svelte-multistyle-ui 0.0.16-alpha → 0.1.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 (75) hide show
  1. package/README.md +4 -4
  2. package/cli/emit.js +9 -4
  3. package/cli/fixtures/sample.expected.svelte +2 -1
  4. package/cli/generate.js +5 -2
  5. package/cli/schema.js +16 -0
  6. package/dist/actions/dialog.js +13 -3
  7. package/dist/components/Accordion.svelte +7 -4
  8. package/dist/components/Alert.svelte +6 -3
  9. package/dist/components/Avatar.svelte +6 -3
  10. package/dist/components/Breadcrumb.svelte +6 -3
  11. package/dist/components/Button.svelte +6 -3
  12. package/dist/components/ButtonGroup.svelte +6 -3
  13. package/dist/components/Card.svelte +6 -3
  14. package/dist/components/Carousel.svelte +6 -3
  15. package/dist/components/Checkbox.svelte +6 -3
  16. package/dist/components/Chip.svelte +6 -3
  17. package/dist/components/CodeEditor.svelte +10 -4
  18. package/dist/components/Column.svelte +8 -1
  19. package/dist/components/CommandPalette.svelte +6 -3
  20. package/dist/components/CrudView.svelte +68 -28
  21. package/dist/components/DatePicker.svelte +20 -6
  22. package/dist/components/Divider.svelte +6 -3
  23. package/dist/components/Drawer.svelte +14 -3
  24. package/dist/components/DropdownMenu.svelte +6 -3
  25. package/dist/components/FAB.svelte +6 -3
  26. package/dist/components/FileUpload.svelte +17 -4
  27. package/dist/components/FilterBar.svelte +24 -14
  28. package/dist/components/GraphEditor.svelte +4 -3
  29. package/dist/components/Grid.svelte +8 -1
  30. package/dist/components/IconButton.svelte +6 -3
  31. package/dist/components/InlineEdit.svelte +6 -3
  32. package/dist/components/Input.svelte +14 -3
  33. package/dist/components/Modal.svelte +8 -4
  34. package/dist/components/Pagination.svelte +11 -3
  35. package/dist/components/Popover.svelte +12 -4
  36. package/dist/components/ProgressBar.svelte +6 -3
  37. package/dist/components/Radio.svelte +6 -3
  38. package/dist/components/Rating.svelte +10 -6
  39. package/dist/components/Row.svelte +8 -1
  40. package/dist/components/Select.svelte +9 -4
  41. package/dist/components/Skeleton.svelte +6 -3
  42. package/dist/components/Slider.svelte +8 -4
  43. package/dist/components/SortableList.svelte +6 -3
  44. package/dist/components/Spinner.svelte +6 -3
  45. package/dist/components/Stepper.svelte +9 -4
  46. package/dist/components/Table.svelte +6 -3
  47. package/dist/components/Tabs.svelte +8 -4
  48. package/dist/components/TextEditor.svelte +6 -3
  49. package/dist/components/Textarea.svelte +20 -6
  50. package/dist/components/Toast.svelte +8 -5
  51. package/dist/components/Toggle.svelte +6 -3
  52. package/dist/components/Tooltip.svelte +11 -4
  53. package/dist/components/charts/Chart.svelte +32 -21
  54. package/dist/components/charts/MermaidChart.svelte +14 -4
  55. package/dist/components/charts/chart-config.d.ts +3 -3
  56. package/dist/components/charts/chart-config.js +8 -0
  57. package/dist/components/charts/index.d.ts +12 -0
  58. package/dist/components/charts/index.js +12 -0
  59. package/dist/components/checkbox-styles.css +2 -2
  60. package/dist/components/crudview-styles.css +2 -2
  61. package/dist/components/radio-styles.css +2 -2
  62. package/dist/components/slider-styles.css +2 -2
  63. package/dist/components/text-editor-core/sanitizer.js +11 -3
  64. package/dist/components/theme.css +59 -49
  65. package/dist/components/toast-styles.css +8 -8
  66. package/dist/components/toggle-styles.css +3 -3
  67. package/dist/config.d.ts +1 -1
  68. package/dist/config.js +1 -1
  69. package/dist/config.svelte.js +11 -1
  70. package/dist/index.d.ts +0 -12
  71. package/dist/index.js +2 -13
  72. package/dist/themes/generator.js +1 -1
  73. package/dist/themes/presets.js +6 -6
  74. package/dist/utils/filter.js +8 -4
  75. package/package.json +11 -3
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import { tick } from "svelte";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
  import "./input-styles.css";
