rimecms 1.4.3 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fields/radio/component/Radio.svelte +19 -1
- package/dist/fields/radio/index.d.ts +23 -6
- package/dist/fields/radio/index.js +13 -1
- package/dist/panel/components/sections/document/AutoSaveBanner.svelte +1 -1
- package/dist/panel/components/sections/document/Document.svelte +4 -13
- package/dist/panel/components/sections/document/DocumentChildren.svelte +1 -1
- package/dist/panel/components/ui/page-header/PageHeader.svelte +3 -9
- package/dist/panel/components/ui/radio-card-group/index.d.ts +3 -0
- package/dist/panel/components/ui/radio-card-group/index.js +3 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group-item.svelte +30 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group-item.svelte.d.ts +9 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group.css +80 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group.svelte +18 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group.svelte.d.ts +5 -0
- package/dist/panel/components/ui/radio-row-group/radio-row-group.css +5 -3
- package/dist/panel/style/index.css +0 -12
- package/dist/panel/style/scheme.css +0 -12
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { fieldset } from '../../../panel/components/fields/fieldset.svelte.js';
|
|
3
3
|
import { Field } from '../../../panel/components/fields/index.js';
|
|
4
4
|
import { Label } from '../../../panel/components/ui/label/index.js';
|
|
5
|
+
import * as RadioCardGroup from '../../../panel/components/ui/radio-card-group/index.js';
|
|
5
6
|
import * as RadioGroup from '../../../panel/components/ui/radio-group/index.js';
|
|
6
7
|
import * as RadioRowGroup from '../../../panel/components/ui/radio-row-group/index.js';
|
|
7
8
|
import { capitalize, slugify } from '../../../util/string.js';
|
|
@@ -33,6 +34,23 @@
|
|
|
33
34
|
</div>
|
|
34
35
|
{/each}
|
|
35
36
|
</RadioRowGroup.Root>
|
|
37
|
+
{:else if config.get.layout === 'cards'}
|
|
38
|
+
<RadioCardGroup.Root
|
|
39
|
+
aria-label={config.get.label}
|
|
40
|
+
bind:value={field.value}
|
|
41
|
+
disabled={!field.editable}
|
|
42
|
+
>
|
|
43
|
+
{#each config.get.options as option, index (index)}
|
|
44
|
+
<RadioCardGroup.Item
|
|
45
|
+
value={option.value}
|
|
46
|
+
id="{fieldId}-{index}"
|
|
47
|
+
thumbnail={option.thumbnail}
|
|
48
|
+
class="rz-radio__input"
|
|
49
|
+
>
|
|
50
|
+
{option.label || capitalize(option.value)}
|
|
51
|
+
</RadioCardGroup.Item>
|
|
52
|
+
{/each}
|
|
53
|
+
</RadioCardGroup.Root>
|
|
36
54
|
{:else}
|
|
37
55
|
<RadioGroup.Root
|
|
38
56
|
aria-label={config.get.label}
|
|
@@ -56,7 +74,7 @@
|
|
|
56
74
|
</fieldset>
|
|
57
75
|
|
|
58
76
|
<style>
|
|
59
|
-
.rz-field-radio
|
|
77
|
+
.rz-field-radio--default {
|
|
60
78
|
display: flex;
|
|
61
79
|
flex-direction: column;
|
|
62
80
|
|
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
import type { DefaultValueFn, FormField, Option } from '../types.js';
|
|
2
|
+
import type { Component } from 'svelte';
|
|
2
3
|
import { PickOneFieldBuilder } from '../../core/fields/builders/select-builder.js';
|
|
3
4
|
export declare class RadioFieldBuilder extends PickOneFieldBuilder<RadioField> {
|
|
4
5
|
constructor(name: string);
|
|
5
|
-
get component():
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
get component(): Component<import("./component/props.js").RadioFieldProps, {}, "">;
|
|
7
|
+
/**
|
|
8
|
+
* `row` shows the options as one segmented row, `default` as a list of radios, `cards` as a grid
|
|
9
|
+
* of cards, each option's thumbnail above its label.
|
|
10
|
+
*/
|
|
11
|
+
layout(value: 'default' | 'row' | 'cards'): this;
|
|
12
|
+
/**
|
|
13
|
+
* The options to pick from. With the `cards` layout, an option may carry a thumbnail: a Svelte
|
|
14
|
+
* component drawn above its label.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* import HeroSplit from './thumbnails/HeroSplit.svelte'
|
|
18
|
+
* radio('layout').layout('cards').options({ value: 'split', label: 'Côte à côte', thumbnail: HeroSplit })
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
options(...options: (RadioOption | string)[]): this;
|
|
9
22
|
protected generateType(): string;
|
|
10
23
|
}
|
|
11
24
|
export declare const radio: (name: string) => RadioFieldBuilder;
|
|
12
25
|
/****************************************************/
|
|
26
|
+
/** An option, with the thumbnail its card shows in the `cards` layout. */
|
|
27
|
+
export type RadioOption = Option & {
|
|
28
|
+
thumbnail?: Component;
|
|
29
|
+
};
|
|
13
30
|
export type RadioField = FormField & {
|
|
14
31
|
type: 'radio';
|
|
15
|
-
options:
|
|
16
|
-
layout: 'row' | 'default';
|
|
32
|
+
options: RadioOption[];
|
|
33
|
+
layout: 'row' | 'default' | 'cards';
|
|
17
34
|
defaultValue: string | DefaultValueFn<string>;
|
|
18
35
|
many: false;
|
|
19
36
|
};
|
|
@@ -9,11 +9,23 @@ export class RadioFieldBuilder extends PickOneFieldBuilder {
|
|
|
9
9
|
get component() {
|
|
10
10
|
return Radio;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* `row` shows the options as one segmented row, `default` as a list of radios, `cards` as a grid
|
|
14
|
+
* of cards, each option's thumbnail above its label.
|
|
15
|
+
*/
|
|
13
16
|
layout(value) {
|
|
14
17
|
this.field.layout = value;
|
|
15
18
|
return this;
|
|
16
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The options to pick from. With the `cards` layout, an option may carry a thumbnail: a Svelte
|
|
22
|
+
* component drawn above its label.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* import HeroSplit from './thumbnails/HeroSplit.svelte'
|
|
26
|
+
* radio('layout').layout('cards').options({ value: 'split', label: 'Côte à côte', thumbnail: HeroSplit })
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
17
29
|
options(...options) {
|
|
18
30
|
super.options(...options);
|
|
19
31
|
// A radio starts on one of its options: its first, unless its default is one of them
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
display: grid;
|
|
107
107
|
gap: var(--rz-size-2);
|
|
108
108
|
padding-block: var(--rz-size-3);
|
|
109
|
-
padding-inline:
|
|
109
|
+
padding-inline: var(--rz-page-gutter);
|
|
110
110
|
background-color: var(--rz-bg-page);
|
|
111
111
|
}
|
|
112
112
|
.rz-auto-save-banner {
|
|
@@ -413,32 +413,23 @@
|
|
|
413
413
|
</form>
|
|
414
414
|
|
|
415
415
|
<style>
|
|
416
|
-
|
|
417
|
-
* The document: a centred column, its heading lined up with its fields.
|
|
418
|
-
*
|
|
419
|
-
* --rz-document-width: the column, 40rem
|
|
420
|
-
*/
|
|
416
|
+
/* The document: its heading lined up with its fields. */
|
|
421
417
|
.rz-document {
|
|
422
|
-
--rz-page-width: var(--rz-document-width, 40rem);
|
|
423
418
|
container: rz-document / inline-size;
|
|
424
419
|
position: relative;
|
|
425
420
|
display: flex;
|
|
426
421
|
flex-direction: column;
|
|
427
422
|
}
|
|
428
423
|
|
|
429
|
-
/* A page of its own is at least the window's height, so the metas sit at its bottom.
|
|
430
|
-
edge glows, as tall as the window whatever the page's length. */
|
|
424
|
+
/* A page of its own is at least the window's height, so the metas sit at its bottom. */
|
|
431
425
|
.rz-document:not([data-nested]) {
|
|
432
426
|
min-height: 100svh;
|
|
433
|
-
background-image: var(--rz-glow);
|
|
434
|
-
background-repeat: no-repeat;
|
|
435
|
-
background-size: 100% 100svh;
|
|
436
427
|
}
|
|
437
428
|
|
|
438
|
-
/* The
|
|
429
|
+
/* The full width inside the page's gutter, where the dashboard and the collection list start. */
|
|
439
430
|
.rz-document__fields,
|
|
440
431
|
.rz-document__infos {
|
|
441
|
-
padding-inline:
|
|
432
|
+
padding-inline: var(--rz-page-gutter);
|
|
442
433
|
}
|
|
443
434
|
|
|
444
435
|
.rz-document__fields {
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
display: grid;
|
|
104
104
|
gap: var(--rz-size-3);
|
|
105
105
|
padding-block: var(--rz-size-6) var(--rz-size-10);
|
|
106
|
-
padding-inline:
|
|
106
|
+
padding-inline: var(--rz-page-gutter);
|
|
107
107
|
border-top: 1px solid var(--rz-border);
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
height: var(--rz-size-11);
|
|
81
81
|
margin-bottom: var(--rz-size-6);
|
|
82
82
|
padding-inline: var(--rz-size-5) var(--rz-size-3);
|
|
83
|
-
/* See-through
|
|
83
|
+
/* See-through: what scrolls under it blurs. */
|
|
84
84
|
background: oklch(from var(--rz-bg-page) l c h / 0.8);
|
|
85
85
|
backdrop-filter: blur(12px);
|
|
86
86
|
box-shadow: inset 0 -1px 0 var(--rz-border);
|
|
@@ -103,16 +103,10 @@
|
|
|
103
103
|
justify-content: flex-end;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
/*
|
|
107
|
-
* The title and the toolbar line up with a page's content. A page narrows it with
|
|
108
|
-
* `--rz-page-width`; else it runs the full width, inside the gutter.
|
|
109
|
-
*/
|
|
106
|
+
/* The title and the toolbar line up with a page's content: the full width, inside the gutter. */
|
|
110
107
|
.rz-page-header__head,
|
|
111
108
|
.rz-page-header__toolbar {
|
|
112
|
-
padding-inline:
|
|
113
|
-
var(--rz-page-gutter, var(--rz-size-6)),
|
|
114
|
-
calc((100% - var(--rz-page-width, 100%)) / 2)
|
|
115
|
-
);
|
|
109
|
+
padding-inline: var(--rz-page-gutter, var(--rz-size-6));
|
|
116
110
|
}
|
|
117
111
|
|
|
118
112
|
.rz-page-header__head {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RadioGroup as RadioGroupPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
|
3
|
+
import type { Component, Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
/** A card: its thumbnail, when it has one, above its label. */
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
thumbnail: Thumbnail,
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithoutChildrenOrChild<RadioGroupPrimitive.ItemProps> & {
|
|
13
|
+
thumbnail?: Component;
|
|
14
|
+
children: Snippet;
|
|
15
|
+
} = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<RadioGroupPrimitive.Item
|
|
19
|
+
bind:ref
|
|
20
|
+
class="rz-radio-card-group-item {className}"
|
|
21
|
+
data-thumbnail={Thumbnail ? '' : null}
|
|
22
|
+
{...restProps}
|
|
23
|
+
>
|
|
24
|
+
{#if Thumbnail}
|
|
25
|
+
<span class="rz-radio-card-group-item__frame">
|
|
26
|
+
<Thumbnail />
|
|
27
|
+
</span>
|
|
28
|
+
{/if}
|
|
29
|
+
<span class="rz-radio-card-group-item__label">{@render children()}</span>
|
|
30
|
+
</RadioGroupPrimitive.Item>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RadioGroup as RadioGroupPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
type $$ComponentProps = WithoutChildrenOrChild<RadioGroupPrimitive.ItemProps> & {
|
|
4
|
+
thumbnail?: Component;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
};
|
|
7
|
+
declare const RadioCardGroupItem: Component<$$ComponentProps, {}, "ref">;
|
|
8
|
+
type RadioCardGroupItem = ReturnType<typeof RadioCardGroupItem>;
|
|
9
|
+
export default RadioCardGroupItem;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* As many cards per line as fit, each at least --rz-size-40 wide. */
|
|
2
|
+
.rz-radio-card-group {
|
|
3
|
+
display: grid;
|
|
4
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--rz-size-40), 1fr));
|
|
5
|
+
gap: var(--rz-size-2-5);
|
|
6
|
+
|
|
7
|
+
&[data-disabled] {
|
|
8
|
+
opacity: 0.4;
|
|
9
|
+
cursor: not-allowed;
|
|
10
|
+
button {
|
|
11
|
+
cursor: not-allowed;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* A raised card, muted until hovered or checked. */
|
|
17
|
+
.rz-radio-card-group-item {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: var(--rz-size-1-5);
|
|
21
|
+
min-width: 0;
|
|
22
|
+
padding: var(--rz-size-1-5) var(--rz-size-1-5) var(--rz-size-2);
|
|
23
|
+
background-color: var(--rz-bg-raised);
|
|
24
|
+
box-shadow:
|
|
25
|
+
0 0 0 1px var(--rz-border),
|
|
26
|
+
var(--rz-shadow-raised, 0 0 transparent);
|
|
27
|
+
border-radius: var(--rz-radius-xl);
|
|
28
|
+
color: var(--rz-fg-muted);
|
|
29
|
+
font-size: var(--rz-text-sm);
|
|
30
|
+
text-align: left;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
outline: none;
|
|
33
|
+
|
|
34
|
+
&:hover,
|
|
35
|
+
&[data-state='checked'] {
|
|
36
|
+
background-image: linear-gradient(var(--rz-bg-hover) 0 0);
|
|
37
|
+
color: var(--rz-fg);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&[data-state='checked'] {
|
|
41
|
+
box-shadow: 0 0 0 1px var(--rz-accent-border);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:focus-visible {
|
|
45
|
+
outline: 2px solid var(--rz-accent-border);
|
|
46
|
+
outline-offset: 2px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Without a thumbnail, the label spans the card's width, its text in the middle. */
|
|
50
|
+
&:not([data-thumbnail]) {
|
|
51
|
+
justify-content: center;
|
|
52
|
+
text-align: center;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* 16:10, the thumbnail filling it. */
|
|
57
|
+
.rz-radio-card-group-item__frame {
|
|
58
|
+
display: block;
|
|
59
|
+
aspect-ratio: 16 / 10;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
border-radius: var(--rz-radius-lg);
|
|
62
|
+
background-color: var(--rz-bg-well);
|
|
63
|
+
color: var(--rz-fg-subtle);
|
|
64
|
+
|
|
65
|
+
> svg {
|
|
66
|
+
display: block;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.rz-radio-card-group-item:is(:hover, [data-state='checked']) .rz-radio-card-group-item__frame {
|
|
73
|
+
color: var(--rz-fg-muted);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.rz-radio-card-group-item__label {
|
|
77
|
+
padding-inline: var(--rz-size-1);
|
|
78
|
+
font-variation-settings: 'wght' 500;
|
|
79
|
+
font-weight: 500;
|
|
80
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RadioGroup as RadioGroupPrimitive } from 'bits-ui';
|
|
3
|
+
import './radio-card-group.css';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
value = $bindable(''),
|
|
9
|
+
...restProps
|
|
10
|
+
}: RadioGroupPrimitive.RootProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<RadioGroupPrimitive.Root
|
|
14
|
+
bind:ref
|
|
15
|
+
bind:value
|
|
16
|
+
class="rz-radio-card-group {className}"
|
|
17
|
+
{...restProps}
|
|
18
|
+
/>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RadioGroup as RadioGroupPrimitive } from 'bits-ui';
|
|
2
|
+
import './radio-card-group.css';
|
|
3
|
+
declare const RadioCardGroup: import("svelte").Component<RadioGroupPrimitive.RootProps, {}, "value" | "ref">;
|
|
4
|
+
type RadioCardGroup = ReturnType<typeof RadioCardGroup>;
|
|
5
|
+
export default RadioCardGroup;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
.rz-radio-row-group {
|
|
2
2
|
display: flex;
|
|
3
|
+
flex-wrap: wrap;
|
|
3
4
|
justify-content: space-between;
|
|
4
5
|
align-self: flex-start;
|
|
5
6
|
width: auto;
|
|
@@ -9,8 +10,7 @@
|
|
|
9
10
|
border-color: var(--rz-border-strong);
|
|
10
11
|
}
|
|
11
12
|
border-radius: var(--rz-radius-lg);
|
|
12
|
-
|
|
13
|
-
height: var(--rz-input-height);
|
|
13
|
+
min-height: var(--rz-input-height);
|
|
14
14
|
padding: var(--rz-size-0-5);
|
|
15
15
|
|
|
16
16
|
&[data-disabled] {
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
padding: 0 var(--rz-size-4);
|
|
34
34
|
background-color: transparent;
|
|
35
35
|
border-radius: var(--rz-radius-md);
|
|
36
|
-
|
|
36
|
+
/* One line of the row: the input height less the well's padding. */
|
|
37
|
+
height: var(--rz-size-8);
|
|
38
|
+
white-space: nowrap;
|
|
37
39
|
color: var(--rz-fg-muted);
|
|
38
40
|
font-variation-settings: 'wght' 500;
|
|
39
41
|
font-weight: 500;
|
|
@@ -602,13 +602,6 @@ video {
|
|
|
602
602
|
|
|
603
603
|
/* shadows: only what floats over the page casts one */
|
|
604
604
|
--rz-shadow-float: 0 16px 36px -12px oklch(from var(--rz-gray-0) l c h / 0.16);
|
|
605
|
-
|
|
606
|
-
/* gradients */
|
|
607
|
-
--rz-glow: radial-gradient(
|
|
608
|
-
70% 38% at 50% 0%,
|
|
609
|
-
oklch(from var(--rz-accent-solid) l c h / 0.035),
|
|
610
|
-
transparent
|
|
611
|
-
);
|
|
612
605
|
}
|
|
613
606
|
|
|
614
607
|
@media (prefers-color-scheme: dark) {
|
|
@@ -639,11 +632,6 @@ video {
|
|
|
639
632
|
--rz-ring: oklch(from var(--rz-accent-soft) l c h / 0.2);
|
|
640
633
|
|
|
641
634
|
--rz-shadow-float: 0 16px 40px -12px oklch(from var(--rz-gray-0) l c h / 0.6);
|
|
642
|
-
--rz-glow: radial-gradient(
|
|
643
|
-
70% 38% at 50% 0%,
|
|
644
|
-
oklch(from var(--rz-accent-solid) l c h / 0.07),
|
|
645
|
-
transparent
|
|
646
|
-
);
|
|
647
635
|
}
|
|
648
636
|
}
|
|
649
637
|
|
|
@@ -42,13 +42,6 @@
|
|
|
42
42
|
|
|
43
43
|
/* shadows: only what floats over the page casts one */
|
|
44
44
|
--rz-shadow-float: 0 16px 36px -12px oklch(from var(--rz-gray-0) l c h / 0.16);
|
|
45
|
-
|
|
46
|
-
/* gradients */
|
|
47
|
-
--rz-glow: radial-gradient(
|
|
48
|
-
70% 38% at 50% 0%,
|
|
49
|
-
oklch(from var(--rz-accent-solid) l c h / 0.035),
|
|
50
|
-
transparent
|
|
51
|
-
);
|
|
52
45
|
}
|
|
53
46
|
|
|
54
47
|
@media (prefers-color-scheme: dark) {
|
|
@@ -79,10 +72,5 @@
|
|
|
79
72
|
--rz-ring: oklch(from var(--rz-accent-soft) l c h / 0.2);
|
|
80
73
|
|
|
81
74
|
--rz-shadow-float: 0 16px 40px -12px oklch(from var(--rz-gray-0) l c h / 0.6);
|
|
82
|
-
--rz-glow: radial-gradient(
|
|
83
|
-
70% 38% at 50% 0%,
|
|
84
|
-
oklch(from var(--rz-accent-solid) l c h / 0.07),
|
|
85
|
-
transparent
|
|
86
|
-
);
|
|
87
75
|
}
|
|
88
76
|
}
|