@sveltia/ui 0.86.0 → 0.87.1

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 (27) hide show
  1. package/dist/components/checkbox/checkbox.svelte.d.ts +1 -1
  2. package/dist/components/dialog/dialog.svelte +10 -0
  3. package/dist/components/dialog/dialog.svelte.d.ts +1 -1
  4. package/dist/components/dialog/prompt-dialog.svelte.d.ts +1 -1
  5. package/dist/components/listbox/listbox.svelte +0 -5
  6. package/dist/components/listbox/option.svelte.d.ts +1 -1
  7. package/dist/components/menu/menu-item.svelte +5 -1
  8. package/dist/components/menu/menu.svelte +0 -5
  9. package/dist/components/table/table-part.svelte.d.ts +2 -2
  10. package/dist/components/text-editor/shiki/version.d.ts +1 -1
  11. package/dist/components/text-editor/shiki/version.js +1 -1
  12. package/dist/components/text-editor/toolbar/insert-table-button.svelte +1 -0
  13. package/dist/components/text-field/color-input.svelte.d.ts +1 -1
  14. package/dist/components/text-field/date-time-input.svelte.d.ts +3 -3
  15. package/dist/components/text-field/masked-input.svelte +5 -0
  16. package/dist/components/text-field/number-input.svelte +31 -22
  17. package/dist/components/text-field/number-input.svelte.d.ts +1 -1
  18. package/dist/components/text-field/search-bar.svelte +4 -0
  19. package/dist/components/text-field/text-area.svelte.d.ts +1 -1
  20. package/dist/components/text-field/text-input.svelte.d.ts +1 -1
  21. package/dist/components/util/app-shell.svelte +2 -0
  22. package/dist/components/util/popup.svelte +7 -0
  23. package/dist/services/popup.svelte.js +6 -2
  24. package/dist/styles/variables.scss +3 -0
  25. package/dist/typedefs.d.ts +2 -2
  26. package/dist/typedefs.js +1 -1
  27. package/package.json +10 -10
