@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.
Files changed (171) hide show
  1. package/README.md +292 -4
  2. package/dist/README.md +41 -18
  3. package/dist/actions/popover/README.md +19 -0
  4. package/dist/actions/popover/index.css +6 -9
  5. package/dist/actions/popover/popover.svelte.js +2 -2
  6. package/dist/actions/tooltip/README.md +18 -0
  7. package/dist/actions/tooltip/index.css +5 -8
  8. package/dist/actions/tooltip/tooltip.svelte.js +1 -1
  9. package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte +9 -10
  10. package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte.d.ts +3 -3
  11. package/dist/components/AlertConfirmPrompt/Current.svelte +15 -17
  12. package/dist/components/AlertConfirmPrompt/Current.svelte.d.ts +5 -3
  13. package/dist/components/AlertConfirmPrompt/acp-icons.js +5 -4
  14. package/dist/components/AlertConfirmPrompt/index.css +62 -0
  15. package/dist/components/AssetsPreview/AssetsPreview.svelte +92 -73
  16. package/dist/components/AssetsPreview/AssetsPreview.svelte.d.ts +1 -0
  17. package/dist/components/AssetsPreview/index.css +59 -0
  18. package/dist/components/Avatar/Avatar.svelte +32 -18
  19. package/dist/components/Avatar/Avatar.svelte.d.ts +1 -0
  20. package/dist/components/Avatar/README.md +166 -0
  21. package/dist/components/Avatar/index.css +128 -0
  22. package/dist/components/Backdrop/Backdrop.svelte +8 -2
  23. package/dist/components/Backdrop/Backdrop.svelte.d.ts +1 -0
  24. package/dist/components/Backdrop/README.md +71 -6
  25. package/dist/components/Backdrop/index.css +29 -0
  26. package/dist/components/Button/Button.svelte +117 -124
  27. package/dist/components/Button/Button.svelte.d.ts +35 -23
  28. package/dist/components/Button/README.md +87 -21
  29. package/dist/components/Button/index.css +473 -9
  30. package/dist/components/Button/index.d.ts +1 -1
  31. package/dist/components/Button/index.js +1 -1
  32. package/dist/components/ButtonGroupRadio/ButtonGroupRadio.svelte +7 -38
  33. package/dist/components/ButtonGroupRadio/README.md +82 -4
  34. package/dist/components/ButtonGroupRadio/index.css +152 -14
  35. package/dist/components/Collapsible/Collapsible.svelte +7 -7
  36. package/dist/components/Collapsible/Collapsible.svelte.d.ts +2 -2
  37. package/dist/components/Collapsible/README.md +34 -2
  38. package/dist/components/Collapsible/index.css +38 -0
  39. package/dist/components/CommandMenu/CommandMenu.svelte +13 -24
  40. package/dist/components/CommandMenu/README.md +39 -0
  41. package/dist/components/CommandMenu/index.css +45 -2
  42. package/dist/components/DismissibleMessage/DismissibleMessage.svelte +53 -50
  43. package/dist/components/DismissibleMessage/DismissibleMessage.svelte.d.ts +6 -5
  44. package/dist/components/DismissibleMessage/README.md +93 -11
  45. package/dist/components/DismissibleMessage/index.css +122 -8
  46. package/dist/components/DismissibleMessage/index.d.ts +1 -1
  47. package/dist/components/DropdownMenu/DropdownMenu.svelte +14 -50
  48. package/dist/components/DropdownMenu/DropdownMenu.svelte.d.ts +6 -6
  49. package/dist/components/DropdownMenu/README.md +132 -0
  50. package/dist/components/DropdownMenu/index.css +231 -27
  51. package/dist/components/Input/FieldAssets.svelte +8 -5
  52. package/dist/components/Input/FieldCheckbox.svelte +7 -44
  53. package/dist/components/Input/FieldFile.svelte +1 -6
  54. package/dist/components/Input/FieldInput.svelte +1 -1
  55. package/dist/components/Input/FieldOptions.svelte +41 -38
  56. package/dist/components/Input/FieldRadios.svelte +7 -16
  57. package/dist/components/Input/FieldSelect.svelte +1 -1
  58. package/dist/components/Input/FieldSwitch.svelte +1 -5
  59. package/dist/components/Input/FieldTextarea.svelte +1 -1
  60. package/dist/components/Input/README.md +194 -0
  61. package/dist/components/Input/_internal/FieldRadioInternal.svelte +2 -40
  62. package/dist/components/Input/_internal/InputWrap.svelte +8 -48
  63. package/dist/components/Input/index.css +522 -127
  64. package/dist/components/ListItemButton/ListItemButton.svelte +37 -73
  65. package/dist/components/ListItemButton/ListItemButton.svelte.d.ts +1 -9
  66. package/dist/components/ListItemButton/README.md +100 -45
  67. package/dist/components/ListItemButton/index.css +175 -56
  68. package/dist/components/ListItemButton/index.d.ts +1 -1
  69. package/dist/components/ListItemButton/index.js +1 -1
  70. package/dist/components/Modal/Modal.svelte +2 -8
  71. package/dist/components/Modal/Modal.svelte.d.ts +1 -0
  72. package/dist/components/Modal/README.md +29 -0
  73. package/dist/components/Modal/index.css +36 -0
  74. package/dist/components/ModalDialog/ModalDialog.svelte +2 -21
  75. package/dist/components/ModalDialog/README.md +35 -0
  76. package/dist/components/ModalDialog/index.css +57 -0
  77. package/dist/components/Notifications/Notifications.svelte +44 -128
  78. package/dist/components/Notifications/Notifications.svelte.d.ts +9 -17
  79. package/dist/components/Notifications/README.md +186 -70
  80. package/dist/components/Notifications/index.css +212 -15
  81. package/dist/components/Progress/README.md +15 -0
  82. package/dist/components/Progress/_internal/Bar.svelte +2 -2
  83. package/dist/components/Progress/index.css +4 -4
  84. package/dist/components/Skeleton/Skeleton.svelte +3 -2
  85. package/dist/components/Skeleton/index.css +11 -14
  86. package/dist/components/Spinner/Spinner.svelte +2 -2
  87. package/dist/components/Spinner/SpinnerCircle.svelte +1 -1
  88. package/dist/components/Switch/README.md +15 -0
  89. package/dist/components/Switch/Switch.svelte +4 -7
  90. package/dist/components/Switch/Switch.svelte.d.ts +1 -1
  91. package/dist/components/Switch/SwitchButton.svelte +4 -5
  92. package/dist/components/Switch/index.css +3 -4
  93. package/dist/components/TabbedMenu/README.md +26 -21
  94. package/dist/components/TabbedMenu/TabbedMenu.svelte +5 -5
  95. package/dist/components/TabbedMenu/index.css +7 -22
  96. package/dist/components/ThemePreview/README.md +289 -0
  97. package/dist/components/ThemePreview/ThemePreview.svelte +341 -0
  98. package/dist/components/ThemePreview/ThemePreview.svelte.d.ts +33 -0
  99. package/dist/components/ThemePreview/index.css +493 -0
  100. package/dist/components/ThemePreview/index.d.ts +1 -0
  101. package/dist/components/ThemePreview/index.js +1 -0
  102. package/dist/components/TwCheck/TwCheck.svelte +4 -4
  103. package/dist/components/TwCheck/index.css +3 -2
  104. package/dist/components/TypeaheadInput/TypeaheadInput.svelte +1 -1
  105. package/dist/components/X/X.svelte +12 -5
  106. package/dist/components/X/X.svelte.d.ts +1 -0
  107. package/dist/icons/index.d.ts +1 -0
  108. package/dist/icons/index.js +1 -0
  109. package/dist/index.css +31 -16
  110. package/dist/index.d.ts +1 -0
  111. package/dist/index.js +1 -0
  112. package/dist/themes/blue-orange.css +163 -0
  113. package/dist/themes/blue-orange.d.ts +6 -0
  114. package/dist/themes/blue-orange.js +151 -0
  115. package/dist/themes/cyan-red.css +163 -0
  116. package/dist/themes/cyan-red.d.ts +6 -0
  117. package/dist/themes/cyan-red.js +151 -0
  118. package/dist/themes/cyan-slate.css +163 -0
  119. package/dist/themes/cyan-slate.d.ts +6 -0
  120. package/dist/themes/cyan-slate.js +151 -0
  121. package/dist/themes/emerald-pink.css +163 -0
  122. package/dist/themes/emerald-pink.d.ts +6 -0
  123. package/dist/themes/emerald-pink.js +151 -0
  124. package/dist/themes/fuchsia-emerald.css +163 -0
  125. package/dist/themes/fuchsia-emerald.d.ts +6 -0
  126. package/dist/themes/fuchsia-emerald.js +151 -0
  127. package/dist/themes/gray.css +163 -0
  128. package/dist/themes/gray.d.ts +6 -0
  129. package/dist/themes/gray.js +151 -0
  130. package/dist/themes/indigo-amber.css +163 -0
  131. package/dist/themes/indigo-amber.d.ts +6 -0
  132. package/dist/themes/indigo-amber.js +151 -0
  133. package/dist/themes/neutral.css +163 -0
  134. package/dist/themes/neutral.d.ts +6 -0
  135. package/dist/themes/neutral.js +151 -0
  136. package/dist/themes/pink-emerald.css +163 -0
  137. package/dist/themes/pink-emerald.d.ts +6 -0
  138. package/dist/themes/pink-emerald.js +151 -0
  139. package/dist/themes/purple-yellow.css +163 -0
  140. package/dist/themes/purple-yellow.d.ts +6 -0
  141. package/dist/themes/purple-yellow.js +151 -0
  142. package/dist/themes/rainbow.css +163 -0
  143. package/dist/themes/rainbow.d.ts +6 -0
  144. package/dist/themes/rainbow.js +156 -0
  145. package/dist/themes/red-blue.css +163 -0
  146. package/dist/themes/red-blue.d.ts +6 -0
  147. package/dist/themes/red-blue.js +151 -0
  148. package/dist/themes/red-cyan.css +163 -0
  149. package/dist/themes/red-cyan.d.ts +6 -0
  150. package/dist/themes/red-cyan.js +151 -0
  151. package/dist/themes/rose-teal.css +163 -0
  152. package/dist/themes/rose-teal.d.ts +6 -0
  153. package/dist/themes/rose-teal.js +151 -0
  154. package/dist/themes/sky-amber.css +163 -0
  155. package/dist/themes/sky-amber.d.ts +6 -0
  156. package/dist/themes/sky-amber.js +151 -0
  157. package/dist/themes/slate-cyan.css +163 -0
  158. package/dist/themes/slate-cyan.d.ts +6 -0
  159. package/dist/themes/slate-cyan.js +151 -0
  160. package/dist/themes/tailwind-color-pairs.md +31 -0
  161. package/dist/themes/teal-rose.css +163 -0
  162. package/dist/themes/teal-rose.d.ts +6 -0
  163. package/dist/themes/teal-rose.js +151 -0
  164. package/dist/themes/violet-lime.css +163 -0
  165. package/dist/themes/violet-lime.d.ts +6 -0
  166. package/dist/themes/violet-lime.js +151 -0
  167. package/dist/utils/design-tokens.d.ts +43 -0
  168. package/dist/utils/design-tokens.js +100 -0
  169. package/dist/utils/index.d.ts +1 -0
  170. package/dist/utils/index.js +1 -0
  171. package/package.json +22 -2
