@sveltia/ui 0.41.3 → 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 (100) hide show
  1. package/dist/components/alert/alert.svelte +39 -31
  2. package/dist/components/alert/alert.svelte.d.ts +8 -0
  3. package/dist/components/alert/infobar.svelte +58 -46
  4. package/dist/components/alert/infobar.svelte.d.ts +8 -0
  5. package/dist/components/bottom-navigation/bottom-navigation.svelte +21 -15
  6. package/dist/components/button/button-group.svelte +10 -6
  7. package/dist/components/button/button-group.svelte.d.ts +8 -0
  8. package/dist/components/button/button.svelte +274 -175
  9. package/dist/components/button/floating-action-button-wrapper.svelte +23 -18
  10. package/dist/components/button/select-button-group.svelte +60 -41
  11. package/dist/components/button/select-button-group.svelte.d.ts +8 -0
  12. package/dist/components/button/split-button.svelte +25 -18
  13. package/dist/components/calendar/calendar.svelte +103 -80
  14. package/dist/components/checkbox/checkbox-group.svelte +25 -19
  15. package/dist/components/checkbox/checkbox-group.svelte.d.ts +8 -0
  16. package/dist/components/checkbox/checkbox.svelte +93 -65
  17. package/dist/components/checkbox/checkbox.svelte.d.ts +2 -2
  18. package/dist/components/dialog/dialog.svelte +105 -87
  19. package/dist/components/dialog/prompt-dialog.svelte +5 -3
  20. package/dist/components/disclosure/disclosure.svelte +34 -21
  21. package/dist/components/divider/divider.svelte +21 -14
  22. package/dist/components/divider/divider.svelte.d.ts +8 -0
  23. package/dist/components/divider/spacer.svelte +13 -8
  24. package/dist/components/drawer/drawer.svelte +343 -190
  25. package/dist/components/grid/grid-body.svelte +16 -14
  26. package/dist/components/grid/grid-cell.svelte +5 -3
  27. package/dist/components/grid/grid-col-header.svelte +5 -3
  28. package/dist/components/grid/grid-foot.svelte +5 -3
  29. package/dist/components/grid/grid-head.svelte +5 -3
  30. package/dist/components/grid/grid-row-header.svelte +6 -4
  31. package/dist/components/grid/grid-row.svelte +6 -4
  32. package/dist/components/grid/grid.svelte +21 -12
  33. package/dist/components/grid/grid.svelte.d.ts +8 -0
  34. package/dist/components/icon/icon.svelte +7 -5
  35. package/dist/components/listbox/listbox.svelte +81 -61
  36. package/dist/components/listbox/listbox.svelte.d.ts +8 -0
  37. package/dist/components/listbox/option-group.svelte +15 -11
  38. package/dist/components/listbox/option.svelte +54 -39
  39. package/dist/components/menu/menu-item-group.svelte +5 -3
  40. package/dist/components/menu/menu-item.svelte +67 -51
  41. package/dist/components/menu/menu.svelte +24 -17
  42. package/dist/components/menu/menu.svelte.d.ts +8 -0
  43. package/dist/components/progressbar/progressbar.svelte +27 -15
  44. package/dist/components/progressbar/progressbar.svelte.d.ts +8 -0
  45. package/dist/components/radio/radio-group.svelte +43 -31
  46. package/dist/components/radio/radio-group.svelte.d.ts +8 -0
  47. package/dist/components/radio/radio.svelte +81 -63
  48. package/dist/components/resizable-pane/resizable-handle.svelte +63 -48
  49. package/dist/components/resizable-pane/resizable-handle.svelte.d.ts +8 -0
  50. package/dist/components/resizable-pane/resizable-pane-group.svelte +18 -14
  51. package/dist/components/select/combobox.svelte +139 -113
  52. package/dist/components/select/select-tags.svelte +73 -57
  53. package/dist/components/slider/slider.svelte +94 -74
  54. package/dist/components/switch/switch.svelte +118 -81
  55. package/dist/components/switch/switch.svelte.d.ts +8 -0
  56. package/dist/components/table/table-body.svelte +16 -14
  57. package/dist/components/table/table-cell.svelte +5 -3
  58. package/dist/components/table/table-col-header.svelte +5 -3
  59. package/dist/components/table/table-foot.svelte +5 -3
  60. package/dist/components/table/table-head.svelte +5 -3
  61. package/dist/components/table/table-row-header.svelte +6 -4
  62. package/dist/components/table/table-row.svelte +6 -4
  63. package/dist/components/table/table.svelte +21 -13
  64. package/dist/components/table/table.svelte.d.ts +8 -0
  65. package/dist/components/tabs/tab-box.svelte +9 -6
  66. package/dist/components/tabs/tab-list.svelte +94 -73
  67. package/dist/components/tabs/tab-list.svelte.d.ts +8 -0
  68. package/dist/components/tabs/tab-panel.svelte +11 -7
  69. package/dist/components/tabs/tab-panels.svelte +19 -14
  70. package/dist/components/text-editor/code-editor.svelte +10 -7
  71. package/dist/components/text-editor/core.js +3 -0
  72. package/dist/components/text-editor/lexical-root.svelte +221 -160
  73. package/dist/components/text-editor/text-editor.svelte +25 -18
  74. package/dist/components/text-editor/toolbar/insert-link-button.svelte +2 -1
  75. package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte +44 -37
  76. package/dist/components/text-field/number-input.svelte +87 -68
  77. package/dist/components/text-field/password-input.svelte +52 -42
  78. package/dist/components/text-field/search-bar.svelte +64 -53
  79. package/dist/components/text-field/secret-input.svelte +61 -46
  80. package/dist/components/text-field/text-area.svelte +80 -68
  81. package/dist/components/text-field/text-input.svelte +139 -107
  82. package/dist/components/toast/toast.svelte +104 -89
  83. package/dist/components/toolbar/toolbar.svelte +73 -54
  84. package/dist/components/toolbar/toolbar.svelte.d.ts +8 -0
  85. package/dist/components/typography/truncated-text.svelte +9 -7
  86. package/dist/components/util/app-shell.svelte +40 -493
  87. package/dist/components/util/empty-state.svelte +13 -11
  88. package/dist/components/util/group.svelte +8 -3
  89. package/dist/components/util/group.svelte.d.ts +8 -0
  90. package/dist/components/util/modal.svelte +59 -48
  91. package/dist/components/util/popup.svelte +87 -67
  92. package/dist/index.d.ts +1 -0
  93. package/dist/index.js +1 -4
  94. package/dist/locales/en.yaml +50 -3
  95. package/dist/locales/ja.yaml +49 -2
  96. package/dist/services/i18n.d.ts +6 -0
  97. package/dist/services/i18n.js +19 -14
  98. package/dist/typedefs.d.ts +5 -1
  99. package/dist/typedefs.js +2 -1
  100. package/package.json +23 -23
