@noxlovette/material 0.5.0 → 0.5.1
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/animation/Shapes.stories.svelte +56 -0
- package/dist/animation/Shapes.stories.svelte.d.ts +3 -0
- package/dist/animation/TransitionPatterns.stories.svelte +2 -0
- package/dist/animation/containerTransform.d.ts +9 -0
- package/dist/animation/containerTransform.js +9 -0
- package/dist/animation/enterExit.d.ts +9 -0
- package/dist/animation/enterExit.js +2 -2
- package/dist/animation/index.d.ts +1 -0
- package/dist/animation/index.js +1 -0
- package/dist/animation/shapeMorph.svelte.d.ts +52 -0
- package/dist/animation/shapeMorph.svelte.js +112 -0
- package/dist/animation/shapesAnimatableSmall.d.ts +28 -22
- package/dist/animation/shapesAnimatableSmall.js +32 -23
- package/dist/animation/sharedAxisTransition.d.ts +22 -0
- package/dist/animation/sharedAxisTransition.js +25 -1
- package/dist/animation/skeleton.d.ts +5 -0
- package/dist/animation/skeleton.js +5 -0
- package/dist/components/date/DateField.svelte +38 -24
- package/dist/components/date/DateField.svelte.d.ts +2 -0
- package/dist/components/date/DateRangeField.svelte +42 -28
- package/dist/components/date/DateRangeField.svelte.d.ts +2 -0
- package/dist/components/date/calendarMotion.d.ts +9 -0
- package/dist/components/date/calendarMotion.js +23 -0
- package/dist/components/date/theme.js +5 -1
- package/dist/components/forms/textfield/theme.d.ts +3 -0
- package/dist/components/forms/textfield/theme.js +4 -1
- package/dist/components/nav/tabs/TabHolder.svelte +29 -3
- package/dist/components/nav/tabs/TabHolder.svelte.d.ts +3 -1
- package/dist/components/time/TimeField.svelte +13 -7
- package/dist/components/time/TimeField.svelte.d.ts +6 -0
- package/dist/components/time/TimepickerInput.svelte +8 -4
- package/dist/components/time/types.d.ts +11 -1
- package/dist/utils/icon/loadingShapes.js +11 -10
- package/package.json +1 -1
|
@@ -3,15 +3,19 @@
|
|
|
3
3
|
DateRangeField lets users enter or pick a date range (start + end) via two
|
|
4
4
|
segment inputs and a shared docked calendar.
|
|
5
5
|
|
|
6
|
+
Changing the visible month slides the grid with the M3 lateral transition (see calendarMotion.ts).
|
|
7
|
+
|
|
6
8
|
@see https://m3.material.io/components/date-pickers/guidelines
|
|
7
9
|
-->
|
|
8
10
|
<script lang="ts">
|
|
9
11
|
import { DateRangePicker, Portal, useId } from 'bits-ui';
|
|
12
|
+
import type { DateValue } from '@internationalized/date';
|
|
10
13
|
import { enterExit, presence } from '../../animation/index.js';
|
|
11
14
|
import ButtonIcon from '../buttons/ButtonIcon.svelte';
|
|
12
15
|
import Icon from '../../utils/icon/Icon.svelte';
|
|
13
16
|
import Layer from '../../utils/Layer.svelte';
|
|
14
17
|
import type { DateRangeFieldProps } from './types';
|
|
18
|
+
import { slideMonth } from './calendarMotion.js';
|
|
15
19
|
import { dateCalendar, dateRangeField, dateSegment } from './theme';
|
|
16
20
|
|
|
17
21
|
let {
|
|
@@ -33,6 +37,13 @@ segment inputs and a shared docked calendar.
|
|
|
33
37
|
|
|
34
38
|
const cls = $derived(dateRangeField({ disabled, error, variant }));
|
|
35
39
|
const calendar = dateCalendar();
|
|
40
|
+
|
|
41
|
+
// Starts undefined on purpose: bits-ui writes its own default (from value, else today) through
|
|
42
|
+
// the setter on mount, which is why the getter below can assert.
|
|
43
|
+
let placeholder = $state<DateValue>();
|
|
44
|
+
let grids = $state<HTMLElement | null>(null);
|
|
45
|
+
const setPlaceholder = (next: DateValue) =>
|
|
46
|
+
slideMonth(placeholder, next, grids, (date) => (placeholder = date));
|
|
36
47
|
</script>
|
|
37
48
|
|
|
38
49
|
{#snippet rangeInput(type: 'start' | 'end', fieldLabel: string)}
|
|
@@ -66,6 +77,7 @@ segment inputs and a shared docked calendar.
|
|
|
66
77
|
|
|
67
78
|
<DateRangePicker.Root
|
|
68
79
|
bind:value
|
|
80
|
+
bind:placeholder={() => placeholder as DateValue, setPlaceholder}
|
|
69
81
|
{weekStartsOn}
|
|
70
82
|
{required}
|
|
71
83
|
{disabled}
|
|
@@ -129,37 +141,39 @@ segment inputs and a shared docked calendar.
|
|
|
129
141
|
</div>
|
|
130
142
|
</DateRangePicker.Header>
|
|
131
143
|
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
<DateRangePicker.
|
|
135
|
-
<DateRangePicker.
|
|
136
|
-
{#each weekdays as day, i (i)}
|
|
137
|
-
<DateRangePicker.HeadCell class={calendar.weekday()}>
|
|
138
|
-
{day}
|
|
139
|
-
</DateRangePicker.HeadCell>
|
|
140
|
-
{/each}
|
|
141
|
-
</DateRangePicker.GridRow>
|
|
142
|
-
</DateRangePicker.GridHead>
|
|
143
|
-
<DateRangePicker.GridBody>
|
|
144
|
-
{#each month.weeks as weekDates, i (i)}
|
|
144
|
+
<div bind:this={grids}>
|
|
145
|
+
{#each months as month (month.value.toString())}
|
|
146
|
+
<DateRangePicker.Grid class={calendar.grid()}>
|
|
147
|
+
<DateRangePicker.GridHead>
|
|
145
148
|
<DateRangePicker.GridRow class={calendar.row()}>
|
|
146
|
-
{#each
|
|
147
|
-
<DateRangePicker.
|
|
148
|
-
{
|
|
149
|
-
|
|
150
|
-
class={calendar.cell()}
|
|
151
|
-
>
|
|
152
|
-
<DateRangePicker.Day class={calendar.day()}>
|
|
153
|
-
<Layer />
|
|
154
|
-
{date.day}
|
|
155
|
-
</DateRangePicker.Day>
|
|
156
|
-
</DateRangePicker.Cell>
|
|
149
|
+
{#each weekdays as day, i (i)}
|
|
150
|
+
<DateRangePicker.HeadCell class={calendar.weekday()}>
|
|
151
|
+
{day}
|
|
152
|
+
</DateRangePicker.HeadCell>
|
|
157
153
|
{/each}
|
|
158
154
|
</DateRangePicker.GridRow>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
155
|
+
</DateRangePicker.GridHead>
|
|
156
|
+
<DateRangePicker.GridBody>
|
|
157
|
+
{#each month.weeks as weekDates, i (i)}
|
|
158
|
+
<DateRangePicker.GridRow class={calendar.row()}>
|
|
159
|
+
{#each weekDates as date (date.toString())}
|
|
160
|
+
<DateRangePicker.Cell
|
|
161
|
+
{date}
|
|
162
|
+
month={month.value}
|
|
163
|
+
class={calendar.cell()}
|
|
164
|
+
>
|
|
165
|
+
<DateRangePicker.Day class={calendar.day()}>
|
|
166
|
+
<Layer />
|
|
167
|
+
{date.day}
|
|
168
|
+
</DateRangePicker.Day>
|
|
169
|
+
</DateRangePicker.Cell>
|
|
170
|
+
{/each}
|
|
171
|
+
</DateRangePicker.GridRow>
|
|
172
|
+
{/each}
|
|
173
|
+
</DateRangePicker.GridBody>
|
|
174
|
+
</DateRangePicker.Grid>
|
|
175
|
+
{/each}
|
|
176
|
+
</div>
|
|
163
177
|
{/snippet}
|
|
164
178
|
</DateRangePicker.Calendar>
|
|
165
179
|
</div>
|
|
@@ -3,6 +3,8 @@ import type { DateRangeFieldProps } from './types';
|
|
|
3
3
|
* DateRangeField lets users enter or pick a date range (start + end) via two
|
|
4
4
|
* segment inputs and a shared docked calendar.
|
|
5
5
|
*
|
|
6
|
+
* Changing the visible month slides the grid with the M3 lateral transition (see calendarMotion.ts).
|
|
7
|
+
*
|
|
6
8
|
* @see https://m3.material.io/components/date-pickers/guidelines
|
|
7
9
|
*/
|
|
8
10
|
declare const DateRangeField: import("svelte").Component<DateRangeFieldProps, {}, "value">;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DateValue } from '@internationalized/date';
|
|
2
|
+
/**
|
|
3
|
+
* Applies a new calendar placeholder (the month the grid shows). When the visible month changes
|
|
4
|
+
* while the calendar is open, the grid runs the M3 lateral transition — months are peers, so a
|
|
5
|
+
* later month pushes in from the right and an earlier one from the left. Covers every way the
|
|
6
|
+
* month changes: prev/next buttons, arrow keys past the month edge, picking an outside day.
|
|
7
|
+
* https://m3.material.io/styles/motion/transitions/transition-patterns#lateral
|
|
8
|
+
*/
|
|
9
|
+
export declare const slideMonth: (current: DateValue | undefined, next: DateValue, target: HTMLElement | null | undefined, apply: (next: DateValue) => void) => undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { lateral } from '../../animation/index.js';
|
|
2
|
+
import { tick } from 'svelte';
|
|
3
|
+
const monthIndex = (date) => date.year * 12 + date.month;
|
|
4
|
+
/**
|
|
5
|
+
* Applies a new calendar placeholder (the month the grid shows). When the visible month changes
|
|
6
|
+
* while the calendar is open, the grid runs the M3 lateral transition — months are peers, so a
|
|
7
|
+
* later month pushes in from the right and an earlier one from the left. Covers every way the
|
|
8
|
+
* month changes: prev/next buttons, arrow keys past the month edge, picking an outside day.
|
|
9
|
+
* https://m3.material.io/styles/motion/transitions/transition-patterns#lateral
|
|
10
|
+
*/
|
|
11
|
+
export const slideMonth = (current, next, target, apply) => {
|
|
12
|
+
const update = async () => {
|
|
13
|
+
apply(next);
|
|
14
|
+
await tick();
|
|
15
|
+
};
|
|
16
|
+
if (!current || !target?.isConnected || monthIndex(current) === monthIndex(next)) {
|
|
17
|
+
return void update();
|
|
18
|
+
}
|
|
19
|
+
lateral(update, {
|
|
20
|
+
target,
|
|
21
|
+
direction: monthIndex(next) > monthIndex(current) ? 'forward' : 'backward'
|
|
22
|
+
});
|
|
23
|
+
};
|
|
@@ -264,14 +264,18 @@ export const dateCalendar = tv({
|
|
|
264
264
|
`,
|
|
265
265
|
weekday: `
|
|
266
266
|
flex size-12 items-center justify-center
|
|
267
|
-
md-sys-typescale-body-large text-md-sys-color-on-surface
|
|
267
|
+
md-sys-typescale-body-large font-normal text-md-sys-color-on-surface
|
|
268
268
|
`,
|
|
269
|
+
/* The range band runs behind every day in the range. On the endpoints it covers only the inner
|
|
270
|
+
half, so it meets the selected circle instead of sticking out past it. A one-day range has
|
|
271
|
+
no band. */
|
|
269
272
|
cell: `
|
|
270
273
|
relative flex size-12 items-center justify-center p-0
|
|
271
274
|
before:absolute before:inset-x-0 before:h-10 before:bg-md-sys-color-secondary-container
|
|
272
275
|
before:opacity-0 before:transition-opacity before:md-sys-motion-fast-effects
|
|
273
276
|
data-range-middle:before:opacity-100
|
|
274
277
|
data-highlighted:before:opacity-100
|
|
278
|
+
data-range-start:before:opacity-100 data-range-end:before:opacity-100
|
|
275
279
|
data-range-start:before:left-1/2 data-range-end:before:right-1/2
|
|
276
280
|
data-range-start:data-range-end:before:opacity-0
|
|
277
281
|
data-outside-month:before:opacity-0
|
|
@@ -4,6 +4,7 @@ export declare const textfield: import("tailwind-variants").TVReturnType<{
|
|
|
4
4
|
variant: {
|
|
5
5
|
filled: {
|
|
6
6
|
base: string;
|
|
7
|
+
input: string;
|
|
7
8
|
label: string;
|
|
8
9
|
};
|
|
9
10
|
outlined: {
|
|
@@ -45,6 +46,7 @@ export declare const textfield: import("tailwind-variants").TVReturnType<{
|
|
|
45
46
|
variant: {
|
|
46
47
|
filled: {
|
|
47
48
|
base: string;
|
|
49
|
+
input: string;
|
|
48
50
|
label: string;
|
|
49
51
|
};
|
|
50
52
|
outlined: {
|
|
@@ -86,6 +88,7 @@ export declare const textfield: import("tailwind-variants").TVReturnType<{
|
|
|
86
88
|
variant: {
|
|
87
89
|
filled: {
|
|
88
90
|
base: string;
|
|
91
|
+
input: string;
|
|
89
92
|
label: string;
|
|
90
93
|
};
|
|
91
94
|
outlined: {
|
|
@@ -10,7 +10,7 @@ export const textfield = tv({
|
|
|
10
10
|
relative flex-1 self-stretch flex items-center px-4
|
|
11
11
|
`,
|
|
12
12
|
input: `
|
|
13
|
-
peer w-full
|
|
13
|
+
peer w-full bg-transparent outline-none
|
|
14
14
|
md-sys-typescale-body-large text-md-sys-color-on-surface
|
|
15
15
|
disabled:text-md-sys-color-on-surface/38
|
|
16
16
|
`,
|
|
@@ -78,6 +78,9 @@ export const textfield = tv({
|
|
|
78
78
|
disabled:bg-md-sys-color-on-surface/4
|
|
79
79
|
disabled:after:bg-md-sys-color-on-surface/12
|
|
80
80
|
`,
|
|
81
|
+
/* Room for the label floated inside the container. Outlined labels float into the border
|
|
82
|
+
notch instead, so their input stays vertically centered. */
|
|
83
|
+
input: 'pt-4',
|
|
81
84
|
label: `
|
|
82
85
|
peer-focus:top-2 peer-focus:md-sys-typescale-body-small peer-focus:translate-y-0
|
|
83
86
|
peer-not-placeholder-shown:top-2 peer-not-placeholder-shown:md-sys-typescale-body-small peer-not-placeholder-shown:translate-y-0
|
|
@@ -4,15 +4,18 @@ Material 3 Tabs container.
|
|
|
4
4
|
|
|
5
5
|
Wraps bits-ui Tabs.Root + Tabs.List and renders a sliding active indicator.
|
|
6
6
|
Use TabContent for content-panel tabs; omit it for navigation (href) tabs.
|
|
7
|
+
Switching panels runs the M3 lateral transition: the new panel pushes the old one out in the
|
|
8
|
+
direction of the selected tab.
|
|
7
9
|
|
|
8
10
|
@see https://m3.material.io/components/tabs/overview
|
|
9
11
|
-->
|
|
10
12
|
<script lang="ts">
|
|
13
|
+
import { lateral } from '../../../animation/index.js';
|
|
11
14
|
import { tabHolder } from './theme.js';
|
|
12
15
|
import type { TabHolderProps } from './types.js';
|
|
13
16
|
import Tab from './Tab.svelte';
|
|
14
17
|
import { Tabs } from 'bits-ui';
|
|
15
|
-
import type
|
|
18
|
+
import { tick, type Snippet } from 'svelte';
|
|
16
19
|
|
|
17
20
|
let {
|
|
18
21
|
items,
|
|
@@ -27,9 +30,28 @@ Use TabContent for content-panel tabs; omit it for navigation (href) tabs.
|
|
|
27
30
|
const idx = $derived(items.findIndex((i) => i.value === value));
|
|
28
31
|
const count = $derived(items.length);
|
|
29
32
|
const { base, bar } = $derived(tabHolder({ rounded }));
|
|
33
|
+
|
|
34
|
+
let panels = $state<HTMLElement>();
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Tabs are peers, so switching panels is the M3 lateral transition: the new panel pushes the
|
|
38
|
+
* old one out toward the side of the newly selected tab. Navigation (href) tabs have no panels
|
|
39
|
+
* here — the route change is the app's to animate.
|
|
40
|
+
* https://m3.material.io/styles/motion/transitions/transition-patterns#lateral
|
|
41
|
+
*/
|
|
42
|
+
const select = (next: string) => {
|
|
43
|
+
const from = idx;
|
|
44
|
+
const to = items.findIndex((i) => i.value === next);
|
|
45
|
+
const update = async () => {
|
|
46
|
+
value = next;
|
|
47
|
+
await tick();
|
|
48
|
+
};
|
|
49
|
+
if (!children || !panels || from === -1 || to === -1 || from === to) return void update();
|
|
50
|
+
lateral(update, { target: panels, direction: to > from ? 'forward' : 'backward' });
|
|
51
|
+
};
|
|
30
52
|
</script>
|
|
31
53
|
|
|
32
|
-
<Tabs.Root bind:value {onValueChange} {activationMode}>
|
|
54
|
+
<Tabs.Root bind:value={() => value, select} {onValueChange} {activationMode}>
|
|
33
55
|
<Tabs.List class={base()}>
|
|
34
56
|
{#each items as item (item)}
|
|
35
57
|
<Tab {...item} {variant} />
|
|
@@ -41,5 +63,9 @@ Use TabContent for content-panel tabs; omit it for navigation (href) tabs.
|
|
|
41
63
|
></div>
|
|
42
64
|
</Tabs.List>
|
|
43
65
|
|
|
44
|
-
{
|
|
66
|
+
{#if children}
|
|
67
|
+
<div bind:this={panels}>
|
|
68
|
+
{@render children()}
|
|
69
|
+
</div>
|
|
70
|
+
{/if}
|
|
45
71
|
</Tabs.Root>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TabHolderProps } from './types.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
3
3
|
type $$ComponentProps = TabHolderProps & {
|
|
4
4
|
children?: Snippet;
|
|
5
5
|
};
|
|
@@ -8,6 +8,8 @@ type $$ComponentProps = TabHolderProps & {
|
|
|
8
8
|
*
|
|
9
9
|
* Wraps bits-ui Tabs.Root + Tabs.List and renders a sliding active indicator.
|
|
10
10
|
* Use TabContent for content-panel tabs; omit it for navigation (href) tabs.
|
|
11
|
+
* Switching panels runs the M3 lateral transition: the new panel pushes the old one out in the
|
|
12
|
+
* direction of the selected tab.
|
|
11
13
|
*
|
|
12
14
|
* @see https://m3.material.io/components/tabs/overview
|
|
13
15
|
*/
|
|
@@ -11,9 +11,11 @@ It combines a Material 3 Textfield with a TimepickerInput for intuitive time sel
|
|
|
11
11
|
import Textfield from '../forms/textfield/Textfield.svelte';
|
|
12
12
|
import TimepickerInput from './TimepickerInput.svelte';
|
|
13
13
|
import { Popover } from 'bits-ui';
|
|
14
|
+
import type { Snippet } from 'svelte';
|
|
15
|
+
import type { TimepickerLabels } from './types.js';
|
|
14
16
|
|
|
15
17
|
let {
|
|
16
|
-
label = '
|
|
18
|
+
label = 'Time',
|
|
17
19
|
value = $bindable(),
|
|
18
20
|
required = false,
|
|
19
21
|
disabled = false,
|
|
@@ -21,6 +23,8 @@ It combines a Material 3 Textfield with a TimepickerInput for intuitive time sel
|
|
|
21
23
|
datePickerTitle = 'Pick date',
|
|
22
24
|
name,
|
|
23
25
|
leadingIconProps,
|
|
26
|
+
supportingText,
|
|
27
|
+
pickerLabels,
|
|
24
28
|
...restProps
|
|
25
29
|
}: {
|
|
26
30
|
/** The label for the text field. */
|
|
@@ -39,6 +43,10 @@ It combines a Material 3 Textfield with a TimepickerInput for intuitive time sel
|
|
|
39
43
|
datePickerTitle?: string;
|
|
40
44
|
/** Props for the leading icon. */
|
|
41
45
|
leadingIconProps?: any;
|
|
46
|
+
/** Supporting text under the field. */
|
|
47
|
+
supportingText?: Snippet;
|
|
48
|
+
/** Headline, input and button strings for the picker overlay (English by default). */
|
|
49
|
+
pickerLabels?: TimepickerLabels;
|
|
42
50
|
} & HTMLInputAttributes = $props();
|
|
43
51
|
|
|
44
52
|
const id = $props.id();
|
|
@@ -58,14 +66,11 @@ It combines a Material 3 Textfield with a TimepickerInput for intuitive time sel
|
|
|
58
66
|
{error}
|
|
59
67
|
{leadingIconProps}
|
|
60
68
|
class="pointer-events-none"
|
|
61
|
-
trailingIconProps={{ name: '
|
|
69
|
+
trailingIconProps={{ name: 'schedule' }}
|
|
62
70
|
trailingOnClick={() => !disabled && (picker = !picker)}
|
|
71
|
+
{supportingText}
|
|
63
72
|
{...restProps as any}
|
|
64
|
-
|
|
65
|
-
{#snippet supportingText()}
|
|
66
|
-
ЧЧ-ММ
|
|
67
|
-
{/snippet}
|
|
68
|
-
</Textfield>
|
|
73
|
+
/>
|
|
69
74
|
|
|
70
75
|
<Popover.Trigger {disabled}>
|
|
71
76
|
{#snippet child({ props })}
|
|
@@ -100,6 +105,7 @@ It combines a Material 3 Textfield with a TimepickerInput for intuitive time sel
|
|
|
100
105
|
{@attach presence(() => open, enterExit.scale)}
|
|
101
106
|
>
|
|
102
107
|
<TimepickerInput
|
|
108
|
+
{...pickerLabels}
|
|
103
109
|
time={value}
|
|
104
110
|
close={() => (picker = false)}
|
|
105
111
|
setTime={(t) => (value = t)}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { TimepickerLabels } from './types.js';
|
|
2
4
|
type $$ComponentProps = {
|
|
3
5
|
/** The label for the text field. */
|
|
4
6
|
label?: string;
|
|
@@ -16,6 +18,10 @@ type $$ComponentProps = {
|
|
|
16
18
|
datePickerTitle?: string;
|
|
17
19
|
/** Props for the leading icon. */
|
|
18
20
|
leadingIconProps?: any;
|
|
21
|
+
/** Supporting text under the field. */
|
|
22
|
+
supportingText?: Snippet;
|
|
23
|
+
/** Headline, input and button strings for the picker overlay (English by default). */
|
|
24
|
+
pickerLabels?: TimepickerLabels;
|
|
19
25
|
} & HTMLInputAttributes;
|
|
20
26
|
/**
|
|
21
27
|
* TimeField component provides a text input that opens a Timepicker overlay when interacted with.
|
|
@@ -15,7 +15,11 @@ It follows the Material 3 design for time input pickers.
|
|
|
15
15
|
import { ButtonIcon } from '../buttons/index.js';
|
|
16
16
|
|
|
17
17
|
const {
|
|
18
|
-
label = '
|
|
18
|
+
label = 'Enter time',
|
|
19
|
+
hourLabel = 'Hour',
|
|
20
|
+
minuteLabel = 'Minute',
|
|
21
|
+
cancelText = 'Cancel',
|
|
22
|
+
confirmText = 'OK',
|
|
19
23
|
time = '09:41',
|
|
20
24
|
close,
|
|
21
25
|
setTime,
|
|
@@ -48,7 +52,7 @@ It follows the Material 3 design for time input pickers.
|
|
|
48
52
|
{value}
|
|
49
53
|
</TimeField.Segment>
|
|
50
54
|
<p class={cls.timeInputSupportingText()}>
|
|
51
|
-
{part === 'hour' ?
|
|
55
|
+
{part === 'hour' ? hourLabel : minuteLabel}
|
|
52
56
|
</p>
|
|
53
57
|
</div>
|
|
54
58
|
{/if}
|
|
@@ -61,7 +65,7 @@ It follows the Material 3 design for time input pickers.
|
|
|
61
65
|
<div class={cls.buttonDiv()}>
|
|
62
66
|
<ButtonIcon type="button" iconProps={{ name: 'schedule' }} />
|
|
63
67
|
<div>
|
|
64
|
-
<Button variant="text" type="button" onclick={() => close()}
|
|
68
|
+
<Button variant="text" type="button" onclick={() => close()}>{cancelText}</Button>
|
|
65
69
|
<Button
|
|
66
70
|
variant="text"
|
|
67
71
|
type="button"
|
|
@@ -69,7 +73,7 @@ It follows the Material 3 design for time input pickers.
|
|
|
69
73
|
setTime(output);
|
|
70
74
|
close();
|
|
71
75
|
}}
|
|
72
|
-
data-cy="calendar-time-confirm"
|
|
76
|
+
data-cy="calendar-time-confirm">{confirmText}</Button
|
|
73
77
|
>
|
|
74
78
|
</div>
|
|
75
79
|
</div>
|
|
@@ -9,9 +9,17 @@ import type { TimepickerVariants } from './theme.js';
|
|
|
9
9
|
export type TimepickerProps = TimepickerVariants & HTMLAttributes<HTMLInputElement> & {
|
|
10
10
|
/**
|
|
11
11
|
* The label displayed at the top of the timepicker.
|
|
12
|
-
* @default '
|
|
12
|
+
* @default 'Enter time'
|
|
13
13
|
*/
|
|
14
14
|
label?: string;
|
|
15
|
+
/** Supporting text under the hour input. @default 'Hour' */
|
|
16
|
+
hourLabel?: string;
|
|
17
|
+
/** Supporting text under the minute input. @default 'Minute' */
|
|
18
|
+
minuteLabel?: string;
|
|
19
|
+
/** Label of the dismiss button. @default 'Cancel' */
|
|
20
|
+
cancelText?: string;
|
|
21
|
+
/** Label of the confirm button. @default 'OK' */
|
|
22
|
+
confirmText?: string;
|
|
15
23
|
/**
|
|
16
24
|
* The current time value in HH:MM format.
|
|
17
25
|
* @default '09:41'
|
|
@@ -32,3 +40,5 @@ export type TimepickerProps = TimepickerVariants & HTMLAttributes<HTMLInputEleme
|
|
|
32
40
|
*/
|
|
33
41
|
setTime: (time: string) => void;
|
|
34
42
|
};
|
|
43
|
+
/** The TimepickerInput strings a TimeField forwards to its picker overlay. */
|
|
44
|
+
export type TimepickerLabels = Partial<Pick<TimepickerProps, 'label' | 'hourLabel' | 'minuteLabel' | 'cancelText' | 'confirmText'>>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { pathAnimatableSmallFourSidedCookie, pathAnimatableSmallNineSidedCookie, pathAnimatableSmallOval, pathAnimatableSmallPentagon, pathAnimatableSmallPill, pathAnimatableSmallSoftBurst, pathAnimatableSmallSunny } from '../../animation/shapesAnimatableSmall.js';
|
|
1
2
|
/*
|
|
2
|
-
The seven shapes the M3 loading indicator morphs through, in a 48 × 48 viewBox.
|
|
3
|
-
the same command structure (120 relative points)
|
|
4
|
-
two.
|
|
3
|
+
The seven shapes the M3 loading indicator morphs through, in a 48 × 48 viewBox. They come from the
|
|
4
|
+
small animatable set, so every path has the same command structure (120 relative points) and
|
|
5
|
+
Motion's `mix` can interpolate between any two.
|
|
5
6
|
https://m3.material.io/components/loading-indicator/specs
|
|
6
7
|
*/
|
|
7
8
|
export const LOADING_SHAPES = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
pathAnimatableSmallSoftBurst,
|
|
10
|
+
pathAnimatableSmallNineSidedCookie,
|
|
11
|
+
pathAnimatableSmallPentagon,
|
|
12
|
+
pathAnimatableSmallPill,
|
|
13
|
+
pathAnimatableSmallSunny,
|
|
14
|
+
pathAnimatableSmallFourSidedCookie,
|
|
15
|
+
pathAnimatableSmallOval
|
|
15
16
|
];
|