6
6
  import "./textarea-styles.css";
@@ -32,8 +32,11 @@
32
32
  class: className = "",
33
33
  } = $props();
34
34
 
35
- const style = $derived(styleProp ?? defaults.style);
36
- const theme = $derived(themeProp ?? defaults.theme);
35
+ const _cfg = getMultistyleDefaults();
36
+
37
+
38
+ const style = $derived(styleProp ?? _cfg.style);
39
+ const theme = $derived(themeProp ?? _cfg.theme);
37
40
  const multiline = $derived(variant === "multiline");
38
41
  const form = $derived(multiline ? "s-textarea" : "s-input");
39
42
  const formClasses = $derived(style === "liquid-glass" ? "" : `${form}-wrapper ${form}-${style} focused`);
@@ -1,7 +1,7 @@
1
1
  <script>
2
2
  import "./input-styles.css";
3
3
  import "./liquid-glass-field.css";
4
- import { defaults, iconClass } from "../config.js";
4
+ import { getMultistyleDefaults, iconClass } from "../config.js";
5
5
  import { cn } from "../utils/cn.js";
6
6
 
7
7
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -38,12 +38,17 @@
38
38
  form = undefined,
39
39
  inputmode = undefined,
40
40
  spellcheck = undefined,
41
+ helperText = "",
42
+ error = "",
41
43
  class: className = "",
42
44
  ...rest
43
45
  } = $props();
44
46
 
45
- const style = $derived(styleProp ?? defaults.style);
46
- const theme = $derived(themeProp ?? defaults.theme);
47
+ const _cfg = getMultistyleDefaults();
48
+
49
+
50
+ const style = $derived(styleProp ?? _cfg.style);
51
+ const theme = $derived(themeProp ?? _cfg.theme);
47
52
 
48
53
  let focused = $state(false);
49
54
  let hasValue = $derived(
@@ -102,6 +107,7 @@
102
107
  {readonly}
103
108
  {required}
104
109
  {name}
110
+ aria-invalid={error ? true : undefined}
105
111
  id={internalId}
106
112
  {min}
107
113
  {max}
@@ -128,4 +134,9 @@
128
134
  <span class="s-input-icon s-input-icon-end {iconClass}">{iconEnd}</span>
129
135
  {/if}
130
136
  </div>
137
+ {#if error}
138
+ <span class="s-field-error" style="display:block;font-size:12px;color:var(--t-error,#ef4444);margin-top:4px;">{error}</span>
139
+ {:else if helperText}
140
+ <span class="s-field-helper" style="display:block;font-size:12px;color:var(--t-text-hint);margin-top:4px;">{helperText}</span>
141
+ {/if}
131
142
  </div>
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./modal-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { fade, scale } from "svelte/transition";
5
5
  import { portal } from "../actions/portal.js";
6
6
  import { dialog } from "../actions/dialog.js";
@@ -17,12 +17,16 @@
17
17
  size = "medium",
18
18
  children,
19
19
  onclose,
20
+ onclick: onclickProp,
20
21
  class: className = "",
21
22
  ...rest
22
23
  } = $props();
23
24
 
24
- const style = $derived(styleProp ?? defaults.style);
25
- const theme = $derived(themeProp ?? defaults.theme);
25
+ const _cfg = getMultistyleDefaults();
26
+
27
+
28
+ const style = $derived(styleProp ?? _cfg.style);
29
+ const theme = $derived(themeProp ?? _cfg.theme);
26
30
 
27
31
  const styleClass = $derived(`s-modal-${style}`);
28
32
  const themeClass = $derived(`theme-${theme}`);
@@ -44,7 +48,7 @@
44
48
  use:dialog={{ onclose: handleClose }}
45
49
  class={cn("s-modal-overlay", styleClass, themeClass, className)}
46
50
  transition:fade={{ duration: 200 }}
47
- onclick={handleBackdrop}
51
+ onclick={(e) => { handleBackdrop(e); onclickProp?.(e); }}
48
52
  role="dialog"
49
53
  aria-modal="true"
50
54
  {...rest}
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./pagination-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
 
6
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -16,14 +16,22 @@
16
16
  ...rest
17
17
  } = $props();
