@human-kit/ui 1.0.0-beta.6 → 1.0.0-beta.8
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/FOCUS_STATE_CONTRACT.md +15 -4
- package/dist/FOCUS_STATE_REVIEW_TEMPLATE.md +8 -8
- package/dist/autocomplete/item/autocomplete-item.svelte +10 -0
- package/dist/avatar/README.md +52 -0
- package/dist/avatar/count/avatar-count.svelte +56 -0
- package/dist/avatar/count/avatar-count.svelte.d.ts +4 -0
- package/dist/avatar/fallback/avatar-fallback.svelte +67 -0
- package/dist/avatar/fallback/avatar-fallback.svelte.d.ts +4 -0
- package/dist/avatar/group/avatar-group.svelte +65 -0
- package/dist/avatar/group/avatar-group.svelte.d.ts +4 -0
- package/dist/avatar/group/context.d.ts +15 -0
- package/dist/avatar/group/context.js +15 -0
- package/dist/avatar/image/avatar-image.svelte +104 -0
- package/dist/avatar/image/avatar-image.svelte.d.ts +4 -0
- package/dist/avatar/index.d.ts +22 -0
- package/dist/avatar/index.js +10 -0
- package/dist/avatar/index.parts.d.ts +5 -0
- package/dist/avatar/index.parts.js +5 -0
- package/dist/avatar/root/avatar-root.svelte +79 -0
- package/dist/avatar/root/avatar-root.svelte.d.ts +4 -0
- package/dist/avatar/root/context.d.ts +14 -0
- package/dist/avatar/root/context.js +15 -0
- package/dist/avatar/types.d.ts +84 -0
- package/dist/avatar/types.js +1 -0
- package/dist/breadcrumbs/README.md +65 -0
- package/dist/breadcrumbs/ellipsis/breadcrumbs-ellipsis.svelte +62 -0
- package/dist/breadcrumbs/ellipsis/breadcrumbs-ellipsis.svelte.d.ts +4 -0
- package/dist/breadcrumbs/index.d.ts +23 -0
- package/dist/breadcrumbs/index.js +10 -0
- package/dist/breadcrumbs/index.parts.d.ts +6 -0
- package/dist/breadcrumbs/index.parts.js +6 -0
- package/dist/breadcrumbs/item/breadcrumbs-item.svelte +42 -0
- package/dist/breadcrumbs/item/breadcrumbs-item.svelte.d.ts +4 -0
- package/dist/breadcrumbs/link/breadcrumbs-link.svelte +47 -0
- package/dist/breadcrumbs/link/breadcrumbs-link.svelte.d.ts +4 -0
- package/dist/breadcrumbs/list/breadcrumbs-list.svelte +31 -0
- package/dist/breadcrumbs/list/breadcrumbs-list.svelte.d.ts +4 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.svelte +112 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.svelte.d.ts +4 -0
- package/dist/breadcrumbs/root/context.d.ts +19 -0
- package/dist/breadcrumbs/root/context.js +15 -0
- package/dist/breadcrumbs/separator/breadcrumbs-separator.svelte +35 -0
- package/dist/breadcrumbs/separator/breadcrumbs-separator.svelte.d.ts +4 -0
- package/dist/breadcrumbs/types.d.ts +80 -0
- package/dist/breadcrumbs/types.js +1 -0
- package/dist/button/root/button-root.svelte +9 -0
- package/dist/calendar/body-cell/calendar-body-cell.svelte +7 -0
- package/dist/checkbox/indicator/checkbox-indicator.svelte +1 -0
- package/dist/checkbox/indicator/checkbox-indicator.svelte.d.ts +1 -0
- package/dist/checkbox/root/checkbox-root.svelte +106 -30
- package/dist/checkbox/root/checkbox-root.svelte.d.ts +5 -0
- package/dist/checkbox-group/README.md +95 -0
- package/dist/checkbox-group/index.d.ts +15 -0
- package/dist/checkbox-group/index.js +6 -0
- package/dist/checkbox-group/index.parts.d.ts +4 -0
- package/dist/checkbox-group/index.parts.js +7 -0
- package/dist/checkbox-group/label/checkbox-group-label.svelte +36 -0
- package/dist/checkbox-group/label/checkbox-group-label.svelte.d.ts +4 -0
- package/dist/checkbox-group/root/checkbox-group-root.svelte +118 -0
- package/dist/checkbox-group/root/checkbox-group-root.svelte.d.ts +4 -0
- package/dist/checkbox-group/root/context.svelte.d.ts +52 -0
- package/dist/checkbox-group/root/context.svelte.js +251 -0
- package/dist/checkbox-group/types.d.ts +57 -0
- package/dist/checkbox-group/types.js +1 -0
- package/dist/combobox/popover/combobox-popover.svelte +4 -56
- package/dist/dialog/root/dialog-root.svelte +15 -2
- package/dist/drawer/root/drawer-root.svelte +15 -2
- package/dist/index.d.ts +18 -0
- package/dist/index.js +17 -0
- package/dist/internal/localized-strings.d.ts +48 -0
- package/dist/internal/localized-strings.js +48 -0
- package/dist/internal/number-precision.d.ts +9 -0
- package/dist/internal/number-precision.js +27 -0
- package/dist/menu/root/focus-state.d.ts +2 -2
- package/dist/menu/root/focus-state.js +8 -32
- package/dist/menu/root/menu-state.svelte.js +5 -1
- package/dist/numberfield/root/number-utils.js +1 -20
- package/dist/popover/root/focus-state.d.ts +2 -2
- package/dist/popover/root/focus-state.js +7 -34
- package/dist/primitives/contain-wheel.d.ts +9 -0
- package/dist/primitives/contain-wheel.js +41 -0
- package/dist/primitives/floating.d.ts +6 -0
- package/dist/primitives/floating.js +26 -5
- package/dist/primitives/focus-visible.svelte.d.ts +14 -0
- package/dist/primitives/focus-visible.svelte.js +19 -0
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.js +1 -0
- package/dist/primitives/input-modality.d.ts +7 -0
- package/dist/primitives/input-modality.js +32 -5
- package/dist/primitives/keyboard-navigation.d.ts +6 -0
- package/dist/primitives/keyboard-navigation.js +2 -1
- package/dist/primitives/trigger-focus-state.d.ts +29 -0
- package/dist/primitives/trigger-focus-state.js +57 -0
- package/dist/progress/README.md +54 -0
- package/dist/progress/index.d.ts +21 -0
- package/dist/progress/index.js +9 -0
- package/dist/progress/index.parts.d.ts +5 -0
- package/dist/progress/index.parts.js +5 -0
- package/dist/progress/indicator/progress-indicator.svelte +37 -0
- package/dist/progress/indicator/progress-indicator.svelte.d.ts +4 -0
- package/dist/progress/label/progress-label.svelte +34 -0
- package/dist/progress/label/progress-label.svelte.d.ts +4 -0
- package/dist/progress/root/context.d.ts +26 -0
- package/dist/progress/root/context.js +15 -0
- package/dist/progress/root/progress-root.svelte +136 -0
- package/dist/progress/root/progress-root.svelte.d.ts +4 -0
- package/dist/progress/root/progress-utils.d.ts +12 -0
- package/dist/progress/root/progress-utils.js +41 -0
- package/dist/progress/track/progress-track.svelte +27 -0
- package/dist/progress/track/progress-track.svelte.d.ts +4 -0
- package/dist/progress/types.d.ts +81 -0
- package/dist/progress/types.js +1 -0
- package/dist/progress/value/progress-value.svelte +36 -0
- package/dist/progress/value/progress-value.svelte.d.ts +4 -0
- package/dist/radio-group/README.md +103 -0
- package/dist/radio-group/index.d.ts +18 -0
- package/dist/radio-group/index.js +9 -0
- package/dist/radio-group/index.parts.d.ts +4 -0
- package/dist/radio-group/index.parts.js +4 -0
- package/dist/radio-group/indicator/radio-group-indicator.svelte +43 -0
- package/dist/radio-group/indicator/radio-group-indicator.svelte.d.ts +12 -0
- package/dist/radio-group/item/context.d.ts +18 -0
- package/dist/radio-group/item/context.js +15 -0
- package/dist/radio-group/item/radio-group-item.svelte +377 -0
- package/dist/radio-group/item/radio-group-item.svelte.d.ts +35 -0
- package/dist/radio-group/label/radio-group-label.svelte +37 -0
- package/dist/radio-group/label/radio-group-label.svelte.d.ts +4 -0
- package/dist/radio-group/root/context.svelte.d.ts +57 -0
- package/dist/radio-group/root/context.svelte.js +284 -0
- package/dist/radio-group/root/radio-group-root.svelte +193 -0
- package/dist/radio-group/root/radio-group-root.svelte.d.ts +4 -0
- package/dist/radio-group/types.d.ts +50 -0
- package/dist/radio-group/types.js +1 -0
- package/dist/select/README.md +129 -0
- package/dist/select/index.d.ts +30 -0
- package/dist/select/index.js +16 -0
- package/dist/select/index.parts.d.ts +8 -0
- package/dist/select/index.parts.js +9 -0
- package/dist/select/item/select-item.svelte +68 -0
- package/dist/select/item/select-item.svelte.d.ts +10 -0
- package/dist/select/item-indicator/select-item-indicator.svelte +55 -0
- package/dist/select/item-indicator/select-item-indicator.svelte.d.ts +4 -0
- package/dist/select/label/select-label.svelte +46 -0
- package/dist/select/label/select-label.svelte.d.ts +4 -0
- package/dist/select/list/select-list.svelte +241 -0
- package/dist/select/list/select-list.svelte.d.ts +62 -0
- package/dist/select/popover/select-popover.svelte +80 -0
- package/dist/select/popover/select-popover.svelte.d.ts +9 -0
- package/dist/select/root/context.d.ts +106 -0
- package/dist/select/root/context.js +22 -0
- package/dist/select/root/select-root.svelte +544 -0
- package/dist/select/root/select-root.svelte.d.ts +25 -0
- package/dist/select/trigger/select-trigger.svelte +192 -0
- package/dist/select/trigger/select-trigger.svelte.d.ts +4 -0
- package/dist/select/types.d.ts +133 -0
- package/dist/select/types.js +1 -0
- package/dist/select/value/select-value.svelte +61 -0
- package/dist/select/value/select-value.svelte.d.ts +4 -0
- package/dist/separator/README.md +35 -0
- package/dist/separator/index.d.ts +7 -0
- package/dist/separator/index.js +3 -0
- package/dist/separator/separator.svelte +254 -0
- package/dist/separator/separator.svelte.d.ts +45 -0
- package/dist/separator/types.d.ts +1 -0
- package/dist/separator/types.js +1 -0
- package/dist/slider/README.md +61 -0
- package/dist/slider/fill/slider-fill.svelte +40 -0
- package/dist/slider/fill/slider-fill.svelte.d.ts +4 -0
- package/dist/slider/index.d.ts +9 -0
- package/dist/slider/index.js +8 -0
- package/dist/slider/index.parts.d.ts +6 -0
- package/dist/slider/index.parts.js +6 -0
- package/dist/slider/label/slider-label.svelte +44 -0
- package/dist/slider/label/slider-label.svelte.d.ts +4 -0
- package/dist/slider/output/slider-output.svelte +46 -0
- package/dist/slider/output/slider-output.svelte.d.ts +4 -0
- package/dist/slider/root/context.d.ts +106 -0
- package/dist/slider/root/context.js +15 -0
- package/dist/slider/root/slider-root.svelte +545 -0
- package/dist/slider/root/slider-root.svelte.d.ts +4 -0
- package/dist/slider/root/slider-utils.d.ts +57 -0
- package/dist/slider/root/slider-utils.js +88 -0
- package/dist/slider/thumb/slider-thumb.svelte +276 -0
- package/dist/slider/thumb/slider-thumb.svelte.d.ts +4 -0
- package/dist/slider/track/slider-track.svelte +60 -0
- package/dist/slider/track/slider-track.svelte.d.ts +4 -0
- package/dist/slider/types.d.ts +144 -0
- package/dist/slider/types.js +1 -0
- package/dist/switch/root/switch-root.svelte +9 -0
- package/dist/table/column-header-cell/table-column-header-cell.svelte +24 -0
- package/dist/table/root/table-root.svelte +29 -6
- package/dist/timepicker/input/time-picker-input.svelte +12 -4
- package/dist/timepicker/input/time-picker-input.svelte.d.ts +12 -4
- package/dist/toggle/root/toggle-root.svelte +28 -0
- package/dist/toggle/root/toggle-root.svelte.d.ts +19 -0
- package/dist/toggle-group/README.md +6 -4
- package/dist/toggle-group/index.d.ts +2 -0
- package/dist/toggle-group/index.parts.d.ts +1 -0
- package/dist/toggle-group/index.parts.js +4 -0
- package/dist/tooltip/README.md +53 -0
- package/dist/tooltip/arrow/tooltip-arrow.svelte +36 -0
- package/dist/tooltip/arrow/tooltip-arrow.svelte.d.ts +4 -0
- package/dist/tooltip/content/tooltip-content.svelte +148 -0
- package/dist/tooltip/content/tooltip-content.svelte.d.ts +4 -0
- package/dist/tooltip/index.d.ts +8 -0
- package/dist/tooltip/index.js +7 -0
- package/dist/tooltip/index.parts.d.ts +5 -0
- package/dist/tooltip/index.parts.js +5 -0
- package/dist/tooltip/provider/tooltip-provider.svelte +36 -0
- package/dist/tooltip/provider/tooltip-provider.svelte.d.ts +4 -0
- package/dist/tooltip/root/context.d.ts +46 -0
- package/dist/tooltip/root/context.js +22 -0
- package/dist/tooltip/root/safe-polygon.d.ts +26 -0
- package/dist/tooltip/root/safe-polygon.js +66 -0
- package/dist/tooltip/root/tooltip-group.d.ts +26 -0
- package/dist/tooltip/root/tooltip-group.js +41 -0
- package/dist/tooltip/root/tooltip-root.svelte +454 -0
- package/dist/tooltip/root/tooltip-root.svelte.d.ts +4 -0
- package/dist/tooltip/trigger/tooltip-trigger.svelte +52 -0
- package/dist/tooltip/trigger/tooltip-trigger.svelte.d.ts +4 -0
- package/dist/tooltip/types.d.ts +105 -0
- package/dist/tooltip/types.js +1 -0
- package/package.json +46 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export { Accordion } from './accordion/index.js';
|
|
2
2
|
export { Autocomplete } from './autocomplete/index.js';
|
|
3
|
+
export { Avatar } from './avatar/index.js';
|
|
4
|
+
export { Breadcrumbs } from './breadcrumbs/index.js';
|
|
3
5
|
export { Button } from './button/index.js';
|
|
4
6
|
export { Checkbox } from './checkbox/index.js';
|
|
7
|
+
export { CheckboxGroup } from './checkbox-group/index.js';
|
|
5
8
|
export { Collapsible } from './collapsible/index.js';
|
|
6
9
|
export { ComboBox } from './combobox/index.js';
|
|
7
10
|
export { Calendar } from './calendar/index.js';
|
|
@@ -15,7 +18,12 @@ export { ListBox } from './listbox/index.js';
|
|
|
15
18
|
export { Menu } from './menu/index.js';
|
|
16
19
|
export { NumberField } from './numberfield/index.js';
|
|
17
20
|
export { Popover } from './popover/index.js';
|
|
21
|
+
export { Progress } from './progress/index.js';
|
|
22
|
+
export { RadioGroup } from './radio-group/index.js';
|
|
23
|
+
export { Select } from './select/index.js';
|
|
24
|
+
export { Slider } from './slider/index.js';
|
|
18
25
|
export { Switch } from './switch/index.js';
|
|
26
|
+
export { Tooltip } from './tooltip/index.js';
|
|
19
27
|
export { Table } from './table/index.js';
|
|
20
28
|
export { Tabs } from './tabs/index.js';
|
|
21
29
|
export { Toggle } from './toggle/index.js';
|
|
@@ -24,16 +32,21 @@ export { TransferList } from './transfer-list/index.js';
|
|
|
24
32
|
export { Tree } from './tree/index.js';
|
|
25
33
|
export { default as Input } from './input/index.js';
|
|
26
34
|
export { default as Label } from './label/index.js';
|
|
35
|
+
export { default as Separator } from './separator/index.js';
|
|
27
36
|
export { default as Dropzone } from './dropzone/index.js';
|
|
28
37
|
export { default as LocaleProvider } from './locale-provider/index.js';
|
|
29
38
|
export { Portal } from './portal/index.js';
|
|
30
39
|
export { OverflowRow, type OverflowRowState } from './overflow-row/index.js';
|
|
31
40
|
export { default as TextArea } from './textarea/index.js';
|
|
32
41
|
export * from './locale-provider/index.js';
|
|
42
|
+
export type { SeparatorOrientation, SeparatorProps } from './separator/index.js';
|
|
33
43
|
export * from './accordion/index.js';
|
|
34
44
|
export * from './autocomplete/index.js';
|
|
35
45
|
export * from './button/index.js';
|
|
36
46
|
export * from './checkbox/index.js';
|
|
47
|
+
export * from './checkbox-group/index.js';
|
|
48
|
+
export * from './avatar/index.js';
|
|
49
|
+
export * from './breadcrumbs/index.js';
|
|
37
50
|
export * from './collapsible/index.js';
|
|
38
51
|
export * from './combobox/index.js';
|
|
39
52
|
export * from './calendar/index.js';
|
|
@@ -48,7 +61,12 @@ export * from './listbox/index.js';
|
|
|
48
61
|
export * from './menu/index.js';
|
|
49
62
|
export * from './numberfield/index.js';
|
|
50
63
|
export * from './popover/index.js';
|
|
64
|
+
export * from './progress/index.js';
|
|
65
|
+
export * from './radio-group/index.js';
|
|
66
|
+
export * from './select/index.js';
|
|
67
|
+
export * from './slider/index.js';
|
|
51
68
|
export * from './switch/index.js';
|
|
69
|
+
export * from './tooltip/index.js';
|
|
52
70
|
export * from './table/index.js';
|
|
53
71
|
export * from './tabs/index.js';
|
|
54
72
|
export * from './toggle/index.js';
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
// Components (namespace exports)
|
|
3
3
|
export { Accordion } from './accordion/index.js';
|
|
4
4
|
export { Autocomplete } from './autocomplete/index.js';
|
|
5
|
+
export { Avatar } from './avatar/index.js';
|
|
6
|
+
export { Breadcrumbs } from './breadcrumbs/index.js';
|
|
5
7
|
export { Button } from './button/index.js';
|
|
6
8
|
export { Checkbox } from './checkbox/index.js';
|
|
9
|
+
export { CheckboxGroup } from './checkbox-group/index.js';
|
|
7
10
|
export { Collapsible } from './collapsible/index.js';
|
|
8
11
|
export { ComboBox } from './combobox/index.js';
|
|
9
12
|
export { Calendar } from './calendar/index.js';
|
|
@@ -17,7 +20,12 @@ export { ListBox } from './listbox/index.js';
|
|
|
17
20
|
export { Menu } from './menu/index.js';
|
|
18
21
|
export { NumberField } from './numberfield/index.js';
|
|
19
22
|
export { Popover } from './popover/index.js';
|
|
23
|
+
export { Progress } from './progress/index.js';
|
|
24
|
+
export { RadioGroup } from './radio-group/index.js';
|
|
25
|
+
export { Select } from './select/index.js';
|
|
26
|
+
export { Slider } from './slider/index.js';
|
|
20
27
|
export { Switch } from './switch/index.js';
|
|
28
|
+
export { Tooltip } from './tooltip/index.js';
|
|
21
29
|
export { Table } from './table/index.js';
|
|
22
30
|
export { Tabs } from './tabs/index.js';
|
|
23
31
|
export { Toggle } from './toggle/index.js';
|
|
@@ -27,6 +35,7 @@ export { Tree } from './tree/index.js';
|
|
|
27
35
|
// Simple components
|
|
28
36
|
export { default as Input } from './input/index.js';
|
|
29
37
|
export { default as Label } from './label/index.js';
|
|
38
|
+
export { default as Separator } from './separator/index.js';
|
|
30
39
|
export { default as Dropzone } from './dropzone/index.js';
|
|
31
40
|
export { default as LocaleProvider } from './locale-provider/index.js';
|
|
32
41
|
export { Portal } from './portal/index.js';
|
|
@@ -38,6 +47,9 @@ export * from './accordion/index.js';
|
|
|
38
47
|
export * from './autocomplete/index.js';
|
|
39
48
|
export * from './button/index.js';
|
|
40
49
|
export * from './checkbox/index.js';
|
|
50
|
+
export * from './checkbox-group/index.js';
|
|
51
|
+
export * from './avatar/index.js';
|
|
52
|
+
export * from './breadcrumbs/index.js';
|
|
41
53
|
export * from './collapsible/index.js';
|
|
42
54
|
export * from './combobox/index.js';
|
|
43
55
|
export * from './calendar/index.js';
|
|
@@ -52,7 +64,12 @@ export * from './listbox/index.js';
|
|
|
52
64
|
export * from './menu/index.js';
|
|
53
65
|
export * from './numberfield/index.js';
|
|
54
66
|
export * from './popover/index.js';
|
|
67
|
+
export * from './progress/index.js';
|
|
68
|
+
export * from './radio-group/index.js';
|
|
69
|
+
export * from './select/index.js';
|
|
70
|
+
export * from './slider/index.js';
|
|
55
71
|
export * from './switch/index.js';
|
|
72
|
+
export * from './tooltip/index.js';
|
|
56
73
|
export * from './table/index.js';
|
|
57
74
|
export * from './tabs/index.js';
|
|
58
75
|
export * from './toggle/index.js';
|
|
@@ -24,6 +24,30 @@ declare const LOCALIZED_STRINGS: {
|
|
|
24
24
|
readonly de: "Vorherige Seite";
|
|
25
25
|
readonly it: "Pagina precedente";
|
|
26
26
|
};
|
|
27
|
+
readonly 'select.placeholder': {
|
|
28
|
+
readonly en: "Select an option";
|
|
29
|
+
readonly es: "Seleccione una opción";
|
|
30
|
+
readonly pt: "Selecione uma opção";
|
|
31
|
+
readonly fr: "Sélectionnez une option";
|
|
32
|
+
readonly de: "Option auswählen";
|
|
33
|
+
readonly it: "Seleziona un’opzione";
|
|
34
|
+
};
|
|
35
|
+
readonly 'slider.minimum': {
|
|
36
|
+
readonly en: "Minimum";
|
|
37
|
+
readonly es: "Mínimo";
|
|
38
|
+
readonly pt: "Mínimo";
|
|
39
|
+
readonly fr: "Minimum";
|
|
40
|
+
readonly de: "Minimum";
|
|
41
|
+
readonly it: "Minimo";
|
|
42
|
+
};
|
|
43
|
+
readonly 'slider.maximum': {
|
|
44
|
+
readonly en: "Maximum";
|
|
45
|
+
readonly es: "Máximo";
|
|
46
|
+
readonly pt: "Máximo";
|
|
47
|
+
readonly fr: "Maximum";
|
|
48
|
+
readonly de: "Maximum";
|
|
49
|
+
readonly it: "Massimo";
|
|
50
|
+
};
|
|
27
51
|
readonly 'datePicker.calendar': {
|
|
28
52
|
readonly en: "Calendar";
|
|
29
53
|
readonly es: "Calendario";
|
|
@@ -304,6 +328,30 @@ declare const LOCALIZED_STRINGS: {
|
|
|
304
328
|
readonly de: "{count} Elemente nach {label} verschoben";
|
|
305
329
|
readonly it: "{count} elementi spostati in {label}";
|
|
306
330
|
};
|
|
331
|
+
readonly 'avatar.more': {
|
|
332
|
+
readonly en: "{count} more";
|
|
333
|
+
readonly es: "{count} más";
|
|
334
|
+
readonly pt: "{count} mais";
|
|
335
|
+
readonly fr: "{count} de plus";
|
|
336
|
+
readonly de: "{count} weitere";
|
|
337
|
+
readonly it: "{count} altri";
|
|
338
|
+
};
|
|
339
|
+
readonly 'breadcrumbs.label': {
|
|
340
|
+
readonly en: "Breadcrumb";
|
|
341
|
+
readonly es: "Ruta de navegación";
|
|
342
|
+
readonly pt: "Trilha de navegação";
|
|
343
|
+
readonly fr: "Fil d'Ariane";
|
|
344
|
+
readonly de: "Brotkrumennavigation";
|
|
345
|
+
readonly it: "Percorso di navigazione";
|
|
346
|
+
};
|
|
347
|
+
readonly 'breadcrumbs.showMore': {
|
|
348
|
+
readonly en: "Show {count} more pages";
|
|
349
|
+
readonly es: "Mostrar {count} páginas más";
|
|
350
|
+
readonly pt: "Mostrar mais {count} páginas";
|
|
351
|
+
readonly fr: "Afficher {count} pages de plus";
|
|
352
|
+
readonly de: "{count} weitere Seiten anzeigen";
|
|
353
|
+
readonly it: "Mostra altre {count} pagine";
|
|
354
|
+
};
|
|
307
355
|
readonly 'segment.empty': {
|
|
308
356
|
readonly en: "Empty";
|
|
309
357
|
readonly es: "Vacío";
|
|
@@ -24,6 +24,30 @@ const LOCALIZED_STRINGS = {
|
|
|
24
24
|
de: 'Vorherige Seite',
|
|
25
25
|
it: 'Pagina precedente'
|
|
26
26
|
},
|
|
27
|
+
'select.placeholder': {
|
|
28
|
+
en: 'Select an option',
|
|
29
|
+
es: 'Seleccione una opción',
|
|
30
|
+
pt: 'Selecione uma opção',
|
|
31
|
+
fr: 'Sélectionnez une option',
|
|
32
|
+
de: 'Option auswählen',
|
|
33
|
+
it: 'Seleziona un’opzione'
|
|
34
|
+
},
|
|
35
|
+
'slider.minimum': {
|
|
36
|
+
en: 'Minimum',
|
|
37
|
+
es: 'Mínimo',
|
|
38
|
+
pt: 'Mínimo',
|
|
39
|
+
fr: 'Minimum',
|
|
40
|
+
de: 'Minimum',
|
|
41
|
+
it: 'Minimo'
|
|
42
|
+
},
|
|
43
|
+
'slider.maximum': {
|
|
44
|
+
en: 'Maximum',
|
|
45
|
+
es: 'Máximo',
|
|
46
|
+
pt: 'Máximo',
|
|
47
|
+
fr: 'Maximum',
|
|
48
|
+
de: 'Maximum',
|
|
49
|
+
it: 'Massimo'
|
|
50
|
+
},
|
|
27
51
|
'datePicker.calendar': {
|
|
28
52
|
en: 'Calendar',
|
|
29
53
|
es: 'Calendario',
|
|
@@ -304,6 +328,30 @@ const LOCALIZED_STRINGS = {
|
|
|
304
328
|
de: '{count} Elemente nach {label} verschoben',
|
|
305
329
|
it: '{count} elementi spostati in {label}'
|
|
306
330
|
},
|
|
331
|
+
'avatar.more': {
|
|
332
|
+
en: '{count} more',
|
|
333
|
+
es: '{count} más',
|
|
334
|
+
pt: '{count} mais',
|
|
335
|
+
fr: '{count} de plus',
|
|
336
|
+
de: '{count} weitere',
|
|
337
|
+
it: '{count} altri'
|
|
338
|
+
},
|
|
339
|
+
'breadcrumbs.label': {
|
|
340
|
+
en: 'Breadcrumb',
|
|
341
|
+
es: 'Ruta de navegación',
|
|
342
|
+
pt: 'Trilha de navegação',
|
|
343
|
+
fr: "Fil d'Ariane",
|
|
344
|
+
de: 'Brotkrumennavigation',
|
|
345
|
+
it: 'Percorso di navigazione'
|
|
346
|
+
},
|
|
347
|
+
'breadcrumbs.showMore': {
|
|
348
|
+
en: 'Show {count} more pages',
|
|
349
|
+
es: 'Mostrar {count} páginas más',
|
|
350
|
+
pt: 'Mostrar mais {count} páginas',
|
|
351
|
+
fr: 'Afficher {count} pages de plus',
|
|
352
|
+
de: '{count} weitere Seiten anzeigen',
|
|
353
|
+
it: 'Mostra altre {count} pagine'
|
|
354
|
+
},
|
|
307
355
|
'segment.empty': {
|
|
308
356
|
en: 'Empty',
|
|
309
357
|
es: 'Vacío',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decimal digits of a number, also for a number written with an exponent: `1e-7` has 7.
|
|
3
|
+
*/
|
|
4
|
+
export declare function decimalPlaces(value: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* Rounds a number to a count of decimal digits, and removes the float error of an arithmetic
|
|
7
|
+
* step: `0.1 + 0.2` at one digit is `0.3`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function roundToPrecision(value: number, precision: number): number;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decimal digits of a number, also for a number written with an exponent: `1e-7` has 7.
|
|
3
|
+
*/
|
|
4
|
+
export function decimalPlaces(value) {
|
|
5
|
+
if (!Number.isFinite(value))
|
|
6
|
+
return 0;
|
|
7
|
+
const text = value.toString().toLowerCase();
|
|
8
|
+
if (!text.includes('e')) {
|
|
9
|
+
return text.split('.')[1]?.length ?? 0;
|
|
10
|
+
}
|
|
11
|
+
const [coefficient, exponentText] = text.split('e');
|
|
12
|
+
const exponent = Number(exponentText);
|
|
13
|
+
const coefficientDecimals = coefficient.split('.')[1]?.length ?? 0;
|
|
14
|
+
return Math.max(0, coefficientDecimals - exponent);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Rounds a number to a count of decimal digits, and removes the float error of an arithmetic
|
|
18
|
+
* step: `0.1 + 0.2` at one digit is `0.3`.
|
|
19
|
+
*/
|
|
20
|
+
export function roundToPrecision(value, precision) {
|
|
21
|
+
const factor = 10 ** Math.min(precision, 12);
|
|
22
|
+
// Round on the absolute value and reapply the sign so ties resolve
|
|
23
|
+
// away from zero symmetrically: 0.025 → 0.03 and -0.025 → -0.03
|
|
24
|
+
// (Math.round alone rounds -0.025 toward +Infinity, giving -0.02).
|
|
25
|
+
const rounded = Math.round((Math.abs(value) + Number.EPSILON) * factor) / factor;
|
|
26
|
+
return value < 0 ? -rounded : rounded;
|
|
27
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { MenuInternalCloseReason } from './context';
|
|
2
|
-
|
|
2
|
+
import { addTriggerBlurCleanup, clearTriggerFocusState } from '../../primitives/trigger-focus-state';
|
|
3
|
+
export { addTriggerBlurCleanup, clearTriggerFocusState };
|
|
3
4
|
export declare function applyTriggerCloseFocusState(trigger: HTMLElement, reason: MenuInternalCloseReason, event?: Event): void;
|
|
4
|
-
export declare function addTriggerBlurCleanup(trigger: HTMLElement, once?: boolean): () => void;
|
|
@@ -1,34 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { applyTriggerCloseFocusState as applyTriggerCloseFocusStateShared, addTriggerBlurCleanup, clearTriggerFocusState } from '../../primitives/trigger-focus-state';
|
|
2
|
+
export { addTriggerBlurCleanup, clearTriggerFocusState };
|
|
3
|
+
// Every reason the menu schedules returns the focus to the trigger, except an outside press:
|
|
4
|
+
// there the shared primitive returns it only when the press left the focus on nothing.
|
|
5
|
+
// 'submenu-back' (ArrowLeft) styles the submenu trigger exactly like an Escape.
|
|
6
6
|
export function applyTriggerCloseFocusState(trigger, reason, event) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (reason === 'outside-press' || reason === 'escape-key' || reason === 'submenu-back') {
|
|
11
|
-
trigger.dataset.focused = 'true';
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
delete trigger.dataset.focused;
|
|
15
|
-
}
|
|
16
|
-
if (closeModality === 'keyboard') {
|
|
17
|
-
trigger.dataset.focusVisible = 'true';
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
delete trigger.dataset.focusVisible;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export function addTriggerBlurCleanup(trigger, once = false) {
|
|
24
|
-
const handleBlur = () => {
|
|
25
|
-
clearTriggerFocusState(trigger);
|
|
26
|
-
if (once) {
|
|
27
|
-
trigger.removeEventListener('blur', handleBlur);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
trigger.addEventListener('blur', handleBlur);
|
|
31
|
-
return () => {
|
|
32
|
-
trigger.removeEventListener('blur', handleBlur);
|
|
33
|
-
};
|
|
7
|
+
applyTriggerCloseFocusStateShared(trigger, reason, event, {
|
|
8
|
+
refocus: reason !== 'outside-press'
|
|
9
|
+
});
|
|
34
10
|
}
|
|
@@ -120,7 +120,11 @@ export function createMenuState(options) {
|
|
|
120
120
|
const triggerRef = options.getTriggerRef();
|
|
121
121
|
if (!triggerRef)
|
|
122
122
|
return;
|
|
123
|
-
|
|
123
|
+
// An outside press is handled by the root menu alone: the focus state decides whether
|
|
124
|
+
// the press left the focus on nothing, and a submenu trigger sits inside content that
|
|
125
|
+
// is already closing.
|
|
126
|
+
const outsidePressOnRoot = reason === 'outside-press' && options.parent === null;
|
|
127
|
+
if (!TRIGGER_REFOCUS_REASONS.includes(reason) && !outsidePressOnRoot)
|
|
124
128
|
return;
|
|
125
129
|
// The INTERNAL reason drives the trigger focus visuals ('submenu-back' styles like an
|
|
126
130
|
// Escape); only the reason reported to consumers is canonicalized.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { decimalPlaces, roundToPrecision } from '../../internal/number-precision';
|
|
1
2
|
const bidiControlPattern = /[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;
|
|
2
3
|
const whitespacePattern = /[\s\u00a0\u202f]/g;
|
|
3
4
|
function escapeRegExp(value) {
|
|
@@ -147,26 +148,6 @@ function normalizeLocalizedNumber(input, locale) {
|
|
|
147
148
|
}
|
|
148
149
|
return normalized;
|
|
149
150
|
}
|
|
150
|
-
function decimalPlaces(value) {
|
|
151
|
-
if (!Number.isFinite(value))
|
|
152
|
-
return 0;
|
|
153
|
-
const text = value.toString().toLowerCase();
|
|
154
|
-
if (!text.includes('e')) {
|
|
155
|
-
return text.split('.')[1]?.length ?? 0;
|
|
156
|
-
}
|
|
157
|
-
const [coefficient, exponentText] = text.split('e');
|
|
158
|
-
const exponent = Number(exponentText);
|
|
159
|
-
const coefficientDecimals = coefficient.split('.')[1]?.length ?? 0;
|
|
160
|
-
return Math.max(0, coefficientDecimals - exponent);
|
|
161
|
-
}
|
|
162
|
-
function roundToPrecision(value, precision) {
|
|
163
|
-
const factor = 10 ** Math.min(precision, 12);
|
|
164
|
-
// Round on the absolute value and reapply the sign so ties resolve
|
|
165
|
-
// away from zero symmetrically: 0.025 → 0.03 and -0.025 → -0.03
|
|
166
|
-
// (Math.round alone rounds -0.025 toward +Infinity, giving -0.02).
|
|
167
|
-
const rounded = Math.round((Math.abs(value) + Number.EPSILON) * factor) / factor;
|
|
168
|
-
return value < 0 ? -rounded : rounded;
|
|
169
|
-
}
|
|
170
151
|
export function roundNumberValueToFormat(value, locale, formatOptions) {
|
|
171
152
|
if (!Number.isFinite(value))
|
|
172
153
|
return value;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PopoverCloseReason } from './context';
|
|
2
|
-
|
|
2
|
+
import { addTriggerBlurCleanup, clearTriggerFocusState, focusFellToBody } from '../../primitives/trigger-focus-state';
|
|
3
|
+
export { addTriggerBlurCleanup, clearTriggerFocusState, focusFellToBody };
|
|
3
4
|
export declare function shouldRefocusTriggerOnClose(reason: PopoverCloseReason): boolean;
|
|
4
5
|
export declare function applyTriggerCloseFocusState(trigger: HTMLElement, reason: PopoverCloseReason, event?: Event): void;
|
|
5
|
-
export declare function addTriggerBlurCleanup(trigger: HTMLElement, once?: boolean): () => void;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
delete trigger.dataset.focused;
|
|
4
|
-
delete trigger.dataset.focusVisible;
|
|
5
|
-
}
|
|
1
|
+
import { applyTriggerCloseFocusState as applyTriggerCloseFocusStateShared, addTriggerBlurCleanup, clearTriggerFocusState, focusFellToBody } from '../../primitives/trigger-focus-state';
|
|
2
|
+
export { addTriggerBlurCleanup, clearTriggerFocusState, focusFellToBody };
|
|
6
3
|
// Per APG/React Aria/Radix, focus returns to the trigger only for keyboard or
|
|
7
4
|
// imperative closes. User-directed dismissals ('outside-press', 'focus-out',
|
|
8
5
|
// 'scroll') must leave focus where the user just put it (e.g. the caret in an
|
|
9
|
-
// outside input, or the element tabbed to).
|
|
6
|
+
// outside input, or the element tabbed to). The one exception, an outside press
|
|
7
|
+
// that left the focus on nothing, lives in the shared primitive.
|
|
10
8
|
const TRIGGER_REFOCUS_CLOSE_REASONS = new Set([
|
|
11
9
|
'escape-key',
|
|
12
10
|
'close-press',
|
|
@@ -16,32 +14,7 @@ export function shouldRefocusTriggerOnClose(reason) {
|
|
|
16
14
|
return TRIGGER_REFOCUS_CLOSE_REASONS.has(reason);
|
|
17
15
|
}
|
|
18
16
|
export function applyTriggerCloseFocusState(trigger, reason, event) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
if (reason === 'outside-press' || reason === 'escape-key') {
|
|
24
|
-
trigger.dataset.focused = 'true';
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
delete trigger.dataset.focused;
|
|
28
|
-
}
|
|
29
|
-
if (closeModality === 'keyboard') {
|
|
30
|
-
trigger.dataset.focusVisible = 'true';
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
delete trigger.dataset.focusVisible;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export function addTriggerBlurCleanup(trigger, once = false) {
|
|
37
|
-
const handleBlur = () => {
|
|
38
|
-
clearTriggerFocusState(trigger);
|
|
39
|
-
if (once) {
|
|
40
|
-
trigger.removeEventListener('blur', handleBlur);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
trigger.addEventListener('blur', handleBlur);
|
|
44
|
-
return () => {
|
|
45
|
-
trigger.removeEventListener('blur', handleBlur);
|
|
46
|
-
};
|
|
17
|
+
applyTriggerCloseFocusStateShared(trigger, reason, event, {
|
|
18
|
+
refocus: shouldRefocusTriggerOnClose(reason)
|
|
19
|
+
});
|
|
47
20
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps a wheel event inside a floating panel.
|
|
3
|
+
*
|
|
4
|
+
* A non-modal popover closes when the page scrolls under it, and a wheel over a list that
|
|
5
|
+
* has reached its end would scroll the page. So the event scrolls the panel, or a scrollable
|
|
6
|
+
* element inside it, while one of them can still move in that direction, and it is consumed
|
|
7
|
+
* otherwise.
|
|
8
|
+
*/
|
|
9
|
+
export declare function containWheel(event: WheelEvent, panel: HTMLElement): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function canElementScrollInDirection(element, deltaY) {
|
|
2
|
+
const isScrollingDown = deltaY > 0;
|
|
3
|
+
const isScrollingUp = deltaY < 0;
|
|
4
|
+
const canScrollDown = element.scrollTop < element.scrollHeight - element.clientHeight;
|
|
5
|
+
const canScrollUp = element.scrollTop > 0;
|
|
6
|
+
return (isScrollingDown && canScrollDown) || (isScrollingUp && canScrollUp);
|
|
7
|
+
}
|
|
8
|
+
function isScrollableElement(element) {
|
|
9
|
+
const { overflowY } = getComputedStyle(element);
|
|
10
|
+
return (['auto', 'scroll', 'overlay'].includes(overflowY) && element.scrollHeight > element.clientHeight);
|
|
11
|
+
}
|
|
12
|
+
function hasScrollableDescendantForWheel(boundary, target, deltaY) {
|
|
13
|
+
let current = target instanceof HTMLElement ? target : target instanceof Node ? target.parentElement : null;
|
|
14
|
+
while (current) {
|
|
15
|
+
if (isScrollableElement(current) && canElementScrollInDirection(current, deltaY)) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
if (current === boundary) {
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
current = current.parentElement;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Keeps a wheel event inside a floating panel.
|
|
27
|
+
*
|
|
28
|
+
* A non-modal popover closes when the page scrolls under it, and a wheel over a list that
|
|
29
|
+
* has reached its end would scroll the page. So the event scrolls the panel, or a scrollable
|
|
30
|
+
* element inside it, while one of them can still move in that direction, and it is consumed
|
|
31
|
+
* otherwise.
|
|
32
|
+
*/
|
|
33
|
+
export function containWheel(event, panel) {
|
|
34
|
+
if (hasScrollableDescendantForWheel(panel, event.target, event.deltaY) ||
|
|
35
|
+
(isScrollableElement(panel) && canElementScrollInDirection(panel, event.deltaY))) {
|
|
36
|
+
event.stopPropagation();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
event.stopPropagation();
|
|
41
|
+
}
|
|
@@ -55,6 +55,12 @@ export type FloatingOptions = {
|
|
|
55
55
|
* so a panel that shrinks to fit still leaves the gutter visible.
|
|
56
56
|
*/
|
|
57
57
|
collisionPadding?: number;
|
|
58
|
+
/**
|
|
59
|
+
* An arrow element inside the floating element. The action moves it along the edge that faces
|
|
60
|
+
* the anchor, with `left` or `top`, and it writes the side in `data-placement`. The offset from
|
|
61
|
+
* that edge is for the CSS of the arrow.
|
|
62
|
+
*/
|
|
63
|
+
arrow?: HTMLElement | null;
|
|
58
64
|
/** Callback when position is updated. */
|
|
59
65
|
onPositionUpdate?: (x: number, y: number, placement: FloatingPlacement) => void;
|
|
60
66
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computePosition, flip, shift, limitShift, offset as offsetMiddleware, size, autoUpdate } from '@floating-ui/dom';
|
|
1
|
+
import { arrow as arrowMiddleware, computePosition, flip, shift, limitShift, offset as offsetMiddleware, size, autoUpdate } from '@floating-ui/dom';
|
|
2
2
|
/**
|
|
3
3
|
* A zero-size anchor at a viewport point, for panels that follow the pointer
|
|
4
4
|
* instead of an element — a context menu at the cursor, a toolbar at a text
|
|
@@ -24,6 +24,9 @@ export function createPointAnchor(x, y, contextElement) {
|
|
|
24
24
|
...(contextElement ? { contextElement } : {})
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
+
function isVirtualAnchor(anchor) {
|
|
28
|
+
return anchor !== null && !(anchor instanceof Element);
|
|
29
|
+
}
|
|
27
30
|
/** Viewport gutter applied when no `collisionPadding` is given. */
|
|
28
31
|
const DEFAULT_COLLISION_PADDING = 8;
|
|
29
32
|
/**
|
|
@@ -166,14 +169,21 @@ export function floating(floatingElement, options) {
|
|
|
166
169
|
floatingEl.style.maxWidth = `${clampedAvailableWidth}px`;
|
|
167
170
|
floatingEl.style.maxHeight = `${clampedAvailableHeight}px`;
|
|
168
171
|
}
|
|
169
|
-
})
|
|
172
|
+
}),
|
|
173
|
+
...(currentOptions.arrow ? [arrowMiddleware({ element: currentOptions.arrow })] : [])
|
|
170
174
|
];
|
|
171
175
|
}
|
|
176
|
+
function applyArrowPosition(arrowElement, data, finalPlacement) {
|
|
177
|
+
const side = finalPlacement.split('-')[0];
|
|
178
|
+
arrowElement.dataset.placement = side;
|
|
179
|
+
arrowElement.style.left = data?.x !== undefined ? `${data.x}px` : '';
|
|
180
|
+
arrowElement.style.top = data?.y !== undefined ? `${data.y}px` : '';
|
|
181
|
+
}
|
|
172
182
|
async function updatePosition() {
|
|
173
183
|
const anchor = currentOptions.anchor;
|
|
174
184
|
if (!anchor || !floatingElement)
|
|
175
185
|
return;
|
|
176
|
-
const { x, y, placement: finalPlacement } = await computePosition(anchor, floatingElement, {
|
|
186
|
+
const { x, y, placement: finalPlacement, middlewareData } = await computePosition(anchor, floatingElement, {
|
|
177
187
|
placement: normalizeExtendedPlacement(currentOptions.placement || 'bottom'),
|
|
178
188
|
middleware: buildMiddleware(),
|
|
179
189
|
strategy: 'fixed' // Use fixed strategy for portal-rendered elements
|
|
@@ -182,6 +192,9 @@ export function floating(floatingElement, options) {
|
|
|
182
192
|
left: `${x}px`,
|
|
183
193
|
top: `${y}px`
|
|
184
194
|
});
|
|
195
|
+
if (currentOptions.arrow) {
|
|
196
|
+
applyArrowPosition(currentOptions.arrow, middlewareData.arrow, finalPlacement);
|
|
197
|
+
}
|
|
185
198
|
currentOptions.onPositionUpdate?.(x, y, finalPlacement);
|
|
186
199
|
}
|
|
187
200
|
function stop() {
|
|
@@ -199,13 +212,21 @@ export function floating(floatingElement, options) {
|
|
|
199
212
|
return {
|
|
200
213
|
update(newOptions) {
|
|
201
214
|
const anchorChanged = newOptions.anchor !== currentOptions.anchor;
|
|
215
|
+
// Two virtual anchors on the same context element are two points on one surface: a
|
|
216
|
+
// panel that follows the pointer makes one per move. The listeners of `autoUpdate`
|
|
217
|
+
// are on the context element, thus they stay, and only the position runs again.
|
|
218
|
+
const sameSurface = anchorChanged &&
|
|
219
|
+
isVirtualAnchor(newOptions.anchor) &&
|
|
220
|
+
isVirtualAnchor(currentOptions.anchor) &&
|
|
221
|
+
newOptions.anchor.contextElement !== undefined &&
|
|
222
|
+
newOptions.anchor.contextElement === currentOptions.anchor.contextElement;
|
|
202
223
|
currentOptions = newOptions;
|
|
203
|
-
if (anchorChanged) {
|
|
224
|
+
if (anchorChanged && !(sameSurface && cleanup)) {
|
|
204
225
|
// Re-subscribe autoUpdate to the new anchor (or stop when it's gone).
|
|
205
226
|
start();
|
|
206
227
|
}
|
|
207
228
|
else if (cleanup) {
|
|
208
|
-
// Same anchor, new placement/offset/boundary: reposition immediately.
|
|
229
|
+
// Same anchor, new placement/offset/boundary/arrow: reposition immediately.
|
|
209
230
|
void updatePosition();
|
|
210
231
|
}
|
|
211
232
|
},
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps a `focusVisible` value honest while the element holds focus.
|
|
3
|
+
*
|
|
4
|
+
* `shouldShowFocusVisible` reads the modality at the moment it is called, so a component that
|
|
5
|
+
* only calls it from its focus handler holds a snapshot. A pointer press seeds `false`, and a
|
|
6
|
+
* key press after it flips the modality — and the `:focus-visible` of the browser — with nothing
|
|
7
|
+
* to tell the component. This subscribes for as long as the element has focus, and it re-reads
|
|
8
|
+
* on each change, which is what React Aria and Base UI do.
|
|
9
|
+
*/
|
|
10
|
+
export declare function watchFocusVisible(options: {
|
|
11
|
+
isFocused: () => boolean;
|
|
12
|
+
element: () => HTMLElement | null;
|
|
13
|
+
set: (focusVisible: boolean) => void;
|
|
14
|
+
}): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { shouldShowFocusVisible, subscribeInputModality } from './input-modality.js';
|
|
2
|
+
/**
|
|
3
|
+
* Keeps a `focusVisible` value honest while the element holds focus.
|
|
4
|
+
*
|
|
5
|
+
* `shouldShowFocusVisible` reads the modality at the moment it is called, so a component that
|
|
6
|
+
* only calls it from its focus handler holds a snapshot. A pointer press seeds `false`, and a
|
|
7
|
+
* key press after it flips the modality — and the `:focus-visible` of the browser — with nothing
|
|
8
|
+
* to tell the component. This subscribes for as long as the element has focus, and it re-reads
|
|
9
|
+
* on each change, which is what React Aria and Base UI do.
|
|
10
|
+
*/
|
|
11
|
+
export function watchFocusVisible(options) {
|
|
12
|
+
$effect(() => {
|
|
13
|
+
if (!options.isFocused())
|
|
14
|
+
return;
|
|
15
|
+
return subscribeInputModality(() => {
|
|
16
|
+
options.set(shouldShowFocusVisible(options.element()));
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -6,5 +6,6 @@ export * from './scroll-lock.js';
|
|
|
6
6
|
export * from './aria-hide-outside.js';
|
|
7
7
|
export * from './click-outside.js';
|
|
8
8
|
export * from './input-modality.js';
|
|
9
|
+
export * from './focus-visible.svelte.js';
|
|
9
10
|
export * from './long-press.js';
|
|
10
11
|
export * from './swipe-gesture.js';
|
package/dist/primitives/index.js
CHANGED
|
@@ -7,5 +7,6 @@ export * from './scroll-lock.js';
|
|
|
7
7
|
export * from './aria-hide-outside.js';
|
|
8
8
|
export * from './click-outside.js';
|
|
9
9
|
export * from './input-modality.js';
|
|
10
|
+
export * from './focus-visible.svelte.js';
|
|
10
11
|
export * from './long-press.js';
|
|
11
12
|
export * from './swipe-gesture.js';
|
|
@@ -2,6 +2,13 @@ export type InputModality = 'keyboard' | 'pointer' | 'virtual';
|
|
|
2
2
|
export declare function initInputModality(target?: HTMLElement | null): void;
|
|
3
3
|
export declare function trackInteractionModality(event?: Event, target?: HTMLElement | null): void;
|
|
4
4
|
export declare function getInteractionModality(): InputModality;
|
|
5
|
+
/**
|
|
6
|
+
* Calls `listener` whenever the interaction modality changes, and returns the unsubscribe
|
|
7
|
+
* function. Components use it to re-read `shouldShowFocusVisible` for an element that already
|
|
8
|
+
* holds focus: the browser re-evaluates `:focus-visible` on its own, and this is what lets a
|
|
9
|
+
* component notice.
|
|
10
|
+
*/
|
|
11
|
+
export declare function subscribeInputModality(listener: (modality: InputModality) => void): () => void;
|
|
5
12
|
export declare function shouldShowFocusVisible(target: HTMLElement | null): boolean;
|
|
6
13
|
export declare function focusWithModality(target: HTMLElement, modality: InputModality, options?: FocusOptions): void;
|
|
7
14
|
export declare function resolveCloseInteractionModality(reason: string, event?: Event): InputModality;
|