@insymetri/styleguide 0.1.93 → 0.1.94
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/IIAccordion/IIAccordion.svelte +12 -2
- package/dist/IIAccordion/IIAccordion.svelte.d.ts +2 -0
- package/dist/IIFormField/IIFormField.svelte +14 -4
- package/dist/IIFormField/IIFormField.svelte.d.ts +6 -1
- package/dist/IITable/IITable.svelte +24 -6
- package/dist/IITable/IITable.svelte.d.ts +2 -0
- package/package.json +1 -1
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
trigger: Snippet<[{expanded: boolean}]>
|
|
10
10
|
children: Snippet
|
|
11
11
|
disabled?: boolean
|
|
12
|
+
/** `card` (default) frames each item; `plain` separates them with a hairline. */
|
|
13
|
+
variant?: 'card' | 'plain'
|
|
12
14
|
class?: string
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -18,6 +20,7 @@
|
|
|
18
20
|
trigger,
|
|
19
21
|
children,
|
|
20
22
|
disabled = false,
|
|
23
|
+
variant = 'card',
|
|
21
24
|
class: className,
|
|
22
25
|
}: Props = $props()
|
|
23
26
|
|
|
@@ -28,7 +31,14 @@
|
|
|
28
31
|
}
|
|
29
32
|
</script>
|
|
30
33
|
|
|
31
|
-
<div
|
|
34
|
+
<div
|
|
35
|
+
class={cn(
|
|
36
|
+
variant === 'plain'
|
|
37
|
+
? 'border-b border-subtle last:border-b-0'
|
|
38
|
+
: 'border border-primary rounded-10 overflow-hidden',
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
32
42
|
<button
|
|
33
43
|
type="button"
|
|
34
44
|
class="flex items-center gap-8 w-full bg-transparent border-none px-16 py-12 cursor-default text-left font-inherit hover:bg-background"
|
|
@@ -47,7 +57,7 @@
|
|
|
47
57
|
</div>
|
|
48
58
|
</button>
|
|
49
59
|
{#if expanded}
|
|
50
|
-
<div class=
|
|
60
|
+
<div class={variant === 'plain' ? '' : 'border-t border-primary'}>
|
|
51
61
|
{@render children()}
|
|
52
62
|
</div>
|
|
53
63
|
{/if}
|
|
@@ -7,6 +7,8 @@ type Props = {
|
|
|
7
7
|
}]>;
|
|
8
8
|
children: Snippet;
|
|
9
9
|
disabled?: boolean;
|
|
10
|
+
/** `card` (default) frames each item; `plain` separates them with a hairline. */
|
|
11
|
+
variant?: 'card' | 'plain';
|
|
10
12
|
class?: string;
|
|
11
13
|
};
|
|
12
14
|
declare const IIAccordion: import("svelte").Component<Props, {}, "expanded">;
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type {Snippet} from 'svelte'
|
|
3
|
+
import {cn} from '../utils/cn'
|
|
3
4
|
|
|
4
5
|
type Props = {
|
|
5
6
|
label?: string
|
|
6
7
|
id?: string
|
|
7
|
-
|
|
8
|
+
/** Control on the label's own line, right-aligned. Ignored without a `label`. */
|
|
9
|
+
labelAction?: Snippet
|
|
10
|
+
class?: string
|
|
8
11
|
}
|
|
9
12
|
|
|
10
|
-
let {label, id, children}: Props = $props()
|
|
13
|
+
let {label, id, labelAction, children, class: className}: Props & {children: Snippet} = $props()
|
|
11
14
|
</script>
|
|
12
15
|
|
|
13
|
-
<div class=
|
|
16
|
+
<div class={cn('mb-16 last:mb-0', className)}>
|
|
14
17
|
{#if label}
|
|
15
|
-
|
|
18
|
+
{#if labelAction}
|
|
19
|
+
<div class="mb-8 flex items-center justify-between gap-10">
|
|
20
|
+
<label class="block text-small-emphasis text-body" for={id}>{label}</label>
|
|
21
|
+
{@render labelAction()}
|
|
22
|
+
</div>
|
|
23
|
+
{:else}
|
|
24
|
+
<label class="block text-small-emphasis text-body mb-8" for={id}>{label}</label>
|
|
25
|
+
{/if}
|
|
16
26
|
{/if}
|
|
17
27
|
{@render children()}
|
|
18
28
|
</div>
|
|
@@ -2,8 +2,13 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
type Props = {
|
|
3
3
|
label?: string;
|
|
4
4
|
id?: string;
|
|
5
|
+
/** Control on the label's own line, right-aligned. Ignored without a `label`. */
|
|
6
|
+
labelAction?: Snippet;
|
|
7
|
+
class?: string;
|
|
8
|
+
};
|
|
9
|
+
type $$ComponentProps = Props & {
|
|
5
10
|
children: Snippet;
|
|
6
11
|
};
|
|
7
|
-
declare const IIFormField: import("svelte").Component
|
|
12
|
+
declare const IIFormField: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
13
|
type IIFormField = ReturnType<typeof IIFormField>;
|
|
9
14
|
export default IIFormField;
|
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
stickyHeader?: boolean
|
|
42
42
|
/** `sm` → text-small (default), `md` → text-default. */
|
|
43
43
|
size?: 'sm' | 'md'
|
|
44
|
+
/** `card` (default) frames the table; `plain` drops the frame and header fill for hairline rules. */
|
|
45
|
+
variant?: 'card' | 'plain'
|
|
44
46
|
class?: string
|
|
45
47
|
}
|
|
46
48
|
|
|
@@ -58,31 +60,45 @@
|
|
|
58
60
|
isExpanded,
|
|
59
61
|
stickyHeader = false,
|
|
60
62
|
size = 'sm',
|
|
63
|
+
variant = 'card',
|
|
61
64
|
class: className,
|
|
62
65
|
}: Props = $props()
|
|
63
66
|
|
|
64
67
|
const alignClass = {left: 'text-left', right: 'text-right', center: 'text-center'} as const
|
|
65
68
|
const cellText = $derived(size === 'sm' ? 'text-small' : 'text-default')
|
|
66
69
|
const interactive = $derived(!!onRowClick)
|
|
70
|
+
const plain = $derived(variant === 'plain')
|
|
71
|
+
|
|
72
|
+
const containerClass = $derived(
|
|
73
|
+
plain ? 'overflow-x-auto' : 'bg-surface-raised border border-subtle rounded-12 overflow-x-auto overflow-y-hidden'
|
|
74
|
+
)
|
|
75
|
+
const headClass = $derived(plain ? 'border-b border-subtle' : 'bg-background border-b border-primary')
|
|
76
|
+
const headCellClass = $derived(
|
|
77
|
+
plain
|
|
78
|
+
? 'px-12 pb-8 text-micro text-tertiary uppercase'
|
|
79
|
+
: 'px-14 py-9 text-tiny-emphasis text-tertiary uppercase tracking-wide'
|
|
80
|
+
)
|
|
81
|
+
const bodyCellClass = $derived(plain ? 'px-12 py-11' : 'px-14 py-10')
|
|
82
|
+
const rowRuleClass = $derived(plain ? 'border-subtle' : 'border-primary')
|
|
67
83
|
|
|
68
84
|
function cellClass(col: Column, row: T): string {
|
|
69
85
|
return typeof col.class === 'function' ? col.class(row) : (col.class ?? '')
|
|
70
86
|
}
|
|
71
87
|
</script>
|
|
72
88
|
|
|
73
|
-
<div class={cn(
|
|
89
|
+
<div class={cn(containerClass, className)}>
|
|
74
90
|
{#if children}
|
|
75
91
|
<table class="w-full border-collapse">
|
|
76
92
|
{@render children()}
|
|
77
93
|
</table>
|
|
78
94
|
{:else}
|
|
79
95
|
<table class="w-full border-collapse">
|
|
80
|
-
<thead class={cn(
|
|
96
|
+
<thead class={cn(headClass, stickyHeader && 'sticky top-0 z-1')}>
|
|
81
97
|
<tr>
|
|
82
98
|
{#each columns as col (col.key)}
|
|
83
99
|
<th
|
|
84
100
|
class={cn(
|
|
85
|
-
|
|
101
|
+
headCellClass,
|
|
86
102
|
alignClass[col.align ?? 'left'],
|
|
87
103
|
col.width,
|
|
88
104
|
col.headerClass
|
|
@@ -108,7 +124,8 @@
|
|
|
108
124
|
{#each rows as row (rowKey?.(row) ?? row)}
|
|
109
125
|
<tr
|
|
110
126
|
class={cn(
|
|
111
|
-
'border-b
|
|
127
|
+
'border-b last:border-b-0',
|
|
128
|
+
rowRuleClass,
|
|
112
129
|
interactive && 'cursor-pointer hover:bg-background',
|
|
113
130
|
rowClass?.(row)
|
|
114
131
|
)}
|
|
@@ -119,7 +136,8 @@
|
|
|
119
136
|
{#each columns as col (col.key)}
|
|
120
137
|
<td
|
|
121
138
|
class={cn(
|
|
122
|
-
|
|
139
|
+
bodyCellClass,
|
|
140
|
+
'text-body',
|
|
123
141
|
cellText,
|
|
124
142
|
alignClass[col.align ?? 'left'],
|
|
125
143
|
col.width,
|
|
@@ -131,7 +149,7 @@
|
|
|
131
149
|
{/each}
|
|
132
150
|
</tr>
|
|
133
151
|
{#if expandedRow && isExpanded?.(row)}
|
|
134
|
-
<tr class=
|
|
152
|
+
<tr class={cn('border-b last:border-b-0 bg-background', rowRuleClass)}>
|
|
135
153
|
<td colspan={columns.length} class="px-16 py-12">
|
|
136
154
|
{@render expandedRow(row)}
|
|
137
155
|
</td>
|
|
@@ -36,6 +36,8 @@ declare function $$render<T>(): {
|
|
|
36
36
|
stickyHeader?: boolean;
|
|
37
37
|
/** `sm` → text-small (default), `md` → text-default. */
|
|
38
38
|
size?: "sm" | "md";
|
|
39
|
+
/** `card` (default) frames the table; `plain` drops the frame and header fill for hairline rules. */
|
|
40
|
+
variant?: "card" | "plain";
|
|
39
41
|
class?: string;
|
|
40
42
|
};
|
|
41
43
|
exports: {};
|