@classic-homes/theme-svelte 0.1.0 → 0.1.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.
- package/dist/lib/components/AlertDialog.svelte +1 -1
- package/dist/lib/components/DataTable.svelte +1 -1
- package/dist/lib/components/DataTable.svelte.d.ts +5 -5
- package/dist/lib/components/Dialog.svelte +1 -1
- package/dist/lib/components/DropdownMenu.svelte +1 -1
- package/dist/lib/components/FormField.svelte +2 -2
- package/dist/lib/components/FormField.svelte.d.ts +2 -2
- package/dist/lib/components/Select.svelte +15 -0
- package/dist/lib/components/Select.svelte.d.ts +4 -0
- package/dist/lib/components/Tooltip.svelte +1 -1
- package/dist/lib/performance.js +2 -25
- package/dist/lib/types/components.d.ts +2 -5
- package/dist/lib/validation.js +2 -28
- package/package.json +2 -1
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
*/
|
|
53
53
|
import type { DataTableColumn } from '../types/components.js';
|
|
54
54
|
import type { Snippet } from 'svelte';
|
|
55
|
-
declare function $$render<T extends
|
|
55
|
+
declare function $$render<T extends object>(): {
|
|
56
56
|
props: {
|
|
57
57
|
/** Array of data rows */
|
|
58
58
|
data: T[];
|
|
@@ -84,7 +84,7 @@ declare function $$render<T extends Record<string, unknown>>(): {
|
|
|
84
84
|
slots: {};
|
|
85
85
|
events: {};
|
|
86
86
|
};
|
|
87
|
-
declare class __sveltets_Render<T extends
|
|
87
|
+
declare class __sveltets_Render<T extends object> {
|
|
88
88
|
props(): ReturnType<typeof $$render<T>>['props'];
|
|
89
89
|
events(): ReturnType<typeof $$render<T>>['events'];
|
|
90
90
|
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
@@ -92,12 +92,12 @@ declare class __sveltets_Render<T extends Record<string, unknown>> {
|
|
|
92
92
|
exports(): {};
|
|
93
93
|
}
|
|
94
94
|
interface $$IsomorphicComponent {
|
|
95
|
-
new <T extends
|
|
95
|
+
new <T extends object>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
96
96
|
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
97
97
|
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
98
|
-
<T extends
|
|
98
|
+
<T extends object>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
99
99
|
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
100
100
|
}
|
|
101
101
|
declare const DataTable: $$IsomorphicComponent;
|
|
102
|
-
type DataTable<T extends
|
|
102
|
+
type DataTable<T extends object> = InstanceType<typeof DataTable<T>>;
|
|
103
103
|
export default DataTable;
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
label: string;
|
|
10
10
|
/** Input ID for association */
|
|
11
11
|
id: string;
|
|
12
|
-
/** Input type (text, email, password, tel, url, number, textarea) */
|
|
13
|
-
type?: 'text' | 'email' | 'password' | 'tel' | 'url' | 'number' | 'textarea';
|
|
12
|
+
/** Input type (text, email, password, tel, url, number, date, textarea) */
|
|
13
|
+
type?: 'text' | 'email' | 'password' | 'tel' | 'url' | 'number' | 'date' | 'textarea';
|
|
14
14
|
/** Field value (bindable) */
|
|
15
15
|
value?: string;
|
|
16
16
|
/** Error message */
|
|
@@ -3,8 +3,8 @@ interface Props {
|
|
|
3
3
|
label: string;
|
|
4
4
|
/** Input ID for association */
|
|
5
5
|
id: string;
|
|
6
|
-
/** Input type (text, email, password, tel, url, number, textarea) */
|
|
7
|
-
type?: 'text' | 'email' | 'password' | 'tel' | 'url' | 'number' | 'textarea';
|
|
6
|
+
/** Input type (text, email, password, tel, url, number, date, textarea) */
|
|
7
|
+
type?: 'text' | 'email' | 'password' | 'tel' | 'url' | 'number' | 'date' | 'textarea';
|
|
8
8
|
/** Field value (bindable) */
|
|
9
9
|
value?: string;
|
|
10
10
|
/** Error message */
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
class?: string;
|
|
34
34
|
/** Optional label */
|
|
35
35
|
label?: string;
|
|
36
|
+
/** Element ID for accessibility */
|
|
37
|
+
id?: string;
|
|
38
|
+
/** Error message to display */
|
|
39
|
+
error?: string;
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
let {
|
|
@@ -45,6 +49,8 @@
|
|
|
45
49
|
required = false,
|
|
46
50
|
class: className,
|
|
47
51
|
label,
|
|
52
|
+
id,
|
|
53
|
+
error,
|
|
48
54
|
}: Props = $props();
|
|
49
55
|
|
|
50
56
|
// Validate props in development
|
|
@@ -111,11 +117,14 @@
|
|
|
111
117
|
onValueChange={handleValueChange}
|
|
112
118
|
>
|
|
113
119
|
<SelectPrimitive.Trigger
|
|
120
|
+
{id}
|
|
114
121
|
class={cn(
|
|
115
122
|
'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
|
|
123
|
+
error && 'border-destructive focus:ring-destructive',
|
|
116
124
|
className
|
|
117
125
|
)}
|
|
118
126
|
aria-label={label || placeholder}
|
|
127
|
+
aria-invalid={error ? 'true' : undefined}
|
|
119
128
|
>
|
|
120
129
|
<span class={value ? '' : 'text-muted-foreground'}>
|
|
121
130
|
{selectedLabel || placeholder}
|
|
@@ -172,3 +181,9 @@
|
|
|
172
181
|
</div>
|
|
173
182
|
</SelectPrimitive.Content>
|
|
174
183
|
</SelectPrimitive.Root>
|
|
184
|
+
|
|
185
|
+
{#if error}
|
|
186
|
+
<p class="text-sm text-destructive mt-1.5" role="alert">
|
|
187
|
+
{error}
|
|
188
|
+
</p>
|
|
189
|
+
{/if}
|
|
@@ -26,6 +26,10 @@ interface Props {
|
|
|
26
26
|
class?: string;
|
|
27
27
|
/** Optional label */
|
|
28
28
|
label?: string;
|
|
29
|
+
/** Element ID for accessibility */
|
|
30
|
+
id?: string;
|
|
31
|
+
/** Error message to display */
|
|
32
|
+
error?: string;
|
|
29
33
|
}
|
|
30
34
|
declare const Select: import("svelte").Component<Props, {}, "value">;
|
|
31
35
|
type Select = ReturnType<typeof Select>;
|
package/dist/lib/performance.js
CHANGED
|
@@ -19,31 +19,8 @@
|
|
|
19
19
|
* });
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
try {
|
|
25
|
-
// @ts-expect-error - import.meta.env may not exist
|
|
26
|
-
if (typeof import.meta !== 'undefined' && import.meta.env?.DEV !== undefined) {
|
|
27
|
-
// @ts-expect-error - accessing env.DEV
|
|
28
|
-
return import.meta.env.DEV === true;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
// Ignore
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
// @ts-expect-error - process may not exist
|
|
36
|
-
if (typeof process !== 'undefined' && process.env?.NODE_ENV !== undefined) {
|
|
37
|
-
// @ts-expect-error - accessing process.env
|
|
38
|
-
return process.env.NODE_ENV !== 'production';
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
// Ignore
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
};
|
|
46
|
-
const isDev = getIsDev();
|
|
22
|
+
import { DEV } from 'esm-env';
|
|
23
|
+
const isDev = DEV;
|
|
47
24
|
const marks = new Map();
|
|
48
25
|
/** Threshold in ms for logging slow operations (1 frame at 60fps) */
|
|
49
26
|
const SLOW_THRESHOLD = 16;
|
|
@@ -7,16 +7,13 @@
|
|
|
7
7
|
/**
|
|
8
8
|
* Dropdown Menu Types
|
|
9
9
|
*/
|
|
10
|
-
import type { Snippet } from 'svelte';
|
|
11
10
|
export interface DropdownMenuItem {
|
|
12
|
-
type?: 'item' | '
|
|
11
|
+
type?: 'item' | 'separator' | 'label';
|
|
13
12
|
label?: string;
|
|
14
13
|
value?: string;
|
|
15
14
|
disabled?: boolean;
|
|
16
|
-
checked?: boolean;
|
|
17
15
|
onSelect?: () => void;
|
|
18
16
|
destructive?: boolean;
|
|
19
|
-
icon?: Snippet;
|
|
20
17
|
shortcut?: string;
|
|
21
18
|
}
|
|
22
19
|
export interface DropdownMenuGroup {
|
|
@@ -67,7 +64,7 @@ export interface FileMetadata {
|
|
|
67
64
|
/**
|
|
68
65
|
* DataTable Types
|
|
69
66
|
*/
|
|
70
|
-
export interface DataTableColumn<T =
|
|
67
|
+
export interface DataTableColumn<T = object> {
|
|
71
68
|
/** Unique column identifier */
|
|
72
69
|
id: string;
|
|
73
70
|
/** Column header text */
|
package/dist/lib/validation.js
CHANGED
|
@@ -4,34 +4,8 @@
|
|
|
4
4
|
* These utilities provide development-time warnings for common prop mistakes.
|
|
5
5
|
* They are designed to be tree-shaken in production builds.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
try {
|
|
10
|
-
// Vite/SvelteKit environment
|
|
11
|
-
// @ts-expect-error - import.meta.env may not exist in all environments
|
|
12
|
-
if (typeof import.meta !== 'undefined' && import.meta.env?.DEV !== undefined) {
|
|
13
|
-
// @ts-expect-error - accessing env.DEV
|
|
14
|
-
return import.meta.env.DEV === true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
// Ignore errors from import.meta access
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
// Node.js environment
|
|
22
|
-
// @ts-expect-error - process may not exist in browser
|
|
23
|
-
if (typeof process !== 'undefined' && process.env?.NODE_ENV !== undefined) {
|
|
24
|
-
// @ts-expect-error - accessing process.env
|
|
25
|
-
return process.env.NODE_ENV !== 'production';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
// Ignore errors from process access
|
|
30
|
-
}
|
|
31
|
-
// Default to false (production mode) if we can't determine
|
|
32
|
-
return false;
|
|
33
|
-
};
|
|
34
|
-
const isDev = getIsDev();
|
|
7
|
+
import { DEV } from 'esm-env';
|
|
8
|
+
const isDev = DEV;
|
|
35
9
|
/**
|
|
36
10
|
* Validate that a required array prop is non-empty
|
|
37
11
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classic-homes/theme-svelte",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Svelte components for the Classic theme system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"svelte": "./dist/lib/index.js",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"@classic-homes/theme-tokens": "*",
|
|
44
44
|
"bits-ui": "^1.0.0",
|
|
45
45
|
"clsx": "^2.1.0",
|
|
46
|
+
"esm-env": "1.2.2",
|
|
46
47
|
"tailwind-merge": "^2.2.0",
|
|
47
48
|
"tailwind-variants": "^0.3.0",
|
|
48
49
|
"zod": "^3.23.0"
|