18
18
 
19
- const style = $derived(styleProp ?? defaults.style);
20
- const theme = $derived(themeProp ?? defaults.theme);
19
+ const _cfg = getMultistyleDefaults();
20
+
21
+
22
+ const style = $derived(styleProp ?? _cfg.style);
23
+ const theme = $derived(themeProp ?? _cfg.theme);
21
24
 
22
25
  const styleClass = $derived(`s-pagination-${style}`);
23
26
  const themeClass = $derived(`theme-${theme}`);
24
27
  const safePerPage = $derived(Math.max(1, Number(perPage) || 1));
25
28
  const totalPages = $derived(Math.max(0, Math.ceil(total / safePerPage)));
26
29
 
30
+ $effect(() => {
31
+ if (totalPages > 0 && current > totalPages) current = totalPages;
32
+ else if (current < 1) current = 1;
33
+ });
34
+
27
35
  const pages = $derived(() => {
28
36
  const p = [];
29
37
  for (let i = 1; i <= totalPages; i++) p.push(i);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./popover-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { fly } from "svelte/transition";
5
5
  import { cn } from "../utils/cn.js";
6
6
 
@@ -19,11 +19,16 @@
19
19
  ...rest
20
20
  } = $props();
21
21
 
22
- const style = $derived(styleProp ?? defaults.style);
23
- const theme = $derived(themeProp ?? defaults.theme);
22
+ const _cfg = getMultistyleDefaults();
23
+
24
+
25
+ const style = $derived(styleProp ?? _cfg.style);
26
+ const theme = $derived(themeProp ?? _cfg.theme);
24
27
  const styleClass = $derived(`s-popover-${style}`);
25
28
  const themeClass = $derived(`theme-${theme}`);
26
29
 
30
+ const uid = $props.id();
31
+ const popoverId = `popover-${uid}`;
27
32
  let popoverEl = $state(null);
28
33
  let triggerEl = $state(null);
29
34
  let isOpen = $state(false);
@@ -86,9 +91,11 @@
86
91
  bind:this={triggerEl}
87
92
  class="s-popover-trigger"
88
93
  onclick={toggle}
89
- onkeydown={(e) => { if (e.key === "Enter" || e.key === " ") toggle(); }}
94
+ onkeydown={(e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); toggle(); } }}
90
95
  role="button"
91
96
  tabindex="0"
97
+ aria-haspopup="dialog"
98
+ aria-controls={popoverId}
92
99
  aria-expanded={effectiveOpen}
93
100
  >
94
101
  {@render children?.()}
@@ -97,6 +104,7 @@
97
104
  {#if effectiveOpen}
98
105
  <div
99
106
  bind:this={popoverEl}
107
+ id={popoverId}
100
108
  class="s-popover popover-{position}"
101
109
  transition:fly={{
102
110
  y: position === "bottom" ? -8 : position === "top" ? 8 : 0,
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./progressbar-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
 
6
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -17,8 +17,11 @@
17
17
  ...rest
18
18
  } = $props();
19
19
 
20
- const style = $derived(styleProp ?? defaults.style);
21
- const theme = $derived(themeProp ?? defaults.theme);
20
+ const _cfg = getMultistyleDefaults();
21
+
22
+
23
+ const style = $derived(styleProp ?? _cfg.style);
24
+ const theme = $derived(themeProp ?? _cfg.theme);
22
25
 
23
26
  const styleClass = $derived(`s-progressbar-${style}`);
24
27
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./radio-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
 
6
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -17,8 +17,11 @@
17
17
  ...rest
18
18
  } = $props();
19
19
 
20
- const style = $derived(styleProp ?? defaults.style);
21
- const theme = $derived(themeProp ?? defaults.theme);
20
+ const _cfg = getMultistyleDefaults();
21
+
22
+
23
+ const style = $derived(styleProp ?? _cfg.style);
24
+ const theme = $derived(themeProp ?? _cfg.theme);
22
25
 
23
26
  let isSelected = $derived(group === value);
24
27
 
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./rating-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
 
6
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -19,8 +19,11 @@
19
19
  ...rest
20
20
  } = $props();
