@sveltia/ui 0.7.4 → 0.7.5

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 (33) hide show
  1. package/package/components/button/button.svelte +8 -0
  2. package/package/components/button/button.svelte.d.ts +5 -0
  3. package/package/components/button/select-button-group.svelte +3 -3
  4. package/package/components/checkbox/checkbox.svelte +10 -5
  5. package/package/components/dialog/dialog.svelte +2 -2
  6. package/package/components/disclosure/disclosure.svelte +0 -1
  7. package/package/components/drawer/drawer.svelte +2 -2
  8. package/package/components/drawer/drawer.svelte.d.ts +2 -2
  9. package/package/components/listbox/listbox.svelte +3 -3
  10. package/package/components/radio/radio-group.svelte +3 -3
  11. package/package/components/radio/radio-group.svelte.d.ts +2 -2
  12. package/package/components/select/combobox.svelte +46 -28
  13. package/package/components/select/combobox.svelte.d.ts +3 -2
  14. package/package/components/select/select.svelte +10 -9
  15. package/package/components/select/select.svelte.d.ts +4 -3
  16. package/package/components/slider/slider.svelte +3 -2
  17. package/package/components/switch/switch.svelte +6 -4
  18. package/package/components/text-field/markdown-editor.svelte +9 -6
  19. package/package/components/text-field/number-input.svelte +74 -40
  20. package/package/components/text-field/password-input.svelte +9 -4
  21. package/package/components/text-field/search-bar.svelte +4 -2
  22. package/package/components/text-field/text-area.svelte +6 -5
  23. package/package/components/text-field/text-input.svelte +16 -4
  24. package/package/components/text-field/text-input.svelte.d.ts +7 -2
  25. package/package/components/util/app-shell.svelte +8 -2
  26. package/package/components/util/popup.svelte +8 -3
  27. package/package/components/util/popup.svelte.d.ts +5 -0
  28. package/package/services/group.js +16 -0
  29. package/package/services/popup.d.ts +5 -1
  30. package/package/services/popup.js +22 -19
  31. package/package/styles/core.scss +4 -0
  32. package/package/styles/variables.scss +2 -2
  33. package/package.json +11 -11
@@ -51,6 +51,12 @@
51
51
  * @type {boolean}
52
52
  */
53
53
  export let disabled = false;
54
+ /**
55
+ * Whether to make the widget read-only. An alias of the `aria-readonly` attribute used in certain
56
+ * roles, including `checkbox`, `listbox`, `slider` and `textbox`.
57
+ * @type {boolean | undefined}
58
+ */
59
+ export let readonly = undefined;
54
60
  /**
55
61
  * Whether to mark the widget pressed. An alias of the `aria-pressed` attribute.
56
62
  * @type {boolean | 'mixed' | undefined}
@@ -110,6 +116,7 @@
110
116
  {role}
111
117
  aria-hidden={hidden}
112
118
  aria-disabled={disabled}
119
+ aria-readonly={readonly}
113
120
  aria-pressed={pressed}
114
121
  {...$$restProps}
115
122
  bind:this={element}
@@ -246,6 +253,7 @@ button:global(.link) {
246
253
  color: var(--sui-primary-accent-color-text);
247
254
  }
248
255
  button:global(.link) :global(.label) {
256
+ padding: 0;
249
257
  line-height: var(--sui-line-height-compact);
250
258
  white-space: normal;
251
259
  }
@@ -18,6 +18,7 @@ export default class Button extends SvelteComponent<{
18
18
  hidden?: boolean;
19
19
  element?: HTMLButtonElement;
20
20
  role?: string;
21
+ readonly?: boolean;
21
22
  pressed?: boolean | "mixed";
22
23
  keyShortcuts?: string;
23
24
  variant?: "link" | "primary" | "secondary" | "tertiary" | "ghost";
@@ -69,6 +70,9 @@ export default class Button extends SvelteComponent<{
69
70
  set disabled(arg: boolean);
70
71
  get disabled(): boolean;
71
72
  /**accessor*/
