@peasant-labs/fairtrade 0.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/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/lib/README.md +13 -0
- package/dist/lib/base.css +48 -0
- package/dist/lib/components.css +2 -0
- package/dist/lib/fonts.css +28 -0
- package/dist/lib/tokens.css +184 -0
- package/dist/lib/tokens.json +768 -0
- package/dist/lib/types/Accordion.d.ts +47 -0
- package/dist/lib/types/Accordion.stories.d.ts +91 -0
- package/dist/lib/types/Avatar.d.ts +94 -0
- package/dist/lib/types/Avatar.stories.d.ts +160 -0
- package/dist/lib/types/BrandMark.d.ts +25 -0
- package/dist/lib/types/BrandMark.stories.d.ts +75 -0
- package/dist/lib/types/Breadcrumb.d.ts +66 -0
- package/dist/lib/types/Breadcrumb.stories.d.ts +91 -0
- package/dist/lib/types/Button.d.ts +86 -0
- package/dist/lib/types/Button.stories.d.ts +129 -0
- package/dist/lib/types/Card.d.ts +145 -0
- package/dist/lib/types/Card.stories.d.ts +70 -0
- package/dist/lib/types/Chart.stories.d.ts +55 -0
- package/dist/lib/types/ChartBar.d.ts +51 -0
- package/dist/lib/types/ChartLine.d.ts +54 -0
- package/dist/lib/types/Checkbox.d.ts +132 -0
- package/dist/lib/types/Checkbox.stories.d.ts +75 -0
- package/dist/lib/types/Chip.d.ts +85 -0
- package/dist/lib/types/Chip.stories.d.ts +190 -0
- package/dist/lib/types/CliOnboard.d.ts +68 -0
- package/dist/lib/types/CliOnboard.stories.d.ts +24 -0
- package/dist/lib/types/CommandPalette.d.ts +6 -0
- package/dist/lib/types/CommandPalette.stories.d.ts +94 -0
- package/dist/lib/types/CommitGraph.d.ts +71 -0
- package/dist/lib/types/CommitGraph.stories.d.ts +17 -0
- package/dist/lib/types/ConnectionState.d.ts +82 -0
- package/dist/lib/types/ConnectionState.stories.d.ts +117 -0
- package/dist/lib/types/ConsentDialog.d.ts +97 -0
- package/dist/lib/types/ConsentDialog.stories.d.ts +61 -0
- package/dist/lib/types/DataTable.d.ts +116 -0
- package/dist/lib/types/DataTable.stories.d.ts +240 -0
- package/dist/lib/types/DateRange.d.ts +242 -0
- package/dist/lib/types/DateRange.stories.d.ts +272 -0
- package/dist/lib/types/Dialog.d.ts +9 -0
- package/dist/lib/types/Dialog.stories.d.ts +121 -0
- package/dist/lib/types/DiffView.d.ts +39 -0
- package/dist/lib/types/DiffView.stories.d.ts +118 -0
- package/dist/lib/types/EmptyState.d.ts +28 -0
- package/dist/lib/types/EmptyState.stories.d.ts +130 -0
- package/dist/lib/types/EvidenceCaption.d.ts +39 -0
- package/dist/lib/types/EvidenceCaption.stories.d.ts +43 -0
- package/dist/lib/types/Explainer.d.ts +82 -0
- package/dist/lib/types/Explainer.stories.d.ts +22 -0
- package/dist/lib/types/FacetRail.d.ts +13 -0
- package/dist/lib/types/FacetRail.stories.d.ts +28 -0
- package/dist/lib/types/Feedback.d.ts +222 -0
- package/dist/lib/types/Feedback.stories.d.ts +81 -0
- package/dist/lib/types/GroupedMultiSelect.d.ts +67 -0
- package/dist/lib/types/GroupedMultiSelect.stories.d.ts +59 -0
- package/dist/lib/types/Input.d.ts +158 -0
- package/dist/lib/types/Input.stories.d.ts +181 -0
- package/dist/lib/types/Intensity.d.ts +55 -0
- package/dist/lib/types/Intensity.stories.d.ts +108 -0
- package/dist/lib/types/MapCanvas.d.ts +89 -0
- package/dist/lib/types/MapCanvas.stories.d.ts +174 -0
- package/dist/lib/types/Menu.d.ts +62 -0
- package/dist/lib/types/Menu.stories.d.ts +173 -0
- package/dist/lib/types/ModerationQueue.d.ts +135 -0
- package/dist/lib/types/ModerationQueue.stories.d.ts +34 -0
- package/dist/lib/types/Pager.d.ts +47 -0
- package/dist/lib/types/Pager.stories.d.ts +100 -0
- package/dist/lib/types/Pagination.d.ts +50 -0
- package/dist/lib/types/Pagination.stories.d.ts +193 -0
- package/dist/lib/types/PolicySelect.d.ts +80 -0
- package/dist/lib/types/PolicySelect.stories.d.ts +130 -0
- package/dist/lib/types/ProviderIcon.d.ts +83 -0
- package/dist/lib/types/ProviderIcon.stories.d.ts +44 -0
- package/dist/lib/types/RailShell.d.ts +199 -0
- package/dist/lib/types/RailShell.stories.d.ts +32 -0
- package/dist/lib/types/Redaction.d.ts +53 -0
- package/dist/lib/types/Redaction.stories.d.ts +120 -0
- package/dist/lib/types/RoleRoster.d.ts +97 -0
- package/dist/lib/types/RoleRoster.stories.d.ts +23 -0
- package/dist/lib/types/SignIn.d.ts +78 -0
- package/dist/lib/types/SignIn.stories.d.ts +57 -0
- package/dist/lib/types/Sparkline.d.ts +19 -0
- package/dist/lib/types/StatTiles.d.ts +115 -0
- package/dist/lib/types/StatTiles.stories.d.ts +31 -0
- package/dist/lib/types/StepWizard.d.ts +92 -0
- package/dist/lib/types/StepWizard.stories.d.ts +18 -0
- package/dist/lib/types/StepsWaterfall.d.ts +67 -0
- package/dist/lib/types/StepsWaterfall.stories.d.ts +94 -0
- package/dist/lib/types/Switch.d.ts +63 -0
- package/dist/lib/types/Switch.stories.d.ts +134 -0
- package/dist/lib/types/Tabs.d.ts +48 -0
- package/dist/lib/types/Tabs.stories.d.ts +75 -0
- package/dist/lib/types/TimeStrip.d.ts +12 -0
- package/dist/lib/types/TimeStrip.stories.d.ts +30 -0
- package/dist/lib/types/Timeline.d.ts +192 -0
- package/dist/lib/types/Timeline.stories.d.ts +974 -0
- package/dist/lib/types/ToastHost.d.ts +70 -0
- package/dist/lib/types/ToastHost.stories.d.ts +115 -0
- package/dist/lib/types/ToolRenderers.d.ts +24 -0
- package/dist/lib/types/ToolRenderers.stories.d.ts +138 -0
- package/dist/lib/types/Tooltip.d.ts +80 -0
- package/dist/lib/types/Tooltip.stories.d.ts +116 -0
- package/dist/lib/types/Tour.d.ts +37 -0
- package/dist/lib/types/Tour.stories.d.ts +39 -0
- package/dist/lib/types/TranscriptMarkers.d.ts +50 -0
- package/dist/lib/types/TranscriptMarkers.stories.d.ts +48 -0
- package/dist/lib/types/Treemap.d.ts +77 -0
- package/dist/lib/types/Treemap.stories.d.ts +101 -0
- package/dist/lib/types/VisibilityControl.d.ts +54 -0
- package/dist/lib/types/VisibilityControl.stories.d.ts +126 -0
- package/dist/lib/types/chart-shared.d.ts +63 -0
- package/dist/lib/types/index.d.ts +53 -0
- package/dist/lib/types/story-frame.d.ts +12 -0
- package/dist/lib/ui.js +8707 -0
- package/package.json +67 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
export default meta;
|
|
2
|
+
export const Playground: {};
|
|
3
|
+
export namespace ReadOnly {
|
|
4
|
+
let name: string;
|
|
5
|
+
namespace args {
|
|
6
|
+
let selectable: boolean;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export namespace SortedAscending {
|
|
10
|
+
let name_1: string;
|
|
11
|
+
export { name_1 as name };
|
|
12
|
+
export namespace args_1 {
|
|
13
|
+
namespace defaultSort {
|
|
14
|
+
let key: string;
|
|
15
|
+
let dir: string;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export { args_1 as args };
|
|
19
|
+
}
|
|
20
|
+
export namespace SomeSelected {
|
|
21
|
+
let name_2: string;
|
|
22
|
+
export { name_2 as name };
|
|
23
|
+
export namespace args_2 {
|
|
24
|
+
let defaultSelectedKeys: string[];
|
|
25
|
+
}
|
|
26
|
+
export { args_2 as args };
|
|
27
|
+
}
|
|
28
|
+
export namespace AllSelected {
|
|
29
|
+
let name_3: string;
|
|
30
|
+
export { name_3 as name };
|
|
31
|
+
export namespace args_3 {
|
|
32
|
+
let defaultSelectedKeys_1: string[];
|
|
33
|
+
export { defaultSelectedKeys_1 as defaultSelectedKeys };
|
|
34
|
+
}
|
|
35
|
+
export { args_3 as args };
|
|
36
|
+
}
|
|
37
|
+
export namespace Empty {
|
|
38
|
+
let name_4: string;
|
|
39
|
+
export { name_4 as name };
|
|
40
|
+
export namespace args_4 {
|
|
41
|
+
let rows: any[];
|
|
42
|
+
let caption: string;
|
|
43
|
+
}
|
|
44
|
+
export { args_4 as args };
|
|
45
|
+
}
|
|
46
|
+
export namespace CustomRenderers {
|
|
47
|
+
let name_5: string;
|
|
48
|
+
export { name_5 as name };
|
|
49
|
+
export namespace args_5 {
|
|
50
|
+
let selectable_1: boolean;
|
|
51
|
+
export { selectable_1 as selectable };
|
|
52
|
+
let caption_1: string;
|
|
53
|
+
export { caption_1 as caption };
|
|
54
|
+
export let columns: ({
|
|
55
|
+
key: string;
|
|
56
|
+
label: string;
|
|
57
|
+
sortable: boolean;
|
|
58
|
+
render?: undefined;
|
|
59
|
+
align?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
key: string;
|
|
62
|
+
label: string;
|
|
63
|
+
sortable: boolean;
|
|
64
|
+
render: (v: any) => any;
|
|
65
|
+
align?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
key: string;
|
|
68
|
+
label: string;
|
|
69
|
+
sortable: boolean;
|
|
70
|
+
align: string;
|
|
71
|
+
render: (value: any) => string;
|
|
72
|
+
})[];
|
|
73
|
+
}
|
|
74
|
+
export { args_5 as args };
|
|
75
|
+
}
|
|
76
|
+
export namespace CenterAligned {
|
|
77
|
+
let name_6: string;
|
|
78
|
+
export { name_6 as name };
|
|
79
|
+
export namespace args_6 {
|
|
80
|
+
let selectable_2: boolean;
|
|
81
|
+
export { selectable_2 as selectable };
|
|
82
|
+
let caption_2: string;
|
|
83
|
+
export { caption_2 as caption };
|
|
84
|
+
let columns_1: ({
|
|
85
|
+
key: string;
|
|
86
|
+
label: string;
|
|
87
|
+
sortable: boolean;
|
|
88
|
+
render?: undefined;
|
|
89
|
+
align?: undefined;
|
|
90
|
+
} | {
|
|
91
|
+
key: string;
|
|
92
|
+
label: string;
|
|
93
|
+
sortable: boolean;
|
|
94
|
+
render: (v: any) => any;
|
|
95
|
+
align?: undefined;
|
|
96
|
+
} | {
|
|
97
|
+
key: string;
|
|
98
|
+
label: string;
|
|
99
|
+
sortable: boolean;
|
|
100
|
+
align: string;
|
|
101
|
+
render?: undefined;
|
|
102
|
+
})[];
|
|
103
|
+
export { columns_1 as columns };
|
|
104
|
+
let rows_1: {
|
|
105
|
+
id: string;
|
|
106
|
+
title: string;
|
|
107
|
+
provider: string;
|
|
108
|
+
status: string;
|
|
109
|
+
turns: number;
|
|
110
|
+
}[];
|
|
111
|
+
export { rows_1 as rows };
|
|
112
|
+
}
|
|
113
|
+
export { args_6 as args };
|
|
114
|
+
}
|
|
115
|
+
export namespace Controlled {
|
|
116
|
+
let name_7: string;
|
|
117
|
+
export { name_7 as name };
|
|
118
|
+
export namespace args_7 {
|
|
119
|
+
let caption_3: string;
|
|
120
|
+
export { caption_3 as caption };
|
|
121
|
+
}
|
|
122
|
+
export { args_7 as args };
|
|
123
|
+
export function render(args: any): any;
|
|
124
|
+
}
|
|
125
|
+
export namespace Interactions {
|
|
126
|
+
let name_8: string;
|
|
127
|
+
export { name_8 as name };
|
|
128
|
+
export namespace args_8 {
|
|
129
|
+
let defaultSort_1: any;
|
|
130
|
+
export { defaultSort_1 as defaultSort };
|
|
131
|
+
}
|
|
132
|
+
export { args_8 as args };
|
|
133
|
+
export function play({ canvasElement, args }: {
|
|
134
|
+
canvasElement: any;
|
|
135
|
+
args: any;
|
|
136
|
+
}): Promise<void>;
|
|
137
|
+
}
|
|
138
|
+
declare namespace meta {
|
|
139
|
+
export let title: string;
|
|
140
|
+
export { DataTable as component };
|
|
141
|
+
export let tags: string[];
|
|
142
|
+
export let decorators: Function[];
|
|
143
|
+
export namespace argTypes {
|
|
144
|
+
export namespace selectable_3 {
|
|
145
|
+
let control: string;
|
|
146
|
+
}
|
|
147
|
+
export { selectable_3 as selectable };
|
|
148
|
+
export namespace caption_4 {
|
|
149
|
+
let control_1: string;
|
|
150
|
+
export { control_1 as control };
|
|
151
|
+
}
|
|
152
|
+
export { caption_4 as caption };
|
|
153
|
+
export namespace columns_2 {
|
|
154
|
+
let control_2: boolean;
|
|
155
|
+
export { control_2 as control };
|
|
156
|
+
}
|
|
157
|
+
export { columns_2 as columns };
|
|
158
|
+
export namespace rows_2 {
|
|
159
|
+
let control_3: boolean;
|
|
160
|
+
export { control_3 as control };
|
|
161
|
+
}
|
|
162
|
+
export { rows_2 as rows };
|
|
163
|
+
export namespace defaultSort_2 {
|
|
164
|
+
let control_4: boolean;
|
|
165
|
+
export { control_4 as control };
|
|
166
|
+
}
|
|
167
|
+
export { defaultSort_2 as defaultSort };
|
|
168
|
+
export namespace sort {
|
|
169
|
+
let control_5: boolean;
|
|
170
|
+
export { control_5 as control };
|
|
171
|
+
}
|
|
172
|
+
export namespace selectedKeys {
|
|
173
|
+
let control_6: boolean;
|
|
174
|
+
export { control_6 as control };
|
|
175
|
+
}
|
|
176
|
+
export namespace defaultSelectedKeys_2 {
|
|
177
|
+
let control_7: boolean;
|
|
178
|
+
export { control_7 as control };
|
|
179
|
+
}
|
|
180
|
+
export { defaultSelectedKeys_2 as defaultSelectedKeys };
|
|
181
|
+
export namespace onSortChange {
|
|
182
|
+
let action: string;
|
|
183
|
+
}
|
|
184
|
+
export namespace onSelectionChange {
|
|
185
|
+
let action_1: string;
|
|
186
|
+
export { action_1 as action };
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
export namespace args_9 {
|
|
190
|
+
export { COLUMNS as columns };
|
|
191
|
+
export { ROWS as rows };
|
|
192
|
+
let selectable_4: boolean;
|
|
193
|
+
export { selectable_4 as selectable };
|
|
194
|
+
let caption_5: string;
|
|
195
|
+
export { caption_5 as caption };
|
|
196
|
+
let onSortChange_1: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
197
|
+
export { onSortChange_1 as onSortChange };
|
|
198
|
+
let onSelectionChange_1: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
199
|
+
export { onSelectionChange_1 as onSelectionChange };
|
|
200
|
+
}
|
|
201
|
+
export { args_9 as args };
|
|
202
|
+
}
|
|
203
|
+
import DataTable from './DataTable.jsx';
|
|
204
|
+
declare const COLUMNS: ({
|
|
205
|
+
key: string;
|
|
206
|
+
label: string;
|
|
207
|
+
sortable: boolean;
|
|
208
|
+
render?: undefined;
|
|
209
|
+
width?: undefined;
|
|
210
|
+
align?: undefined;
|
|
211
|
+
} | {
|
|
212
|
+
key: string;
|
|
213
|
+
label: string;
|
|
214
|
+
sortable: boolean;
|
|
215
|
+
render: (v: any) => any;
|
|
216
|
+
width: string;
|
|
217
|
+
align?: undefined;
|
|
218
|
+
} | {
|
|
219
|
+
key: string;
|
|
220
|
+
label: string;
|
|
221
|
+
sortable: boolean;
|
|
222
|
+
width: string;
|
|
223
|
+
render?: undefined;
|
|
224
|
+
align?: undefined;
|
|
225
|
+
} | {
|
|
226
|
+
key: string;
|
|
227
|
+
label: string;
|
|
228
|
+
sortable: boolean;
|
|
229
|
+
align: string;
|
|
230
|
+
width: string;
|
|
231
|
+
render?: undefined;
|
|
232
|
+
})[];
|
|
233
|
+
declare const ROWS: {
|
|
234
|
+
id: string;
|
|
235
|
+
title: string;
|
|
236
|
+
provider: string;
|
|
237
|
+
collective: string;
|
|
238
|
+
redactions: number;
|
|
239
|
+
turns: number;
|
|
240
|
+
}[];
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* formatRange({from,to}) -> a lowercase, tabular display string.
|
|
3
|
+
* {from:'2026-06-01', to:'2026-06-14'} -> "jun 1 – jun 14, 2026"
|
|
4
|
+
* same month is collapsed; a single day drops the dash; an open value returns "".
|
|
5
|
+
* @param {{from:string|null,to:string|null}} value
|
|
6
|
+
* @param {{long?:boolean}} [opts] long=true spells the month ("june" not "jun")
|
|
7
|
+
*/
|
|
8
|
+
export function formatRange(value: {
|
|
9
|
+
from: string | null;
|
|
10
|
+
to: string | null;
|
|
11
|
+
}, opts?: {
|
|
12
|
+
long?: boolean;
|
|
13
|
+
}): string;
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {Object} CalendarProps
|
|
16
|
+
* @property {{from:string|null,to:string|null}} [value] controlled ISO range
|
|
17
|
+
* @property {{from:string|null,to:string|null}} [defaultValue] uncontrolled seed
|
|
18
|
+
* @property {(v:{from:string|null,to:string|null}) => void} [onChange] fires on a committed range
|
|
19
|
+
* @property {(v:{from:string|null,to:string|null}) => void} [onDraftChange] fires on each in-grid change before commit
|
|
20
|
+
* @property {string} [min] ISO lower bound (inclusive); out-of-range days are aria-disabled
|
|
21
|
+
* @property {string} [max] ISO upper bound (inclusive)
|
|
22
|
+
* @property {1|2} [numberOfMonths] months shown side by side (collapses to 1 under ~560px via container query)
|
|
23
|
+
* @property {0|1|2|3|4|5|6} [weekStartsOn] first column weekday (1 = monday, ISO default)
|
|
24
|
+
* @property {string} [className] extra classes on the .dr-cal wrapper (e.g. "is-static" for embeds)
|
|
25
|
+
* @property {(focusedISO:string) => void} [onAutoFocus] internal: notified when the grid focuses a day
|
|
26
|
+
* @property {boolean} [autoFocus] move DOM focus into the focused day on mount
|
|
27
|
+
*/
|
|
28
|
+
export function DateRangeCalendar({ value, defaultValue, onChange, onDraftChange, min, max, numberOfMonths, weekStartsOn, className, autoFocus, gridLabelId, }: {
|
|
29
|
+
value: any;
|
|
30
|
+
defaultValue?: {
|
|
31
|
+
from: any;
|
|
32
|
+
to: any;
|
|
33
|
+
};
|
|
34
|
+
onChange: any;
|
|
35
|
+
onDraftChange: any;
|
|
36
|
+
min: any;
|
|
37
|
+
max: any;
|
|
38
|
+
numberOfMonths?: number;
|
|
39
|
+
weekStartsOn?: number;
|
|
40
|
+
className?: string;
|
|
41
|
+
autoFocus?: boolean;
|
|
42
|
+
gridLabelId: any;
|
|
43
|
+
}): any;
|
|
44
|
+
/**
|
|
45
|
+
* @typedef {Object} DateRangeProps
|
|
46
|
+
* @property {{from:string|null,to:string|null}} [value] controlled ISO range
|
|
47
|
+
* @property {{from:string|null,to:string|null}} [defaultValue] uncontrolled seed
|
|
48
|
+
* @property {(v:{from:string|null,to:string|null}) => void} [onChange] fires only on a committed range / preset / clear
|
|
49
|
+
* @property {(v:{from:string|null,to:string|null}) => void} [onDraftChange] fires on each in-popover change before commit
|
|
50
|
+
* @property {{id:string,label:string,range:() => ({from:string,to:string})}[]} [presets] quick ranges; [] hides the rail
|
|
51
|
+
* @property {string} [min] ISO lower bound (inclusive)
|
|
52
|
+
* @property {string} [max] ISO upper bound (inclusive)
|
|
53
|
+
* @property {1|2} [numberOfMonths] desktop month count (auto-collapses to 1 under ~560px)
|
|
54
|
+
* @property {0|1|2|3|4|5|6} [weekStartsOn] first column weekday (1 = monday)
|
|
55
|
+
* @property {string} [placeholder] trigger label when empty (lowercase chrome)
|
|
56
|
+
* @property {string} [label] optional .label rendered above (form use)
|
|
57
|
+
* @property {'start'|'end'} [align] which trigger edge the popover aligns to
|
|
58
|
+
* @property {'md'|'sm'} [size] trigger height (36 / 28px)
|
|
59
|
+
* @property {boolean} [disabled]
|
|
60
|
+
* @property {boolean} [clearable] show a clear (X) action in the footer when a range is set
|
|
61
|
+
* @property {string} [id] trigger id; popover id derives `${id}-pop`
|
|
62
|
+
*/
|
|
63
|
+
export default function DateRange({ value, defaultValue, onChange, onDraftChange, presets, min, max, numberOfMonths, weekStartsOn, placeholder, label, align, size, disabled, clearable, id, }: {
|
|
64
|
+
value: any;
|
|
65
|
+
defaultValue?: {
|
|
66
|
+
from: any;
|
|
67
|
+
to: any;
|
|
68
|
+
};
|
|
69
|
+
onChange: any;
|
|
70
|
+
onDraftChange: any;
|
|
71
|
+
presets?: {
|
|
72
|
+
id: string;
|
|
73
|
+
label: string;
|
|
74
|
+
range: () => {
|
|
75
|
+
from: any;
|
|
76
|
+
to: any;
|
|
77
|
+
};
|
|
78
|
+
}[];
|
|
79
|
+
min: any;
|
|
80
|
+
max: any;
|
|
81
|
+
numberOfMonths?: number;
|
|
82
|
+
weekStartsOn?: number;
|
|
83
|
+
placeholder?: string;
|
|
84
|
+
label: any;
|
|
85
|
+
align?: string;
|
|
86
|
+
size?: string;
|
|
87
|
+
disabled?: boolean;
|
|
88
|
+
clearable?: boolean;
|
|
89
|
+
id: any;
|
|
90
|
+
}): any;
|
|
91
|
+
/**
|
|
92
|
+
* DATE_PRESETS - the default quick-range list. each `range()` is evaluated at open time
|
|
93
|
+
* against today's local date, so "last 7 days" always tracks the real calendar.
|
|
94
|
+
*/
|
|
95
|
+
export const DATE_PRESETS: {
|
|
96
|
+
id: string;
|
|
97
|
+
label: string;
|
|
98
|
+
range: () => {
|
|
99
|
+
from: any;
|
|
100
|
+
to: any;
|
|
101
|
+
};
|
|
102
|
+
}[];
|
|
103
|
+
export type CalendarProps = {
|
|
104
|
+
/**
|
|
105
|
+
* controlled ISO range
|
|
106
|
+
*/
|
|
107
|
+
value?: {
|
|
108
|
+
from: string | null;
|
|
109
|
+
to: string | null;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* uncontrolled seed
|
|
113
|
+
*/
|
|
114
|
+
defaultValue?: {
|
|
115
|
+
from: string | null;
|
|
116
|
+
to: string | null;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* fires on a committed range
|
|
120
|
+
*/
|
|
121
|
+
onChange?: (v: {
|
|
122
|
+
from: string | null;
|
|
123
|
+
to: string | null;
|
|
124
|
+
}) => void;
|
|
125
|
+
/**
|
|
126
|
+
* fires on each in-grid change before commit
|
|
127
|
+
*/
|
|
128
|
+
onDraftChange?: (v: {
|
|
129
|
+
from: string | null;
|
|
130
|
+
to: string | null;
|
|
131
|
+
}) => void;
|
|
132
|
+
/**
|
|
133
|
+
* ISO lower bound (inclusive); out-of-range days are aria-disabled
|
|
134
|
+
*/
|
|
135
|
+
min?: string;
|
|
136
|
+
/**
|
|
137
|
+
* ISO upper bound (inclusive)
|
|
138
|
+
*/
|
|
139
|
+
max?: string;
|
|
140
|
+
/**
|
|
141
|
+
* months shown side by side (collapses to 1 under ~560px via container query)
|
|
142
|
+
*/
|
|
143
|
+
numberOfMonths?: 1 | 2;
|
|
144
|
+
/**
|
|
145
|
+
* first column weekday (1 = monday, ISO default)
|
|
146
|
+
*/
|
|
147
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
148
|
+
/**
|
|
149
|
+
* extra classes on the .dr-cal wrapper (e.g. "is-static" for embeds)
|
|
150
|
+
*/
|
|
151
|
+
className?: string;
|
|
152
|
+
/**
|
|
153
|
+
* internal: notified when the grid focuses a day
|
|
154
|
+
*/
|
|
155
|
+
onAutoFocus?: (focusedISO: string) => void;
|
|
156
|
+
/**
|
|
157
|
+
* move DOM focus into the focused day on mount
|
|
158
|
+
*/
|
|
159
|
+
autoFocus?: boolean;
|
|
160
|
+
};
|
|
161
|
+
export type DateRangeProps = {
|
|
162
|
+
/**
|
|
163
|
+
* controlled ISO range
|
|
164
|
+
*/
|
|
165
|
+
value?: {
|
|
166
|
+
from: string | null;
|
|
167
|
+
to: string | null;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* uncontrolled seed
|
|
171
|
+
*/
|
|
172
|
+
defaultValue?: {
|
|
173
|
+
from: string | null;
|
|
174
|
+
to: string | null;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* fires only on a committed range / preset / clear
|
|
178
|
+
*/
|
|
179
|
+
onChange?: (v: {
|
|
180
|
+
from: string | null;
|
|
181
|
+
to: string | null;
|
|
182
|
+
}) => void;
|
|
183
|
+
/**
|
|
184
|
+
* fires on each in-popover change before commit
|
|
185
|
+
*/
|
|
186
|
+
onDraftChange?: (v: {
|
|
187
|
+
from: string | null;
|
|
188
|
+
to: string | null;
|
|
189
|
+
}) => void;
|
|
190
|
+
/**
|
|
191
|
+
* quick ranges; [] hides the rail
|
|
192
|
+
*/
|
|
193
|
+
presets?: {
|
|
194
|
+
id: string;
|
|
195
|
+
label: string;
|
|
196
|
+
range: () => ({
|
|
197
|
+
from: string;
|
|
198
|
+
to: string;
|
|
199
|
+
});
|
|
200
|
+
}[];
|
|
201
|
+
/**
|
|
202
|
+
* ISO lower bound (inclusive)
|
|
203
|
+
*/
|
|
204
|
+
min?: string;
|
|
205
|
+
/**
|
|
206
|
+
* ISO upper bound (inclusive)
|
|
207
|
+
*/
|
|
208
|
+
max?: string;
|
|
209
|
+
/**
|
|
210
|
+
* desktop month count (auto-collapses to 1 under ~560px)
|
|
211
|
+
*/
|
|
212
|
+
numberOfMonths?: 1 | 2;
|
|
213
|
+
/**
|
|
214
|
+
* first column weekday (1 = monday)
|
|
215
|
+
*/
|
|
216
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
217
|
+
/**
|
|
218
|
+
* trigger label when empty (lowercase chrome)
|
|
219
|
+
*/
|
|
220
|
+
placeholder?: string;
|
|
221
|
+
/**
|
|
222
|
+
* optional .label rendered above (form use)
|
|
223
|
+
*/
|
|
224
|
+
label?: string;
|
|
225
|
+
/**
|
|
226
|
+
* which trigger edge the popover aligns to
|
|
227
|
+
*/
|
|
228
|
+
align?: "start" | "end";
|
|
229
|
+
/**
|
|
230
|
+
* trigger height (36 / 28px)
|
|
231
|
+
*/
|
|
232
|
+
size?: "md" | "sm";
|
|
233
|
+
disabled?: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* show a clear (X) action in the footer when a range is set
|
|
236
|
+
*/
|
|
237
|
+
clearable?: boolean;
|
|
238
|
+
/**
|
|
239
|
+
* trigger id; popover id derives `${id}-pop`
|
|
240
|
+
*/
|
|
241
|
+
id?: string;
|
|
242
|
+
};
|