Skip to content

Commit

Permalink
Merge branch 'v5/develop' into v6/develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	panel/package-lock.json
#	panel/package.json
  • Loading branch information
distantnative committed Jun 1, 2024
2 parents 2d01791 + ab16b33 commit fd48891
Show file tree
Hide file tree
Showing 150 changed files with 3,195 additions and 2,226 deletions.
11 changes: 10 additions & 1 deletion config/areas/languages/views.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
return App::instance()->option('languages.variables', true) !== false;
},
'action' => function (string $code) {
$kirby = App::instance();
$language = Find::language($code);
$link = '/languages/' . $language->code();
$strings = [];
$foundation = App::instance()->defaultLanguage()->translations();
$foundation = $kirby->defaultLanguage()->translations();
$translations = $language->translations();

ksort($foundation);
Expand Down Expand Up @@ -67,6 +68,11 @@
]
],
'props' => [
'buttons' => $kirby->option('panel.viewButtons.language', [
'preview',
'settings',
'remove'
]),
'deletable' => $language->isDeletable(),
'code' => Escape::html($language->code()),
'default' => $language->isDefault(),
Expand Down Expand Up @@ -107,6 +113,9 @@
return [
'component' => 'k-languages-view',
'props' => [
'buttons' => $kirby->option('panel.viewButtons.languages', [
'add'
]),
'languages' => $kirby->languages()->values(fn ($language) => [
'deletable' => $language->isDeletable(),
'default' => $language->isDefault(),
Expand Down
1 change: 1 addition & 0 deletions config/areas/system/views.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
return [
'component' => 'k-system-view',
'props' => [
'buttons' => $kirby->option('panel.viewButtons.system', []),
'environment' => $environment,
'exceptions' => $kirby->option('debug') === true ? $exceptions : [],
'info' => $system->info(),
Expand Down
5 changes: 4 additions & 1 deletion config/areas/users/views.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
return [
'component' => 'k-users-view',
'props' => [
'role' => function () use ($kirby, $roles, $role) {
'buttons' => $kirby->option('panel.viewButtons.users', [
'add'
]),
'role' => function () use ($roles, $role) {
if ($role) {
return $roles[$role] ?? null;
}
Expand Down
3 changes: 2 additions & 1 deletion config/fields/radio.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
],
'computed' => [
'default' => function () {
return $this->sanitizeOption($this->default);
$default = $this->model()->toString($this->default);
return $this->sanitizeOption($default);
},
'value' => function () {
return $this->sanitizeOption($this->value) ?? '';
Expand Down
2 changes: 1 addition & 1 deletion config/fields/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
return $icon;
},
/**
* Custom placeholder string for empty option.
* Text shown when no option is selected yet
*/
'placeholder' => function (string $placeholder = '') {
return $placeholder;
Expand Down
9 changes: 2 additions & 7 deletions panel/lab/components/inputs/select/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,8 @@
/>
</k-lab-example>

<k-lab-example label="Empty: false">
<k-select-input
:empty="false"
:options="options"
:value="value"
@input="value = $event"
/>
<k-lab-example label="No empty option">
<k-select-input :required="true" :options="options" value="b" />
</k-lab-example>

<k-lab-example label="Multiple: true">
Expand Down
5 changes: 5 additions & 0 deletions panel/lab/components/login/1_login-form/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'docs' => 'k-login-form'
];
26 changes: 26 additions & 0 deletions panel/lab/components/login/1_login-form/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<k-lab-examples>
<k-lab-example label="Default">
<k-login-form />
</k-lab-example>
<k-lab-example label="With password">
<k-login-form :methods="['password']" />
</k-lab-example>
<k-lab-example label="Prefilled">
<k-login-form
:methods="['password']"
:value="{
email: '[email protected]',
password: 'password1',
remember: true
}"
/>
</k-lab-example>
<k-lab-example label="Toggle between login methods">
<k-login-form :methods="['password', 'code']" />
</k-lab-example>
<k-lab-example label="Password reset">
<k-login-form :methods="['password', 'password-reset']" />
</k-lab-example>
</k-lab-examples>
</template>
5 changes: 5 additions & 0 deletions panel/lab/components/login/2_login-code-form/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'docs' => 'k-login-code-form'
];
15 changes: 15 additions & 0 deletions panel/lab/components/login/2_login-code-form/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<k-lab-examples>
<k-lab-example label="Default">
<k-login-code-form />
</k-lab-example>
<k-lab-example label="Prefilled">
<k-login-code-form value="123456" />
</k-lab-example>
<k-lab-example label="Pending info">
<k-login-code-form
:pending="{ email: '[email protected]', challenge: 'totp' }"
/>
</k-lab-example>
</k-lab-examples>
</template>
5 changes: 5 additions & 0 deletions panel/lab/components/uploads/1_upload-items/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'docs' => 'k-upload-items',
];
54 changes: 54 additions & 0 deletions panel/lab/components/uploads/1_upload-items/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<template>
<k-lab-examples>
<k-lab-example label="Upload Items">
<k-upload-items :items="items" @remove="remove" @rename="rename" />
</k-lab-example>
</k-lab-examples>
</template>

<script>
export default {
computed: {
items() {
return [
{
extension: "jpeg",
type: "image/jpeg",
name: "test",
niceSize: "128 KB",
url: "https://picsum.photos/200/200"
},
{
extension: "pdf",
type: "application/pdf",
name: "document",
niceSize: "1.5 MB",
url: "/some.pdf"
},
{
extension: "mp4",
type: "video/mp4",
name: "screencast",
niceSize: "3 GB",
url: "/some.mp4"
},
{
extension: "mp3",
type: "audio/mp3",
name: "song",
niceSize: "2.5 MB",
url: "/some.mp3"
}
];
}
},
methods: {
remove(file) {
console.log("Remove", { file });
},
rename(file, name) {
console.log("Rename", { file, name });
}
}
};
</script>
5 changes: 5 additions & 0 deletions panel/lab/components/uploads/2_upload-item/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'docs' => 'k-upload-item',
];
74 changes: 74 additions & 0 deletions panel/lab/components/uploads/2_upload-item/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<template>
<k-lab-examples>
<k-lab-example label="Upload Item">
<k-upload-item
extension="jpeg"
type="image/jpeg"
name="test"
niceSize="128 kB"
url="https://picsum.photos/200/200"
@remove="remove"
@rename="rename"
/>
</k-lab-example>
<k-lab-example label="Progress">
<k-upload-item
:progress="80"
extension="jpeg"
type="image/jpeg"
name="test"
niceSize="128 kB"
url="https://picsum.photos/200/200"
@remove="remove"
@rename="rename"
/>
</k-lab-example>
<k-lab-example label="Completed">
<k-upload-item
:completed="true"
extension="jpeg"
type="image/jpeg"
name="test"
niceSize="128 kB"
url="https://picsum.photos/200/200"
@remove="remove"
@rename="rename"
/>
</k-lab-example>
<k-lab-example label="Not editable">
<k-upload-item
:editable="false"
extension="jpeg"
type="image/jpeg"
name="test"
niceSize="128 kB"
url="https://picsum.photos/200/200"
/>
</k-lab-example>
<k-lab-example label="Error">
<k-upload-item
extension="jpeg"
type="image/jpeg"
name="test"
niceSize="128 kB"
error="The file could not be uploaded"
url="https://picsum.photos/200/200"
@remove="remove"
@rename="rename"
/>
</k-lab-example>
</k-lab-examples>
</template>

<script>
export default {
methods: {
remove() {
console.log("Remove");
},
rename(name) {
console.log("Rename to", name);
}
}
};
</script>
5 changes: 5 additions & 0 deletions panel/lab/components/uploads/3_upload-item-preview/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'docs' => 'k-upload-item-preview',
];
34 changes: 34 additions & 0 deletions panel/lab/components/uploads/3_upload-item-preview/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<template>
<k-lab-examples>
<k-lab-example label="Image with preview">
<k-upload-item-preview
type="image/jpeg"
url="https://picsum.photos/200/200"
/>
</k-lab-example>
<k-lab-example label="Image without preview">
<k-upload-item-preview
type="image/bitmap"
url="https://picsum.photos/200/200"
/>
</k-lab-example>
<k-lab-example label="Audio">
<k-upload-item-preview type="audio/mp3" url="/some.mp3" />
</k-lab-example>
<k-lab-example label="Video">
<k-upload-item-preview type="video/mp4" url="/some.mp4" />
</k-lab-example>
<k-lab-example label="Icon">
<k-upload-item-preview icon="image" url="/some.mp4" />
</k-lab-example>
<k-lab-example label="Color">
<k-upload-item-preview color="pink-500" icon="heart" url="/some.mp4" />
</k-lab-example>
</k-lab-examples>
</template>

<style>
.k-lab-example .k-upload-item-preview {
width: 6rem;
}
</style>
Loading

0 comments on commit fd48891

Please sign in to comment.