@sveltia/ui 0.6.6 → 0.7.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 (97) hide show
  1. package/package/components/button/button.svelte +112 -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 +37 -17
  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 +13 -6
  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 +59 -29
  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 +120 -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 +63 -11
  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 +17 -15
  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 +42 -34
  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
@@ -4,39 +4,52 @@
4
4
  @see https://w3c.github.io/aria/#tablist
5
5
  @see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
6
6
  -->
7
- <svelte:options accessors={true} />
8
-
9
7
  <script>
10
- import { activateGroup } from '../util/group';
8
+ import { activateGroup } from '../../services/group';
11
9
 
12
10
  /**
13
- * CSS class name on the button.
11
+ * The `class` attribute on the wrapper element.
14
12
  * @type {string}
15
13
  */
16
14
  let className = '';
17
-
18
15
  export { className as class };
19
-
20
- /** @type {HTMLElement?} */
21
- export let element = undefined;
22
-
23
- /** @type {('horizontal'|'vertical')} */
16
+ /**
17
+ * Whether to hide the widget. An alias of the `aria-hidden` attribute.
18
+ * @type {boolean | undefined}
19
+ */
20
+ export let hidden = undefined;
21
+ /**
22
+ * Whether to disable the widget. An alias of the `aria-disabled` attribute.
23
+ * @type {boolean}
24
+ */
25
+ export let disabled = false;
26
+ /**
27
+ * Orientation of the widget. An alias of the `aria-orientation` attribute.
28
+ * @type {'horizontal' | 'vertical'}
29
+ */
24
30
  export let orientation = 'horizontal';
25
-
26
- export let name = '';
31
+ /**
32
+ * The `data-name` attribute on the wrapper element.
33
+ * @type {string | undefined}
34
+ */
35
+ export let name = undefined;
27
36
  </script>
28
37
 
29
38
  <div
30
39
  class="sui tab-list {className}"
31
40
  role="tablist"
41
+ hidden={hidden || undefined}
42
+ aria-hidden={hidden}
43
+ aria-disabled={disabled}
32
44
  aria-orientation={orientation}
33
45
  data-name={name || undefined}
34
46
  {...$$restProps}
35
- bind:this={element}
36
- on:select
37
47
  use:activateGroup
48
+ on:change
38
49
  >
39
- <slot />
50
+ <div class="inner" inert={disabled}>
51
+ <slot />
52
+ </div>
40
53
  </div>
41
54
 
42
55
  <style>.tab-list {
@@ -73,5 +86,9 @@
73
86
  height: var(--sui-tab-medium-height);
74
87
  }
75
88
  .tab-list :global(button[aria-selected="true"]) {
76
- border-color: var(--sui-primary-accent-color-lighter);
89
+ border-color: var(--sui-primary-accent-color-light);
90
+ }
91
+
92
+ .inner {
93
+ display: contents;
77
94
  }</style>
@@ -10,27 +10,16 @@ export default class TabList extends SvelteComponent<{
10
10
  [x: string]: any;
11
11
  class?: string;
12
12
  name?: string;
13
- element?: HTMLElement;
13
+ disabled?: boolean;
14
+ hidden?: boolean;
14
15
  orientation?: "vertical" | "horizontal";
15
16
  }, {
16
- select: Event;
17
+ change: Event;
17
18
  } & {
18
19
  [evt: string]: CustomEvent<any>;
19
20
  }, {
20
21
  default: {};
21
22
  }> {
22
- /**accessor*/
23
- set class(arg: string);
24
- get class(): string;
25
- /**accessor*/
26
- set element(arg: HTMLElement);
27
- get element(): HTMLElement;
28
- /**accessor*/
29
- set orientation(arg: "vertical" | "horizontal");
30
- get orientation(): "vertical" | "horizontal";
31
- /**accessor*/
32
- set name(arg: string);
33
- get name(): string;
34
23
  }
35
24
  export type TabListProps = typeof __propDef.props;
36
25
  export type TabListEvents = typeof __propDef.events;