21
21
 
22
- const style = $derived(styleProp ?? defaults.style);
23
- const theme = $derived(themeProp ?? defaults.theme);
22
+ const _cfg = getMultistyleDefaults();
23
+
24
+
25
+ const style = $derived(styleProp ?? _cfg.style);
26
+ const theme = $derived(themeProp ?? _cfg.theme);
24
27
  const styleClass = $derived(`s-rating-${style}`);
25
28
  const themeClass = $derived(`theme-${theme}`);
26
29
  const stars = $derived(Array.from({ length: max }, (_, i) => i + 1));
@@ -69,9 +72,10 @@
69
72
 
70
73
  function handleStarKeydown(e, star) {
71
74
  if (readonly) return;
75
+ const step = precision === "half" ? 0.5 : 1;
72
76
  let next = null;
73
- if (e.key === "ArrowRight" || e.key === "ArrowUp") next = Math.min(max, (value || 0) + 1);
74
- else if (e.key === "ArrowLeft" || e.key === "ArrowDown") next = Math.max(1, (value || 1) - 1);
77
+ if (e.key === "ArrowRight" || e.key === "ArrowUp") next = Math.min(max, (value || 0) + step);
78
+ else if (e.key === "ArrowLeft" || e.key === "ArrowDown") next = Math.max(0, (value || 0) - step);
75
79
  else if (e.key === "Home") next = 1;
76
80
  else if (e.key === "End") next = max;
77
81
  else if (e.key === "Enter" || e.key === " ") next = star;
@@ -108,7 +112,7 @@
108
112
  <svg width="100%" height="100%" viewBox="0 0 24 24" style="clip-path:inset(0 50% 0 0)" fill="currentColor">
109
113
  <path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" />
110
114
  </svg>
111
- <svg width="100%" height="100%" viewBox="0 0 24 24" style="clip-path:inset(0 0 0 50%);position:absolute;top:0;left:0" fill="color-mix(in srgb, #eab308 30%, transparent 70%)">
115
+ <svg width="100%" height="100%" viewBox="0 0 24 24" style="clip-path:inset(0 0 0 50%);position:absolute;top:0;left:0" fill="color-mix(in srgb, var(--t-warning, #eab308) 30%, transparent)">
112
116
  <path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" />
113
117
  </svg>
114
118
  {:else}
@@ -1,11 +1,14 @@
1
1
  <script>
2
2
  import "./row-styles.css";
3
+ import { getMultistyleDefaults } from "../config.js";
3
4
  import { cn } from "../utils/cn.js";
4
5
 
5
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
6
7
 
7
8
 
8
9
  let {
10
+ style: styleProp,
11
+ theme: themeProp,
9
12
  gap = "8px",
10
13
  align = "stretch",
11
14
  justify = "start",
@@ -33,11 +36,15 @@
33
36
  evenly: "space-evenly",
34
37
  };
35
38
 
39
+ const _cfg = getMultistyleDefaults();
40
+ const style = $derived(styleProp ?? _cfg.style);
41
+ const theme = $derived(themeProp ?? _cfg.theme);
42
+
36
43
  const styleStr = $derived(
37
44
  `display:flex;flex-direction:row;gap:${gap};align-items:${alignItems[align] ?? align};justify-content:${justifyContent[justify] ?? justify};${fill ? "width:100%;" : ""}${wrap ? "flex-wrap:wrap;" : ""}`
38
45
  );
39
46
  </script>
40
47
 
41
- <div class={cn("s-row", className)} style={styleStr} {...rest}>
48
+ <div class={cn("s-row", `s-row-${style}`, `theme-${theme}`, className)} style={styleStr} {...rest}>
42
49
  {@render children?.()}
43
50
  </div>
@@ -1,7 +1,7 @@
1
1
  <script>
2
2
  import "./select-styles.css";
3
3
  import { portal } from "../actions/portal.js";
4
- import { defaults } from "../config.js";
4
+ import { getMultistyleDefaults } from "../config.js";
5
5
  import { cn } from "../utils/cn.js";
6
6
 
7
7
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -24,8 +24,11 @@
24
24
  ...rest
25
25
  } = $props();