@@ -82,21 +82,28 @@
82
82
  </MenuButton>
83
83
  </div>
84
84
 
85
- <style>.split-button {
86
- flex: none;
87
- display: inline-flex;
88
- margin: var(--sui-focus-ring-width);
89
- }
90
- .split-button :global(button) {
91
- margin: 0;
92
- }
93
- .split-button :global(button.menu-button) {
94
- border-inline-start-width: 0;
95
- border-start-start-radius: 0;
96
- border-end-start-radius: 0;
97
- aspect-ratio: 3/4;
98
- }
99
- .split-button :global(button:not(.menu-button)) {
100
- border-start-end-radius: 0;
101
- border-end-end-radius: 0;
102
- }</style>
85
+ <style lang="scss">
86
+ .split-button {
87
+ flex: none;
88
+ display: inline-flex;
89
+ margin: var(--sui-focus-ring-width);
90
+
91
+ :global {
92
+ button {
93
+ margin: 0;
94
+
95
+ &.menu-button {
96
+ border-inline-start-width: 0;
97
+ border-start-start-radius: 0;
98
+ border-end-start-radius: 0;
99
+ aspect-ratio: 3 / 4;
100
+ }
101
+
102
+ &:not(.menu-button) {
103
+ border-start-end-radius: 0;
104
+ border-end-end-radius: 0;
105
+ }
106
+ }
107
+ }
108
+ }
109
+ </style>
@@ -180,87 +180,110 @@
180
180
  </div>