@@ -47,7 +47,7 @@ declare const Checkbox: import("svelte").Component<ButtonProps & import("../../t
47
47
  * bind:group>`](https://svelte.dev/docs/svelte/bind#input-bind:group) of Svelte.
48
48
  */
49
49
  group?: string[] | undefined;
50
- } & Record<string, any>, {}, "group" | "checked">;
50
+ } & Record<string, any>, {}, "checked" | "group">;
51
51
  type Props = {
52
52
  /**
53
53
  * The `class` attribute on the wrapper element.
@@ -212,6 +212,16 @@
212
212
  transition-duration: 300ms;
213
213
  transform: scale(90%);
214
214
  }
215
+ .content.x-small {
216
+ width: var(--sui-dialog-x-small-content-width, var(--sui-dialog-content-width, 300px));
217
+ max-height: var(--sui-dialog-x-small-content-max-height, var(--sui-dialog-content-max-height, 300px));
218
+ --sui-textbox-singleline-min-width: 0;
219
+ }
220
+ @media (max-height: 300px) {
221
+ .content.x-small {
222
+ max-height: calc(100dvh - 32px);
223
+ }
224
+ }
215
225
  .content.small {
216
226
  width: var(--sui-dialog-small-content-width, var(--sui-dialog-content-width, 400px));
217
227
  max-height: var(--sui-dialog-small-content-max-height, var(--sui-dialog-content-max-height, 400px));
@@ -8,6 +8,6 @@ type Dialog = {
8
8
  * @see https://w3c.github.io/aria/#dialog
9
9
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
10
10
  */
11
- declare const Dialog: import("svelte").Component<ModalProps & DialogProps & Record<string, any>, {}, "value" | "open">;
11
+ declare const Dialog: import("svelte").Component<ModalProps & DialogProps & Record<string, any>, {}, "open" | "value">;
12
12
  import type { ModalProps } from '../../typedefs.js';
13
13
  import type { DialogProps } from '../../typedefs.js';
@@ -28,7 +28,7 @@ declare const PromptDialog: import("svelte").Component<ModalProps & DialogProps
28
28
  * Input slot content.
29
29
  */
30
30
  input?: Snippet<[]> | undefined;
31
- } & Record<string, any>, {}, "value" | "open">;
31
+ } & Record<string, any>, {}, "open" | "value">;
32
32
  type Props = {
33
33
  /**
34
34
  * Value entered on the textbox.
@@ -106,11 +106,6 @@
106
106
  font-size: var(--sui-control-font-size);
107
107
  line-height: var(--sui-control-line-height);
108
108
  }
109
- @media (pointer: coarse) {
110
- [role=listbox] {
111
- gap: 8px 0;
112
- }
113
- }
114
109
  [role=listbox] :global([role=separator]) {
115
110
  margin: 4px 0;
116
111
  background-color: var(--sui-control-border-color);
@@ -34,7 +34,7 @@ declare const Option: import("svelte").Component<ButtonProps & import("../../typ
34
34
  * Check icon slot content.
35
35
  */
36
36
  checkIcon?: Snippet<[]> | undefined;
37
- } & Record<string, any>, {}, "hidden" | "selected">;
37
+ } & Record<string, any>, {}, "selected" | "hidden">;
38
38
  type Props = {
39
39
  /**
40
40
  * The `class` attribute on the wrapper element.
@@ -123,7 +123,11 @@
123
123
  if (hasItems) {
124
124
  event.preventDefault();
125
125
  event.stopPropagation();
126
- isPopupOpen = !isPopupOpen;
126
+ window.clearTimeout(hoverTimer);
127
+ // A pointer click opens rather than toggles, as the hover may have opened the submenu
128
+ // already; on a touch screen, the emulated `mouseenter` comes right before the `click`. A
129
+ // scripted click still toggles it, which is how the keyboard navigation closes it.
130
+ isPopupOpen = event.detail ? true : !isPopupOpen;
127
131
  }
128
132
 
129
133
  onclick?.(event);
@@ -65,11 +65,6 @@
65
65
  border-radius: var(--sui-menu-border-radius, 4px);
66
66
  padding: var(--sui-menu-padding, 4px);
67
67
  }
68
- @media (pointer: coarse) {
69
- .menu {
70
- gap: 8px 0;
71
- }
72
- }
73
68
  .menu :global([role=separator]) {
74
69
  margin: var(--sui-menu-divider-margin, 4px);
75
70
  width: auto;
@@ -16,7 +16,7 @@ declare const TablePart: import("svelte").Component<{
16
16
  * The component class name, which also
17
17
  * determines the `display` style.
18
18
  */
19
- kind: `table-${"head" | "row" | "foot" | "col-header" | "row-header" | "cell"}` | `grid-${"head" | "row" | "foot" | "col-header" | "row-header" | "cell"}`;
19
+ kind: `table-${"head" | "foot" | "row" | "col-header" | "row-header" | "cell"}` | `grid-${"head" | "foot" | "row" | "col-header" | "row-header" | "cell"}`;
20
20
  /**
21
21
  * The `class` attribute on the wrapper element.
22
22
  */
@@ -35,7 +35,7 @@ type Props = {
35
35
  * The component class name, which also
36
36
  * determines the `display` style.
37
37
  */
38
- kind: `table-${"head" | "row" | "foot" | "col-header" | "row-header" | "cell"}` | `grid-${"head" | "row" | "foot" | "col-header" | "row-header" | "cell"}`;
38
+ kind: `table-${"head" | "foot" | "row" | "col-header" | "row-header" | "cell"}` | `grid-${"head" | "foot" | "row" | "col-header" | "row-header" | "cell"}`;
39
39
  /**
40
40
  * The `class` attribute on the wrapper element.
41
41
  */
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Version of this package, used to resolve the prebuilt Shiki engine chunk from a CDN.
3
3
  */
4
- export const UI_VERSION: "0.86.0";
4
+ export const UI_VERSION: "0.87.1";
@@ -3,4 +3,4 @@
3
3
  /**
4
4
  * Version of this package, used to resolve the prebuilt Shiki engine chunk from a CDN.
5
5
  */
6
- export const UI_VERSION = '0.86.0';
6
+ export const UI_VERSION = '0.87.1';
@@ -164,6 +164,7 @@
164
164
  </Button>
165
165
 
166
166
  <Dialog
167
+ size="x-small"
167
168
  title={_('_sui.text_editor.insert_table')}
168
169
  bind:open={openDialog}
169
170
  okDisabled={!isValid}
@@ -50,7 +50,7 @@ declare const ColorInput: import("svelte").Component<import("../../typedefs.js")
50
50
  * `aria-label` attribute.
51
51
  */
52
52
  ariaLabel?: string | undefined;
53
- } & Record<string, any>, {}, "value" | "element">;
53
+ } & Record<string, any>, {}, "element" | "value">;
54
54
  type Props = {
55
55
  /**
56
56
  * Input value, a lowercase hex color in the `#rrggbb` format. The
@@ -27,7 +27,7 @@ declare const DateTimeInput: import("svelte").Component<import("../../typedefs.j
27
27
  /**
28
28
  * The `type` attribute on the `<input>`.
29
29
  */
30
- type?: "time" | "date" | "datetime-local" | undefined;
30
+ type?: "date" | "datetime-local" | "time" | undefined;
31
31
  /**
32
32
  * Minimum allowed value, in the same format as `value`.
33
33
  */
@@ -69,7 +69,7 @@ declare const DateTimeInput: import("svelte").Component<import("../../typedefs.j
69
69
  * `aria-label` attribute.
70
70
  */
71
71
  ariaLabel?: string | undefined;
72
- } & Record<string, any>, {}, "value" | "element">;
72
+ } & Record<string, any>, {}, "element" | "value">;
73
73
  type Props = {
74
74
  /**
75
75
  * Input value, in the native input’s format: `YYYY-MM-DD` for `date`,
@@ -84,7 +84,7 @@ type Props = {
84
84
  /**
85
85
  * The `type` attribute on the `<input>`.
86
86
  */
87
- type?: "time" | "date" | "datetime-local" | undefined;
87
+ type?: "date" | "datetime-local" | "time" | undefined;
88
88
  /**
89
89
  * Minimum allowed value, in the same format as `value`.
90
90
  */
@@ -176,4 +176,9 @@
176
176
  }
177
177
  .secret-input :global(input) {
178
178
  -webkit-text-security: disc;
179
+ }
180
+
181
+ .password-input:dir(rtl),
182
+ .secret-input:dir(rtl) {
183
+ --sui-textbox-text-align: right;
179
184
  }</style>
@@ -170,6 +170,7 @@
170
170
  class:flex
171
171
  class:disabled
172
172
  class:readonly
173
+ class:stepper={stepEnabled}
173
174
  {hidden}
174
175
  >
175
176
  {#if stepEnabled}
@@ -266,9 +267,13 @@
266
267
  <style>.number-input {
267
268
  display: inline-flex;
268
269
  align-items: center;
270
+ position: relative;
269
271
  margin: var(--sui-focus-ring-width);
270
272
  min-width: var(--sui-textbox-singleline-min-width);
271
273
  }
274
+ .number-input.stepper {
275
+ --sui-number-input-end-padding: 24px;
276
+ }
272
277
  .number-input.flex:not([hidden]) {
273
278
  display: inline-flex;
274
279
  width: -moz-available;
@@ -282,13 +287,8 @@
282
287
  .number-input:not(.disabled) :global(button[aria-disabled='true']) :global(*) {
283
288
  filter: grayscale(1) opacity(var(--sui-disabled-opacity, 0.35));
284
289
  }
285
- .number-input :global(.buttons) + :global(*) :global(input) {
286
- border-start-start-radius: 0;
287
- border-end-start-radius: 0;
288
- }
289
- .number-input :global(:not(:last-child)) :global(input) {
290
- border-start-end-radius: 0;
291
- border-end-end-radius: 0;
290
+ .number-input :global(input) {
291
+ padding-right: var(--sui-number-input-end-padding, 8px);
292
292
  }
293
293
  .number-input :global(.text-input) {
294
294
  flex: auto;
@@ -299,26 +299,35 @@
299
299
 
300
300
  .buttons {
301
301
  display: flex;
302
- flex-direction: row;
303
- width: 48px;
304
- height: var(--sui-textbox-height);
302
+ flex-direction: column;
303
+ position: absolute;
304
+ inset-block: 2px;
305
+ right: 2px;
306
+ z-index: 3;
307
+ width: 18px;
305
308
  }
306
309
  .buttons :global(button) {
307
310
  flex: none;
308
311
  margin: 0 !important;
309
- border-width: 1px;
310
- border-color: var(--sui-textbox-border-color);
311
- width: 50%;
312
- height: 100%;
313
- border-inline-end-width: 0;
312
+ border-width: 0;
313
+ border-radius: 3px;
314
+ padding: 0;
315
+ width: 100%;
316
+ height: 50%;
317
+ min-height: 0;
318
+ }
319
+ .buttons :global(button) :global(.icon) {
320
+ font-size: 16px;
314
321
  }
315
- .buttons :global(button:first-of-type) {
316
- border-start-end-radius: 0;
317
- border-end-end-radius: 0;
322
+
323
+ .number-input:dir(rtl) {
324
+ --sui-textbox-text-align: right;
318
325
  }
319
- .buttons :global(button:last-of-type) {
320
- border-radius: 0;
326
+ .number-input:dir(rtl) .buttons {
327
+ right: auto;
328
+ left: 2px;
321
329
  }
322
- .buttons :global(button) :global(.icon) {
323
- font-size: 20px;
330
+ .number-input:dir(rtl) :global(input) {
331
+ padding-right: 8px;
332
+ padding-left: var(--sui-number-input-end-padding, 8px);
324
333
  }</style>
@@ -48,7 +48,7 @@ declare const NumberInput: import("svelte").Component<TextInputProps & import(".
48
48
  * Decrease icon slot content.
49
49
  */
50
50
  decreaseIcon?: Snippet<[]> | undefined;
51
- } & Record<string, any>, {}, "invalid" | "value">;
51
+ } & Record<string, any>, {}, "value" | "invalid">;
52
52
  type Props = {
53
53
  /**
54
54
  * Input value.
@@ -168,4 +168,8 @@
168
168
  z-index: 1;
169
169
  padding: 0 var(--sui-button-medium-height) !important;
170
170
  width: 100%;
171
+ }
172
+
173
+ .search-bar:dir(rtl) {
174
+ --sui-textbox-text-align: right;
171
175
  }</style>
@@ -80,7 +80,7 @@ declare const TextArea: import("svelte").Component<import("../../typedefs.js").K
80
80
  * Primary slot content.
81
81
  */
82
82
  children?: Snippet<[]> | undefined;
83
- } & Record<string, any>, {}, "value" | "element">;
83
+ } & Record<string, any>, {}, "element" | "value">;
84
84
  type Props = {
85
85
  /**
86
86
  * Input value.
@@ -18,7 +18,7 @@ declare const TextInput: import("svelte").Component<TextInputProps & import("../
18
18
  * types a shortcode, like `:smi`.
19
19
  */
20
20
  useEmojiAutocomplete?: boolean | undefined;
21
- } & Record<string, any>, {}, "value" | "element">;
21
+ } & Record<string, any>, {}, "element" | "value">;
22
22
  type Props = {
23
23
  /**
24
24
  * Input value.
@@ -198,6 +198,7 @@
198
198
  --sui-heading-font-weight: var(--sui-font-weight-bold);
199
199
  --sui-heading-line-height: var(--sui-line-height-default);
200
200
  --sui-paragraph-margin: 1.75em;
201
+ --sui-menuitem-font-size: 14px;
201
202
  --sui-control-small-border-width: 1px;
202
203
  --sui-control-small-border-radius: calc(var(--sui-control-small-height) / 8);
203
204
  --sui-control-small-padding: 0 calc((var(--sui-control-small-height) / 5));
@@ -275,6 +276,7 @@
275
276
  @media (pointer: coarse) {
276
277
  :global(:root),
277
278
  :global(:host) {
279
+ --sui-menuitem-height: 40px;
278
280
  --sui-control-small-height: 32px;
279
281
  --sui-control-medium-height: 40px;
280
282
  --sui-control-large-height: 48px;
@@ -189,6 +189,7 @@
189
189
  role="none"
190
190
  class="content {className} {contentType}"
191
191
  class:touch
192
+ class:nested={!!parentDialogElement}
192
193
  style:inset={popupInstance?.style.inset}
193
194
  style:z-index={popupInstance?.style.zIndex}
194
195
  style:min-width={popupInstance?.style.minWidth}
@@ -338,4 +339,10 @@
338
339
  transition-duration: 300ms;
339
340
  opacity: 0;
340
341
  transform: translateY(-8px);
342
+ }
343
+ .content.nested.menu {
344
+ margin-block: calc(-1 * (var(--sui-menu-border-width, 1px) + var(--sui-menu-padding, 4px)));
345
+ }
346
+ :global(dialog.open) .content.nested.menu {
347
+ transform: none;
341
348
  }</style>
@@ -118,9 +118,13 @@ class Popup {
118
118
 
119
119
  this.anchorElement.setAttribute('aria-expanded', 'false');
120
120
 
121
- const removeClickListener = on(anchorElement, 'click', () => {
121
+ const removeClickListener = on(anchorElement, 'click', (event) => {
122
122
  if (!this.isDisabled && !this.isReadOnly) {
123
- this.open = !this.open;
123
+ // A menu item’s submenu may already have been opened by hovering, which also happens right
124
+ // before a tap on a touch screen, so a pointer click only opens it rather than toggling it
125
+ // closed. A scripted click, which has no `detail`, still toggles it: that’s how the
126
+ // keyboard navigation closes a submenu.
127
+ this.open = event.detail && anchorElement.matches('[role="menuitem"]') ? true : !this.open;
124
128
  }
125
129
  });
126
130
 
@@ -281,6 +281,8 @@
281
281
  --sui-heading-font-weight: var(--sui-font-weight-bold);
282
282
  --sui-heading-line-height: var(--sui-line-height-default);
283
283
  --sui-paragraph-margin: 1.75em;
284
+ // Menu
285
+ --sui-menuitem-font-size: 14px;
284
286
  // Controls
285
287
  --sui-control-small-border-width: 1px;
286
288
  --sui-control-small-border-radius: calc(var(--sui-control-small-height) / 8);
@@ -369,6 +371,7 @@
369
371
 
370
372
  // Make controls larger on touch devices, e.g. mobile & tablet
371
373
  @media (pointer: coarse) {
374
+ --sui-menuitem-height: 40px;
372
375
  --sui-control-small-height: 32px;
373
376
  --sui-control-medium-height: 40px;
374
377
  --sui-control-large-height: 48px;
@@ -135,7 +135,7 @@ export type ModalProps = {
135
135
  * The `role` attribute on the `<dialog>`
136
136
  * element.
137
137
  */
138
- role?: "none" | "dialog" | "alertdialog" | undefined;
138
+ role?: "dialog" | "alertdialog" | "none" | undefined;
139
139
  /**
140
140
  * Whether to show the modal.
141
141
  */
@@ -221,7 +221,7 @@ export type DialogProps = {
221
221
  /**
222
222
  * Width of the dialog.
223
223
  */
224
- size?: "small" | "medium" | "large" | "x-large" | undefined;
224
+ size?: "small" | "medium" | "large" | "x-small" | "x-large" | undefined;
225
225
  /**
226
226
  * The `class` attribute on the `<dialog>` element.
227
227
  */
package/dist/typedefs.js CHANGED
@@ -82,7 +82,7 @@
82
82
  * @property {string} [ariaLabelledby] ID of the element that labels the dialog, typically a heading
83
83
  * inside a custom `header` snippet. Takes precedence over `title` for the accessible name.
84
84
  * @property {'dialog' | 'alertdialog'} [role] The `role` attribute on the `<dialog>` element.
85
- * @property {'small' | 'medium' | 'large' | 'x-large'} [size] Width of the dialog.
85
+ * @property {'x-small' | 'small' | 'medium' | 'large' | 'x-large'} [size] Width of the dialog.
86
86
  * @property {string} [class] The `class` attribute on the `<dialog>` element.
87
87
  * @property {boolean} [open] Whether to open the dialog.
88
88
  * @property {boolean} [showClose] Whether to show the Close button on the header.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/ui",
3
- "version": "0.86.0",
3
+ "version": "0.87.1",
4
4
  "description": "A collection of Svelte components and utilities for building user interfaces.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -71,21 +71,21 @@
71
71
  "@fontsource/noto-mono": "5.3.0",
72
72
  "@rollup/plugin-yaml": "^5.0.0",
73
73
  "@sveltejs/adapter-auto": "^8.0.0",
74
- "@sveltejs/kit": "^3.0.1",
75
- "@sveltejs/package": "^3.0.0",
74
+ "@sveltejs/kit": "^3.1.0",
75
+ "@sveltejs/package": "^3.0.1",
76
76
  "@sveltejs/vite-plugin-svelte": "^7.3.1",
77
- "@vitest/browser-playwright": "^5.0.4",
78
- "@vitest/coverage-v8": "^5.0.4",
77
+ "@vitest/browser-playwright": "^5.0.5",
78
+ "@vitest/coverage-v8": "^5.0.5",
79
79
  "cspell": "^10.4.0",
80
80
  "eslint": "^9.39.5",
81
81
  "eslint-config-airbnb-extended": "^3.3.0",
82
82
  "eslint-config-prettier": "^10.1.8",
83
83
  "eslint-plugin-import": "^2.32.0",
84
- "eslint-plugin-jsdoc": "^65.3.4",
84
+ "eslint-plugin-jsdoc": "^65.3.12",
85
85
  "eslint-plugin-package-json": "^1.10.1",
86
86
  "eslint-plugin-svelte": "^3.23.1",
87
87
  "globals": "^17.13.0",
88
- "happy-dom": "^21.0.1",
88
+ "happy-dom": "^21.0.3",
89
89
  "oxlint": "^1.88.0",
90
90
  "playwright": "^1.64.1",
91
91
  "postcss": "^8.5.30",
@@ -93,17 +93,17 @@
93
93
  "prettier": "^3.9.10",
94
94
  "prettier-plugin-svelte": "^4.1.1",
95
95
  "rolldown": "^1.2.14",
96
- "sass": "^1.105.1",
96
+ "sass": "^1.105.2",
97
97
  "shiki": "^4.5.0",
98
98
  "stylelint": "^17.16.0",
99
99
  "stylelint-config-recommended-scss": "^17.0.1",
100
100
  "stylelint-scss": "^7.3.0",
101
101
  "svelte": "^5.57.2",
102
- "svelte-check": "^4.7.6",
102
+ "svelte-check": "^4.7.7",
103
103
  "svelte-preprocess": "^6.0.5",
104
104
  "tslib": "^2.8.1",
105
105
  "vite": "^8.3.4",
106
- "vitest": "^5.0.4",
106
+ "vitest": "^5.0.5",
107
107
  "vitest-browser-svelte": "^3.1.0"
108
108
  },
109
109
  "peerDependencies": {