@@ -1,20 +1,18 @@
1
1
  # DismissibleMessage
2
2
 
3
- A dismissible alert/message component with color themes and slide transition.
3
+ A dismissible alert/message component with semantic intents and slide transition.
4
4
 
5
5
  ## Props
6
6
 
7
7
  | Prop | Type | Default | Description |
8
8
  |------|------|---------|-------------|
9
9
  | `message` | `THC \| Error` | - | Message content (string, HTML, or Error object) |
10
- | `theme` | `TW_COLORS` | - | Tailwind color theme (e.g., `"red"`, `"green"`, `"blue"`) |
10
+ | `intent` | `"destructive" \| "warning" \| "success" \| "info"` | - | Semantic color intent |
11
11
  | `forceAsHtml` | `boolean` | `true` | Render message as HTML |
12
12
  | `duration` | `number` | `150` | Slide transition duration (ms) |
13
13
  | `onDismiss` | `(() => void) \| null \| false` | - | Dismiss callback (set to `false` to hide X button) |
14
14
  | `class` | `string` | - | CSS for container |
15
15
  | `classContent` | `string` | - | CSS for content area |
16
- | `classDismiss` | `string` | - | CSS for dismiss button |
17
- | `classX` | `string` | - | CSS for X icon |
18
16
 