181
181
  </div>
182
182
 
183
- <style>[role=group] {
184
- display: inline-flex;
185
- flex-direction: column;
186
- gap: 8px;
187
- -webkit-user-select: none;
188
- user-select: none;
189
- cursor: default;
190
- }
191
- [role=group] > * {
192
- flex: none;
193
- }
183
+ <style lang="scss">
184
+ [role='group'] {
185
+ display: inline-flex;
186
+ flex-direction: column;
187
+ gap: 8px;
188
+ -webkit-user-select: none;
189
+ user-select: none;
190
+ cursor: default;
194
191
 
195
- :is(.header, .footer) {
196
- display: flex;
197
- gap: 8px;
198
- height: 24px;
199
- align-items: center;
200
- }
201
- :is(.header, .footer) :global(button.secondary) {
202
- width: 100px;
203
- flex: auto;
204
- }
192
+ & > * {
193
+ flex: none;
194
+ }
195
+ }
205
196
 
206
- .grid {
207
- display: grid !important;
208
- grid-template-columns: repeat(auto-fill, 24px);
209
- gap: 2px;
210
- width: 180px;
211
- }
212
- .grid div {
213
- display: flex;
214
- justify-content: center;
215
- align-items: center;
216
- width: 24px;
217
- height: 24px;
218
- font-size: var(--sui-font-size-small);
219
- }
220
- .grid div.weekday {
221
- color: var(--sui-secondary-foreground-color);
222
- }
223
- .grid div.other-month {
224
- color: var(--sui-tertiary-foreground-color);
225
- }
226
- .grid div :global(.today) :global(button) {
227
- color: var(--sui-highlight-foreground-color);
228
- background-color: var(--sui-primary-accent-color);
229
- }
230
- .grid div :global(button) {
231
- justify-content: center;
232
- margin: 0 !important;
233
- width: 100%;
234
- height: 24px;
235
- border-radius: 50%;
236
- }
237
- .grid div :global(button:hover) {
238
- background-color: var(--sui-hover-background-color);
239
- }
240
- .grid div :global(button:focus) {
241
- border-width: 1px;
242
- border-color: var(--sui-primary-accent-color-light);
243
- }
197
+ :is(.header, .footer) {
198
+ display: flex;
199
+ gap: 8px;
200
+ height: 24px;
201
+ align-items: center;
244
202
 
245
- .footer :global(button) {
246
- font-size: var(--sui-font-size-small);
247
- }
203
+ :global {
204
+ button.secondary {
205
+ width: 100px;
206
+ flex: auto;
207
+ }
208
+ }
209
+ }
248
210
 