73
+ set readonly(arg: boolean);
74
+ get readonly(): boolean;
75
+ /**accessor*/
72
76
  set pressed(arg: boolean | "mixed");
73
77
  get pressed(): boolean | "mixed";
74
78
  /**accessor*/
@@ -110,6 +114,7 @@ declare const __propDef: {
110
114
  hidden?: boolean | undefined;
111
115
  element?: HTMLButtonElement | undefined;
112
116
  role?: string;
117
+ readonly?: boolean | undefined;
113
118
  pressed?: boolean | 'mixed' | undefined;
114
119
  keyShortcuts?: string | undefined;
115
120
  variant?: 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'link' | undefined;
@@ -24,17 +24,17 @@
24
24
  */
25
25
  export let disabled = false;
26
26
  /**
27
- * Whether to disable the widget. An alias of the `aria-readonly` attribute.
27
+ * Whether to make the widget read-only. An alias of the `aria-readonly` attribute.
28
28
  * @type {boolean}
29
29
  */
30
30
  export let readonly = false;
31
31
  /**
32
- * Whether to disable the widget. An alias of the `aria-required` attribute.
32
+ * Whether to mark the widget required. An alias of the `aria-required` attribute.
33
33
  * @type {boolean}
34
34
  */
35
35
  export let required = false;
36
36
  /**
37
- * Whether to disable the widget. An alias of the `aria-invalid` attribute.
37
+ * Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
38
38
  * @type {boolean}
39
39
  */
40
40
  export let invalid = false;
@@ -38,17 +38,17 @@
38
38
  */
39
39
  export let disabled = false;
40
40
  /**
41
- * Whether to disable the widget. An alias of the `aria-readonly` attribute.
41
+ * Whether to make the widget read-only. An alias of the `aria-readonly` attribute.
42
42
  * @type {boolean}
43
43
  */
44
44
  export let readonly = false;
45
45
  /**
46
- * Whether to disable the widget. An alias of the `aria-required` attribute.
46
+ * Whether to mark the widget required. An alias of the `aria-required` attribute.
47
47
  * @type {boolean}
48
48
  */
49
49
  export let required = false;
50
50
  /**
51
- * Whether to disable the widget. An alias of the `aria-invalid` attribute.
51
+ * Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
52
52
  * @type {boolean}
53
53
  */
54
54
  export let invalid = false;
@@ -81,6 +81,7 @@
81
81
  class:checked
82
82
  class:indeterminate
83
83
  class:disabled
84
+ class:readonly
84
85
  hidden={hidden || undefined}
85
86
  role="none"
86
87
  {...$$restProps}
@@ -106,9 +107,13 @@
106
107
  aria-labelledby={ariaLabel ? undefined : '{id}-label'}
107
108
  bind:this={buttonComponent}
108
109
  on:click={(event) => {
110
+ event.preventDefault();
109
111
  event.stopPropagation();
110
- checked = indeterminate ? true : !checked;
111
- dispatch('change', { checked });
112
+
113
+ if (!disabled && !readonly) {
114
+ checked = indeterminate ? true : !checked;
115
+ dispatch('change', { checked });
116
+ }
112
117
  }}
113
118
  >
114
119
  <Icon slot="start-icon" name={indeterminate ? 'remove' : 'check'} />
@@ -248,8 +248,8 @@ dialog form {
248
248
  border-radius: 4px;
249
249
  max-width: calc(100vw - 32px);
250
250
  background-color: var(--sui-secondary-background-color-translucent);
251
- -webkit-backdrop-filter: blur(16px);
252
- backdrop-filter: blur(16px);
251
+ -webkit-backdrop-filter: blur(32px);
252
+ backdrop-filter: blur(32px);
253
253
  box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
254
254
  will-change: opacity, transform;
255
255
  transition-property: opacity, transform;
@@ -74,7 +74,6 @@
74
74
  <style>.disclosure :global(button) {
75
75
  display: flex;
76
76
  width: 100%;
77
- justify-content: space-between;
78
77
  }
79
78
  .disclosure :global(button .icon) {
80
79
  transition: all 200ms;
@@ -245,8 +245,8 @@ dialog form {
245
245
  max-width: 100vw;
246
246
  max-height: 100vh;
247
247
  background-color: var(--sui-secondary-background-color-translucent);
248
- -webkit-backdrop-filter: blur(16px);
249
- backdrop-filter: blur(16px);
248
+ -webkit-backdrop-filter: blur(32px);
249
+ backdrop-filter: blur(32px);
250
250
  box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
251
251
  will-change: opacity, transform;
252
252
  transition-property: opacity, transform;
@@ -12,10 +12,10 @@ export default class Drawer extends SvelteComponent<{
12
12
  title?: string;
13
13
  size?: "small" | "medium" | "large" | "x-large";
14
14
  position?: "top" | "right" | "bottom" | "left";
15
+ keepContent?: boolean;
15
16
  open?: boolean;
16
17
  showClose?: false | "inside" | "outside";
17
18
  closeOnBackdropClick?: boolean;
18
- keepContent?: boolean;
19
19
  }, {
20
20
  submit: SubmitEvent;
21
21
  ok: CustomEvent<any>;
@@ -41,10 +41,10 @@ declare const __propDef: {
41
41
  title?: string;
42
42
  size?: ('small' | 'medium' | 'large' | 'x-large');
43
43
  position?: ('top' | 'right' | 'bottom' | 'left');
44
+ keepContent?: boolean;
44
45
  open?: boolean;
45
46
  showClose?: ('inside' | 'outside' | false);
46
47
  closeOnBackdropClick?: boolean;
47
- keepContent?: boolean;
48
48
  };
49
49
  events: {
50
50
  submit: SubmitEvent;
@@ -25,17 +25,17 @@
25
25
  */
26
26
  export let disabled = false;
27
27
  /**
28
- * Whether to disable the widget. An alias of the `aria-readonly` attribute.
28
+ * Whether to make the widget read-only. An alias of the `aria-readonly` attribute.
29
29
  * @type {boolean}
30
30
  */
31
31
  export let readonly = false;
32
32
  /**
33
- * Whether to disable the widget. An alias of the `aria-required` attribute.
33
+ * Whether to mark the widget required. An alias of the `aria-required` attribute.
34
34
  * @type {boolean}
35
35
  */
36
36
  export let required = false;
37
37
  /**
38
- * Whether to disable the widget. An alias of the `aria-invalid` attribute.
38
+ * Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
39
39
  * @type {boolean}
40
40
  */
41
41
  export let invalid = false;
@@ -24,17 +24,17 @@
24
24
  */
25
25
  export let disabled = false;
26
26
  /**
27
- * Whether to disable the widget. An alias of the `aria-readonly` attribute.
27
+ * Whether to make the widget read-only. An alias of the `aria-readonly` attribute.
28
28
  * @type {boolean}
29
29
  */
30
30
  export let readonly = false;
31
31
  /**
32
- * Whether to disable the widget. An alias of the `aria-required` attribute.
32
+ * Whether to mark the widget required. An alias of the `aria-required` attribute.
33
33
  * @type {boolean}
34
34
  */
35
35
  export let required = false;
36
36
  /**
37
- * Whether to disable the widget. An alias of the `aria-invalid` attribute.
37
+ * Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
38
38
  * @type {boolean}
39
39
  */
40
40
  export let invalid = false;
@@ -13,8 +13,8 @@ export default class RadioGroup extends SvelteComponent<{
13
13
  disabled?: boolean;
14
14
  required?: boolean;
15
15
  hidden?: boolean;
16
- orientation?: "vertical" | "horizontal";
17
16
  readonly?: boolean;
17
+ orientation?: "vertical" | "horizontal";
18
18
  }, {
19
19
  change: Event;
20
20
  } & {
@@ -35,8 +35,8 @@ declare const __propDef: {
35
35
  disabled?: boolean;
36
36
  required?: boolean;
37
37
  hidden?: boolean | undefined;
38
- orientation?: 'horizontal' | 'vertical';
39
38
  readonly?: boolean;
39
+ orientation?: 'horizontal' | 'vertical';
40
40
  };
41
41
  events: {
42
42
  change: Event;
@@ -3,6 +3,7 @@
3
3
  A variant of the `<Select>` widget with an auto-complete text input field.
4
4
  @see https://w3c.github.io/aria/#combobox
5
5
  @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
6
+ @todo Add DOM API compatibility.
6
7
  -->
7
8
  <script>
8
9
  import { createEventDispatcher } from 'svelte';
@@ -32,30 +33,29 @@
32
33
  */
33
34
  export let disabled = false;
34
35
  /**
35
- * Whether to disable the widget. An alias of the `aria-readonly` attribute.
36
+ * Whether to make the widget read-only. An alias of the `aria-readonly` attribute.
36
37
  * @type {boolean}
37
38
  */
38
39
  export let readonly = false;
39
40
  /**
40
- * Whether to disable the widget. An alias of the `aria-required` attribute.
41
+ * Whether to mark the widget required. An alias of the `aria-required` attribute.
41
42
  * @type {boolean}
42
43
  */
43
44
  export let required = false;
44
45
  /**
45
- * Whether to disable the widget. An alias of the `aria-invalid` attribute.
46
+ * Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
46
47
  * @type {boolean}
47
48
  */
48
49
  export let invalid = false;
49
- /**
50
- * Text label displayed on the readonly item.
51
- * @type {string}
52
- */
53
- export let label = '';
54
50
  /**
55
51
  * Selected option’s value.
56
52
  * @type {(string | number | undefined)}
57
53
  */
58
54
  export let value = undefined;
55
+ /**
56
+ * Whether to make the `combobox` editable.
57
+ */
58
+ export let editable = true;
59
59
  /**
60
60
  * Where to show the dropdown menu.
61
61
  * @type {PopupPosition}
@@ -71,10 +71,37 @@
71
71
  /** @type {Popup?} */
72
72
  let popupComponent;
73
73
  let isPopupOpen = writable(false);
74
+ /** @type {string} */
75
+ let label = '';
76
+
77
+ /**
78
+ * Update the `value` and `label` whenever an option is selected
79
+ * @param {HTMLButtonElement} target Selected option.
80
+ */
81
+ const onSelect = (target) => {
82
+ // @todo support more types
83
+ value = target.dataset.type === 'number' ? Number(target.value) : target.value;
84
+ label = target.querySelector('.label')?.textContent || target.value;
85
+ dispatch('change', { target: inputComponent?.element, value });
86
+ };
87
+
88
+ $: {
89
+ if (popupComponent?.content) {
90
+ window.requestAnimationFrame(() => {
91
+ const selected = popupComponent.content.querySelector(
92
+ '[role="option"][aria-selected="true"]',
93
+ );
94
+
95
+ if (selected) {
96
+ onSelect(/** @type {HTMLButtonElement?} */ (selected));
97
+ }
98
+ });
99
+ }
100
+ }
74
101
  </script>
75
102
 
76
- <div class="sui combobox {className}" class:readonly hidden={hidden || undefined} {...$$restProps}>
77
- {#if readonly}
103
+ <div class="sui combobox {className}" hidden={hidden || undefined} {...$$restProps}>
104
+ {#if !editable}
78
105
  <div
79
106
  {id}
80
107
  class:selected={value !== undefined}
@@ -84,14 +111,14 @@
84
111
  aria-expanded={$isPopupOpen}
85
112
  aria-hidden={hidden}
86
113
  aria-disabled={disabled}
87
- aria-readonly="true"
114
+ aria-readonly={readonly}
88
115
  aria-haspopup="listbox"
89
116
  aria-activedescendant="selected-option"
90
117
  {...$$restProps}
91
118
  bind:this={comboboxElement}
92
119
  >
93
120
  <div class="label">
94
- {value !== undefined ? label || value : $_('_sui.combobox.select_an_option')}
121
+ {value !== undefined ? label : $_('_sui.combobox.select_an_option')}
95
122
  </div>
96
123
  </div>
97
124
  {:else}
@@ -121,9 +148,10 @@
121
148
  aria-controls="{id}-popup"
122
149
  aria-expanded={$isPopupOpen}
123
150
  on:click={(event) => {
151
+ event.preventDefault();
124
152
  event.stopPropagation();
125
153
 
126
- if (!disabled) {
154
+ if (!disabled && !readonly) {
127
155
  $isPopupOpen = !$isPopupOpen;
128
156
  }
129
157
  }}
@@ -140,6 +168,7 @@
140
168
  class="combobox"
141
169
  anchor={comboboxElement ?? inputComponent?.element}
142
170
  {position}
171
+ keepContent={true}
143
172
  touchOptimized={true}
144
173
  bind:open={isPopupOpen}
145
174
  bind:this={popupComponent}
@@ -147,13 +176,7 @@
147
176
  <Listbox
148
177
  on:click={(event) => {
149
178
  if (/** @type {HTMLElement} */ (event.target).matches('[role="option"]')) {
150
- // eslint-disable-next-line prefer-destructuring
151
- const target = /** @type {HTMLButtonElement?} */ (event.target);
152
-
153
- // @todo support more types
154
- value = target.dataset.type === 'number' ? Number(target.value) : target.value;
155
- label = target.querySelector('.label')?.textContent || target.value;
156
- dispatch('change', { target: inputComponent?.element, value });
179
+ onSelect(/** @type {HTMLButtonElement?} */ (event.target));
157
180
  }
158
181
  }}
159
182
  >
@@ -214,11 +237,6 @@
214
237
  .combobox div[role=combobox]:hover, .combobox div[role=combobox]:focus {
215
238
  background-color: var(--sui-hover-background-color);
216
239
  }
217
- .combobox div[role=combobox][aria-disabled=true] {
218
- background-color: var(--sui-disabled-background-color);
219
- opacity: 0.4;
220
- cursor: default;
221
- }
222
240
  .combobox div[role=combobox] .label {
223
241
  display: block;
224
242
  overflow: hidden;
@@ -228,7 +246,7 @@
228
246
  }
229
247
  .combobox :global(input) {
230
248
  padding: 0 32px 0 8px;
231
- width: 100%;
249
+ width: 0;
232
250
  }
233
251
  .combobox + :global([role="listbox"]) {
234
252
  position: fixed;
@@ -237,8 +255,8 @@
237
255
  box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
238
256
  overflow: auto;
239
257
  background-color: var(--sui-secondary-background-color);
240
- -webkit-backdrop-filter: blur(16px);
241
- backdrop-filter: blur(16px);
258
+ -webkit-backdrop-filter: blur(32px);
259
+ backdrop-filter: blur(32px);
242
260
  /* Add .1s delay before the position can be determined */
243
261
  transition: opacity 100ms 100ms;
244
262
  }
@@ -5,11 +5,11 @@
5
5
  * A variant of the `<Select>` widget with an auto-complete text input field.
6
6
  * @see https://w3c.github.io/aria/#combobox
7
7
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
8
+ * @todo Add DOM API compatibility.
8
9
  */
9
10
  export default class Combobox extends SvelteComponent<{
10
11
  [x: string]: any;
11
12
  class?: string;
12
- label?: string;
13
13
  invalid?: boolean;
14
14
  disabled?: boolean;
15
15
  required?: boolean;
@@ -17,6 +17,7 @@ export default class Combobox extends SvelteComponent<{
17
17
  position?: PopupPosition;
18
18
  hidden?: boolean;
19
19
  readonly?: boolean;
20
+ editable?: boolean;
20
21
  }, {
21
22
  change: CustomEvent<any>;
22
23
  } & {
@@ -33,7 +34,6 @@ declare const __propDef: {
33
34
  props: {
34
35
  [x: string]: any;
35
36
  class?: string;
36
- label?: string;
37
37
  invalid?: boolean;
38
38
  disabled?: boolean;
39
39
  required?: boolean;
@@ -41,6 +41,7 @@ declare const __propDef: {
41
41
  position?: PopupPosition;
42
42
  hidden?: boolean | undefined;
43
43
  readonly?: boolean;
44
+ editable?: boolean;
44
45
  };
45
46
  events: {
46
47
  change: CustomEvent<any>;
@@ -1,8 +1,9 @@
1
1
  <!--
2
2
  @component
3
- A read-only variant of `<Combobox>`. The equivalent of the HTML `<select>` element.
3
+ A select-only variant of `<Combobox>`. The equivalent of the HTML `<select>` element.
4
4
  @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
5
5
  @see https://w3c.github.io/aria/#combobox
6
+ @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/
6
7
  -->
7
8
  <script>
8
9
  import Combobox from './combobox.svelte';
@@ -23,21 +24,21 @@
23
24
  * @type {boolean}
24
25
  */
25
26
  export let disabled = false;
27
+ /**
28
+ * Whether to make the widget read-only. An alias of the `aria-readonly` attribute.
29
+ * @type {boolean}
30
+ */
31
+ export let readonly = false;
26
32
  /**
27
33
  * Whether to disable the widget. An alias of the `aria-required` attribute.
28
34
  * @type {boolean}
29
35
  */
30
36
  export let required = false;
31
37
  /**
32
- * Whether to disable the widget. An alias of the `aria-invalid` attribute.
38
+ * Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
33
39
  * @type {boolean}
34
40
  */
35
41
  export let invalid = false;
36
- /**
37
- * Text label displayed on the readonly item.
38
- * @type {string}
39
- */
40
- export let label = '';
41
42
  /**
42
43
  * Selected option’s value.
43
44
  * @type {(string | number | undefined)}
@@ -50,11 +51,11 @@
50
51
  class="sui select {className}"
51
52
  {hidden}
52
53
  {disabled}
53
- readonly={true}
54
+ {readonly}
54
55
  {required}
55
56
  {invalid}
56
- {label}
57
57
  {...$$restProps}
58
+ editable={false}
58
59
  on:change
59
60
  >
60
61
  <slot />
@@ -2,19 +2,20 @@
2
2
  /** @typedef {typeof __propDef.events} SelectEvents */
3
3
  /** @typedef {typeof __propDef.slots} SelectSlots */
4
4
  /**
5
- * A read-only variant of `<Combobox>`. The equivalent of the HTML `<select>` element.
5
+ * A select-only variant of `<Combobox>`. The equivalent of the HTML `<select>` element.
6
6
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
7
7
  * @see https://w3c.github.io/aria/#combobox
8
+ * @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/
8
9
  */
9
10
  export default class Select extends SvelteComponent<{
10
11
  [x: string]: any;
11
12
  class?: string;
12
- label?: string;
13
13
  invalid?: boolean;
14
14
  disabled?: boolean;
15
15
  required?: boolean;
16
16
  value?: string | number;
17
17
  hidden?: boolean;
18
+ readonly?: boolean;
18
19
  }, {
19
20
  change: CustomEvent<any>;
20
21
  } & {
@@ -31,12 +32,12 @@ declare const __propDef: {
31
32
  props: {
32
33
  [x: string]: any;
33
34
  class?: string;
34
- label?: string;
35
35
  invalid?: boolean;
36
36
  disabled?: boolean;
37
37
  required?: boolean;
38
38
  value?: (string | number | undefined);
39
39
  hidden?: boolean | undefined;
40
+ readonly?: boolean;
40
41
  };
41
42
  events: {
42
43
  change: CustomEvent<any>;
@@ -27,12 +27,12 @@
27
27
  */
28
28
  export let disabled = false;
29
29
  /**
30
- * Whether to disable the widget. An alias of the `aria-readonly` attribute.
30
+ * Whether to make the widget read-only. An alias of the `aria-readonly` attribute.
31
31
  * @type {boolean}
32
32
  */
33
33
  export let readonly = false;
34
34
  /**
35
- * Whether to disable the widget. An alias of the `aria-invalid` attribute.
35
+ * Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
36
36
  * @type {boolean}
37
37
  */
38
38
  export let invalid = false;
@@ -289,6 +289,7 @@
289
289
  <div
290
290
  class="sui slider {className}"
291
291
  class:disabled
292
+ class:readonly
292
293
  role="none"
293
294
  hidden={hidden || undefined}
294
295
  {...$$restProps}
@@ -22,17 +22,17 @@
22
22
  */
23
23
  export let disabled = false;
24
24
  /**
25
- * Whether to disable the widget. An alias of the `aria-readonly` attribute.
25
+ * Whether to make the widget read-only. An alias of the `aria-readonly` attribute.
26
26
  * @type {boolean}
27
27
  */
28
28
  export let readonly = false;
29
29
  /**
30
- * Whether to disable the widget. An alias of the `aria-required` attribute.
30
+ * Whether to mark the widget required. An alias of the `aria-required` attribute.
31
31
  * @type {boolean}
32
32
  */
33
33
  export let required = false;
34
34
  /**
35
- * Whether to disable the widget. An alias of the `aria-invalid` attribute.
35
+ * Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
36
36
  * @type {boolean}
37
37
  */
38
38
  export let invalid = false;
@@ -62,7 +62,9 @@
62
62
  aria-invalid={invalid}
63
63
  {...$$restProps}
64
64
  on:click={() => {
65
- checked = !checked;
65
+ if (!disabled && !readonly) {
66
+ checked = !checked;
67
+ }
66
68
  }}
67
69
  >
68
70
  <span />
@@ -26,12 +26,12 @@
26
26
  */
27
27
  export let readonly = false;
28
28
  /**
29
- * Whether to disable the widget. An alias of the `aria-required` attribute.
29
+ * Whether to mark the widget required. An alias of the `aria-required` attribute.
30
30
  * @type {boolean}
31
31
  */
32
32
  export let required = false;
33
33
  /**
34
- * Whether to disable the widget. An alias of the `aria-invalid` attribute.
34
+ * Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
35
35
  * @type {boolean}
36
36
  */
37
37
  export let invalid = false;
@@ -72,14 +72,17 @@
72
72
  ];
73
73
  </script>
74
74
 
75
- <div class="wrapper" class:disabled hidden={hidden || undefined} {...$$restProps}>
76
- <div class="inner" inert={disabled}>
77
- <Toolbar aria-label={$_('_sui.markdown_editor.markdown_editor')}>
75
+ <div class="wrapper" hidden={hidden || undefined} {...$$restProps}>
76
+ <div class="inner">
77
+ <Toolbar
78
+ disabled={disabled || readonly}
79
+ aria-label={$_('_sui.markdown_editor.markdown_editor')}
80
+ >
78
81
  {#each defaultButtons as { label, icon, separator }}
79
82
  {#if separator}
80
83
  <Divider />
81
84
  {:else}
82
- <Button iconic {disabled}>
85
+ <Button iconic>
83
86
  <Icon slot="start-icon" name={icon} {label} />
84
87
  </Button>
85
88
  {/if}