@krizaka/ui 3.0.0 → 3.2.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 +1 -1
- package/dist/achievement.js +1 -1
- package/dist/action-bar.js +1 -1
- package/dist/app-shell.js +1 -1
- package/dist/argument-card.js +2 -2
- package/dist/card-grid.js +1 -1
- package/dist/card.js +1 -1
- package/dist/choice-grid.js +1 -1
- package/dist/{chunk-OGJI5X4W.js → chunk-2PUDI7JS.js} +2 -2
- package/dist/chunk-4LOMIQVX.js +21 -0
- package/dist/chunk-4LOMIQVX.js.map +1 -0
- package/dist/{chunk-K3SWZXYT.js → chunk-DGQMDJXK.js} +2 -2
- package/dist/chunk-G3ETON2A.js +22 -0
- package/dist/chunk-G3ETON2A.js.map +1 -0
- package/dist/chunk-I5RVM5CW.js +27 -0
- package/dist/chunk-I5RVM5CW.js.map +1 -0
- package/dist/chunk-IZ7MV6HM.js +26 -0
- package/dist/chunk-IZ7MV6HM.js.map +1 -0
- package/dist/chunk-ZNMFG62E.js +20 -0
- package/dist/chunk-ZNMFG62E.js.map +1 -0
- package/dist/cn.d.ts +9 -1
- package/dist/cn.js +5 -3
- package/dist/code-block.js +1 -1
- package/dist/command.js +1 -1
- package/dist/confirm-button.js +1 -1
- package/dist/continue-prompt.js +1 -1
- package/dist/cta-panel.js +1 -1
- package/dist/data-table.js +2 -2
- package/dist/date-picker.d.ts +650 -61
- package/dist/date-picker.js +918 -122
- package/dist/date-picker.js.map +1 -1
- package/dist/decision-list.js +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/error-page.js +1 -1
- package/dist/field.js +1 -1
- package/dist/filter-bar.js +2 -2
- package/dist/form/server.d.ts +96 -0
- package/dist/form/server.js +82 -0
- package/dist/form/server.js.map +1 -0
- package/dist/form.d.ts +503 -0
- package/dist/form.js +760 -0
- package/dist/form.js.map +1 -0
- package/dist/gallery-page.js +1 -1
- package/dist/glow-card.js +1 -1
- package/dist/goal-gauge.js +1 -1
- package/dist/how-it-works-page.js +1 -1
- package/dist/landscape.js +1 -1
- package/dist/link-card.js +1 -1
- package/dist/longform-page.js +1 -1
- package/dist/marquee.js +1 -1
- package/dist/mascot-quote.js +1 -1
- package/dist/motion.css +18 -1
- package/dist/native/form.d.ts +376 -0
- package/dist/native/form.js +650 -0
- package/dist/native/form.js.map +1 -0
- package/dist/native.d.ts +351 -3
- package/dist/native.js +1205 -399
- package/dist/native.js.map +1 -1
- package/dist/nav-bar.js +1 -1
- package/dist/page-hero.js +2 -2
- package/dist/page.js +2 -2
- package/dist/popover.js +1 -1
- package/dist/pricing-page.js +1 -1
- package/dist/product-page.js +1 -1
- package/dist/profile-card.js +1 -1
- package/dist/promise-card.js +1 -1
- package/dist/scroll-stage.js +1 -1
- package/dist/stage-banner.js +1 -1
- package/dist/terminal-replay.js +1 -1
- package/dist/toast.js +1 -1
- package/dist/toc.js +1 -1
- package/dist/tooltip.js +1 -1
- package/package.json +50 -7
- package/registry/achievement.json +1 -1
- package/registry/action-bar.json +1 -1
- package/registry/alert.json +1 -1
- package/registry/app-shell.json +1 -1
- package/registry/argument-card.json +1 -1
- package/registry/audio-player.json +1 -1
- package/registry/auth-layout.json +1 -1
- package/registry/avatar.json +1 -1
- package/registry/badge.json +1 -1
- package/registry/button.json +1 -1
- package/registry/card-grid.json +1 -1
- package/registry/card.json +1 -1
- package/registry/catalogue-page.json +1 -1
- package/registry/changelog-page.json +1 -1
- package/registry/checkbox.json +89 -4
- package/registry/chip-link.json +1 -1
- package/registry/chip.json +1 -1
- package/registry/choice-grid.json +1 -1
- package/registry/cn.json +1 -1
- package/registry/code-block.json +1 -1
- package/registry/combobox.json +1 -1
- package/registry/command.json +1 -1
- package/registry/component-page.json +1 -1
- package/registry/confirm-button.json +1 -1
- package/registry/contact-page.json +1 -1
- package/registry/continue-prompt.json +1 -1
- package/registry/countdown.json +1 -1
- package/registry/cta-panel.json +1 -1
- package/registry/dashboard-layout.json +1 -1
- package/registry/data-table.json +1 -1
- package/registry/date-picker.json +1811 -236
- package/registry/decision-list.json +1 -1
- package/registry/detail-layout.json +1 -1
- package/registry/dialog.json +1 -1
- package/registry/docs-article-page.json +1 -1
- package/registry/docs-hub-page.json +1 -1
- package/registry/docs-layout.json +1 -1
- package/registry/dropdown-menu.json +1 -1
- package/registry/empty-state.json +1 -1
- package/registry/error-page.json +1 -1
- package/registry/examples/checkbox/native/terms.d.ts +4 -0
- package/registry/examples/checkbox/native/terms.dark.png +0 -0
- package/registry/examples/checkbox/native/terms.js +26 -0
- package/registry/examples/checkbox/native/terms.light.png +0 -0
- package/registry/examples/checkbox/native/terms.tsx +28 -0
- package/registry/examples/date-picker/birth-date-wheel.d.ts +4 -0
- package/registry/examples/date-picker/birth-date-wheel.js +13 -0
- package/registry/examples/date-picker/birth-date-wheel.tsx +11 -0
- package/registry/examples/date-picker/birth-date.d.ts +4 -0
- package/registry/examples/date-picker/birth-date.js +25 -0
- package/registry/examples/date-picker/birth-date.tsx +21 -0
- package/registry/examples/date-picker/calendar.js +1 -1
- package/registry/examples/date-picker/calendar.tsx +2 -6
- package/registry/examples/date-picker/day-strip.d.ts +4 -0
- package/registry/examples/date-picker/day-strip.js +28 -0
- package/registry/examples/date-picker/day-strip.tsx +27 -0
- package/registry/examples/date-picker/month-year.d.ts +4 -0
- package/registry/examples/date-picker/month-year.js +13 -0
- package/registry/examples/date-picker/month-year.tsx +10 -0
- package/registry/examples/date-picker/native/birth-date-wheel.d.ts +4 -0
- package/registry/examples/date-picker/native/birth-date-wheel.dark.png +0 -0
- package/registry/examples/date-picker/native/birth-date-wheel.js +13 -0
- package/registry/examples/date-picker/native/birth-date-wheel.light.png +0 -0
- package/registry/examples/date-picker/native/birth-date-wheel.tsx +9 -0
- package/registry/examples/date-picker/native/birth-date.d.ts +4 -0
- package/registry/examples/date-picker/native/birth-date.dark.png +0 -0
- package/registry/examples/date-picker/native/birth-date.js +30 -0
- package/registry/examples/date-picker/native/birth-date.light.png +0 -0
- package/registry/examples/date-picker/native/birth-date.tsx +27 -0
- package/registry/examples/date-picker/native/calendar.d.ts +4 -0
- package/registry/examples/date-picker/native/calendar.dark.png +0 -0
- package/registry/examples/date-picker/native/calendar.js +13 -0
- package/registry/examples/date-picker/native/calendar.light.png +0 -0
- package/registry/examples/date-picker/native/calendar.tsx +8 -0
- package/registry/examples/date-picker/native/day-strip.d.ts +4 -0
- package/registry/examples/date-picker/native/day-strip.dark.png +0 -0
- package/registry/examples/date-picker/native/day-strip.js +29 -0
- package/registry/examples/date-picker/native/day-strip.light.png +0 -0
- package/registry/examples/date-picker/native/day-strip.tsx +26 -0
- package/registry/examples/date-picker/native/month-year.d.ts +4 -0
- package/registry/examples/date-picker/native/month-year.dark.png +0 -0
- package/registry/examples/date-picker/native/month-year.js +13 -0
- package/registry/examples/date-picker/native/month-year.light.png +0 -0
- package/registry/examples/date-picker/native/month-year.tsx +8 -0
- package/registry/examples/date-picker/native/time-slots.d.ts +4 -0
- package/registry/examples/date-picker/native/time-slots.dark.png +0 -0
- package/registry/examples/date-picker/native/time-slots.js +15 -0
- package/registry/examples/date-picker/native/time-slots.light.png +0 -0
- package/registry/examples/date-picker/native/time-slots.tsx +15 -0
- package/registry/examples/date-picker/native/time-wheel.d.ts +4 -0
- package/registry/examples/date-picker/native/time-wheel.dark.png +0 -0
- package/registry/examples/date-picker/native/time-wheel.js +13 -0
- package/registry/examples/date-picker/native/time-wheel.light.png +0 -0
- package/registry/examples/date-picker/native/time-wheel.tsx +8 -0
- package/registry/examples/date-picker/time-slots.d.ts +4 -0
- package/registry/examples/date-picker/time-slots.js +26 -0
- package/registry/examples/date-picker/time-slots.tsx +25 -0
- package/registry/examples/date-picker/time-wheel.d.ts +4 -0
- package/registry/examples/date-picker/time-wheel.js +13 -0
- package/registry/examples/date-picker/time-wheel.tsx +10 -0
- package/registry/examples/date-picker/wheel.d.ts +4 -0
- package/registry/examples/date-picker/wheel.js +14 -0
- package/registry/examples/date-picker/wheel.tsx +16 -0
- package/registry/examples/field/native/default.d.ts +4 -0
- package/registry/examples/field/native/default.dark.png +0 -0
- package/registry/examples/field/native/default.js +29 -0
- package/registry/examples/field/native/default.light.png +0 -0
- package/registry/examples/field/native/default.tsx +23 -0
- package/registry/examples/form/amount.d.ts +4 -0
- package/registry/examples/form/amount.js +30 -0
- package/registry/examples/form/amount.tsx +36 -0
- package/registry/examples/form/audience.d.ts +4 -0
- package/registry/examples/form/audience.js +29 -0
- package/registry/examples/form/audience.tsx +31 -0
- package/registry/examples/form/native/amount.d.ts +4 -0
- package/registry/examples/form/native/amount.dark.png +0 -0
- package/registry/examples/form/native/amount.js +26 -0
- package/registry/examples/form/native/amount.light.png +0 -0
- package/registry/examples/form/native/amount.tsx +30 -0
- package/registry/examples/form/native/audience.d.ts +4 -0
- package/registry/examples/form/native/audience.dark.png +0 -0
- package/registry/examples/form/native/audience.js +24 -0
- package/registry/examples/form/native/audience.light.png +0 -0
- package/registry/examples/form/native/audience.tsx +24 -0
- package/registry/examples/form/native/profile.d.ts +4 -0
- package/registry/examples/form/native/profile.dark.png +0 -0
- package/registry/examples/form/native/profile.js +33 -0
- package/registry/examples/form/native/profile.light.png +0 -0
- package/registry/examples/form/native/profile.tsx +36 -0
- package/registry/examples/form/native/settings.d.ts +4 -0
- package/registry/examples/form/native/settings.dark.png +0 -0
- package/registry/examples/form/native/settings.js +25 -0
- package/registry/examples/form/native/settings.light.png +0 -0
- package/registry/examples/form/native/settings.tsx +23 -0
- package/registry/examples/form/native/sign-up.d.ts +4 -0
- package/registry/examples/form/native/sign-up.dark.png +0 -0
- package/registry/examples/form/native/sign-up.js +38 -0
- package/registry/examples/form/native/sign-up.light.png +0 -0
- package/registry/examples/form/native/sign-up.tsx +34 -0
- package/registry/examples/form/native/upload.d.ts +4 -0
- package/registry/examples/form/native/upload.dark.png +0 -0
- package/registry/examples/form/native/upload.js +23 -0
- package/registry/examples/form/native/upload.light.png +0 -0
- package/registry/examples/form/native/upload.tsx +22 -0
- package/registry/examples/form/profile.d.ts +4 -0
- package/registry/examples/form/profile.js +35 -0
- package/registry/examples/form/profile.tsx +40 -0
- package/registry/examples/form/report.d.ts +4 -0
- package/registry/examples/form/report.js +30 -0
- package/registry/examples/form/report.tsx +30 -0
- package/registry/examples/form/settings.d.ts +4 -0
- package/registry/examples/form/settings.js +30 -0
- package/registry/examples/form/settings.tsx +31 -0
- package/registry/examples/form/sign-up.d.ts +4 -0
- package/registry/examples/form/sign-up.js +38 -0
- package/registry/examples/form/sign-up.tsx +37 -0
- package/registry/examples/form/upload.d.ts +4 -0
- package/registry/examples/form/upload.js +32 -0
- package/registry/examples/form/upload.tsx +32 -0
- package/registry/field.json +104 -4
- package/registry/file-upload.json +1 -1
- package/registry/filter-bar.json +1 -1
- package/registry/form.json +2940 -0
- package/registry/gallery-page.json +1 -1
- package/registry/glow-card.json +1 -1
- package/registry/goal-gauge.json +1 -1
- package/registry/how-it-works-page.json +1 -1
- package/registry/image-cropper.json +1 -1
- package/registry/index.json +43 -10
- package/registry/iso.json +1 -1
- package/registry/kbd.json +1 -1
- package/registry/landing-page.json +1 -1
- package/registry/landscape.json +1 -1
- package/registry/legal-page.json +1 -1
- package/registry/link-card.json +1 -1
- package/registry/loader.json +1 -1
- package/registry/longform-page.json +1 -1
- package/registry/marketing-layout.json +1 -1
- package/registry/marquee.json +1 -1
- package/registry/mascot-quote.json +1 -1
- package/registry/mascot-state.json +2 -2
- package/registry/mascots.json +2 -2
- package/registry/media-capture.json +1 -1
- package/registry/meter.json +1 -1
- package/registry/nav-bar.json +1 -1
- package/registry/number-ticker.json +1 -1
- package/registry/page-header.json +1 -1
- package/registry/page-hero.json +1 -1
- package/registry/page.json +1 -1
- package/registry/pagination.json +1 -1
- package/registry/pointer-light.json +1 -1
- package/registry/popover.json +1 -1
- package/registry/pricing-page.json +1 -1
- package/registry/product-page.json +1 -1
- package/registry/profile-card.json +1 -1
- package/registry/progress.json +1 -1
- package/registry/promise-card.json +1 -1
- package/registry/radio-group.json +1 -1
- package/registry/scroll-stage.json +1 -1
- package/registry/search-field.json +1 -1
- package/registry/section-backdrop.json +1 -1
- package/registry/separator.json +1 -1
- package/registry/settings-layout.json +1 -1
- package/registry/skeleton.json +1 -1
- package/registry/slider.json +1 -1
- package/registry/slot.json +1 -1
- package/registry/spinner.json +1 -1
- package/registry/split-view.json +1 -1
- package/registry/stage-banner.json +1 -1
- package/registry/stat.json +1 -1
- package/registry/status-page.json +1 -1
- package/registry/stepper.json +1 -1
- package/registry/switch.json +1 -1
- package/registry/tabs.json +1 -1
- package/registry/tag-input.json +1 -1
- package/registry/terminal-replay.json +1 -1
- package/registry/theme.json +8 -1
- package/registry/toast.json +1 -1
- package/registry/toc.json +1 -1
- package/registry/tooltip.json +1 -1
- package/registry/video-player.json +1 -1
- package/registry/video-trimmer.json +1 -1
- package/registry/virtual.json +1 -1
- package/skills/date-picker/SKILL.md +43 -0
- package/skills/form/SKILL.md +44 -0
- package/dist/chunk-2USC2YT6.js +0 -17
- package/dist/chunk-2USC2YT6.js.map +0 -1
- package/dist/chunk-5AXLA4LK.js +0 -13
- package/dist/chunk-5AXLA4LK.js.map +0 -1
- package/dist/chunk-FJDSLNXK.js +0 -11
- package/dist/chunk-FJDSLNXK.js.map +0 -1
- package/dist/chunk-KNBYZGSQ.js +0 -11
- package/dist/chunk-KNBYZGSQ.js.map +0 -1
- package/dist/chunk-VCAAHCHL.js +0 -17
- package/dist/chunk-VCAAHCHL.js.map +0 -1
- /package/dist/{chunk-OGJI5X4W.js.map → chunk-2PUDI7JS.js.map} +0 -0
- /package/dist/{chunk-K3SWZXYT.js.map → chunk-DGQMDJXK.js.map} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { DateField, isRealDate, latestBirthDate } from "@krizaka/ui/date-picker";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
// A date of birth typed as day, month and year (the browser can fill it); an under-18 date is refused at once.
|
|
7
|
+
export default function DatePickerBirthDate() {
|
|
8
|
+
const [birth, setBirth] = React.useState("2015-03-27");
|
|
9
|
+
const minor = isRealDate(birth) && birth > latestBirthDate(18);
|
|
10
|
+
return (
|
|
11
|
+
<DateField
|
|
12
|
+
label="Date of birth"
|
|
13
|
+
locale="en-GB"
|
|
14
|
+
autoComplete="bday"
|
|
15
|
+
value={birth}
|
|
16
|
+
onValueChange={setBirth}
|
|
17
|
+
hint="Private, never shown. For example, 27 3 1990."
|
|
18
|
+
error={minor ? "You must be 18 or older to create an account." : undefined}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -7,7 +7,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
var weekend = (iso) => [0, 6].includes((/* @__PURE__ */ new Date(`${iso}T12:00:00`)).getDay());
|
|
8
8
|
function DatePickerCalendar() {
|
|
9
9
|
const [day, setDay] = React.useState("2026-10-15");
|
|
10
|
-
return /* @__PURE__ */ jsx(
|
|
10
|
+
return /* @__PURE__ */ jsx(Calendar, { variant: "card", locale: "en-GB", value: day, onSelect: setDay, isDateDisabled: weekend, min: "2026-10-12", today: "2026-10-11" });
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
13
13
|
DatePickerCalendar as default
|
|
@@ -5,12 +5,8 @@ import * as React from "react";
|
|
|
5
5
|
|
|
6
6
|
const weekend = (iso: string) => [0, 6].includes(new Date(`${iso}T12:00:00`).getDay());
|
|
7
7
|
|
|
8
|
-
// The month is the interface:
|
|
8
|
+
// The month is the interface: a card of its own, weekends unavailable, today marked by the node.
|
|
9
9
|
export default function DatePickerCalendar() {
|
|
10
10
|
const [day, setDay] = React.useState("2026-10-15");
|
|
11
|
-
return
|
|
12
|
-
<div className="inline-block rounded-xl border border-border-default bg-surface-1 p-3">
|
|
13
|
-
<Calendar locale="en-GB" value={day} onSelect={setDay} isDateDisabled={weekend} min="2026-10-12" today="2026-10-11" />
|
|
14
|
-
</div>
|
|
15
|
-
);
|
|
11
|
+
return <Calendar variant="card" locale="en-GB" value={day} onSelect={setDay} isDateDisabled={weekend} min="2026-10-12" today="2026-10-11" />;
|
|
16
12
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/date-picker/day-strip.tsx
|
|
4
|
+
import { DayStrip } from "@krizaka/ui/date-picker";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var closed = (iso) => (/* @__PURE__ */ new Date(`${iso}T12:00:00`)).getDay() === 0;
|
|
8
|
+
var sessions = /* @__PURE__ */ new Set(["2026-10-14", "2026-10-17", "2026-10-21"]);
|
|
9
|
+
function DatePickerDayStrip() {
|
|
10
|
+
const [day, setDay] = React.useState("2026-10-14");
|
|
11
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full max-w-md", children: /* @__PURE__ */ jsx(
|
|
12
|
+
DayStrip,
|
|
13
|
+
{
|
|
14
|
+
label: "Session day",
|
|
15
|
+
locale: "en-US",
|
|
16
|
+
value: day,
|
|
17
|
+
onValueChange: setDay,
|
|
18
|
+
start: "2026-10-11",
|
|
19
|
+
today: "2026-10-11",
|
|
20
|
+
isDateDisabled: closed,
|
|
21
|
+
isDateMarked: (d) => sessions.has(d),
|
|
22
|
+
labels: { marked: "has a session" }
|
|
23
|
+
}
|
|
24
|
+
) });
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
DatePickerDayStrip as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { DayStrip } from "@krizaka/ui/date-picker";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
const closed = (iso: string) => new Date(`${iso}T12:00:00`).getDay() === 0;
|
|
7
|
+
const sessions = new Set(["2026-10-14", "2026-10-17", "2026-10-21"]);
|
|
8
|
+
|
|
9
|
+
// The next two weeks in a row: Sundays closed, the days with a session marked.
|
|
10
|
+
export default function DatePickerDayStrip() {
|
|
11
|
+
const [day, setDay] = React.useState<string | null>("2026-10-14");
|
|
12
|
+
return (
|
|
13
|
+
<div className="w-full max-w-md">
|
|
14
|
+
<DayStrip
|
|
15
|
+
label="Session day"
|
|
16
|
+
locale="en-US"
|
|
17
|
+
value={day}
|
|
18
|
+
onValueChange={setDay}
|
|
19
|
+
start="2026-10-11"
|
|
20
|
+
today="2026-10-11"
|
|
21
|
+
isDateDisabled={closed}
|
|
22
|
+
isDateMarked={(d) => sessions.has(d)}
|
|
23
|
+
labels={{ marked: "has a session" }}
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/date-picker/month-year.tsx
|
|
4
|
+
import { MonthPicker } from "@krizaka/ui/date-picker";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function DatePickerMonthYear() {
|
|
8
|
+
const [month, setMonth] = React.useState("2026-09");
|
|
9
|
+
return /* @__PURE__ */ jsx(MonthPicker, { variant: "card", locale: "en-US", value: month, onValueChange: setMonth, max: "2026-10", current: "2026-10" });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
DatePickerMonthYear as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { MonthPicker } from "@krizaka/ui/date-picker";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
// A billing month: twelve months at a glance, the year above them, nothing later than this month.
|
|
7
|
+
export default function DatePickerMonthYear() {
|
|
8
|
+
const [month, setMonth] = React.useState<string | null>("2026-09");
|
|
9
|
+
return <MonthPicker variant="card" locale="en-US" value={month} onValueChange={setMonth} max="2026-10" current="2026-10" />;
|
|
10
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/date-picker/native/birth-date-wheel.tsx
|
|
4
|
+
import { DateWheel } from "@krizaka/ui/native";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function NativeDatePickerBirthDateWheel() {
|
|
8
|
+
const [birth, setBirth] = React.useState("1994-06-18");
|
|
9
|
+
return /* @__PURE__ */ jsx(DateWheel, { label: "Date of birth", locale: "en-US", value: birth, onValueChange: setBirth, max: "2008-10-11", hint: "You must be 18 or older." });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
NativeDatePickerBirthDateWheel as default
|
|
13
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DateWheel } from "@krizaka/ui/native";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
// The wheels of a date of birth in the locale's order, ending at the 18th birthday; each value passed ticks under the
|
|
5
|
+
// thumb (the app's `haptics`). `max` is fixed here for the documentation; in an app, `max={latestBirthDate(18)}`.
|
|
6
|
+
export default function NativeDatePickerBirthDateWheel() {
|
|
7
|
+
const [birth, setBirth] = React.useState<string | null>("1994-06-18");
|
|
8
|
+
return <DateWheel label="Date of birth" locale="en-US" value={birth} onValueChange={setBirth} max="2008-10-11" hint="You must be 18 or older." />;
|
|
9
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/date-picker/native/birth-date.tsx
|
|
4
|
+
import { DateField } from "@krizaka/ui/native";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { View } from "react-native";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var latestAdult = () => {
|
|
9
|
+
const today = /* @__PURE__ */ new Date();
|
|
10
|
+
return new Date(Date.UTC(today.getFullYear() - 18, today.getMonth(), today.getDate())).toISOString().slice(0, 10);
|
|
11
|
+
};
|
|
12
|
+
function NativeDateFieldBirthDate() {
|
|
13
|
+
const [birth, setBirth] = React.useState("2015-03-27");
|
|
14
|
+
const minor = /^\d{4}-\d{2}-\d{2}$/.test(birth) && birth > latestAdult();
|
|
15
|
+
return /* @__PURE__ */ jsx(View, { style: { width: 296 }, children: /* @__PURE__ */ jsx(
|
|
16
|
+
DateField,
|
|
17
|
+
{
|
|
18
|
+
label: "Date of birth",
|
|
19
|
+
locale: "en-GB",
|
|
20
|
+
autoComplete: "bday",
|
|
21
|
+
value: birth,
|
|
22
|
+
onValueChange: setBirth,
|
|
23
|
+
hint: "Private, never shown. For example, 27 3 1990.",
|
|
24
|
+
error: minor ? "You must be 18 or older to create an account." : void 0
|
|
25
|
+
}
|
|
26
|
+
) });
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
NativeDateFieldBirthDate as default
|
|
30
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DateField } from "@krizaka/ui/native";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
|
|
5
|
+
const latestAdult = () => {
|
|
6
|
+
const today = new Date();
|
|
7
|
+
return new Date(Date.UTC(today.getFullYear() - 18, today.getMonth(), today.getDate())).toISOString().slice(0, 10);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// A date of birth typed as day, month and year, in the locale's order; an under-18 date is refused at once.
|
|
11
|
+
export default function NativeDateFieldBirthDate() {
|
|
12
|
+
const [birth, setBirth] = React.useState("2015-03-27");
|
|
13
|
+
const minor = /^\d{4}-\d{2}-\d{2}$/.test(birth) && birth > latestAdult();
|
|
14
|
+
return (
|
|
15
|
+
<View style={{ width: 296 }}>
|
|
16
|
+
<DateField
|
|
17
|
+
label="Date of birth"
|
|
18
|
+
locale="en-GB"
|
|
19
|
+
autoComplete="bday"
|
|
20
|
+
value={birth}
|
|
21
|
+
onValueChange={setBirth}
|
|
22
|
+
hint="Private, never shown. For example, 27 3 1990."
|
|
23
|
+
error={minor ? "You must be 18 or older to create an account." : undefined}
|
|
24
|
+
/>
|
|
25
|
+
</View>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/date-picker/native/calendar.tsx
|
|
4
|
+
import { Calendar } from "@krizaka/ui/native";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function NativeDatePickerCalendar() {
|
|
8
|
+
const [day, setDay] = React.useState("2026-10-15");
|
|
9
|
+
return /* @__PURE__ */ jsx(Calendar, { locale: "en-US", value: day, onSelect: setDay, min: "2026-10-11", today: "2026-10-11" });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
NativeDatePickerCalendar as default
|
|
13
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Calendar } from "@krizaka/ui/native";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
// A month to book a day: 44-pt days, today's node, the past unavailable.
|
|
5
|
+
export default function NativeDatePickerCalendar() {
|
|
6
|
+
const [day, setDay] = React.useState("2026-10-15");
|
|
7
|
+
return <Calendar locale="en-US" value={day} onSelect={setDay} min="2026-10-11" today="2026-10-11" />;
|
|
8
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/date-picker/native/day-strip.tsx
|
|
4
|
+
import { DayStrip } from "@krizaka/ui/native";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { View } from "react-native";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var sessions = /* @__PURE__ */ new Set(["2026-10-14", "2026-10-17"]);
|
|
9
|
+
function NativeDatePickerDayStrip() {
|
|
10
|
+
const [day, setDay] = React.useState("2026-10-14");
|
|
11
|
+
return /* @__PURE__ */ jsx(View, { style: { width: 320 }, children: /* @__PURE__ */ jsx(
|
|
12
|
+
DayStrip,
|
|
13
|
+
{
|
|
14
|
+
label: "Session day",
|
|
15
|
+
locale: "en-US",
|
|
16
|
+
value: day,
|
|
17
|
+
onValueChange: setDay,
|
|
18
|
+
start: "2026-10-11",
|
|
19
|
+
today: "2026-10-11",
|
|
20
|
+
days: 10,
|
|
21
|
+
isDateDisabled: (d) => (/* @__PURE__ */ new Date(`${d}T12:00:00`)).getDay() === 0,
|
|
22
|
+
isDateMarked: (d) => sessions.has(d),
|
|
23
|
+
markedLabel: "has a session"
|
|
24
|
+
}
|
|
25
|
+
) });
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
NativeDatePickerDayStrip as default
|
|
29
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DayStrip } from "@krizaka/ui/native";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
|
|
5
|
+
const sessions = new Set(["2026-10-14", "2026-10-17"]);
|
|
6
|
+
|
|
7
|
+
// The days ahead, swiped sideways: Sundays closed, the days with a session marked.
|
|
8
|
+
export default function NativeDatePickerDayStrip() {
|
|
9
|
+
const [day, setDay] = React.useState<string | null>("2026-10-14");
|
|
10
|
+
return (
|
|
11
|
+
<View style={{ width: 320 }}>
|
|
12
|
+
<DayStrip
|
|
13
|
+
label="Session day"
|
|
14
|
+
locale="en-US"
|
|
15
|
+
value={day}
|
|
16
|
+
onValueChange={setDay}
|
|
17
|
+
start="2026-10-11"
|
|
18
|
+
today="2026-10-11"
|
|
19
|
+
days={10}
|
|
20
|
+
isDateDisabled={(d) => new Date(`${d}T12:00:00`).getDay() === 0}
|
|
21
|
+
isDateMarked={(d) => sessions.has(d)}
|
|
22
|
+
markedLabel="has a session"
|
|
23
|
+
/>
|
|
24
|
+
</View>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/date-picker/native/month-year.tsx
|
|
4
|
+
import { MonthPicker } from "@krizaka/ui/native";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function NativeDatePickerMonthYear() {
|
|
8
|
+
const [month, setMonth] = React.useState("2026-09");
|
|
9
|
+
return /* @__PURE__ */ jsx(MonthPicker, { locale: "en-US", value: month, onValueChange: setMonth, max: "2026-10" });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
NativeDatePickerMonthYear as default
|
|
13
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MonthPicker } from "@krizaka/ui/native";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
// A billing month: the twelve months of the year, nothing later than this month.
|
|
5
|
+
export default function NativeDatePickerMonthYear() {
|
|
6
|
+
const [month, setMonth] = React.useState<string | null>("2026-09");
|
|
7
|
+
return <MonthPicker locale="en-US" value={month} onValueChange={setMonth} max="2026-10" />;
|
|
8
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/date-picker/native/time-slots.tsx
|
|
4
|
+
import { TimePicker, timeSlots } from "@krizaka/ui/native";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { View } from "react-native";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var taken = /* @__PURE__ */ new Set(["10:00", "11:30"]);
|
|
9
|
+
function NativeDatePickerTimeSlots() {
|
|
10
|
+
const [time, setTime] = React.useState("10:30");
|
|
11
|
+
return /* @__PURE__ */ jsx(View, { style: { width: 320 }, children: /* @__PURE__ */ jsx(TimePicker, { variant: "slots", label: "Appointment time", locale: "en-US", slots: timeSlots("09:00", "12:00", 30), isTimeDisabled: (t) => taken.has(t), value: time, onValueChange: setTime }) });
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
NativeDatePickerTimeSlots as default
|
|
15
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TimePicker, timeSlots } from "@krizaka/ui/native";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
|
|
5
|
+
const taken = new Set(["10:00", "11:30"]);
|
|
6
|
+
|
|
7
|
+
// The free times of an agenda as buttons; taken ones dashed and struck through.
|
|
8
|
+
export default function NativeDatePickerTimeSlots() {
|
|
9
|
+
const [time, setTime] = React.useState<string | null>("10:30");
|
|
10
|
+
return (
|
|
11
|
+
<View style={{ width: 320 }}>
|
|
12
|
+
<TimePicker variant="slots" label="Appointment time" locale="en-US" slots={timeSlots("09:00", "12:00", 30)} isTimeDisabled={(t) => taken.has(t)} value={time} onValueChange={setTime} />
|
|
13
|
+
</View>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/date-picker/native/time-wheel.tsx
|
|
4
|
+
import { TimePicker } from "@krizaka/ui/native";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function NativeDatePickerTimeWheel() {
|
|
8
|
+
const [time, setTime] = React.useState("19:30");
|
|
9
|
+
return /* @__PURE__ */ jsx(TimePicker, { label: "Remind me at", locale: "en-US", value: time, onValueChange: setTime });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
NativeDatePickerTimeWheel as default
|
|
13
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TimePicker } from "@krizaka/ui/native";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
// A reminder set by the thumb: hours, minutes by 5, the period of a 12-hour locale. The value is "HH:mm".
|
|
5
|
+
export default function NativeDatePickerTimeWheel() {
|
|
6
|
+
const [time, setTime] = React.useState<string | null>("19:30");
|
|
7
|
+
return <TimePicker label="Remind me at" locale="en-US" value={time} onValueChange={setTime} />;
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/date-picker/time-slots.tsx
|
|
4
|
+
import { TimePicker, timeSlots } from "@krizaka/ui/date-picker";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var taken = /* @__PURE__ */ new Set(["10:00", "13:30", "14:00"]);
|
|
8
|
+
function DatePickerTimeSlots() {
|
|
9
|
+
const [time, setTime] = React.useState("11:00");
|
|
10
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full max-w-md", children: /* @__PURE__ */ jsx(
|
|
11
|
+
TimePicker,
|
|
12
|
+
{
|
|
13
|
+
variant: "slots",
|
|
14
|
+
label: "Appointment time",
|
|
15
|
+
locale: "en-US",
|
|
16
|
+
slots: timeSlots("09:00", "17:00", 30),
|
|
17
|
+
isTimeDisabled: (t) => taken.has(t),
|
|
18
|
+
groupLabels: { morning: "Morning", afternoon: "Afternoon", evening: "Evening" },
|
|
19
|
+
value: time,
|
|
20
|
+
onValueChange: setTime
|
|
21
|
+
}
|
|
22
|
+
) });
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
DatePickerTimeSlots as default
|
|
26
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { TimePicker, timeSlots } from "@krizaka/ui/date-picker";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
const taken = new Set(["10:00", "13:30", "14:00"]);
|
|
7
|
+
|
|
8
|
+
// The free times of an agenda, by part of the day; taken slots are struck through and skipped by the arrows.
|
|
9
|
+
export default function DatePickerTimeSlots() {
|
|
10
|
+
const [time, setTime] = React.useState<string | null>("11:00");
|
|
11
|
+
return (
|
|
12
|
+
<div className="w-full max-w-md">
|
|
13
|
+
<TimePicker
|
|
14
|
+
variant="slots"
|
|
15
|
+
label="Appointment time"
|
|
16
|
+
locale="en-US"
|
|
17
|
+
slots={timeSlots("09:00", "17:00", 30)}
|
|
18
|
+
isTimeDisabled={(t) => taken.has(t)}
|
|
19
|
+
groupLabels={{ morning: "Morning", afternoon: "Afternoon", evening: "Evening" }}
|
|
20
|
+
value={time}
|
|
21
|
+
onValueChange={setTime}
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/date-picker/time-wheel.tsx
|
|
4
|
+
import { TimePicker } from "@krizaka/ui/date-picker";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function DatePickerTimeWheel() {
|
|
8
|
+
const [time, setTime] = React.useState("19:30");
|
|
9
|
+
return /* @__PURE__ */ jsx(TimePicker, { label: "Remind me at", locale: "en-US", value: time, onValueChange: setTime, minuteStep: 5 });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
DatePickerTimeWheel as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { TimePicker } from "@krizaka/ui/date-picker";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
// A reminder set by the thumb: hours, minutes by 5 and the period, as the locale writes them. The value is "HH:mm".
|
|
7
|
+
export default function DatePickerTimeWheel() {
|
|
8
|
+
const [time, setTime] = React.useState<string | null>("19:30");
|
|
9
|
+
return <TimePicker label="Remind me at" locale="en-US" value={time} onValueChange={setTime} minuteStep={5} />;
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/date-picker/wheel.tsx
|
|
4
|
+
import { Wheel, WheelPicker } from "@krizaka/ui/date-picker";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var sizes = Array.from({ length: 12 }, (_, i) => ({ value: String(i + 1), label: i === 0 ? "1 guest" : `${i + 1} guests` }));
|
|
8
|
+
function DatePickerWheel() {
|
|
9
|
+
const [size, setSize] = React.useState("4");
|
|
10
|
+
return /* @__PURE__ */ jsx(WheelPicker, { label: "Party size", children: /* @__PURE__ */ jsx(Wheel, { label: "Guests", options: sizes, value: size, onValueChange: setSize, className: "w-36" }) });
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
DatePickerWheel as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Wheel, WheelPicker } from "@krizaka/ui/date-picker";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
const sizes = Array.from({ length: 12 }, (_, i) => ({ value: String(i + 1), label: i === 0 ? "1 guest" : `${i + 1} guests` }));
|
|
7
|
+
|
|
8
|
+
// Any short list turned by the thumb: a party size. The keyboard moves it too (↑ ↓, Page Up / Down, Home / End).
|
|
9
|
+
export default function DatePickerWheel() {
|
|
10
|
+
const [size, setSize] = React.useState("4");
|
|
11
|
+
return (
|
|
12
|
+
<WheelPicker label="Party size">
|
|
13
|
+
<Wheel label="Guests" options={sizes} value={size} onValueChange={setSize} className="w-36" />
|
|
14
|
+
</WheelPicker>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
Binary file
|