@sveltia/ui 0.41.5 → 0.42.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 (76) hide show
  1. package/dist/components/alert/alert.svelte +36 -30
  2. package/dist/components/alert/infobar.svelte +55 -45
  3. package/dist/components/bottom-navigation/bottom-navigation.svelte +21 -15
  4. package/dist/components/button/button-group.svelte +7 -5
  5. package/dist/components/button/button.svelte +274 -175
  6. package/dist/components/button/floating-action-button-wrapper.svelte +23 -18
  7. package/dist/components/button/select-button-group.svelte +57 -41
  8. package/dist/components/button/split-button.svelte +25 -18
  9. package/dist/components/calendar/calendar.svelte +103 -80
  10. package/dist/components/checkbox/checkbox-group.svelte +22 -19
  11. package/dist/components/checkbox/checkbox.svelte +91 -63
  12. package/dist/components/dialog/dialog.svelte +105 -87
  13. package/dist/components/dialog/prompt-dialog.svelte +5 -3
  14. package/dist/components/disclosure/disclosure.svelte +34 -21
  15. package/dist/components/divider/divider.svelte +18 -14
  16. package/dist/components/divider/spacer.svelte +13 -8
  17. package/dist/components/drawer/drawer.svelte +343 -190
  18. package/dist/components/grid/grid-body.svelte +16 -14
  19. package/dist/components/grid/grid-cell.svelte +5 -3
  20. package/dist/components/grid/grid-col-header.svelte +5 -3
  21. package/dist/components/grid/grid-foot.svelte +5 -3
  22. package/dist/components/grid/grid-head.svelte +5 -3
  23. package/dist/components/grid/grid-row-header.svelte +6 -4
  24. package/dist/components/grid/grid-row.svelte +6 -4
  25. package/dist/components/grid/grid.svelte +18 -12
  26. package/dist/components/icon/icon.svelte +7 -5
  27. package/dist/components/listbox/listbox.svelte +78 -61
  28. package/dist/components/listbox/option-group.svelte +15 -11
  29. package/dist/components/listbox/option.svelte +54 -39
  30. package/dist/components/menu/menu-item-group.svelte +5 -3
  31. package/dist/components/menu/menu-item.svelte +67 -51
  32. package/dist/components/menu/menu.svelte +21 -17
  33. package/dist/components/progressbar/progressbar.svelte +24 -15
  34. package/dist/components/radio/radio-group.svelte +40 -31
  35. package/dist/components/radio/radio.svelte +81 -63
  36. package/dist/components/resizable-pane/resizable-handle.svelte +60 -48
  37. package/dist/components/resizable-pane/resizable-pane-group.svelte +18 -14
  38. package/dist/components/select/combobox.svelte +135 -112
  39. package/dist/components/select/select-tags.svelte +73 -57
  40. package/dist/components/slider/slider.svelte +94 -74
  41. package/dist/components/switch/switch.svelte +115 -81
  42. package/dist/components/table/table-body.svelte +16 -14
  43. package/dist/components/table/table-cell.svelte +5 -3
  44. package/dist/components/table/table-col-header.svelte +5 -3
  45. package/dist/components/table/table-foot.svelte +5 -3
  46. package/dist/components/table/table-head.svelte +5 -3
  47. package/dist/components/table/table-row-header.svelte +6 -4
  48. package/dist/components/table/table-row.svelte +6 -4
  49. package/dist/components/table/table.svelte +18 -12
  50. package/dist/components/tabs/tab-box.svelte +9 -6
  51. package/dist/components/tabs/tab-list.svelte +91 -73
  52. package/dist/components/tabs/tab-panel.svelte +11 -7
  53. package/dist/components/tabs/tab-panels.svelte +19 -14
  54. package/dist/components/text-editor/code-editor.svelte +10 -7
  55. package/dist/components/text-editor/lexical-root.svelte +221 -160
  56. package/dist/components/text-editor/text-editor.svelte +25 -18
  57. package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte +44 -37
  58. package/dist/components/text-field/number-input.svelte +87 -68
  59. package/dist/components/text-field/password-input.svelte +52 -42
  60. package/dist/components/text-field/search-bar.svelte +64 -53
  61. package/dist/components/text-field/secret-input.svelte +61 -46
  62. package/dist/components/text-field/text-area.svelte +80 -68
  63. package/dist/components/text-field/text-input.svelte +138 -106
  64. package/dist/components/toast/toast.svelte +104 -89
  65. package/dist/components/toolbar/toolbar.svelte +70 -54
  66. package/dist/components/typography/truncated-text.svelte +9 -7
  67. package/dist/components/util/app-shell.svelte +40 -493
  68. package/dist/components/util/empty-state.svelte +13 -11
  69. package/dist/components/util/group.svelte +5 -3
  70. package/dist/components/util/modal.svelte +59 -48
  71. package/dist/components/util/popup.svelte +87 -67
  72. package/dist/index.d.ts +1 -0
  73. package/dist/index.js +1 -4
  74. package/dist/services/i18n.d.ts +6 -0
  75. package/dist/services/i18n.js +19 -14
  76. package/package.json +20 -20