26
26
 
27
- const style = $derived(styleProp ?? defaults.style);
28
- const theme = $derived(themeProp ?? defaults.theme);
27
+ const _cfg = getMultistyleDefaults();
28
+
29
+
30
+ const style = $derived(styleProp ?? _cfg.style);
31
+ const theme = $derived(themeProp ?? _cfg.theme);
29
32
 
30
33
  const isMultiple = $derived(multiple === true || multiple === "true" || multiple === "");
31
34
  const isSearchable = $derived(
@@ -165,7 +168,9 @@
165
168
  } else if (e.key === "Enter" || e.key === " ") {
166
169
  e.preventDefault();
167
170
  if (open && highlightedIndex >= 0 && highlightedIndex < filteredOptions.length) {
168
- selectOption(filteredOptions[highlightedIndex]);
171
+ const opt = filteredOptions[highlightedIndex];
172
+ const optVal = opt && typeof opt === "object" ? opt.value : opt;
173
+ if (multiple) toggleMulti(optVal); else selectSingle(optVal);
169
174
  } else {
170
175
  open = !open;
171
176
  focused = true;
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./skeleton-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
 
6
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -16,8 +16,11 @@
16
16
  ...rest
17
17
  } = $props();
18
18
 
19
- const style = $derived(styleProp ?? defaults.style);
20
- const theme = $derived(themeProp ?? defaults.theme);
19
+ const _cfg = getMultistyleDefaults();
20
+
21
+
22
+ const style = $derived(styleProp ?? _cfg.style);
23
+ const theme = $derived(themeProp ?? _cfg.theme);
21
24
 
22
25
  const styleClass = $derived(`s-skeleton-${style}`);
23
26
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./slider-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
 
6
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -19,12 +19,16 @@
19
19
  ...rest
20
20
  } = $props();
21
21
 
22
- const style = $derived(styleProp ?? defaults.style);
23
- const theme = $derived(themeProp ?? defaults.theme);
22
+ const _cfg = getMultistyleDefaults();
23
+
24
+
25
+ const style = $derived(styleProp ?? _cfg.style);
26
+ const theme = $derived(themeProp ?? _cfg.theme);
24
27
 
25
28
  const styleClass = $derived(`s-slider-${style}`);
26
29
  const themeClass = $derived(`theme-${theme}`);
27
- const inputId = `slider-${$props.id()}`;
30
+ const uid = $props.id();
31
+ const inputId = `slider-${uid}`;
28
32
  const percent = $derived(max === min ? 0 : ((value - min) / (max - min)) * 100);
29
33
  </script>
30
34
 
@@ -1,7 +1,7 @@
1
1
  <script>
2
2
  import { draggable, droppable } from '@thisux/sveltednd';
3
3
  import "./sortablelist-styles.css";
4
- import { defaults } from "../config.js";
4
+ import { getMultistyleDefaults } from "../config.js";
5
5
  import { cn } from "../utils/cn.js";
6
6
 
7
7
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -18,8 +18,11 @@
18
18
  children
19
19
  } = $props();
20
20
 
21
- const style = $derived(styleProp ?? defaults.style);
22
- const theme = $derived(themeProp ?? defaults.theme);
21
+ const _cfg = getMultistyleDefaults();
22
+
23
+
24
+ const style = $derived(styleProp ?? _cfg.style);
25
+ const theme = $derived(themeProp ?? _cfg.theme);
23
26
 
24
27
  const styleClass = $derived(`s-sortablelist-${style}`);
25
28
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./spinner-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
 
6
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -14,8 +14,11 @@
14
14
  ...rest
15
15
  } = $props();
16
16
 
