@sveltia/ui 0.6.6 → 0.7.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 (97) hide show
  1. package/package/components/button/button.svelte +109 -75
  2. package/package/components/button/button.svelte.d.ts +45 -18
  3. package/package/components/button/select-button-group.svelte +51 -30
  4. package/package/components/button/select-button-group.svelte.d.ts +12 -8
  5. package/package/components/button/select-button.svelte +50 -2
  6. package/package/components/button/select-button.svelte.d.ts +16 -0
  7. package/package/components/calendar/calendar.svelte +5 -3
  8. package/package/components/checkbox/checkbox-group.svelte +28 -10
  9. package/package/components/checkbox/checkbox-group.svelte.d.ts +4 -2
  10. package/package/components/checkbox/checkbox.svelte +114 -71
  11. package/package/components/checkbox/checkbox.svelte.d.ts +13 -7
  12. package/package/components/dialog/dialog.svelte +36 -16
  13. package/package/components/dialog/dialog.svelte.d.ts +0 -4
  14. package/package/components/disclosure/disclosure.svelte +48 -21
  15. package/package/components/disclosure/disclosure.svelte.d.ts +19 -0
  16. package/package/components/divider/divider.svelte +14 -6
  17. package/package/components/divider/divider.svelte.d.ts +3 -1
  18. package/package/components/divider/spacer.svelte +17 -5
  19. package/package/components/divider/spacer.svelte.d.ts +2 -0
  20. package/package/components/drawer/drawer.svelte +12 -5
  21. package/package/components/listbox/listbox.svelte +55 -20
  22. package/package/components/listbox/listbox.svelte.d.ts +12 -13
  23. package/package/components/listbox/option-group.svelte +22 -5
  24. package/package/components/listbox/option-group.svelte.d.ts +4 -0
  25. package/package/components/listbox/option.svelte +41 -14
  26. package/package/components/listbox/option.svelte.d.ts +9 -3
  27. package/package/components/menu/menu-button.svelte +51 -5
  28. package/package/components/menu/menu-button.svelte.d.ts +15 -0
  29. package/package/components/menu/menu-item-checkbox.svelte +41 -2
  30. package/package/components/menu/menu-item-checkbox.svelte.d.ts +14 -0
  31. package/package/components/menu/menu-item-group.svelte +26 -9
  32. package/package/components/menu/menu-item-group.svelte.d.ts +4 -2
  33. package/package/components/menu/menu-item-radio.svelte +47 -3
  34. package/package/components/menu/menu-item-radio.svelte.d.ts +14 -0
  35. package/package/components/menu/menu-item.svelte +48 -21
  36. package/package/components/menu/menu-item.svelte.d.ts +10 -4
  37. package/package/components/menu/menu.svelte +17 -9
  38. package/package/components/menu/menu.svelte.d.ts +8 -8
  39. package/package/components/radio/radio-group.svelte +50 -11
  40. package/package/components/radio/radio-group.svelte.d.ts +13 -5
  41. package/package/components/radio/radio.svelte +76 -45
  42. package/package/components/radio/radio.svelte.d.ts +11 -5
  43. package/package/components/select/combobox.svelte +58 -28
  44. package/package/components/select/combobox.svelte.d.ts +8 -2
  45. package/package/components/select/select.svelte +31 -6
  46. package/package/components/select/select.svelte.d.ts +10 -2
  47. package/package/components/slider/slider.svelte +158 -70
  48. package/package/components/slider/slider.svelte.d.ts +12 -4
  49. package/package/components/switch/switch.svelte +71 -29
  50. package/package/components/switch/switch.svelte.d.ts +11 -3
  51. package/package/components/table/table-row-header.svelte +1 -0
  52. package/package/components/table/table-row.svelte +16 -3
  53. package/package/components/table/table-row.svelte.d.ts +4 -0
  54. package/package/components/table/table.svelte +2 -1
  55. package/package/components/table/table.svelte.d.ts +4 -0
  56. package/package/components/tabs/tab-list.svelte +33 -16
  57. package/package/components/tabs/tab-list.svelte.d.ts +8 -18
  58. package/package/components/tabs/tab-panel.svelte +1 -2
  59. package/package/components/tabs/tab.svelte +25 -3
  60. package/package/components/tabs/tab.svelte.d.ts +10 -0
  61. package/package/components/text-field/markdown-editor.svelte +54 -22
  62. package/package/components/text-field/markdown-editor.svelte.d.ts +11 -1
  63. package/package/components/text-field/number-input.svelte +66 -15
  64. package/package/components/text-field/number-input.svelte.d.ts +13 -5
  65. package/package/components/text-field/password-input.svelte +42 -9
  66. package/package/components/text-field/password-input.svelte.d.ts +11 -1
  67. package/package/components/text-field/search-bar.svelte +67 -17
  68. package/package/components/text-field/search-bar.svelte.d.ts +26 -1
  69. package/package/components/text-field/text-area.svelte +55 -21
  70. package/package/components/text-field/text-area.svelte.d.ts +12 -19
  71. package/package/components/text-field/text-input.svelte +71 -46
  72. package/package/components/text-field/text-input.svelte.d.ts +34 -14
  73. package/package/components/toast/toast.svelte +119 -0
  74. package/package/components/toast/toast.svelte.d.ts +36 -0
  75. package/package/components/toolbar/toolbar.svelte +33 -10
  76. package/package/components/toolbar/toolbar.svelte.d.ts +7 -1
  77. package/package/components/util/app-shell.svelte +133 -69
  78. package/package/components/util/group.svelte +21 -6
  79. package/package/components/util/group.svelte.d.ts +4 -2
  80. package/package/components/util/popup.svelte +62 -10
  81. package/package/components/util/popup.svelte.d.ts +13 -3
  82. package/package/components/util/portal.svelte +1 -1
  83. package/package/components/util/portal.svelte.d.ts +2 -0
  84. package/package/index.d.ts +2 -0
  85. package/package/index.js +4 -3
  86. package/package/{components/util → services}/events.d.ts +1 -1
  87. package/package/{components/util → services}/events.js +3 -2
  88. package/package/services/group.d.ts +1 -0
  89. package/package/{components/util → services}/group.js +15 -13
  90. package/package/{components/util → services}/util.d.ts +1 -1
  91. package/package/{components/util → services}/util.js +2 -2
  92. package/package/styles/core.scss +36 -7
  93. package/package/styles/variables.scss +98 -62
  94. package/package.json +37 -29
  95. package/package/components/util/group.d.ts +0 -1
  96. /package/package/{components/util → services}/popup.d.ts +0 -0
  97. /package/package/{components/util → services}/popup.js +0 -0