@@ -73,36 +73,45 @@
73
73
  </div>
74
74
  </div>
75
75
 
76
- <style>.radio-group {
77
- display: inline-flex;
78
- }
79
- .radio-group:focus-visible {
80
- outline-width: 0 !important;
81
- }
82
- .radio-group.horizontal {
83
- gap: 8px;
84
- align-items: center;
85
- flex-wrap: wrap;
86
- }
87
- .radio-group.vertical {
88
- gap: 4px;
89
- flex-direction: column;
90
- }
91
- @media (pointer: coarse) {
92
- .radio-group.vertical {
93
- gap: 8px;
76
+ <style lang="scss">
77
+ .radio-group {
78
+ display: inline-flex;
79
+
80
+ &:focus-visible {
81
+ outline-width: 0 !important;
82
+ }
83
+
84
+ &.horizontal {
85
+ gap: 8px;
86
+ align-items: center;
87
+ flex-wrap: wrap;
88
+ }
89
+
90
+ &.vertical {
91
+ gap: 4px;
92
+ flex-direction: column;
93
+
94
+ @media (pointer: coarse) {
95
+ gap: 8px;
96
+ }
97
+ }
98
+
99
+ :global {
100
+ &[aria-invalid='true'] button {
101
+ border-color: var(--sui-error-border-color);
102
+
103
+ &[aria-checked='true'] {
104
+ border-color: var(--sui-error-border-color);
105
+
106
+ &::before {
107
+ background-color: var(--sui-error-border-color);
108
+ }
109
+ }
110
+ }
111
+ }
94
112
  }
95
- }
96
- .radio-group :global([aria-invalid=true]) :global(button) {
97
- border-color: var(--sui-error-border-color);
98
- }
99
- .radio-group :global([aria-invalid=true]) :global(button[aria-checked=true]) {
100
- border-color: var(--sui-error-border-color);
101
- }
102
- .radio-group :global([aria-invalid=true]) :global(button[aria-checked=true]::before) {
103
- background-color: var(--sui-error-border-color);
104
- }
105
113
 
106
- .inner {
107
- display: contents;
108
- }</style>
114
+ .inner {
115
+ display: contents;
116
+ }
117
+ </style>
@@ -127,66 +127,84 @@
127
127
  {/if}
128
128
  </span>
129
129
 
130
- <style>.radio {
131
- display: inline-flex;
132
- align-items: center;
133
- gap: 8px;
134
- margin: var(--sui-focus-ring-width);
135
- color: var(--sui-control-foreground-color);
136
- font-family: var(--sui-control-font-family);
137
- font-size: var(--sui-control-font-size);
138
- line-height: var(--sui-control-line-height);
139
- cursor: pointer;
140
- -webkit-user-select: none;
141
- user-select: none;
142
- }
143
- .radio :global(:hover) :global(button) {
144
- background-color: var(--sui-hover-background-color);
145
- }
146
- .radio :global(:hover) :global(button[aria-checked=true]) {
147
- border-color: var(--sui-primary-accent-color-light);
148
- color: var(--sui-primary-accent-color-text);
149
- }
150
- .radio :global(:hover) :global(button[aria-checked=true]::before) {
151
- background-color: var(--sui-primary-accent-color-light);
152
- }
153
- .radio :global(:active) :global(button) {
154
- background-color: var(--sui-active-background-color);
155
- }
156
- .radio :global(:active) :global(button[aria-checked=true]) {
157
- border-color: var(--sui-primary-accent-color-dark);
158
- color: var(--sui-primary-accent-color-dark);
159
- }
160
- .radio :global(button) {
161
- flex: none;
162
- justify-content: center;
163
- overflow: hidden;
164
- margin: 0 !important;
165
- border-width: 1.5px;
166
- border-color: var(--sui-checkbox-border-color);
167
- border-radius: var(--sui-checkbox-height);
168
- padding: 0;
169
- width: var(--sui-checkbox-height);
170
- height: var(--sui-checkbox-height);
171
- background-color: var(--sui-checkbox-background-color);
172
- transition: all 200ms;
173
- }
174
- .radio :global(button::before) {
175
- content: "";
176
- border-radius: var(--sui-checkbox-height);
177
- width: calc(var(--sui-checkbox-height) - 7px);
178
- height: calc(var(--sui-checkbox-height) - 7px);
179
- background-color: var(--sui-primary-accent-color);
180
- opacity: 0;
181
- transition: all 200ms;
182
- will-change: opacity;
183
- }
184
- .radio :global(button[aria-checked=true]) {
185
- border-color: var(--sui-primary-accent-color);
186
- }
187
- .radio :global(button[aria-checked=true]::before) {
188
- opacity: 1;
189
- }
190
- .radio label {
191
- cursor: inherit;
192
- }</style>
130
+ <style lang="scss">
131
+ .radio {
132
+ display: inline-flex;
133
+ align-items: center;
134
+ gap: 8px;
135
+ margin: var(--sui-focus-ring-width);
136
+ color: var(--sui-control-foreground-color);
137
+ font-family: var(--sui-control-font-family);
138
+ font-size: var(--sui-control-font-size);
139
+ line-height: var(--sui-control-line-height);
140
+ cursor: pointer;
141
+ -webkit-user-select: none;
142
+ user-select: none;
143
+
144
+ :global {
145
+ &:hover {
146
+ button {
147
+ background-color: var(--sui-hover-background-color);
148
+
149
+ &[aria-checked='true'] {
150
+ border-color: var(--sui-primary-accent-color-light);
151
+ color: var(--sui-primary-accent-color-text);
152
+
153
+ &::before {
154
+ background-color: var(--sui-primary-accent-color-light);
155
+ }
156
+ }
157
+ }
158
+ }
159
+
160
+ &:active {
161
+ button {
162
+ background-color: var(--sui-active-background-color);
163
+
164
+ &[aria-checked='true'] {
165
+ border-color: var(--sui-primary-accent-color-dark);
166
+ color: var(--sui-primary-accent-color-dark);
167
+ }
168
+ }
169
+ }
170
+
171
+ button {
172
+ flex: none;
173
+ justify-content: center;
174
+ overflow: hidden;
175
+ margin: 0 !important;
176
+ border-width: 1.5px;
177
+ border-color: var(--sui-checkbox-border-color);
178
+ border-radius: var(--sui-checkbox-height);
179
+ padding: 0;
180
+ width: var(--sui-checkbox-height);
181
+ height: var(--sui-checkbox-height);
182
+ background-color: var(--sui-checkbox-background-color);
183
+ transition: all 200ms;
184
+
185
+ &::before {
186
+ content: '';
187
+ border-radius: var(--sui-checkbox-height);
188
+ width: calc(var(--sui-checkbox-height) - 7px);
189
+ height: calc(var(--sui-checkbox-height) - 7px);
190
+ background-color: var(--sui-primary-accent-color);
191
+ opacity: 0;
192
+ transition: all 200ms;
193
+ will-change: opacity;
194
+ }
195
+
196
+ &[aria-checked='true'] {
197
+ border-color: var(--sui-primary-accent-color);
198
+
199
+ &::before {
200
+ opacity: 1;
201
+ }
202
+ }
203
+ }
204
+ }
205
+
206
+ label {
207
+ cursor: inherit;
208
+ }
209
+ }
210
+ </style>
@@ -276,51 +276,63 @@
276
276
  {/if}
277
277
  </div>
278
278
 
279
- <style>.resizable-handle {
280
- position: relative;
281
- flex: 0 0 auto;
282
- display: flex;
283
- align-items: center;
284
- justify-content: center;
285
- touch-action: none;
286
- outline-offset: 0;
287
- background-color: transparent;
288
- transition: background-color 200ms;
289
- }
290
- .resizable-handle:focus-visible, .resizable-handle:hover, .resizable-handle.dragging {
291
- outline: none;
292
- z-index: 1;
293
- background-color: var(--sui-primary-accent-color-translucent);
294
- }
295
- .resizable-handle:focus-visible .handle-bar, .resizable-handle:hover .handle-bar, .resizable-handle.dragging .handle-bar {
296
- background-color: var(--sui-primary-accent-color);
297
- }
298
- .resizable-handle.disabled {
299
- pointer-events: none;
300
- opacity: 0.4;
301
- }
302
- .resizable-handle.horizontal {
303
- width: var(--sui-resizable-handle-size, 4px);
304
- height: 100%;
305
- cursor: col-resize;
306
- }
307
- .resizable-handle.horizontal .handle-bar {
308
- width: 2px;
309
- height: 40%;
310
- min-height: 20px;
311
- }
312
- .resizable-handle.vertical {
313
- width: 100%;
314
- height: var(--sui-resizable-handle-size, 4px);
315
- cursor: row-resize;
316
- }
317
- .resizable-handle.vertical .handle-bar {
318
- height: 2px;
319
- width: 40%;
320
- min-width: 20px;
321
- }
322
- .resizable-handle .handle-bar {
323
- border-radius: 1px;
324
- background-color: hsl(var(--sui-border-color-1-hsl));
325
- transition: background-color 200ms;
326
- }</style>
279
+ <style lang="scss">
280
+ .resizable-handle {
281
+ position: relative;
282
+ flex: 0 0 auto;
283
+ display: flex;
284
+ align-items: center;
285
+ justify-content: center;
286
+ touch-action: none;
287
+ outline-offset: 0;
288
+ background-color: transparent;
289
+ transition: background-color 200ms;
290
+
291
+ &:focus-visible,
292
+ &:hover,
293
+ &.dragging {
294
+ outline: none;
295
+ z-index: 1;
296
+ background-color: var(--sui-primary-accent-color-translucent);
297
+
298
+ .handle-bar {
299
+ background-color: var(--sui-primary-accent-color);
300
+ }
301
+ }
302
+
303
+ &.disabled {
304
+ pointer-events: none;
305
+ opacity: 0.4;
306
+ }
307
+
308
+ &.horizontal {
309
+ width: var(--sui-resizable-handle-size, 4px);
310
+ height: 100%;
311
+ cursor: col-resize;
312
+
313
+ .handle-bar {
314
+ width: 2px;
315
+ height: 40%;
316
+ min-height: 20px;
317
+ }
318
+ }
319
+
320
+ &.vertical {
321
+ width: 100%;
322
+ height: var(--sui-resizable-handle-size, 4px);
323
+ cursor: row-resize;
324
+
325
+ .handle-bar {
326
+ height: 2px;
327
+ width: 40%;
328
+ min-width: 20px;
329
+ }
330
+ }
331
+
332
+ .handle-bar {
333
+ border-radius: 1px;
334
+ background-color: hsl(var(--sui-border-color-1-hsl));
335
+ transition: background-color 200ms;
336
+ }
337
+ }
338
+ </style>
@@ -271,17 +271,21 @@
271
271
  {@render children?.()}
272
272
  </div>
273
273
 
274
- <style>.resizable-pane-group {
275
- display: flex;
276
- overflow: hidden;
277
- }
278
- .resizable-pane-group.horizontal {
279
- flex-direction: row;
280
- width: 100%;
281
- height: 100%;
282
- }
283
- .resizable-pane-group.vertical {
284
- flex-direction: column;
285
- width: 100%;
286
- height: 100%;
287
- }</style>
274
+ <style lang="scss">
275
+ .resizable-pane-group {
276
+ display: flex;
277
+ overflow: hidden;
278
+
279
+ &.horizontal {
280
+ flex-direction: row;
281
+ width: 100%;
282
+ height: 100%;
283
+ }
284
+
285
+ &.vertical {
286
+ flex-direction: column;
287
+ width: 100%;
288
+ height: 100%;
289
+ }
290
+ }
291
+ </style>
@@ -245,115 +245,138 @@
245
245
  </div>
246
246
  </Popup>
247
247
 
248
- <style>.combobox {
249
- margin: var(--sui-focus-ring-width);
250
- display: flex;
251
- align-items: center;
252
- position: relative;
253
- min-width: var(--sui-combobox-min-width, calc(var(--sui-option-height) * 5));
254
- }
255
- .combobox div[role=combobox] {
256
- display: flex;
257
- align-items: center;
258
- border-width: 1px;
259
- border-color: var(--sui-control-border-color);
260
- border-radius: var(--sui-textbox-border-radius);
261
- padding-block: 0;
262
- padding-inline-start: calc(var(--sui-textbox-height) / 4);
263
- padding-inline-end: var(--sui-textbox-height);
264
- width: 100%;
265
- height: var(--sui-textbox-height);
266
- color: var(--sui-control-foreground-color);
267
- background-color: var(--sui-disabled-background-color);
268
- font-family: var(--sui-control-font-family);
269
- font-size: var(--sui-control-font-size);
270
- line-height: var(--sui-control-line-height);
271
- -webkit-user-select: none;
272
- user-select: none;
273
- cursor: pointer;
274
- transition: all 200ms;
275
- }
276
- .combobox div[role=combobox]:not(.selected) {
277
- font-style: italic;
278
- }
279
- .combobox div[role=combobox]:is(:hover, :focus) {
280
- background-color: var(--sui-hover-background-color);
281
- }
282
- .combobox div[role=combobox][aria-invalid=true] {
283
- border-color: var(--sui-error-border-color);
284
- }
285
- .combobox div[role=combobox] .label {
286
- width: 100%;
287
- }
288
- .combobox :global(.icon) {
289
- font-size: var(--sui-font-size-xx-large);
290
- opacity: 0.5;
291
- }
292
- .combobox > :global(.icon) {
293
- position: absolute;
294
- inset-block-start: 8px;
295
- inset-inline-start: 8px;
296
- z-index: 1;
297
- }
298
- .combobox > :global(button) {
299
- position: absolute;
300
- inset-block-start: 0;
301
- inset-inline-end: 0;
302
- z-index: 1;
303
- margin: 0 !important;
304
- border-start-start-radius: 0;
305
- border-end-start-radius: 0;
306
- background-color: transparent !important;
307
- }
308
- .combobox > :global(button[tabindex="-1"]) {
309
- pointer-events: none;
310
- }
311
- .combobox :global(:not(.editable)) > :global(button) {
312
- background-color: transparent !important;
313
- }
314
- .combobox :global(.text-input) {
315
- margin: 0 !important;
316
- width: 100% !important;
317
- }
318
- .combobox :global(input) {
319
- padding-block: 0;
320
- padding-inline: 8px 32px;
321
- width: 0;
322
- }
323
- .combobox + :global([role=listbox]) {
324
- position: fixed;
325
- z-index: 100;
326
- border-radius: var(--sui-control-medium-border-radius);
327
- box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
328
- overflow: auto;
329
- background-color: var(--sui-secondary-background-color);
330
- -webkit-backdrop-filter: blur(32px);
331
- backdrop-filter: blur(32px);
332
- /* Add .1s delay before the position can be determined */
333
- transition: opacity 100ms 100ms;
334
- }
335
- .combobox + :global([role=listbox]:not(.open)) {
336
- opacity: 0;
337
- pointer-events: none;
338
- }
339
-
340
- .combobox-inner {
341
- display: flex;
342
- flex-direction: column;
343
- overflow: hidden;
344
- }
345
- .combobox-inner :global(.sui.search-bar) {
346
- flex: none;
347
- }
348
- .combobox-inner :global(.sui.listbox) {
349
- flex: auto;
350
- overflow-y: auto;
351
- }
352
- .combobox-inner .no-options {
353
- flex: none;
354
- display: flex;
355
- align-items: center;
356
- padding: var(--sui-option-padding);
357
- height: var(--sui-option-height);
358
- color: var(--sui-tertiary-foreground-color);
359
- }</style>
248
+ <style lang="scss">
249
+ .combobox {
250
+ margin: var(--sui-focus-ring-width);
251
+ display: flex;
252
+ align-items: center;
253
+ position: relative;
254
+ min-width: var(--sui-combobox-min-width, calc(var(--sui-option-height) * 5));
255
+
256
+ div[role='combobox'] {
257
+ display: flex;
258
+ align-items: center;
259
+ border-width: 1px;
260
+ border-color: var(--sui-control-border-color);
261
+ border-radius: var(--sui-textbox-border-radius);
262
+ padding-block: 0;
263
+ padding-inline-start: calc(var(--sui-textbox-height) / 4);
264
+ padding-inline-end: var(--sui-textbox-height);
265
+ width: 100%;
266
+ height: var(--sui-textbox-height);
267
+ color: var(--sui-control-foreground-color);
268
+ background-color: var(--sui-disabled-background-color);
269
+ font-family: var(--sui-control-font-family);
270
+ font-size: var(--sui-control-font-size);
271
+ line-height: var(--sui-control-line-height);
272
+ -webkit-user-select: none;
273
+ user-select: none;
274
+ cursor: pointer;
275
+ transition: all 200ms;
276
+
277
+ &:not(.selected) {
278
+ font-style: italic;
279
+ }
280
+
281
+ &:is(:hover, :focus) {
282
+ background-color: var(--sui-hover-background-color);
283
+ }
284
+
285
+ &[aria-invalid='true'] {
286
+ border-color: var(--sui-error-border-color);
287
+ }
288
+
289
+ .label {
290
+ width: 100%;
291
+ }
292
+ }
293
+
294
+ :global {
295
+ .icon {
296
+ font-size: var(--sui-font-size-xx-large);
297
+ opacity: 0.5;
298
+ }
299
+
300
+ & > .icon {
301
+ position: absolute;
302
+ inset-block-start: 8px;
303
+ inset-inline-start: 8px;
304
+ z-index: 1;
305
+ }
306
+
307
+ & > button {
308
+ position: absolute;
309
+ inset-block-start: 0;
310
+ inset-inline-end: 0;
311
+ z-index: 1;
312
+ margin: 0 !important;
313
+ border-start-start-radius: 0;
314
+ border-end-start-radius: 0;
315
+ background-color: transparent !important;
316
+
317
+ &[tabindex='-1'] {
318
+ pointer-events: none;
319
+ }
320
+ }
321
+
322
+ &:not(.editable) > button {
323
+ background-color: transparent !important;
324
+ }
325
+
326
+ .text-input {
327
+ margin: 0 !important;
328
+ width: 100% !important;
329
+ }
330
+
331
+ input {
332
+ padding-block: 0;
333
+ padding-inline: 8px 32px;
334
+ width: 0; // = auto
335
+ }
336
+
337
+ & + [role='listbox'] {
338
+ position: fixed;
339
+ z-index: 100;
340
+ border-radius: var(--sui-control-medium-border-radius);
341
+ box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
342
+ overflow: auto;
343
+ background-color: var(--sui-secondary-background-color);
344
+ -webkit-backdrop-filter: blur(32px);
345
+ backdrop-filter: blur(32px);
346
+ /* Add .1s delay before the position can be determined */
347
+ transition: opacity 100ms 100ms;
348
+
349
+ &:not(.open) {
350
+ opacity: 0;
351
+ pointer-events: none;
352
+ }
353
+ }
354
+ }
355
+ }
356
+
357
+ .combobox-inner {
358
+ display: flex;
359
+ flex-direction: column;
360
+ overflow: hidden;
361
+
362
+ :global {
363
+ .sui.search-bar {
364
+ flex: none;
365
+ }
366
+
367
+ .sui.listbox {
368
+ flex: auto;
369
+ overflow-y: auto;
370
+ }
371
+ }
372
+
373
+ .no-options {
374
+ flex: none;
375
+ display: flex;
376
+ align-items: center;
377
+ padding: var(--sui-option-padding);
378
+ height: var(--sui-option-height);
379
+ color: var(--sui-tertiary-foreground-color);
380
+ }
381
+ }
382
+ </style>