17
- const style = $derived(styleProp ?? defaults.style);
18
- const theme = $derived(themeProp ?? defaults.theme);
17
+ const _cfg = getMultistyleDefaults();
18
+
19
+
20
+ const style = $derived(styleProp ?? _cfg.style);
21
+ const theme = $derived(themeProp ?? _cfg.theme);
19
22
 
20
23
  const styleClass = $derived(`s-spinner-${style}`);
21
24
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./stepper-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
 
6
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -15,8 +15,11 @@
15
15
  ...rest
16
16
  } = $props();
17
17
 
18
- const style = $derived(styleProp ?? defaults.style);
19
- const theme = $derived(themeProp ?? defaults.theme);
18
+ const _cfg = getMultistyleDefaults();
19
+
20
+
21
+ const style = $derived(styleProp ?? _cfg.style);
22
+ const theme = $derived(themeProp ?? _cfg.theme);
20
23
 
21
24
  const styleClass = $derived(`s-stepper-${style}`);
22
25
  const themeClass = $derived(`theme-${theme}`);
@@ -63,12 +66,14 @@
63
66
  </script>
64
67
 
65
68
  <div class={cn("s-stepper-wrap", className)}>
66
- <div class="s-stepper {styleClass} {themeClass}" bind:this={el} {...rest}>
69
+ <div class="s-stepper {styleClass} {themeClass}" role="list" bind:this={el} {...rest}>
67
70
  {#each steps as step, i}
68
71
  <div
69
72
  class="s-stepper-step"
70
73
  class:completed={i < current}
71
74
  class:active={i === current}
75
+ role="listitem"
76
+ aria-current={i === current ? "step" : undefined}
72
77
  >
73
78
  <div class="s-stepper-circle">{i + 1}</div>
74
79
  <span class="s-stepper-label">{step.label}</span>
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./table-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
 
6
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -16,8 +16,11 @@
16
16
  ...rest
17
17
  } = $props();
18
18
 
19
- const style = $derived(styleProp ?? defaults.style);
20
- const theme = $derived(themeProp ?? defaults.theme);
19
+ const _cfg = getMultistyleDefaults();
20
+
21
+
22
+ const style = $derived(styleProp ?? _cfg.style);
23
+ const theme = $derived(themeProp ?? _cfg.theme);
21
24
 
22
25
  const styleClass = $derived(`s-table-${style}`);
23
26
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./tabs-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
 
6
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -15,11 +15,15 @@
15
15
  ...rest
16
16
  } = $props();
17
17
 
18
- const style = $derived(styleProp ?? defaults.style);
19
- const theme = $derived(themeProp ?? defaults.theme);
18
+ const _cfg = getMultistyleDefaults();
19
+
20
+
21
+ const style = $derived(styleProp ?? _cfg.style);
22
+ const theme = $derived(themeProp ?? _cfg.theme);
20
23
 
21
24
  const styleClass = $derived(`s-tabs-${style}`);
22
25
  const themeClass = $derived(`theme-${theme}`);
26
+ const hasActiveMatch = $derived(tabs.some((t) => t.id === active));
23
27
 
24
28
  function handleTabKeydown(e, idx) {
25
29
  if (!tabs || tabs.length === 0) return;
@@ -38,7 +42,7 @@
38
42
 
39
43
  <div class={cn("s-tabs", styleClass, themeClass, className)} role="tablist" {...rest}>
40
44
  {#each tabs as tab, idx}
41
- {@const isActive = active === tab.id || (!active && idx === 0)}
45
+ {@const isActive = active === tab.id || (!hasActiveMatch && idx === 0)}
42
46
  <button type="button"
43
47
  class="s-tab"
44
48
  class:active={active === tab.id}
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./texteditor-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
  import { onMount, onDestroy } from "svelte";
6
6
  import { TextEditorCore } from "./text-editor-core/index.js";
@@ -25,8 +25,11 @@
25
25
  ...rest
26
26
  } = $props();
27
27
 
28
- const style = $derived(styleProp ?? defaults.style);
29
- const theme = $derived(themeProp ?? defaults.theme);
28
+ const _cfg = getMultistyleDefaults();
29
+
30
+
31
+ const style = $derived(styleProp ?? _cfg.style);
32
+ const theme = $derived(themeProp ?? _cfg.theme);
30
33
 
31
34
  const styleClass = $derived(`s-texteditor-${style}`);
32
35
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./textarea-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
 
6
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
@@ -17,13 +17,20 @@
17
17
  disabled = false,
18
18
  readonly = false,
19
19
  required = false,
20
+ id = "",
20
21
  autoresize = false,
22
+ helperText = "",
23
+ error = "",
24
+ oninput: oninputProp,
21
25
  class: className = "",
22
26
  ...rest
23
27
  } = $props();
