@classic-homes/theme-svelte 0.1.49 → 0.1.51

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 (37) hide show
  1. package/dist/lib/components/Button.svelte +34 -49
  2. package/dist/lib/components/Checkbox.svelte +2 -2
  3. package/dist/lib/components/DataPanel.svelte +1399 -0
  4. package/dist/lib/components/DataPanel.svelte.d.ts +63 -0
  5. package/dist/lib/components/DataPanelContent.svelte +17 -0
  6. package/dist/lib/components/DataPanelContent.svelte.d.ts +10 -0
  7. package/dist/lib/components/DataPanelFooter.svelte +55 -0
  8. package/dist/lib/components/DataPanelFooter.svelte.d.ts +15 -0
  9. package/dist/lib/components/DataPanelHeader.svelte +220 -0
  10. package/dist/lib/components/DataPanelHeader.svelte.d.ts +37 -0
  11. package/dist/lib/components/DataPanelTab.svelte +72 -0
  12. package/dist/lib/components/DataPanelTab.svelte.d.ts +14 -0
  13. package/dist/lib/components/DateTimePicker.svelte +175 -57
  14. package/dist/lib/components/DateTimePicker.svelte.d.ts +2 -0
  15. package/dist/lib/components/FileUpload.svelte +4 -2
  16. package/dist/lib/components/Label.svelte +1 -1
  17. package/dist/lib/components/Select.svelte +126 -231
  18. package/dist/lib/components/Separator.svelte +1 -1
  19. package/dist/lib/components/Signature.svelte +4 -3
  20. package/dist/lib/components/Switch.svelte +7 -20
  21. package/dist/lib/components/Switch.svelte.d.ts +0 -1
  22. package/dist/lib/components/Tabs.svelte +4 -2
  23. package/dist/lib/components/data-table/createDataTable.svelte.d.ts +1 -1
  24. package/dist/lib/components/layout/FormPageLayout.svelte +3 -2
  25. package/dist/lib/components/layout/FormPageLayout.svelte.d.ts +1 -1
  26. package/dist/lib/composables/index.d.ts +17 -0
  27. package/dist/lib/composables/index.js +17 -1
  28. package/dist/lib/index.d.ts +7 -0
  29. package/dist/lib/index.js +7 -0
  30. package/dist/lib/schemas/common.d.ts +2 -2
  31. package/dist/lib/stores/dataPanel.svelte.d.ts +37 -0
  32. package/dist/lib/stores/dataPanel.svelte.js +182 -0
  33. package/dist/lib/utils/date.d.ts +29 -0
  34. package/dist/lib/utils/date.js +118 -0
  35. package/dist/lib/utils.d.ts +8 -0
  36. package/dist/lib/utils.js +19 -0
  37. package/package.json +5 -1
@@ -44,6 +44,7 @@
44
44
  class?: string;
45
45
  onclick?: (e: MouseEvent) => void;
46
46
  children: Snippet;
47
+ /** Allow passing additional HTML attributes (aria-*, data-*, etc.) */
47
48
  [key: string]: unknown;
48
49
  }
49
50
 
@@ -64,33 +65,41 @@
64
65
  const classes = $derived(cn(buttonVariants({ variant, size }), className));
65
66
  </script>
66
67
 
67
- {#if href}
68
- <a {href} class={classes} {...restProps}>
69
- {#if loading}
70
- <svg
71
- class="h-4 w-4 animate-spin"
72
- xmlns="http://www.w3.org/2000/svg"
73
- fill="none"
74
- viewBox="0 0 24 24"
75
- aria-hidden="true"
76
- >
77
- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"
78
- ></circle>
79
- <path
80
- class="opacity-75"
81
- fill="currentColor"
82
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
83
- ></path>
84
- </svg>
85
- {#if loadingText}
86
- <span>{loadingText}</span>
87
- <span class="sr-only">Loading</span>
88
- {:else}
89
- {@render children()}
90
- {/if}
68
+ {#snippet loadingSpinner()}
69
+ <svg
70
+ class="h-4 w-4 animate-spin"
71
+ xmlns="http://www.w3.org/2000/svg"
72
+ fill="none"
73
+ viewBox="0 0 24 24"
74
+ aria-hidden="true"
75
+ >
76
+ <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"
77
+ ></circle>
78
+ <path
79
+ class="opacity-75"
80
+ fill="currentColor"
81
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
82
+ ></path>
83
+ </svg>
84
+ {/snippet}
85
+
86
+ {#snippet buttonContent()}
87
+ {#if loading}
88
+ {@render loadingSpinner()}
89
+ {#if loadingText}
90
+ <span>{loadingText}</span>
91
+ <span class="sr-only">Loading</span>
91
92
  {:else}
92
93
  {@render children()}
93
94
  {/if}
95
+ {:else}
96
+ {@render children()}
97
+ {/if}
98
+ {/snippet}
99
+
100
+ {#if href}
101
+ <a {href} class={classes} {...restProps}>
102
+ {@render buttonContent()}
94
103
  </a>
95
104
  {:else}
96
105
  <button
@@ -102,30 +111,6 @@
102
111
  {onclick}
103
112
  {...restProps}
104
113
  >
105
- {#if loading}
106
- <svg
107
- class="h-4 w-4 animate-spin"
108
- xmlns="http://www.w3.org/2000/svg"
109
- fill="none"
110
- viewBox="0 0 24 24"
111
- aria-hidden="true"
112
- >
113
- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"
114
- ></circle>
115
- <path
116
- class="opacity-75"
117
- fill="currentColor"
118
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
119
- ></path>
120
- </svg>
121
- {#if loadingText}
122
- <span>{loadingText}</span>
123
- <span class="sr-only">Loading</span>
124
- {:else}
125
- {@render children()}
126
- {/if}
127
- {:else}
128
- {@render children()}
129
- {/if}
114
+ {@render buttonContent()}
130
115
  </button>
131
116
  {/if}
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte';
3
3
  import { Checkbox as CheckboxPrimitive } from 'bits-ui';
4
- import { cn } from '../utils.js';
4
+ import { cn, useId } from '../utils.js';
5
5
 
6
6
  interface Props {
7
7
  checked?: boolean;
@@ -32,7 +32,7 @@
32
32
  }: Props = $props();
33
33
 
34
34
  // Generate a stable unique ID if none provided (for accessibility)
35
- const generatedId = `checkbox-${Math.random().toString(36).substring(2, 11)}`;
35
+ const generatedId = useId('checkbox');
36
36
  const effectiveId = $derived(id ?? generatedId);
37
37
 
38
38
  function handleCheckedChange(newChecked: boolean | 'indeterminate') {