@@ -40,12 +29,13 @@ declare const __propDef: {
40
29
  props: {
41
30
  [x: string]: any;
42
31
  class?: string;
43
- name?: string;
44
- element?: HTMLElement | null;
45
- orientation?: ('horizontal' | 'vertical');
32
+ name?: string | undefined;
33
+ disabled?: boolean;
34
+ hidden?: boolean | undefined;
35
+ orientation?: 'horizontal' | 'vertical';
46
36
  };
47
37
  events: {
48
- select: Event;
38
+ change: Event;
49
39
  } & {
50
40
  [evt: string]: CustomEvent<any>;
51
41
  };
@@ -6,11 +6,10 @@
6
6
  -->
7
7
  <script>
8
8
  /**
9
- * CSS class name on the button.
9
+ * The `class` attribute on the wrapper element.
10
10
  * @type {string}
11
11
  */
12
12
  let className = '';
13
-
14
13
  export { className as class };
15
14
  </script>
16
15
 
@@ -8,15 +8,37 @@
8
8
  import Button from '../button/button.svelte';
9
9
 
10
10
  /**
11
- * CSS class name on the button.
11
+ * The `class` attribute on the `<button>` element.
12
12
  * @type {string}
13
13
  */
14
14
  let className = '';
15
-
16
15
  export { className as class };
16
+ /**
17
+ * Whether to select the widget. An alias of the `aria-selected` attribute.
18
+ * @type {boolean}
19
+ */
20
+ export let selected = false;
21
+ /**
22
+ * Whether to hide the widget. An alias of the `aria-hidden` attribute.
23
+ * @type {boolean | undefined}
24
+ */
25
+ export let hidden = undefined;
26
+ /**
27
+ * Whether to disable the widget. An alias of the `aria-disabled` attribute.
28
+ * @type {boolean}
29
+ */
30
+ export let disabled = false;
17
31
  </script>
18
32
 
19
- <Button role="tab" class="sui tab {className}" {...$$restProps}>
33
+ <Button
34
+ class="sui tab {className}"
35
+ role="tab"
36
+ {hidden}
37
+ {disabled}
38
+ aria-selected={selected}
39
+ {...$$restProps}
40
+ on:select
41
+ >
20
42
  <slot name="start-icon" slot="start-icon" />
21
43
  <slot />
22
44
  <slot name="end-icon" slot="end-icon" />
@@ -9,7 +9,12 @@
9
9
  export default class Tab extends SvelteComponent<{
10
10
  [x: string]: any;
11
11
  class?: string;
12
+ disabled?: boolean;
13
+ hidden?: boolean;
14
+ selected?: boolean;
12
15
  }, {
16
+ select: Event;
17
+ } & {
13
18
  [evt: string]: CustomEvent<any>;
14
19
  }, {
15
20
  'start-icon': {
@@ -29,8 +34,13 @@ declare const __propDef: {
29
34
  props: {
30
35
  [x: string]: any;
31
36
  class?: string;
37
+ disabled?: boolean;
38
+ hidden?: boolean | undefined;
39
+ selected?: boolean;
32
40
  };
33
41
  events: {
42
+ select: Event;
43
+ } & {
34
44
  [evt: string]: CustomEvent<any>;
35
45
  };
36
46
  slots: {
@@ -10,10 +10,36 @@
10
10
  import Toolbar from '../toolbar/toolbar.svelte';
11
11
  import TextArea from './text-area.svelte';
12
12
 
13
- /** @type {string?} */
14
- export let value = undefined;
15
-
13
+ /**
14
+ * Whether to hide the widget. An alias of the `aria-hidden` attribute.
15
+ * @type {boolean | undefined}
16
+ */
17
+ export let hidden = undefined;
18
+ /**
19
+ * Whether to disable the widget. An alias of the `aria-disabled` attribute.
20
+ * @type {boolean}
21
+ */
16
22
  export let disabled = false;
23
+ /**
24
+ * Whether to disable the widget. An alias of `aria-readonly` attribute.
25
+ * @type {boolean}
26
+ */
27
+ export let readonly = false;
28
+ /**
29
+ * Whether to disable the widget. An alias of the `aria-required` attribute.
30
+ * @type {boolean}
31
+ */
32
+ export let required = false;
33
+ /**
34
+ * Whether to disable the widget. An alias of the `aria-invalid` attribute.
35
+ * @type {boolean}
36
+ */
37
+ export let invalid = false;
38
+ /**
39
+ * Input value.
40
+ * @type {string | undefined}
41
+ */
42
+ export let value = undefined;
17
43
 
18
44
  const defaultButtons = [
19
45
  { name: 'bold', label: $_('_sui.markdown_editor.bold'), icon: 'format_bold' },
@@ -46,37 +72,43 @@
46
72
  ];
47
73
  </script>
48
74
 
49
- <div>
50
- <Toolbar aria-label={$_('_sui.markdown_editor.markdown_editor')}>
51
- {#each defaultButtons as { label, icon, separator }}
52
- {#if separator}
53
- <Divider />
54
- {:else}
55
- <Button {disabled}>
56
- <Icon slot="start-icon" name={icon} {label} />
57
- </Button>
58
- {/if}
59
- {/each}
60
- </Toolbar>
61
- <TextArea autoResize={true} {disabled} bind:value />
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')}>
78
+ {#each defaultButtons as { label, icon, separator }}
79
+ {#if separator}
80
+ <Divider />
81
+ {:else}
82
+ <Button iconic {disabled}>
83
+ <Icon slot="start-icon" name={icon} {label} />
84
+ </Button>
85
+ {/if}
86
+ {/each}
87
+ </Toolbar>
88
+ <TextArea autoResize={true} bind:value {hidden} {disabled} {readonly} {required} {invalid} />
89
+ </div>
62
90
  </div>
63
91
 
64
- <style>div {
92
+ <style>.wrapper {
65
93
  display: contents;
66
94
  }
67
- div :global([role="toolbar"]) {
95
+ .wrapper :global([role="toolbar"]) {
68
96
  display: flex;
69
- gap: 8px;
97
+ gap: 0;
70
98
  border-radius: 4px 4px 0 0;
71
99
  padding: 8px;
72
100
  background-color: var(--sui-tertiary-background-color);
73
101
  }
74
- div :global([role="toolbar"]) :global(button) {
102
+ .wrapper :global([role="toolbar"]) :global(button) {
75
103
  flex: none;
76
104
  }
77
- div :global([role="toolbar"]) + :global(div) {
105
+ .wrapper :global([role="toolbar"]) + :global(div) {
78
106
  width: 100%;
79
107
  }
80
- div :global([role="toolbar"]) + :global(div) :global(textarea) {
108
+ .wrapper :global([role="toolbar"]) + :global(div) :global(textarea) {
81
109
  border-radius: 0 0 4px 4px !important;
110
+ }
111
+
112
+ .inner {
113
+ display: contents;
82
114
  }</style>
@@ -3,8 +3,13 @@
3
3
  /** @typedef {typeof __propDef.slots} MarkdownEditorSlots */
4
4
  /** A Markdown text editor. */
5
5
  export default class MarkdownEditor extends SvelteComponent<{
6
+ [x: string]: any;
7
+ invalid?: boolean;
6
8
  disabled?: boolean;
9
+ required?: boolean;
7
10
  value?: string;
11
+ hidden?: boolean;
12
+ readonly?: boolean;
8
13
  }, {
9
14
  [evt: string]: CustomEvent<any>;
10
15
  }, {}> {
@@ -15,8 +20,13 @@ export type MarkdownEditorSlots = typeof __propDef.slots;
15
20
  import { SvelteComponent } from "svelte";
16
21
  declare const __propDef: {
17
22
  props: {
23
+ [x: string]: any;
24
+ invalid?: boolean;
18
25
  disabled?: boolean;
19
- value?: string | null;
26
+ required?: boolean;
27
+ value?: string | undefined;
28
+ hidden?: boolean | undefined;
29
+ readonly?: boolean;
20
30
  };
21
31
  events: {
22
32
  [evt: string]: CustomEvent<any>;
@@ -11,25 +11,65 @@
11
11
  import TextInput from './text-input.svelte';
12
12
 
13
13
  /**
14
- * CSS class name on the button.
14
+ * The `class` attribute on the wrapper element.
15
15
  * @type {string}
16
16
  */
17
17
  let className = '';
18
-
19
18
  export { className as class };
20
-
21
- /** @type {string?} */
22
- export let value = undefined;
23
-
19
+ /**
20
+ * Whether to hide the widget. An alias of the `aria-hidden` attribute.
21
+ * @type {boolean | undefined}
22
+ */
23
+ export let hidden = undefined;
24
+ /**
25
+ * Whether to disable the widget. An alias of the `aria-disabled` attribute.
26
+ * @type {boolean}
27
+ */
24
28
  export let disabled = false;
29
+ /**
30
+ * Whether to disable the widget. An alias of `aria-readonly` attribute.
31
+ * @type {boolean}
32
+ */
33
+ export let readonly = false;
34
+ /**
35
+ * Whether to disable the widget. An alias of the `aria-required` attribute.
36
+ * @type {boolean}
37
+ */
38
+ export let required = false;
39
+ /**
40
+ * Whether to disable the widget. An alias of the `aria-invalid` attribute.
41
+ * @type {boolean}
42
+ */
43
+ export let invalid = false;
44
+ /**
45
+ * Input value.
46
+ * @type {string | undefined}
47
+ */
48
+ export let value = undefined;
49
+ /**
50
+ * Minimum allowed value.
51
+ * @type {number | undefined}
52
+ */
25
53
  export let min = undefined;
54
+ /**
55
+ * Maximum allowed value.
56
+ * @type {number | undefined}
57
+ */
26
58
  export let max = undefined;
59
+ /**
60
+ * Value to be added or removed when using the up/down arrow key or button.
61
+ */
27
62
  export let step = 1;
28
63
 
29
64
  $: maximumFractionDigits = String(step).split('.')[1]?.length || 0;
30
65
  $: isMin = typeof min === 'number' && Number(value || 0) <= min;
31
66
  $: isMax = typeof max === 'number' && Number(value || 0) >= max;
32
67
 
68
+ $: invalid =
69
+ (value !== undefined && Number.isNaN(Number(value))) ||
70
+ (typeof min === 'number' && Number(value || 0) < min) ||
71
+ (typeof max === 'number' && Number(value || 0) > max);
72
+
33
73
  let component;
34
74
 
35
75
  /**
@@ -55,14 +95,19 @@
55
95
  };
56
96
  </script>
57
97
 
58
- <div class="sui number-input {className}">
98
+ <div class="sui number-input {className}" class:disabled hidden={hidden || undefined}>
59
99
  <TextInput
60
100
  bind:this={component}
61
101
  bind:value
62
- {disabled}
63
102
  role="spinbutton"
103
+ {hidden}
104
+ {disabled}
105
+ {readonly}
106
+ {required}
107
+ {invalid}
64
108
  aria-valuenow={Number(value || 0)}
65
- aria-invalid={value !== undefined && Number.isNaN(Number(value))}
109
+ aria-valuemin={min}
110
+ aria-valuemax={max}
66
111
  {...$$restProps}
67
112
  on:keydown={(event) => {
68
113
  const { key, ctrlKey, metaKey, altKey, shiftKey } = event;
@@ -82,7 +127,7 @@
82
127
  on:input
83
128
  />
84
129
  <Button
85
- class="iconic"
130
+ iconic
86
131
  disabled={disabled || Number.isNaN(Number(value)) || isMin}
87
132
  on:click={() => {
88
133
  decrease();
@@ -91,7 +136,7 @@
91
136
  <Icon slot="start-icon" name="arrow_downward" label={$_('_sui.number_input.decrease')} />
92
137
  </Button>
93
138
  <Button
94
- class="iconic"
139
+ iconic
95
140
  disabled={disabled || Number.isNaN(Number(value)) || isMax}
96
141
  on:click={() => {
97
142
  increase();
@@ -107,14 +152,14 @@
107
152
  align-items: center;
108
153
  }
109
154
  .number-input :global(input) {
110
- border-radius: 4px 0 0 4px;
155
+ border-top-right-radius: 0;
156
+ border-bottom-right-radius: 0;
111
157
  }
112
158
  .number-input :global(button) {
113
159
  flex: none;
114
160
  border-width: 1px;
115
- border-color: var(--sui-control-border-color);
116
- width: 32px;
117
- height: var(--sui-textbox-medium-height);
161
+ border-color: var(--sui-textbox-border-color);
162
+ width: var(--sui-textbox-height);
118
163
  }
119
164
  .number-input :global(button):first-of-type {
120
165
  border-radius: 0;
@@ -125,4 +170,10 @@
125
170
  }
126
171
  .number-input :global(button) :global(.icon) {
127
172
  font-size: var(--sui-font-size-xx-large);
173
+ }
174
+ .number-input:not(.disabled) :global(button[aria-disabled="true"]) {
175
+ filter: grayscale(0) opacity(1);
176
+ }
177
+ .number-input:not(.disabled) :global(button[aria-disabled="true"]) :global(*) {
178
+ filter: grayscale(1) opacity(0.35);
128
179
  }</style>
@@ -9,11 +9,15 @@
9
9
  export default class NumberInput extends SvelteComponent<{
10
10
  [x: string]: any;
11
11
  class?: string;
12
+ invalid?: boolean;
12
13
  disabled?: boolean;
13
- max?: any;
14
- min?: any;
14
+ max?: number;
15
+ min?: number;
16
+ required?: boolean;
15
17
  step?: number;
16
18
  value?: string;
19
+ hidden?: boolean;
20
+ readonly?: boolean;
17
21
  }, {
18
22
  keypress: KeyboardEvent;
19
23
  input: Event;
@@ -29,11 +33,15 @@ declare const __propDef: {
29
33
  props: {
30
34
  [x: string]: any;
31
35
  class?: string;
36
+ invalid?: boolean;
32
37
  disabled?: boolean;
33
- max?: any;
34
- min?: any;
38
+ max?: number | undefined;
39
+ min?: number | undefined;
40
+ required?: boolean;
35
41
  step?: number;
36
- value?: string | null;
42
+ value?: string | undefined;
43
+ hidden?: boolean | undefined;
44
+ readonly?: boolean;
37
45
  };
38
46
  events: {
39
47
  keypress: KeyboardEvent;
@@ -12,14 +12,40 @@
12
12
  import TextInput from './text-input.svelte';
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?} */
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 disable the widget. An alias of `aria-readonly` attribute.
32
+ * @type {boolean}
33
+ */
34
+ export let readonly = false;
35
+ /**
36
+ * Whether to disable the widget. An alias of the `aria-required` attribute.
37
+ * @type {boolean}
38
+ */
39
+ export let required = false;
40
+ /**
41
+ * Whether to disable the widget. An alias of the `aria-invalid` attribute.
42
+ * @type {boolean}
43
+ */
44
+ export let invalid = false;
45
+ /**
46
+ * Input value.
47
+ * @type {string | undefined}
48
+ */
23
49
  export let value = undefined;
24
50
 
25
51
  /**
@@ -35,18 +61,24 @@
35
61
  }
36
62
  </script>
37
63
 
38
- <div class="sui password-input {className}">
64
+ <div class="sui password-input {className}" class:disabled hidden={hidden || undefined}>
39
65
  <TextInput
40
66
  bind:this={inputComponent}
41
67
  bind:value
42
68
  type="password"
69
+ {hidden}
70
+ {disabled}
71
+ {readonly}
72
+ {required}
73
+ {invalid}
43
74
  {...$$restProps}
44
75
  on:input
45
76
  on:keypress
46
77
  on:change
47
78
  />
48
79
  <Button
49
- class="iconic"
80
+ iconic
81
+ {disabled}
50
82
  pressed={passwordVisible}
51
83
  on:click={() => {
52
84
  passwordVisible = !passwordVisible;
@@ -66,14 +98,15 @@
66
98
  align-items: center;
67
99
  }
68
100
  .password-input :global(input) {
69
- border-radius: 4px 0 0 4px;
101
+ border-top-right-radius: 0;
102
+ border-bottom-right-radius: 0;
70
103
  }
71
104
  .password-input :global(button) {
72
105
  flex: none;
73
106
  margin-left: -1px;
74
107
  border-width: 1px;
75
- border-color: var(--sui-control-border-color);
76
- height: var(--sui-textbox-medium-height);
108
+ border-color: var(--sui-textbox-border-color);
109
+ width: var(--sui-textbox-height);
77
110
  aspect-ratio: 1/1;
78
111
  }
79
112
  .password-input :global(button):last-child {
@@ -10,7 +10,12 @@
10
10
  export default class PasswordInput extends SvelteComponent<{
11
11
  [x: string]: any;
12
12
  class?: string;
13
+ invalid?: boolean;
14
+ disabled?: boolean;
15
+ required?: boolean;
13
16
  value?: string;
17
+ hidden?: boolean;
18
+ readonly?: boolean;
14
19
  }, {
15
20
  input: Event;
16
21
  keypress: KeyboardEvent;
@@ -27,7 +32,12 @@ declare const __propDef: {
27
32
  props: {
28
33
  [x: string]: any;
29
34
  class?: string;
30
- value?: string | null;
35
+ invalid?: boolean;
36
+ disabled?: boolean;
37
+ required?: boolean;
38
+ value?: string | undefined;
39
+ hidden?: boolean | undefined;
40
+ readonly?: boolean;
31
41
  };
32
42
  events: {
33
43
  input: Event;