249
- .popup-inner {
250
- display: flex;
251
- gap: 8px;
252
- padding: 8px;
253
- }
254
- .popup-inner [role=group] {
255
- gap: 0;
256
- }
257
- .popup-inner [role=group] .header {
258
- justify-content: center;
259
- }
260
- .popup-inner .grid {
261
- grid-template-columns: repeat(auto-fill, 48px);
262
- width: 98px;
263
- }
264
- .popup-inner .grid > div {
265
- width: 48px;
266
- }</style>
211
+ .grid {
212
+ display: grid !important;
213
+ grid-template-columns: repeat(auto-fill, 24px);
214
+ gap: 2px;
215
+ width: 180px;
216
+
217
+ div {
218
+ display: flex;
219
+ justify-content: center;
220
+ align-items: center;
221
+ width: 24px;
222
+ height: 24px;
223
+ font-size: var(--sui-font-size-small);
224
+
225
+ &.weekday {
226
+ color: var(--sui-secondary-foreground-color);
227
+ }
228
+
229
+ &.other-month {
230
+ color: var(--sui-tertiary-foreground-color);
231
+ }
232
+
233
+ :global {
234
+ &.today button {
235
+ color: var(--sui-highlight-foreground-color);
236
+ background-color: var(--sui-primary-accent-color);
237
+ }
238
+
239
+ button {
240
+ justify-content: center;
241
+ margin: 0 !important;
242
+ width: 100%;
243
+ height: 24px;
244
+ border-radius: 50%;
245
+
246
+ &:hover {
247
+ background-color: var(--sui-hover-background-color);
248
+ }
249
+
250
+ &:focus {
251
+ border-width: 1px;
252
+ border-color: var(--sui-primary-accent-color-light);
253
+ }
254
+ }
255
+ }
256
+ }
257
+ }
258
+
259
+ .footer {
260
+ :global {
261
+ button {
262
+ font-size: var(--sui-font-size-small);
263
+ }
264
+ }
265
+ }
266
+
267
+ .popup-inner {
268
+ display: flex;
269
+ gap: 8px;
270
+ padding: 8px;
271
+
272
+ [role='group'] {
273
+ gap: 0;
274
+
275
+ .header {
276
+ justify-content: center;
277
+ }
278
+ }
279
+
280
+ .grid {
281
+ grid-template-columns: repeat(auto-fill, 48px);
282
+ width: calc(48px * 2 + 2px);
283
+
284
+ & > div {
285
+ width: 48px;
286
+ }
287
+ }
288
+ }
289
+ </style>
@@ -15,6 +15,7 @@
15
15
  * @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
16
16
  * attribute.
17
17
  * @property {'horizontal'|'vertical'} [orientation] Orientation of the widget.
18
+ * @property {string} [ariaLabel] The `aria-label` attribute on the wrapper element.
18
19
  * @property {Snippet} [children] Primary slot content.
19
20
  */
20
21
 
@@ -27,6 +28,7 @@
27
28
  hidden = false,
28
29
  disabled = false,
29
30
  orientation = 'horizontal',
31
+ ariaLabel = undefined,
30
32
  children,
31
33
  ...restProps
32
34
  /* eslint-enable prefer-const */
@@ -41,30 +43,34 @@
41
43
  aria-hidden={hidden}
42
44
  aria-disabled={disabled}
43
45
  aria-roledescription="checkbox group"
46
+ aria-label={ariaLabel}
44
47
  >
45
48
  <div role="none" class="inner" inert={disabled}>
46
49
  {@render children?.()}
47
50
  </div>
48
51
  </div>
49
52
 
