@makolabs/ripple 2.5.9 → 3.0.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/README.md +403 -497
- package/dist/adapters/storage/S3Adapter.d.ts +49 -1
- package/dist/adapters/storage/S3Adapter.js +38 -1
- package/dist/adapters/storage/types.d.ts +20 -0
- package/dist/ai/AIChatInterface.svelte +2 -1
- package/dist/ai/AIChatInterface.svelte.d.ts +2 -1
- package/dist/ai/CodeRenderer.svelte +7 -2
- package/dist/ai/CodeRenderer.svelte.d.ts +2 -1
- package/dist/ai/ComposeDropdown.svelte +1 -1
- package/dist/ai/MessageBox.svelte +3 -3
- package/dist/ai/MessageBox.svelte.d.ts +3 -2
- package/dist/ai/ThinkingDisplay.svelte +4 -3
- package/dist/ai/ThinkingDisplay.svelte.d.ts +2 -1
- package/dist/ai/ai-types.d.ts +55 -1
- package/dist/button/Button.svelte +5 -5
- package/dist/button/button-types.d.ts +49 -4
- package/dist/button/button.d.ts +9 -9
- package/dist/button/button.js +6 -6
- package/dist/charts/Chart.svelte +8 -16
- package/dist/charts/chart-types.d.ts +78 -1
- package/dist/drawer/Drawer.svelte +6 -26
- package/dist/drawer/drawer-types.d.ts +33 -12
- package/dist/drawer/drawer.d.ts +3 -3
- package/dist/drawer/drawer.js +1 -1
- package/dist/elements/accordion/Accordion.svelte +6 -17
- package/dist/elements/accordion/accordion-types.d.ts +53 -6
- package/dist/elements/alert/Alert.svelte +3 -0
- package/dist/elements/badge/Badge.svelte +1 -1
- package/dist/elements/badge/badge-types.d.ts +22 -0
- package/dist/elements/badge/badge.d.ts +3 -3
- package/dist/elements/badge/badge.js +1 -1
- package/dist/elements/combobox/ComboBox.svelte +247 -0
- package/dist/elements/combobox/ComboBox.svelte.d.ts +4 -0
- package/dist/elements/combobox/combobox-types.d.ts +41 -0
- package/dist/elements/combobox/combobox-types.js +1 -0
- package/dist/elements/context-menu/ContextMenu.svelte +137 -0
- package/dist/elements/context-menu/ContextMenu.svelte.d.ts +4 -0
- package/dist/elements/context-menu/context-menu-types.d.ts +40 -0
- package/dist/elements/context-menu/context-menu-types.js +1 -0
- package/dist/elements/dropdown/Dropdown.svelte +1 -1
- package/dist/elements/dropdown/Select.svelte +4 -1
- package/dist/elements/dropdown/dropdown-types.d.ts +114 -0
- package/dist/elements/dropdown/dropdown.d.ts +3 -3
- package/dist/elements/dropdown/dropdown.js +2 -2
- package/dist/elements/dropdown/select.d.ts +3 -3
- package/dist/elements/dropdown/select.js +2 -2
- package/dist/elements/empty-state/EmptyState.svelte +1 -1
- package/dist/elements/empty-state/empty-state-types.d.ts +32 -1
- package/dist/elements/empty-state/empty-state.d.ts +3 -3
- package/dist/elements/empty-state/empty-state.js +2 -2
- package/dist/elements/file-upload/FileUpload.svelte +5 -0
- package/dist/elements/file-upload/file-upload-types.d.ts +59 -0
- package/dist/elements/pagination/Pagination.svelte +53 -21
- package/dist/elements/pagination/Pagination.svelte.d.ts +33 -5
- package/dist/elements/popover/Popover.svelte +234 -0
- package/dist/elements/popover/Popover.svelte.d.ts +4 -0
- package/dist/elements/popover/index.d.ts +2 -0
- package/dist/elements/popover/index.js +1 -0
- package/dist/elements/popover/popover-types.d.ts +60 -0
- package/dist/elements/popover/popover-types.js +1 -0
- package/dist/elements/progress/Progress.svelte +32 -7
- package/dist/elements/progress/progress-types.d.ts +48 -1
- package/dist/elements/skeleton/Skeleton.svelte +56 -0
- package/dist/elements/skeleton/Skeleton.svelte.d.ts +4 -0
- package/dist/elements/skeleton/index.d.ts +2 -0
- package/dist/elements/skeleton/index.js +1 -0
- package/dist/elements/skeleton/skeleton-types.d.ts +50 -0
- package/dist/elements/skeleton/skeleton-types.js +1 -0
- package/dist/elements/spinner/Spinner.svelte +1 -1
- package/dist/elements/spinner/spinner-types.d.ts +20 -0
- package/dist/elements/spinner/spinner.d.ts +3 -3
- package/dist/elements/spinner/spinner.js +2 -2
- package/dist/elements/tooltip/Tooltip.svelte +108 -11
- package/dist/elements/tooltip/tooltip-types.d.ts +49 -1
- package/dist/file-browser/FileBrowser.svelte +21 -12
- package/dist/filters/CompactFilters.svelte +221 -33
- package/dist/filters/CompactFilters.svelte.d.ts +1 -1
- package/dist/filters/FilterBar.svelte +184 -0
- package/dist/filters/FilterBar.svelte.d.ts +4 -0
- package/dist/filters/FilterPopover.svelte +346 -0
- package/dist/filters/FilterPopover.svelte.d.ts +4 -0
- package/dist/filters/date-presets.d.ts +15 -0
- package/dist/filters/date-presets.js +107 -0
- package/dist/filters/filter-types.d.ts +69 -3
- package/dist/filters/index.d.ts +5 -0
- package/dist/filters/index.js +4 -0
- package/dist/filters/sync-filters-to-url.svelte.d.ts +37 -0
- package/dist/filters/sync-filters-to-url.svelte.js +114 -0
- package/dist/forms/DateRange.svelte +4 -2
- package/dist/forms/Input.svelte +2 -2
- package/dist/forms/MarketSelector.svelte +8 -3
- package/dist/forms/NumberInput.svelte +4 -4
- package/dist/forms/RadioGroup.svelte +123 -0
- package/dist/forms/RadioGroup.svelte.d.ts +4 -0
- package/dist/forms/SegmentedControl.svelte +11 -4
- package/dist/forms/Slider.svelte +72 -3
- package/dist/forms/Tags.svelte +14 -5
- package/dist/forms/Textarea.svelte +126 -0
- package/dist/forms/Textarea.svelte.d.ts +4 -0
- package/dist/forms/Toggle.svelte +8 -8
- package/dist/forms/calendar/Calendar.svelte +218 -0
- package/dist/forms/calendar/Calendar.svelte.d.ts +4 -0
- package/dist/forms/calendar/calendar-types.d.ts +46 -0
- package/dist/forms/calendar/calendar-types.js +1 -0
- package/dist/forms/calendar/index.d.ts +2 -0
- package/dist/forms/calendar/index.js +1 -0
- package/dist/forms/date-picker/DatePicker.svelte +144 -0
- package/dist/forms/date-picker/DatePicker.svelte.d.ts +4 -0
- package/dist/forms/date-picker/date-picker-types.d.ts +29 -0
- package/dist/forms/date-picker/date-picker-types.js +1 -0
- package/dist/forms/form-types.d.ts +425 -6
- package/dist/forms/market/market-selector-types.d.ts +52 -1
- package/dist/forms/segmented-control.d.ts +5 -2
- package/dist/forms/segmented-control.js +16 -5
- package/dist/forms/slider.d.ts +3 -3
- package/dist/forms/slider.js +2 -2
- package/dist/funcs/user-management.remote.js +1 -1
- package/dist/header/Breadcrumbs.svelte +4 -20
- package/dist/header/PageHeader.svelte +6 -14
- package/dist/header/breadcrumbs.d.ts +3 -11
- package/dist/header/breadcrumbs.js +10 -5
- package/dist/header/header-types.d.ts +62 -11
- package/dist/index.d.ts +35 -9
- package/dist/index.js +24 -4
- package/dist/layout/activity-list/ActivityList.svelte +13 -7
- package/dist/layout/activity-list/activity-list-types.d.ts +46 -7
- package/dist/layout/card/Card.svelte +12 -15
- package/dist/layout/card/MetricCard.svelte +50 -32
- package/dist/layout/card/card-types.d.ts +114 -4
- package/dist/layout/navbar/navbar-types.d.ts +48 -0
- package/dist/layout/navbar/navbar.d.ts +3 -3
- package/dist/layout/navbar/navbar.js +2 -2
- package/dist/layout/sidebar/Sidebar.svelte +87 -11
- package/dist/layout/sidebar/sidebar-types.d.ts +60 -1
- package/dist/layout/stepper/Stepper.svelte +288 -0
- package/dist/layout/stepper/Stepper.svelte.d.ts +4 -0
- package/dist/layout/stepper/stepper-types.d.ts +80 -0
- package/dist/layout/stepper/stepper-types.js +1 -0
- package/dist/layout/table/Table.svelte +91 -85
- package/dist/layout/table/table-types.d.ts +148 -24
- package/dist/layout/table/table.d.ts +3 -3
- package/dist/layout/table/table.js +2 -2
- package/dist/layout/tabs/Tab.svelte +6 -2
- package/dist/layout/tabs/Tab.svelte.d.ts +4 -1
- package/dist/layout/tabs/TabGroup.svelte +9 -2
- package/dist/layout/tabs/tabs-types.d.ts +63 -0
- package/dist/layout/tabs/tabs.d.ts +3 -3
- package/dist/layout/tabs/tabs.js +12 -6
- package/dist/modal/ConfirmDialog.svelte +65 -0
- package/dist/modal/ConfirmDialog.svelte.d.ts +4 -0
- package/dist/modal/Modal.svelte +6 -26
- package/dist/modal/confirm-dialog-types.d.ts +39 -0
- package/dist/modal/confirm-dialog-types.js +1 -0
- package/dist/modal/modal-types.d.ts +51 -12
- package/dist/modal/modal.d.ts +3 -3
- package/dist/modal/modal.js +3 -3
- package/dist/pipeline/Pipeline.svelte +8 -3
- package/dist/pipeline/pipeline-types.d.ts +55 -3
- package/dist/pipeline/pipeline.d.ts +18 -3
- package/dist/pipeline/pipeline.js +7 -2
- package/dist/server/s3.d.ts +35 -3
- package/dist/sonner/Toaster.svelte +29 -0
- package/dist/sonner/Toaster.svelte.d.ts +4 -0
- package/dist/sonner/index.d.ts +21 -0
- package/dist/sonner/index.js +20 -0
- package/dist/user-management/UserManagement.svelte +22 -16
- package/dist/user-management/UserModal.svelte +10 -7
- package/dist/user-management/UserTable.svelte +16 -17
- package/dist/user-management/UserViewModal.svelte +11 -11
- package/dist/user-management/user-management-types.d.ts +118 -31
- package/dist/variants.d.ts +1 -1
- package/dist/variants.js +1 -1
- package/package.json +7 -4
- package/dist/config/ai.d.ts +0 -13
- package/dist/config/ai.js +0 -44
- package/dist/elements/empty-state/EmptyStateTestWrapper.svelte +0 -25
- package/dist/elements/empty-state/EmptyStateTestWrapper.svelte.d.ts +0 -8
- package/dist/elements/tooltip/TooltipTestWrapper.svelte +0 -14
- package/dist/elements/tooltip/TooltipTestWrapper.svelte.d.ts +0 -7
- package/dist/helper/deprecation.d.ts +0 -14
- package/dist/helper/deprecation.js +0 -24
- package/dist/modal/ModalFooterTestWrapper.svelte +0 -17
- package/dist/modal/ModalFooterTestWrapper.svelte.d.ts +0 -8
|
@@ -4,92 +4,297 @@ import type { Component } from 'svelte';
|
|
|
4
4
|
import type { DOMAttributes } from 'svelte/elements';
|
|
5
5
|
import type { SuperForm } from 'sveltekit-superforms';
|
|
6
6
|
import type { VariantColors, VariantSizes } from '../index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Props for `<Form>` — a thin wrapper around a native `<form>` that wires
|
|
9
|
+
* in a [sveltekit-superforms](https://superforms.rocks) `SuperForm`
|
|
10
|
+
* instance and exposes its enhance/delayed helpers to child inputs.
|
|
11
|
+
*
|
|
12
|
+
* Use Form when you want validation, progressive enhancement, and the
|
|
13
|
+
* `Input`/`Checkbox`/`Toggle` helpers to read error state automatically.
|
|
14
|
+
* Skip Form if you're assembling a simple filter bar or uncontrolled UI.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```svelte
|
|
18
|
+
* <script lang="ts">
|
|
19
|
+
* import { Form, Input, Button } from '@makolabs/ripple';
|
|
20
|
+
* import { superForm } from 'sveltekit-superforms';
|
|
21
|
+
* export let data;
|
|
22
|
+
* const form = superForm(data.form);
|
|
23
|
+
* </script>
|
|
24
|
+
*
|
|
25
|
+
* <Form {form} method="POST">
|
|
26
|
+
* <Input name="email" label="Email" />
|
|
27
|
+
* <Button type="submit">Save</Button>
|
|
28
|
+
* </Form>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
7
31
|
export interface FormProps<T extends Record<string, unknown>> {
|
|
32
|
+
/** Result of `superForm(data.form)`. Drives validation + progressive enhancement. */
|
|
8
33
|
form: SuperForm<any>;
|
|
9
34
|
class?: ClassValue;
|
|
35
|
+
/** HTTP method on the underlying `<form>`. @default 'POST' */
|
|
10
36
|
method?: 'GET' | 'POST' | 'dialog' | 'get' | 'post' | 'DIALOG' | null | undefined;
|
|
37
|
+
/** Where to post. Defaults to the current route (SvelteKit convention). */
|
|
11
38
|
action?: string;
|
|
39
|
+
/** Matches the native `enctype` attribute. Use `'multipart/form-data'` for file uploads. */
|
|
12
40
|
enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain' | null | undefined;
|
|
41
|
+
/** Autofill hint for the whole form. @default 'on' (browser default) */
|
|
13
42
|
autocomplete?: 'on' | 'off';
|
|
43
|
+
/** Suppress native HTML5 validation; lean on superforms / server errors instead. */
|
|
14
44
|
novalidate?: boolean;
|
|
45
|
+
/** Form content — typically `<Input>`/`<Checkbox>`/`<Button>` children. */
|
|
15
46
|
children?: Snippet;
|
|
16
47
|
testId?: string;
|
|
17
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Props for `<Input>` — a styled wrapper around `<input>` (and `<textarea>`
|
|
51
|
+
* when `type='textarea'`). Supports labels, validation errors, size
|
|
52
|
+
* variants, and all native input attributes via rest props.
|
|
53
|
+
*
|
|
54
|
+
* Prefer `<Textarea>` for multi-line input — it exposes richer options
|
|
55
|
+
* (autoGrow, maxLength + counter). Keep `<Input type='textarea'>` for
|
|
56
|
+
* simple cases where Input's wider API is enough.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```svelte
|
|
60
|
+
* <Input name="email" type="email" label="Email" bind:value={email} required />
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```svelte
|
|
65
|
+
* <!-- With validation errors -->
|
|
66
|
+
* <Input
|
|
67
|
+
* name="username"
|
|
68
|
+
* bind:value={username}
|
|
69
|
+
* errors={['Already taken']}
|
|
70
|
+
* />
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
18
73
|
export type InputProps = {
|
|
74
|
+
/** @default 'text' */
|
|
19
75
|
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'date' | 'textarea';
|
|
76
|
+
/** Bindable input value. */
|
|
20
77
|
value?: string | number;
|
|
78
|
+
/** Input name. Also used as `id` if one isn't supplied. */
|
|
21
79
|
name: string;
|
|
80
|
+
/** Optional label rendered above the input. */
|
|
22
81
|
label?: string;
|
|
23
82
|
placeholder?: string;
|
|
24
83
|
required?: boolean;
|
|
25
84
|
disabled?: boolean;
|
|
26
85
|
class?: ClassValue;
|
|
27
86
|
size?: VariantSizes;
|
|
87
|
+
/** Explicit `id`. Falls back to `name`. */
|
|
28
88
|
id?: string;
|
|
89
|
+
/** Validation error messages. When non-empty, the input gets a danger border. */
|
|
29
90
|
errors?: string[];
|
|
30
91
|
testId?: string;
|
|
31
92
|
} & DOMAttributes<HTMLInputElement>;
|
|
93
|
+
/**
|
|
94
|
+
* Single option for `<RadioGroup>` (and the fused `<SegmentedControl>`,
|
|
95
|
+
* which extends it).
|
|
96
|
+
*/
|
|
32
97
|
export type RadioOption = {
|
|
98
|
+
/** Underlying form value — what you bind to. */
|
|
33
99
|
value: string;
|
|
100
|
+
/** Visible text. */
|
|
34
101
|
label: string;
|
|
102
|
+
/** Short helper text shown under the label. */
|
|
103
|
+
description?: string;
|
|
104
|
+
disabled?: boolean;
|
|
35
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* Props for `<RadioGroup>` — a set of mutually-exclusive radio buttons.
|
|
108
|
+
* Reach for this when the options are short and should stay visible
|
|
109
|
+
* (3-5 items); use `<Select>` or `<ComboBox>` for longer lists.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```svelte
|
|
113
|
+
* <RadioGroup
|
|
114
|
+
* name="plan"
|
|
115
|
+
* label="Choose a plan"
|
|
116
|
+
* bind:value={plan}
|
|
117
|
+
* options={[
|
|
118
|
+
* { value: 'free', label: 'Free' },
|
|
119
|
+
* { value: 'pro', label: 'Pro', description: '$10/mo' }
|
|
120
|
+
* ]}
|
|
121
|
+
* />
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
export interface RadioGroupProps {
|
|
125
|
+
name: string;
|
|
126
|
+
label?: string;
|
|
127
|
+
options: RadioOption[];
|
|
128
|
+
/** Bindable selected option value. */
|
|
129
|
+
value?: string;
|
|
130
|
+
disabled?: boolean;
|
|
131
|
+
required?: boolean;
|
|
132
|
+
/** Stack vertically or horizontally. @default 'vertical' */
|
|
133
|
+
orientation?: 'vertical' | 'horizontal';
|
|
134
|
+
size?: VariantSizes;
|
|
135
|
+
/** Color for the selected dot. @default 'primary' */
|
|
136
|
+
color?: VariantColors;
|
|
137
|
+
errors?: string[];
|
|
138
|
+
class?: ClassValue;
|
|
139
|
+
/** Fires whenever the selection changes. */
|
|
140
|
+
onchange?: (value: string) => void;
|
|
141
|
+
testId?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Props for `<Checkbox>` — a single boolean toggle. Use `<Toggle>` for
|
|
145
|
+
* "on/off" UX (feature switches), and Checkbox for "selected/not selected"
|
|
146
|
+
* UX (filters, agreements, list item selection).
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```svelte
|
|
150
|
+
* <Checkbox name="terms" label="I accept the terms" bind:value={accepted} required />
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
36
153
|
export type CheckboxProps = {
|
|
37
154
|
name: string;
|
|
38
155
|
label?: string;
|
|
156
|
+
/** Bindable checked state. */
|
|
39
157
|
value?: boolean;
|
|
40
158
|
disabled?: boolean;
|
|
41
159
|
class?: ClassValue;
|
|
42
160
|
size?: VariantSizes;
|
|
161
|
+
/** Checked-state fill color. @default 'primary' */
|
|
43
162
|
color?: VariantColors;
|
|
44
163
|
errors?: string[];
|
|
45
164
|
required?: boolean;
|
|
46
165
|
testId?: string;
|
|
47
166
|
};
|
|
167
|
+
/**
|
|
168
|
+
* Props for `<Toggle>` — a binary switch for on/off states.
|
|
169
|
+
* Prefer Toggle for settings / features you're turning on and off.
|
|
170
|
+
* Prefer `<Checkbox>` for selection / agreement semantics.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```svelte
|
|
174
|
+
* <Toggle name="notifications" label="Email notifications" bind:value={enabled} />
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
48
177
|
export interface ToggleProps {
|
|
49
178
|
name: string;
|
|
50
179
|
label?: string;
|
|
51
180
|
disabled?: boolean;
|
|
52
181
|
class?: ClassValue;
|
|
182
|
+
/** Bindable on/off state. */
|
|
53
183
|
value?: boolean;
|
|
54
184
|
size?: VariantSizes;
|
|
185
|
+
/**
|
|
186
|
+
* Color used when the toggle is ON. Takes precedence over
|
|
187
|
+
* `activeColor` / `offColor` when set.
|
|
188
|
+
*/
|
|
55
189
|
color?: VariantColors;
|
|
56
190
|
id?: string;
|
|
57
191
|
errors?: string[];
|
|
192
|
+
/**
|
|
193
|
+
* Raw Tailwind class for the track when OFF. Use for ad-hoc styling
|
|
194
|
+
* that doesn't map to a ripple color. @default 'bg-default-200'
|
|
195
|
+
*/
|
|
58
196
|
offColor?: string;
|
|
59
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Raw Tailwind class for the track when ON. Overrides the default
|
|
199
|
+
* derived from `color`. Use when you need a brand-specific tint.
|
|
200
|
+
*/
|
|
201
|
+
activeColor?: string;
|
|
60
202
|
testId?: string;
|
|
61
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* A selectable currency / unit option inside `<NumberInput>`'s unit
|
|
206
|
+
* dropdown.
|
|
207
|
+
*/
|
|
62
208
|
export type CurrencyOption = {
|
|
209
|
+
/** The unit code/label stored as the selected unit (e.g. 'USD', '%'). */
|
|
63
210
|
value: string;
|
|
211
|
+
/** Optional icon rendered in the dropdown and trigger (e.g. a flag). */
|
|
64
212
|
icon?: Component;
|
|
65
213
|
};
|
|
214
|
+
/**
|
|
215
|
+
* Props for `<NumberInput>` — a numeric input with an optional unit
|
|
216
|
+
* selector on the right. Great for currency amounts, percentages, or
|
|
217
|
+
* anything that pairs a number with a unit.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```svelte
|
|
221
|
+
* <NumberInput
|
|
222
|
+
* name="amount"
|
|
223
|
+
* label="Amount"
|
|
224
|
+
* bind:value={amount}
|
|
225
|
+
* unit="USD"
|
|
226
|
+
* units={[{ value: 'USD' }, { value: 'EUR' }, { value: 'GBP' }]}
|
|
227
|
+
* onunitchange={(prev, next) => console.log('changed from', prev, 'to', next)}
|
|
228
|
+
* />
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
66
231
|
export type NumberInputProps = {
|
|
232
|
+
/** Bindable numeric value. */
|
|
67
233
|
value?: number;
|
|
68
234
|
name?: string;
|
|
69
235
|
label?: string;
|
|
70
236
|
placeholder?: string;
|
|
71
237
|
size?: VariantSizes;
|
|
72
238
|
class?: ClassValue;
|
|
239
|
+
/**
|
|
240
|
+
* Currently selected unit. When `units` is provided, this doubles as
|
|
241
|
+
* the controlled value of the unit dropdown.
|
|
242
|
+
*/
|
|
73
243
|
unit?: string;
|
|
244
|
+
/**
|
|
245
|
+
* Available units. When set, a dropdown appears on the right side
|
|
246
|
+
* of the field. Omit to render as a plain number input.
|
|
247
|
+
*/
|
|
74
248
|
units?: CurrencyOption[];
|
|
75
249
|
errors?: string[];
|
|
76
250
|
disabled?: boolean;
|
|
77
|
-
|
|
251
|
+
/** Icon for the dropdown trigger. Defaults to a chevron. */
|
|
252
|
+
dropdownIcon?: Component;
|
|
253
|
+
/** Fires when the user picks a different unit. */
|
|
78
254
|
onunitchange?: (prevUnit: string, newUnit: string) => void;
|
|
79
255
|
testId?: string;
|
|
80
256
|
};
|
|
257
|
+
/**
|
|
258
|
+
* Props for `<DateRange>` — a two-date picker (from → to). Presents
|
|
259
|
+
* an inline calendar with both dates visually connected. For a single
|
|
260
|
+
* date use `<DatePicker>`.
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```svelte
|
|
264
|
+
* <DateRange
|
|
265
|
+
* startDate={from}
|
|
266
|
+
* endDate={to}
|
|
267
|
+
* onselect={({ startDate, endDate }) => {
|
|
268
|
+
* from = startDate;
|
|
269
|
+
* to = endDate;
|
|
270
|
+
* }}
|
|
271
|
+
* />
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
81
274
|
export interface DateRangeProps {
|
|
275
|
+
/** Selected start of the range. */
|
|
82
276
|
startDate?: Date;
|
|
277
|
+
/** Selected end of the range. */
|
|
83
278
|
endDate?: Date;
|
|
279
|
+
/** Earliest selectable date (inclusive). */
|
|
84
280
|
minDate?: Date;
|
|
281
|
+
/** Latest selectable date (inclusive). */
|
|
85
282
|
maxDate?: Date;
|
|
86
283
|
disabled?: boolean;
|
|
87
284
|
class?: ClassValue;
|
|
88
285
|
placeholder?: string;
|
|
89
286
|
startLabel?: string;
|
|
90
287
|
endLabel?: string;
|
|
288
|
+
/**
|
|
289
|
+
* Display format for the input text. Supports `yyyy`, `MM`, `dd`
|
|
290
|
+
* tokens with any literal separator. @default 'yyyy-MM-dd'
|
|
291
|
+
*/
|
|
91
292
|
format?: string;
|
|
92
293
|
errors?: string[];
|
|
294
|
+
/**
|
|
295
|
+
* Fires when the user completes a selection. Both dates may be
|
|
296
|
+
* undefined (cleared).
|
|
297
|
+
*/
|
|
93
298
|
onselect?: ({ startDate, endDate }: {
|
|
94
299
|
startDate?: Date;
|
|
95
300
|
endDate?: Date;
|
|
@@ -98,11 +303,32 @@ export interface DateRangeProps {
|
|
|
98
303
|
name?: string;
|
|
99
304
|
testId?: string;
|
|
100
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* Shape emitted by Calendar/DateRange-related selection events. `null`
|
|
308
|
+
* indicates the field was cleared rather than picked.
|
|
309
|
+
*/
|
|
101
310
|
export interface DateSelectEvent {
|
|
102
311
|
startDate: Date | null;
|
|
103
312
|
endDate: Date | null;
|
|
104
313
|
}
|
|
314
|
+
/**
|
|
315
|
+
* Props for `<Tags>` — an input that accepts a list of short strings
|
|
316
|
+
* (email addresses, keywords, filter terms). Users type + press Enter to
|
|
317
|
+
* add a tag; they remove tags with ×.
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```svelte
|
|
321
|
+
* <Tags
|
|
322
|
+
* name="recipients"
|
|
323
|
+
* label="Recipients"
|
|
324
|
+
* bind:value={emails}
|
|
325
|
+
* placeholder="Add an email and press Enter"
|
|
326
|
+
* suggestions={recentContacts}
|
|
327
|
+
* />
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
105
330
|
export type TagsProps = {
|
|
331
|
+
/** Bindable array of tag strings. */
|
|
106
332
|
value?: string[];
|
|
107
333
|
name?: string;
|
|
108
334
|
label?: string;
|
|
@@ -110,63 +336,256 @@ export type TagsProps = {
|
|
|
110
336
|
placeholder?: string;
|
|
111
337
|
size?: VariantSizes;
|
|
112
338
|
class?: ClassValue;
|
|
339
|
+
/**
|
|
340
|
+
* Optional list of autocomplete suggestions shown in a dropdown
|
|
341
|
+
* while the user is typing. Tags the user has already added are
|
|
342
|
+
* filtered out of the suggestion list.
|
|
343
|
+
*/
|
|
113
344
|
suggestions?: string[];
|
|
345
|
+
/** Fires when a tag is added. */
|
|
114
346
|
onaddtag?: (tag: string) => void;
|
|
347
|
+
/** Fires when a tag is removed (via × or backspace). */
|
|
115
348
|
onremovetag?: (tag: string) => void;
|
|
116
349
|
testId?: string;
|
|
117
350
|
};
|
|
351
|
+
/** Selection mode for `<Slider>`. */
|
|
118
352
|
export type SliderMode = 'single' | 'range' | 'enum';
|
|
353
|
+
/**
|
|
354
|
+
* Intl.NumberFormat notation style. Controls how the Slider renders
|
|
355
|
+
* numeric values (e.g. `compact` → "1.2K").
|
|
356
|
+
*/
|
|
119
357
|
export type NotationType = 'standard' | 'compact' | 'scientific' | 'engineering';
|
|
358
|
+
/** Single option for Slider's enum mode — a discrete, labeled step. */
|
|
120
359
|
export type EnumOption = {
|
|
121
360
|
value: string | number;
|
|
122
361
|
label: string;
|
|
123
362
|
};
|
|
363
|
+
/** Single tick mark on the Slider track. */
|
|
364
|
+
export type SliderTick = {
|
|
365
|
+
/** Position on the axis. Ignored if outside `[min, max]`. */
|
|
366
|
+
value: number;
|
|
367
|
+
/** Optional text shown below the tick. */
|
|
368
|
+
label?: string;
|
|
369
|
+
};
|
|
370
|
+
/**
|
|
371
|
+
* Props for `<Textarea>` — a multi-line text input with optional
|
|
372
|
+
* auto-grow and character counter. Prefer this over `<Input type='textarea'>`
|
|
373
|
+
* when you need autoGrow, maxLength with counter, or richer multi-line UX.
|
|
374
|
+
*
|
|
375
|
+
* @example
|
|
376
|
+
* ```svelte
|
|
377
|
+
* <Textarea name="bio" label="Short bio" bind:value={bio} maxLength={160} showCount />
|
|
378
|
+
* ```
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```svelte
|
|
382
|
+
* <!-- Auto-grow up to 10 rows for chat-style composers -->
|
|
383
|
+
* <Textarea name="message" rows={1} autoGrow maxRows={10} bind:value={message} />
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
export interface TextareaProps {
|
|
387
|
+
name: string;
|
|
388
|
+
id?: string;
|
|
389
|
+
label?: string;
|
|
390
|
+
placeholder?: string;
|
|
391
|
+
/** Bindable text value. */
|
|
392
|
+
value?: string;
|
|
393
|
+
disabled?: boolean;
|
|
394
|
+
readonly?: boolean;
|
|
395
|
+
/** Visible row count. @default 3 */
|
|
396
|
+
rows?: number;
|
|
397
|
+
/**
|
|
398
|
+
* When true, textarea height grows with content up to `maxRows` rows.
|
|
399
|
+
* @default false
|
|
400
|
+
*/
|
|
401
|
+
autoGrow?: boolean;
|
|
402
|
+
/** Upper bound for autoGrow. @default 10 */
|
|
403
|
+
maxRows?: number;
|
|
404
|
+
/** Max characters. Also displays a character counter if `showCount` is true. */
|
|
405
|
+
maxLength?: number;
|
|
406
|
+
/** Show a "N / maxLength" counter under the field. Requires `maxLength`. @default false */
|
|
407
|
+
showCount?: boolean;
|
|
408
|
+
size?: VariantSizes;
|
|
409
|
+
errors?: string[];
|
|
410
|
+
class?: ClassValue;
|
|
411
|
+
/** Fires on every keystroke with the current value. */
|
|
412
|
+
oninput?: (value: string) => void;
|
|
413
|
+
/** Fires on blur with the current value. */
|
|
414
|
+
onblur?: (value: string) => void;
|
|
415
|
+
testId?: string;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Props for `<Slider>` — a unified slider supporting three modes:
|
|
419
|
+
* - **`single`** (default): one value. Bind to `value`.
|
|
420
|
+
* - **`range`**: two values. Bind to `valueStart` + `valueEnd`.
|
|
421
|
+
* - **`enum`**: pick from discrete `options`. Bind to `value`.
|
|
422
|
+
*
|
|
423
|
+
* Use `tickInterval` or `ticks` to render visual anchors along the
|
|
424
|
+
* track — see the examples.
|
|
425
|
+
*
|
|
426
|
+
* @example
|
|
427
|
+
* ```svelte
|
|
428
|
+
* <!-- Single value with compact formatting -->
|
|
429
|
+
* <Slider
|
|
430
|
+
* name="volume"
|
|
431
|
+
* label="Volume"
|
|
432
|
+
* min={0}
|
|
433
|
+
* max={100}
|
|
434
|
+
* bind:value
|
|
435
|
+
* valueSuffix="%"
|
|
436
|
+
* />
|
|
437
|
+
* ```
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* ```svelte
|
|
441
|
+
* <!-- Range with labeled ticks -->
|
|
442
|
+
* <Slider
|
|
443
|
+
* name="budget"
|
|
444
|
+
* mode="range"
|
|
445
|
+
* min={0}
|
|
446
|
+
* max={1000}
|
|
447
|
+
* step={50}
|
|
448
|
+
* bind:valueStart
|
|
449
|
+
* bind:valueEnd
|
|
450
|
+
* ticks={[
|
|
451
|
+
* { value: 0, label: '$0' },
|
|
452
|
+
* { value: 500, label: '$500' },
|
|
453
|
+
* { value: 1000, label: '$1K' }
|
|
454
|
+
* ]}
|
|
455
|
+
* />
|
|
456
|
+
* ```
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* ```svelte
|
|
460
|
+
* <!-- Discrete enum values -->
|
|
461
|
+
* <Slider
|
|
462
|
+
* name="quality"
|
|
463
|
+
* mode="enum"
|
|
464
|
+
* bind:value
|
|
465
|
+
* options={[
|
|
466
|
+
* { value: 'low', label: 'Low' },
|
|
467
|
+
* { value: 'med', label: 'Med' },
|
|
468
|
+
* { value: 'high', label: 'High' }
|
|
469
|
+
* ]}
|
|
470
|
+
* />
|
|
471
|
+
* ```
|
|
472
|
+
*/
|
|
124
473
|
export interface SliderProps {
|
|
125
474
|
name: string;
|
|
126
475
|
label?: string;
|
|
476
|
+
/** @default 'single' */
|
|
127
477
|
mode?: SliderMode;
|
|
128
478
|
disabled?: boolean;
|
|
129
479
|
size?: VariantSizes;
|
|
130
480
|
errors?: string[];
|
|
131
481
|
class?: ClassValue;
|
|
482
|
+
/** Lower bound (single/range mode). @default 0 */
|
|
132
483
|
min?: number;
|
|
484
|
+
/** Upper bound (single/range mode). @default 100 */
|
|
133
485
|
max?: number;
|
|
486
|
+
/** Increment per arrow-key / drag step. @default 1 */
|
|
134
487
|
step?: number;
|
|
488
|
+
/** Bindable value (single/enum mode). */
|
|
135
489
|
value?: number | string;
|
|
490
|
+
/** Bindable range start (range mode only). */
|
|
136
491
|
valueStart?: number;
|
|
492
|
+
/** Bindable range end (range mode only). */
|
|
137
493
|
valueEnd?: number;
|
|
494
|
+
/** Render the formatted value alongside the label. @default true */
|
|
138
495
|
showValue?: boolean;
|
|
496
|
+
/** Prefix prepended to displayed values (e.g. `'$'`). */
|
|
139
497
|
valuePrefix?: string;
|
|
498
|
+
/** Suffix appended to displayed values (e.g. `' %'`). */
|
|
140
499
|
valueSuffix?: string;
|
|
500
|
+
/** Required in `enum` mode — the discrete choices. */
|
|
141
501
|
options?: EnumOption[];
|
|
502
|
+
/**
|
|
503
|
+
* Intl.NumberFormat options applied when rendering the value. Use
|
|
504
|
+
* `{ notation: 'compact' }` to show "1.2K" instead of "1200".
|
|
505
|
+
*/
|
|
142
506
|
formatOptions?: Intl.NumberFormatOptions & {
|
|
143
507
|
notation?: NotationType;
|
|
144
508
|
};
|
|
509
|
+
/**
|
|
510
|
+
* Draw a tick mark at every multiple of this interval between `min` and
|
|
511
|
+
* `max`. Ignored in `enum` mode (options already act as ticks). Ignored
|
|
512
|
+
* if `ticks` is also set.
|
|
513
|
+
*/
|
|
514
|
+
tickInterval?: number;
|
|
515
|
+
/**
|
|
516
|
+
* Explicit tick marks with optional labels. Overrides `tickInterval`.
|
|
517
|
+
* Values outside `[min, max]` are ignored.
|
|
518
|
+
*/
|
|
519
|
+
ticks?: Array<number | SliderTick>;
|
|
145
520
|
testId?: string;
|
|
146
521
|
}
|
|
147
|
-
/**
|
|
522
|
+
/**
|
|
523
|
+
* Single segment in a fused `<SegmentedControl>` bar — extends
|
|
524
|
+
* `RadioOption` with visual embellishments (prefix icon, HTML title).
|
|
525
|
+
* Unlike `TabGroup`, segments are purely a control (no panels).
|
|
526
|
+
*/
|
|
148
527
|
export type SegmentedOption = RadioOption & {
|
|
149
|
-
/**
|
|
528
|
+
/** Content rendered before the label (e.g. flag emoji, icon). */
|
|
150
529
|
prefix?: string;
|
|
151
|
-
/** `title` on the segment button */
|
|
530
|
+
/** Native `title` attribute on the segment button (hover tooltip). */
|
|
152
531
|
title?: string;
|
|
153
532
|
disabled?: boolean;
|
|
154
533
|
};
|
|
534
|
+
/**
|
|
535
|
+
* Props for `<SegmentedControl>` — a compact segmented radio control
|
|
536
|
+
* (think iOS segmented control). Use for 2-5 mutually-exclusive short
|
|
537
|
+
* options where visibility matters more than listing space.
|
|
538
|
+
*
|
|
539
|
+
* Differences vs related components:
|
|
540
|
+
* - `<RadioGroup>` — more vertical space, option descriptions allowed
|
|
541
|
+
* - `<TabGroup>` — tabs with associated panel content below
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* ```svelte
|
|
545
|
+
* <SegmentedControl
|
|
546
|
+
* name="view"
|
|
547
|
+
* label="View as"
|
|
548
|
+
* bind:value
|
|
549
|
+
* options={[
|
|
550
|
+
* { value: 'list', label: 'List' },
|
|
551
|
+
* { value: 'grid', label: 'Grid' },
|
|
552
|
+
* { value: 'kanban', label: 'Kanban' }
|
|
553
|
+
* ]}
|
|
554
|
+
* />
|
|
555
|
+
* ```
|
|
556
|
+
*/
|
|
155
557
|
export type SegmentedControlProps = {
|
|
156
558
|
options: SegmentedOption[];
|
|
559
|
+
/** Bindable selected value. */
|
|
157
560
|
value?: string;
|
|
158
561
|
name?: string;
|
|
159
562
|
label?: string;
|
|
160
563
|
class?: ClassValue;
|
|
564
|
+
/**
|
|
565
|
+
* Visual treatment:
|
|
566
|
+
* - `'surface'` (default) — segments sit in a contrasting track
|
|
567
|
+
* - `'inverted'` — track is white, selected segment is colored
|
|
568
|
+
* - `'pills'` — detached pill-shaped segments with a subtle outline
|
|
569
|
+
*/
|
|
161
570
|
appearance?: 'surface' | 'inverted' | 'pills';
|
|
162
|
-
|
|
571
|
+
/**
|
|
572
|
+
* - `'horizontal'` (default) — items in a row.
|
|
573
|
+
* - `'vertical'` — items stacked.
|
|
574
|
+
* - `'auto'` — horizontal by default, flips to vertical when the parent
|
|
575
|
+
* container drops below 250px (uses CSS container queries, no JS).
|
|
576
|
+
*/
|
|
577
|
+
orientation?: 'horizontal' | 'vertical' | 'auto';
|
|
163
578
|
color?: VariantColors;
|
|
164
579
|
size?: VariantSizes;
|
|
580
|
+
/** Tighten horizontal padding to fit more segments in narrow space. */
|
|
165
581
|
compact?: boolean;
|
|
582
|
+
/** Label placement relative to the control. @default 'above' */
|
|
166
583
|
labelLayout?: 'above' | 'inline';
|
|
584
|
+
/** Additional classes for the label element. */
|
|
167
585
|
labelClass?: ClassValue;
|
|
168
586
|
disabled?: boolean;
|
|
169
587
|
errors?: string[];
|
|
588
|
+
/** Fires on selection change with the new value. */
|
|
170
589
|
onchange?: (value: string) => void;
|
|
171
590
|
testId?: string;
|
|
172
591
|
};
|
|
@@ -1,22 +1,73 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* Props for `<MarketSelector>` — a specialised `<SegmentedControl>` for
|
|
6
|
+
* picking between a small set of geographic markets. Renders a flag +
|
|
7
|
+
* country code per segment, and can collapse to flags-only in narrow
|
|
8
|
+
* layouts (sidebar rails, mobile).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```svelte
|
|
12
|
+
* <MarketSelector
|
|
13
|
+
* markets={['US', 'GB', 'FR', 'DE']}
|
|
14
|
+
* selectedMarket={market}
|
|
15
|
+
* onchange={(code) => (market = code)}
|
|
16
|
+
* />
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```svelte
|
|
21
|
+
* <!-- Auto-collapse to flags-only on narrow screens -->
|
|
22
|
+
* <MarketSelector
|
|
23
|
+
* markets={['US', 'EU', 'JP']}
|
|
24
|
+
* orientation="auto"
|
|
25
|
+
* flagsOnly={collapsed}
|
|
26
|
+
* bind:selectedMarket
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
4
30
|
export type MarketSelectorProps = {
|
|
31
|
+
/** Ordered list of market codes to render as segments. */
|
|
5
32
|
markets: CountryCode[];
|
|
33
|
+
/** Bindable currently-selected market code. */
|
|
6
34
|
selectedMarket?: CountryCode;
|
|
35
|
+
/**
|
|
36
|
+
* Market to fall back to when `selectedMarket` is undefined on first
|
|
37
|
+
* render. Defaults to the first entry in `markets`.
|
|
38
|
+
*/
|
|
7
39
|
defaultMarket?: CountryCode;
|
|
40
|
+
/** Render a flag emoji before each label. @default true */
|
|
8
41
|
showFlags?: boolean;
|
|
9
42
|
label?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Visual treatment — see `SegmentedControl.appearance`.
|
|
45
|
+
* @default 'surface'
|
|
46
|
+
*/
|
|
10
47
|
appearance?: 'surface' | 'inverted' | 'pills';
|
|
11
|
-
|
|
48
|
+
/**
|
|
49
|
+
* - `'horizontal'` — items in a row.
|
|
50
|
+
* - `'vertical'` — items stacked.
|
|
51
|
+
* - `'auto'` (default) — flips to vertical when the parent container drops below 250px.
|
|
52
|
+
*/
|
|
53
|
+
orientation?: 'horizontal' | 'vertical' | 'auto';
|
|
54
|
+
/** Label placement relative to the control. @default 'above' */
|
|
12
55
|
labelLayout?: 'above' | 'inline';
|
|
13
56
|
labelClass?: ClassValue;
|
|
14
57
|
color?: VariantColors;
|
|
15
58
|
size?: VariantSizes;
|
|
59
|
+
/** Tighten horizontal padding to fit more segments in narrow space. */
|
|
16
60
|
compact?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Hide country code labels and show only flag emojis. Implies `showFlags: true`.
|
|
63
|
+
* Useful in narrow spaces like a collapsed sidebar. @default false
|
|
64
|
+
*/
|
|
65
|
+
flagsOnly?: boolean;
|
|
17
66
|
disabled?: boolean;
|
|
18
67
|
class?: ClassValue;
|
|
68
|
+
/** Form name attribute on the hidden input (for native POST submissions). */
|
|
19
69
|
name?: string;
|
|
70
|
+
/** Fires when the user picks a different market. */
|
|
20
71
|
onchange?: (market: CountryCode) => void;
|
|
21
72
|
testId?: string;
|
|
22
73
|
};
|
|
@@ -10,8 +10,9 @@ export declare const segmentedTrack: import("tailwind-variants").TVReturnType<{
|
|
|
10
10
|
orientation: {
|
|
11
11
|
horizontal: string;
|
|
12
12
|
vertical: string;
|
|
13
|
+
auto: string;
|
|
13
14
|
};
|
|
14
|
-
}, undefined, "inline-flex overflow-
|
|
15
|
+
}, undefined, "inline-flex max-w-full overflow-x-auto rounded-lg border [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", {
|
|
15
16
|
appearance: {
|
|
16
17
|
surface: string;
|
|
17
18
|
inverted: string;
|
|
@@ -20,6 +21,7 @@ export declare const segmentedTrack: import("tailwind-variants").TVReturnType<{
|
|
|
20
21
|
orientation: {
|
|
21
22
|
horizontal: string;
|
|
22
23
|
vertical: string;
|
|
24
|
+
auto: string;
|
|
23
25
|
};
|
|
24
26
|
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
25
27
|
appearance: {
|
|
@@ -30,8 +32,9 @@ export declare const segmentedTrack: import("tailwind-variants").TVReturnType<{
|
|
|
30
32
|
orientation: {
|
|
31
33
|
horizontal: string;
|
|
32
34
|
vertical: string;
|
|
35
|
+
auto: string;
|
|
33
36
|
};
|
|
34
|
-
}, undefined, "inline-flex overflow-
|
|
37
|
+
}, undefined, "inline-flex max-w-full overflow-x-auto rounded-lg border [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", unknown, unknown, undefined>>;
|
|
35
38
|
export declare function segmentClasses(args: {
|
|
36
39
|
selected: boolean;
|
|
37
40
|
disabled: boolean;
|