19
17
  ## Usage
20
18
 
@@ -22,7 +20,7 @@ A dismissible alert/message component with color themes and slide transition.
22
20
 
23
21
  ```svelte
24
22
  <script lang="ts">
25
- import { DismissibleMessage } from 'stuic';
23
+ import { DismissibleMessage } from '@marianmeres/stuic';
26
24
 
27
25
  let message = $state('This is an important notice.');
28
26
  </script>
@@ -33,27 +31,41 @@ A dismissible alert/message component with color themes and slide transition.
33
31
  />
34
32
  ```
35
33
 
36
- ### With Theme Colors
34
+ ### With Semantic Intents
37
35
 
38
36
  ```svelte
39
37
  <script lang="ts">
40
- import { DismissibleMessage } from 'stuic';
38
+ import { DismissibleMessage } from '@marianmeres/stuic';
41
39
 
42
40
  let error = $state('Something went wrong!');
43
41
  let success = $state('Operation completed successfully.');
44
42
  </script>
45
43
 
44
+ <!-- Error/destructive message -->
46
45
  <DismissibleMessage
47
46
  message={error}
48
- theme="red"
47
+ intent="destructive"
49
48
  onDismiss={() => error = ''}
50
49
  />
51
50
 
51
+ <!-- Success message -->
52
52
  <DismissibleMessage
53
53
  message={success}
54
- theme="green"
54
+ intent="success"
55
55
  onDismiss={() => success = ''}
56
56
  />
57
+
58
+ <!-- Warning message -->
59
+ <DismissibleMessage
60
+ message="Please review your changes"
61
+ intent="warning"
62
+ />
63
+
64
+ <!-- Info message -->
65
+ <DismissibleMessage
66
+ message="New features are available"
67
+ intent="info"
68
+ />
57
69
  ```
58
70
 
59
71
  ### Non-Dismissible
