@insymetri/styleguide 0.1.93 → 0.1.95
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 +29 -8
- package/dist/IITable/IITable.svelte.d.ts +4 -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,10 @@
|
|
|
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'
|
|
46
|
+
/** Classes on the `<table>` itself — chiefly a `min-w-*`, so narrow viewports scroll rather than squash. */
|
|
47
|
+
tableClass?: string
|
|
44
48
|
class?: string
|
|
45
49
|
}
|
|
46
50
|
|
|
@@ -58,31 +62,46 @@
|
|
|
58
62
|
isExpanded,
|
|
59
63
|
stickyHeader = false,
|
|
60
64
|
size = 'sm',
|
|
65
|
+
variant = 'card',
|
|
66
|
+
tableClass,
|
|
61
67
|
class: className,
|
|
62
68
|
}: Props = $props()
|
|
63
69
|
|
|
64
70
|
const alignClass = {left: 'text-left', right: 'text-right', center: 'text-center'} as const
|
|
65
71
|
const cellText = $derived(size === 'sm' ? 'text-small' : 'text-default')
|
|
66
72
|
const interactive = $derived(!!onRowClick)
|
|
73
|
+
const plain = $derived(variant === 'plain')
|
|
74
|
+
|
|
75
|
+
const containerClass = $derived(
|
|
76
|
+
plain ? 'overflow-x-auto' : 'bg-surface-raised border border-subtle rounded-12 overflow-x-auto overflow-y-hidden'
|
|
77
|
+
)
|
|
78
|
+
const headClass = $derived(plain ? 'border-b border-subtle' : 'bg-background border-b border-primary')
|
|
79
|
+
const headCellClass = $derived(
|
|
80
|
+
plain
|
|
81
|
+
? 'px-12 pb-8 text-micro text-tertiary uppercase'
|
|
82
|
+
: 'px-14 py-9 text-tiny-emphasis text-tertiary uppercase tracking-wide'
|
|
83
|
+
)
|
|
84
|
+
const bodyCellClass = $derived(plain ? 'px-12 py-11' : 'px-14 py-10')
|
|
85
|
+
const rowRuleClass = $derived(plain ? 'border-subtle' : 'border-primary')
|
|
67
86
|
|
|
68
87
|
function cellClass(col: Column, row: T): string {
|
|
69
88
|
return typeof col.class === 'function' ? col.class(row) : (col.class ?? '')
|
|
70
89
|
}
|
|
71
90
|
</script>
|
|
72
91
|
|
|
73
|
-
<div class={cn(
|
|
92
|
+
<div class={cn(containerClass, className)}>
|
|
74
93
|
{#if children}
|
|
75
|
-
<table class=
|
|
94
|
+
<table class={cn('w-full border-collapse', tableClass)}>
|
|
76
95
|
{@render children()}
|
|
77
96
|
</table>
|
|
78
97
|
{:else}
|
|
79
|
-
<table class=
|
|
80
|
-
<thead class={cn(
|
|
98
|
+
<table class={cn('w-full border-collapse', tableClass)}>
|
|
99
|
+
<thead class={cn(headClass, stickyHeader && 'sticky top-0 z-1')}>
|
|
81
100
|
<tr>
|
|
82
101
|
{#each columns as col (col.key)}
|
|
83
102
|
<th
|
|
84
103
|
class={cn(
|
|
85
|
-
|
|
104
|
+
headCellClass,
|
|
86
105
|
alignClass[col.align ?? 'left'],
|
|
87
106
|
col.width,
|
|
88
107
|
col.headerClass
|
|
@@ -108,7 +127,8 @@
|
|
|
108
127
|
{#each rows as row (rowKey?.(row) ?? row)}
|
|
109
128
|
<tr
|
|
110
129
|
class={cn(
|
|
111
|
-
'border-b
|
|
130
|
+
'border-b last:border-b-0',
|
|
131
|
+
rowRuleClass,
|
|
112
132
|
interactive && 'cursor-pointer hover:bg-background',
|
|
113
133
|
rowClass?.(row)
|
|
114
134
|
)}
|
|
@@ -119,7 +139,8 @@
|
|
|
119
139
|
{#each columns as col (col.key)}
|
|
120
140
|
<td
|
|
121
141
|
class={cn(
|
|
122
|
-
|
|
142
|
+
bodyCellClass,
|
|
143
|
+
'text-body',
|
|
123
144
|
cellText,
|
|
124
145
|
alignClass[col.align ?? 'left'],
|
|
125
146
|
col.width,
|
|
@@ -131,7 +152,7 @@
|
|
|
131
152
|
{/each}
|
|
132
153
|
</tr>
|
|
133
154
|
{#if expandedRow && isExpanded?.(row)}
|
|
134
|
-
<tr class=
|
|
155
|
+
<tr class={cn('border-b last:border-b-0 bg-background', rowRuleClass)}>
|
|
135
156
|
<td colspan={columns.length} class="px-16 py-12">
|
|
136
157
|
{@render expandedRow(row)}
|
|
137
158
|
</td>
|
|
@@ -36,6 +36,10 @@ 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";
|
|
41
|
+
/** Classes on the `<table>` itself — chiefly a `min-w-*`, so narrow viewports scroll rather than squash. */
|
|
42
|
+
tableClass?: string;
|
|
39
43
|
class?: string;
|
|
40
44
|
};
|
|
41
45
|
exports: {};
|