@ecopages/radiant-ui 0.1.0-beta.7 → 0.1.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/README.md +1 -1
- package/dist/components/ui/alert/alert.css +88 -50
- package/dist/components/ui/alert/alert.d.ts +43 -5
- package/dist/components/ui/alert/alert.script.d.ts +51 -4
- package/dist/components/ui/alert/index.d.ts +2 -2
- package/dist/components/ui/alert/index.js +1 -1
- package/dist/components/ui/alert/index.js.map +4 -4
- package/dist/components/ui/autocomplete/autocomplete.css +4 -4
- package/dist/components/ui/autocomplete/autocomplete.d.ts +15 -5
- package/dist/components/ui/autocomplete/autocomplete.script.d.ts +9 -0
- package/dist/components/ui/autocomplete/index.js +1 -1
- package/dist/components/ui/autocomplete/index.js.map +4 -4
- package/dist/components/ui/avatar/avatar.d.ts +15 -1
- package/dist/components/ui/avatar/index.js +1 -1
- package/dist/components/ui/avatar/index.js.map +4 -4
- package/dist/components/ui/breadcrumb/breadcrumb.d.ts +32 -6
- package/dist/components/ui/breadcrumb/index.js +1 -1
- package/dist/components/ui/breadcrumb/index.js.map +4 -4
- package/dist/{styles/components → components/ui/button}/button.css +45 -31
- package/dist/components/ui/button/button.d.ts +21 -4
- package/dist/components/ui/button-group/button-group.d.ts +7 -1
- package/dist/components/ui/button-group/index.js +1 -1
- package/dist/components/ui/button-group/index.js.map +4 -4
- package/dist/components/ui/calendar/calendar.css +7 -7
- package/dist/components/ui/calendar/calendar.d.ts +3 -2
- package/dist/components/ui/calendar/calendar.script.d.ts +39 -1
- package/dist/components/ui/calendar/index.js +1 -1
- package/dist/components/ui/calendar/index.js.map +4 -4
- package/dist/components/ui/carousel/carousel.d.ts +32 -6
- package/dist/components/ui/carousel/carousel.script.d.ts +44 -0
- package/dist/components/ui/carousel/index.js +1 -1
- package/dist/components/ui/carousel/index.js.map +4 -4
- package/dist/components/ui/checkbox/checkbox.css +1 -1
- package/dist/components/ui/checkbox/checkbox.d.ts +3 -2
- package/dist/components/ui/checkbox/checkbox.script.d.ts +4 -0
- package/dist/components/ui/checkbox/index.js +1 -1
- package/dist/components/ui/checkbox/index.js.map +4 -4
- package/dist/components/ui/chip/chip.d.ts +8 -0
- package/dist/components/ui/chip/index.js +1 -1
- package/dist/components/ui/chip/index.js.map +4 -4
- package/dist/components/ui/chip-list/chip-list.d.ts +10 -2
- package/dist/components/ui/chip-list/index.js +1 -1
- package/dist/components/ui/chip-list/index.js.map +4 -4
- package/dist/components/ui/combobox/combobox.css +39 -1
- package/dist/components/ui/combobox/combobox.d.ts +15 -5
- package/dist/components/ui/combobox/combobox.script.d.ts +13 -1
- package/dist/components/ui/combobox/index.js +1 -1
- package/dist/components/ui/combobox/index.js.map +4 -4
- package/dist/components/ui/cycle-toggle/cycle-toggle.css +15 -0
- package/dist/components/ui/cycle-toggle/cycle-toggle.d.ts +29 -0
- package/dist/components/ui/cycle-toggle/cycle-toggle.script.d.ts +61 -0
- package/dist/components/ui/cycle-toggle/index.d.ts +5 -0
- package/dist/components/ui/cycle-toggle/index.js +2 -0
- package/dist/components/ui/cycle-toggle/index.js.map +7 -0
- package/dist/components/ui/cycle-toggle/theme-preference-icons.d.ts +12 -0
- package/dist/components/ui/date-field/date-field.css +37 -0
- package/dist/components/ui/date-field/date-field.d.ts +22 -3
- package/dist/components/ui/date-field/date-field.script.d.ts +29 -5
- package/dist/components/ui/date-field/index.d.ts +1 -1
- package/dist/components/ui/date-field/index.js +1 -1
- package/dist/components/ui/date-field/index.js.map +4 -4
- package/dist/components/ui/date-range-picker/date-range-picker.css +37 -0
- package/dist/components/ui/date-range-picker/date-range-picker.d.ts +37 -4
- package/dist/components/ui/date-range-picker/date-range-picker.script.d.ts +31 -5
- package/dist/components/ui/date-range-picker/index.d.ts +1 -1
- package/dist/components/ui/date-range-picker/index.js +1 -1
- package/dist/components/ui/date-range-picker/index.js.map +4 -4
- package/dist/components/ui/dialog/dialog.css +1 -1
- package/dist/components/ui/dialog/dialog.d.ts +30 -5
- package/dist/components/ui/dialog/dialog.script.d.ts +3 -0
- package/dist/components/ui/dialog/index.js +1 -1
- package/dist/components/ui/dialog/index.js.map +4 -4
- package/dist/components/ui/disclosure/disclosure-group.css +1 -1
- package/dist/components/ui/disclosure/disclosure-group.script.d.ts +6 -0
- package/dist/components/ui/disclosure/disclosure.d.ts +26 -7
- package/dist/components/ui/disclosure/disclosure.script.d.ts +5 -0
- package/dist/components/ui/disclosure/index.js +1 -1
- package/dist/components/ui/disclosure/index.js.map +4 -4
- package/dist/components/ui/feed/feed.d.ts +37 -7
- package/dist/components/ui/feed/index.js +1 -1
- package/dist/components/ui/feed/index.js.map +4 -4
- package/dist/components/ui/field/field-description.d.ts +5 -1
- package/dist/components/ui/field/field-error.d.ts +5 -0
- package/dist/components/ui/field/field.d.ts +8 -1
- package/dist/components/ui/field/field.script.d.ts +35 -0
- package/dist/components/ui/field/index.js +1 -1
- package/dist/components/ui/field/index.js.map +4 -4
- package/dist/components/ui/form/control-protocol.d.ts +6 -0
- package/dist/components/ui/form/form.d.ts +2 -1
- package/dist/components/ui/form/form.script.d.ts +16 -1
- package/dist/components/ui/form/index.d.ts +1 -1
- package/dist/components/ui/form/index.js +1 -1
- package/dist/components/ui/form/index.js.map +4 -4
- package/dist/components/ui/grid/grid.d.ts +12 -2
- package/dist/components/ui/grid/grid.script.d.ts +14 -0
- package/dist/components/ui/grid/index.js +1 -1
- package/dist/components/ui/grid/index.js.map +4 -4
- package/dist/components/ui/heading/heading.d.ts +26 -4
- package/dist/components/ui/heading/index.js +1 -1
- package/dist/components/ui/heading/index.js.map +4 -4
- package/dist/components/ui/headline/headline.d.ts +9 -1
- package/dist/components/ui/headline/index.js +1 -1
- package/dist/components/ui/headline/index.js.map +4 -4
- package/dist/components/ui/input/index.d.ts +1 -1
- package/dist/components/ui/input/index.js +1 -1
- package/dist/components/ui/input/index.js.map +4 -4
- package/dist/components/ui/input/input.css +2 -7
- package/dist/components/ui/input/input.d.ts +7 -2
- package/dist/components/ui/label/index.js +1 -1
- package/dist/components/ui/label/index.js.map +4 -4
- package/dist/components/ui/label/label.d.ts +8 -1
- package/dist/components/ui/listbox/index.js +1 -1
- package/dist/components/ui/listbox/index.js.map +4 -4
- package/dist/components/ui/listbox/listbox.css +2 -5
- package/dist/components/ui/listbox/listbox.d.ts +7 -3
- package/dist/components/ui/listbox/listbox.script.d.ts +14 -1
- package/dist/components/ui/menu-button/index.d.ts +1 -1
- package/dist/components/ui/menu-button/index.js +1 -1
- package/dist/components/ui/menu-button/index.js.map +4 -4
- package/dist/components/ui/menu-button/menu-button.css +2 -2
- package/dist/components/ui/menu-button/menu-button.d.ts +27 -5
- package/dist/components/ui/menu-button/menu-button.script.d.ts +8 -3
- package/dist/components/ui/menubar/index.js +1 -1
- package/dist/components/ui/menubar/index.js.map +4 -4
- package/dist/components/ui/menubar/menubar.css +4 -4
- package/dist/components/ui/menubar/menubar.d.ts +14 -2
- package/dist/components/ui/menubar/menubar.script.d.ts +10 -1
- package/dist/components/ui/meter/index.js +1 -1
- package/dist/components/ui/meter/index.js.map +4 -4
- package/dist/components/ui/meter/meter.css +1 -1
- package/dist/components/ui/meter/meter.d.ts +7 -2
- package/dist/components/ui/meter/meter.script.d.ts +21 -0
- package/dist/components/ui/navigation-menu/index.js +1 -1
- package/dist/components/ui/navigation-menu/index.js.map +4 -4
- package/dist/components/ui/navigation-menu/navigation-menu.css +2 -2
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts +3 -2
- package/dist/components/ui/navigation-menu/navigation-menu.script.d.ts +4 -0
- package/dist/components/ui/number-field/index.d.ts +1 -1
- package/dist/components/ui/number-field/index.js +1 -1
- package/dist/components/ui/number-field/index.js.map +4 -4
- package/dist/components/ui/number-field/number-field.css +18 -3
- package/dist/components/ui/number-field/number-field.d.ts +36 -8
- package/dist/components/ui/number-field/number-field.script.d.ts +28 -1
- package/dist/components/ui/popover/index.js +1 -1
- package/dist/components/ui/popover/index.js.map +4 -4
- package/dist/components/ui/popover/popover.d.ts +5 -4
- package/dist/components/ui/popover/popover.script.d.ts +4 -0
- package/dist/components/ui/radio-group/index.d.ts +1 -1
- package/dist/components/ui/radio-group/index.js +1 -1
- package/dist/components/ui/radio-group/index.js.map +4 -4
- package/dist/components/ui/radio-group/radio-group.d.ts +29 -4
- package/dist/components/ui/radio-group/radio-group.script.d.ts +14 -9
- package/dist/components/ui/select/index.js +1 -1
- package/dist/components/ui/select/index.js.map +4 -4
- package/dist/components/ui/select/select.css +48 -6
- package/dist/components/ui/select/select.d.ts +29 -8
- package/dist/components/ui/select/select.script.d.ts +7 -0
- package/dist/components/ui/sidebar/index.js +1 -1
- package/dist/components/ui/sidebar/index.js.map +4 -4
- package/dist/components/ui/sidebar/sidebar-trigger.script.d.ts +4 -0
- package/dist/components/ui/sidebar/sidebar.css +41 -24
- package/dist/components/ui/sidebar/sidebar.d.ts +68 -14
- package/dist/components/ui/sidebar/sidebar.docs.css +5 -2
- package/dist/components/ui/sidebar/sidebar.script.d.ts +9 -0
- package/dist/components/ui/slider/index.js +1 -1
- package/dist/components/ui/slider/index.js.map +4 -4
- package/dist/components/ui/slider/slider.d.ts +2 -1
- package/dist/components/ui/slider/slider.script.d.ts +29 -1
- package/dist/components/ui/switch/index.js +1 -1
- package/dist/components/ui/switch/index.js.map +4 -4
- package/dist/components/ui/switch/switch.css +3 -3
- package/dist/components/ui/switch/switch.d.ts +11 -2
- package/dist/components/ui/switch/switch.script.d.ts +5 -0
- package/dist/components/ui/tabs/index.js +1 -1
- package/dist/components/ui/tabs/index.js.map +4 -4
- package/dist/components/ui/tabs/tabs.css +9 -10
- package/dist/components/ui/tabs/tabs.d.ts +30 -9
- package/dist/components/ui/tag-group/index.js +1 -1
- package/dist/components/ui/tag-group/index.js.map +4 -4
- package/dist/components/ui/tag-group/tag-group.css +2 -11
- package/dist/components/ui/tag-group/tag-group.d.ts +18 -5
- package/dist/components/ui/tag-group/tag-group.script.d.ts +9 -2
- package/dist/components/ui/textarea/index.d.ts +1 -1
- package/dist/components/ui/textarea/index.js +1 -1
- package/dist/components/ui/textarea/index.js.map +4 -4
- package/dist/components/ui/textarea/textarea.d.ts +7 -2
- package/dist/components/ui/toast/index.d.ts +1 -1
- package/dist/components/ui/toast/index.js +1 -1
- package/dist/components/ui/toast/index.js.map +4 -4
- package/dist/components/ui/toast/stack-layout.d.ts +18 -0
- package/dist/components/ui/toast/toast-context.d.ts +10 -0
- package/dist/components/ui/toast/toast.css +30 -9
- package/dist/components/ui/toast/toast.d.ts +12 -2
- package/dist/components/ui/toast/toast.script.d.ts +60 -4
- package/dist/components/ui/toast/toaster.script.d.ts +71 -2
- package/dist/components/ui/toc/index.js +1 -1
- package/dist/components/ui/toc/index.js.map +4 -4
- package/dist/components/ui/toc/toc.css +3 -0
- package/dist/components/ui/toc/toc.d.ts +2 -1
- package/dist/components/ui/toc/toc.script.d.ts +15 -0
- package/dist/components/ui/toolbar/index.js +1 -1
- package/dist/components/ui/toolbar/index.js.map +4 -4
- package/dist/components/ui/toolbar/toolbar.d.ts +3 -2
- package/dist/components/ui/toolbar/toolbar.script.d.ts +8 -0
- package/dist/components/ui/tooltip/index.js +1 -1
- package/dist/components/ui/tooltip/index.js.map +4 -4
- package/dist/components/ui/tooltip/tooltip.d.ts +3 -2
- package/dist/components/ui/tooltip/tooltip.script.d.ts +3 -0
- package/dist/components/ui/tree/index.js +1 -1
- package/dist/components/ui/tree/index.js.map +4 -4
- package/dist/components/ui/tree/tree.d.ts +12 -2
- package/dist/components/ui/tree/tree.script.d.ts +18 -1
- package/dist/components/ui/treegrid/index.js +1 -1
- package/dist/components/ui/treegrid/index.js.map +4 -4
- package/dist/components/ui/treegrid/treegrid.d.ts +15 -2
- package/dist/components/ui/treegrid/treegrid.script.d.ts +22 -1
- package/dist/components/ui/window-splitter/index.js +1 -1
- package/dist/components/ui/window-splitter/index.js.map +4 -4
- package/dist/components/ui/window-splitter/window-splitter.css +1 -1
- package/dist/components/ui/window-splitter/window-splitter.d.ts +3 -2
- package/dist/components/ui/window-splitter/window-splitter.script.d.ts +22 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/lib/cycle-value.d.ts +8 -0
- package/dist/lib/intl-number/range.d.ts +8 -0
- package/dist/styles/radiant-ui-core.css +110 -341
- package/dist/styles/radiant-ui.css +413 -377
- package/dist/styles/styles.css +839 -2731
- package/dist/styles/tailwind.css +626 -530
- package/dist/styles/tokens/colors/aurora.css +2 -2
- package/dist/styles/tokens/colors/basalt.css +2 -1
- package/dist/styles/tokens/colors/glacier.css +2 -1
- package/dist/styles/tokens/presets/colors/aurora.css +42 -14
- package/dist/styles/tokens/presets/colors/basalt.css +28 -0
- package/dist/styles/tokens/presets/colors/ember.css +28 -0
- package/dist/styles/tokens/presets/colors/glacier.css +28 -0
- package/dist/styles/tokens/semantic.css +22 -2
- package/dist/styles/tokens/spacing/compact.css +12 -12
- package/package.json +21 -8
- package/dist/components/ui/dialog/dialog-registry.test.d.ts +0 -1
- package/dist/components/ui/field/field-ssr-hydration.test.d.ts +0 -1
- package/dist/components/ui/form/form-field.test.d.ts +0 -4
- package/dist/components/ui/form/form-store.test.d.ts +0 -1
- package/dist/components/ui/shared/collection-navigation.test.d.ts +0 -1
- package/dist/components/ui/shared/floating-position.test.d.ts +0 -1
- package/dist/components/ui/shared/listbox-popover-behavior.test.d.ts +0 -1
- package/dist/components/ui/shared/popover-controller.test.d.ts +0 -1
- package/dist/components/ui/shared/portal.test.d.ts +0 -1
- package/dist/components/ui/sidebar/sidebar.ssr.test.d.ts +0 -2
- package/dist/components/ui/sidebar/sidebar.test.d.ts +0 -1
- package/dist/components/ui/toast/toast.test.d.ts +0 -2
- package/dist/components/ui/toc/toc-helpers.test.d.ts +0 -1
- package/dist/components/ui/toc/toc.ssr.test.d.ts +0 -1
- package/dist/components/ui/toc/toc.test.d.ts +0 -1
- package/dist/lib/intl-date/parts.test.d.ts +0 -1
- package/dist/lib/intl-date/segments.test.d.ts +0 -1
- package/dist/lib/intl-date/selection.test.d.ts +0 -1
- package/dist/lib/mask/date-mask.test.d.ts +0 -1
- package/dist/lib/mask/input-mask.test.d.ts +0 -1
- package/dist/lib/radiant-view.d.ts +0 -43
- package/dist/lib/text-filter.test.d.ts +0 -1
- package/dist/styles/tokens/presets/radius.css +0 -45
- package/dist/styles/tokens/presets/spacing.css +0 -57
|
@@ -10,7 +10,7 @@ rui-sidebar {
|
|
|
10
10
|
width: 100%;
|
|
11
11
|
min-width: 0px;
|
|
12
12
|
flex: 1;
|
|
13
|
-
overflow:
|
|
13
|
+
overflow: clip;
|
|
14
14
|
background-color: var(--color-background, var(--background));
|
|
15
15
|
}
|
|
16
16
|
.rui-sidebar-provider[data-layout='full'] {
|
|
@@ -21,7 +21,7 @@ rui-sidebar {
|
|
|
21
21
|
height: 100svh;
|
|
22
22
|
min-height: 0px;
|
|
23
23
|
flex-direction: column;
|
|
24
|
-
overflow:
|
|
24
|
+
overflow: clip;
|
|
25
25
|
.rui-sidebar-provider__site-header {
|
|
26
26
|
position: sticky;
|
|
27
27
|
top: 0px;
|
|
@@ -79,7 +79,7 @@ rui-sidebar {
|
|
|
79
79
|
.rui-sidebar-provider__site-header-nav {
|
|
80
80
|
display: flex;
|
|
81
81
|
align-items: center;
|
|
82
|
-
gap: var(--spacing-
|
|
82
|
+
gap: var(--spacing-1, var(--space-1));
|
|
83
83
|
}
|
|
84
84
|
.rui-sidebar-provider__site-header-link {
|
|
85
85
|
font-size: var(--text-sm, var(--text-sm));
|
|
@@ -91,7 +91,7 @@ rui-sidebar {
|
|
|
91
91
|
display: flex;
|
|
92
92
|
min-height: 0px;
|
|
93
93
|
flex: 1;
|
|
94
|
-
overflow:
|
|
94
|
+
overflow: clip;
|
|
95
95
|
}
|
|
96
96
|
.rui-sidebar-docs-page {
|
|
97
97
|
margin-inline: auto;
|
|
@@ -137,13 +137,10 @@ rui-sidebar {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
@media (max-width: 767px) {
|
|
140
|
-
rui-sidebar-trigger {
|
|
141
|
-
display: inline-flex;
|
|
142
|
-
}
|
|
143
140
|
rui-sidebar-trigger .rui-sidebar__trigger {
|
|
144
141
|
width: calc(var(--spacing, 0.25rem) * 9);
|
|
145
142
|
height: calc(var(--spacing, 0.25rem) * 9);
|
|
146
|
-
border-radius: var(--radius-
|
|
143
|
+
border-radius: var(--radius-control, var(--radius-control));
|
|
147
144
|
border-style: var(--tw-border-style);
|
|
148
145
|
border-width: 1px;
|
|
149
146
|
border-color: var(--color-border, var(--border));
|
|
@@ -175,7 +172,7 @@ rui-sidebar {
|
|
|
175
172
|
}
|
|
176
173
|
}
|
|
177
174
|
.rui-sidebar-provider:has(rui-sidebar[data-mobile='true'][data-state='expanded']) {
|
|
178
|
-
overflow:
|
|
175
|
+
overflow: clip;
|
|
179
176
|
}
|
|
180
177
|
.rui-sidebar {
|
|
181
178
|
position: relative;
|
|
@@ -184,14 +181,14 @@ rui-sidebar {
|
|
|
184
181
|
min-width: 0px;
|
|
185
182
|
flex-shrink: 0;
|
|
186
183
|
align-self: stretch;
|
|
187
|
-
background-color: var(--color-surface, var(--surface));
|
|
188
184
|
color: var(--color-on-background, var(--on-background));
|
|
185
|
+
background-color: var(--rui-sidebar-background, var(--color-surface));
|
|
189
186
|
}
|
|
190
187
|
.rui-sidebar[data-side='right'] {
|
|
191
188
|
flex-direction: row-reverse;
|
|
192
189
|
}
|
|
193
190
|
.rui-sidebar[data-variant='inset'] {
|
|
194
|
-
border-radius: var(--radius-
|
|
191
|
+
border-radius: var(--radius-container, var(--radius-container));
|
|
195
192
|
border-style: var(--tw-border-style);
|
|
196
193
|
border-width: 1px;
|
|
197
194
|
border-color: var(--color-border, var(--border));
|
|
@@ -283,11 +280,11 @@ rui-sidebar {
|
|
|
283
280
|
flex-shrink: 0;
|
|
284
281
|
flex-direction: row;
|
|
285
282
|
align-items: center;
|
|
286
|
-
gap: var(--spacing-
|
|
283
|
+
gap: var(--spacing-inline, var(--space-inline));
|
|
287
284
|
border-bottom-style: var(--tw-border-style);
|
|
288
285
|
border-bottom-width: 1px;
|
|
289
286
|
border-color: var(--color-border, var(--border));
|
|
290
|
-
padding-inline: var(--spacing-
|
|
287
|
+
padding-inline: var(--spacing-control-x, var(--space-control-x));
|
|
291
288
|
}
|
|
292
289
|
.rui-sidebar[data-collapsible='icon'][data-state='collapsed'] .rui-sidebar__header {
|
|
293
290
|
flex-direction: column;
|
|
@@ -315,7 +312,7 @@ rui-sidebar {
|
|
|
315
312
|
padding: var(--spacing-3, var(--space-3));
|
|
316
313
|
}
|
|
317
314
|
.rui-sidebar[data-collapsible='icon'][data-state='collapsed'] .rui-sidebar__content {
|
|
318
|
-
gap: var(--spacing-
|
|
315
|
+
gap: var(--spacing-inline, var(--space-inline));
|
|
319
316
|
overflow-x: hidden;
|
|
320
317
|
padding-inline: var(--spacing-1, var(--space-1));
|
|
321
318
|
}
|
|
@@ -323,7 +320,7 @@ rui-sidebar {
|
|
|
323
320
|
display: flex;
|
|
324
321
|
flex-shrink: 0;
|
|
325
322
|
flex-direction: column;
|
|
326
|
-
gap: var(--spacing-
|
|
323
|
+
gap: var(--spacing-inline, var(--space-inline));
|
|
327
324
|
border-top-style: var(--tw-border-style);
|
|
328
325
|
border-top-width: 1px;
|
|
329
326
|
border-color: var(--color-border, var(--border));
|
|
@@ -375,7 +372,7 @@ rui-sidebar {
|
|
|
375
372
|
cursor: pointer;
|
|
376
373
|
align-items: center;
|
|
377
374
|
justify-content: center;
|
|
378
|
-
border-radius: var(--radius-
|
|
375
|
+
border-radius: var(--radius-control, var(--radius-control));
|
|
379
376
|
border-style: var(--tw-border-style);
|
|
380
377
|
border-width: 0px;
|
|
381
378
|
background-color: transparent;
|
|
@@ -422,8 +419,8 @@ rui-sidebar {
|
|
|
422
419
|
min-width: 0px;
|
|
423
420
|
cursor: pointer;
|
|
424
421
|
align-items: center;
|
|
425
|
-
gap: var(--spacing-
|
|
426
|
-
border-radius: var(--radius-
|
|
422
|
+
gap: var(--spacing-inline, var(--space-inline));
|
|
423
|
+
border-radius: var(--radius-control, var(--radius-control));
|
|
427
424
|
border-style: var(--tw-border-style);
|
|
428
425
|
border-width: 0px;
|
|
429
426
|
background-color: transparent;
|
|
@@ -526,7 +523,7 @@ rui-sidebar {
|
|
|
526
523
|
flex: 1;
|
|
527
524
|
flex-direction: column;
|
|
528
525
|
gap: 0px;
|
|
529
|
-
overflow:
|
|
526
|
+
overflow: clip;
|
|
530
527
|
background-color: var(--color-background, var(--background));
|
|
531
528
|
}
|
|
532
529
|
.rui-sidebar__trigger {
|
|
@@ -553,7 +550,15 @@ rui-sidebar {
|
|
|
553
550
|
:is(.rui-sidebar-provider:has(> rui-sidebar[data-collapsible='off']:not([data-mobile='true'])),
|
|
554
551
|
.rui-sidebar-provider:has(
|
|
555
552
|
> .rui-sidebar-provider__body > rui-sidebar[data-collapsible='off']:not([data-mobile='true'])
|
|
556
|
-
)) rui-sidebar-trigger
|
|
553
|
+
)) rui-sidebar-trigger.rui-sidebar-trigger-placement--header, :is(.rui-sidebar-provider:has(> rui-sidebar[data-collapsible='off']:not([data-mobile='true'])),
|
|
554
|
+
.rui-sidebar-provider:has(
|
|
555
|
+
> .rui-sidebar-provider__body > rui-sidebar[data-collapsible='off']:not([data-mobile='true'])
|
|
556
|
+
))
|
|
557
|
+
rui-sidebar-trigger[data-placement='header'], :is(.rui-sidebar-provider:has(> rui-sidebar[data-collapsible='off']:not([data-mobile='true'])),
|
|
558
|
+
.rui-sidebar-provider:has(
|
|
559
|
+
> .rui-sidebar-provider__body > rui-sidebar[data-collapsible='off']:not([data-mobile='true'])
|
|
560
|
+
))
|
|
561
|
+
rui-sidebar-trigger.rui-sidebar-trigger-placement--inset, :is(.rui-sidebar-provider:has(> rui-sidebar[data-collapsible='off']:not([data-mobile='true'])),
|
|
557
562
|
.rui-sidebar-provider:has(
|
|
558
563
|
> .rui-sidebar-provider__body > rui-sidebar[data-collapsible='off']:not([data-mobile='true'])
|
|
559
564
|
))
|
|
@@ -563,21 +568,33 @@ rui-sidebar {
|
|
|
563
568
|
:is(.rui-sidebar-provider:has(> rui-sidebar[data-state='expanded']:not([data-mobile='true'])),
|
|
564
569
|
.rui-sidebar-provider:has(
|
|
565
570
|
> .rui-sidebar-provider__body > rui-sidebar[data-state='expanded']:not([data-mobile='true'])
|
|
566
|
-
)) rui-sidebar-trigger[data-
|
|
571
|
+
)) rui-sidebar-trigger.rui-sidebar-trigger-placement--inset, :is(.rui-sidebar-provider:has(> rui-sidebar[data-state='expanded']:not([data-mobile='true'])),
|
|
572
|
+
.rui-sidebar-provider:has(
|
|
573
|
+
> .rui-sidebar-provider__body > rui-sidebar[data-state='expanded']:not([data-mobile='true'])
|
|
574
|
+
))
|
|
575
|
+
rui-sidebar-trigger[data-placement='inset'] {
|
|
567
576
|
display: none;
|
|
568
577
|
}
|
|
569
578
|
:is(.rui-sidebar-provider:has(> rui-sidebar[data-state='collapsed']:not([data-mobile='true'])),
|
|
570
579
|
.rui-sidebar-provider:has(
|
|
571
580
|
> .rui-sidebar-provider__body > rui-sidebar[data-state='collapsed']:not([data-mobile='true'])
|
|
572
|
-
)) rui-sidebar-trigger[data-
|
|
581
|
+
)) rui-sidebar-trigger.rui-sidebar-trigger-placement--header, :is(.rui-sidebar-provider:has(> rui-sidebar[data-state='collapsed']:not([data-mobile='true'])),
|
|
582
|
+
.rui-sidebar-provider:has(
|
|
583
|
+
> .rui-sidebar-provider__body > rui-sidebar[data-state='collapsed']:not([data-mobile='true'])
|
|
584
|
+
))
|
|
585
|
+
rui-sidebar-trigger[data-placement='header'] {
|
|
573
586
|
display: none;
|
|
574
587
|
}
|
|
575
588
|
:is(.rui-sidebar-provider:has(> rui-sidebar[data-state='expanded'][data-mobile='true']),
|
|
576
|
-
.rui-sidebar-provider:has(> .rui-sidebar-provider__body > rui-sidebar[data-state='expanded'][data-mobile='true'])) rui-sidebar-trigger[data-
|
|
589
|
+
.rui-sidebar-provider:has(> .rui-sidebar-provider__body > rui-sidebar[data-state='expanded'][data-mobile='true'])) rui-sidebar-trigger.rui-sidebar-trigger-placement--inset, :is(.rui-sidebar-provider:has(> rui-sidebar[data-state='expanded'][data-mobile='true']),
|
|
590
|
+
.rui-sidebar-provider:has(> .rui-sidebar-provider__body > rui-sidebar[data-state='expanded'][data-mobile='true']))
|
|
591
|
+
rui-sidebar-trigger[data-placement='inset'] {
|
|
577
592
|
display: none;
|
|
578
593
|
}
|
|
579
594
|
:is(.rui-sidebar-provider:has(> rui-sidebar[data-state='collapsed'][data-mobile='true']),
|
|
580
|
-
.rui-sidebar-provider:has(> .rui-sidebar-provider__body > rui-sidebar[data-state='collapsed'][data-mobile='true'])) rui-sidebar-trigger[data-
|
|
595
|
+
.rui-sidebar-provider:has(> .rui-sidebar-provider__body > rui-sidebar[data-state='collapsed'][data-mobile='true'])) rui-sidebar-trigger.rui-sidebar-trigger-placement--header, :is(.rui-sidebar-provider:has(> rui-sidebar[data-state='collapsed'][data-mobile='true']),
|
|
596
|
+
.rui-sidebar-provider:has(> .rui-sidebar-provider__body > rui-sidebar[data-state='collapsed'][data-mobile='true']))
|
|
597
|
+
rui-sidebar-trigger[data-placement='header'] {
|
|
581
598
|
display: none;
|
|
582
599
|
}
|
|
583
600
|
.rui-sidebar[data-mobile='true'] {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { JsxHtmlPropsWithChildren, JsxRenderable } from '@ecopages/jsx';
|
|
2
2
|
import type { RuiSidebarProps } from './sidebar.script';
|
|
3
|
+
import './sidebar.script';
|
|
3
4
|
import type { RuiSidebarTriggerProps } from './sidebar-trigger.script';
|
|
5
|
+
import './sidebar-trigger.script';
|
|
4
6
|
export type RuiSidebarProviderProps = {
|
|
5
7
|
/**
|
|
6
8
|
* Layout context. `default` is the standard shell; `full` removes chrome;
|
|
@@ -22,6 +24,10 @@ export type RuiSidebarProviderProps = {
|
|
|
22
24
|
* `SidebarProvider` from common sidebar kits, but without a runtime context —
|
|
23
25
|
* coordination between trigger, sidebar, and inset is achieved through
|
|
24
26
|
* `id`/`aria-controls` and shared `data-*` attributes.
|
|
27
|
+
*
|
|
28
|
+
* @cssclass rui-sidebar-provider - Shell wrapping sidebar + inset.
|
|
29
|
+
* @cssclass rui-sidebar-provider__site-header - Full-width chrome (`layout="docs"`).
|
|
30
|
+
* @cssclass rui-sidebar-provider__body - Sidebar + inset row.
|
|
25
31
|
*/
|
|
26
32
|
export declare function RuiSidebarProvider({ layout, siteHeader, sidebar, children, class: className, }: RuiSidebarProviderProps): JsxRenderable;
|
|
27
33
|
export type RuiSidebarHeaderProps = {
|
|
@@ -30,7 +36,11 @@ export type RuiSidebarHeaderProps = {
|
|
|
30
36
|
/** Accessible name for the header region. */
|
|
31
37
|
'aria-label'?: string;
|
|
32
38
|
};
|
|
33
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Top section of the sidebar pane (logo, search, primary trigger).
|
|
41
|
+
*
|
|
42
|
+
* @cssclass rui-sidebar__header - Top, pinned section.
|
|
43
|
+
*/
|
|
34
44
|
export declare function RuiSidebarHeader({ children, class: className, 'aria-label': ariaLabel }: RuiSidebarHeaderProps): JsxRenderable;
|
|
35
45
|
export type RuiSidebarContentProps = {
|
|
36
46
|
children: JsxRenderable;
|
|
@@ -38,20 +48,32 @@ export type RuiSidebarContentProps = {
|
|
|
38
48
|
/** Optional label for the scrolling content region. */
|
|
39
49
|
'aria-label'?: string;
|
|
40
50
|
};
|
|
41
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Scrollable middle section. Multiple allowed; each becomes its own region.
|
|
53
|
+
*
|
|
54
|
+
* @cssclass rui-sidebar__content - Scrollable middle section.
|
|
55
|
+
*/
|
|
42
56
|
export declare function RuiSidebarContent({ children, class: className, 'aria-label': ariaLabel }: RuiSidebarContentProps): JsxRenderable;
|
|
43
57
|
export type RuiSidebarFooterProps = {
|
|
44
58
|
children: JsxRenderable;
|
|
45
59
|
class?: string;
|
|
46
60
|
};
|
|
47
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Pinned bottom section (user, theme toggle, settings).
|
|
63
|
+
*
|
|
64
|
+
* @cssclass rui-sidebar__footer - Pinned bottom section.
|
|
65
|
+
*/
|
|
48
66
|
export declare function RuiSidebarFooter({ children, class: className }: RuiSidebarFooterProps): JsxRenderable;
|
|
49
67
|
export type RuiSidebarSeparatorProps = {
|
|
50
68
|
class?: string;
|
|
51
69
|
/** Accessible label for the separator. */
|
|
52
70
|
'aria-label'?: string;
|
|
53
71
|
};
|
|
54
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Horizontal rule between sidebar sections.
|
|
74
|
+
*
|
|
75
|
+
* @cssclass rui-sidebar__separator - Horizontal rule (`role="separator"`).
|
|
76
|
+
*/
|
|
55
77
|
export declare function RuiSidebarSeparator({ class: className, 'aria-label': ariaLabel }: RuiSidebarSeparatorProps): JsxRenderable;
|
|
56
78
|
export type RuiSidebarGroupProps = {
|
|
57
79
|
children: JsxRenderable;
|
|
@@ -59,7 +81,11 @@ export type RuiSidebarGroupProps = {
|
|
|
59
81
|
/** Accessible label for the group region. */
|
|
60
82
|
'aria-label'?: string;
|
|
61
83
|
};
|
|
62
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Landmark group of related sidebar items.
|
|
86
|
+
*
|
|
87
|
+
* @cssclass rui-sidebar__group - Landmark group region.
|
|
88
|
+
*/
|
|
63
89
|
export declare function RuiSidebarGroup({ children, class: className, 'aria-label': ariaLabel }: RuiSidebarGroupProps): JsxRenderable;
|
|
64
90
|
export type RuiSidebarGroupLabelProps = {
|
|
65
91
|
children: JsxRenderable;
|
|
@@ -67,7 +93,11 @@ export type RuiSidebarGroupLabelProps = {
|
|
|
67
93
|
/** Optional `id` so the group can be referenced by `aria-labelledby`. */
|
|
68
94
|
id?: string;
|
|
69
95
|
};
|
|
70
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* Heading for a sidebar group.
|
|
98
|
+
*
|
|
99
|
+
* @cssclass rui-sidebar__group-label - Group heading (`<h2>`).
|
|
100
|
+
*/
|
|
71
101
|
export declare function RuiSidebarGroupLabel({ children, class: className, id }: RuiSidebarGroupLabelProps): JsxRenderable;
|
|
72
102
|
export type RuiSidebarGroupActionProps = {
|
|
73
103
|
children: JsxRenderable;
|
|
@@ -75,14 +105,22 @@ export type RuiSidebarGroupActionProps = {
|
|
|
75
105
|
/** Accessible label for the action button. */
|
|
76
106
|
'aria-label'?: string;
|
|
77
107
|
};
|
|
78
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Top-right action button inside a group header.
|
|
110
|
+
*
|
|
111
|
+
* @cssclass rui-sidebar__group-action - Group header action button.
|
|
112
|
+
*/
|
|
79
113
|
export declare function RuiSidebarGroupAction({ children, class: className, 'aria-label': ariaLabel, }: RuiSidebarGroupActionProps): JsxRenderable;
|
|
80
114
|
export type RuiSidebarGroupHeaderProps = {
|
|
81
115
|
label: JsxRenderable;
|
|
82
116
|
action?: JsxRenderable;
|
|
83
117
|
class?: string;
|
|
84
118
|
};
|
|
85
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* Convenience: a label + optional action in one row.
|
|
121
|
+
*
|
|
122
|
+
* @cssclass rui-sidebar__group-header - Group label + action row.
|
|
123
|
+
*/
|
|
86
124
|
export declare function RuiSidebarGroupHeader({ label, action, class: className }: RuiSidebarGroupHeaderProps): JsxRenderable;
|
|
87
125
|
export type RuiSidebarMenuProps = {
|
|
88
126
|
children: JsxRenderable;
|
|
@@ -90,13 +128,21 @@ export type RuiSidebarMenuProps = {
|
|
|
90
128
|
/** Accessible label for the menu list. */
|
|
91
129
|
'aria-label'?: string;
|
|
92
130
|
};
|
|
93
|
-
/**
|
|
131
|
+
/**
|
|
132
|
+
* `<ul>` of sidebar items.
|
|
133
|
+
*
|
|
134
|
+
* @cssclass rui-sidebar__menu - Menu list.
|
|
135
|
+
*/
|
|
94
136
|
export declare function RuiSidebarMenu({ children, class: className, 'aria-label': ariaLabel }: RuiSidebarMenuProps): JsxRenderable;
|
|
95
137
|
export type RuiSidebarMenuItemProps = {
|
|
96
138
|
children: JsxRenderable;
|
|
97
139
|
class?: string;
|
|
98
140
|
};
|
|
99
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* `<li>` of a sidebar menu.
|
|
143
|
+
*
|
|
144
|
+
* @cssclass rui-sidebar__menu-item - Menu item (`<li>`).
|
|
145
|
+
*/
|
|
100
146
|
export declare function RuiSidebarMenuItem({ children, class: className }: RuiSidebarMenuItemProps): JsxRenderable;
|
|
101
147
|
export type RuiSidebarMenuButtonProps = {
|
|
102
148
|
children: JsxRenderable;
|
|
@@ -118,10 +164,14 @@ export type RuiSidebarMenuButtonProps = {
|
|
|
118
164
|
* The clickable surface inside a `RuiSidebarMenuItem`. When the sidebar
|
|
119
165
|
* collapses to icon mode, only this element remains visible; it must keep an
|
|
120
166
|
* accessible name via `tooltip` or visible children.
|
|
167
|
+
*
|
|
168
|
+
* @cssclass rui-sidebar__menu-button - Clickable menu surface (`<a>`/`<button>`).
|
|
169
|
+
* @cssclass rui-sidebar__menu-button--active - Current-page marker (`aria-current="page"`).
|
|
121
170
|
*/
|
|
122
171
|
export declare function RuiSidebarMenuButton({ children, class: className, isActive, as, href, type, tooltip, disabled, onClick, }: RuiSidebarMenuButtonProps): JsxRenderable;
|
|
123
172
|
export type RuiSidebarMenuActionProps = RuiSidebarMenuButtonProps;
|
|
124
|
-
/** Smaller, secondary button (e.g. `+ New`) below a menu or group.
|
|
173
|
+
/** Smaller, secondary button (e.g. `+ New`) below a menu or group.
|
|
174
|
+
* @cssclass rui-sidebar__menu-action - Secondary menu action button. */
|
|
125
175
|
export declare function RuiSidebarMenuAction(props: RuiSidebarMenuActionProps): JsxRenderable;
|
|
126
176
|
export type RuiSidebarInsetProps = {
|
|
127
177
|
children: JsxRenderable;
|
|
@@ -129,14 +179,18 @@ export type RuiSidebarInsetProps = {
|
|
|
129
179
|
/** Optional `id` so the sidebar trigger can target the main landmark. */
|
|
130
180
|
id?: string;
|
|
131
181
|
};
|
|
132
|
-
/**
|
|
182
|
+
/**
|
|
183
|
+
* The main content area that sits next to the sidebar.
|
|
184
|
+
*
|
|
185
|
+
* @cssclass rui-sidebar__inset - Main content area (`<main>`).
|
|
186
|
+
*/
|
|
133
187
|
export declare function RuiSidebarInset({ children, class: className, id }: RuiSidebarInsetProps): JsxRenderable;
|
|
134
188
|
export type RuiSidebarViewProps = JsxHtmlPropsWithChildren<RuiSidebarProps & {
|
|
135
189
|
id: string;
|
|
136
190
|
slot?: string;
|
|
137
191
|
}>;
|
|
138
|
-
export declare
|
|
192
|
+
export declare function RuiSidebar({ children, id, defaultOpen, mobileDefaultOpen, open, defaultWidth, width, resizable, mobileBreakpoint, matchActive, matchMode, scrollActiveOnMount, navigationEvents, ...props }: RuiSidebarViewProps): JsxRenderable;
|
|
139
193
|
export type RuiSidebarTriggerViewProps = JsxHtmlPropsWithChildren<RuiSidebarTriggerProps & {
|
|
140
194
|
slot?: string;
|
|
141
195
|
}>;
|
|
142
|
-
export declare
|
|
196
|
+
export declare function RuiSidebarTrigger({ children, class: className, controls, triggerLabel, placement, variant, size, ...props }: RuiSidebarTriggerViewProps): JsxRenderable;
|
|
@@ -7,7 +7,7 @@ rui-sidebar .rui-sidebar {
|
|
|
7
7
|
@supports (color: color-mix(in lab, red, red)) {
|
|
8
8
|
border-color: color-mix(in oklab, var(--color-border, var(--border)) 60%, transparent);
|
|
9
9
|
}
|
|
10
|
-
background-color: transparent;
|
|
10
|
+
background-color: var(--rui-sidebar-background, transparent);
|
|
11
11
|
}
|
|
12
12
|
rui-sidebar .rui-sidebar__header {
|
|
13
13
|
height: auto;
|
|
@@ -113,10 +113,12 @@ rui-sidebar .rui-sidebar__menu {
|
|
|
113
113
|
border-color: color-mix(in oklab, var(--color-border, var(--border)) 30%, transparent);
|
|
114
114
|
}
|
|
115
115
|
padding-left: var(--spacing-3, var(--space-3));
|
|
116
|
+
--rui-docs-navigation-inset: var(--space-3);
|
|
117
|
+
padding-left: var(--rui-docs-navigation-inset);
|
|
116
118
|
}
|
|
117
119
|
rui-sidebar .rui-sidebar__menu-button {
|
|
118
120
|
position: relative;
|
|
119
|
-
border-radius: var(--radius-
|
|
121
|
+
border-radius: var(--radius-control, var(--radius-control));
|
|
120
122
|
border-style: var(--tw-border-style);
|
|
121
123
|
border-width: 0px;
|
|
122
124
|
background-color: transparent;
|
|
@@ -170,6 +172,7 @@ rui-sidebar .rui-sidebar__menu-button[aria-current='page']::before, rui-sidebar
|
|
|
170
172
|
border-top-right-radius: var(--radius-sm, var(--border-radius-sm));
|
|
171
173
|
border-bottom-right-radius: var(--radius-sm, var(--border-radius-sm));
|
|
172
174
|
background-color: var(--color-primary, var(--primary));
|
|
175
|
+
left: calc(-1 * (var(--rui-docs-navigation-inset) + 1px));
|
|
173
176
|
}
|
|
174
177
|
rui-sidebar .rui-sidebar__menu-button > :last-child {
|
|
175
178
|
overflow: hidden;
|
|
@@ -14,6 +14,8 @@ export type RuiSidebarProps = {
|
|
|
14
14
|
collapsible?: RuiSidebarCollapsible;
|
|
15
15
|
/** Initial open state when uncontrolled. Default: `true`. */
|
|
16
16
|
defaultOpen?: boolean;
|
|
17
|
+
/** Initial open state below `mobileBreakpoint` when uncontrolled. Default: `false`. */
|
|
18
|
+
mobileDefaultOpen?: boolean;
|
|
17
19
|
/** Controlled open state. */
|
|
18
20
|
open?: boolean;
|
|
19
21
|
/** Initial width in pixels when uncontrolled. Default: `256`. */
|
|
@@ -92,6 +94,7 @@ export declare class RuiSidebar extends RadiantElement<RuiSidebarBindings> {
|
|
|
92
94
|
maxWidth: number;
|
|
93
95
|
resizable: boolean;
|
|
94
96
|
defaultOpen: boolean;
|
|
97
|
+
mobileDefaultOpen: boolean;
|
|
95
98
|
open: boolean | undefined;
|
|
96
99
|
mobileBreakpoint: number;
|
|
97
100
|
label: string;
|
|
@@ -160,6 +163,9 @@ export declare class RuiSidebar extends RadiantElement<RuiSidebarBindings> {
|
|
|
160
163
|
*/
|
|
161
164
|
private setMobile;
|
|
162
165
|
private clampWidth;
|
|
166
|
+
/**
|
|
167
|
+
* @remarks Mobile is always a full drawer — never leave an icon rail when closed.
|
|
168
|
+
*/
|
|
163
169
|
private paneWidth;
|
|
164
170
|
/** Drive layout through the CSS variable only — never set inline pane width. */
|
|
165
171
|
private syncPaneWidthVar;
|
|
@@ -173,6 +179,7 @@ export declare class RuiSidebar extends RadiantElement<RuiSidebarBindings> {
|
|
|
173
179
|
private onHandlePointerDown;
|
|
174
180
|
private onHandleKeydown;
|
|
175
181
|
private onScrimClick;
|
|
182
|
+
onMenuLinkClick(): void;
|
|
176
183
|
onHostKeydown(event: Event): void;
|
|
177
184
|
/**
|
|
178
185
|
* Only the pane's `aria-label` is bound below. `data-state`/`data-collapsible`/
|
|
@@ -183,6 +190,8 @@ export declare class RuiSidebar extends RadiantElement<RuiSidebarBindings> {
|
|
|
183
190
|
* (tooltip, menu-button) hit real regressions from binding conversion that
|
|
184
191
|
* weren't fully root-caused. Deferred as a follow-up rather than risking the
|
|
185
192
|
* same class of bug here under the same review budget.
|
|
193
|
+
*
|
|
194
|
+
* @remarks The icon rail stays interactive when collapsed on desktop; the mobile drawer does not.
|
|
186
195
|
*/
|
|
187
196
|
render(): import("@ecopages/jsx").JsxRenderable;
|
|
188
197
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as w,jsxs as C}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as qe,customElement as et,event as tt,onEvent as v,onUpdated as ze,prop as p,query as Ke,state as Be}from"@ecopages/radiant";var le,ue,oe,he,ce,de,me,ge,pe,fe,be,ve,_e,ye,xe,Re,Me,we,Te,Ve,Se,Ee,De,Pe,ke,Ue,Ae,Ie,je,Ce,$e,Fe,Le,Ne;function Je(n,e,t,i,a,u){var _,o,F,L,P,N,S,X=Symbol.metadata||Symbol.for("Symbol.metadata"),G=Object.defineProperty,O=Object.create,H=[O(null),O(null)],J=e.length;function k(r,f,m){return function(s,l){f&&(l=s,s=n);for(var b=0;b<r.length;b++)l=r[b].apply(s,m?[l]:[]);return m?l:s}}function R(r,f,m,s){if(typeof r!="function"&&(s||r!==void 0))throw new TypeError(f+" must "+(m||"be")+" a function"+(s?"":" or undefined"));return r}function Q(r,f,m,s,l,b,T,g,y,x,Z){function q(c){if(!Z(c))throw new TypeError("Attempted to access private element on non-instance")}var z=[].concat(f[0]),ee=f[3],K=!T,E=l===1,te=l===3,ie=l===4,U=l===2;function A(c,V,re){return function(j,se){return V&&(se=j,j=r),re&&re(j),h[c].call(j,se)}}if(!K){var h={},B=[],M=te?"get":ie||E?"set":"value";if(y?(x||E?h={get:Oe(function(){return ee(this)},s,"get"),set:function(c){f[4](this,c)}}:h[M]=ee,x||Oe(h[M],s,U?"":M)):x||(h=Object.getOwnPropertyDescriptor(r,s)),!x&&!y){if((o=H[+g][s])&&(o^l)!==7)throw Error("Decorating two elements with the same name ("+h[M].name+") is not supported yet");H[+g][s]=l<3?1:l}}for(var d=r,I=z.length-1;I>=0;I-=m?2:1){var ne=R(z[I],"A decorator","be",!0),ae=m?z[I-1]:void 0,W={},D={kind:["field","accessor","method","getter","setter","class"][l],name:s,metadata:_,addInitializer:function(c,V){if(c.v)throw new TypeError("attempted to call addInitializer after decoration was finished");R(V,"An initializer","be",!0),b.push(V)}.bind(null,W)};if(K)o=ne.call(ae,d,D),W.v=1,R(o,"class decorators","return")&&(d=o);else if(D.static=g,D.private=y,o=D.access={has:y?Z.bind():function(c){return s in c}},ie||(o.get=y?U?function(c){return q(c),h.value}:A("get",0,q):function(c){return c[s]}),U||te||(o.set=y?A("set",0,q):function(c,V){c[s]=V}),d=ne.call(ae,E?{get:h.get,set:h.set}:h[M],D),W.v=1,E){if(typeof d=="object"&&d)(o=R(d.get,"accessor.get"))&&(h.get=o),(o=R(d.set,"accessor.set"))&&(h.set=o),(o=R(d.init,"accessor.init"))&&B.unshift(o);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else R(d,(x?"field":"method")+" decorators","return")&&(x?B.unshift(d):h[M]=d)}return l<2&&T.push(k(B,g,1),k(b,g,0)),x||K||(y?E?T.splice(-1,0,A("get",g),A("set",g)):T.push(U?h[M]:R.call.bind(h[M])):G(r,s,h)),d}function Y(r){return G(r,X,{configurable:!0,enumerable:!0,value:_})}return u!==void 0&&(_=u[X]),_=O(_??null),P=[],N=function(r){r&&P.push(k(r))},S=function(r,f){for(var m=0;m<t.length;m++){var s=t[m],l=s[1],b=7&l;if((8&l)==r&&!b==f){var T=s[2],g=!!s[3],y=16&l;Q(r?n:n.prototype,s,y,g?"#"+T:Qe(T),b,b<2?[]:r?L=L||[]:F=F||[],P,!!r,g,f,r&&g?function(x){return Ze(x)===n}:a)}}},S(8,0),S(0,0),S(8,1),S(0,1),N(F),N(L),o=P,J||Y(n),{e:o,get c(){var r=[];return J&&[Y(n=Q(n,[e],i,n.name,5,r)),k(r,1)]}}}function Qe(n){var e=Ye(n,"string");return typeof e=="symbol"?e:e+""}function Ye(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Oe(n,e,t){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(n,"name",{configurable:!0,value:t?t+" "+e:e})}catch{}return n}function Ze(n){if(Object(n)!==n)throw TypeError("right-hand side of 'in' should be an object, got "+(n!==null?typeof n:"null"));return n}var $,We=class extends qe{static{({e:[oe,he,ce,de,me,ge,pe,fe,be,ve,_e,ye,xe,Re,Me,we,Te,Ve,Se,Ee,De,Pe,ke,Ue,Ae,Ie,je,Ce,$e,Fe,Le,Ne,le],c:[$,ue]}=Je(this,[et("rui-slider")],[[p({type:String,defaultValue:"single"}),0,"variant"],[p({type:Number,reflect:!0,defaultValue:50}),0,"value"],[p({type:Number,reflect:!0,attribute:"range-min",defaultValue:25}),0,"rangeMin"],[p({type:Number,reflect:!0,attribute:"range-max",defaultValue:75}),0,"rangeMax"],[p({type:Number,defaultValue:0}),0,"min"],[p({type:Number,defaultValue:100}),0,"max"],[p({type:Number,defaultValue:1}),0,"step"],[p({type:Number,defaultValue:0}),0,"minDistance"],[p({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[p({type:String,defaultValue:""}),0,"label"],[p({type:String,defaultValue:""}),0,"name"],[tt({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[Ke({ref:"input"}),0,"inputTarget"],[Ke({ref:"rangeFill"}),0,"rangeFill"],[Be,0,"pendingRange"],[Be,0,"displayedValue"],[ze(["value","min","max","step","variant"]),2,"onSinglePropsUpdated"],[ze(["rangeMin","rangeMax","min","max","step","minDistance","variant"]),2,"onRangePropsUpdated"],[v({ref:"input",type:"pointerdown"}),2,"onPointerDown"],[v({ref:"input",type:"pointerup"}),2,"onPointerUp"],[v({ref:"input",type:"pointercancel"}),2,"onPointerCancel"],[v({ref:"input",type:"input"}),2,"onInput"],[v({ref:"input",type:"change"}),2,"onChange"],[v({selector:"[data-thumb]",type:"pointerdown"}),2,"onThumbPointerDown"],[v({selector:"[data-thumb]",type:"pointermove"}),2,"onThumbPointerMove"],[v({selector:"[data-thumb]",type:"pointerup"}),2,"onThumbPointerUp"],[v({selector:"[data-thumb]",type:"pointercancel"}),2,"onThumbPointerCancel"],[v({selector:"[data-thumb]",type:"keydown"}),2,"onThumbKeydown"]],0,void 0,qe))}variant=(le(this),oe(this));value=(he(this),ce(this));rangeMin=(de(this),me(this));rangeMax=(ge(this),pe(this));min=(fe(this),be(this));max=(ve(this),_e(this));step=(ye(this),xe(this));minDistance=(Re(this),Me(this));disabled=(we(this),Te(this));label=(Ve(this),Se(this));name=(Ee(this),De(this));changeEvent=(Pe(this),ke(this));inputTarget=(Ue(this),Ae(this));rangeFill=(Ie(this),je(this));interacting=(Ce(this),!1);activeThumb=null;pendingRange=$e(this,null);displayedValue=(Fe(this),Le(this,null));resolvedDisabledTabindex=(Ne(this),this.$.disabled.map(e=>e?-1:0));resolvedMinLabel=this.$.label.map(e=>e?`${e} minimum`:"Minimum value");resolvedMaxLabel=this.$.label.map(e=>e?`${e} maximum`:"Maximum value");resolvedName=this.$.name.map(e=>e||void 0);connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.variant==="single"?this.syncInputFromValue():this.syncRangeUi()})}onSinglePropsUpdated(){this.variant!=="single"||this.interacting||this.syncInputFromValue()}onRangePropsUpdated(){this.variant!=="range"||this.activeThumb||this.syncRangeUi()}clamp(e){let t=Math.round(e/this.step)*this.step;return Math.min(this.max,Math.max(this.min,t))}normalizeRange(e=this.rangeMin,t=this.rangeMax){let i=this.clamp(e),a=this.clamp(t);return i>a&&([i,a]=[a,i]),a-i<this.minDistance&&(this.activeThumb==="min"?i=this.clamp(a-this.minDistance):a=this.clamp(i+this.minDistance)),[i,a]}getActiveRange(){return this.normalizeRange(...this.pendingRange??[this.rangeMin,this.rangeMax])}percentFor(e){return this.max===this.min?0:(e-this.min)/(this.max-this.min)*100}valueFromPointer(e,t){let i=t.getBoundingClientRect(),a=Math.min(1,Math.max(0,(e-i.left)/i.width));return this.clamp(this.min+a*(this.max-this.min))}syncInputFromValue(){let e=this.inputTarget;if(!e)return;let t=String(this.value);e.value!==t&&(e.value=t),e.min=String(this.min),e.max=String(this.max),e.step=String(this.step),this.updateDisplayedValue(this.value)}updateDisplayedValue(e){this.displayedValue=e}syncRangeUi(){let[e,t]=this.getActiveRange(),i=!1;if(this.activeThumb||(e!==this.rangeMin&&(this.rangeMin=e,i=!0),t!==this.rangeMax&&(this.rangeMax=t,i=!0)),i){queueMicrotask(()=>{this.activeThumb||this.paintRangeUi(...this.getActiveRange())});return}this.paintRangeUi(e,t)}paintRangeUi(e,t){let i=this.percentFor(e),a=this.percentFor(t),u=this.querySelector(".rui-slider__range-track");u&&(u.style.setProperty("--rui-slider-min",`${i}%`),u.style.setProperty("--rui-slider-max",`${a}%`)),this.rangeFill&&(this.rangeFill.style.left=`${i}%`,this.rangeFill.style.width=`${a-i}%`)}commitRange(e=!0){let[t,i]=this.getActiveRange(),a=t!==this.rangeMin||i!==this.rangeMax;this.pendingRange=null,this.rangeMin=t,this.rangeMax=i,e&&a&&this.changeEvent.emit({values:[t,i]})}setRangeValue(e,t){this.activeThumb=e;let[i,a]=this.pendingRange??[this.rangeMin,this.rangeMax],[u,_]=this.normalizeRange(e==="min"?t:i,e==="max"?t:a);this.pendingRange=[u,_],this.paintRangeUi(u,_)}commitSingleValue(e){let t=Number(e.value);this.updateDisplayedValue(t),t!==this.value&&(this.value=t,this.changeEvent.emit({value:t}))}onPointerDown(e){e.button!==0||this.variant!=="single"||(this.interacting=!0)}onPointerUp(e){!this.interacting||this.variant!=="single"||(this.interacting=!1,this.commitSingleValue(e.target))}onPointerCancel(e){!this.interacting||this.variant!=="single"||(this.interacting=!1,this.commitSingleValue(e.target))}onInput(e){if(this.variant!=="single")return;let t=e.target,i=Number(t.value);if(this.updateDisplayedValue(i),this.interacting){this.changeEvent.emit({value:i});return}this.commitSingleValue(t)}onChange(e){this.variant==="single"&&(this.interacting=!1,this.commitSingleValue(e.target))}onThumbPointerDown(e){if(e.button!==0||this.variant!=="range"||this.disabled)return;let t=e.target.closest("[data-thumb]");if(!t)return;let i=t.getAttribute("data-thumb");this.activeThumb=i,this.pendingRange=[this.rangeMin,this.rangeMax],t.setPointerCapture(e.pointerId),e.preventDefault()}onThumbPointerMove(e){if(!this.activeThumb||this.variant!=="range")return;let t=this.querySelector(".rui-slider__range-track");t&&(this.setRangeValue(this.activeThumb,this.valueFromPointer(e.clientX,t)),this.pendingRange&&this.changeEvent.emit({values:this.pendingRange}))}onThumbPointerUp(){!this.activeThumb||this.variant!=="range"||(this.commitRange(),this.activeThumb=null)}onThumbPointerCancel(){!this.activeThumb||this.variant!=="range"||(this.pendingRange=null,this.syncRangeUi(),this.activeThumb=null)}onThumbKeydown(e){if(this.variant!=="range"||this.disabled)return;let t=e.target.closest("[data-thumb]");if(!t)return;let i=t.getAttribute("data-thumb"),a=i==="min"?this.rangeMin:this.rangeMax,u=a;switch(e.key){case"ArrowRight":case"ArrowUp":u=this.clamp(a+this.step);break;case"ArrowLeft":case"ArrowDown":u=this.clamp(a-this.step);break;case"Home":u=this.min;break;case"End":u=this.max;break;case"PageUp":u=this.clamp(a+this.step*10);break;case"PageDown":u=this.clamp(a-this.step*10);break;default:return}e.preventDefault(),this.setRangeValue(i,u),this.commitRange(!1),this.changeEvent.emit({values:[this.rangeMin,this.rangeMax]}),this.activeThumb=null}render(){let[e,t]=this.getActiveRange(),i=this.displayedValue??this.value;return this.variant==="range"?C("div",{class:"rui-slider rui-slider--range",children:[this.label?w("span",{class:"rui-slider__label",children:this.label}):null,w("div",{class:"rui-slider__range",children:C("div",{class:"rui-slider__range-track",children:[w("div",{class:"rui-slider__range-fill","data-ref":"rangeFill"}),w("button",{type:"button",class:"rui-slider__thumb","data-ref":"rangeMinThumb","data-thumb":"min",role:"slider",tabindex:this.resolvedDisabledTabindex,"aria-label":this.resolvedMinLabel,"aria-valuemin":this.min,"aria-valuemax":t,"aria-valuenow":e,disabled:this.$.disabled}),w("button",{type:"button",class:"rui-slider__thumb","data-ref":"rangeMaxThumb","data-thumb":"max",role:"slider",tabindex:this.resolvedDisabledTabindex,"aria-label":this.resolvedMaxLabel,"aria-valuemin":e,"aria-valuemax":this.max,"aria-valuenow":t,disabled:this.$.disabled})]})}),C("span",{class:"rui-slider__value","data-ref":"value","aria-hidden":"true",children:[e," \u2013 ",t]})]}):C("label",{class:"rui-slider",children:[this.label?w("span",{class:"rui-slider__label",children:this.label}):null,w("input",{type:"range","data-ref":"input","data-rui-control":!0,"data-rui-control-type":"number",class:"rui-slider__input",disabled:this.$.disabled,name:this.resolvedName,"aria-valuemin":this.min,"aria-valuemax":this.max,"aria-valuenow":this.value}),w("span",{class:"rui-slider__value","data-ref":"value","aria-hidden":"true",children:i})]})}static{ue()}};import{jsx as at}from"@ecopages/jsx/jsx-runtime";var it=Symbol.for("@ecopages/storybook-radiant.viewElement"),Xe=Symbol.for("@ecopages/storybook-radiant.scriptModule"),Ge=Symbol.for("@ecopages/storybook-radiant.scriptExport");function nt(n,e){n[it]=e;let t=e[Xe];t&&(n[Xe]=t,n[Ge]=e[Ge]??e.name)}function He(n,e,t){let i=a=>e(a);return nt(i,n),i}var rt=He($,({values:n,...e})=>at("rui-slider",{...e,rangeMin:n?.[0],rangeMax:n?.[1]}),{stylesheets:["./slider.css"]});export{rt as RuiSlider,$ as RuiSliderElement};
|
|
1
|
+
import{jsx as w,jsxs as C}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as ze,customElement as We,event as Ye,onEvent as v,onUpdated as Ke,prop as p,query as Oe,state as Be}from"@ecopages/radiant";var se,le,ue,he,oe,ce,de,me,ge,pe,fe,be,ve,_e,ye,xe,Me,Re,we,Te,Ve,Se,De,Ee,Pe,Ue,ke,je,$e,Ae,Ce,Fe,Ie,Le;function Ge(n,e,t,i,r,u){var _,h,F,I,P,L,S,X=Symbol.metadata||Symbol.for("Symbol.metadata"),G=Object.defineProperty,q=Object.create,H=[q(null),q(null)],J=e.length;function U(a,f,m){return function(s,l){f&&(l=s,s=n);for(var b=0;b<a.length;b++)l=a[b].apply(s,m?[l]:[]);return m?l:s}}function M(a,f,m,s){if(typeof a!="function"&&(s||a!==void 0))throw new TypeError(f+" must "+(m||"be")+" a function"+(s?"":" or undefined"));return a}function Q(a,f,m,s,l,b,T,g,y,x,Y){function z(c){if(!Y(c))throw new TypeError("Attempted to access private element on non-instance")}var K=[].concat(f[0]),Z=f[3],O=!T,D=l===1,ee=l===3,te=l===4,k=l===2;function j(c,V,ae){return function(A,re){return V&&(re=A,A=a),ae&&ae(A),o[c].call(A,re)}}if(!O){var o={},B=[],R=ee?"get":te||D?"set":"value";if(y?(x||D?o={get:qe(function(){return Z(this)},s,"get"),set:function(c){f[4](this,c)}}:o[R]=Z,x||qe(o[R],s,k?"":R)):x||(o=Object.getOwnPropertyDescriptor(a,s)),!x&&!y){if((h=H[+g][s])&&(h^l)!==7)throw Error("Decorating two elements with the same name ("+o[R].name+") is not supported yet");H[+g][s]=l<3?1:l}}for(var d=a,$=K.length-1;$>=0;$-=m?2:1){var ie=M(K[$],"A decorator","be",!0),ne=m?K[$-1]:void 0,N={},E={kind:["field","accessor","method","getter","setter","class"][l],name:s,metadata:_,addInitializer:function(c,V){if(c.v)throw new TypeError("attempted to call addInitializer after decoration was finished");M(V,"An initializer","be",!0),b.push(V)}.bind(null,N)};if(O)h=ie.call(ne,d,E),N.v=1,M(h,"class decorators","return")&&(d=h);else if(E.static=g,E.private=y,h=E.access={has:y?Y.bind():function(c){return s in c}},te||(h.get=y?k?function(c){return z(c),o.value}:j("get",0,z):function(c){return c[s]}),k||ee||(h.set=y?j("set",0,z):function(c,V){c[s]=V}),d=ie.call(ne,D?{get:o.get,set:o.set}:o[R],E),N.v=1,D){if(typeof d=="object"&&d)(h=M(d.get,"accessor.get"))&&(o.get=h),(h=M(d.set,"accessor.set"))&&(o.set=h),(h=M(d.init,"accessor.init"))&&B.unshift(h);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else M(d,(x?"field":"method")+" decorators","return")&&(x?B.unshift(d):o[R]=d)}return l<2&&T.push(U(B,g,1),U(b,g,0)),x||O||(y?D?T.splice(-1,0,j("get",g),j("set",g)):T.push(k?o[R]:M.call.bind(o[R])):G(a,s,o)),d}function W(a){return G(a,X,{configurable:!0,enumerable:!0,value:_})}return u!==void 0&&(_=u[X]),_=q(_??null),P=[],L=function(a){a&&P.push(U(a))},S=function(a,f){for(var m=0;m<t.length;m++){var s=t[m],l=s[1],b=7&l;if((8&l)==a&&!b==f){var T=s[2],g=!!s[3],y=16&l;Q(a?n:n.prototype,s,y,g?"#"+T:He(T),b,b<2?[]:a?I=I||[]:F=F||[],P,!!a,g,f,a&&g?function(x){return Qe(x)===n}:r)}}},S(8,0),S(0,0),S(8,1),S(0,1),L(F),L(I),h=P,J||W(n),{e:h,get c(){var a=[];return J&&[W(n=Q(n,[e],i,n.name,5,a)),U(a,1)]}}}function He(n){var e=Je(n,"string");return typeof e=="symbol"?e:e+""}function Je(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function qe(n,e,t){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(n,"name",{configurable:!0,value:t?t+" "+e:e})}catch{}return n}function Qe(n){if(Object(n)!==n)throw TypeError("right-hand side of 'in' should be an object, got "+(n!==null?typeof n:"null"));return n}var Xe,Ne=class extends ze{static{({e:[ue,he,oe,ce,de,me,ge,pe,fe,be,ve,_e,ye,xe,Me,Re,we,Te,Ve,Se,De,Ee,Pe,Ue,ke,je,$e,Ae,Ce,Fe,Ie,Le,se],c:[Xe,le]}=Ge(this,[We("rui-slider")],[[p({type:String,defaultValue:"single"}),0,"variant"],[p({type:Number,reflect:!0,defaultValue:50}),0,"value"],[p({type:Number,reflect:!0,attribute:"range-min",defaultValue:25}),0,"rangeMin"],[p({type:Number,reflect:!0,attribute:"range-max",defaultValue:75}),0,"rangeMax"],[p({type:Number,defaultValue:0}),0,"min"],[p({type:Number,defaultValue:100}),0,"max"],[p({type:Number,defaultValue:1}),0,"step"],[p({type:Number,defaultValue:0}),0,"minDistance"],[p({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[p({type:String,defaultValue:""}),0,"label"],[p({type:String,defaultValue:""}),0,"name"],[Ye({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[Oe({ref:"input"}),0,"inputTarget"],[Oe({ref:"rangeFill"}),0,"rangeFill"],[Be,0,"pendingRange"],[Be,0,"displayedValue"],[Ke(["value","min","max","step","variant"]),2,"onSinglePropsUpdated"],[Ke(["rangeMin","rangeMax","min","max","step","minDistance","variant"]),2,"onRangePropsUpdated"],[v({ref:"input",type:"pointerdown"}),2,"onPointerDown"],[v({ref:"input",type:"pointerup"}),2,"onPointerUp"],[v({ref:"input",type:"pointercancel"}),2,"onPointerCancel"],[v({ref:"input",type:"input"}),2,"onInput"],[v({ref:"input",type:"change"}),2,"onChange"],[v({selector:"[data-thumb]",type:"pointerdown"}),2,"onThumbPointerDown"],[v({selector:"[data-thumb]",type:"pointermove"}),2,"onThumbPointerMove"],[v({selector:"[data-thumb]",type:"pointerup"}),2,"onThumbPointerUp"],[v({selector:"[data-thumb]",type:"pointercancel"}),2,"onThumbPointerCancel"],[v({selector:"[data-thumb]",type:"keydown"}),2,"onThumbKeydown"]],0,void 0,ze))}variant=(se(this),ue(this));value=(he(this),oe(this));rangeMin=(ce(this),de(this));rangeMax=(me(this),ge(this));min=(pe(this),fe(this));max=(be(this),ve(this));step=(_e(this),ye(this));minDistance=(xe(this),Me(this));disabled=(Re(this),we(this));label=(Te(this),Ve(this));name=(Se(this),De(this));changeEvent=(Ee(this),Pe(this));inputTarget=(Ue(this),ke(this));rangeFill=(je(this),$e(this));interacting=(Ae(this),!1);activeThumb=null;pendingRange=Ce(this,null);displayedValue=(Fe(this),Ie(this,null));resolvedDisabledTabindex=(Le(this),this.$.disabled.map(e=>e?-1:0));resolvedMinLabel=this.$.label.map(e=>e?`${e} minimum`:"Minimum value");resolvedMaxLabel=this.$.label.map(e=>e?`${e} maximum`:"Maximum value");resolvedName=this.$.name.map(e=>e||void 0);connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.variant==="single"?this.syncInputFromValue():this.syncRangeUi()})}onSinglePropsUpdated(){this.variant!=="single"||this.interacting||this.syncInputFromValue()}onRangePropsUpdated(){this.variant!=="range"||this.activeThumb||this.syncRangeUi()}clamp(e){let t=Math.round(e/this.step)*this.step;return Math.min(this.max,Math.max(this.min,t))}normalizeRange(e=this.rangeMin,t=this.rangeMax){let i=this.clamp(e),r=this.clamp(t);return i>r&&([i,r]=[r,i]),r-i<this.minDistance&&(this.activeThumb==="min"?i=this.clamp(r-this.minDistance):r=this.clamp(i+this.minDistance)),[i,r]}getActiveRange(){return this.normalizeRange(...this.pendingRange??[this.rangeMin,this.rangeMax])}percentFor(e){return this.max===this.min?0:(e-this.min)/(this.max-this.min)*100}valueFromPointer(e,t){let i=t.getBoundingClientRect(),r=Math.min(1,Math.max(0,(e-i.left)/i.width));return this.clamp(this.min+r*(this.max-this.min))}syncInputFromValue(){let e=this.inputTarget;if(!e)return;let t=String(this.value);e.value!==t&&(e.value=t),e.min=String(this.min),e.max=String(this.max),e.step=String(this.step),this.updateDisplayedValue(this.value)}updateDisplayedValue(e){this.displayedValue=e}syncRangeUi(){let[e,t]=this.getActiveRange(),i=!1;if(this.activeThumb||(e!==this.rangeMin&&(this.rangeMin=e,i=!0),t!==this.rangeMax&&(this.rangeMax=t,i=!0)),i){queueMicrotask(()=>{this.activeThumb||this.paintRangeUi(...this.getActiveRange())});return}this.paintRangeUi(e,t)}paintRangeUi(e,t){let i=this.percentFor(e),r=this.percentFor(t),u=this.querySelector(".rui-slider__range-track");u&&(u.style.setProperty("--rui-slider-min",`${i}%`),u.style.setProperty("--rui-slider-max",`${r}%`)),this.rangeFill&&(this.rangeFill.style.left=`${i}%`,this.rangeFill.style.width=`${r-i}%`)}commitRange(e=!0){let[t,i]=this.getActiveRange(),r=t!==this.rangeMin||i!==this.rangeMax;this.pendingRange=null,this.rangeMin=t,this.rangeMax=i,e&&r&&this.changeEvent.emit({values:[t,i]})}setRangeValue(e,t){this.activeThumb=e;let[i,r]=this.pendingRange??[this.rangeMin,this.rangeMax],[u,_]=this.normalizeRange(e==="min"?t:i,e==="max"?t:r);this.pendingRange=[u,_],this.paintRangeUi(u,_)}commitSingleValue(e){let t=Number(e.value);this.updateDisplayedValue(t),t!==this.value&&(this.value=t,this.changeEvent.emit({value:t}))}onPointerDown(e){e.button!==0||this.variant!=="single"||(this.interacting=!0)}onPointerUp(e){!this.interacting||this.variant!=="single"||(this.interacting=!1,this.commitSingleValue(e.target))}onPointerCancel(e){!this.interacting||this.variant!=="single"||(this.interacting=!1,this.commitSingleValue(e.target))}onInput(e){if(this.variant!=="single")return;let t=e.target,i=Number(t.value);if(this.updateDisplayedValue(i),this.interacting){this.changeEvent.emit({value:i});return}this.commitSingleValue(t)}onChange(e){this.variant==="single"&&(this.interacting=!1,this.commitSingleValue(e.target))}onThumbPointerDown(e){if(e.button!==0||this.variant!=="range"||this.disabled)return;let t=e.target.closest("[data-thumb]");if(!t)return;let i=t.getAttribute("data-thumb");this.activeThumb=i,this.pendingRange=[this.rangeMin,this.rangeMax],t.setPointerCapture(e.pointerId),e.preventDefault()}onThumbPointerMove(e){if(!this.activeThumb||this.variant!=="range")return;let t=this.querySelector(".rui-slider__range-track");t&&(this.setRangeValue(this.activeThumb,this.valueFromPointer(e.clientX,t)),this.pendingRange&&this.changeEvent.emit({values:this.pendingRange}))}onThumbPointerUp(){!this.activeThumb||this.variant!=="range"||(this.commitRange(),this.activeThumb=null)}onThumbPointerCancel(){!this.activeThumb||this.variant!=="range"||(this.pendingRange=null,this.syncRangeUi(),this.activeThumb=null)}onThumbKeydown(e){if(this.variant!=="range"||this.disabled)return;let t=e.target.closest("[data-thumb]");if(!t)return;let i=t.getAttribute("data-thumb"),r=i==="min"?this.rangeMin:this.rangeMax,u=r;switch(e.key){case"ArrowRight":case"ArrowUp":u=this.clamp(r+this.step);break;case"ArrowLeft":case"ArrowDown":u=this.clamp(r-this.step);break;case"Home":u=this.min;break;case"End":u=this.max;break;case"PageUp":u=this.clamp(r+this.step*10);break;case"PageDown":u=this.clamp(r-this.step*10);break;default:return}e.preventDefault(),this.setRangeValue(i,u),this.commitRange(!1),this.changeEvent.emit({values:[this.rangeMin,this.rangeMax]}),this.activeThumb=null}render(){let[e,t]=this.getActiveRange(),i=this.displayedValue??this.value;return this.variant==="range"?C("div",{class:"rui-slider rui-slider--range",children:[this.label?w("span",{class:"rui-slider__label",children:this.label}):null,w("div",{class:"rui-slider__range",children:C("div",{class:"rui-slider__range-track",children:[w("div",{class:"rui-slider__range-fill","data-ref":"rangeFill"}),w("button",{type:"button",class:"rui-slider__thumb","data-ref":"rangeMinThumb","data-thumb":"min",role:"slider",tabindex:this.resolvedDisabledTabindex,"aria-label":this.resolvedMinLabel,"aria-valuemin":this.min,"aria-valuemax":t,"aria-valuenow":e,disabled:this.$.disabled}),w("button",{type:"button",class:"rui-slider__thumb","data-ref":"rangeMaxThumb","data-thumb":"max",role:"slider",tabindex:this.resolvedDisabledTabindex,"aria-label":this.resolvedMaxLabel,"aria-valuemin":e,"aria-valuemax":this.max,"aria-valuenow":t,disabled:this.$.disabled})]})}),C("span",{class:"rui-slider__value","data-ref":"value","aria-hidden":"true",children:[e," \u2013 ",t]})]}):C("label",{class:"rui-slider",children:[this.label?w("span",{class:"rui-slider__label",children:this.label}):null,w("input",{type:"range","data-ref":"input","data-rui-control":!0,"data-rui-control-type":"number",class:"rui-slider__input",disabled:this.$.disabled,name:this.resolvedName,"aria-valuemin":this.min,"aria-valuemax":this.max,"aria-valuenow":this.value}),w("span",{class:"rui-slider__value","data-ref":"value","aria-hidden":"true",children:i})]})}static{le()}};import{jsx as Ze}from"@ecopages/jsx/jsx-runtime";function et({values:n,...e}){return Ze("rui-slider",{...e,rangeMin:n?.[0],rangeMax:n?.[1]})}export{et as RuiSlider,Xe as RuiSliderElement};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|