24
28
 
25
- const style = $derived(styleProp ?? defaults.style);
26
- const theme = $derived(themeProp ?? defaults.theme);
29
+ const _cfg = getMultistyleDefaults();
30
+
31
+
32
+ const style = $derived(styleProp ?? _cfg.style);
33
+ const theme = $derived(themeProp ?? _cfg.theme);
27
34
 
28
35
  let focused = $state(false);
29
36
  let hasValue = $derived(
@@ -54,6 +61,7 @@
54
61
  e.target.style.height = "auto";
55
62
  e.target.style.height = e.target.scrollHeight + "px";
56
63
  }
64
+ oninputProp?.(e);
57
65
  }
58
66
  </script>
59
67
 
@@ -66,10 +74,10 @@
66
74
  class:above-label={useAboveLabel}
67
75
  >
68
76
  {#if useAboveLabel}
69
- <label class="s-textarea-label-above" for={internalId}>{displayLabel}</label>
77
+ <label class="s-textarea-label-above" for={id || internalId}>{displayLabel}</label>
70
78
  {/if}
71
79
  {#if useFloatingLabel}
72
- <label class="s-textarea-floating-label" for={internalId}
80
+ <label class="s-textarea-floating-label" for={id || internalId}
73
81
  >{displayLabel}</label
74
82
  >
75
83
  {/if}
@@ -83,7 +91,8 @@
83
91
  {required}
84
92
  {rows}
85
93
  {maxlength}
86
- id={internalId}
94
+ aria-invalid={error ? true : undefined}
95
+ id={id || internalId}
87
96
  oninput={handleInput}
88
97
  onfocus={() => (focused = true)}
89
98
  onblur={() => (focused = false)}
@@ -92,4 +101,9 @@
92
101
  {#if maxlength}
93
102
  <span class="s-textarea-counter">{charCount}/{maxlength}</span>
94
103
  {/if}
104
+ {#if error}
105
+ <span class="s-field-error" style="display:block;font-size:12px;color:var(--t-error,#ef4444);margin-top:4px;">{error}</span>
106
+ {:else if helperText}
107
+ <span class="s-field-helper" style="display:block;font-size:12px;color:var(--t-text-hint);margin-top:4px;">{helperText}</span>
108
+ {/if}
95
109
  </div>
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./toast-styles.css";
3
- import { defaults, iconClass } from "../config.js";
3
+ import { getMultistyleDefaults, iconClass } from "../config.js";
4
4
  import { fly } from "svelte/transition";
5
5
  import { cn } from "../utils/cn.js";
6
6
 
@@ -17,8 +17,11 @@
17
17
  ...rest
18
18
  } = $props();
19
19
 
20
- const style = $derived(styleProp ?? defaults.style);
21
- const theme = $derived(themeProp ?? defaults.theme);
20
+ const _cfg = getMultistyleDefaults();
21
+
22
+
23
+ const style = $derived(styleProp ?? _cfg.style);
24
+ const theme = $derived(themeProp ?? _cfg.theme);
22
25
  const styleClass = $derived(`s-toast-${style}`);
23
26
  const themeClass = $derived(`theme-${theme}`);
24
27
 
@@ -113,10 +116,10 @@
113
116
  onclick={(e) => handleDismiss(toast.id, e)}
114
117
  aria-label="Dismiss"
115
118
  >&times;</button>
116
- {#if toast.duration > 0}
119
+ {#if (toast.duration ?? duration) > 0}
117
120
  <div
118
121
  class="s-toast-progress"
119
- style="animation-duration: {toast.duration}ms"
122
+ style="animation-duration: {toast.duration ?? duration}ms"
120
123
  ></div>
121
124
  {/if}
122
125
  </div>