@@ -9,9 +9,17 @@
9
9
  export default class SelectButton extends SvelteComponent<{
10
10
  [x: string]: any;
11
11
  class?: string;
12
+ label?: string;
13
+ disabled?: boolean;
14
+ size?: "small" | "medium" | "large";
15
+ value?: string;
16
+ hidden?: boolean;
17
+ variant?: "link" | "primary" | "secondary" | "tertiary" | "ghost";
18
+ iconic?: boolean;
12
19
  selected?: boolean;
13
20
  }, {
14
21
  click: MouseEvent;
22
+ select: Event;
15
23
  } & {
16
24
  [evt: string]: CustomEvent<any>;
17
25
  }, {
@@ -32,10 +40,18 @@ declare const __propDef: {
32
40
  props: {
33
41
  [x: string]: any;
34
42
  class?: string;
43
+ label?: string;
44
+ disabled?: boolean;
45
+ size?: 'small' | 'medium' | 'large';
46
+ value?: string | undefined;
47
+ hidden?: boolean | undefined;
48
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'link' | undefined;
49
+ iconic?: boolean;
35
50
  selected?: boolean;
36
51
  };
37
52
  events: {
38
53
  click: MouseEvent;
54
+ select: Event;
39
55
  } & {
40
56
  [evt: string]: CustomEvent<any>;
41
57
  };
@@ -12,7 +12,9 @@
12
12
  /** @type {string?} */
13
13
  export let value = undefined;
14
14
 
15
+ /** @type {{ day: Date }[]} */
15
16
  const dayList = [];
17
+ /** @type {{ day: Date }[][]} */
16
18
  const weeks = [];
17
19
  const now = new Date();
18
20
 
@@ -50,7 +52,7 @@
50
52
  <input type="hidden" bind:value />
51
53
  <div class="header">
52
54
  <Button
53
- class="ghost"
55
+ variant="ghost"
54
56
  label={firstDay.toLocaleDateString('en', { year: 'numeric', month: 'short' })}
55
57
  aria-haspopup="dialog"
56
58
  >
@@ -214,11 +216,11 @@
214
216
  border-radius: 50%;
215
217
  }
216
218
  .grid div :global(button):hover {
217
- background-color: var(--sui-highlight-background-color);
219
+ background-color: var(--sui-hover-background-color);
218
220
  }
219
221
  .grid div :global(button):focus {
220
222
  border-width: 1px;
221
- border-color: var(--sui-primary-accent-color-lighter);
223
+ border-color: var(--sui-primary-accent-color-light);
222
224
  }
223
225
 
224
226
  .footer :global(button) {
@@ -4,30 +4,39 @@
4
4
  -->
5
5
  <script>
6
6
  /**
7
- * CSS class name on the button.
7
+ * The `class` attribute on the wrapper element.
8
8
  * @type {string}
9
9
  */
10
10
  let className = '';
11
-
12
11
  export { className as class };
13
-
14
12
  /**
15
- * The `aria-label` attribute on the button element.
16
- * @type {string}
13
+ * Whether to hide the widget. An alias of the `aria-hidden` attribute.
14
+ * @type {boolean | undefined}
15
+ */
16
+ export let hidden = undefined;
17
+ /**
18
+ * Whether to disable the widget. An alias of the `aria-disabled` attribute.
19
+ * @type {boolean}
20
+ */
21
+ export let disabled = false;
22
+ /**
23
+ * Orientation of the widget.
24
+ * @type {('horizontal'|'vertical')}
17
25
  */
18
- export let ariaLabel = '';
19
-
20
- /** @type {('horizontal'|'vertical')} */
21
26
  export let orientation = 'horizontal';
22
27
  </script>
23
28
 
24
29
  <div
25
30
  class="sui checkbox-group {className} {orientation}"
31
+ hidden={hidden || undefined}
26
32
  role="group"
27
- aria-label={ariaLabel}
33
+ aria-hidden={hidden}
34
+ aria-disabled={disabled}
28
35
  {...$$restProps}
29
36
  >
30
- <slot />
37
+ <div class="inner" inert={disabled}>
38
+ <slot />
39
+ </div>
31
40
  </div>
32
41
 
33
42
  <style>.checkbox-group {
@@ -40,4 +49,13 @@
40
49
  .checkbox-group.vertical {
41
50
  gap: 8px;
42
51
  flex-direction: column;
52
+ }
53
+ @media (pointer: coarse) {
54
+ .checkbox-group.vertical {
55
+ gap: 16px;
56
+ }
57
+ }
58
+
59
+ .inner {
60
+ display: contents;
43
61
  }</style>
@@ -5,8 +5,9 @@
5
5
  export default class CheckboxGroup extends SvelteComponent<{
6
6
  [x: string]: any;
7
7
  class?: string;
8
+ disabled?: boolean;
9
+ hidden?: boolean;
8
10
  orientation?: "vertical" | "horizontal";
9
- ariaLabel?: string;
10
11
  }, {
11
12
  [evt: string]: CustomEvent<any>;
12
13
  }, {
@@ -21,8 +22,9 @@ declare const __propDef: {
21
22
  props: {
22
23
  [x: string]: any;
23
24
  class?: string;
25
+ disabled?: boolean;
26
+ hidden?: boolean | undefined;
24
27
  orientation?: ('horizontal' | 'vertical');
25
- ariaLabel?: string;
26
28
  };
27
29
  events: {
28
30
  [evt: string]: CustomEvent<any>;
@@ -7,51 +7,81 @@
7
7
  -->
8
8
  <script>
9
9
  import { createEventDispatcher } from 'svelte';
10
+ import { getRandomId } from '../../services/util';
10
11
  import Button from '../button/button.svelte';
11
12
  import Icon from '../icon/icon.svelte';
12
- import { getRandomId } from '../util/util';
13
13
 
14
14
  /**
15
- * CSS class name on the button.
15
+ * The `class` attribute on the wrapper element.
16
16
  * @type {string}
17
17
  */
18
18
  let className = '';
19
-
20
19
  export { className as class };
21
-
22
- /** @type {string} */
23
- export let name = '';
24
-
25
- /** @type {string?} */
26
- export let label = undefined;
27
-
28
- /** @type {string?} */
20
+ /**
21
+ * The `name` attribute on the `<button>` element.
22
+ * @type {string | undefined}
23
+ */
24
+ export let name = undefined;
25
+ /**
26
+ * The `value` attribute on the `<button>` element.
27
+ * @type {string | undefined}
28
+ */
29
29
  export let value = undefined;
30
-
31
- /** @type {(boolean | string | undefined)} */
32
- export let checked = false;
33
-
34
- /** @type {boolean} */
35
- export let indeterminate = false;
36
-
37
- /** @type {boolean} */
30
+ /**
31
+ * Whether to hide the widget. An alias of the `aria-hidden` attribute.
32
+ * @type {boolean | undefined}
33
+ */
34
+ export let hidden = undefined;
35
+ /**
36
+ * Whether to disable the widget. An alias of the `aria-disabled` attribute.
37
+ * @type {boolean}
38
+ */
38
39
  export let disabled = false;
40
+ /**
41
+ * Whether to disable the widget. An alias of the `aria-readonly` attribute.
42
+ * @type {boolean}
43
+ */
44
+ export let readonly = false;
45
+ /**
46
+ * Whether to disable the widget. An alias of the `aria-required` attribute.
47
+ * @type {boolean}
48
+ */
49
+ export let required = false;
50
+ /**
51
+ * Whether to disable the widget. An alias of the `aria-invalid` attribute.
52
+ * @type {boolean}
53
+ */
54
+ export let invalid = false;
55
+ /**
56
+ * Whether to check the widget. An alias of the `aria-checked` attribute.
57
+ * @type {boolean | 'mixed'}
58
+ */
59
+ export let checked = false;
60
+ /**
61
+ * Text label displayed next to the checkbox.
62
+ * @type {string | undefined}
63
+ */
64
+ export let label = undefined;
39
65
 
40
66
  const dispatch = createEventDispatcher();
41
67
  const id = getRandomId('checkbox');
42
- /** @type {Button} */
43
- let buttonComponent;
44
- </script>
45
68
 
46
- {#if name && value && checked && !indeterminate}
47
- <input type="hidden" {name} {value} />
48
- {/if}
69
+ /**
70
+ * Reference to the `Button` component.
71
+ * @type {Button | undefined}
72
+ */
73
+ let buttonComponent = undefined;
49
74
 
50
- <span
75
+ $: ariaLabel = $$restProps['aria-label'];
76
+ $: indeterminate = checked === 'mixed';
77
+ </script>
78
+
79
+ <div
51
80
  class="sui checkbox {className}"
52
81
  class:checked
53
82
  class:indeterminate
54
83
  class:disabled
84
+ hidden={hidden || undefined}
55
85
  role="none"
56
86
  {...$$restProps}
57
87
  on:click|preventDefault|stopPropagation={(event) => {
@@ -60,35 +90,40 @@
60
90
  }
61
91
  }}
62
92
  >
63
- <Button
64
- {id}
65
- {disabled}
66
- {name}
67
- {value}
68
- role="checkbox"
69
- aria-checked={indeterminate ? 'mixed' : checked}
70
- aria-labelledby="{id}-label"
71
- bind:this={buttonComponent}
72
- on:click={(event) => {
73
- event.preventDefault();
74
- event.stopPropagation();
75
- checked = indeterminate ? true : !checked;
76
- indeterminate = false;
77
- dispatch('change', { checked });
78
- }}
79
- >
80
- <Icon slot="start-icon" name={indeterminate ? 'remove' : 'check'} />
81
- </Button>
82
- {#if $$slots.default || label}
83
- <label id="{id}-label">
84
- {#if $$slots.default}
85
- <slot />
86
- {:else}
87
- {label}
88
- {/if}
89
- </label>
90
- {/if}
91
- </span>
93
+ <div class="inner" inert={disabled}>
94
+ <Button
95
+ {id}
96
+ {name}
97
+ {value}
98
+ role="checkbox"
99
+ {hidden}
100
+ {disabled}
101
+ {readonly}
102
+ {required}
103
+ {invalid}
104
+ aria-checked={checked}
105
+ aria-label={ariaLabel || undefined}
106
+ aria-labelledby={ariaLabel ? undefined : '{id}-label'}
107
+ bind:this={buttonComponent}
108
+ on:click={(event) => {
109
+ event.stopPropagation();
110
+ checked = indeterminate ? true : !checked;
111
+ dispatch('change', { checked });
112
+ }}
113
+ >
114
+ <Icon slot="start-icon" name={indeterminate ? 'remove' : 'check'} />
115
+ </Button>
116
+ {#if $$slots.default || label}
117
+ <label id="{id}-label">
118
+ {#if $$slots.default}
119
+ <slot />
120
+ {:else}
121
+ {label}
122
+ {/if}
123
+ </label>
124
+ {/if}
125
+ </div>
126
+ </div>
92
127
 
93
128
  <style>.checkbox {
94
129
  display: inline-flex;
@@ -102,39 +137,47 @@
102
137
  -webkit-user-select: none;
103
138
  user-select: none;
104
139
  }
105
- .checkbox.disabled {
106
- cursor: default;
140
+ .checkbox:hover :global(button) {
141
+ background-color: var(--sui-hover-background-color);
142
+ }
143
+ .checkbox:hover :global(button[aria-checked="true"]) {
144
+ background-color: var(--sui-primary-accent-color-light);
107
145
  }
108
- .checkbox.disabled label {
109
- color: var(--sui-disabled-foreground-color);
146
+ .checkbox:active :global(button) {
147
+ background-color: var(--sui-active-background-color);
148
+ }
149
+ .checkbox:active :global(button[aria-checked="true"]) {
150
+ background-color: var(--sui-primary-accent-color-dark);
110
151
  }
111
152
  .checkbox :global(button) {
112
153
  align-items: center;
113
154
  justify-content: center;
114
155
  overflow: hidden;
115
- border-width: 2px;
156
+ border-width: 1.5px;
116
157
  border-color: var(--sui-checkbox-border-color);
117
- border-radius: 4px;
118
- width: 20px;
119
- height: 20px;
120
- color: var(--sui-primary-accent-color-lighter);
158
+ border-radius: var(--sui-checkbox-border-radius);
159
+ padding: 0;
160
+ width: var(--sui-checkbox-height);
161
+ height: var(--sui-checkbox-height);
162
+ color: var(--sui-primary-accent-text-color);
121
163
  background-color: var(--sui-checkbox-background-color);
122
164
  transition: all 200ms;
123
165
  }
124
166
  .checkbox :global(button) :global(.icon) {
125
- font-size: 20px;
167
+ font-size: calc(var(--sui-checkbox-height) - 4px);
126
168
  }
127
169
  .checkbox :global(button[aria-checked="true"]) {
128
- border-color: var(--sui-primary-accent-color-lighter);
129
- color: var(--sui-primary-accent-color-foreground);
130
- background-color: var(--sui-primary-accent-color-lighter);
131
- }
132
- .checkbox :global(button[aria-checked="mixed"]) {
133
- color: var(--sui-checkbox-border-color);
170
+ border-color: var(--sui-primary-accent-color);
171
+ color: var(--sui-primary-accent-color-inverted);
172
+ background-color: var(--sui-primary-accent-color);
134
173
  }
135
174
  .checkbox :global(button[aria-checked="false"]) {
136
175
  color: transparent;
137
176
  }
138
177
  .checkbox label {
139
178
  cursor: inherit;
179
+ }
180
+
181
+ .inner {
182
+ display: contents;
140
183
  }</style>
@@ -12,10 +12,13 @@ export default class Checkbox extends SvelteComponent<{
12
12
  class?: string;
13
13
  name?: string;
14
14
  label?: string;
15
- checked?: string | boolean;
15
+ invalid?: boolean;
16
+ checked?: boolean | "mixed";
16
17
  disabled?: boolean;
17
- indeterminate?: boolean;
18
+ required?: boolean;
18
19
  value?: string;
20
+ hidden?: boolean;
21
+ readonly?: boolean;
19
22
  }, {
20
23
  change: CustomEvent<any>;
21
24
  } & {
@@ -32,12 +35,15 @@ declare const __propDef: {
32
35
  props: {
33
36
  [x: string]: any;
34
37
  class?: string;
35
- name?: string;
36
- label?: string | null;
37
- checked?: (boolean | string | undefined);
38
+ name?: string | undefined;
39
+ label?: string | undefined;
40
+ invalid?: boolean;
41
+ checked?: boolean | 'mixed';
38
42
  disabled?: boolean;
39
- indeterminate?: boolean;
40
- value?: string | null;
43
+ required?: boolean;
44
+ value?: string | undefined;
45
+ hidden?: boolean | undefined;
46
+ readonly?: boolean;
41
47
  };
42
48
  events: {
43
49
  change: CustomEvent<any>;
@@ -79,16 +79,6 @@
79
79
  const closeDialog = async () => {
80
80
  showDialog = false;
81
81
 
82
- if (dialog.returnValue === 'ok') {
83
- dispatch('ok');
84
- }
85
-
86
- if (dialog.returnValue === 'cancel') {
87
- dispatch('cancel');
88
- }
89
-
90
- dispatch('close', dialog.returnValue);
91
-
92
82
  await new Promise((resolve) => {
93
83
  form.addEventListener('transitionend', () => resolve(), { once: true });
94
84
  });
@@ -96,6 +86,12 @@
96
86
  showContent = false;
97
87
  dialog?.close();
98
88
  dialog?.remove();
89
+
90
+ if (['ok', 'cancel'].includes(dialog?.returnValue)) {
91
+ dispatch(dialog?.returnValue);
92
+ }
93
+
94
+ dispatch('close', dialog?.returnValue);
99
95
  };
100
96
 
101
97
  /**
@@ -111,9 +107,10 @@
111
107
  }
112
108
  };
113
109
 
114
- // Call the function only when the `open` prop is changed
115
- // @ts-ignore
116
- $: toggleDialog(open);
110
+ $: {
111
+ void open;
112
+ toggleDialog();
113
+ }
117
114
 
118
115
  onMount(() => {
119
116
  dialog.remove();
@@ -131,6 +128,7 @@
131
128
  bind:this={dialog}
132
129
  class="sui dialog {className} {size}"
133
130
  class:open={showDialog}
131
+ aria-label={title}
134
132
  {...$$restProps}
135
133
  on:click={({ target }) => {
136
134
  if (closeOnBackdropClick && /** @type {HTMLElement?} */ (target)?.matches('dialog')) {
@@ -159,7 +157,8 @@
159
157
  {/if}
160
158
  {#if showClose}
161
159
  <Button
162
- class="ghost iconic"
160
+ variant="ghost"
161
+ iconic
163
162
  on:click={() => {
164
163
  dialog.returnValue = 'close';
165
164
  open = false;
@@ -185,7 +184,7 @@
185
184
  <Spacer flex={true} />
186
185
  {#if showOk}
187
186
  <Button
188
- class="primary"
187
+ variant="primary"
189
188
  label={okLabel || $_('_sui.ok')}
190
189
  disabled={okDisabled}
191
190
  on:click={() => {
@@ -196,7 +195,7 @@
196
195
  {/if}
197
196
  {#if showCancel}
198
197
  <Button
199
- class="secondary"
198
+ variant="secondary"
200
199
  label={cancelLabel || $_('_sui.cancel')}
201
200
  disabled={cancelDisabled}
202
201
  on:click={() => {
@@ -247,6 +246,7 @@ dialog form {
247
246
  display: flex;
248
247
  flex-direction: column;
249
248
  border-radius: 4px;
249
+ max-width: calc(100vw - 32px);
250
250
  background-color: var(--sui-secondary-background-color-translucent);
251
251
  -webkit-backdrop-filter: blur(16px);
252
252
  backdrop-filter: blur(16px);
@@ -258,18 +258,38 @@ dialog.small form {
258
258
  width: 400px;
259
259
  max-height: 400px;
260
260
  }
261
+ @media (max-height: 400px) {
262
+ dialog.small form {
263
+ max-height: calc(100vh - 32px);
264
+ }
265
+ }
261
266
  dialog.medium form {
262
267
  width: 600px;
263
268
  max-height: 600px;
264
269
  }
270
+ @media (max-height: 600px) {
271
+ dialog.medium form {
272
+ max-height: calc(100vh - 32px);
273
+ }
274
+ }
265
275
  dialog.large form {
266
276
  width: 800px;
267
277
  max-height: 800px;
268
278
  }
279
+ @media (max-height: 800px) {
280
+ dialog.large form {
281
+ max-height: calc(100vh - 32px);
282
+ }
283
+ }
269
284
  dialog.x-large form {
270
285
  width: 1000px;
271
286
  max-height: 1000px;
272
287
  }
288
+ @media (max-height: 1000px) {
289
+ dialog.x-large form {
290
+ max-height: calc(100vh - 32px);
291
+ }
292
+ }
273
293
 
274
294
  .header,
275
295
  .footer {
@@ -23,8 +23,6 @@ export default class Dialog extends SvelteComponent<{
23
23
  closeOnBackdropClick?: boolean;
24
24
  }, {
25
25
  submit: SubmitEvent;
26
- ok: CustomEvent<any>;
27
- cancel: CustomEvent<any>;
28
26
  close: CustomEvent<any>;
29
27
  } & {
30
28
  [evt: string]: CustomEvent<any>;
@@ -59,8 +57,6 @@ declare const __propDef: {
59
57
  };
60
58
  events: {
61
59
  submit: SubmitEvent;
62
- ok: CustomEvent<any>;
63
- cancel: CustomEvent<any>;
64
60
  close: CustomEvent<any>;
65
61
  } & {
66
62
  [evt: string]: CustomEvent<any>;
@@ -4,47 +4,70 @@
4
4
  @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
5
5
  @see https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/
6
6
  -->
7
+ <svelte:options accessors={true} />
8
+
7
9
  <script>
10
+ import { getRandomId } from '../../services/util';
8
11
  import Button from '../button/button.svelte';
9
12
  import Icon from '../icon/icon.svelte';
10
- import { getRandomId } from '../util/util';
11
13
 
12
14
  /**
13
- * CSS class name on the button.
15
+ * The `class` attribute on the wrapper element.
14
16
  * @type {string}
15
17
  */
16
18
  let className = '';
17
-
18
19
  export { className as class };
19
-
20
- export let label = '';
21
-
20
+ /**
21
+ * Whether to hide the widget. An alias of the `aria-hidden` attribute.
22
+ * @type {boolean | undefined}
23
+ */
24
+ export let hidden = undefined;
25
+ /**
26
+ * Whether to disable the widget. An alias of the `aria-disabled` attribute.
27
+ * @type {boolean}
28
+ */
29
+ export let disabled = false;
30
+ /**
31
+ * Whether to show the content. An alias of the `aria-expanded` attribute.
32
+ * @type {boolean}
33
+ */
22
34
  export let expanded = false;
35
+ /**
36
+ * Text label displayed next to the expander.
37
+ * @type {string}
38
+ */
39
+ export let label = '';
23
40
 
24
41
  const id = getRandomId('disclosure');
25
42
  </script>
26
43
 
27
44
  <div
28
- class="sui disclosure {className}"
29
45
  {id}
46
+ class="sui disclosure {className}"
30
47
  role="group"
48
+ hidden={hidden || undefined}
49
+ aria-hidden={hidden}
50
+ aria-disabled={disabled}
31
51
  aria-labelledby="{id}-header"
32
52
  {...$$restProps}
33
53
  >
34
- <Button
35
- class="header"
36
- id="{id}-header"
37
- aria-controls="{id}-content"
38
- aria-expanded={expanded}
39
- on:click={() => {
40
- expanded = !expanded;
41
- }}
42
- >
43
- <Icon name="expand_more" />
44
- {label}
45
- </Button>
46
- <div class="content" id="{id}-content" hidden={!expanded ? true : undefined}>
47
- <slot />
54
+ <div class="inner" inert={disabled}>
55
+ <Button
56
+ class="header"
57
+ id="{id}-header"
58
+ {disabled}
59
+ aria-controls="{id}-content"
60
+ aria-expanded={expanded}
61
+ on:click={() => {
62
+ expanded = !expanded;
63
+ }}
64
+ >
65
+ <Icon name="expand_more" />
66
+ {label}
67
+ </Button>
68
+ <div class="content" id="{id}-content" hidden={!expanded}>
69
+ <slot />
70
+ </div>
48
71
  </div>
49
72
  </div>
50
73
 
@@ -60,6 +83,10 @@
60
83
  transform: rotate(-90deg);
61
84
  }
62
85
 
86
+ .inner {
87
+ display: contents;
88
+ }
89
+
63
90
  .content[hidden] {
64
91
  display: block;
65
92
  overflow: hidden;