@ecopages/radiant-ui 0.1.0-rc.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/dist/components/ui/alert/alert.d.ts +2 -4
- package/dist/components/ui/alert/alert.script.d.ts +25 -15
- package/dist/components/ui/autocomplete/autocomplete.css +1 -2
- package/dist/components/ui/autocomplete/autocomplete.d.ts +8 -3
- package/dist/components/ui/autocomplete/autocomplete.script.d.ts +29 -4
- package/dist/components/ui/avatar/avatar.css +10 -8
- package/dist/components/ui/avatar/avatar.d.ts +3 -1
- package/dist/components/ui/breadcrumb/breadcrumb.d.ts +11 -11
- package/dist/components/ui/breadcrumb/breadcrumb.script.d.ts +10 -10
- package/dist/components/ui/calendar/calendar.css +10 -5
- package/dist/components/ui/calendar/calendar.script.d.ts +24 -21
- package/dist/components/ui/calendar/index.js +1 -1
- package/dist/components/ui/calendar/index.js.map +3 -3
- package/dist/components/ui/carousel/carousel-autoplay.d.ts +22 -0
- package/dist/components/ui/carousel/carousel-swipe.d.ts +17 -0
- package/dist/components/ui/carousel/carousel-window.d.ts +63 -0
- package/dist/components/ui/carousel/carousel.css +71 -18
- package/dist/components/ui/carousel/carousel.d.ts +8 -4
- package/dist/components/ui/carousel/carousel.script.d.ts +73 -40
- 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.d.ts +11 -0
- package/dist/components/ui/checkbox/checkbox.script.d.ts +31 -8
- package/dist/components/ui/checkbox/index.js +1 -1
- package/dist/components/ui/checkbox/index.js.map +4 -4
- package/dist/components/ui/checkbox-group/checkbox-group.d.ts +4 -2
- package/dist/components/ui/checkbox-group/checkbox-group.script.d.ts +39 -20
- package/dist/components/ui/checkbox-group/index.js +1 -1
- package/dist/components/ui/checkbox-group/index.js.map +4 -4
- package/dist/components/ui/combobox/combobox.css +9 -1
- package/dist/components/ui/combobox/combobox.d.ts +12 -4
- package/dist/components/ui/combobox/combobox.script.d.ts +74 -25
- package/dist/components/ui/combobox/index.d.ts +2 -2
- 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.d.ts +6 -2
- package/dist/components/ui/cycle-toggle/cycle-toggle.script.d.ts +35 -4
- package/dist/components/ui/cycle-toggle/index.js +1 -1
- package/dist/components/ui/cycle-toggle/index.js.map +3 -3
- package/dist/components/ui/date-field/date-field.css +13 -17
- package/dist/components/ui/date-field/date-field.d.ts +10 -8
- package/dist/components/ui/date-field/date-field.script.d.ts +35 -52
- 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-input/date-input-segment-dom.d.ts +24 -0
- package/dist/components/ui/date-input/date-input.css +50 -0
- package/dist/components/ui/date-input/date-input.d.ts +8 -0
- package/dist/components/ui/date-input/date-input.script.d.ts +137 -0
- package/dist/components/ui/date-input/index.d.ts +2 -0
- package/dist/components/ui/date-input/index.js +2 -0
- package/dist/components/ui/date-input/index.js.map +7 -0
- package/dist/components/ui/date-range-picker/date-range-picker.css +18 -19
- package/dist/components/ui/date-range-picker/date-range-picker.d.ts +11 -9
- package/dist/components/ui/date-range-picker/date-range-picker.script.d.ts +42 -51
- 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 +18 -14
- package/dist/components/ui/dialog/dialog.d.ts +6 -0
- package/dist/components/ui/dialog/dialog.script.d.ts +43 -10
- 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.script.d.ts +19 -3
- package/dist/components/ui/disclosure/disclosure.css +3 -6
- package/dist/components/ui/disclosure/disclosure.d.ts +23 -7
- package/dist/components/ui/disclosure/disclosure.script.d.ts +31 -7
- package/dist/components/ui/disclosure/index.d.ts +1 -1
- package/dist/components/ui/disclosure/index.js +1 -1
- package/dist/components/ui/disclosure/index.js.map +4 -4
- package/dist/components/ui/field/field-description.d.ts +1 -0
- package/dist/components/ui/field/field-error.d.ts +2 -2
- package/dist/components/ui/field/field.d.ts +4 -4
- package/dist/components/ui/field/field.script.d.ts +54 -24
- 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 +38 -1
- package/dist/components/ui/form/form-context.d.ts +3 -0
- package/dist/components/ui/form/form.d.ts +6 -0
- package/dist/components/ui/form/form.script.d.ts +29 -12
- package/dist/components/ui/form/index.d.ts +2 -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 +4 -3
- package/dist/components/ui/grid/grid.script.d.ts +19 -11
- package/dist/components/ui/hover-card/hover-card.css +12 -101
- package/dist/components/ui/hover-card/hover-card.d.ts +7 -2
- package/dist/components/ui/hover-card/hover-card.script.d.ts +36 -5
- package/dist/components/ui/hover-card/index.js +1 -1
- package/dist/components/ui/hover-card/index.js.map +4 -4
- 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 +1 -1
- package/dist/components/ui/knob/index.js +1 -1
- package/dist/components/ui/knob/index.js.map +3 -3
- package/dist/components/ui/knob/knob.css +6 -1
- package/dist/components/ui/knob/knob.d.ts +4 -4
- package/dist/components/ui/knob/knob.script.d.ts +55 -20
- 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 +2 -1
- package/dist/components/ui/listbox/index.d.ts +2 -2
- 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 +14 -0
- package/dist/components/ui/listbox/listbox.d.ts +16 -2
- package/dist/components/ui/listbox/listbox.script.d.ts +55 -12
- 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.d.ts +2 -2
- package/dist/components/ui/menu-button/menu-button.script.d.ts +30 -27
- 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.script.d.ts +41 -15
- package/dist/components/ui/meter/index.js +1 -1
- package/dist/components/ui/meter/index.js.map +3 -3
- package/dist/components/ui/meter/meter.css +27 -2
- package/dist/components/ui/meter/meter.script.d.ts +19 -14
- package/dist/components/ui/navigation-menu/index.d.ts +1 -1
- 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 +32 -34
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts +34 -5
- package/dist/components/ui/navigation-menu/navigation-menu.script.d.ts +93 -12
- 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 +1 -1
- package/dist/components/ui/number-field/number-field.d.ts +8 -19
- package/dist/components/ui/number-field/number-field.script.d.ts +30 -9
- package/dist/components/ui/pagination/index.d.ts +1 -1
- package/dist/components/ui/pagination/index.js +1 -1
- package/dist/components/ui/pagination/index.js.map +3 -3
- package/dist/components/ui/pagination/pagination.css +50 -13
- package/dist/components/ui/pagination/pagination.d.ts +33 -9
- package/dist/components/ui/pagination/pagination.script.d.ts +29 -9
- 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 +17 -1
- package/dist/components/ui/popover/popover.script.d.ts +57 -9
- 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 +2 -2
- package/dist/components/ui/radio-group/radio-group.script.d.ts +35 -16
- package/dist/components/ui/select/index.d.ts +2 -2
- 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 +8 -6
- package/dist/components/ui/select/select.d.ts +18 -9
- package/dist/components/ui/select/select.script.d.ts +74 -26
- package/dist/components/ui/shared/calendar-popover-behavior.d.ts +27 -0
- package/dist/components/ui/shared/control-toggle.css +8 -4
- package/dist/components/ui/shared/field-label.d.ts +5 -0
- package/dist/components/ui/shared/listbox-host-controller.d.ts +41 -0
- package/dist/components/ui/shared/listbox-option.d.ts +4 -0
- package/dist/components/ui/shared/multi-value.d.ts +23 -1
- package/dist/components/ui/shared/numeric-range.d.ts +8 -0
- package/dist/components/ui/shared/popover.css +10 -99
- package/dist/components/ui/sidebar/index.d.ts +2 -1
- 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.d.ts +12 -0
- package/dist/components/ui/sidebar/sidebar-trigger.script.d.ts +52 -31
- package/dist/components/ui/sidebar/sidebar.css +67 -61
- package/dist/components/ui/sidebar/sidebar.d.ts +9 -4
- package/dist/components/ui/sidebar/sidebar.script.d.ts +42 -20
- 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.css +5 -5
- package/dist/components/ui/slider/slider.d.ts +20 -10
- package/dist/components/ui/slider/slider.script.d.ts +103 -27
- 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 +28 -22
- package/dist/components/ui/switch/switch.d.ts +13 -0
- package/dist/components/ui/switch/switch.script.d.ts +34 -8
- package/dist/components/ui/table/index.js +1 -1
- package/dist/components/ui/table/index.js.map +4 -4
- package/dist/components/ui/table/table.d.ts +9 -7
- package/dist/components/ui/table/table.script.d.ts +55 -12
- package/dist/components/ui/tabs/tabs.css +18 -12
- package/dist/components/ui/tabs/tabs.d.ts +7 -4
- package/dist/components/ui/tabs/tabs.script.d.ts +39 -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.d.ts +19 -7
- package/dist/components/ui/tag-group/tag-group.script.d.ts +58 -10
- 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.css +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/toast.css +35 -32
- package/dist/components/ui/toast/toast.script.d.ts +17 -31
- package/dist/components/ui/toast/toaster.script.d.ts +24 -12
- package/dist/components/ui/toc/toc.script.d.ts +19 -8
- package/dist/components/ui/toolbar/toolbar.d.ts +5 -0
- package/dist/components/ui/toolbar/toolbar.script.d.ts +24 -4
- 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.css +14 -94
- package/dist/components/ui/tooltip/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip/tooltip.script.d.ts +36 -6
- package/dist/components/ui/tree/tree.d.ts +4 -3
- package/dist/components/ui/tree/tree.script.d.ts +28 -15
- package/dist/components/ui/treegrid/treegrid.d.ts +5 -3
- package/dist/components/ui/treegrid/treegrid.script.d.ts +33 -14
- package/dist/components/ui/window-splitter/index.d.ts +1 -1
- package/dist/components/ui/window-splitter/index.js +1 -1
- package/dist/components/ui/window-splitter/index.js.map +3 -3
- package/dist/components/ui/window-splitter/window-splitter.d.ts +10 -1
- package/dist/components/ui/window-splitter/window-splitter.script.d.ts +26 -8
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/lib/icons/check.d.ts +3 -0
- package/dist/lib/icons/chevron-down.d.ts +0 -1
- package/dist/lib/icons/index.d.ts +2 -0
- package/dist/lib/icons/x.d.ts +5 -0
- package/dist/lib/intl-date/index.d.ts +4 -2
- package/dist/lib/intl-date/segment-editing.d.ts +34 -0
- package/dist/lib/intl-date/segments.d.ts +26 -4
- package/dist/lib/non-empty.d.ts +6 -0
- package/dist/lib/unique-id.d.ts +11 -0
- package/dist/lib/viewport/breakpoints.d.ts +6 -0
- package/dist/lib/viewport/mobile-layout.d.ts +15 -0
- package/dist/styles/primitives.css +14 -11
- package/dist/styles/radiant-ui-core.css +10 -0
- package/dist/styles/radiant-ui.css +40 -11
- package/dist/styles/style-dependencies.json +38 -13
- package/dist/styles/styles.css +485 -252
- package/dist/styles/tailwind.css +40 -101
- package/dist/styles/tokens/presets/colors/aurora.css +2 -0
- package/dist/styles/tokens/presets/colors/basalt.css +2 -0
- package/dist/styles/tokens/presets/colors/ember.css +2 -0
- package/dist/styles/tokens/presets/colors/glacier.css +2 -0
- package/dist/styles/tokens/semantic.css +1 -0
- package/dist/styles/tokens/system.css +11 -3
- package/dist/styles/tokens/typography/default.css +8 -0
- package/package.json +27 -13
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
rui-toaster {
|
|
4
|
-
--
|
|
5
|
-
--
|
|
4
|
+
--rui-toaster-width: 356px;
|
|
5
|
+
--rui-toaster-gap: 14px;
|
|
6
|
+
--rui-toaster-offset: 24px;
|
|
7
|
+
--rui-toaster-inset-x: 16px;
|
|
8
|
+
--rui-toaster-inset-bottom: 16px;
|
|
6
9
|
position: fixed;
|
|
7
10
|
z-index: var(--z-toast, 50);
|
|
8
11
|
pointer-events: none;
|
|
9
12
|
box-sizing: border-box;
|
|
10
|
-
width: var(--width
|
|
13
|
+
width: var(--rui-toaster-width);
|
|
11
14
|
margin: 0;
|
|
12
15
|
padding: 0;
|
|
13
16
|
}
|
|
@@ -15,20 +18,20 @@ rui-toaster[data-contained='true'] {
|
|
|
15
18
|
position: absolute;
|
|
16
19
|
}
|
|
17
20
|
rui-toaster[data-y-position='top'] {
|
|
18
|
-
top: var(--
|
|
21
|
+
top: var(--rui-toaster-offset, 24px);
|
|
19
22
|
bottom: auto;
|
|
20
23
|
}
|
|
21
24
|
rui-toaster[data-y-position='bottom'] {
|
|
22
|
-
bottom: var(--
|
|
25
|
+
bottom: var(--rui-toaster-offset, 24px);
|
|
23
26
|
top: auto;
|
|
24
27
|
}
|
|
25
28
|
rui-toaster[data-x-position='end'] {
|
|
26
|
-
right: var(--
|
|
29
|
+
right: var(--rui-toaster-offset, 24px);
|
|
27
30
|
left: auto;
|
|
28
31
|
transform: none;
|
|
29
32
|
}
|
|
30
33
|
rui-toaster[data-x-position='start'] {
|
|
31
|
-
left: var(--
|
|
34
|
+
left: var(--rui-toaster-offset, 24px);
|
|
32
35
|
right: auto;
|
|
33
36
|
transform: none;
|
|
34
37
|
}
|
|
@@ -38,20 +41,20 @@ rui-toaster[data-x-position='center'] {
|
|
|
38
41
|
transform: translateX(-50%);
|
|
39
42
|
}
|
|
40
43
|
rui-toast {
|
|
41
|
-
--y: translateY(0);
|
|
42
|
-
--z
|
|
44
|
+
--rui-toast-y: translateY(0);
|
|
45
|
+
--rui-toast-z: 1;
|
|
43
46
|
position: absolute;
|
|
44
47
|
left: 0;
|
|
45
48
|
width: 100%;
|
|
46
49
|
opacity: 0;
|
|
47
|
-
transform: var(--y);
|
|
50
|
+
transform: var(--rui-toast-y);
|
|
48
51
|
touch-action: none;
|
|
49
52
|
box-sizing: border-box;
|
|
50
53
|
outline: none;
|
|
51
54
|
overflow-wrap: anywhere;
|
|
52
55
|
overflow: hidden;
|
|
53
56
|
pointer-events: auto;
|
|
54
|
-
z-index: var(--z
|
|
57
|
+
z-index: var(--rui-toast-z);
|
|
55
58
|
transition: transform 400ms ease,
|
|
56
59
|
opacity 400ms ease,
|
|
57
60
|
height 400ms ease;
|
|
@@ -70,10 +73,10 @@ rui-toast:not([data-mounted='true']) {
|
|
|
70
73
|
opacity: 0;
|
|
71
74
|
}
|
|
72
75
|
rui-toaster[data-y-position='bottom'] rui-toast:not([data-mounted='true']) {
|
|
73
|
-
--y: translateY(100%);
|
|
76
|
+
--rui-toast-y: translateY(100%);
|
|
74
77
|
}
|
|
75
78
|
rui-toaster[data-y-position='top'] rui-toast:not([data-mounted='true']) {
|
|
76
|
-
--y: translateY(-100%);
|
|
79
|
+
--rui-toast-y: translateY(-100%);
|
|
77
80
|
}
|
|
78
81
|
rui-toast[data-mounted='true'] {
|
|
79
82
|
opacity: 1;
|
|
@@ -86,7 +89,7 @@ rui-toast[data-expanded='false'][data-front='false'] {
|
|
|
86
89
|
pointer-events: none;
|
|
87
90
|
}
|
|
88
91
|
rui-toast[data-swiping='true'] {
|
|
89
|
-
transform: var(--y) translateY(var(--swipe-
|
|
92
|
+
transform: var(--rui-toast-y) translateY(var(--rui-toast-swipe-y, 0px)) translateX(var(--rui-toast-swipe-x, 0px));
|
|
90
93
|
transition: none;
|
|
91
94
|
}
|
|
92
95
|
rui-toast[data-removed='true'][data-swipe-out='false'] {
|
|
@@ -96,10 +99,10 @@ rui-toast[data-removed='true'][data-swipe-out='false'] {
|
|
|
96
99
|
height 400ms ease;
|
|
97
100
|
}
|
|
98
101
|
rui-toaster[data-y-position='bottom'] rui-toast[data-removed='true'][data-swipe-out='false'] {
|
|
99
|
-
--y: translateY(100%);
|
|
102
|
+
--rui-toast-y: translateY(100%);
|
|
100
103
|
}
|
|
101
104
|
rui-toaster[data-y-position='top'] rui-toast[data-removed='true'][data-swipe-out='false'] {
|
|
102
|
-
--y: translateY(-100%);
|
|
105
|
+
--rui-toast-y: translateY(-100%);
|
|
103
106
|
}
|
|
104
107
|
rui-toast[data-swipe-out='true'] {
|
|
105
108
|
animation-duration: 200ms;
|
|
@@ -123,7 +126,7 @@ rui-toaster[data-y-position='bottom'] rui-toast[data-expanded='true']::after {
|
|
|
123
126
|
position: absolute;
|
|
124
127
|
left: 0;
|
|
125
128
|
width: 100%;
|
|
126
|
-
height: calc(var(--gap
|
|
129
|
+
height: calc(var(--rui-toaster-gap) + 1px);
|
|
127
130
|
bottom: 100%;
|
|
128
131
|
}
|
|
129
132
|
rui-toaster[data-y-position='top'] rui-toast[data-expanded='true']::after {
|
|
@@ -131,7 +134,7 @@ rui-toaster[data-y-position='top'] rui-toast[data-expanded='true']::after {
|
|
|
131
134
|
position: absolute;
|
|
132
135
|
left: 0;
|
|
133
136
|
width: 100%;
|
|
134
|
-
height: calc(var(--gap
|
|
137
|
+
height: calc(var(--rui-toaster-gap) + 1px);
|
|
135
138
|
top: 100%;
|
|
136
139
|
}
|
|
137
140
|
@layer components {
|
|
@@ -308,62 +311,62 @@ rui-toaster[data-y-position='top'] rui-toast[data-expanded='true']::after {
|
|
|
308
311
|
}
|
|
309
312
|
@keyframes rui-toast-swipe-out-left {
|
|
310
313
|
from {
|
|
311
|
-
transform: var(--y) translateX(var(--swipe-
|
|
314
|
+
transform: var(--rui-toast-y) translateX(var(--rui-toast-swipe-x));
|
|
312
315
|
opacity: 1;
|
|
313
316
|
}
|
|
314
317
|
to {
|
|
315
|
-
transform: var(--y) translateX(calc(var(--swipe-
|
|
318
|
+
transform: var(--rui-toast-y) translateX(calc(var(--rui-toast-swipe-x) - 100%));
|
|
316
319
|
opacity: 0;
|
|
317
320
|
}
|
|
318
321
|
}
|
|
319
322
|
@keyframes rui-toast-swipe-out-right {
|
|
320
323
|
from {
|
|
321
|
-
transform: var(--y) translateX(var(--swipe-
|
|
324
|
+
transform: var(--rui-toast-y) translateX(var(--rui-toast-swipe-x));
|
|
322
325
|
opacity: 1;
|
|
323
326
|
}
|
|
324
327
|
to {
|
|
325
|
-
transform: var(--y) translateX(calc(var(--swipe-
|
|
328
|
+
transform: var(--rui-toast-y) translateX(calc(var(--rui-toast-swipe-x) + 100%));
|
|
326
329
|
opacity: 0;
|
|
327
330
|
}
|
|
328
331
|
}
|
|
329
332
|
@keyframes rui-toast-swipe-out-up {
|
|
330
333
|
from {
|
|
331
|
-
transform: var(--y) translateY(var(--swipe-
|
|
334
|
+
transform: var(--rui-toast-y) translateY(var(--rui-toast-swipe-y));
|
|
332
335
|
opacity: 1;
|
|
333
336
|
}
|
|
334
337
|
to {
|
|
335
|
-
transform: var(--y) translateY(calc(var(--swipe-
|
|
338
|
+
transform: var(--rui-toast-y) translateY(calc(var(--rui-toast-swipe-y) - 100%));
|
|
336
339
|
opacity: 0;
|
|
337
340
|
}
|
|
338
341
|
}
|
|
339
342
|
@keyframes rui-toast-swipe-out-down {
|
|
340
343
|
from {
|
|
341
|
-
transform: var(--y) translateY(var(--swipe-
|
|
344
|
+
transform: var(--rui-toast-y) translateY(var(--rui-toast-swipe-y));
|
|
342
345
|
opacity: 1;
|
|
343
346
|
}
|
|
344
347
|
to {
|
|
345
|
-
transform: var(--y) translateY(calc(var(--swipe-
|
|
348
|
+
transform: var(--rui-toast-y) translateY(calc(var(--rui-toast-swipe-y) + 100%));
|
|
346
349
|
opacity: 0;
|
|
347
350
|
}
|
|
348
351
|
}
|
|
349
352
|
@media (max-width: 600px) {
|
|
350
353
|
rui-toaster {
|
|
351
|
-
left: var(--
|
|
352
|
-
right: var(--
|
|
354
|
+
left: var(--rui-toaster-inset-x);
|
|
355
|
+
right: var(--rui-toaster-inset-x);
|
|
353
356
|
width: auto;
|
|
354
357
|
transform: none;
|
|
355
358
|
}
|
|
356
359
|
rui-toaster[data-y-position='bottom'] {
|
|
357
|
-
bottom: var(--
|
|
360
|
+
bottom: var(--rui-toaster-inset-bottom);
|
|
358
361
|
}
|
|
359
362
|
rui-toaster[data-y-position='top'] {
|
|
360
|
-
top: var(--
|
|
363
|
+
top: var(--rui-toaster-inset-x);
|
|
361
364
|
}
|
|
362
365
|
rui-toaster[data-x-position='end'],
|
|
363
366
|
rui-toaster[data-x-position='start'],
|
|
364
367
|
rui-toaster[data-x-position='center'] {
|
|
365
|
-
left: var(--
|
|
366
|
-
right: var(--
|
|
368
|
+
left: var(--rui-toaster-inset-x);
|
|
369
|
+
right: var(--rui-toaster-inset-x);
|
|
367
370
|
transform: none;
|
|
368
371
|
}
|
|
369
372
|
}
|
|
@@ -27,51 +27,37 @@ type RuiToastBindings = {
|
|
|
27
27
|
/**
|
|
28
28
|
* `<rui-toast>` — a single transient notification in a toaster stack.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
30
|
+
* Derived Tree: prefer the imperative {@link toast} API with `<rui-toaster>`;
|
|
31
|
+
* the toaster renders this element. The host `render()` paints the toast surface.
|
|
32
32
|
*
|
|
33
|
-
*
|
|
34
|
-
* border accent. `loading` toasts never auto-dismiss.
|
|
33
|
+
* ## Light-DOM contract
|
|
35
34
|
*
|
|
36
|
-
*
|
|
35
|
+
* Generated by `render()` (do not author manually):
|
|
36
|
+
* - `[data-ref="toast"]` — toast surface (`role="listitem"` on the host). Used for
|
|
37
|
+
* swipe-to-dismiss hit testing.
|
|
38
|
+
* - `[data-toast-close]` — optional close button (when `close-button` is set).
|
|
39
|
+
* - `[data-toast-action]` — optional action button (when `action-label` is set).
|
|
40
|
+
*
|
|
41
|
+
* Nested hosts: none.
|
|
37
42
|
*
|
|
43
|
+
* @element rui-toast
|
|
38
44
|
* @attr {string} toast-id - Toast id; used for deadline bookkeeping. Default: `''`.
|
|
39
45
|
* @attr {string} title - Heading text. Default: `''`.
|
|
40
46
|
* @attr {string} description - Supporting detail under the title. Default: `''`.
|
|
41
|
-
* @attr {('default'|'info'|'success'|'warning'|'error'|'loading')} variant -
|
|
42
|
-
* Status tone; drives the icon and border accent. Default: `default`.
|
|
47
|
+
* @attr {('default'|'info'|'success'|'warning'|'error'|'loading')} variant - Status tone. Default: `default`.
|
|
43
48
|
* @attr {number} duration - Lifetime in ms before auto-dismiss. Default: `4000`.
|
|
44
49
|
* @attr {boolean} dismissible - Allow close button / swipe-to-dismiss. Default: `true`.
|
|
45
50
|
* @attr {boolean} close-button - Render the corner close control. Default: `false`.
|
|
46
51
|
* @attr {string} action-label - Text for the optional action button. Default: `''`.
|
|
47
52
|
* @attr {string} position - Placement; mirrors the toaster's position. Default: `bottom-end`.
|
|
48
53
|
* @attr {boolean} marked-delete - Marks the toast for animated exit. Default: `false`.
|
|
49
|
-
*
|
|
50
|
-
* @fires rui-toast-mounted - Bubbles after the toast mounts and paints (enter
|
|
51
|
-
* animation / timer start); the toaster uses it to resync stack layout.
|
|
54
|
+
* @fires rui-toast-mounted - Bubbles after the toast mounts and paints; the toaster uses it to resync stack layout.
|
|
52
55
|
*
|
|
53
56
|
* @remarks
|
|
54
|
-
* Styling lives on the composed surface
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* **Why a custom element?** The toast owns dismiss lifetime bookkeeping (pause
|
|
59
|
-
* on hover / hidden tab, swipe-to-dismiss), which needs DOM state — not a
|
|
60
|
-
* presentational view.
|
|
61
|
-
*
|
|
62
|
-
* @cssclass rui-toast - Toast surface (`role="status"`).
|
|
63
|
-
* @cssclass rui-toast--info - Info tone (blue accent).
|
|
64
|
-
* @cssclass rui-toast--success - Success tone (green accent).
|
|
65
|
-
* @cssclass rui-toast--warning - Warning tone (amber accent).
|
|
66
|
-
* @cssclass rui-toast--error - Error tone (red accent).
|
|
67
|
-
* @cssclass rui-toast--loading - Loading tone (neutral accent).
|
|
68
|
-
* @cssclass rui-toast__icon - Status icon wrapper.
|
|
69
|
-
* @cssclass rui-toast__loader - Spinner for `loading` toasts.
|
|
70
|
-
* @cssclass rui-toast__content - Title + description column.
|
|
71
|
-
* @cssclass rui-toast__title - Heading.
|
|
72
|
-
* @cssclass rui-toast__description - Supporting detail.
|
|
73
|
-
* @cssclass rui-toast__action - Optional action button.
|
|
74
|
-
* @cssclass rui-toast__close - Corner close control.
|
|
57
|
+
* Styling lives on the composed surface. Variants map to semantic status roles in
|
|
58
|
+
* `toast.css`. The toast owns dismiss lifetime bookkeeping (pause on hover /
|
|
59
|
+
* hidden tab, swipe-to-dismiss). Stack motion uses host-written `--rui-toast-y`,
|
|
60
|
+
* `--rui-toast-z`, and `--rui-toast-swipe-*` (not theming knobs).
|
|
75
61
|
*/
|
|
76
62
|
export declare class RuiToast extends RadiantElement<RuiToastBindings> {
|
|
77
63
|
toastId: string;
|
|
@@ -38,12 +38,24 @@ export type RuiToasterProps = {
|
|
|
38
38
|
/**
|
|
39
39
|
* `<rui-toaster>` — fixed viewport that renders the toast stack.
|
|
40
40
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* and per-position filtering of queued toasts.
|
|
41
|
+
* Derived Tree: mount once at the app root, then drive it imperatively with
|
|
42
|
+
* {@link toast}. The host `render()` paints the stack list and `rui-toast` children.
|
|
44
43
|
*
|
|
45
|
-
*
|
|
44
|
+
* ## Light-DOM contract
|
|
45
|
+
*
|
|
46
|
+
* Generated by `render()` (do not author manually):
|
|
47
|
+
* - `[data-ref="list"]` — `<ol>` stack list. Host queries this for layout math
|
|
48
|
+
* (collapsed peek, hover expand, per-position filtering).
|
|
49
|
+
* - `rui-toast` — toast children mounted by the host. Host listens for
|
|
50
|
+
* `rui-toast-mounted` on each.
|
|
51
|
+
*
|
|
52
|
+
* The host also queries `[data-ref="toast"]` inside each `rui-toast` for stack
|
|
53
|
+
* height measurement.
|
|
46
54
|
*
|
|
55
|
+
* Nested hosts:
|
|
56
|
+
* - `rui-toast` — each child owns its own derived tree; see `rui-toast` CE TSDoc.
|
|
57
|
+
*
|
|
58
|
+
* @element rui-toaster
|
|
47
59
|
* @attr {string} position - Corner / edge placement. Default: `bottom-end`.
|
|
48
60
|
* @attr {number} duration - Default lifetime in ms. Default: `4000`.
|
|
49
61
|
* @attr {number} visible-toasts - Max toasts mounted at once; older wait in queue. Default: `3`.
|
|
@@ -53,17 +65,16 @@ export type RuiToasterProps = {
|
|
|
53
65
|
* @attr {number} offset - Viewport inset in px. Default: `24`.
|
|
54
66
|
* @attr {string} container - CSS selector for a positioning root. Default: `''`.
|
|
55
67
|
*
|
|
56
|
-
* @
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
59
|
-
*
|
|
68
|
+
* @cssprop --rui-toaster-width - Stack width. Default: `356px`. Override on `rui-toaster`.
|
|
69
|
+
* @cssprop --rui-toaster-gap - Expanded stack gap. Default: `14px`. The `gap` attribute writes this and wins.
|
|
70
|
+
* @cssprop --rui-toaster-offset - Viewport inset. Default: `24px`. The `offset` attribute writes this and wins.
|
|
71
|
+
* @cssprop --rui-toaster-inset-x - Inline inset below 600px. Default: `16px`.
|
|
72
|
+
* @cssprop --rui-toaster-inset-bottom - Bottom inset below 600px. Default: `16px`.
|
|
60
73
|
*
|
|
61
74
|
* @remarks
|
|
62
75
|
* `container` switches the host from `position: fixed` to absolute inside a
|
|
63
76
|
* matched root — used by docs canvas demos so toasts render inside the preview.
|
|
64
|
-
*
|
|
65
|
-
* @cssclass rui-toaster-region - Announcement region wrapper (`display: contents`).
|
|
66
|
-
* @cssclass rui-toaster - The `<ol>` stack list.
|
|
77
|
+
* Document-level events: `rui-toast-show`, `rui-toast-dismiss`.
|
|
67
78
|
*/
|
|
68
79
|
export declare class RuiToaster extends RadiantElement {
|
|
69
80
|
position: ToastPosition;
|
|
@@ -74,6 +85,7 @@ export declare class RuiToaster extends RadiantElement {
|
|
|
74
85
|
gap: number;
|
|
75
86
|
offset: number;
|
|
76
87
|
container: string;
|
|
88
|
+
listTarget: HTMLOListElement;
|
|
77
89
|
toasts: ToastRecord[];
|
|
78
90
|
private expanded;
|
|
79
91
|
private interacting;
|
|
@@ -119,7 +131,7 @@ export declare class RuiToaster extends RadiantElement {
|
|
|
119
131
|
* Natural content height for stack math.
|
|
120
132
|
*
|
|
121
133
|
* @remarks
|
|
122
|
-
* Uses the inner
|
|
134
|
+
* Uses the inner `[data-ref="toast"]` `offsetHeight` (layout size, transform-independent).
|
|
123
135
|
* Host height/overflow are temporarily cleared because collapsed behind toasts are
|
|
124
136
|
* clipped to the front height — leaving that in place can under-measure in some engines.
|
|
125
137
|
*/
|
|
@@ -18,20 +18,31 @@ type RuiTocBindings = {
|
|
|
18
18
|
label: string;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
* `<rui-toc>` — table of contents that tracks in-page headings
|
|
22
|
-
* section currently in view while scrolling.
|
|
21
|
+
* `<rui-toc>` — table of contents that tracks in-page headings while scrolling.
|
|
23
22
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* Derived Tree: the host `render()` owns the `nav` landmark and jump-link list.
|
|
24
|
+
* It scans headings in an external content root (not authored children of the host).
|
|
25
|
+
*
|
|
26
|
+
* ## Scan contract
|
|
27
|
+
*
|
|
28
|
+
* - `target` — CSS selector for the content root. Default: parent element.
|
|
29
|
+
* - `heading-selector` — selector for headings inside that root. Default: `h2,h3`.
|
|
30
|
+
* Headings without `id` receive one before links are built.
|
|
31
|
+
*
|
|
32
|
+
* Resolves the nearest overflow scroll ancestor of the target (not always `window`)
|
|
33
|
+
* so nested layout scrollers drive active-section tracking correctly.
|
|
28
34
|
*
|
|
29
35
|
* @element rui-toc
|
|
30
|
-
* @attr {string} target - CSS selector for the content root that contains headings.
|
|
36
|
+
* @attr {string} target - CSS selector for the content root that contains headings.
|
|
31
37
|
* @attr {string} heading-selector - Selector for headings to include. Default: `h2,h3`.
|
|
32
38
|
* @attr {string} label - Visible label above the link list. Default: `On this page`.
|
|
33
39
|
* @attr {number} scroll-offset - Pixel offset from the viewport top when tracking the active section. Default: `120`.
|
|
34
|
-
* @attr {string} navigation-events -
|
|
40
|
+
* @attr {string} navigation-events - Comma-separated document event names that trigger a rebuild.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* Renders nothing when no headings match. Link click updates the URL hash and
|
|
44
|
+
* scrolls the heading into view with `scroll-offset` applied.
|
|
45
|
+
*
|
|
35
46
|
* @cssclass rui-toc - Root `nav` landmark.
|
|
36
47
|
* @cssclass rui-toc__label - Section label above the list.
|
|
37
48
|
* @cssclass rui-toc__list - Link list.
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { JsxCustomElementAttributes } from '@ecopages/jsx';
|
|
2
2
|
import type { RuiToolbar as RuiToolbarElement, RuiToolbarProps } from './toolbar.script';
|
|
3
3
|
import './toolbar.script';
|
|
4
|
+
/**
|
|
5
|
+
* Toolbar landmark wrapper. Stamps `[role="toolbar"]` with `data-ref="root"`.
|
|
6
|
+
*
|
|
7
|
+
* @cssclass rui-toolbar - Toolbar surface (`role="toolbar"`).
|
|
8
|
+
*/
|
|
4
9
|
export declare function RuiToolbar({ children, label, ...props }: JsxCustomElementAttributes<RuiToolbarElement, RuiToolbarProps>): import("@ecopages/jsx").JsxRenderable;
|
|
@@ -5,16 +5,36 @@ export type RuiToolbarProps = {
|
|
|
5
5
|
exclusiveToggles?: boolean;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
* `<rui-toolbar>` —
|
|
8
|
+
* `<rui-toolbar>` — horizontal control group with roving keyboard navigation.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* focusable descendants
|
|
10
|
+
* The custom element is a behavior host: it does not render toolbar chrome. Import
|
|
11
|
+
* the script and place focusable controls as light-DOM descendants, or use
|
|
12
|
+
* `RuiToolbar`, which stamps `[role="toolbar"]`.
|
|
13
|
+
*
|
|
14
|
+
* ## Light-DOM contract
|
|
15
|
+
*
|
|
16
|
+
* Required:
|
|
17
|
+
* - Focusable descendants — `button`, `a[href]`, `input`, `select`, `textarea`, or
|
|
18
|
+
* `[tabindex]`. Host sets roving `tabIndex` among non-`disabled` matches.
|
|
19
|
+
*
|
|
20
|
+
* Optional:
|
|
21
|
+
* - `button[data-toggle][aria-pressed]` — toggle button. Host toggles `aria-pressed`
|
|
22
|
+
* on click (capture phase, before child handlers). With `exclusive-toggles`, only
|
|
23
|
+
* one pressed toggle stays active.
|
|
24
|
+
*
|
|
25
|
+
* Author `disabled` on controls to exclude them from roving focus. Author initial
|
|
26
|
+
* `aria-pressed` on toggles; the host owns updates after click.
|
|
27
|
+
*
|
|
28
|
+
* Nested hosts: none.
|
|
12
29
|
*
|
|
13
30
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/
|
|
14
31
|
* @element rui-toolbar
|
|
15
32
|
* @attr {string} label - Accessible name for the `role="toolbar"` region.
|
|
16
33
|
* @attr {boolean} exclusive-toggles - Only one toggle button stays pressed at a time. Default: `false`.
|
|
17
|
-
*
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* The view stamps `[role="toolbar"]` with `data-ref="root"`. Arrow keys navigate
|
|
37
|
+
* among focusable descendants anywhere under `<rui-toolbar>`.
|
|
18
38
|
*/
|
|
19
39
|
export declare class RuiToolbar extends RadiantElement {
|
|
20
40
|
label: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as B,jsxs as Vt}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as _t,bound as Et,customElement as Ht,onEvent as G,onUpdated as Kt,prop as X,query as Bt}from"@ecopages/radiant";var St="a[href], button, input, select, textarea, [tabindex]";function Ct(t){return!t.hasAttribute("disabled")&&t.getAttribute("tabindex")!=="-1"}function jt(t){return Array.from(t.querySelectorAll(St)).filter(Ct)}function at(t){return jt(t)[0]}var It={top:"bottom",bottom:"top",left:"right",right:"left"},Lt=8;function Pt(t){let e=t.indexOf("-");if(e===-1)return{side:t,align:"center"};let i=t.slice(0,e),s=t.slice(e+1);return{side:i,align:s==="start"||s==="end"?s:"center"}}function ut(t){return t==="top"||t==="bottom"?"y":"x"}function lt(t,e,i,s,n){let{width:r,height:a}=e,o=0,p=0;switch(i){case"top":p=t.top-a-n;break;case"bottom":p=t.bottom+n;break;case"left":o=t.left-r-n;break;case"right":o=t.right+n;break}return ut(i)==="y"?s==="start"?o=t.left:s==="end"?o=t.right-r:o=t.left+(t.width-r)/2:s==="start"?p=t.top:s==="end"?p=t.bottom-a:p=t.top+(t.height-a)/2,{x:o,y:p}}function Dt(t,e,i,s){let{padding:n,width:r,height:a}=s;return i==="top"?Math.max(0,n-t.y):i==="bottom"?Math.max(0,t.y+e.height-(a-n)):i==="left"?Math.max(0,n-t.x):Math.max(0,t.x+e.width-(r-n))}function ct(t,e,i,s){let{padding:n,width:r,height:a}=s;return i==="top"?t.top-n-e.height:i==="bottom"?a-n-e.height-t.bottom:i==="left"?t.left-n-e.width:r-n-e.width-t.right}function Rt(t,e){return e==="center"?t:`${t}-${e}`}function Mt(t,e,i,s){let{padding:n,width:r,height:a}=s;if(ut(i)==="y"){let p=Math.max(n,r-n-e.width);return{x:Math.min(Math.max(t.x,n),p),y:t.y}}let o=Math.max(n,a-n-e.height);return{x:t.x,y:Math.min(Math.max(t.y,n),o)}}function kt(t,e,i,s,n={width:typeof window>"u"?0:window.innerWidth,height:typeof window>"u"?0:window.innerHeight,padding:Lt}){let{side:r,align:a}=Pt(i),o=lt(t,e,r,a,s),p=Dt(o,e,r,n),_=r,E=o;if(p>0){let F=It[r],A=lt(t,e,F,a,s),I=ct(t,e,r,n);ct(t,e,F,n)>I&&(_=F,E=A)}return{coords:Mt(E,e,_,n),placement:Rt(_,a)}}function K(t,e,i,s,n={}){let{coords:r,placement:a}=kt(t.getBoundingClientRect(),{width:e.offsetWidth,height:e.offsetHeight},i,s);return Object.assign(e.style,{position:"fixed",left:`${r.x}px`,top:`${r.y}px`,right:"auto",bottom:"auto",visibility:"visible"}),n.matchAnchorWidth&&(e.style.width=`${t.offsetWidth}px`),e.setAttribute("data-placement",a),a}function dt({anchor:t,floating:e,getPlacement:i,gap:s,matchAnchorWidth:n}){let r=()=>{e.hidden||K(t,e,i(),s,{matchAnchorWidth:n})};r(),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0);let a=new ResizeObserver(r);return a.observe(t),a.observe(e),()=>{window.removeEventListener("resize",r),window.removeEventListener("scroll",r,!0),a.disconnect()}}var ht,pt,ft,mt,gt,bt,yt,wt,vt,Tt;function $t(t,e,i,s,n,r){var a,o,p,_,E,F,A,I=Symbol.metadata||Symbol.for("Symbol.metadata"),k=Object.defineProperty,$=Object.create,J=[$(null),$(null)],Q=e.length;function L(l,b,m){return function(c,u){b&&(u=c,c=t);for(var y=0;y<l.length;y++)u=l[y].apply(c,m?[u]:[]);return m?u:c}}function T(l,b,m,c){if(typeof l!="function"&&(c||l!==void 0))throw new TypeError(b+" must "+(m||"be")+" a function"+(c?"":" or undefined"));return l}function Z(l,b,m,c,u,y,O,g,w,v,N){function q(h){if(!N(h))throw new TypeError("Attempted to access private element on non-instance")}var W=[].concat(b[0]),tt=b[3],U=!O,C=u===1,et=u===3,it=u===4,P=u===2;function D(h,S,ot){return function(M,st){return S&&(st=M,M=l),ot&&ot(M),d[h].call(M,st)}}if(!U){var d={},V=[],x=et?"get":it||C?"set":"value";if(w?(v||C?d={get:xt(function(){return tt(this)},c,"get"),set:function(h){b[4](this,h)}}:d[x]=tt,v||xt(d[x],c,P?"":x)):v||(d=Object.getOwnPropertyDescriptor(l,c)),!v&&!w){if((o=J[+g][c])&&(o^u)!==7)throw Error("Decorating two elements with the same name ("+d[x].name+") is not supported yet");J[+g][c]=u<3?1:u}}for(var f=l,R=W.length-1;R>=0;R-=m?2:1){var nt=T(W[R],"A decorator","be",!0),rt=m?W[R-1]:void 0,H={},j={kind:["field","accessor","method","getter","setter","class"][u],name:c,metadata:a,addInitializer:function(h,S){if(h.v)throw new TypeError("attempted to call addInitializer after decoration was finished");T(S,"An initializer","be",!0),y.push(S)}.bind(null,H)};if(U)o=nt.call(rt,f,j),H.v=1,T(o,"class decorators","return")&&(f=o);else if(j.static=g,j.private=w,o=j.access={has:w?N.bind():function(h){return c in h}},it||(o.get=w?P?function(h){return q(h),d.value}:D("get",0,q):function(h){return h[c]}),P||et||(o.set=w?D("set",0,q):function(h,S){h[c]=S}),f=nt.call(rt,C?{get:d.get,set:d.set}:d[x],j),H.v=1,C){if(typeof f=="object"&&f)(o=T(f.get,"accessor.get"))&&(d.get=o),(o=T(f.set,"accessor.set"))&&(d.set=o),(o=T(f.init,"accessor.init"))&&V.unshift(o);else if(f!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else T(f,(v?"field":"method")+" decorators","return")&&(v?V.unshift(f):d[x]=f)}return u<2&&O.push(L(V,g,1),L(y,g,0)),v||U||(w?C?O.splice(-1,0,D("get",g),D("set",g)):O.push(P?d[x]:T.call.bind(d[x])):k(l,c,d)),f}function z(l){return k(l,I,{configurable:!0,enumerable:!0,value:a})}return r!==void 0&&(a=r[I]),a=$(a??null),E=[],F=function(l){l&&E.push(L(l))},A=function(l,b){for(var m=0;m<i.length;m++){var c=i[m],u=c[1],y=7&u;if((8&u)==l&&!y==b){var O=c[2],g=!!c[3],w=16&u;Z(l?t:t.prototype,c,w,g?"#"+O:qt(O),y,y<2?[]:l?_=_||[]:p=p||[],E,!!l,g,b,l&&g?function(v){return Ut(v)===t}:n)}}},A(8,0),A(0,0),A(8,1),A(0,1),F(p),F(_),o=E,Q||z(t),{e:o,get c(){var l=[];return Q&&[z(t=Z(t,[e],s,t.name,5,l)),L(l,1)]}}}function qt(t){var e=Wt(t,"string");return typeof e=="symbol"?e:e+""}function Wt(t,e){if(typeof t!="object"||!t)return t;var i=t[Symbol.toPrimitive];if(i!==void 0){var s=i.call(t,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function xt(t,e,i){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:i?i+" "+e:e})}catch{}return t}function Ut(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}var Ft=8,Ot,At=class extends _t{static{({e:[ft,mt,gt,bt,yt,wt,vt,Tt,ht],c:[Ot,pt]}=$t(this,[Ht("rui-tooltip")],[[X({type:String,defaultValue:""}),0,"content"],[X({type:String,defaultValue:"top"}),0,"placement"],[X({type:Number,defaultValue:200}),0,"delay"],[Bt({ref:"tooltip"}),0,"tooltipTarget"],[Kt(["content","placement"]),2,"onDescribedPropsUpdated"],[G({document:!0,type:"keydown"}),2,"onDocumentKeydown"],[G({type:"focusin",selector:".rui-tooltip__trigger"}),2,"onFocusIn"],[G({type:"focusout",selector:".rui-tooltip__trigger"}),2,"onFocusOut"],[Et,2,"onPointerEnter"],[Et,2,"onPointerLeave"]],0,void 0,_t))}content=(ht(this),ft(this));placement=(mt(this),gt(this));delay=(bt(this),yt(this));tooltipTarget=(wt(this),vt(this));open=(Tt(this),!1);showTimer=null;hideTimer=null;tooltipId=`rui-tooltip-${Math.random().toString(36).slice(2,9)}`;describedEl=null;cleanupFloating=null;connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",this.onPointerEnter),this.addEventListener("pointerleave",this.onPointerLeave),queueMicrotask(()=>this.wireTrigger())}disconnectedCallback(){this.clearTimers(),this.teardownFloating(),this.removeEventListener("pointerenter",this.onPointerEnter),this.removeEventListener("pointerleave",this.onPointerLeave),this.describedEl?.removeAttribute("aria-describedby"),super.disconnectedCallback()}clearTimers(){this.showTimer&&clearTimeout(this.showTimer),this.hideTimer&&clearTimeout(this.hideTimer),this.showTimer=null,this.hideTimer=null}teardownFloating(){this.cleanupFloating?.(),this.cleanupFloating=null}getAnchor(){return at(this)??this}wireTrigger(){this.describedEl?.removeAttribute("aria-describedby"),this.describedEl=this.getAnchor(),this.tooltipTarget&&(this.tooltipTarget.id=this.tooltipId),this.describedEl.setAttribute("aria-describedby",this.tooltipId)}attachFloating(){this.tooltipTarget&&(this.teardownFloating(),this.cleanupFloating=dt({anchor:this.getAnchor(),floating:this.tooltipTarget,getPlacement:()=>this.placement,gap:Ft}))}onDescribedPropsUpdated(){this.wireTrigger(),this.open&&this.tooltipTarget&&K(this.getAnchor(),this.tooltipTarget,this.placement,Ft)}setOpen(e){this.clearTimers(),this.open=e,this.tooltipTarget&&(this.tooltipTarget.hidden=!e,e?this.attachFloating():this.teardownFloating())}scheduleShow(){if(this.clearTimers(),this.delay<=0){this.setOpen(!0);return}this.showTimer=setTimeout(()=>this.setOpen(!0),this.delay)}scheduleHide(){this.clearTimers(),this.hideTimer=setTimeout(()=>this.setOpen(!1),80)}onDocumentKeydown(e){!this.open||e.key!=="Escape"||this.setOpen(!1)}onFocusIn(){this.scheduleShow()}onFocusOut(e){let i=e.relatedTarget;i&&this.contains(i)||this.scheduleHide()}onPointerEnter(){this.scheduleShow()}onPointerLeave(){this.scheduleHide()}render(){return Vt("span",{class:"rui-tooltip",children:[B("span",{class:"rui-tooltip__trigger",children:B("slot",{})}),B("span",{"data-ref":"tooltip",id:this.tooltipId,class:"rui-tooltip__content rui-floating",role:"tooltip",hidden:!0,children:this.$.content})]})}static{pt()}};import{jsx as Y,jsxs as Gt}from"@ecopages/jsx/jsx-runtime";function Xt({children:t,content:e="",...i}){return Y("rui-tooltip",{content:e,...i,children:Gt("span",{class:"rui-tooltip",children:[Y("span",{class:"rui-tooltip__trigger",children:t}),Y("span",{class:"rui-tooltip__content rui-floating","data-ref":"tooltip",role:"tooltip",hidden:!0,children:e})]})})}export{Xt as RuiTooltip,Ot as RuiTooltipElement};
|
|
1
|
+
import{jsx as G,jsxs as Xt}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as St,bound as Ft,customElement as Yt,onEvent as Z,onUpdated as zt,prop as X,query as Jt}from"@ecopages/radiant";var jt="a[href], button, input, select, textarea, [tabindex]";function Dt(t){return!t.hasAttribute("disabled")&&t.getAttribute("tabindex")!=="-1"}function Pt(t){return Array.from(t.querySelectorAll(jt)).filter(Dt)}function lt(t){return Pt(t)[0]}var Lt=/^[A-Za-z][A-Za-z0-9_-]*$/;function ct(t){return Lt.test(t)}function Mt(t){let e=t.trim();if(ct(e))return e;let i=`rui-${e}`;return e&&ct(i)?i:"rui"}function ut(t){let e=typeof crypto.randomUUID=="function"?crypto.randomUUID().replace(/-/g,""):Array.from(crypto.getRandomValues(new Uint8Array(16)),i=>i.toString(16).padStart(2,"0")).join("");return`${Mt(t)}-${e}`}var Wt={top:"bottom",bottom:"top",left:"right",right:"left"},Rt=8,K=new WeakMap;function kt(t){K.has(t)&&(t.style.width="",t.style.minWidth="",t.style.maxWidth="",t.style.boxSizing="",K.delete(t))}function $t(t){let e=t.indexOf("-");if(e===-1)return{side:t,align:"center"};let i=t.slice(0,e),a=t.slice(e+1);return{side:i,align:a==="start"||a==="end"?a:"center"}}function pt(t){return t==="top"||t==="bottom"?"y":"x"}function dt(t,e,i,a,r){let{width:s,height:o}=e,n=0,d=0;switch(i){case"top":d=t.top-o-r;break;case"bottom":d=t.bottom+r;break;case"left":n=t.left-s-r;break;case"right":n=t.right+r;break}return pt(i)==="y"?a==="start"?n=t.left:a==="end"?n=t.right-s:n=t.left+(t.width-s)/2:a==="start"?d=t.top:a==="end"?d=t.bottom-o:d=t.top+(t.height-o)/2,{x:n,y:d}}function Ut(t,e,i,a){let{padding:r,width:s,height:o}=a;return i==="top"?Math.max(0,r-t.y):i==="bottom"?Math.max(0,t.y+e.height-(o-r)):i==="left"?Math.max(0,r-t.x):Math.max(0,t.x+e.width-(s-r))}function ht(t,e,i,a){let{padding:r,width:s,height:o}=a;return i==="top"?t.top-r-e.height:i==="bottom"?o-r-e.height-t.bottom:i==="left"?t.left-r-e.width:s-r-e.width-t.right}function qt(t,e){return e==="center"?t:`${t}-${e}`}function Vt(t,e,i,a){let{padding:r,width:s,height:o}=a;if(pt(i)==="y"){let d=Math.max(r,s-r-e.width);return{x:Math.min(Math.max(t.x,r),d),y:Math.max(r,t.y)}}let n=Math.max(r,o-r-e.height);return{x:Math.max(r,t.x),y:Math.min(Math.max(t.y,r),n)}}function Ht(t,e,i,a,r={width:typeof window>"u"?0:window.innerWidth,height:typeof window>"u"?0:window.innerHeight,padding:Rt}){let{side:s,align:o}=$t(i),n=dt(t,e,s,o,a),d=Ut(n,e,s,r),y=s,E=n;if(d>0){let A=Wt[s],S=dt(t,e,A,o,a),j=ht(t,e,s,r);ht(t,e,A,r)>j&&(y=A,E=S)}return{coords:Vt(E,e,y,r),placement:qt(y,o)}}function B(t,e,i,a,r={}){let s=r.matchAnchorWidth===!0,o=t.offsetWidth,n=s?{width:o,height:e.offsetHeight}:{width:e.offsetWidth,height:e.offsetHeight};s?(e.style.width=`${o}px`,e.style.minWidth=`${o}px`,e.style.maxWidth=`${o}px`,e.style.boxSizing="border-box",K.set(e,!0)):kt(e);let{coords:d,placement:y}=Ht(t.getBoundingClientRect(),n,i,a);return Object.assign(e.style,{position:"fixed",left:`${d.x}px`,top:`${d.y}px`,right:"auto",bottom:"auto",visibility:"visible"}),e.setAttribute("data-placement",y),y}function ft({anchor:t,floating:e,getPlacement:i,gap:a,matchAnchorWidth:r}){let s=()=>{e.hidden||B(t,e,i(),a,{matchAnchorWidth:r})};s(),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0);let o=new ResizeObserver(s);return o.observe(t),o.observe(e),()=>{window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0),o.disconnect()}}var mt,gt,yt,bt,wt,vt,xt,Tt,_t,Et;function Kt(t,e,i,a,r,s){var o,n,d,y,E,A,S,j=Symbol.metadata||Symbol.for("Symbol.metadata"),R=Object.defineProperty,k=Object.create,z=[k(null),k(null)],J=e.length;function D(l,b,m){return function(c,u){b&&(u=c,c=t);for(var w=0;w<l.length;w++)u=l[w].apply(c,m?[u]:[]);return m?u:c}}function T(l,b,m,c){if(typeof l!="function"&&(c||l!==void 0))throw new TypeError(b+" must "+(m||"be")+" a function"+(c?"":" or undefined"));return l}function Q(l,b,m,c,u,w,F,g,v,x,tt){function $(p){if(!tt(p))throw new TypeError("Attempted to access private element on non-instance")}var U=[].concat(b[0]),et=b[3],q=!F,I=u===1,it=u===3,rt=u===4,P=u===2;function L(p,O,st){return function(W,at){return O&&(at=W,W=l),st&&st(W),h[p].call(W,at)}}if(!q){var h={},V=[],_=it?"get":rt||I?"set":"value";if(v?(x||I?h={get:At(function(){return et(this)},c,"get"),set:function(p){b[4](this,p)}}:h[_]=et,x||At(h[_],c,P?"":_)):x||(h=Object.getOwnPropertyDescriptor(l,c)),!x&&!v){if((n=z[+g][c])&&(n^u)!==7)throw Error("Decorating two elements with the same name ("+h[_].name+") is not supported yet");z[+g][c]=u<3?1:u}}for(var f=l,M=U.length-1;M>=0;M-=m?2:1){var nt=T(U[M],"A decorator","be",!0),ot=m?U[M-1]:void 0,H={},C={kind:["field","accessor","method","getter","setter","class"][u],name:c,metadata:o,addInitializer:function(p,O){if(p.v)throw new TypeError("attempted to call addInitializer after decoration was finished");T(O,"An initializer","be",!0),w.push(O)}.bind(null,H)};if(q)n=nt.call(ot,f,C),H.v=1,T(n,"class decorators","return")&&(f=n);else if(C.static=g,C.private=v,n=C.access={has:v?tt.bind():function(p){return c in p}},rt||(n.get=v?P?function(p){return $(p),h.value}:L("get",0,$):function(p){return p[c]}),P||it||(n.set=v?L("set",0,$):function(p,O){p[c]=O}),f=nt.call(ot,I?{get:h.get,set:h.set}:h[_],C),H.v=1,I){if(typeof f=="object"&&f)(n=T(f.get,"accessor.get"))&&(h.get=n),(n=T(f.set,"accessor.set"))&&(h.set=n),(n=T(f.init,"accessor.init"))&&V.unshift(n);else if(f!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else T(f,(x?"field":"method")+" decorators","return")&&(x?V.unshift(f):h[_]=f)}return u<2&&F.push(D(V,g,1),D(w,g,0)),x||q||(v?I?F.splice(-1,0,L("get",g),L("set",g)):F.push(P?h[_]:T.call.bind(h[_])):R(l,c,h)),f}function N(l){return R(l,j,{configurable:!0,enumerable:!0,value:o})}return s!==void 0&&(o=s[j]),o=k(o??null),E=[],A=function(l){l&&E.push(D(l))},S=function(l,b){for(var m=0;m<i.length;m++){var c=i[m],u=c[1],w=7&u;if((8&u)==l&&!w==b){var F=c[2],g=!!c[3],v=16&u;Q(l?t:t.prototype,c,v,g?"#"+F:Bt(F),w,w<2?[]:l?y=y||[]:d=d||[],E,!!l,g,b,l&&g?function(x){return Zt(x)===t}:r)}}},S(8,0),S(0,0),S(8,1),S(0,1),A(d),A(y),n=E,J||N(t),{e:n,get c(){var l=[];return J&&[N(t=Q(t,[e],a,t.name,5,l)),D(l,1)]}}}function Bt(t){var e=Gt(t,"string");return typeof e=="symbol"?e:e+""}function Gt(t,e){if(typeof t!="object"||!t)return t;var i=t[Symbol.toPrimitive];if(i!==void 0){var a=i.call(t,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function At(t,e,i){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:i?i+" "+e:e})}catch{}return t}function Zt(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}var Ot=8,Ct,It=class extends St{static{({e:[yt,bt,wt,vt,xt,Tt,_t,Et,mt],c:[Ct,gt]}=Kt(this,[Yt("rui-tooltip")],[[X({type:String,defaultValue:""}),0,"content"],[X({type:String,defaultValue:"top"}),0,"placement"],[X({type:Number,defaultValue:200}),0,"delay"],[Jt({ref:"tooltip"}),0,"tooltipTarget"],[zt(["content","placement"]),2,"onDescribedPropsUpdated"],[Z({document:!0,type:"keydown"}),2,"onDocumentKeydown"],[Z({type:"focusin",ref:"trigger"}),2,"onFocusIn"],[Z({type:"focusout",ref:"trigger"}),2,"onFocusOut"],[Ft,2,"onPointerEnter"],[Ft,2,"onPointerLeave"]],0,void 0,St))}content=(mt(this),yt(this));placement=(bt(this),wt(this));delay=(vt(this),xt(this));tooltipTarget=(Tt(this),_t(this));open=(Et(this),!1);showTimer=null;hideTimer=null;tooltipId=ut("rui-tooltip");describedEl=null;cleanupFloating=null;connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",this.onPointerEnter),this.addEventListener("pointerleave",this.onPointerLeave),queueMicrotask(()=>this.wireTrigger())}disconnectedCallback(){this.clearTimers(),this.teardownFloating(),this.removeEventListener("pointerenter",this.onPointerEnter),this.removeEventListener("pointerleave",this.onPointerLeave),this.describedEl?.removeAttribute("aria-describedby"),super.disconnectedCallback()}clearTimers(){this.showTimer&&clearTimeout(this.showTimer),this.hideTimer&&clearTimeout(this.hideTimer),this.showTimer=null,this.hideTimer=null}teardownFloating(){this.cleanupFloating?.(),this.cleanupFloating=null}getAnchor(){return lt(this)??this}wireTrigger(){this.describedEl?.removeAttribute("aria-describedby"),this.describedEl=this.getAnchor(),this.tooltipTarget&&(this.tooltipTarget.id=this.tooltipId),this.describedEl.setAttribute("aria-describedby",this.tooltipId)}attachFloating(){this.tooltipTarget&&(this.teardownFloating(),this.cleanupFloating=ft({anchor:this.getAnchor(),floating:this.tooltipTarget,getPlacement:()=>this.placement,gap:Ot}))}onDescribedPropsUpdated(){this.wireTrigger(),this.open&&this.tooltipTarget&&B(this.getAnchor(),this.tooltipTarget,this.placement,Ot)}setOpen(e){this.clearTimers(),this.open=e,this.tooltipTarget&&(this.tooltipTarget.hidden=!e,e?this.attachFloating():this.teardownFloating())}scheduleShow(){if(this.clearTimers(),this.delay<=0){this.setOpen(!0);return}this.showTimer=setTimeout(()=>this.setOpen(!0),this.delay)}scheduleHide(){this.clearTimers(),this.hideTimer=setTimeout(()=>this.setOpen(!1),80)}onDocumentKeydown(e){!this.open||e.key!=="Escape"||this.setOpen(!1)}onFocusIn(){this.scheduleShow()}onFocusOut(e){let i=e.relatedTarget;i&&this.contains(i)||this.scheduleHide()}onPointerEnter(){this.scheduleShow()}onPointerLeave(){this.scheduleHide()}render(){return Xt("span",{class:"rui-tooltip",children:[G("span",{class:"rui-tooltip__trigger","data-ref":"trigger",children:G("slot",{})}),G("span",{"data-ref":"tooltip",id:this.tooltipId,class:"rui-tooltip__content rui-floating",role:"tooltip",hidden:!0,children:this.$.content})]})}static{gt()}};import{jsx as Y,jsxs as Qt}from"@ecopages/jsx/jsx-runtime";function Nt({children:t,content:e="",...i}){return Y("rui-tooltip",{content:e,...i,children:Qt("span",{class:"rui-tooltip",children:[Y("span",{class:"rui-tooltip__trigger","data-ref":"trigger",children:t}),Y("span",{class:"rui-tooltip__content rui-floating","data-ref":"tooltip",role:"tooltip",hidden:!0,children:e})]})})}export{Nt as RuiTooltip,Ct as RuiTooltipElement};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|