@fulgurite/tailwind-ui 0.0.1
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 +15 -0
- package/README.md +352 -0
- package/dist/daisy/dark-mode-switcher/index.d.ts +4 -0
- package/dist/daisy/dark-mode-switcher/index.d.ts.map +1 -0
- package/dist/daisy/dark-mode-switcher/index.js +22 -0
- package/dist/daisy/dark-mode-switcher/index.js.map +1 -0
- package/dist/daisy/date-picker/index.d.ts +4 -0
- package/dist/daisy/date-picker/index.d.ts.map +1 -0
- package/dist/daisy/date-picker/index.js +196 -0
- package/dist/daisy/date-picker/index.js.map +1 -0
- package/dist/daisy/locale-switcher/index.d.ts +4 -0
- package/dist/daisy/locale-switcher/index.d.ts.map +1 -0
- package/dist/daisy/locale-switcher/index.js +62 -0
- package/dist/daisy/locale-switcher/index.js.map +1 -0
- package/dist/internal/cx.d.ts +2 -0
- package/dist/internal/cx.d.ts.map +1 -0
- package/dist/internal/cx.js +4 -0
- package/dist/internal/cx.js.map +1 -0
- package/dist/internal/date-picker-icons.d.ts +8 -0
- package/dist/internal/date-picker-icons.d.ts.map +1 -0
- package/dist/internal/date-picker-icons.js +18 -0
- package/dist/internal/date-picker-icons.js.map +1 -0
- package/dist/internal/globe-icon.d.ts +4 -0
- package/dist/internal/globe-icon.d.ts.map +1 -0
- package/dist/internal/globe-icon.js +6 -0
- package/dist/internal/globe-icon.js.map +1 -0
- package/dist/internal/index.d.ts +6 -0
- package/dist/internal/index.d.ts.map +1 -0
- package/dist/internal/index.js +4 -0
- package/dist/internal/index.js.map +1 -0
- package/dist/internal/theme-icons.d.ts +9 -0
- package/dist/internal/theme-icons.d.ts.map +1 -0
- package/dist/internal/theme-icons.js +13 -0
- package/dist/internal/theme-icons.js.map +1 -0
- package/dist/shared/date-picker.d.ts +24 -0
- package/dist/shared/date-picker.d.ts.map +1 -0
- package/dist/shared/date-picker.js +2 -0
- package/dist/shared/date-picker.js.map +1 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +2 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/locale.d.ts +21 -0
- package/dist/shared/locale.d.ts.map +1 -0
- package/dist/shared/locale.js +2 -0
- package/dist/shared/locale.js.map +1 -0
- package/dist/shared/theme.d.ts +17 -0
- package/dist/shared/theme.d.ts.map +1 -0
- package/dist/shared/theme.js +2 -0
- package/dist/shared/theme.js.map +1 -0
- package/dist/vanilla/dark-mode-switcher/index.d.ts +4 -0
- package/dist/vanilla/dark-mode-switcher/index.d.ts.map +1 -0
- package/dist/vanilla/dark-mode-switcher/index.js +25 -0
- package/dist/vanilla/dark-mode-switcher/index.js.map +1 -0
- package/dist/vanilla/date-picker/index.d.ts +4 -0
- package/dist/vanilla/date-picker/index.d.ts.map +1 -0
- package/dist/vanilla/date-picker/index.js +197 -0
- package/dist/vanilla/date-picker/index.js.map +1 -0
- package/dist/vanilla/locale-switcher/index.d.ts +4 -0
- package/dist/vanilla/locale-switcher/index.d.ts.map +1 -0
- package/dist/vanilla/locale-switcher/index.js +70 -0
- package/dist/vanilla/locale-switcher/index.js.map +1 -0
- package/package.json +102 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, USD
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
6
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
7
|
+
and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
11
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
13
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
14
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
15
|
+
THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
# @fulgurite/tailwind-ui
|
|
2
|
+
|
|
3
|
+
Controlled React switchers and date pickers for USD apps that use Tailwind CSS. The package exposes exactly six public ESM subpath imports: vanilla and daisyUI variants for locale, dark-mode, and date selection.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Install the package with the peers used by the app that renders the components.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @fulgurite/tailwind-ui react react-dom tailwindcss
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add daisyUI only when importing from `/daisy/*`.
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
pnpm add @fulgurite/tailwind-ui react react-dom tailwindcss daisyui
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
daisyUI is an optional peer dependency. It is not required for `/vanilla/*` imports.
|
|
20
|
+
|
|
21
|
+
## Compatibility
|
|
22
|
+
|
|
23
|
+
| Tool | Supported version |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| Node | `>=20` |
|
|
26
|
+
| pnpm | `10.24.0` |
|
|
27
|
+
| TypeScript | `^5` |
|
|
28
|
+
| React | `^18.2 || ^19` |
|
|
29
|
+
| Tailwind CSS | `^4` |
|
|
30
|
+
| daisyUI | `^5`, only for `/daisy/*` imports |
|
|
31
|
+
|
|
32
|
+
## Public Imports
|
|
33
|
+
|
|
34
|
+
Import only from the exact subpaths below. There is no root import, no grouped import, no wildcard export, and no default export.
|
|
35
|
+
|
|
36
|
+
| Subpath | Named component export | Type exports |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| `@fulgurite/tailwind-ui/vanilla/locale-switcher` | `VanillaLocaleSwitcher` | `LocaleOption`, `LocaleSwitcherProps` |
|
|
39
|
+
| `@fulgurite/tailwind-ui/daisy/locale-switcher` | `DaisyLocaleSwitcher` | `LocaleOption`, `LocaleSwitcherProps` |
|
|
40
|
+
| `@fulgurite/tailwind-ui/vanilla/dark-mode-switcher` | `VanillaDarkModeSwitcher` | `ThemeSwitcherOption`, `DarkModeSwitcherProps` |
|
|
41
|
+
| `@fulgurite/tailwind-ui/daisy/dark-mode-switcher` | `DaisyDarkModeSwitcher` | `ThemeSwitcherOption`, `DarkModeSwitcherProps` |
|
|
42
|
+
| `@fulgurite/tailwind-ui/vanilla/date-picker` | `VanillaDatePicker` | `DatePickerProps`, `DatePickerWeekStart` |
|
|
43
|
+
| `@fulgurite/tailwind-ui/daisy/date-picker` | `DaisyDatePicker` | `DatePickerProps`, `DatePickerWeekStart` |
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import {
|
|
47
|
+
VanillaLocaleSwitcher,
|
|
48
|
+
type LocaleOption,
|
|
49
|
+
type LocaleSwitcherProps,
|
|
50
|
+
} from "@fulgurite/tailwind-ui/vanilla/locale-switcher";
|
|
51
|
+
|
|
52
|
+
import {
|
|
53
|
+
DaisyLocaleSwitcher,
|
|
54
|
+
type LocaleOption,
|
|
55
|
+
type LocaleSwitcherProps,
|
|
56
|
+
} from "@fulgurite/tailwind-ui/daisy/locale-switcher";
|
|
57
|
+
|
|
58
|
+
import {
|
|
59
|
+
VanillaDarkModeSwitcher,
|
|
60
|
+
type ThemeSwitcherOption,
|
|
61
|
+
type DarkModeSwitcherProps,
|
|
62
|
+
} from "@fulgurite/tailwind-ui/vanilla/dark-mode-switcher";
|
|
63
|
+
|
|
64
|
+
import {
|
|
65
|
+
DaisyDarkModeSwitcher,
|
|
66
|
+
type ThemeSwitcherOption,
|
|
67
|
+
type DarkModeSwitcherProps,
|
|
68
|
+
} from "@fulgurite/tailwind-ui/daisy/dark-mode-switcher";
|
|
69
|
+
|
|
70
|
+
import {
|
|
71
|
+
VanillaDatePicker,
|
|
72
|
+
type DatePickerProps,
|
|
73
|
+
type DatePickerWeekStart,
|
|
74
|
+
} from "@fulgurite/tailwind-ui/vanilla/date-picker";
|
|
75
|
+
|
|
76
|
+
import {
|
|
77
|
+
DaisyDatePicker,
|
|
78
|
+
type DatePickerProps,
|
|
79
|
+
type DatePickerWeekStart,
|
|
80
|
+
} from "@fulgurite/tailwind-ui/daisy/date-picker";
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Tailwind v4 Setup
|
|
84
|
+
|
|
85
|
+
Add the package as a Tailwind source in the consuming app CSS so Tailwind scans classes shipped in `dist`.
|
|
86
|
+
|
|
87
|
+
```css
|
|
88
|
+
@import "tailwindcss";
|
|
89
|
+
@source "../node_modules/@fulgurite/tailwind-ui";
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Adjust the relative `@source` path when your CSS file is nested differently.
|
|
93
|
+
|
|
94
|
+
## daisyUI Setup
|
|
95
|
+
|
|
96
|
+
Only apps that use `/daisy/*` imports need daisyUI. The `/vanilla/date-picker` entry uses Tailwind utilities only and does not require daisyUI. Add the plugin in the same consumer CSS file that imports Tailwind when rendering daisyUI components.
|
|
97
|
+
|
|
98
|
+
```css
|
|
99
|
+
@import "tailwindcss";
|
|
100
|
+
@plugin "daisyui";
|
|
101
|
+
@source "../node_modules/@fulgurite/tailwind-ui";
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Consumer apps own daisyUI theme selection.
|
|
105
|
+
|
|
106
|
+
```css
|
|
107
|
+
@import "tailwindcss";
|
|
108
|
+
@plugin "daisyui" {
|
|
109
|
+
themes: light --default, dark --prefersdark, cupcake;
|
|
110
|
+
}
|
|
111
|
+
@source "../node_modules/@fulgurite/tailwind-ui";
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Usage Examples
|
|
115
|
+
|
|
116
|
+
All components are controlled React components. Switchers receive the current `value`, a stable `options` array, and an `onChange` handler. Both date pickers share the same API: a controlled date-only `value` string and an `onChange` handler that updates application state.
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import { useState } from "react";
|
|
120
|
+
import {
|
|
121
|
+
VanillaLocaleSwitcher,
|
|
122
|
+
type LocaleOption,
|
|
123
|
+
} from "@fulgurite/tailwind-ui/vanilla/locale-switcher";
|
|
124
|
+
|
|
125
|
+
const localeOptions: readonly LocaleOption[] = [
|
|
126
|
+
{ value: "en", label: "English", flag: "US" },
|
|
127
|
+
{ value: "es", label: "Spanish", flag: "ES" },
|
|
128
|
+
];
|
|
129
|
+
|
|
130
|
+
export function VanillaLocaleControl() {
|
|
131
|
+
const [locale, setLocale] = useState("en");
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<VanillaLocaleSwitcher
|
|
135
|
+
value={locale}
|
|
136
|
+
options={localeOptions}
|
|
137
|
+
onChange={(nextLocale) => setLocale(nextLocale)}
|
|
138
|
+
label="Language"
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
import { useState } from "react";
|
|
146
|
+
import {
|
|
147
|
+
DaisyLocaleSwitcher,
|
|
148
|
+
type LocaleOption,
|
|
149
|
+
} from "@fulgurite/tailwind-ui/daisy/locale-switcher";
|
|
150
|
+
|
|
151
|
+
const localeOptions: readonly LocaleOption[] = [
|
|
152
|
+
{ value: "en", label: "English", flag: "US" },
|
|
153
|
+
{ value: "fr", label: "French", flag: "FR" },
|
|
154
|
+
];
|
|
155
|
+
|
|
156
|
+
export function DaisyLocaleControl() {
|
|
157
|
+
const [locale, setLocale] = useState("en");
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<DaisyLocaleSwitcher
|
|
161
|
+
value={locale}
|
|
162
|
+
options={localeOptions}
|
|
163
|
+
onChange={(nextLocale) => setLocale(nextLocale)}
|
|
164
|
+
label="Language"
|
|
165
|
+
/>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
import { useState } from "react";
|
|
172
|
+
import {
|
|
173
|
+
VanillaDarkModeSwitcher,
|
|
174
|
+
type ThemeSwitcherOption,
|
|
175
|
+
} from "@fulgurite/tailwind-ui/vanilla/dark-mode-switcher";
|
|
176
|
+
|
|
177
|
+
const themeOptions: readonly ThemeSwitcherOption[] = [
|
|
178
|
+
{ value: "light", label: "Light" },
|
|
179
|
+
{ value: "dark", label: "Dark" },
|
|
180
|
+
];
|
|
181
|
+
|
|
182
|
+
export function VanillaThemeControl() {
|
|
183
|
+
const [theme, setTheme] = useState("light");
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<VanillaDarkModeSwitcher
|
|
187
|
+
value={theme}
|
|
188
|
+
options={themeOptions}
|
|
189
|
+
onChange={(nextTheme) => setTheme(nextTheme)}
|
|
190
|
+
label="Theme"
|
|
191
|
+
/>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
```tsx
|
|
197
|
+
import { useState } from "react";
|
|
198
|
+
import {
|
|
199
|
+
DaisyDarkModeSwitcher,
|
|
200
|
+
type ThemeSwitcherOption,
|
|
201
|
+
} from "@fulgurite/tailwind-ui/daisy/dark-mode-switcher";
|
|
202
|
+
|
|
203
|
+
const themeOptions: readonly ThemeSwitcherOption[] = [
|
|
204
|
+
{ value: "light", label: "Light" },
|
|
205
|
+
{ value: "dark", label: "Dark" },
|
|
206
|
+
];
|
|
207
|
+
|
|
208
|
+
export function DaisyThemeControl() {
|
|
209
|
+
const [theme, setTheme] = useState("light");
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<DaisyDarkModeSwitcher
|
|
213
|
+
value={theme}
|
|
214
|
+
options={themeOptions}
|
|
215
|
+
onChange={(nextTheme) => setTheme(nextTheme)}
|
|
216
|
+
label="Theme"
|
|
217
|
+
/>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
```tsx
|
|
223
|
+
import { useState } from "react";
|
|
224
|
+
import { VanillaDatePicker } from "@fulgurite/tailwind-ui/vanilla/date-picker";
|
|
225
|
+
|
|
226
|
+
export function VanillaDeliveryDateControl() {
|
|
227
|
+
const [deliveryDate, setDeliveryDate] = useState("");
|
|
228
|
+
|
|
229
|
+
return (
|
|
230
|
+
<VanillaDatePicker
|
|
231
|
+
value={deliveryDate}
|
|
232
|
+
onChange={(nextDate) => setDeliveryDate(nextDate)}
|
|
233
|
+
label="Delivery date"
|
|
234
|
+
emptyLabel="No date selected"
|
|
235
|
+
openCalendarLabel="Open delivery calendar"
|
|
236
|
+
allowClear
|
|
237
|
+
/>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
import { useState } from "react";
|
|
244
|
+
import { DaisyDatePicker } from "@fulgurite/tailwind-ui/daisy/date-picker";
|
|
245
|
+
|
|
246
|
+
export function DaisyDeliveryDateControl() {
|
|
247
|
+
const [deliveryDate, setDeliveryDate] = useState("");
|
|
248
|
+
|
|
249
|
+
return (
|
|
250
|
+
<DaisyDatePicker
|
|
251
|
+
value={deliveryDate}
|
|
252
|
+
onChange={(nextDate) => setDeliveryDate(nextDate)}
|
|
253
|
+
label="Delivery date"
|
|
254
|
+
emptyLabel="No date selected"
|
|
255
|
+
openCalendarLabel="Open delivery calendar"
|
|
256
|
+
allowClear
|
|
257
|
+
/>
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## API Reference
|
|
263
|
+
|
|
264
|
+
### `VanillaLocaleSwitcher` and `DaisyLocaleSwitcher`
|
|
265
|
+
|
|
266
|
+
| Prop | Type | Required | Notes |
|
|
267
|
+
| --- | --- | --- | --- |
|
|
268
|
+
| `value` | `string` | Yes | Current selected locale value. |
|
|
269
|
+
| `options` | `readonly LocaleOption[]` | Yes | Ordered choices rendered by the switcher. |
|
|
270
|
+
| `onChange` | `(value: string, option: LocaleOption) => void` | Yes | Called when an enabled option is selected. |
|
|
271
|
+
| `label` | `React.ReactNode` | No | Accessible label; vanilla defaults to `Language`, daisy falls back to `Change language` for accessibility. |
|
|
272
|
+
| `emptyLabel` | `React.ReactNode` | No | Empty-state text when no locale options are available. |
|
|
273
|
+
| `disabled` | `boolean` | No | Disables the trigger and option changes. |
|
|
274
|
+
| `className` | `string` | No | Class name for the root element. |
|
|
275
|
+
| `triggerClassName` | `string` | No | Class name merged onto the trigger button. |
|
|
276
|
+
| `menuClassName` | `string` | No | Class name merged onto the option menu. |
|
|
277
|
+
| `optionClassName` | `string` | No | Class name merged onto each option button. |
|
|
278
|
+
| `triggerIcon` | `React.ReactNode` | No | Replaces the internal globe icon. |
|
|
279
|
+
|
|
280
|
+
| `LocaleOption` field | Type | Required | Notes |
|
|
281
|
+
| --- | --- | --- | --- |
|
|
282
|
+
| `value` | `string` | Yes | Stable value passed back to `onChange`. |
|
|
283
|
+
| `label` | `React.ReactNode` | Yes | Visible option label. |
|
|
284
|
+
| `flag` | `React.ReactNode` | No | Optional flag or locale marker. |
|
|
285
|
+
| `disabled` | `boolean` | No | Disables only this option. |
|
|
286
|
+
|
|
287
|
+
### `VanillaDarkModeSwitcher` and `DaisyDarkModeSwitcher`
|
|
288
|
+
|
|
289
|
+
| Prop | Type | Required | Notes |
|
|
290
|
+
| --- | --- | --- | --- |
|
|
291
|
+
| `value` | `string` | Yes | Current selected theme value. |
|
|
292
|
+
| `options` | `readonly ThemeSwitcherOption[]` | Yes | Ordered choices rendered by the switcher. |
|
|
293
|
+
| `onChange` | `(value: string, option: ThemeSwitcherOption) => void` | Yes | Called when an enabled option is selected. |
|
|
294
|
+
| `label` | `React.ReactNode` | No | Accessible legend rendered for assistive technology. |
|
|
295
|
+
| `disabled` | `boolean` | No | Disables the switcher and option changes. |
|
|
296
|
+
| `className` | `string` | No | Class name for the fieldset/root element. |
|
|
297
|
+
| `optionClassName` | `string` | No | Class name merged onto each option button. |
|
|
298
|
+
|
|
299
|
+
| `ThemeSwitcherOption` field | Type | Required | Notes |
|
|
300
|
+
| --- | --- | --- | --- |
|
|
301
|
+
| `value` | `string` | Yes | Stable value passed back to `onChange`. |
|
|
302
|
+
| `label` | `React.ReactNode` | Yes | Visible label when no `icon` is provided; accessible label when an icon is provided. |
|
|
303
|
+
| `icon` | `React.ReactNode` | No | Optional icon for compact theme choices. |
|
|
304
|
+
| `disabled` | `boolean` | No | Disables only this option. |
|
|
305
|
+
|
|
306
|
+
### `VanillaDatePicker` and `DaisyDatePicker`
|
|
307
|
+
|
|
308
|
+
| Prop | Type | Required | Notes |
|
|
309
|
+
| --- | --- | --- | --- |
|
|
310
|
+
| `value` | `string` | Yes | Controlled date value. Use `""` for no date and `YYYY-MM-DD` for selected dates. Invalid non-empty values display as raw text and do not select a calendar day. |
|
|
311
|
+
| `onChange` | `(nextValue: string) => void` | Yes | Called with a `YYYY-MM-DD` date string when a day is selected, or `""` when the clear action runs. |
|
|
312
|
+
| `label` | `React.ReactNode` | No | Visible field label and dialog label when it is a string or number. |
|
|
313
|
+
| `emptyLabel` | `React.ReactNode` | No | Trigger text when `value` is empty. Defaults to `Select date`. |
|
|
314
|
+
| `openCalendarLabel` | `string` | No | Accessible trigger label. Defaults to `Open calendar`. |
|
|
315
|
+
| `clearLabel` | `string` | No | Accessible clear-button label. Defaults to `Clear date`. |
|
|
316
|
+
| `previousMonthLabel` | `string` | No | Accessible previous-month button label. |
|
|
317
|
+
| `nextMonthLabel` | `string` | No | Accessible next-month button label. |
|
|
318
|
+
| `dateInputLabel` | `string` | No | Accessible label for the hidden native date input affordance. |
|
|
319
|
+
| `disabled` | `boolean` | No | Disables trigger, clear, month navigation, and day selection. |
|
|
320
|
+
| `allowClear` | `boolean` | No | Shows a clear button when `value` is non-empty. |
|
|
321
|
+
| `locale` | `string` | No | Locale passed to date formatting. Defaults to `en-US`. |
|
|
322
|
+
| `weekStartsOn` | `DatePickerWeekStart` | No | First day of the week, `0` for Sunday through `6` for Saturday. Defaults to Sunday. |
|
|
323
|
+
| `className` | `string` | No | Class name for the root element. |
|
|
324
|
+
| `triggerClassName` | `string` | No | Class name merged onto the trigger button. |
|
|
325
|
+
| `panelClassName` | `string` | No | Class name merged onto the calendar popover panel. |
|
|
326
|
+
| `calendarClassName` | `string` | No | Class name merged onto the calendar content grid. |
|
|
327
|
+
| `dayClassName` | `string` | No | Class name merged onto every day button. |
|
|
328
|
+
| `clearButtonClassName` | `string` | No | Class name merged onto the clear button. |
|
|
329
|
+
|
|
330
|
+
`DatePickerWeekStart` is the union `0 | 1 | 2 | 3 | 4 | 5 | 6`.
|
|
331
|
+
|
|
332
|
+
## Runtime Boundaries
|
|
333
|
+
|
|
334
|
+
The components do not inject CSS, register Tailwind plugins, mutate `document`, read or write storage, route between locales, persist themes, or own app state. React, React DOM, Tailwind CSS, and optional daisyUI setup stay in the consuming app.
|
|
335
|
+
|
|
336
|
+
Locale switchers use `triggerIcon` when supplied; otherwise they render the package globe icon. Theme options with `icon` render the icon with an accessible label from `label`; options without `icon` render `label` visibly. Date pickers own only transient UI state for their open panel and viewed month while all selected date state stays in the caller.
|
|
337
|
+
|
|
338
|
+
## SSR and Next Apps
|
|
339
|
+
|
|
340
|
+
Each public entry starts with the React client boundary and renders from props. The components do not read browser APIs at module scope, and they do not read from local storage, cookies, or the router. The date picker attaches `document`/`window` listeners only in effects while the popover is open. In Next apps, keep state, persistence, locale routing, and theme application in the app layer; handlers that touch browser APIs belong in a client component.
|
|
341
|
+
|
|
342
|
+
## Tiery Migration Notes
|
|
343
|
+
|
|
344
|
+
When migrating from Tiery, preserve the user-facing behavior from `LanguageSwitcher` and `ThemePicker`: present the current language or theme, show available choices, and call app code when the user selects a new value.
|
|
345
|
+
|
|
346
|
+
Do not port Tiery runtime coupling into this package. Next routing, i18n adapters, Zustand stores, local storage, and document theme updates belong in the consuming app.
|
|
347
|
+
|
|
348
|
+
## Package Readiness
|
|
349
|
+
|
|
350
|
+
The package is ESM-only and exposes no alternate module-format fields. Packed contents are controlled by the `files` field and verified to include only `package.json`, `README.md`, `LICENSE`, and allowed `.js`, `.js.map`, `.d.ts`, or `.d.ts.map` files under `dist`.
|
|
351
|
+
|
|
352
|
+
Release-readiness checks are available through `pnpm verify:all`, which runs Biome checks, type checking, build, unit tests, Storybook build, Playwright Storybook QA, export verification, pack validation, and fixture verification in order. This README documents package readiness only; it does not claim that an npm release has been made.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DarkModeSwitcherProps } from "../../shared/theme.js";
|
|
2
|
+
export type { DarkModeSwitcherProps, ThemeSwitcherOption } from "../../shared/theme.js";
|
|
3
|
+
export declare function DaisyDarkModeSwitcher({ value, options, onChange, label, disabled, className, optionClassName, }: DarkModeSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/daisy/dark-mode-switcher/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,uBAAuB,CAAC;AAExF,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAUxF,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,OAAO,EACP,QAAQ,EACR,KAAK,EACL,QAAgB,EAChB,SAAS,EACT,eAAe,GAChB,EAAE,qBAAqB,2CAqDvB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../../internal/cx.js";
|
|
4
|
+
function getStringLabel(label) {
|
|
5
|
+
if (typeof label === "string" || typeof label === "number") {
|
|
6
|
+
return String(label);
|
|
7
|
+
}
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
export function DaisyDarkModeSwitcher({ value, options, onChange, label, disabled = false, className, optionClassName, }) {
|
|
11
|
+
return (_jsxs("fieldset", { "aria-disabled": disabled ? true : undefined, className: cx("join rounded-full border border-base-300 bg-base-100 p-0.5 shadow-sm", disabled && "opacity-60", className), disabled: disabled, children: [label !== undefined ? _jsx("legend", { className: "sr-only", children: label }) : null, options.map((option) => {
|
|
12
|
+
const isSelected = option.value === value;
|
|
13
|
+
const isDisabled = disabled || option.disabled;
|
|
14
|
+
const title = getStringLabel(option.label);
|
|
15
|
+
return (_jsx("button", { "aria-disabled": isDisabled ? true : undefined, "aria-pressed": isSelected, className: cx("btn btn-ghost btn-xs join-item h-8 min-h-8 rounded-full border-0 px-3 shadow-none transition-colors", option.icon ? "w-8 px-0" : false, isSelected ? "btn-active text-base-content" : "text-base-content/60", !isDisabled && "hover:text-base-content", optionClassName), disabled: isDisabled, onClick: () => {
|
|
16
|
+
if (!isDisabled) {
|
|
17
|
+
onChange(option.value, option);
|
|
18
|
+
}
|
|
19
|
+
}, title: title, type: "button", children: option.icon ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", className: "inline-flex size-4 items-center justify-center", children: option.icon }), _jsx("span", { className: "sr-only", children: option.label })] })) : (_jsx("span", { className: "text-sm leading-none", children: option.label })) }, option.value));
|
|
20
|
+
})] }));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/daisy/dark-mode-switcher/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAK1C,SAAS,cAAc,CAAC,KAAmC;IACzD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAA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KAAK,EAAE,MAAM,CAAC,CAAC;wBACjC,CAAC;oBACH,CAAC,EACD,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,QAAQ,YAEZ,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACb,8BACE,8BAAkB,MAAM,EAAC,SAAS,EAAC,gDAAgD,YAChF,MAAM,CAAC,IAAI,GACP,EACP,eAAM,SAAS,EAAC,SAAS,YAAE,MAAM,CAAC,KAAK,GAAQ,IAC9C,CACJ,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,sBAAsB,YAAE,MAAM,CAAC,KAAK,GAAQ,CAC7D,IAlBI,MAAM,CAAC,KAAK,CAmBV,CACV,CAAC;YACJ,CAAC,CAAC,IACO,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DatePickerProps } from "../../shared/date-picker.js";
|
|
2
|
+
export type { DatePickerProps, DatePickerWeekStart } from "../../shared/date-picker.js";
|
|
3
|
+
export declare function DaisyDatePicker({ value, onChange, label, emptyLabel, openCalendarLabel, clearLabel, previousMonthLabel, nextMonthLabel, dateInputLabel, disabled, allowClear, locale, weekStartsOn, className, triggerClassName, panelClassName, calendarClassName, dayClassName, clearButtonClassName, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/daisy/date-picker/index.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,6BAA6B,CAAC;AAExF,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAiLxF,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,UAA8B,EAC9B,iBAA4C,EAC5C,UAA8B,EAC9B,kBAA8C,EAC9C,cAAsC,EACtC,cAAsC,EACtC,QAAgB,EAChB,UAAkB,EAClB,MAAsB,EACtB,YAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,GACrB,EAAE,eAAe,2CA4NjB"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { cx } from "../../internal/cx.js";
|
|
5
|
+
import { DatePickerCalendarIcon, DatePickerChevronLeftIcon, DatePickerChevronRightIcon, DatePickerXIcon, } from "../../internal/date-picker-icons.js";
|
|
6
|
+
const defaultEmptyLabel = "Select date";
|
|
7
|
+
const defaultOpenCalendarLabel = "Open calendar";
|
|
8
|
+
const defaultClearLabel = "Clear date";
|
|
9
|
+
const defaultPreviousMonthLabel = "Show previous month";
|
|
10
|
+
const defaultNextMonthLabel = "Show next month";
|
|
11
|
+
const defaultDateInputLabel = "Selected date";
|
|
12
|
+
const defaultLocale = "en-US";
|
|
13
|
+
const rootClassName = "grid w-full max-w-sm gap-2 text-sm text-base-content";
|
|
14
|
+
const labelClassName = "text-sm font-medium text-base-content/80";
|
|
15
|
+
const wrapClassName = "relative grid gap-2";
|
|
16
|
+
const rowClassName = "flex items-center gap-2";
|
|
17
|
+
const triggerBaseClassName = "btn btn-sm min-h-10 flex-1 justify-start gap-2 rounded-box border border-base-300 bg-base-100 text-left font-normal text-base-content shadow-sm transition-colors hover:bg-base-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30";
|
|
18
|
+
const triggerValueClassName = "min-w-0 flex-1 truncate text-left";
|
|
19
|
+
const triggerCaretClassName = "text-base-content/50";
|
|
20
|
+
const clearBaseClassName = "btn btn-ghost btn-sm btn-circle border border-base-300 bg-base-100 text-base-content/70 shadow-sm hover:bg-base-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30";
|
|
21
|
+
const hiddenInputClassName = "absolute -m-px h-px w-px overflow-hidden whitespace-nowrap border-0 p-0 [clip-path:inset(50%)] [clip:rect(0,0,0,0)]";
|
|
22
|
+
const panelBaseClassName = "card card-compact absolute left-0 top-full z-50 mt-2 max-h-[min(28rem,calc(100dvh-5rem))] w-full min-w-80 overflow-y-auto border border-base-300 bg-base-100 p-3 text-base-content shadow-2xl";
|
|
23
|
+
const calendarBaseClassName = "grid gap-3";
|
|
24
|
+
const calendarHeaderClassName = "grid grid-cols-[auto_1fr_auto] items-center gap-2";
|
|
25
|
+
const calendarTitleClassName = "text-center text-sm font-semibold text-base-content";
|
|
26
|
+
const navButtonClassName = "btn btn-ghost btn-sm btn-circle text-base-content/70 hover:text-base-content focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30";
|
|
27
|
+
const calendarGridClassName = "grid grid-cols-7 gap-1";
|
|
28
|
+
const weekdayClassName = "text-center text-xs font-bold uppercase tracking-wide text-base-content/50";
|
|
29
|
+
const dayButtonClassName = "btn btn-ghost btn-sm h-9 min-h-9 rounded-lg border border-transparent p-0 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30";
|
|
30
|
+
const dayCurrentMonthClassName = "text-base-content hover:bg-base-200";
|
|
31
|
+
const dayAdjacentMonthClassName = "text-base-content/35 hover:text-base-content/60";
|
|
32
|
+
const dayTodayClassName = "border-primary/50 text-primary";
|
|
33
|
+
const daySelectedClassName = "btn-primary border-primary text-primary-content";
|
|
34
|
+
function formatLocalDateInput(date) {
|
|
35
|
+
const year = date.getFullYear();
|
|
36
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
37
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
38
|
+
return `${year}-${month}-${day}`;
|
|
39
|
+
}
|
|
40
|
+
function parseLocalDateInput(value) {
|
|
41
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const [yearRaw, monthRaw, dayRaw] = value.split("-");
|
|
45
|
+
const year = Number(yearRaw);
|
|
46
|
+
const month = Number(monthRaw);
|
|
47
|
+
const day = Number(dayRaw);
|
|
48
|
+
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const parsed = new Date(year, month - 1, day);
|
|
52
|
+
if (parsed.getFullYear() !== year ||
|
|
53
|
+
parsed.getMonth() !== month - 1 ||
|
|
54
|
+
parsed.getDate() !== day) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return parsed;
|
|
58
|
+
}
|
|
59
|
+
function addLocalDays(baseDate, days) {
|
|
60
|
+
const nextDate = new Date(baseDate);
|
|
61
|
+
nextDate.setDate(nextDate.getDate() + days);
|
|
62
|
+
return nextDate;
|
|
63
|
+
}
|
|
64
|
+
function addCalendarMonths(baseDate, months) {
|
|
65
|
+
const nextDate = new Date(baseDate.getFullYear(), baseDate.getMonth(), 1);
|
|
66
|
+
nextDate.setMonth(nextDate.getMonth() + months);
|
|
67
|
+
return nextDate;
|
|
68
|
+
}
|
|
69
|
+
function getInitialViewMonth(value, fallback) {
|
|
70
|
+
const parsed = parseLocalDateInput(value);
|
|
71
|
+
const sourceDate = parsed ?? fallback;
|
|
72
|
+
return new Date(sourceDate.getFullYear(), sourceDate.getMonth(), 1);
|
|
73
|
+
}
|
|
74
|
+
function formatDisplayValue(value, emptyLabel, locale) {
|
|
75
|
+
if (!value) {
|
|
76
|
+
return emptyLabel;
|
|
77
|
+
}
|
|
78
|
+
const parsed = parseLocalDateInput(value);
|
|
79
|
+
if (!parsed) {
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
return parsed.toLocaleDateString(locale, {
|
|
83
|
+
year: "numeric",
|
|
84
|
+
month: "short",
|
|
85
|
+
day: "numeric",
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function buildWeekdayLabels(locale, weekStartsOn) {
|
|
89
|
+
const sunday = new Date(2025, 0, 5);
|
|
90
|
+
return Array.from({ length: 7 }, (_, index) => {
|
|
91
|
+
const weekdayDate = addLocalDays(sunday, weekStartsOn + index);
|
|
92
|
+
return weekdayDate.toLocaleDateString(locale, { weekday: "short" });
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function buildCalendarCells({ locale, todayValue, value, viewMonth, weekStartsOn, }) {
|
|
96
|
+
const firstOfMonth = new Date(viewMonth.getFullYear(), viewMonth.getMonth(), 1);
|
|
97
|
+
const startOffset = (firstOfMonth.getDay() - weekStartsOn + 7) % 7;
|
|
98
|
+
const gridStart = addLocalDays(firstOfMonth, -startOffset);
|
|
99
|
+
return Array.from({ length: 42 }, (_, index) => {
|
|
100
|
+
const cellDate = addLocalDays(gridStart, index);
|
|
101
|
+
const cellValue = formatLocalDateInput(cellDate);
|
|
102
|
+
return {
|
|
103
|
+
dayNumber: cellDate.getDate(),
|
|
104
|
+
label: cellDate.toLocaleDateString(locale, {
|
|
105
|
+
weekday: "long",
|
|
106
|
+
month: "long",
|
|
107
|
+
day: "numeric",
|
|
108
|
+
year: "numeric",
|
|
109
|
+
}),
|
|
110
|
+
value: cellValue,
|
|
111
|
+
isCurrentMonth: cellDate.getMonth() === viewMonth.getMonth(),
|
|
112
|
+
isSelected: cellValue === value,
|
|
113
|
+
isToday: cellValue === todayValue,
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function getDialogLabel(label, openCalendarLabel) {
|
|
118
|
+
if (typeof label === "string" || typeof label === "number") {
|
|
119
|
+
return String(label);
|
|
120
|
+
}
|
|
121
|
+
return openCalendarLabel;
|
|
122
|
+
}
|
|
123
|
+
export function DaisyDatePicker({ value, onChange, label, emptyLabel = defaultEmptyLabel, openCalendarLabel = defaultOpenCalendarLabel, clearLabel = defaultClearLabel, previousMonthLabel = defaultPreviousMonthLabel, nextMonthLabel = defaultNextMonthLabel, dateInputLabel = defaultDateInputLabel, disabled = false, allowClear = false, locale = defaultLocale, weekStartsOn = 0, className, triggerClassName, panelClassName, calendarClassName, dayClassName, clearButtonClassName, }) {
|
|
124
|
+
const panelId = useId();
|
|
125
|
+
const inputId = useId();
|
|
126
|
+
const rootRef = useRef(null);
|
|
127
|
+
const triggerRef = useRef(null);
|
|
128
|
+
const today = useMemo(() => new Date(), []);
|
|
129
|
+
const todayValue = useMemo(() => formatLocalDateInput(today), [today]);
|
|
130
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
131
|
+
const [viewMonth, setViewMonth] = useState(() => getInitialViewMonth(value, today));
|
|
132
|
+
const displayValue = useMemo(() => formatDisplayValue(value, emptyLabel, locale), [emptyLabel, locale, value]);
|
|
133
|
+
const monthHeading = useMemo(() => viewMonth.toLocaleDateString(locale, { month: "long", year: "numeric" }), [locale, viewMonth]);
|
|
134
|
+
const weekdayLabels = useMemo(() => buildWeekdayLabels(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
135
|
+
const calendarCells = useMemo(() => buildCalendarCells({ locale, todayValue, value, viewMonth, weekStartsOn }), [locale, todayValue, value, viewMonth, weekStartsOn]);
|
|
136
|
+
const hiddenInputValue = parseLocalDateInput(value) ? value : "";
|
|
137
|
+
const dialogLabel = getDialogLabel(label, openCalendarLabel);
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (!disabled)
|
|
140
|
+
return;
|
|
141
|
+
setIsOpen(false);
|
|
142
|
+
}, [disabled]);
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
if (!isOpen)
|
|
145
|
+
return;
|
|
146
|
+
function handlePointerDown(event) {
|
|
147
|
+
const target = event.target;
|
|
148
|
+
if (!target || rootRef.current?.contains(target))
|
|
149
|
+
return;
|
|
150
|
+
setIsOpen(false);
|
|
151
|
+
}
|
|
152
|
+
function handleKeyDown(event) {
|
|
153
|
+
if (event.key !== "Escape")
|
|
154
|
+
return;
|
|
155
|
+
setIsOpen(false);
|
|
156
|
+
triggerRef.current?.focus();
|
|
157
|
+
}
|
|
158
|
+
document.addEventListener("mousedown", handlePointerDown);
|
|
159
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
160
|
+
return () => {
|
|
161
|
+
document.removeEventListener("mousedown", handlePointerDown);
|
|
162
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
163
|
+
};
|
|
164
|
+
}, [isOpen]);
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
if (!isOpen)
|
|
167
|
+
return;
|
|
168
|
+
setViewMonth(getInitialViewMonth(value, today));
|
|
169
|
+
}, [isOpen, today, value]);
|
|
170
|
+
function closeAndReturnFocus() {
|
|
171
|
+
setIsOpen(false);
|
|
172
|
+
triggerRef.current?.focus();
|
|
173
|
+
}
|
|
174
|
+
function handleTriggerClick() {
|
|
175
|
+
if (disabled)
|
|
176
|
+
return;
|
|
177
|
+
setIsOpen((currentIsOpen) => !currentIsOpen);
|
|
178
|
+
}
|
|
179
|
+
function handleMonthChange(months) {
|
|
180
|
+
if (disabled)
|
|
181
|
+
return;
|
|
182
|
+
setViewMonth((currentMonth) => addCalendarMonths(currentMonth, months));
|
|
183
|
+
}
|
|
184
|
+
function handleSelect(nextValue) {
|
|
185
|
+
if (disabled)
|
|
186
|
+
return;
|
|
187
|
+
onChange(nextValue);
|
|
188
|
+
closeAndReturnFocus();
|
|
189
|
+
}
|
|
190
|
+
return (_jsxs("div", { className: cx(rootClassName, className), ref: rootRef, children: [label !== undefined && label !== null ? (_jsx("span", { className: labelClassName, children: label })) : null, _jsxs("div", { className: wrapClassName, children: [_jsxs("div", { className: rowClassName, children: [_jsxs("button", { "aria-controls": isOpen ? panelId : undefined, "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-label": openCalendarLabel, className: cx(triggerBaseClassName, disabled && "btn-disabled", triggerClassName), disabled: disabled, onClick: handleTriggerClick, ref: triggerRef, title: openCalendarLabel, type: "button", children: [_jsx(DatePickerCalendarIcon, { "aria-hidden": "true" }), _jsx("span", { "aria-hidden": "true", className: triggerValueClassName, children: displayValue }), _jsx("span", { "aria-hidden": "true", className: triggerCaretClassName, children: isOpen ? "▲" : "▼" })] }), allowClear && value ? (_jsx("button", { "aria-label": clearLabel, className: cx(clearBaseClassName, disabled && "btn-disabled", clearButtonClassName), disabled: disabled, onClick: () => handleSelect(""), title: clearLabel, type: "button", children: _jsx(DatePickerXIcon, { "aria-hidden": "true", className: "size-3.5" }) })) : null] }), _jsx("input", { "aria-label": dateInputLabel, className: hiddenInputClassName, disabled: disabled, id: inputId, readOnly: true, tabIndex: -1, type: "date", value: hiddenInputValue }), isOpen ? (_jsx("div", { "aria-label": dialogLabel, className: cx(panelBaseClassName, panelClassName), id: panelId, role: "dialog", children: _jsxs("div", { className: cx(calendarBaseClassName, calendarClassName), children: [_jsxs("div", { className: calendarHeaderClassName, children: [_jsx("button", { "aria-label": previousMonthLabel, className: navButtonClassName, disabled: disabled, onClick: () => handleMonthChange(-1), type: "button", children: _jsx(DatePickerChevronLeftIcon, { "aria-hidden": "true" }) }), _jsx("p", { "aria-live": "polite", className: calendarTitleClassName, children: monthHeading }), _jsx("button", { "aria-label": nextMonthLabel, className: navButtonClassName, disabled: disabled, onClick: () => handleMonthChange(1), type: "button", children: _jsx(DatePickerChevronRightIcon, { "aria-hidden": "true" }) })] }), _jsx("div", { "aria-hidden": "true", className: calendarGridClassName, children: weekdayLabels.map((weekdayLabel) => (_jsx("span", { className: weekdayClassName, children: weekdayLabel }, weekdayLabel))) }), _jsx("div", { className: calendarGridClassName, children: calendarCells.map((cell) => (_jsx("button", { "aria-current": cell.isToday ? "date" : undefined, "aria-label": cell.label, "aria-pressed": cell.isSelected, className: cx(dayButtonClassName, cell.isSelected
|
|
191
|
+
? daySelectedClassName
|
|
192
|
+
: cell.isCurrentMonth
|
|
193
|
+
? dayCurrentMonthClassName
|
|
194
|
+
: dayAdjacentMonthClassName, !cell.isSelected && cell.isToday && dayTodayClassName, disabled && "btn-disabled opacity-50", dayClassName), disabled: disabled, onClick: () => handleSelect(cell.value), type: "button", children: cell.dayNumber }, cell.value))) })] }) })) : null] })] }));
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/daisy/date-picker/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,qCAAqC,CAAC;AAc7C,MAAM,iBAAiB,GAAG,aAAa,CAAC;AACxC,MAAM,wBAAwB,GAAG,eAAe,CAAC;AACjD,MAAM,iBAAiB,GAAG,YAAY,CAAC;AACvC,MAAM,yBAAyB,GAAG,qBAAqB,CAAC;AACxD,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAChD,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAC9C,MAAM,aAAa,GAAG,OAAO,CAAC;AAE9B,MAAM,aAAa,GAAG,sDAAsD,CAAC;AAC7E,MAAM,cAAc,GAAG,0CAA0C,CAAC;AAClE,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAC5C,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAC/C,MAAM,oBAAoB,GACxB,mQAAmQ,CAAC;AACtQ,MAAM,qBAAqB,GAAG,mCAAmC,CAAC;AAClE,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AACrD,MAAM,kBAAkB,GACtB,mMAAmM,CAAC;AACtM,MAAM,oBAAoB,GACxB,qHAAqH,CAAC;AACxH,MAAM,kBAAkB,GACtB,+LAA+L,CAAC;AAClM,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAC3C,MAAM,uBAAuB,GAAG,mDAAmD,CAAC;AACpF,MAAM,sB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,UAAU,IAAI,IAAI,CAAC,OAAO,IAAI,iBAAiB,EACrD,QAAQ,IAAI,yBAAyB,EACrC,YAAY,CACb,EACD,QAAQ,EAAE,QAAQ,EAElB,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EACvC,IAAI,EAAC,QAAQ,YAEZ,IAAI,CAAC,SAAS,IAJV,IAAI,CAAC,KAAK,CAKR,CACV,CAAC,GACE,IACF,GACF,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LocaleSwitcherProps } from "../../shared/locale.js";
|
|
2
|
+
export type { LocaleOption, LocaleSwitcherProps } from "../../shared/locale.js";
|
|
3
|
+
export declare function DaisyLocaleSwitcher({ value, options, onChange, label, emptyLabel, disabled, className, triggerClassName, menuClassName, optionClassName, triggerIcon, }: LocaleSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/daisy/locale-switcher/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAgB,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAEhF,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAKhF,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,OAAO,EACP,QAAQ,EACR,KAAK,EACL,UAAU,EACV,QAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,WAAW,GACZ,EAAE,mBAAmB,2CAuJrB"}
|