@makolabs/ripple 2.1.0 → 2.3.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.
- package/dist/charts/Chart.svelte +307 -53
- package/dist/charts/chart-types.d.ts +12 -0
- package/dist/elements/accordion/Accordion.svelte +27 -10
- package/dist/elements/accordion/accordion-types.d.ts +6 -0
- package/dist/elements/dropdown/Select.svelte +191 -63
- package/dist/elements/dropdown/dropdown-types.d.ts +13 -1
- package/dist/elements/dropdown/select.d.ts +15 -0
- package/dist/elements/dropdown/select.js +14 -8
- package/dist/forms/DateRange.svelte +16 -3
- package/dist/forms/Input.svelte +6 -4
- package/dist/forms/MarketSelector.svelte +7 -27
- package/dist/forms/NumberInput.svelte +9 -6
- package/dist/forms/SegmentedControl.svelte +5 -18
- package/dist/forms/Tags.svelte +1 -1
- package/dist/forms/form-types.d.ts +2 -31
- package/dist/forms/market/market-selector-types.d.ts +1 -21
- package/dist/forms/segmented-control.d.ts +4 -34
- package/dist/forms/segmented-control.js +19 -59
- package/dist/index.d.ts +3 -11
- package/dist/index.js +0 -8
- package/dist/layout/activity-list/ActivityList.svelte +55 -1
- package/dist/variants.js +6 -6
- package/package.json +1 -1
- package/dist/elements/collapsible/Collapsible.svelte +0 -79
- package/dist/elements/collapsible/Collapsible.svelte.d.ts +0 -4
- package/dist/elements/collapsible/CollapsibleTestWrapper.svelte +0 -23
- package/dist/elements/collapsible/CollapsibleTestWrapper.svelte.d.ts +0 -8
- package/dist/elements/collapsible/collapsible-types.d.ts +0 -16
- package/dist/elements/collapsible/collapsible-types.js +0 -1
- package/dist/elements/combobox/Combobox.svelte +0 -274
- package/dist/elements/combobox/Combobox.svelte.d.ts +0 -25
- package/dist/elements/combobox/ComboboxTestWrapper.svelte +0 -38
- package/dist/elements/combobox/ComboboxTestWrapper.svelte.d.ts +0 -4
- package/dist/elements/combobox/combobox-types.d.ts +0 -39
- package/dist/elements/combobox/combobox-types.js +0 -1
- package/dist/elements/timeline/Timeline.svelte +0 -95
- package/dist/elements/timeline/Timeline.svelte.d.ts +0 -7
- package/dist/elements/timeline/timeline-types.d.ts +0 -11
- package/dist/elements/timeline/timeline-types.js +0 -1
- package/dist/forms/RadioInputs.svelte +0 -73
- package/dist/forms/RadioInputs.svelte.d.ts +0 -4
- package/dist/forms/RadioPill.svelte +0 -66
- package/dist/forms/RadioPill.svelte.d.ts +0 -4
|
@@ -29,23 +29,19 @@
|
|
|
29
29
|
|
|
30
30
|
const hasError = $derived(errors && errors.length > 0);
|
|
31
31
|
|
|
32
|
-
const clarkCollapsed = $derived(
|
|
33
|
-
compact && appearance === 'clarkSidebar' && orientation === 'vertical'
|
|
34
|
-
);
|
|
35
|
-
|
|
36
32
|
const trackClass = $derived(
|
|
37
33
|
cn(
|
|
38
34
|
segmentedTrack({
|
|
39
35
|
appearance,
|
|
40
|
-
orientation
|
|
41
|
-
clarkCollapsed
|
|
36
|
+
orientation
|
|
42
37
|
}),
|
|
43
|
-
orientation === 'vertical' && compact &&
|
|
38
|
+
orientation === 'vertical' && compact && 'items-stretch'
|
|
44
39
|
)
|
|
45
40
|
);
|
|
46
41
|
|
|
47
42
|
const rootClass = $derived(
|
|
48
43
|
cn(
|
|
44
|
+
'w-fit',
|
|
49
45
|
labelLayout === 'inline' ? 'flex flex-row items-center gap-2' : 'flex flex-col gap-2',
|
|
50
46
|
className
|
|
51
47
|
)
|
|
@@ -110,8 +106,6 @@
|
|
|
110
106
|
}
|
|
111
107
|
}
|
|
112
108
|
}
|
|
113
|
-
|
|
114
|
-
const isClark = $derived(appearance === 'clarkDefault' || appearance === 'clarkSidebar');
|
|
115
109
|
</script>
|
|
116
110
|
|
|
117
111
|
<div class={rootClass}>
|
|
@@ -133,8 +127,6 @@
|
|
|
133
127
|
>
|
|
134
128
|
{#each options as option, index (option.value)}
|
|
135
129
|
{@const isSelected = value === option.value}
|
|
136
|
-
{@const isFirst = index === 0}
|
|
137
|
-
{@const isLast = index === options.length - 1}
|
|
138
130
|
{@const segDisabled = disabled || option.disabled}
|
|
139
131
|
<button
|
|
140
132
|
id="{groupId}-seg-{index}"
|
|
@@ -149,11 +141,7 @@
|
|
|
149
141
|
disabled: !!segDisabled,
|
|
150
142
|
appearance,
|
|
151
143
|
color: color as VariantColors,
|
|
152
|
-
size: size as VariantSizes
|
|
153
|
-
isFirst,
|
|
154
|
-
isLast,
|
|
155
|
-
orientation,
|
|
156
|
-
clarkCollapsed
|
|
144
|
+
size: size as VariantSizes
|
|
157
145
|
})}
|
|
158
146
|
data-testid={buildTestId('segmented', 'item', testId, index)}
|
|
159
147
|
onclick={() => handleSelect(option.value, option.disabled)}
|
|
@@ -164,8 +152,7 @@
|
|
|
164
152
|
{/if}
|
|
165
153
|
<span
|
|
166
154
|
class={cn(
|
|
167
|
-
!compact && (size === Size.XS || size === Size.SM) &&
|
|
168
|
-
isClark && !compact && 'text-xs font-medium',
|
|
155
|
+
!compact && (size === Size.XS || size === Size.SM) && 'text-sm',
|
|
169
156
|
compact && 'sr-only'
|
|
170
157
|
)}
|
|
171
158
|
>
|
package/dist/forms/Tags.svelte
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
|
|
106
106
|
const containerClass = $derived(
|
|
107
107
|
cn(
|
|
108
|
-
'relative flex flex-wrap gap-2 rounded-lg border bg-white shadow-
|
|
108
|
+
'relative flex flex-wrap gap-2 rounded-lg border bg-white shadow-xs px-3 py-2',
|
|
109
109
|
'border-default-300 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500 focus-within:ring-offset-2',
|
|
110
110
|
{
|
|
111
111
|
'border-danger-300 focus-within:border-danger-500 focus-within:ring-danger-500':
|
|
@@ -33,19 +33,6 @@ export type RadioOption = {
|
|
|
33
33
|
value: string;
|
|
34
34
|
label: string;
|
|
35
35
|
};
|
|
36
|
-
export type RadioInputsProps = {
|
|
37
|
-
name: string;
|
|
38
|
-
label?: string;
|
|
39
|
-
options: RadioOption[];
|
|
40
|
-
value?: string;
|
|
41
|
-
disabled?: boolean;
|
|
42
|
-
class?: ClassValue;
|
|
43
|
-
size?: VariantSizes;
|
|
44
|
-
color?: VariantColors;
|
|
45
|
-
errors?: string[];
|
|
46
|
-
required?: boolean;
|
|
47
|
-
testId?: string;
|
|
48
|
-
};
|
|
49
36
|
export type CheckboxProps = {
|
|
50
37
|
name: string;
|
|
51
38
|
label?: string;
|
|
@@ -102,6 +89,7 @@ export interface DateRangeProps {
|
|
|
102
89
|
startLabel?: string;
|
|
103
90
|
endLabel?: string;
|
|
104
91
|
format?: string;
|
|
92
|
+
errors?: string[];
|
|
105
93
|
onselect?: ({ startDate, endDate }: {
|
|
106
94
|
startDate?: Date;
|
|
107
95
|
endDate?: Date;
|
|
@@ -156,16 +144,6 @@ export interface SliderProps {
|
|
|
156
144
|
};
|
|
157
145
|
testId?: string;
|
|
158
146
|
}
|
|
159
|
-
export type RadioPillProps = {
|
|
160
|
-
name: string;
|
|
161
|
-
options: RadioOption[];
|
|
162
|
-
value?: string;
|
|
163
|
-
label?: string;
|
|
164
|
-
class?: ClassValue;
|
|
165
|
-
errors?: string[];
|
|
166
|
-
onchange?: (value: string) => void;
|
|
167
|
-
testId?: string;
|
|
168
|
-
};
|
|
169
147
|
/** Single segment in a fused SegmentedControl bar (not TabGroup — no panels). */
|
|
170
148
|
export type SegmentedOption = RadioOption & {
|
|
171
149
|
/** Shown before label, e.g. flag emoji */
|
|
@@ -180,19 +158,12 @@ export type SegmentedControlProps = {
|
|
|
180
158
|
name?: string;
|
|
181
159
|
label?: string;
|
|
182
160
|
class?: ClassValue;
|
|
183
|
-
|
|
184
|
-
* - `surface` / `inverted`: generic Ripple styling (`color` applies).
|
|
185
|
-
* - `clarkDefault` / `clarkSidebar`: match Clark AR market bar (fixed blue selection, inline-friendly).
|
|
186
|
-
*/
|
|
187
|
-
appearance?: 'surface' | 'inverted' | 'clarkDefault' | 'clarkSidebar';
|
|
161
|
+
appearance?: 'surface' | 'inverted' | 'pills';
|
|
188
162
|
orientation?: 'horizontal' | 'vertical';
|
|
189
163
|
color?: VariantColors;
|
|
190
164
|
size?: VariantSizes;
|
|
191
|
-
/** Hide segment label text; prefix only (`sr-only`); with Clark sidebar + vertical = collapsed column */
|
|
192
165
|
compact?: boolean;
|
|
193
|
-
/** Label above the track vs beside the track (Clark uses `inline`) */
|
|
194
166
|
labelLayout?: 'above' | 'inline';
|
|
195
|
-
/** Optional class on the visible label (e.g. `sr-only` when collapsed sidebar) */
|
|
196
167
|
labelClass?: ClassValue;
|
|
197
168
|
disabled?: boolean;
|
|
198
169
|
errors?: string[];
|
|
@@ -1,41 +1,21 @@
|
|
|
1
1
|
import type { ClassValue } from 'tailwind-variants';
|
|
2
2
|
import type { CountryCode } from './country-data.js';
|
|
3
3
|
import type { VariantColors, VariantSizes } from '../../index.js';
|
|
4
|
-
/** Clark AR toolbar (`default`) vs dark sidebar (`sidebar`) — maps to SegmentedControl Clark appearances. */
|
|
5
|
-
export type MarketSelectorVariant = 'default' | 'sidebar';
|
|
6
4
|
export type MarketSelectorProps = {
|
|
7
|
-
/**
|
|
8
|
-
* Non-empty ordered list of ISO 3166-1 alpha-2 codes to show (e.g. `[Market.DE, Market.GB, Market.CH]`).
|
|
9
|
-
* United Kingdom is `Market.GB` (not `UK`).
|
|
10
|
-
*/
|
|
11
5
|
markets: CountryCode[];
|
|
12
|
-
/** Selected market; use `bind:selectedMarket`. */
|
|
13
6
|
selectedMarket?: CountryCode;
|
|
14
|
-
/** Used when `selectedMarket` is unset or not in `markets` (e.g. first paint or bad URL). */
|
|
15
7
|
defaultMarket?: CountryCode;
|
|
16
8
|
showFlags?: boolean;
|
|
17
9
|
label?: string;
|
|
18
|
-
|
|
19
|
-
* Clark AR–style market bar. When set, overrides `appearance` to `clarkDefault` / `clarkSidebar`
|
|
20
|
-
* and defaults `labelLayout` to `inline` (override with `labelLayout`).
|
|
21
|
-
*/
|
|
22
|
-
variant?: MarketSelectorVariant;
|
|
23
|
-
/**
|
|
24
|
-
* With `variant="sidebar"` only: vertical icon column and `sr-only` segment labels (Clark collapsed sidebar).
|
|
25
|
-
*/
|
|
26
|
-
collapsed?: boolean;
|
|
27
|
-
appearance?: 'surface' | 'inverted' | 'clarkDefault' | 'clarkSidebar';
|
|
10
|
+
appearance?: 'surface' | 'inverted' | 'pills';
|
|
28
11
|
orientation?: 'horizontal' | 'vertical';
|
|
29
|
-
/** Label above vs beside the track (Clark uses `inline` via `variant`). */
|
|
30
12
|
labelLayout?: 'above' | 'inline';
|
|
31
|
-
/** Extra classes on the visible label (e.g. override default `sr-only` when collapsed). */
|
|
32
13
|
labelClass?: ClassValue;
|
|
33
14
|
color?: VariantColors;
|
|
34
15
|
size?: VariantSizes;
|
|
35
16
|
compact?: boolean;
|
|
36
17
|
disabled?: boolean;
|
|
37
18
|
class?: ClassValue;
|
|
38
|
-
/** Optional form field name (hidden input), same as `SegmentedControl`. */
|
|
39
19
|
name?: string;
|
|
40
20
|
onchange?: (market: CountryCode) => void;
|
|
41
21
|
testId?: string;
|
|
@@ -1,60 +1,36 @@
|
|
|
1
1
|
import type { VariantColors, VariantSizes } from '../index.js';
|
|
2
2
|
/** @see SegmentedControlProps['appearance'] */
|
|
3
|
-
export type SegmentAppearance = 'surface' | 'inverted' | '
|
|
3
|
+
export type SegmentAppearance = 'surface' | 'inverted' | 'pills';
|
|
4
4
|
export declare const segmentedTrack: import("tailwind-variants").TVReturnType<{
|
|
5
5
|
appearance: {
|
|
6
6
|
surface: string;
|
|
7
7
|
inverted: string;
|
|
8
|
-
|
|
9
|
-
clarkDefault: string;
|
|
10
|
-
/** Clark (dark sidebar): translucent track */
|
|
11
|
-
clarkSidebar: string;
|
|
8
|
+
pills: string;
|
|
12
9
|
};
|
|
13
10
|
orientation: {
|
|
14
11
|
horizontal: string;
|
|
15
12
|
vertical: string;
|
|
16
13
|
};
|
|
17
|
-
/** Collapsed sidebar column layout (Clark) */
|
|
18
|
-
clarkCollapsed: {
|
|
19
|
-
true: string;
|
|
20
|
-
false: string;
|
|
21
|
-
};
|
|
22
14
|
}, undefined, "inline-flex overflow-hidden rounded-lg border", {
|
|
23
15
|
appearance: {
|
|
24
16
|
surface: string;
|
|
25
17
|
inverted: string;
|
|
26
|
-
|
|
27
|
-
clarkDefault: string;
|
|
28
|
-
/** Clark (dark sidebar): translucent track */
|
|
29
|
-
clarkSidebar: string;
|
|
18
|
+
pills: string;
|
|
30
19
|
};
|
|
31
20
|
orientation: {
|
|
32
21
|
horizontal: string;
|
|
33
22
|
vertical: string;
|
|
34
23
|
};
|
|
35
|
-
/** Collapsed sidebar column layout (Clark) */
|
|
36
|
-
clarkCollapsed: {
|
|
37
|
-
true: string;
|
|
38
|
-
false: string;
|
|
39
|
-
};
|
|
40
24
|
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
41
25
|
appearance: {
|
|
42
26
|
surface: string;
|
|
43
27
|
inverted: string;
|
|
44
|
-
|
|
45
|
-
clarkDefault: string;
|
|
46
|
-
/** Clark (dark sidebar): translucent track */
|
|
47
|
-
clarkSidebar: string;
|
|
28
|
+
pills: string;
|
|
48
29
|
};
|
|
49
30
|
orientation: {
|
|
50
31
|
horizontal: string;
|
|
51
32
|
vertical: string;
|
|
52
33
|
};
|
|
53
|
-
/** Collapsed sidebar column layout (Clark) */
|
|
54
|
-
clarkCollapsed: {
|
|
55
|
-
true: string;
|
|
56
|
-
false: string;
|
|
57
|
-
};
|
|
58
34
|
}, undefined, "inline-flex overflow-hidden rounded-lg border", unknown, unknown, undefined>>;
|
|
59
35
|
export declare function segmentClasses(args: {
|
|
60
36
|
selected: boolean;
|
|
@@ -62,11 +38,5 @@ export declare function segmentClasses(args: {
|
|
|
62
38
|
appearance: SegmentAppearance;
|
|
63
39
|
color: VariantColors;
|
|
64
40
|
size: VariantSizes;
|
|
65
|
-
isFirst: boolean;
|
|
66
|
-
isLast: boolean;
|
|
67
|
-
orientation: 'horizontal' | 'vertical';
|
|
68
|
-
/** Clark sidebar collapsed: stacked segments, smaller padding */
|
|
69
|
-
clarkCollapsed?: boolean;
|
|
70
41
|
}): string;
|
|
71
|
-
/** Label next to / above the track (Clark uses muted gray or default-300 in sidebar). */
|
|
72
42
|
export declare function segmentedLabelClasses(appearance: SegmentAppearance, hasError: boolean): string;
|
|
@@ -5,34 +5,18 @@ export const segmentedTrack = tv({
|
|
|
5
5
|
base: 'inline-flex overflow-hidden rounded-lg border',
|
|
6
6
|
variants: {
|
|
7
7
|
appearance: {
|
|
8
|
-
surface: 'border-default-200 bg-
|
|
8
|
+
surface: 'border-default-200 bg-white p-0',
|
|
9
9
|
inverted: 'border-white/20 bg-white/5 p-0.5',
|
|
10
|
-
|
|
11
|
-
clarkDefault: 'items-center border-gray-300 bg-white p-0',
|
|
12
|
-
/** Clark (dark sidebar): translucent track */
|
|
13
|
-
clarkSidebar: 'items-center border-white/20 bg-white/5 p-0'
|
|
10
|
+
pills: 'border-transparent bg-transparent gap-1.5 p-0 overflow-visible rounded-none'
|
|
14
11
|
},
|
|
15
12
|
orientation: {
|
|
16
13
|
horizontal: 'flex-row',
|
|
17
14
|
vertical: 'w-full flex-col'
|
|
18
|
-
},
|
|
19
|
-
/** Collapsed sidebar column layout (Clark) */
|
|
20
|
-
clarkCollapsed: {
|
|
21
|
-
true: 'gap-1',
|
|
22
|
-
false: ''
|
|
23
15
|
}
|
|
24
16
|
},
|
|
25
|
-
compoundVariants: [
|
|
26
|
-
{
|
|
27
|
-
appearance: ['clarkDefault', 'clarkSidebar'],
|
|
28
|
-
orientation: 'vertical',
|
|
29
|
-
class: 'items-center'
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
17
|
defaultVariants: {
|
|
33
18
|
appearance: 'surface',
|
|
34
|
-
orientation: 'horizontal'
|
|
35
|
-
clarkCollapsed: false
|
|
19
|
+
orientation: 'horizontal'
|
|
36
20
|
}
|
|
37
21
|
});
|
|
38
22
|
const selectedByColor = {
|
|
@@ -46,41 +30,23 @@ const selectedByColor = {
|
|
|
46
30
|
};
|
|
47
31
|
const segmentSize = {
|
|
48
32
|
[Size.XS]: 'gap-1 px-2 py-1 text-xs',
|
|
49
|
-
[Size.SM]: 'gap-1.5 px-
|
|
33
|
+
[Size.SM]: 'gap-1.5 px-3 py-1.5 text-xs',
|
|
50
34
|
[Size.BASE]: 'gap-1.5 px-3 py-1.5 text-sm',
|
|
51
35
|
[Size.LG]: 'gap-2 px-4 py-2 text-base',
|
|
52
36
|
[Size.XL]: 'gap-2 px-4 py-2.5 text-lg',
|
|
53
37
|
[Size.XXL]: 'gap-2 px-5 py-3 text-xl'
|
|
54
38
|
};
|
|
55
|
-
function isClark(appearance) {
|
|
56
|
-
return appearance === 'clarkDefault' || appearance === 'clarkSidebar';
|
|
57
|
-
}
|
|
58
39
|
export function segmentClasses(args) {
|
|
59
|
-
const { selected, disabled, appearance, color, size
|
|
60
|
-
if (
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const clarkPad = clarkCollapsed && isSidebar ? 'justify-center px-2 py-1.5' : 'gap-1.5 px-3 py-1.5';
|
|
68
|
-
const clarkBase = cn('group relative flex cursor-pointer items-center transition-all duration-150', clarkPad, 'focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:outline-none', isSidebar ? 'focus-visible:ring-offset-0' : 'focus-visible:ring-offset-2', rounding, disabled && 'cursor-not-allowed opacity-50');
|
|
69
|
-
if (disabled) {
|
|
70
|
-
return cn(clarkBase, 'text-default-400');
|
|
71
|
-
}
|
|
72
|
-
if (selected) {
|
|
73
|
-
return cn(clarkBase, 'bg-blue-600 text-white');
|
|
74
|
-
}
|
|
75
|
-
if (appearance === 'clarkDefault') {
|
|
76
|
-
return cn(clarkBase, 'bg-white text-gray-600 hover:bg-gray-50');
|
|
77
|
-
}
|
|
78
|
-
return cn(clarkBase, 'text-default-200 hover:bg-white/10');
|
|
40
|
+
const { selected, disabled, appearance, color, size } = args;
|
|
41
|
+
if (appearance === 'pills') {
|
|
42
|
+
const pillBase = cn('flex cursor-pointer items-center justify-center rounded-full font-medium transition-colors duration-150', 'focus-visible:ring-primary-500 focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-offset-2', segmentSize[size], disabled && 'cursor-not-allowed opacity-50');
|
|
43
|
+
if (disabled)
|
|
44
|
+
return cn(pillBase, 'text-default-400');
|
|
45
|
+
if (selected)
|
|
46
|
+
return cn(pillBase, selectedByColor[color]);
|
|
47
|
+
return cn(pillBase, 'bg-default-100 text-default-700 hover:bg-default-200');
|
|
79
48
|
}
|
|
80
|
-
const
|
|
81
|
-
? cn(isFirst && 'rounded-l-md', isLast && 'rounded-r-md')
|
|
82
|
-
: cn(isFirst && 'rounded-t-md', isLast && 'rounded-b-md');
|
|
83
|
-
const base = cn('flex cursor-pointer items-center justify-center font-medium transition-colors duration-150', 'focus-visible:ring-primary-500 focus-visible:ring-2 focus-visible:outline-none', appearance === 'inverted' ? 'focus-visible:ring-offset-0' : 'focus-visible:ring-offset-2', segmentSize[size], rounding, disabled && 'cursor-not-allowed opacity-50');
|
|
49
|
+
const base = cn('flex cursor-pointer items-center justify-center font-medium transition-colors duration-150', 'focus-visible:ring-primary-500 focus-visible:ring-2 focus-visible:outline-none', appearance === 'inverted' ? 'focus-visible:ring-offset-0' : 'focus-visible:ring-offset-2', segmentSize[size], disabled && 'cursor-not-allowed opacity-50');
|
|
84
50
|
if (disabled) {
|
|
85
51
|
return cn(base, 'text-default-400');
|
|
86
52
|
}
|
|
@@ -88,20 +54,14 @@ export function segmentClasses(args) {
|
|
|
88
54
|
return cn(base, selectedByColor[color]);
|
|
89
55
|
}
|
|
90
56
|
if (appearance === 'surface') {
|
|
91
|
-
return cn(base, 'bg-
|
|
57
|
+
return cn(base, 'bg-white text-default-600 hover:bg-default-50');
|
|
92
58
|
}
|
|
93
59
|
return cn(base, 'bg-transparent text-default-200 hover:bg-white/10');
|
|
94
60
|
}
|
|
95
|
-
/** Label next to / above the track (Clark uses muted gray or default-300 in sidebar). */
|
|
96
61
|
export function segmentedLabelClasses(appearance, hasError) {
|
|
97
|
-
if (hasError)
|
|
98
|
-
return 'text-sm font-medium text-danger-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
if (appearance === 'clarkSidebar') {
|
|
104
|
-
return 'text-xs text-default-300';
|
|
105
|
-
}
|
|
106
|
-
return cn('text-sm font-medium', 'text-default-700');
|
|
62
|
+
if (hasError)
|
|
63
|
+
return 'text-sm font-medium text-danger-600';
|
|
64
|
+
if (appearance === 'inverted')
|
|
65
|
+
return 'text-sm font-medium text-default-200';
|
|
66
|
+
return 'text-sm font-medium text-default-700';
|
|
107
67
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -28,22 +28,19 @@ export type { BreadcrumbItem, BreadcrumbsProps, PageHeaderProps } from './header
|
|
|
28
28
|
export type { TabItem, TabProps, TabsGroupProps, TabContentProps } from './layout/tabs/tabs-types.js';
|
|
29
29
|
export type { NavbarLinkItem, NavbarProps } from './layout/navbar/navbar-types.js';
|
|
30
30
|
export type { MenuBar, BaseNavigationItem, WithIcon, Activatable, LinkItem, ParentItem, DividerItem, NavigationItem, LogoType, NavGroupProps, NavItemProps, SidebarProps } from './layout/sidebar/sidebar-types.js';
|
|
31
|
-
export type { ChartColorKey, ChartColorValue, ChartColors, ChartType, ChartColorString, XAxisConfig, YAxisConfig, SeriesConfig, GridConfig, LegendConfig, TooltipConfig, ToolboxConfig, ChartConfig, PointClickType, ChartRenderType, ChartProps } from './charts/chart-types.js';
|
|
32
|
-
export type { FormProps, InputProps, RadioOption,
|
|
31
|
+
export type { ChartColorKey, ChartColorValue, ChartColors, ChartType, ChartColorString, XAxisConfig, YAxisConfig, SeriesConfig, ChartThreshold, ChartAnnotation, GridConfig, LegendConfig, TooltipConfig, ToolboxConfig, ChartConfig, PointClickType, ChartRenderType, ChartProps } from './charts/chart-types.js';
|
|
32
|
+
export type { FormProps, InputProps, RadioOption, CheckboxProps, ToggleProps, CurrencyOption, NumberInputProps, DateRangeProps, DateSelectEvent, TagsProps, SliderMode, NotationType, EnumOption, SliderProps, SegmentedOption, SegmentedControlProps } from './forms/form-types.js';
|
|
33
33
|
export type { CountryCode } from './forms/market/country-data.js';
|
|
34
34
|
export type { MarketCode } from './forms/market/market.js';
|
|
35
35
|
export { ALL_COUNTRY_CODES, COUNTRY_NAMES } from './forms/market/country-data.js';
|
|
36
36
|
export { Market } from './forms/market/market.js';
|
|
37
|
-
export type { MarketSelectorProps
|
|
37
|
+
export type { MarketSelectorProps } from './forms/market/market-selector-types.js';
|
|
38
38
|
export { countryCodeToFlagEmoji } from './forms/market/flag-emoji.js';
|
|
39
39
|
export type { ProgressSegment, ProgressProps } from './elements/progress/progress-types.js';
|
|
40
40
|
export type { SpinnerProps } from './elements/spinner/spinner-types.js';
|
|
41
41
|
export type { EmptyStateProps, EmptyStateSize } from './elements/empty-state/empty-state-types.js';
|
|
42
|
-
export type { CollapsibleProps } from './elements/collapsible/collapsible-types.js';
|
|
43
42
|
export type { TooltipProps, TooltipPlacement } from './elements/tooltip/tooltip-types.js';
|
|
44
|
-
export type { ComboboxItem, ComboboxProps } from './elements/combobox/combobox-types.js';
|
|
45
43
|
export type { AccordionProps } from './elements/accordion/accordion-types.js';
|
|
46
|
-
export type { TimelineItem } from './elements/timeline/timeline-types.js';
|
|
47
44
|
export type { FilterTab, FilterGroup, CompactFiltersProps } from './filters/filter-types.js';
|
|
48
45
|
export type { ActivityItemBadge, ActivityItemAction, ActivityItem, ActivityListProps, ActivityListSize } from './layout/activity-list/activity-list-types.js';
|
|
49
46
|
export type { FileUploadProps, FileUploadSize, FilePreviewProps, UploadedFile, StagedFile } from './elements/file-upload/file-upload-types.js';
|
|
@@ -84,11 +81,8 @@ export { default as Spinner } from './elements/spinner/Spinner.svelte';
|
|
|
84
81
|
export { spinner as spinnerVariants } from './elements/spinner/spinner.js';
|
|
85
82
|
export { default as EmptyState } from './elements/empty-state/EmptyState.svelte';
|
|
86
83
|
export { emptyState as emptyStateVariants } from './elements/empty-state/empty-state.js';
|
|
87
|
-
export { default as Collapsible } from './elements/collapsible/Collapsible.svelte';
|
|
88
84
|
export { default as Tooltip } from './elements/tooltip/Tooltip.svelte';
|
|
89
|
-
export { default as Combobox } from './elements/combobox/Combobox.svelte';
|
|
90
85
|
export { default as Accordion } from './elements/accordion/Accordion.svelte';
|
|
91
|
-
export { default as Timeline } from './elements/timeline/Timeline.svelte';
|
|
92
86
|
export { default as Chart } from './charts/Chart.svelte';
|
|
93
87
|
export { default as FileUpload } from './elements/file-upload/FileUpload.svelte';
|
|
94
88
|
export { default as FilesPreview } from './elements/file-upload/FilesPreview.svelte';
|
|
@@ -99,14 +93,12 @@ export { default as CodeRenderer } from './ai/CodeRenderer.svelte';
|
|
|
99
93
|
export * from './ai/content-detector.js';
|
|
100
94
|
export { default as Form } from './forms/Form.svelte';
|
|
101
95
|
export { default as Input } from './forms/Input.svelte';
|
|
102
|
-
export { default as RadioInputs } from './forms/RadioInputs.svelte';
|
|
103
96
|
export { default as Checkbox } from './forms/Checkbox.svelte';
|
|
104
97
|
export { default as Toggle } from './forms/Toggle.svelte';
|
|
105
98
|
export { default as Slider } from './forms/Slider.svelte';
|
|
106
99
|
export { default as NumberInput } from './forms/NumberInput.svelte';
|
|
107
100
|
export { default as DateRange } from './forms/DateRange.svelte';
|
|
108
101
|
export { default as Tags } from './forms/Tags.svelte';
|
|
109
|
-
export { default as RadioPill } from './forms/RadioPill.svelte';
|
|
110
102
|
export { default as SegmentedControl } from './forms/SegmentedControl.svelte';
|
|
111
103
|
export { default as MarketSelector } from './forms/MarketSelector.svelte';
|
|
112
104
|
export { dropdownMenu } from './elements/dropdown/dropdown.js';
|
package/dist/index.js
CHANGED
|
@@ -67,16 +67,10 @@ export { spinner as spinnerVariants } from './elements/spinner/spinner.js';
|
|
|
67
67
|
// Elements - EmptyState
|
|
68
68
|
export { default as EmptyState } from './elements/empty-state/EmptyState.svelte';
|
|
69
69
|
export { emptyState as emptyStateVariants } from './elements/empty-state/empty-state.js';
|
|
70
|
-
// Elements - Collapsible
|
|
71
|
-
export { default as Collapsible } from './elements/collapsible/Collapsible.svelte';
|
|
72
70
|
// Elements - Tooltip
|
|
73
71
|
export { default as Tooltip } from './elements/tooltip/Tooltip.svelte';
|
|
74
|
-
// Elements - Combobox
|
|
75
|
-
export { default as Combobox } from './elements/combobox/Combobox.svelte';
|
|
76
72
|
// Elements - Accordion
|
|
77
73
|
export { default as Accordion } from './elements/accordion/Accordion.svelte';
|
|
78
|
-
// Elements - Timeline
|
|
79
|
-
export { default as Timeline } from './elements/timeline/Timeline.svelte';
|
|
80
74
|
// Chart
|
|
81
75
|
export { default as Chart } from './charts/Chart.svelte';
|
|
82
76
|
// File Upload
|
|
@@ -93,14 +87,12 @@ export * from './ai/content-detector.js';
|
|
|
93
87
|
// Form Component Exports
|
|
94
88
|
export { default as Form } from './forms/Form.svelte';
|
|
95
89
|
export { default as Input } from './forms/Input.svelte';
|
|
96
|
-
export { default as RadioInputs } from './forms/RadioInputs.svelte';
|
|
97
90
|
export { default as Checkbox } from './forms/Checkbox.svelte';
|
|
98
91
|
export { default as Toggle } from './forms/Toggle.svelte';
|
|
99
92
|
export { default as Slider } from './forms/Slider.svelte';
|
|
100
93
|
export { default as NumberInput } from './forms/NumberInput.svelte';
|
|
101
94
|
export { default as DateRange } from './forms/DateRange.svelte';
|
|
102
95
|
export { default as Tags } from './forms/Tags.svelte';
|
|
103
|
-
export { default as RadioPill } from './forms/RadioPill.svelte';
|
|
104
96
|
export { default as SegmentedControl } from './forms/SegmentedControl.svelte';
|
|
105
97
|
export { default as MarketSelector } from './forms/MarketSelector.svelte';
|
|
106
98
|
// ============================================================================
|
|
@@ -105,6 +105,61 @@
|
|
|
105
105
|
<div class="min-w-0 flex-1" data-activity-custom="">
|
|
106
106
|
{@render customContent?.(activityItem, index)}
|
|
107
107
|
</div>
|
|
108
|
+
{:else if timeline && activityItem.subtitle}
|
|
109
|
+
<div class="min-w-0 flex-1">
|
|
110
|
+
<div class="flex items-start justify-between gap-3">
|
|
111
|
+
<div
|
|
112
|
+
class="ring-default-200 flex-1 rounded-md bg-white p-3 ring-1"
|
|
113
|
+
data-activity-comment=""
|
|
114
|
+
>
|
|
115
|
+
<div class="mb-1 flex justify-between gap-x-4">
|
|
116
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
117
|
+
<button
|
|
118
|
+
class="text-default-900 text-sm font-medium"
|
|
119
|
+
onclick={() => onItemClick?.(activityItem, index)}
|
|
120
|
+
>
|
|
121
|
+
{activityItem.title}
|
|
122
|
+
</button>
|
|
123
|
+
{#if activityItem.badges}
|
|
124
|
+
{#each activityItem.badges as badge (badge.text)}
|
|
125
|
+
{#if badge.color}
|
|
126
|
+
<Badge color={badge.color} size={Size.SM}>{badge.text}</Badge>
|
|
127
|
+
{:else if badge.class}
|
|
128
|
+
<span
|
|
129
|
+
class="inline-flex rounded-full px-2 py-1 text-xs font-medium {badge.class}"
|
|
130
|
+
>
|
|
131
|
+
{badge.text}
|
|
132
|
+
</span>
|
|
133
|
+
{:else}
|
|
134
|
+
<Badge size={Size.SM}>{badge.text}</Badge>
|
|
135
|
+
{/if}
|
|
136
|
+
{/each}
|
|
137
|
+
{/if}
|
|
138
|
+
</div>
|
|
139
|
+
{#if activityItem.timestamp}
|
|
140
|
+
<div class={itemTimestamp()} data-activity-timestamp="">
|
|
141
|
+
{activityItem.timestamp}
|
|
142
|
+
</div>
|
|
143
|
+
{/if}
|
|
144
|
+
</div>
|
|
145
|
+
<p class="text-default-500 text-sm">{activityItem.subtitle}</p>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
{#if activityItem.actions}
|
|
149
|
+
<div class={cn(itemActions(), 'mt-2')}>
|
|
150
|
+
{#each activityItem.actions as action (action.label)}
|
|
151
|
+
<Button
|
|
152
|
+
size={Size.XS}
|
|
153
|
+
variant={action.variant ?? 'outline'}
|
|
154
|
+
color={action.color ?? Color.DEFAULT}
|
|
155
|
+
onclick={() => action.onClick?.()}
|
|
156
|
+
>
|
|
157
|
+
{action.label}
|
|
158
|
+
</Button>
|
|
159
|
+
{/each}
|
|
160
|
+
</div>
|
|
161
|
+
{/if}
|
|
162
|
+
</div>
|
|
108
163
|
{:else}
|
|
109
164
|
<div class={itemContent()}>
|
|
110
165
|
<div class={itemMain()}>
|
|
@@ -117,7 +172,6 @@
|
|
|
117
172
|
{#if badge.color}
|
|
118
173
|
<Badge color={badge.color} size={Size.SM}>{badge.text}</Badge>
|
|
119
174
|
{:else if badge.class}
|
|
120
|
-
<!-- Legacy class-based badge — kept for backward compat -->
|
|
121
175
|
<span
|
|
122
176
|
class="inline-flex rounded-full px-2 py-1 text-xs font-medium {badge.class}"
|
|
123
177
|
>
|
package/dist/variants.js
CHANGED
|
@@ -24,12 +24,12 @@ export const ChartColor = {
|
|
|
24
24
|
DEFAULT: 'default'
|
|
25
25
|
};
|
|
26
26
|
export const defaultChartColors = {
|
|
27
|
-
[ChartColor.HEALTH]: '#
|
|
28
|
-
[ChartColor.PROPERTY]: '#
|
|
29
|
-
[ChartColor.AUTO]: '#
|
|
30
|
-
[ChartColor.LIFE]: '#
|
|
31
|
-
[ChartColor.OTHER]: '#
|
|
32
|
-
[ChartColor.DEFAULT]: '#
|
|
27
|
+
[ChartColor.HEALTH]: '#6366f1',
|
|
28
|
+
[ChartColor.PROPERTY]: '#10b981',
|
|
29
|
+
[ChartColor.AUTO]: '#f59e0b',
|
|
30
|
+
[ChartColor.LIFE]: '#ef4444',
|
|
31
|
+
[ChartColor.OTHER]: '#8b5cf6',
|
|
32
|
+
[ChartColor.DEFAULT]: '#64748b'
|
|
33
33
|
};
|
|
34
34
|
export const colors = Object.values(Color);
|
|
35
35
|
export const sizes = Object.values(Size);
|
package/package.json
CHANGED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { cn } from '../../helper/cls.js';
|
|
3
|
-
import { buildTestId } from '../../helper/testid.js';
|
|
4
|
-
import type { CollapsibleProps } from '../../index.js';
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
open = $bindable(false),
|
|
8
|
-
title,
|
|
9
|
-
header,
|
|
10
|
-
children,
|
|
11
|
-
class: className = '',
|
|
12
|
-
headerClass = '',
|
|
13
|
-
contentClass = '',
|
|
14
|
-
disabled = false,
|
|
15
|
-
ontoggle,
|
|
16
|
-
testId
|
|
17
|
-
}: CollapsibleProps = $props();
|
|
18
|
-
|
|
19
|
-
function toggle() {
|
|
20
|
-
if (disabled) return;
|
|
21
|
-
open = !open;
|
|
22
|
-
ontoggle?.(open);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function handleKeydown(event: KeyboardEvent) {
|
|
26
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
27
|
-
event.preventDefault();
|
|
28
|
-
toggle();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<div
|
|
34
|
-
class={cn('border-default-200 overflow-hidden rounded-md border', className)}
|
|
35
|
-
data-testid={buildTestId('collapsible', undefined, testId)}
|
|
36
|
-
data-open={open ? 'true' : 'false'}
|
|
37
|
-
>
|
|
38
|
-
<button
|
|
39
|
-
type="button"
|
|
40
|
-
class={cn(
|
|
41
|
-
'flex w-full cursor-pointer items-center justify-between gap-2 px-4 py-3 text-left transition-colors',
|
|
42
|
-
'hover:bg-default-50 focus-visible:ring-primary-500 focus-visible:ring-2 focus-visible:outline-none',
|
|
43
|
-
disabled && 'cursor-not-allowed opacity-50',
|
|
44
|
-
headerClass
|
|
45
|
-
)}
|
|
46
|
-
aria-expanded={open}
|
|
47
|
-
aria-disabled={disabled ? 'true' : undefined}
|
|
48
|
-
{disabled}
|
|
49
|
-
onclick={toggle}
|
|
50
|
-
onkeydown={handleKeydown}
|
|
51
|
-
>
|
|
52
|
-
{#if header}
|
|
53
|
-
{@render header({ open })}
|
|
54
|
-
{:else}
|
|
55
|
-
<span class="text-default-800 font-medium">{title}</span>
|
|
56
|
-
{/if}
|
|
57
|
-
<svg
|
|
58
|
-
class={cn(
|
|
59
|
-
'text-default-500 h-4 w-4 shrink-0 transition-transform duration-200',
|
|
60
|
-
open && 'rotate-180'
|
|
61
|
-
)}
|
|
62
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
63
|
-
viewBox="0 0 20 20"
|
|
64
|
-
fill="currentColor"
|
|
65
|
-
aria-hidden="true"
|
|
66
|
-
>
|
|
67
|
-
<path
|
|
68
|
-
fill-rule="evenodd"
|
|
69
|
-
d="M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 111.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z"
|
|
70
|
-
clip-rule="evenodd"
|
|
71
|
-
/>
|
|
72
|
-
</svg>
|
|
73
|
-
</button>
|
|
74
|
-
{#if open}
|
|
75
|
-
<div class={cn('border-default-200 border-t px-4 py-3', contentClass)}>
|
|
76
|
-
{@render children()}
|
|
77
|
-
</div>
|
|
78
|
-
{/if}
|
|
79
|
-
</div>
|