@marianmeres/stuic 2.66.0 → 3.0.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 +292 -4
- package/dist/README.md +41 -18
- package/dist/actions/popover/README.md +19 -0
- package/dist/actions/popover/index.css +6 -9
- package/dist/actions/popover/popover.svelte.js +2 -2
- package/dist/actions/tooltip/README.md +18 -0
- package/dist/actions/tooltip/index.css +5 -8
- package/dist/actions/tooltip/tooltip.svelte.js +1 -1
- package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte +9 -10
- package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte.d.ts +3 -3
- package/dist/components/AlertConfirmPrompt/Current.svelte +15 -17
- package/dist/components/AlertConfirmPrompt/Current.svelte.d.ts +5 -3
- package/dist/components/AlertConfirmPrompt/acp-icons.js +5 -4
- package/dist/components/AlertConfirmPrompt/index.css +62 -0
- package/dist/components/AssetsPreview/AssetsPreview.svelte +92 -73
- package/dist/components/AssetsPreview/AssetsPreview.svelte.d.ts +1 -0
- package/dist/components/AssetsPreview/index.css +59 -0
- package/dist/components/Avatar/Avatar.svelte +32 -18
- package/dist/components/Avatar/Avatar.svelte.d.ts +1 -0
- package/dist/components/Avatar/README.md +166 -0
- package/dist/components/Avatar/index.css +128 -0
- package/dist/components/Backdrop/Backdrop.svelte +8 -2
- package/dist/components/Backdrop/Backdrop.svelte.d.ts +1 -0
- package/dist/components/Backdrop/README.md +71 -6
- package/dist/components/Backdrop/index.css +29 -0
- package/dist/components/Button/Button.svelte +117 -124
- package/dist/components/Button/Button.svelte.d.ts +35 -23
- package/dist/components/Button/README.md +87 -21
- package/dist/components/Button/index.css +473 -9
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/ButtonGroupRadio/ButtonGroupRadio.svelte +7 -38
- package/dist/components/ButtonGroupRadio/README.md +82 -4
- package/dist/components/ButtonGroupRadio/index.css +152 -14
- package/dist/components/Collapsible/Collapsible.svelte +7 -7
- package/dist/components/Collapsible/Collapsible.svelte.d.ts +2 -2
- package/dist/components/Collapsible/README.md +34 -2
- package/dist/components/Collapsible/index.css +38 -0
- package/dist/components/CommandMenu/CommandMenu.svelte +13 -24
- package/dist/components/CommandMenu/README.md +39 -0
- package/dist/components/CommandMenu/index.css +45 -2
- package/dist/components/DismissibleMessage/DismissibleMessage.svelte +53 -50
- package/dist/components/DismissibleMessage/DismissibleMessage.svelte.d.ts +6 -5
- package/dist/components/DismissibleMessage/README.md +93 -11
- package/dist/components/DismissibleMessage/index.css +122 -8
- package/dist/components/DismissibleMessage/index.d.ts +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.svelte +14 -50
- package/dist/components/DropdownMenu/DropdownMenu.svelte.d.ts +6 -6
- package/dist/components/DropdownMenu/README.md +132 -0
- package/dist/components/DropdownMenu/index.css +231 -27
- package/dist/components/Input/FieldAssets.svelte +8 -5
- package/dist/components/Input/FieldCheckbox.svelte +7 -44
- package/dist/components/Input/FieldFile.svelte +1 -6
- package/dist/components/Input/FieldInput.svelte +1 -1
- package/dist/components/Input/FieldOptions.svelte +41 -38
- package/dist/components/Input/FieldRadios.svelte +7 -16
- package/dist/components/Input/FieldSelect.svelte +1 -1
- package/dist/components/Input/FieldSwitch.svelte +1 -5
- package/dist/components/Input/FieldTextarea.svelte +1 -1
- package/dist/components/Input/README.md +194 -0
- package/dist/components/Input/_internal/FieldRadioInternal.svelte +2 -40
- package/dist/components/Input/_internal/InputWrap.svelte +8 -48
- package/dist/components/Input/index.css +522 -127
- package/dist/components/ListItemButton/ListItemButton.svelte +37 -73
- package/dist/components/ListItemButton/ListItemButton.svelte.d.ts +1 -9
- package/dist/components/ListItemButton/README.md +100 -45
- package/dist/components/ListItemButton/index.css +175 -56
- package/dist/components/ListItemButton/index.d.ts +1 -1
- package/dist/components/ListItemButton/index.js +1 -1
- package/dist/components/Modal/Modal.svelte +2 -8
- package/dist/components/Modal/Modal.svelte.d.ts +1 -0
- package/dist/components/Modal/README.md +29 -0
- package/dist/components/Modal/index.css +36 -0
- package/dist/components/ModalDialog/ModalDialog.svelte +2 -21
- package/dist/components/ModalDialog/README.md +35 -0
- package/dist/components/ModalDialog/index.css +57 -0
- package/dist/components/Notifications/Notifications.svelte +44 -128
- package/dist/components/Notifications/Notifications.svelte.d.ts +9 -17
- package/dist/components/Notifications/README.md +186 -70
- package/dist/components/Notifications/index.css +212 -15
- package/dist/components/Progress/README.md +15 -0
- package/dist/components/Progress/_internal/Bar.svelte +2 -2
- package/dist/components/Progress/index.css +4 -4
- package/dist/components/Skeleton/Skeleton.svelte +3 -2
- package/dist/components/Skeleton/index.css +11 -14
- package/dist/components/Spinner/Spinner.svelte +2 -2
- package/dist/components/Spinner/SpinnerCircle.svelte +1 -1
- package/dist/components/Switch/README.md +15 -0
- package/dist/components/Switch/Switch.svelte +4 -7
- package/dist/components/Switch/Switch.svelte.d.ts +1 -1
- package/dist/components/Switch/SwitchButton.svelte +4 -5
- package/dist/components/Switch/index.css +3 -4
- package/dist/components/TabbedMenu/README.md +26 -21
- package/dist/components/TabbedMenu/TabbedMenu.svelte +5 -5
- package/dist/components/TabbedMenu/index.css +7 -22
- package/dist/components/ThemePreview/README.md +289 -0
- package/dist/components/ThemePreview/ThemePreview.svelte +341 -0
- package/dist/components/ThemePreview/ThemePreview.svelte.d.ts +33 -0
- package/dist/components/ThemePreview/index.css +493 -0
- package/dist/components/ThemePreview/index.d.ts +1 -0
- package/dist/components/ThemePreview/index.js +1 -0
- package/dist/components/TwCheck/TwCheck.svelte +4 -4
- package/dist/components/TwCheck/index.css +3 -2
- package/dist/components/TypeaheadInput/TypeaheadInput.svelte +1 -1
- package/dist/components/X/X.svelte +12 -5
- package/dist/components/X/X.svelte.d.ts +1 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/index.css +31 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/themes/blue-orange.css +163 -0
- package/dist/themes/blue-orange.d.ts +6 -0
- package/dist/themes/blue-orange.js +151 -0
- package/dist/themes/cyan-red.css +163 -0
- package/dist/themes/cyan-red.d.ts +6 -0
- package/dist/themes/cyan-red.js +151 -0
- package/dist/themes/cyan-slate.css +163 -0
- package/dist/themes/cyan-slate.d.ts +6 -0
- package/dist/themes/cyan-slate.js +151 -0
- package/dist/themes/emerald-pink.css +163 -0
- package/dist/themes/emerald-pink.d.ts +6 -0
- package/dist/themes/emerald-pink.js +151 -0
- package/dist/themes/fuchsia-emerald.css +163 -0
- package/dist/themes/fuchsia-emerald.d.ts +6 -0
- package/dist/themes/fuchsia-emerald.js +151 -0
- package/dist/themes/gray.css +163 -0
- package/dist/themes/gray.d.ts +6 -0
- package/dist/themes/gray.js +151 -0
- package/dist/themes/indigo-amber.css +163 -0
- package/dist/themes/indigo-amber.d.ts +6 -0
- package/dist/themes/indigo-amber.js +151 -0
- package/dist/themes/neutral.css +163 -0
- package/dist/themes/neutral.d.ts +6 -0
- package/dist/themes/neutral.js +151 -0
- package/dist/themes/pink-emerald.css +163 -0
- package/dist/themes/pink-emerald.d.ts +6 -0
- package/dist/themes/pink-emerald.js +151 -0
- package/dist/themes/purple-yellow.css +163 -0
- package/dist/themes/purple-yellow.d.ts +6 -0
- package/dist/themes/purple-yellow.js +151 -0
- package/dist/themes/rainbow.css +163 -0
- package/dist/themes/rainbow.d.ts +6 -0
- package/dist/themes/rainbow.js +156 -0
- package/dist/themes/red-blue.css +163 -0
- package/dist/themes/red-blue.d.ts +6 -0
- package/dist/themes/red-blue.js +151 -0
- package/dist/themes/red-cyan.css +163 -0
- package/dist/themes/red-cyan.d.ts +6 -0
- package/dist/themes/red-cyan.js +151 -0
- package/dist/themes/rose-teal.css +163 -0
- package/dist/themes/rose-teal.d.ts +6 -0
- package/dist/themes/rose-teal.js +151 -0
- package/dist/themes/sky-amber.css +163 -0
- package/dist/themes/sky-amber.d.ts +6 -0
- package/dist/themes/sky-amber.js +151 -0
- package/dist/themes/slate-cyan.css +163 -0
- package/dist/themes/slate-cyan.d.ts +6 -0
- package/dist/themes/slate-cyan.js +151 -0
- package/dist/themes/tailwind-color-pairs.md +31 -0
- package/dist/themes/teal-rose.css +163 -0
- package/dist/themes/teal-rose.d.ts +6 -0
- package/dist/themes/teal-rose.js +151 -0
- package/dist/themes/violet-lime.css +163 -0
- package/dist/themes/violet-lime.d.ts +6 -0
- package/dist/themes/violet-lime.js +151 -0
- package/dist/utils/design-tokens.d.ts +43 -0
- package/dist/utils/design-tokens.js +100 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +22 -2
|
@@ -1,27 +1,248 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* =============================================================================
|
|
2
|
+
DROPDOWN MENU COMPONENT TOKENS
|
|
3
|
+
Override globally: :root { --stuic-dropdown-menu-radius: 0; }
|
|
4
|
+
Override locally: <DropdownMenu style="--stuic-dropdown-menu-radius: 9999px;">
|
|
5
|
+
============================================================================= */
|
|
6
|
+
|
|
7
|
+
:root {
|
|
8
|
+
/* Structure tokens */
|
|
9
|
+
--stuic-dropdown-menu-radius: var(--radius-md);
|
|
10
|
+
--stuic-dropdown-menu-padding: calc(var(--spacing) * 1);
|
|
11
|
+
--stuic-dropdown-menu-gap: calc(var(--spacing) * 0.5);
|
|
12
|
+
--stuic-dropdown-menu-min-width: 12rem;
|
|
13
|
+
--stuic-dropdown-menu-transition: 150ms;
|
|
14
|
+
|
|
15
|
+
/* Dropdown container colors */
|
|
16
|
+
--stuic-dropdown-menu-bg: var(--stuic-color-surface);
|
|
17
|
+
--stuic-dropdown-menu-text: var(--stuic-color-surface-foreground);
|
|
18
|
+
--stuic-dropdown-menu-border: var(--stuic-color-border);
|
|
19
|
+
--stuic-dropdown-menu-shadow: var(--shadow-lg);
|
|
20
|
+
|
|
21
|
+
/* Trigger button colors */
|
|
22
|
+
--stuic-dropdown-menu-trigger-bg: var(--stuic-color-surface);
|
|
23
|
+
--stuic-dropdown-menu-trigger-bg-hover: var(--stuic-color-surface-hover);
|
|
24
|
+
--stuic-dropdown-menu-trigger-bg-active: var(--stuic-color-surface-active);
|
|
25
|
+
--stuic-dropdown-menu-trigger-text: var(--stuic-color-surface-foreground);
|
|
26
|
+
--stuic-dropdown-menu-trigger-text-hover: var(--stuic-color-surface-foreground-hover);
|
|
27
|
+
--stuic-dropdown-menu-trigger-text-active: var(--stuic-color-surface-foreground-active);
|
|
28
|
+
--stuic-dropdown-menu-trigger-border: var(--stuic-color-border);
|
|
29
|
+
--stuic-dropdown-menu-trigger-border-hover: var(--stuic-color-border-hover);
|
|
30
|
+
--stuic-dropdown-menu-trigger-border-active: var(--stuic-color-border-active);
|
|
31
|
+
|
|
32
|
+
/* Trigger sizing */
|
|
33
|
+
--stuic-dropdown-menu-trigger-padding-x: calc(var(--spacing) * 3);
|
|
34
|
+
--stuic-dropdown-menu-trigger-padding-y: calc(var(--spacing) * 2);
|
|
35
|
+
|
|
36
|
+
/* Focus ring */
|
|
37
|
+
--stuic-dropdown-menu-ring-width: 3px;
|
|
38
|
+
--stuic-dropdown-menu-ring-offset: 0px;
|
|
39
|
+
--stuic-dropdown-menu-ring-color: var(--stuic-color-ring);
|
|
40
|
+
|
|
41
|
+
/* Divider */
|
|
42
|
+
--stuic-dropdown-menu-divider-bg: var(--stuic-color-border);
|
|
43
|
+
--stuic-dropdown-menu-divider-height: 1px;
|
|
44
|
+
--stuic-dropdown-menu-divider-margin-y: calc(var(--spacing) * 1);
|
|
45
|
+
|
|
46
|
+
/* Header (section label) */
|
|
47
|
+
--stuic-dropdown-menu-header-text: var(--stuic-color-muted-foreground);
|
|
48
|
+
--stuic-dropdown-menu-header-font-size: var(--text-xs);
|
|
49
|
+
--stuic-dropdown-menu-header-font-weight: var(--font-weight-semibold);
|
|
50
|
+
--stuic-dropdown-menu-header-padding-x: calc(var(--spacing) * 2);
|
|
51
|
+
--stuic-dropdown-menu-header-padding-y: calc(var(--spacing) * 1.5);
|
|
52
|
+
--stuic-dropdown-menu-header-letter-spacing: 0.05em;
|
|
53
|
+
--stuic-dropdown-menu-header-text-transform: uppercase;
|
|
54
|
+
|
|
55
|
+
/* Backdrop (fallback mode) */
|
|
56
|
+
--stuic-dropdown-menu-backdrop-bg: rgb(0 0 0 / 0.25);
|
|
57
|
+
--stuic-dropdown-menu-backdrop-z-index: 40;
|
|
58
|
+
|
|
59
|
+
/* Close button (fallback mode) */
|
|
60
|
+
--stuic-dropdown-menu-close-bg: var(--stuic-color-foreground);
|
|
61
|
+
--stuic-dropdown-menu-close-text: var(--stuic-color-background);
|
|
62
|
+
--stuic-dropdown-menu-close-opacity: 0.6;
|
|
63
|
+
--stuic-dropdown-menu-close-opacity-hover: 1;
|
|
64
|
+
|
|
65
|
+
/* Expandable section indent */
|
|
66
|
+
--stuic-dropdown-menu-expandable-indent: calc(var(--spacing) * 4);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* =============================================================================
|
|
70
|
+
BASE STYLES
|
|
71
|
+
============================================================================= */
|
|
72
|
+
|
|
73
|
+
.stuic-dropdown-menu {
|
|
74
|
+
position: relative;
|
|
75
|
+
display: inline-block;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* =============================================================================
|
|
79
|
+
TRIGGER BUTTON
|
|
80
|
+
============================================================================= */
|
|
81
|
+
|
|
82
|
+
.stuic-dropdown-menu-trigger {
|
|
83
|
+
/* Layout */
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
gap: var(--stuic-dropdown-menu-gap);
|
|
88
|
+
|
|
89
|
+
/* Sizing */
|
|
90
|
+
padding: var(--stuic-dropdown-menu-trigger-padding-y)
|
|
91
|
+
var(--stuic-dropdown-menu-trigger-padding-x);
|
|
92
|
+
|
|
93
|
+
/* Box model */
|
|
94
|
+
border-width: 1px;
|
|
95
|
+
border-style: solid;
|
|
96
|
+
border-radius: var(--stuic-dropdown-menu-radius);
|
|
97
|
+
|
|
98
|
+
/* Colors */
|
|
99
|
+
background: var(--stuic-dropdown-menu-trigger-bg);
|
|
100
|
+
color: var(--stuic-dropdown-menu-trigger-text);
|
|
101
|
+
border-color: var(--stuic-dropdown-menu-trigger-border);
|
|
102
|
+
|
|
103
|
+
/* Interaction */
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
user-select: none;
|
|
106
|
+
-webkit-tap-highlight-color: transparent;
|
|
107
|
+
touch-action: manipulation;
|
|
108
|
+
transition:
|
|
109
|
+
background var(--stuic-dropdown-menu-transition),
|
|
110
|
+
color var(--stuic-dropdown-menu-transition),
|
|
111
|
+
border-color var(--stuic-dropdown-menu-transition);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.stuic-dropdown-menu-trigger:hover:not(:disabled) {
|
|
115
|
+
background: var(--stuic-dropdown-menu-trigger-bg-hover);
|
|
116
|
+
color: var(--stuic-dropdown-menu-trigger-text-hover);
|
|
117
|
+
border-color: var(--stuic-dropdown-menu-trigger-border-hover);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.stuic-dropdown-menu-trigger:active:not(:disabled) {
|
|
121
|
+
background: var(--stuic-dropdown-menu-trigger-bg-active);
|
|
122
|
+
color: var(--stuic-dropdown-menu-trigger-text-active);
|
|
123
|
+
border-color: var(--stuic-dropdown-menu-trigger-border-active);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.stuic-dropdown-menu-trigger:focus-visible {
|
|
127
|
+
outline: var(--stuic-dropdown-menu-ring-width) solid
|
|
128
|
+
var(--stuic-dropdown-menu-ring-color);
|
|
129
|
+
outline-offset: var(--stuic-dropdown-menu-ring-offset);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* =============================================================================
|
|
133
|
+
DROPDOWN CONTAINER
|
|
134
|
+
============================================================================= */
|
|
135
|
+
|
|
2
136
|
.stuic-dropdown-menu-dropdown {
|
|
137
|
+
/* Colors */
|
|
138
|
+
background: var(--stuic-dropdown-menu-bg);
|
|
139
|
+
color: var(--stuic-dropdown-menu-text);
|
|
140
|
+
border: 1px solid var(--stuic-dropdown-menu-border);
|
|
141
|
+
box-shadow: var(--stuic-dropdown-menu-shadow);
|
|
142
|
+
|
|
143
|
+
/* Box model */
|
|
144
|
+
border-radius: var(--stuic-dropdown-menu-radius);
|
|
145
|
+
padding: var(--stuic-dropdown-menu-padding);
|
|
146
|
+
|
|
147
|
+
/* Layout */
|
|
148
|
+
min-width: var(--stuic-dropdown-menu-min-width);
|
|
149
|
+
overflow-y: auto;
|
|
3
150
|
scrollbar-width: thin;
|
|
151
|
+
|
|
152
|
+
/* Stacking */
|
|
153
|
+
z-index: 50;
|
|
4
154
|
}
|
|
5
155
|
|
|
6
|
-
/*
|
|
156
|
+
/* =============================================================================
|
|
157
|
+
DIVIDER
|
|
158
|
+
============================================================================= */
|
|
159
|
+
|
|
160
|
+
.stuic-dropdown-menu-divider {
|
|
161
|
+
height: var(--stuic-dropdown-menu-divider-height);
|
|
162
|
+
margin: var(--stuic-dropdown-menu-divider-margin-y) 0;
|
|
163
|
+
background: var(--stuic-dropdown-menu-divider-bg);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* =============================================================================
|
|
167
|
+
HEADER (Section Label)
|
|
168
|
+
============================================================================= */
|
|
169
|
+
|
|
170
|
+
.stuic-dropdown-menu-header {
|
|
171
|
+
padding: var(--stuic-dropdown-menu-header-padding-y)
|
|
172
|
+
var(--stuic-dropdown-menu-header-padding-x);
|
|
173
|
+
font-size: var(--stuic-dropdown-menu-header-font-size);
|
|
174
|
+
font-weight: var(--stuic-dropdown-menu-header-font-weight);
|
|
175
|
+
letter-spacing: var(--stuic-dropdown-menu-header-letter-spacing);
|
|
176
|
+
text-transform: var(--stuic-dropdown-menu-header-text-transform);
|
|
177
|
+
color: var(--stuic-dropdown-menu-header-text);
|
|
178
|
+
user-select: none;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* =============================================================================
|
|
182
|
+
BACKDROP (Fallback Mode)
|
|
183
|
+
============================================================================= */
|
|
184
|
+
|
|
185
|
+
.stuic-dropdown-menu-backdrop {
|
|
186
|
+
position: fixed;
|
|
187
|
+
inset: 0;
|
|
188
|
+
background: var(--stuic-dropdown-menu-backdrop-bg);
|
|
189
|
+
z-index: var(--stuic-dropdown-menu-backdrop-z-index);
|
|
190
|
+
transition-property: opacity;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* =============================================================================
|
|
194
|
+
CLOSE BUTTON (Fallback Mode)
|
|
195
|
+
============================================================================= */
|
|
196
|
+
|
|
197
|
+
.stuic-dropdown-menu-close {
|
|
198
|
+
background: var(--stuic-dropdown-menu-close-bg);
|
|
199
|
+
color: var(--stuic-dropdown-menu-close-text);
|
|
200
|
+
opacity: var(--stuic-dropdown-menu-close-opacity);
|
|
201
|
+
border-radius: var(--stuic-dropdown-menu-radius);
|
|
202
|
+
padding: calc(var(--spacing) * 2);
|
|
203
|
+
cursor: pointer;
|
|
204
|
+
line-height: 1;
|
|
205
|
+
transition: opacity var(--stuic-dropdown-menu-transition);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.stuic-dropdown-menu-close:hover {
|
|
209
|
+
opacity: var(--stuic-dropdown-menu-close-opacity-hover);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* =============================================================================
|
|
213
|
+
EXPANDABLE SECTION
|
|
214
|
+
============================================================================= */
|
|
215
|
+
|
|
216
|
+
.stuic-dropdown-menu-expandable-content {
|
|
217
|
+
padding-left: var(--stuic-dropdown-menu-expandable-indent);
|
|
218
|
+
overflow: hidden;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* =============================================================================
|
|
222
|
+
LIST ITEM BUTTON OVERRIDES FOR DROPDOWN CONTEXT
|
|
223
|
+
Reset default ListItemButton background to transparent within dropdown.
|
|
224
|
+
============================================================================= */
|
|
225
|
+
|
|
7
226
|
.stuic-dropdown-menu-dropdown .stuic-list-item-button {
|
|
8
|
-
--
|
|
9
|
-
--
|
|
10
|
-
--color-lib-border: transparent;
|
|
11
|
-
--color-lib-border-dark: transparent;
|
|
227
|
+
--stuic-list-item-button-bg: transparent;
|
|
228
|
+
--stuic-list-item-button-border: transparent;
|
|
12
229
|
}
|
|
13
230
|
|
|
231
|
+
/* =============================================================================
|
|
232
|
+
CSS ANCHOR POSITIONING (when supported)
|
|
233
|
+
============================================================================= */
|
|
234
|
+
|
|
14
235
|
@position-try --pop-top {
|
|
15
|
-
position-area: top;
|
|
236
|
+
position-area: top;
|
|
16
237
|
}
|
|
17
238
|
@position-try --pop-top-span-right {
|
|
18
|
-
position-area: top span-right;
|
|
239
|
+
position-area: top span-right;
|
|
19
240
|
}
|
|
20
241
|
@position-try --pop-top-span-left {
|
|
21
|
-
position-area: top span-left;
|
|
242
|
+
position-area: top span-left;
|
|
22
243
|
}
|
|
23
244
|
@position-try --pop-bottom {
|
|
24
|
-
position-area: bottom;
|
|
245
|
+
position-area: bottom;
|
|
25
246
|
}
|
|
26
247
|
@position-try --pop-bottom-span-right {
|
|
27
248
|
position-area: bottom span-right;
|
|
@@ -36,28 +257,11 @@
|
|
|
36
257
|
position-area: right;
|
|
37
258
|
}
|
|
38
259
|
|
|
39
|
-
/* CSS Anchor Positioning supported mode - flip only when viewport overflow */
|
|
40
260
|
@supports (anchor-name: --anchor) {
|
|
41
261
|
.stuic-dropdown-menu-dropdown {
|
|
42
|
-
/* position-try-fallbacks: flip-block, flip-inline; */
|
|
43
|
-
|
|
44
|
-
/* position-area is set via inline style based on position param */
|
|
45
|
-
|
|
46
|
-
/* fallbacks ensure popover stays within viewport */
|
|
47
|
-
/* order: try other bottom positions first, then top, then left/right */
|
|
48
262
|
position-try-fallbacks:
|
|
49
263
|
flip-inline, --pop-bottom-span-right, --pop-bottom-span-left, --pop-bottom,
|
|
50
264
|
flip-block, --pop-top-span-right, --pop-top-span-left, --pop-top, --pop-left,
|
|
51
265
|
--pop-right;
|
|
52
266
|
}
|
|
53
267
|
}
|
|
54
|
-
|
|
55
|
-
/* Expandable section animation handled by Svelte slide transition */
|
|
56
|
-
.stuic-dropdown-menu-expandable-content {
|
|
57
|
-
overflow: hidden;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/* Backdrop for fallback mode */
|
|
61
|
-
.stuic-dropdown-menu-backdrop {
|
|
62
|
-
transition-property: opacity;
|
|
63
|
-
}
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
import SpinnerCircleOscillate from "../Spinner/SpinnerCircleOscillate.svelte";
|
|
38
38
|
import { isTHCNotEmpty, type THC } from "../Thc/Thc.svelte";
|
|
39
39
|
import InputWrap from "./_internal/InputWrap.svelte";
|
|
40
|
+
import Button from "../Button/Button.svelte";
|
|
40
41
|
|
|
41
42
|
const clog = createClog("FieldAssets");
|
|
42
43
|
|
|
@@ -324,7 +325,6 @@
|
|
|
324
325
|
clog.warn(`${e}`);
|
|
325
326
|
}
|
|
326
327
|
});
|
|
327
|
-
|
|
328
328
|
</script>
|
|
329
329
|
|
|
330
330
|
{#snippet default_render()}
|
|
@@ -386,17 +386,20 @@
|
|
|
386
386
|
</button>
|
|
387
387
|
</div>
|
|
388
388
|
{/each}
|
|
389
|
-
<
|
|
389
|
+
<Button
|
|
390
390
|
type="button"
|
|
391
391
|
onclick={(e) => {
|
|
392
392
|
e.preventDefault();
|
|
393
393
|
e.stopPropagation();
|
|
394
394
|
inputEl.click();
|
|
395
395
|
}}
|
|
396
|
-
class={[
|
|
396
|
+
class={["m-4", classControls].join(" ")}
|
|
397
|
+
roundedFull
|
|
398
|
+
aspect1
|
|
399
|
+
variant="ghost"
|
|
397
400
|
>
|
|
398
|
-
{@html iconAdd({ size:
|
|
399
|
-
</
|
|
401
|
+
{@html iconAdd({ size: 24 })}
|
|
402
|
+
</Button>
|
|
400
403
|
</div>
|
|
401
404
|
{/if}
|
|
402
405
|
{/snippet}
|
|
@@ -70,23 +70,7 @@
|
|
|
70
70
|
|
|
71
71
|
// $inspect(33333, invalid, validation);
|
|
72
72
|
|
|
73
|
-
//
|
|
74
|
-
let _classCommon = $derived(
|
|
75
|
-
[invalid && "invalid", disabled && "disabled", required && "required", renderSize]
|
|
76
|
-
.filter(Boolean)
|
|
77
|
-
.join(" ")
|
|
78
|
-
);
|
|
79
73
|
|
|
80
|
-
const _preset = {
|
|
81
|
-
labelBox: {
|
|
82
|
-
label: {
|
|
83
|
-
size: {
|
|
84
|
-
sm: "text-sm mt-0.5",
|
|
85
|
-
lg: "font-bold",
|
|
86
|
-
} as any,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
74
|
</script>
|
|
91
75
|
|
|
92
76
|
{#snippet snippetOrThc({ id, value }: { id: string; value?: SnippetWithId | THC })}
|
|
@@ -99,17 +83,18 @@
|
|
|
99
83
|
|
|
100
84
|
<label
|
|
101
85
|
class={twMerge(
|
|
102
|
-
|
|
103
|
-
_classCommon,
|
|
86
|
+
"stuic-checkbox",
|
|
104
87
|
"flex items-start mb-4 text-base",
|
|
88
|
+
invalid && "invalid",
|
|
89
|
+
disabled && "disabled",
|
|
105
90
|
classProp
|
|
106
91
|
)}
|
|
92
|
+
data-size={renderSize}
|
|
107
93
|
{style}
|
|
108
94
|
>
|
|
109
95
|
<div
|
|
110
96
|
class={twMerge(
|
|
111
97
|
"input-box",
|
|
112
|
-
_classCommon,
|
|
113
98
|
"flex h-6 items-center ml-1",
|
|
114
99
|
classInputBox
|
|
115
100
|
)}
|
|
@@ -126,40 +111,20 @@
|
|
|
126
111
|
...(typeof validate === "boolean" ? {} : validate),
|
|
127
112
|
setValidationResult,
|
|
128
113
|
})}
|
|
129
|
-
class={twMerge(
|
|
130
|
-
_classCommon,
|
|
131
|
-
`size-5 rounded
|
|
132
|
-
bg-neutral-100
|
|
133
|
-
border-neutral-300
|
|
134
|
-
text-input-accent dark:text-input-accent-dark
|
|
135
|
-
cursor-pointer
|
|
136
|
-
|
|
137
|
-
checked:border-input-accent checked:bg-input-accent
|
|
138
|
-
checked:dark:border-input-accent-dark checked:dark:bg-input-accent-dark
|
|
139
|
-
|
|
140
|
-
focus:border-input-accent
|
|
141
|
-
focus:ring-4
|
|
142
|
-
focus:ring-offset-0
|
|
143
|
-
focus:ring-input-accent/20 focus:dark:ring-input-accent-dark/20
|
|
144
|
-
|
|
145
|
-
disabled:cursor-not-allowed`,
|
|
146
|
-
classInput
|
|
147
|
-
)}
|
|
114
|
+
class={twMerge(classInput)}
|
|
148
115
|
{required}
|
|
149
116
|
{disabled}
|
|
150
117
|
{...rest}
|
|
151
118
|
/>
|
|
152
119
|
</div>
|
|
153
|
-
<div class={twMerge("label-box",
|
|
120
|
+
<div class={twMerge("label-box", "ml-3 w-full", classLabelBox)}>
|
|
154
121
|
{#if label}
|
|
155
122
|
<div
|
|
156
123
|
class={twMerge(
|
|
157
124
|
"label",
|
|
158
|
-
_classCommon,
|
|
159
125
|
"block w-full cursor-pointer",
|
|
160
126
|
disabled && "cursor-not-allowed",
|
|
161
127
|
required && "after:content-['*'] after:opacity-40 after:pl-1",
|
|
162
|
-
_preset.labelBox.label.size[renderSize],
|
|
163
128
|
classLabel
|
|
164
129
|
)}
|
|
165
130
|
>
|
|
@@ -175,8 +140,7 @@
|
|
|
175
140
|
transition:slide={{ duration: 150 }}
|
|
176
141
|
class={twMerge(
|
|
177
142
|
"validation-box",
|
|
178
|
-
|
|
179
|
-
"text-sm text-input-accent-invalid dark:text-input-accent-invalid-dark tracking-tight",
|
|
143
|
+
"text-sm tracking-tight",
|
|
180
144
|
classValidationBox
|
|
181
145
|
)}
|
|
182
146
|
>
|
|
@@ -187,7 +151,6 @@
|
|
|
187
151
|
<Collapsible
|
|
188
152
|
class={twMerge(
|
|
189
153
|
"desc-box",
|
|
190
|
-
_classCommon,
|
|
191
154
|
"text-sm opacity-50 cursor-pointer font-normal",
|
|
192
155
|
disabled && "cursor-not-allowed",
|
|
193
156
|
classDescBox
|
|
@@ -126,12 +126,7 @@
|
|
|
126
126
|
bind:this={input}
|
|
127
127
|
{id}
|
|
128
128
|
class={twMerge(
|
|
129
|
-
"
|
|
130
|
-
"block border-0 w-full",
|
|
131
|
-
"file:rounded file:border-0 file:mr-4 file:bg-neutral-200",
|
|
132
|
-
"file:px-2 file:cursor-pointer",
|
|
133
|
-
"focus-visible:ring-0 focus:ring-0 focus:leading-0",
|
|
134
|
-
renderSize,
|
|
129
|
+
"block w-full",
|
|
135
130
|
classInput
|
|
136
131
|
)}
|
|
137
132
|
use:highlightDragover={() => ({ classes: ["outline-dashed"] })}
|
|
@@ -228,10 +228,13 @@
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
function getIconThc(isSelected: boolean): { html: string } {
|
|
231
|
+
const size = 19;
|
|
231
232
|
if (isMultiple) {
|
|
232
|
-
return {
|
|
233
|
+
return {
|
|
234
|
+
html: isSelected ? iconCheckboxCheck({ size }) : iconCheckboxEmpty({ size }),
|
|
235
|
+
};
|
|
233
236
|
}
|
|
234
|
-
return { html: isSelected ? iconRadioCheck() : iconRadioEmpty() };
|
|
237
|
+
return { html: isSelected ? iconRadioCheck({ size }) : iconRadioEmpty({ size }) };
|
|
235
238
|
}
|
|
236
239
|
|
|
237
240
|
function sortFn(a: Item, b: Item) {
|
|
@@ -542,7 +545,7 @@
|
|
|
542
545
|
let extra = '';
|
|
543
546
|
if (vals.length > limit) {
|
|
544
547
|
vals = vals.slice(0, limit);
|
|
545
|
-
extra = `, ... <span class="text-sm
|
|
548
|
+
extra = `, ... <span class="text-sm stuic-field-options-muted">(+${(origLength - limit)})</span>`;
|
|
546
549
|
}
|
|
547
550
|
return vals.filter(v => v != null).map(_renderOptionLabel).join(", ") + extra;
|
|
548
551
|
} catch (e) {
|
|
@@ -569,8 +572,8 @@
|
|
|
569
572
|
class={twMerge("m-2 mb-12 shadow-xl", classModalField)}
|
|
570
573
|
classInputBoxWrap={twMerge(
|
|
571
574
|
// always look like focused
|
|
572
|
-
`border border-
|
|
573
|
-
`ring-
|
|
575
|
+
`border border-(--stuic-input-accent)`,
|
|
576
|
+
`ring-(--stuic-input-accent)/20 ring-4`
|
|
574
577
|
)}
|
|
575
578
|
{id}
|
|
576
579
|
{required}
|
|
@@ -580,7 +583,7 @@
|
|
|
580
583
|
bind:this={input}
|
|
581
584
|
{type}
|
|
582
585
|
{id}
|
|
583
|
-
class={twMerge(
|
|
586
|
+
class={twMerge(renderSize, classInput)}
|
|
584
587
|
tabindex={1}
|
|
585
588
|
{required}
|
|
586
589
|
{disabled}
|
|
@@ -599,16 +602,16 @@
|
|
|
599
602
|
/>
|
|
600
603
|
|
|
601
604
|
{#snippet inputBelow()}
|
|
602
|
-
<div
|
|
605
|
+
<div
|
|
606
|
+
class="h-full border-t p-2"
|
|
607
|
+
style="border-color: var(--stuic-field-options-divider);"
|
|
608
|
+
>
|
|
603
609
|
<div class="text-sm -mt-1 flex items-center">
|
|
604
610
|
{#if isMultiple}
|
|
605
611
|
<button
|
|
606
612
|
type="button"
|
|
607
613
|
onclick={() => _selectedColl.addMany(options.items)}
|
|
608
|
-
class=
|
|
609
|
-
"control flex items-center p-1 m-1 text-sm opacity-75 underline rounded",
|
|
610
|
-
"hover:opacity-100 focus-visible:outline-neutral-400 focus-visible:opacity-100"
|
|
611
|
-
)}
|
|
614
|
+
class="control flex items-center p-1 m-1 text-sm underline rounded stuic-field-options-control"
|
|
612
615
|
tabindex={4}
|
|
613
616
|
disabled={!options.size}
|
|
614
617
|
>
|
|
@@ -621,11 +624,8 @@
|
|
|
621
624
|
_selectedColl.clear();
|
|
622
625
|
input?.focus();
|
|
623
626
|
}}
|
|
624
|
-
class=
|
|
625
|
-
|
|
626
|
-
"hover:opacity-100 focus-visible:outline-neutral-400 focus-visible:opacity-100"
|
|
627
|
-
)}
|
|
628
|
-
class:opacity-20={!selected.items.length}
|
|
627
|
+
class="control flex items-center p-1 m-1 text-sm underline rounded stuic-field-options-control"
|
|
628
|
+
data-disabled={!selected.items.length || undefined}
|
|
629
629
|
tabindex={5}
|
|
630
630
|
disabled={!selected.items.length}
|
|
631
631
|
>
|
|
@@ -634,7 +634,7 @@
|
|
|
634
634
|
|
|
635
635
|
<span class="p-1 m-1 text-sm"> </span>
|
|
636
636
|
<span
|
|
637
|
-
class="flex-1 block justify-end
|
|
637
|
+
class="flex-1 block justify-end text-right text-xs p-1 pr-2 stuic-field-options-muted"
|
|
638
638
|
>
|
|
639
639
|
{selected.items.length}
|
|
640
640
|
{#if cardinality > 0 && cardinality < Infinity}
|
|
@@ -655,11 +655,15 @@
|
|
|
655
655
|
tabindex="-1"
|
|
656
656
|
>
|
|
657
657
|
{#if isFetching && !options.items.length}
|
|
658
|
-
<div
|
|
658
|
+
<div
|
|
659
|
+
class="flex text-sm h-full items-center justify-center stuic-field-options-placeholder"
|
|
660
|
+
>
|
|
659
661
|
<Spinner class="w-4" />
|
|
660
662
|
</div>
|
|
661
663
|
{:else if !options.items.length && !allowUnknown}
|
|
662
|
-
<div
|
|
664
|
+
<div
|
|
665
|
+
class="flex text-sm h-full items-center justify-center stuic-field-options-placeholder"
|
|
666
|
+
>
|
|
663
667
|
{@html t("no_results")}
|
|
664
668
|
</div>
|
|
665
669
|
{/if}
|
|
@@ -682,8 +686,7 @@
|
|
|
682
686
|
{#if _optgroup}
|
|
683
687
|
<div
|
|
684
688
|
class={twMerge(
|
|
685
|
-
"mb-1 p-1 text-xs font-semibold uppercase tracking-wide",
|
|
686
|
-
"text-neutral-500 dark:text-neutral-400",
|
|
689
|
+
"mb-1 p-1 text-xs font-semibold uppercase tracking-wide stuic-field-options-optgroup",
|
|
687
690
|
classOptgroup
|
|
688
691
|
)}
|
|
689
692
|
>
|
|
@@ -717,7 +720,9 @@
|
|
|
717
720
|
active={isSelected}
|
|
718
721
|
focused={active}
|
|
719
722
|
contentBefore={showIcons ? getIconThc(isSelected) : undefined}
|
|
720
|
-
classContentBefore={isSelected
|
|
723
|
+
classContentBefore={isSelected
|
|
724
|
+
? "stuic-field-options-icon stuic-field-options-icon--selected"
|
|
725
|
+
: "stuic-field-options-icon"}
|
|
721
726
|
class={classOption}
|
|
722
727
|
classActive={classOptionActive}
|
|
723
728
|
classFocused={classOptionActive}
|
|
@@ -734,7 +739,7 @@
|
|
|
734
739
|
</div>
|
|
735
740
|
<!-- {/if} -->
|
|
736
741
|
<div class="p-2 px-3 flex items-end justify-between">
|
|
737
|
-
<div class="text-xs
|
|
742
|
+
<div class="text-xs stuic-field-options-muted">
|
|
738
743
|
<!-- Use arrows to navigate. Spacebar and Enter to select and/or submit. -->
|
|
739
744
|
{#if allowUnknown}
|
|
740
745
|
{@html t("unknown_allowed")}
|
|
@@ -746,7 +751,7 @@
|
|
|
746
751
|
<Button
|
|
747
752
|
class="control"
|
|
748
753
|
type="button"
|
|
749
|
-
|
|
754
|
+
intent="primary"
|
|
750
755
|
onclick={async (e) => {
|
|
751
756
|
e.preventDefault();
|
|
752
757
|
try_submit(true);
|
|
@@ -761,22 +766,20 @@
|
|
|
761
766
|
{/snippet}
|
|
762
767
|
|
|
763
768
|
{#snippet inputAfter()}
|
|
764
|
-
<div
|
|
769
|
+
<div
|
|
770
|
+
class="flex pl-2 items-center justify-center stuic-field-options-placeholder"
|
|
771
|
+
>
|
|
765
772
|
{#if isFetching}
|
|
766
773
|
<Spinner class="w-4" />
|
|
767
774
|
{/if}
|
|
768
775
|
</div>
|
|
769
776
|
<div class="flex pl-2 pr-1 items-center justify-center">
|
|
770
|
-
<
|
|
777
|
+
<Button
|
|
778
|
+
x
|
|
779
|
+
variant="ghost"
|
|
780
|
+
roundedFull
|
|
771
781
|
type="button"
|
|
772
|
-
|
|
773
|
-
"opacity-75 rounded",
|
|
774
|
-
"hover:opacity-100 hover:bg-neutral-200 dark:hover:bg-neutral-800",
|
|
775
|
-
"focus-visible:opacity-100 focus-visible:outline-0",
|
|
776
|
-
"focus-visible:bg-neutral-200 dark:focus-visible:bg-neutral-800"
|
|
777
|
-
)}
|
|
778
|
-
use:tooltip
|
|
779
|
-
aria-label={t("x_close")}
|
|
782
|
+
tooltip={t("x_close")}
|
|
780
783
|
onclick={(e) => {
|
|
781
784
|
e.preventDefault();
|
|
782
785
|
if (innerValue.trim() == "") {
|
|
@@ -787,14 +790,14 @@
|
|
|
787
790
|
input?.focus();
|
|
788
791
|
}}
|
|
789
792
|
tabindex={2}
|
|
790
|
-
|
|
791
|
-
<X class="m-2 size-6" />
|
|
792
|
-
</button>
|
|
793
|
+
/>
|
|
793
794
|
</div>
|
|
794
795
|
{/snippet}
|
|
795
796
|
|
|
796
797
|
{#snippet inputBefore()}
|
|
797
|
-
<div
|
|
798
|
+
<div
|
|
799
|
+
class="flex flex-col items-center justify-center pl-3 stuic-field-options-muted"
|
|
800
|
+
>
|
|
798
801
|
{@html iconSearch({ size: 19, strokeWidth: 3 })}
|
|
799
802
|
</div>
|
|
800
803
|
{/snippet}
|