@@ -61,7 +73,7 @@ A dismissible alert/message component with color themes and slide transition.
61
73
  ```svelte
62
74
  <DismissibleMessage
63
75
  message="This message cannot be dismissed."
64
- theme="blue"
76
+ intent="info"
65
77
  onDismiss={false}
66
78
  />
67
79
  ```
@@ -84,8 +96,78 @@ A dismissible alert/message component with color themes and slide transition.
84
96
  {#if error}
85
97
  <DismissibleMessage
86
98
  message={error}
87
- theme="red"
99
+ intent="destructive"
88
100
  onDismiss={() => error = null}
89
101
  />
90
102
  {/if}
91
103
  ```
104
+
105
+ ## CSS Variables
106
+
107
+ ### Component Tokens
108
+
109
+ | Variable | Default | Description |
110
+ |----------|---------|-------------|
111
+ | `--stuic-dismissible-message-radius` | `var(--radius-md)` | Border radius |
112
+ | `--stuic-dismissible-message-padding-x` | `calc(var(--spacing) * 4)` | Horizontal padding |
113
+ | `--stuic-dismissible-message-padding-y` | `calc(var(--spacing) * 3)` | Vertical padding |
114
+ | `--stuic-dismissible-message-border-width` | `1px` | Border width |
115
+ | `--stuic-dismissible-message-transition` | `150ms` | Color transition duration |
116
+
117
+ ### Customization Examples
118
+
119
+ ```css
120
+ /* Global override */
121
+ :root {
122
+ --stuic-dismissible-message-radius: var(--radius-lg);
123
+ --stuic-dismissible-message-padding-x: calc(var(--spacing) * 6);
124
+ }
125
+ ```
126
+
127
+ ```svelte
128
+ <!-- Inline override -->
129
+ <DismissibleMessage
130
+ message="Custom styled message"
131
+ style="--stuic-dismissible-message-radius: 9999px;"
132
+ />
133
+ ```
134
+
135
+ ### Intent Colors
136
+
137
+ Intent colors are derived from the global STUIC design tokens:
138
+
139
+ | Intent | Token Used |
140
+ |--------|------------|
141
+ | `destructive` | `--stuic-color-destructive` |
142
+ | `warning` | `--stuic-color-warning` |
143
+ | `success` | `--stuic-color-success` |
144
+ | `info` | `--stuic-color-info` |
145
+
146
+ Customize these in your theme file to change all components at once.
147
+
148
+ ## Data Attributes
149
+
150
+ The component uses data attributes for CSS targeting:
151
+
152
+ - `data-intent` - The intent value (when set)
153
+
154
+ ```css
155
+ /* Custom styling for specific intent */
156
+ .stuic-dismissible-message[data-intent="destructive"] {
157
+ font-weight: bold;
158
+ }
159
+ ```
160
+
161
+ ## Migration from v2
162
+
163
+ The `theme` prop has been replaced with `intent`:
164
+
165
+ | Old (v2) | New (v3) |
166
+ |----------|----------|
167
+ | `theme="red"` | `intent="destructive"` |
168
+ | `theme="orange"` | `intent="warning"` |
169
+ | `theme="green"` | `intent="success"` |
170
+ | `theme="blue"` | `intent="info"` |
171
+ | No theme | No intent (default) |
172
+
173
+ The `classDismiss` and `classX` props have been removed.
@@ -1,11 +1,125 @@
1
- /* prettier-ignore */
2
- @theme inline {
3
- --color-dismiss-bg: var(--color-dismiss-bg, var(--color-neutral-200));
4
- --color-dismiss-bg-dark: var(--color-dismiss-bg-dark, var(--color-neutral-700));
1
+ /* =============================================================================
2
+ DISMISSIBLE MESSAGE COMPONENT TOKENS
3
+ Override globally: :root { --stuic-dismissible-message-radius: 0; }
4
+ Override locally: style="--stuic-dismissible-message-radius: 9999px;"
5
+ ============================================================================= */
5
6
 
6
- --color-dismiss-text: var(--color-dismiss-text, var(--color-neutral-700));
7
- --color-dismiss-text-dark: var(--color-dismiss-text-dark, var(--color-neutral-200));
7
+ :root {
8
+ --stuic-dismissible-message-radius: var(--radius-md);
9
+ --stuic-dismissible-message-padding-x: calc(var(--spacing) * 4);
10
+ --stuic-dismissible-message-padding-y: calc(var(--spacing) * 3);
11
+ --stuic-dismissible-message-border-width: 1px;
12
+ --stuic-dismissible-message-transition: 150ms;
13
+ }
14
+
15
+ /* =============================================================================
16
+ BASE STYLES
17
+ ============================================================================= */
18
+
19
+ .stuic-dismissible-message {
20
+ display: flex;
21
+ align-items: center;
22
+ border-width: var(--stuic-dismissible-message-border-width);
23
+ border-style: solid;
24
+ border-radius: var(--stuic-dismissible-message-radius);
25
+ transition:
26
+ background var(--stuic-dismissible-message-transition),
27
+ border-color var(--stuic-dismissible-message-transition);
28
+
29
+ /* Colors via internal vars set by intent */
30
+ background: var(--_bg);
31
+ color: var(--_text);
32
+ border-color: var(--_border);
33
+ }
34
+
35
+ /* Content area */
36
+ .stuic-dismissible-message > .content {
37
+ flex: 1;
38
+ padding: var(--stuic-dismissible-message-padding-y)
39
+ var(--stuic-dismissible-message-padding-x);
40
+ }
41
+
42
+ /* Icon container (left side) */
43
+ .stuic-dismissible-message > .icon {
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ flex-shrink: 0;
48
+ padding-left: var(--stuic-dismissible-message-padding-x);
49
+ color: var(--_text);
50
+ opacity: 0.85;
51
+ }
52
+
53
+ .stuic-dismissible-message > .icon svg {
54
+ width: 1.5rem;
55
+ height: 1.5rem;
56
+ }
57
+
58
+ /* Dismiss button container */
59
+ .stuic-dismissible-message > .dismiss {
60
+ display: flex;
61
+ align-items: center;
62
+ justify-content: center;
63
+ padding: calc(var(--stuic-dismissible-message-padding-y) * 0.75);
64
+ }
65
+
66
+ /* Dismiss button inherits message text color */
67
+ .stuic-dismissible-message > .dismiss .stuic-button {
68
+ color: var(--_text);
69
+ }
70
+
71
+ /* =============================================================================
72
+ DEFAULT (NO INTENT): NEUTRAL MUTED APPEARANCE
73
+ ============================================================================= */
74
+
75
+ .stuic-dismissible-message:not([data-intent]) {
76
+ --_bg: var(--stuic-color-muted);
77
+ --_text: var(--stuic-color-muted-foreground);
78
+ --_border: var(--stuic-color-border);
79
+ }
80
+
81
+ /* =============================================================================
82
+ INTENT COLOR MAPPING (SOFT STYLE)
83
+ Each intent uses a soft/tinted appearance appropriate for messages.
84
+ ============================================================================= */
85
+
86
+ /* Destructive: error messages */
87
+ .stuic-dismissible-message[data-intent="destructive"] {
88
+ --_bg: color-mix(in srgb, var(--stuic-color-destructive) 10%, transparent);
89
+ --_text: var(--stuic-color-destructive);
90
+ --_border: color-mix(in srgb, var(--stuic-color-destructive) 30%, transparent);
91
+ }
92
+
93
+ /* Warning: caution messages */
94
+ .stuic-dismissible-message[data-intent="warning"] {
95
+ --_bg: color-mix(in srgb, var(--stuic-color-warning) 10%, transparent);
96
+ --_text: var(--stuic-color-warning);
97
+ --_border: color-mix(in srgb, var(--stuic-color-warning) 30%, transparent);
98
+ }
99
+
100
+ /* Success: confirmation messages */
101
+ .stuic-dismissible-message[data-intent="success"] {
102
+ --_bg: color-mix(in srgb, var(--stuic-color-success) 10%, transparent);
103
+ --_text: var(--stuic-color-success);
104
+ --_border: color-mix(in srgb, var(--stuic-color-success) 30%, transparent);
105
+ }
106
+
107
+ /* Info: informational messages */
108
+ .stuic-dismissible-message[data-intent="info"] {
109
+ --_bg: color-mix(in srgb, var(--stuic-color-info) 10%, transparent);
110
+ --_text: var(--stuic-color-info);
111
+ --_border: color-mix(in srgb, var(--stuic-color-info) 30%, transparent);
112
+ }
113
+
114
+ /* =============================================================================
115
+ DARK MODE ADJUSTMENTS
116
+ Increase color intensity for better visibility in dark mode.
117
+ ============================================================================= */
8
118
 
9
- --color-dismiss-border: var(--color-dismiss-border, var(--color-neutral-500));
10
- --color-dismiss-border-dark: var(--color-dismiss-border-dark, var(--color-neutral-500));
119
+ .dark .stuic-dismissible-message[data-intent="destructive"],
120
+ .dark .stuic-dismissible-message[data-intent="warning"],
121
+ .dark .stuic-dismissible-message[data-intent="success"],
122
+ .dark .stuic-dismissible-message[data-intent="info"] {
123
+ --_bg: color-mix(in srgb, var(--_text) 20%, transparent);
124
+ --_border: color-mix(in srgb, var(--_text) 40%, transparent);
11
125
  }
@@ -1 +1 @@
1
- export { default as DismissibleMessage, type Props as DismissibleMessageProps, } from "./DismissibleMessage.svelte";
1
+ export { default as DismissibleMessage, type Props as DismissibleMessageProps, type MessageIntent as DismissibleMessageIntent, } from "./DismissibleMessage.svelte";
@@ -205,49 +205,17 @@
205
205
  );
206
206
  }
207
207
 
208
- export const DROPDOWN_MENU_BASE_CLASSES = `stuic-dropdown-menu relative inline-block`;
209
-
210
- export const DROPDOWN_MENU_TRIGGER_CLASSES = `
211
- inline-flex items-center justify-center gap-2
212
- px-3 py-2
213
- rounded-md border
214
- bg-white dark:bg-neutral-800
215
- text-neutral-900 dark:text-neutral-100
216
- border-neutral-200 dark:border-neutral-700
217
- hover:brightness-95 dark:hover:brightness-110
218
- cursor-pointer
219
- `;
220
- // focus-visible:outline-2 focus-visible:outline-offset-2
221
-
222
- export const DROPDOWN_MENU_DROPDOWN_CLASSES = `
223
- stuic-dropdown-menu-dropdown
224
- bg-white dark:bg-neutral-800
225
- text-neutral-900 dark:text-neutral-100
226
- border border-neutral-200 dark:border-neutral-700
227
- rounded-md shadow-sm
228
- p-1
229
- overflow-y-auto
230
- z-50
231
- min-w-48
232
- `;
233
-
234
- export const DROPDOWN_MENU_DIVIDER_CLASSES = `
235
- h-px my-1
236
- bg-neutral-200 dark:bg-neutral-700
237
- `;
238
-
239
- export const DROPDOWN_MENU_HEADER_CLASSES = `
240
- px-2 py-1.5
241
- text-xs font-semibold uppercase tracking-wide
242
- text-neutral-500 dark:text-neutral-400
243
- select-none
244
- `;
245
-
246
- export const DROPDOWN_MENU_BACKDROP_CLASSES = `
247
- stuic-dropdown-menu-backdrop
248
- fixed inset-0 bg-black/25
249
- z-40
250
- `;
208
+ export const DROPDOWN_MENU_BASE_CLASSES = `stuic-dropdown-menu`;
209
+
210
+ export const DROPDOWN_MENU_TRIGGER_CLASSES = `stuic-dropdown-menu-trigger`;
211
+
212
+ export const DROPDOWN_MENU_DROPDOWN_CLASSES = `stuic-dropdown-menu-dropdown`;
213
+
214
+ export const DROPDOWN_MENU_DIVIDER_CLASSES = `stuic-dropdown-menu-divider`;
215
+
216
+ export const DROPDOWN_MENU_HEADER_CLASSES = `stuic-dropdown-menu-header`;
217
+
218
+ export const DROPDOWN_MENU_BACKDROP_CLASSES = `stuic-dropdown-menu-backdrop`;
251
219
  </script>
252
220
 
253
221
  <script lang="ts">
@@ -659,15 +627,11 @@
659
627
  >
660
628
  <!-- Close button (fallback mode only) -->
661
629
  {#if !isSupported}
662
- <div class="sticky top-0 right-0 z-10 flex just pointer-events-none">
630
+ <div class="sticky top-0 right-0 z-10 flex pointer-events-none">
663
631
  <button
664
632
  type="button"
665
633
  aria-label="Close"
666
- class={[
667
- "bg-black text-white rounded-md cursor-pointer opacity-60",
668
- "absolute right-0 top-0 p-2",
669
- "leading-none hover:opacity-100 pointer-events-auto",
670
- ]}
634
+ class="stuic-dropdown-menu-close absolute right-0 top-0 pointer-events-auto"
671
635
  onclick={() => {
672
636
  isOpen = false;
673
637
  triggerEl?.focus();
@@ -760,7 +724,7 @@
760
724
  {#if isExpanded}
761
725
  <div
762
726
  class={twMerge(
763
- "stuic-dropdown-menu-expandable-content pl-4",
727
+ "stuic-dropdown-menu-expandable-content",
764
728
  classExpandableContent
765
729
  )}
766
730
  transition:slide={{ duration: transitionDuration }}
@@ -147,12 +147,12 @@ export interface Props extends Omit<HTMLButtonAttributes, "children"> {
147
147
  /** Optional, used only when css positioning not supported (iPhone)*/
148
148
  noScrollLock?: boolean;
149
149
  }
150
- export declare const DROPDOWN_MENU_BASE_CLASSES = "stuic-dropdown-menu relative inline-block";
151
- export declare const DROPDOWN_MENU_TRIGGER_CLASSES = "\n\t\tinline-flex items-center justify-center gap-2\n\t\tpx-3 py-2\n\t\trounded-md border\n\t\tbg-white dark:bg-neutral-800\n\t\ttext-neutral-900 dark:text-neutral-100\n\t\tborder-neutral-200 dark:border-neutral-700\n\t\thover:brightness-95 dark:hover:brightness-110\n\t\tcursor-pointer\n\t\t";
152
- export declare const DROPDOWN_MENU_DROPDOWN_CLASSES = "\n\t\tstuic-dropdown-menu-dropdown\n\t\tbg-white dark:bg-neutral-800\n\t\ttext-neutral-900 dark:text-neutral-100\n\t\tborder border-neutral-200 dark:border-neutral-700\n\t\trounded-md shadow-sm\n\t\tp-1\n\t\toverflow-y-auto\n\t\tz-50\n\t\tmin-w-48\n\t";
153
- export declare const DROPDOWN_MENU_DIVIDER_CLASSES = "\n\t\th-px my-1\n\t\tbg-neutral-200 dark:bg-neutral-700\n\t";
154
- export declare const DROPDOWN_MENU_HEADER_CLASSES = "\n\t\tpx-2 py-1.5\n\t\ttext-xs font-semibold uppercase tracking-wide\n\t\ttext-neutral-500 dark:text-neutral-400\n\t\tselect-none\n\t";
155
- export declare const DROPDOWN_MENU_BACKDROP_CLASSES = "\n\t\tstuic-dropdown-menu-backdrop\n\t\tfixed inset-0 bg-black/25\n\t\tz-40\n\t";
150
+ export declare const DROPDOWN_MENU_BASE_CLASSES = "stuic-dropdown-menu";
151
+ export declare const DROPDOWN_MENU_TRIGGER_CLASSES = "stuic-dropdown-menu-trigger";
152
+ export declare const DROPDOWN_MENU_DROPDOWN_CLASSES = "stuic-dropdown-menu-dropdown";
153
+ export declare const DROPDOWN_MENU_DIVIDER_CLASSES = "stuic-dropdown-menu-divider";
154
+ export declare const DROPDOWN_MENU_HEADER_CLASSES = "stuic-dropdown-menu-header";
155
+ export declare const DROPDOWN_MENU_BACKDROP_CLASSES = "stuic-dropdown-menu-backdrop";
156
156
  import "./index.css";
157
157
  declare const DropdownMenu: import("svelte").Component<Props, {}, "isOpen" | "triggerEl" | "dropdownEl">;
158
158
  type DropdownMenu = ReturnType<typeof DropdownMenu>;
@@ -313,3 +313,135 @@ interface DropdownMenuExpandableItem {
313
313
  - **Reduced Motion**: Respects user's reduced motion preference
314
314
  - **Click Outside**: Automatically closes when clicking outside
315
315
  - **Focus Management**: Returns focus to trigger on close
316
+
317
+ ## CSS Variables
318
+
319
+ Override these tokens globally in `:root` or locally via inline `style`:
320
+
321
+ ### Structure Tokens
322
+
323
+ | Variable | Default | Description |
324
+ |----------|---------|-------------|
325
+ | `--stuic-dropdown-menu-radius` | `--radius-md` | Border radius for trigger and dropdown |
326
+ | `--stuic-dropdown-menu-padding` | `--spacing * 1` | Inner padding of dropdown container |
327
+ | `--stuic-dropdown-menu-gap` | `--spacing * 0.5` | Gap between trigger content |
328
+ | `--stuic-dropdown-menu-min-width` | `12rem` | Minimum width of dropdown |
329
+ | `--stuic-dropdown-menu-transition` | `150ms` | Transition duration |
330
+
331
+ ### Container Colors
332
+
333
+ | Variable | Default | Description |
334
+ |----------|---------|-------------|
335
+ | `--stuic-dropdown-menu-bg` | `--stuic-color-surface` | Dropdown background color |
336
+ | `--stuic-dropdown-menu-text` | `--stuic-color-surface-foreground` | Dropdown text color |
337
+ | `--stuic-dropdown-menu-border` | `--stuic-color-border` | Dropdown border color |
338
+ | `--stuic-dropdown-menu-shadow` | subtle shadow | Dropdown shadow |
339
+
340
+ ### Trigger Button
341
+
342
+ | Variable | Default | Description |
343
+ |----------|---------|-------------|
344
+ | `--stuic-dropdown-menu-trigger-bg` | `--stuic-color-surface` | Trigger background |
345
+ | `--stuic-dropdown-menu-trigger-bg-hover` | `--stuic-color-surface-hover` | Trigger hover background |
346
+ | `--stuic-dropdown-menu-trigger-bg-active` | `--stuic-color-surface-active` | Trigger active background |
347
+ | `--stuic-dropdown-menu-trigger-text` | `--stuic-color-surface-foreground` | Trigger text color |
348
+ | `--stuic-dropdown-menu-trigger-text-hover` | `--stuic-color-surface-foreground-hover` | Trigger hover text color |
349
+ | `--stuic-dropdown-menu-trigger-text-active` | `--stuic-color-surface-foreground-active` | Trigger active text color |
350
+ | `--stuic-dropdown-menu-trigger-border` | `--stuic-color-border` | Trigger border color |
351
+ | `--stuic-dropdown-menu-trigger-border-hover` | `--stuic-color-border-hover` | Trigger hover border |
352
+ | `--stuic-dropdown-menu-trigger-border-active` | `--stuic-color-border-active` | Trigger active border |
353
+ | `--stuic-dropdown-menu-trigger-padding-x` | `--spacing * 3` | Trigger horizontal padding |
354
+ | `--stuic-dropdown-menu-trigger-padding-y` | `--spacing * 2` | Trigger vertical padding |
355
+
356
+ ### Focus Ring
357
+
358
+ | Variable | Default | Description |
359
+ |----------|---------|-------------|
360
+ | `--stuic-dropdown-menu-ring-width` | `3px` | Focus ring width |
361
+ | `--stuic-dropdown-menu-ring-offset` | `0px` | Focus ring offset |
362
+ | `--stuic-dropdown-menu-ring-color` | `--stuic-color-ring` | Focus ring color |
363
+
364
+ ### Divider
365
+
366
+ | Variable | Default | Description |
367
+ |----------|---------|-------------|
368
+ | `--stuic-dropdown-menu-divider-bg` | `--stuic-color-border` | Divider color |
369
+ | `--stuic-dropdown-menu-divider-height` | `1px` | Divider height |
370
+ | `--stuic-dropdown-menu-divider-margin-y` | `--spacing * 1` | Divider vertical margin |
371
+
372
+ ### Header (Section Label)
373
+
374
+ | Variable | Default | Description |
375
+ |----------|---------|-------------|
376
+ | `--stuic-dropdown-menu-header-text` | `--stuic-color-muted-foreground` | Header text color |
377
+ | `--stuic-dropdown-menu-header-font-size` | `--text-xs` | Header font size |
378
+ | `--stuic-dropdown-menu-header-font-weight` | `--font-weight-semibold` | Header font weight |
379
+ | `--stuic-dropdown-menu-header-padding-x` | `--spacing * 2` | Header horizontal padding |
380
+ | `--stuic-dropdown-menu-header-padding-y` | `--spacing * 1.5` | Header vertical padding |
381
+ | `--stuic-dropdown-menu-header-letter-spacing` | `0.05em` | Header letter spacing |
382
+ | `--stuic-dropdown-menu-header-text-transform` | `uppercase` | Header text transform |
383
+
384
+ ### Backdrop (Fallback Mode)
385
+
386
+ | Variable | Default | Description |
387
+ |----------|---------|-------------|
388
+ | `--stuic-dropdown-menu-backdrop-bg` | `rgb(0 0 0 / 0.25)` | Backdrop color |
389
+ | `--stuic-dropdown-menu-backdrop-z-index` | `40` | Backdrop z-index |
390
+
391
+ ### Close Button (Fallback Mode)
392
+
393
+ | Variable | Default | Description |
394
+ |----------|---------|-------------|
395
+ | `--stuic-dropdown-menu-close-bg` | `--stuic-color-foreground` | Close button background |
396
+ | `--stuic-dropdown-menu-close-text` | `--stuic-color-background` | Close button text color |
397
+ | `--stuic-dropdown-menu-close-opacity` | `0.6` | Close button opacity |
398
+ | `--stuic-dropdown-menu-close-opacity-hover` | `1` | Close button hover opacity |
399
+
400
+ ### Expandable Section
401
+
402
+ | Variable | Default | Description |
403
+ |----------|---------|-------------|
404
+ | `--stuic-dropdown-menu-expandable-indent` | `--spacing * 4` | Expandable content indent |
405
+
406
+ ## Customization Examples
407
+
408
+ ### Global Override
409
+
410
+ ```css
411
+ /* Custom theme: pill-shaped dropdowns with more padding */
412
+ :root {
413
+ --stuic-dropdown-menu-radius: 9999px;
414
+ --stuic-dropdown-menu-padding: 1rem;
415
+ --stuic-dropdown-menu-trigger-bg: var(--color-blue-500);
416
+ --stuic-dropdown-menu-trigger-text: white;
417
+ }
418
+ ```
419
+
420
+ ### Local Override
421
+
422
+ ```svelte
423
+ <DropdownMenu
424
+ style="--stuic-dropdown-menu-radius: 0; --stuic-dropdown-menu-shadow: none;"
425
+ items={items}
426
+ >
427
+ Sharp Corners, No Shadow
428
+ </DropdownMenu>
429
+ ```
430
+
431
+ ### Using Class Props
432
+
433
+ Class props override default styling with Tailwind classes:
434
+
435
+ ```svelte
436
+ <!-- Blue-themed dropdown -->
437
+ <DropdownMenu
438
+ items={items}
439
+ classTrigger="bg-blue-500 text-white hover:bg-blue-600 border-blue-600"
440
+ classDropdown="bg-blue-50 dark:bg-blue-950 border-blue-200"
441
+ classItem="hover:bg-blue-100 dark:hover:bg-blue-900"
442
+ >
443
+ Blue Theme
444
+ </DropdownMenu>
445
+ ```
446
+
447
+ Class props always win over CSS variables due to Tailwind's specificity.