50
- <style>.checkbox-group {
51
- display: inline-flex;
52
- }
53
- .checkbox-group.horizontal {
54
- gap: 8px;
55
- align-items: center;
56
- flex-wrap: wrap;
57
- }
58
- .checkbox-group.vertical {
59
- gap: 4px;
60
- flex-direction: column;
61
- }
62
- @media (pointer: coarse) {
63
- .checkbox-group.vertical {
64
- gap: 8px;
53
+ <style lang="scss">
54
+ .checkbox-group {
55
+ display: inline-flex;
56
+
57
+ &.horizontal {
58
+ gap: 8px;
59
+ align-items: center;
60
+ flex-wrap: wrap;
61
+ }
62
+
63
+ &.vertical {
64
+ gap: 4px;
65
+ flex-direction: column;
66
+
67
+ @media (pointer: coarse) {
68
+ gap: 8px;
69
+ }
70
+ }
65
71
  }
66
- }
67
72
 
68
- .inner {
69
- display: contents;
70
- }</style>
73
+ .inner {
74
+ display: contents;
75
+ }
76
+ </style>
@@ -23,6 +23,10 @@ declare const CheckboxGroup: import("svelte").Component<{
23
23
  * Orientation of the widget.
24
24
  */
25
25
  orientation?: "horizontal" | "vertical" | undefined;
26
+ /**
27
+ * The `aria-label` attribute on the wrapper element.
28
+ */
29
+ ariaLabel?: string | undefined;
26
30
  /**
27
31
  * Primary slot content.
28
32
  */
@@ -47,6 +51,10 @@ type Props = {
47
51
  * Orientation of the widget.
48
52
  */
49
53
  orientation?: "horizontal" | "vertical" | undefined;
54
+ /**
55
+ * The `aria-label` attribute on the wrapper element.
56
+ */
57
+ ariaLabel?: string | undefined;
50
58
  /**
51
59
  * Primary slot content.
52
60
  */
@@ -24,7 +24,7 @@
24
24
  * @property {boolean | 'mixed'} [checked] Whether to check the widget. An alias of the
25
25
  * `aria-checked` attribute.
26
26
  * @property {string} [label] Text label displayed next to the checkbox.
27
- * @property {string} [aria-label] `aria-label` attribute.
27
+ * @property {string} [ariaLabel] `aria-label` attribute.
28
28
  * @property {Snippet} [checkIcon] Check icon slot content.
29
29
  * @property {string[]} [group] The two-way bound variable to manage the state of a group of
30
30
  * checkboxes. It works in the same way as the [`<input
@@ -46,7 +46,7 @@
46
46
  required = false,
47
47
  invalid = false,
48
48
  label = undefined,
49
- 'aria-label': ariaLabel,
49
+ ariaLabel = undefined,
50
50
  group = $bindable(),
51
51
  onChange,
52
52
  children,
@@ -157,66 +157,94 @@
157
157
  </div>
158
158
  </div>
159
159
 
160
- <style>.checkbox {
161
- display: inline-flex;
162
- align-items: center;
163
- gap: 8px;
164
- margin: var(--sui-focus-ring-width);
165
- color: var(--sui-control-foreground-color);
166
- font-family: var(--sui-control-font-family);
167
- font-size: var(--sui-control-font-size);
168
- line-height: var(--sui-control-line-height);
169
- cursor: pointer;
170
- -webkit-user-select: none;
171
- user-select: none;
172
- }
173
- .checkbox:hover :global(button) {
174
- background-color: var(--sui-hover-background-color);
175
- }
176
- .checkbox:hover :global(button[aria-checked=true]) {
177
- background-color: var(--sui-primary-accent-color-light);
178
- }
179
- .checkbox:active :global(button) {
180
- background-color: var(--sui-active-background-color);
181
- }
182
- .checkbox:active :global(button[aria-checked=true]) {
183
- background-color: var(--sui-primary-accent-color-dark);
184
- }
185
- .checkbox :global(button) {
186
- flex: none;
187
- align-items: center;
188
- justify-content: center;
189
- overflow: hidden;
190
- margin: 0 !important;
191
- border-width: var(--sui-checkbox-border-width, 1.5px);
192
- border-color: var(--sui-checkbox-border-color);
193
- border-radius: var(--sui-checkbox-border-radius);
194
- padding: 0;
195
- width: var(--sui-checkbox-height);
196
- height: var(--sui-checkbox-height);
197
- color: var(--sui-primary-accent-text-color);
198
- background-color: var(--sui-checkbox-background-color);
199
- transition: all 200ms;
200
- }
201
- .checkbox :global(button[aria-checked=true]) {
202
- border-color: var(--sui-checkbox-border-color-checked, var(--sui-primary-accent-color));
203
- color: var(--sui-checkbox-foreground-color-checked, var(--sui-primary-accent-color-inverted));
204
- background-color: var(--sui-checkbox-background-color-checked, var(--sui-primary-accent-color));
205
- }
206
- .checkbox :global(button[aria-invalid=true]) {
207
- border-color: var(--sui-error-border-color);
208
- color: var(--sui-error-foreground-color);
209
- }
210
- .checkbox :global(button[aria-checked=true][aria-invalid=true]) {
211
- background-color: var(--sui-checkbox-background-color);
212
- }
213
- .checkbox :global(button) :global(.icon) {
214
- font-size: calc(var(--sui-checkbox-height) - 2px);
215
- }
216
- .checkbox label {
217
- cursor: inherit;
218
- }
219
-
220
- .inner {
221
- display: contents;
222
- }</style>
160
+ <style lang="scss">
161
+ .checkbox {
162
+ display: inline-flex;
163
+ align-items: center;
164
+ gap: 8px;
165
+ margin: var(--sui-focus-ring-width);
166
+ color: var(--sui-control-foreground-color);
167
+ font-family: var(--sui-control-font-family);
168
+ font-size: var(--sui-control-font-size);
169
+ line-height: var(--sui-control-line-height);
170
+ cursor: pointer;
171
+ -webkit-user-select: none;
172
+ user-select: none;
173
+
174
+ &:hover {
175
+ :global {
176
+ button {
177
+ background-color: var(--sui-hover-background-color);
178
+
179
+ &[aria-checked='true'] {
180
+ background-color: var(--sui-primary-accent-color-light);
181
+ }
182
+ }
183
+ }
184
+ }
185
+
186
+ &:active {
187
+ :global {
188
+ button {
189
+ background-color: var(--sui-active-background-color);
190
+
191
+ &[aria-checked='true'] {
192
+ background-color: var(--sui-primary-accent-color-dark);
193
+ }
194
+ }
195
+ }
196
+ }
197
+
198
+ :global {
199
+ button {
200
+ flex: none;
201
+ align-items: center;
202
+ justify-content: center;
203
+ overflow: hidden;
204
+ margin: 0 !important;
205
+ border-width: var(--sui-checkbox-border-width, 1.5px);
206
+ border-color: var(--sui-checkbox-border-color);
207
+ border-radius: var(--sui-checkbox-border-radius);
208
+ padding: 0;
209
+ width: var(--sui-checkbox-height);
210
+ height: var(--sui-checkbox-height);
211
+ color: var(--sui-primary-accent-text-color);
212
+ background-color: var(--sui-checkbox-background-color);
213
+ transition: all 200ms;
214
+
215
+ &[aria-checked='true'] {
216
+ border-color: var(--sui-checkbox-border-color-checked, var(--sui-primary-accent-color));
217
+ color: var(
218
+ --sui-checkbox-foreground-color-checked,
219
+ var(--sui-primary-accent-color-inverted)
220
+ );
221
+ background-color: var(
222
+ --sui-checkbox-background-color-checked,
223
+ var(--sui-primary-accent-color)
224
+ );
225
+ }
226
+
227
+ &[aria-invalid='true'] {
228
+ border-color: var(--sui-error-border-color);
229
+ color: var(--sui-error-foreground-color);
230
+ }
231
+
232
+ &[aria-checked='true'][aria-invalid='true'] {
233
+ background-color: var(--sui-checkbox-background-color);
234
+ }
235
+
236
+ .icon {
237
+ font-size: calc(var(--sui-checkbox-height) - 2px);
238
+ }
239
+ }
240
+ }
241
+
242
+ label {
243
+ cursor: inherit;
244
+ }
245
+ }
246
+
247
+ .inner {
248
+ display: contents;
249
+ }
250
+ </style>
@@ -36,7 +36,7 @@ declare const Checkbox: import("svelte").Component<ButtonProps & import("../../t
36
36
  /**
37
37
  * `aria-label` attribute.
38
38
  */
39
- "aria-label"?: string | undefined;
39
+ ariaLabel?: string | undefined;
40
40
  /**
41
41
  * Check icon slot content.
42
42
  */
@@ -75,7 +75,7 @@ type Props = {
75
75
  /**
76
76
  * `aria-label` attribute.
77
77
  */
78
- "aria-label"?: string | undefined;
78
+ ariaLabel?: string | undefined;
79
79
  /**
80
80
  * Check icon slot content.
81
81
  */