ionbase-ui 0.59.0 → 0.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AgentActivity.d.ts +2 -1
- package/dist/components/AgentActivity.d.ts.map +1 -1
- package/dist/components/AgentActivity.js +4 -17
- package/dist/components/AgentActivity.js.map +1 -1
- package/dist/components/Calendar.d.ts +20 -0
- package/dist/components/Calendar.d.ts.map +1 -0
- package/dist/components/Calendar.js +151 -0
- package/dist/components/Calendar.js.map +1 -0
- package/dist/components/CalendarPopover.d.ts +26 -0
- package/dist/components/CalendarPopover.d.ts.map +1 -0
- package/dist/components/CalendarPopover.js +45 -0
- package/dist/components/CalendarPopover.js.map +1 -0
- package/dist/components/DateField.d.ts +15 -0
- package/dist/components/DateField.d.ts.map +1 -0
- package/dist/components/DateField.js +74 -0
- package/dist/components/DateField.js.map +1 -0
- package/dist/components/DatePicker.d.ts +81 -0
- package/dist/components/DatePicker.d.ts.map +1 -0
- package/dist/components/DatePicker.js +102 -0
- package/dist/components/DatePicker.js.map +1 -0
- package/dist/components/DateRangePicker.d.ts +117 -0
- package/dist/components/DateRangePicker.d.ts.map +1 -0
- package/dist/components/DateRangePicker.js +152 -0
- package/dist/components/DateRangePicker.js.map +1 -0
- package/dist/components/Header.d.ts +10 -0
- package/dist/components/Header.d.ts.map +1 -1
- package/dist/components/Header.js +18 -3
- package/dist/components/Header.js.map +1 -1
- package/dist/components/NumberInput.d.ts +63 -0
- package/dist/components/NumberInput.d.ts.map +1 -0
- package/dist/components/NumberInput.js +102 -0
- package/dist/components/NumberInput.js.map +1 -0
- package/dist/components/PromptInput.d.ts +89 -0
- package/dist/components/PromptInput.d.ts.map +1 -0
- package/dist/components/PromptInput.js +130 -0
- package/dist/components/PromptInput.js.map +1 -0
- package/dist/components/SegmentedControl.d.ts +63 -0
- package/dist/components/SegmentedControl.d.ts.map +1 -0
- package/dist/components/SegmentedControl.js +79 -0
- package/dist/components/SegmentedControl.js.map +1 -0
- package/dist/components/Sidebar.d.ts +109 -0
- package/dist/components/Sidebar.d.ts.map +1 -0
- package/dist/components/Sidebar.js +106 -0
- package/dist/components/Sidebar.js.map +1 -0
- package/dist/components/Stepper.d.ts +73 -0
- package/dist/components/Stepper.d.ts.map +1 -0
- package/dist/components/Stepper.js +82 -0
- package/dist/components/Stepper.js.map +1 -0
- package/dist/components/ToolCall.d.ts +66 -0
- package/dist/components/ToolCall.d.ts.map +1 -0
- package/dist/components/ToolCall.js +78 -0
- package/dist/components/ToolCall.js.map +1 -0
- package/dist/components/agent-status.d.ts +14 -0
- package/dist/components/agent-status.d.ts.map +1 -0
- package/dist/components/agent-status.js +16 -0
- package/dist/components/agent-status.js.map +1 -0
- package/dist/components/index.d.ts +17 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +8 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/iso-date.d.ts +53 -0
- package/dist/components/iso-date.d.ts.map +1 -0
- package/dist/components/iso-date.js +102 -0
- package/dist/components/iso-date.js.map +1 -0
- package/dist/figma-descriptions.json +107 -52
- package/dist/figma-map.json +735 -2
- package/dist/meta/AgentActivityStep.json +2 -2
- package/dist/meta/DatePicker.json +270 -0
- package/dist/meta/DateRangePicker.json +284 -0
- package/dist/meta/Header.json +32 -2
- package/dist/meta/NumberInput.json +407 -0
- package/dist/meta/PromptInput.json +212 -0
- package/dist/meta/SegmentedControl.json +217 -0
- package/dist/meta/SegmentedControlItem.json +122 -0
- package/dist/meta/Sidebar.json +150 -0
- package/dist/meta/SidebarItem.json +184 -0
- package/dist/meta/SidebarSection.json +131 -0
- package/dist/meta/Stepper.json +135 -0
- package/dist/meta/StepperStep.json +148 -0
- package/dist/meta/Tabs.json +5 -0
- package/dist/meta/ToolCall.json +192 -0
- package/dist/meta/components.json +5784 -3297
- package/dist/meta/contrast.json +7776 -2478
- package/dist/meta/index.json +139 -2
- package/dist/meta/patterns/AgentRun.json +27 -0
- package/dist/meta/patterns/Form.json +9 -0
- package/dist/meta/patterns/PageShell.json +43 -3
- package/dist/meta/patterns/Wizard.json +20 -1
- package/dist/meta/patterns/index.json +10 -1
- package/dist/styles/date-picker.css +420 -0
- package/dist/styles/date-range-picker.css +280 -0
- package/dist/styles/header.css +26 -0
- package/dist/styles/index.css +15 -0
- package/dist/styles/number-input.css +83 -0
- package/dist/styles/prompt-input.css +127 -0
- package/dist/styles/segmented-control.css +182 -0
- package/dist/styles/sidebar.css +307 -0
- package/dist/styles/stepper.css +250 -0
- package/dist/styles/tool-call.css +202 -0
- package/llms.txt +2 -2
- package/package.json +20 -19
- package/LICENSE +0 -21
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
import type { DateValue } from '@internationalized/date';
|
|
3
|
+
/**
|
|
4
|
+
* A calendar date as `YYYY-MM-DD` — no time, no timezone, no offset.
|
|
5
|
+
*
|
|
6
|
+
* This is an alias for `string`, so it documents rather than enforces. The
|
|
7
|
+
* runtime enforcement is in `toCalendarDate`, which throws on a malformed
|
|
8
|
+
* value instead of silently rendering an empty field.
|
|
9
|
+
*/
|
|
10
|
+
export type IsoDate = string;
|
|
11
|
+
/**
|
|
12
|
+
* ISO string in, `CalendarDate` out. Throws on anything else.
|
|
13
|
+
*
|
|
14
|
+
* THROWING IS THE POINT. The tempting alternative is to return `null` for an
|
|
15
|
+
* unparseable value, and the first version did. A caller who passed a
|
|
16
|
+
* `Date`, a timestamp or `'04/12/2026'` then got a date picker that rendered
|
|
17
|
+
* perfectly with nothing in it, and no indication anywhere that the value it
|
|
18
|
+
* was handed had been dropped on the floor. An exception names the prop and the
|
|
19
|
+
* value, which is the difference between a five-second fix and an afternoon.
|
|
20
|
+
*
|
|
21
|
+
* `parseDate` is also stricter than it looks: it rejects `2026-02-30` and
|
|
22
|
+
* `2026-13-01`, so a date that is well-formed but does not exist fails here
|
|
23
|
+
* too rather than being quietly rounded into a neighbouring month.
|
|
24
|
+
*/
|
|
25
|
+
export declare function toCalendarDate(value: IsoDate | null | undefined, prop: string): CalendarDate | null;
|
|
26
|
+
/**
|
|
27
|
+
* `CalendarDate` out, ISO string back.
|
|
28
|
+
*
|
|
29
|
+
* `toString()` is NOT used, and this is not a stylistic preference. A value
|
|
30
|
+
* that came from a non-Gregorian calendar stringifies WITH its calendar
|
|
31
|
+
* annotation — `2569-05-30[u-ca-buddhist]` — which is a correct ISO 8601-2
|
|
32
|
+
* string and is not what any caller expecting `YYYY-MM-DD` will do anything
|
|
33
|
+
* sensible with. Building the string from the parts of the Gregorian
|
|
34
|
+
* projection is what keeps the wire format one shape in every locale.
|
|
35
|
+
*
|
|
36
|
+
* The projection to Gregorian happens here rather than being assumed. In
|
|
37
|
+
* practice react-aria hands back the calendar it was given — `useCalendarState`
|
|
38
|
+
* converts through `toCalendar` on the way out — so a Gregorian value in is a
|
|
39
|
+
* Gregorian value out, and this is a no-op. It is written anyway because the
|
|
40
|
+
* one path where it is NOT a no-op is an unavailable-date predicate being
|
|
41
|
+
* offered a cell from the DISPLAY calendar, which is the reader's, not ours.
|
|
42
|
+
*/
|
|
43
|
+
export declare function toIso(date: DateValue): IsoDate;
|
|
44
|
+
/**
|
|
45
|
+
* Wraps an `isDateUnavailable` predicate so the caller receives an ISO string
|
|
46
|
+
* rather than a `CalendarDate`.
|
|
47
|
+
*
|
|
48
|
+
* Returned as `undefined` when there is no predicate, rather than as a function
|
|
49
|
+
* that always returns false. react-aria checks for the prop's presence in more
|
|
50
|
+
* than one place, and a no-op function is present.
|
|
51
|
+
*/
|
|
52
|
+
export declare function wrapUnavailable(fn: ((date: IsoDate) => boolean) | undefined): ((date: DateValue) => boolean) | undefined;
|
|
53
|
+
//# sourceMappingURL=iso-date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iso-date.d.ts","sourceRoot":"","sources":["../../src/components/iso-date.ts"],"names":[],"mappings":"AAmCA,OAAO,EACL,YAAY,EAIb,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAK7B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,EACjC,IAAI,EAAE,MAAM,GACX,YAAY,GAAG,IAAI,CAerB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAO9C;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,SAAS,GAC3C,CAAC,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,GAAG,SAAS,CAG5C"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The ISO boundary. Every conversion between the public API and react-aria's
|
|
3
|
+
* date objects happens here and nowhere else.
|
|
4
|
+
*
|
|
5
|
+
* WHY THE PUBLIC API IS A STRING AND NOT A `CalendarDate`
|
|
6
|
+
*
|
|
7
|
+
* react-aria's date hooks speak `@internationalized/date`. Exposing that type
|
|
8
|
+
* on the props would make it a peer dependency: every consumer would have to
|
|
9
|
+
* install the package and write `parseDate('2026-04-12')` to pass a literal
|
|
10
|
+
* date. That is a real cost for a real benefit — non-Gregorian calendar systems
|
|
11
|
+
* survive the round trip untouched — and the benefit is not the one this system
|
|
12
|
+
* is optimising for.
|
|
13
|
+
*
|
|
14
|
+
* IonBase is written on the premise that the caller is an agent with no
|
|
15
|
+
* developer reviewing the output. An agent can write `value="2026-04-12"` and
|
|
16
|
+
* be right; it cannot forget to install a package it was never told about, or
|
|
17
|
+
* pass a `Date` where a `CalendarDate` was wanted and get a type error it has
|
|
18
|
+
* no way to act on. `@internationalized/date` stays a dependency of this
|
|
19
|
+
* package, imported here, and never appears in a consumer's import list.
|
|
20
|
+
*
|
|
21
|
+
* WHAT IS GIVEN UP, STATED PLAINLY
|
|
22
|
+
*
|
|
23
|
+
* The VALUE is always a Gregorian ISO calendar date. The DISPLAY is not — the
|
|
24
|
+
* field and the grid are rendered in the user's locale and calendar system via
|
|
25
|
+
* `createCalendar`, so a Hijri or Buddhist reader sees their own calendar and
|
|
26
|
+
* the value still comes back as `YYYY-MM-DD`. That is the same split the HTML
|
|
27
|
+
* `<input type="date">` makes, and it is the one almost every backend wants.
|
|
28
|
+
*
|
|
29
|
+
* WHAT THIS IS NOT
|
|
30
|
+
*
|
|
31
|
+
* Not a `Date`. `new Date('2026-04-12')` parses as UTC midnight and then prints
|
|
32
|
+
* as the 11th for anyone west of Greenwich — the single most common date bug
|
|
33
|
+
* there is. A calendar date has no time and no zone, so it cannot have that
|
|
34
|
+
* bug, and keeping the string as the wire format is what preserves that.
|
|
35
|
+
*/
|
|
36
|
+
import { CalendarDate, GregorianCalendar, parseDate, toCalendar, } from '@internationalized/date';
|
|
37
|
+
/** Matches exactly `YYYY-MM-DD`. Deliberately not a full ISO 8601 parse. */
|
|
38
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
39
|
+
/**
|
|
40
|
+
* ISO string in, `CalendarDate` out. Throws on anything else.
|
|
41
|
+
*
|
|
42
|
+
* THROWING IS THE POINT. The tempting alternative is to return `null` for an
|
|
43
|
+
* unparseable value, and the first version did. A caller who passed a
|
|
44
|
+
* `Date`, a timestamp or `'04/12/2026'` then got a date picker that rendered
|
|
45
|
+
* perfectly with nothing in it, and no indication anywhere that the value it
|
|
46
|
+
* was handed had been dropped on the floor. An exception names the prop and the
|
|
47
|
+
* value, which is the difference between a five-second fix and an afternoon.
|
|
48
|
+
*
|
|
49
|
+
* `parseDate` is also stricter than it looks: it rejects `2026-02-30` and
|
|
50
|
+
* `2026-13-01`, so a date that is well-formed but does not exist fails here
|
|
51
|
+
* too rather than being quietly rounded into a neighbouring month.
|
|
52
|
+
*/
|
|
53
|
+
export function toCalendarDate(value, prop) {
|
|
54
|
+
if (value == null || value === '')
|
|
55
|
+
return null;
|
|
56
|
+
if (typeof value !== 'string' || !ISO_DATE.test(value)) {
|
|
57
|
+
throw new TypeError(`${prop}: expected a YYYY-MM-DD string, received ${JSON.stringify(value)}. ` +
|
|
58
|
+
`Date pickers in ionbase-ui take ISO calendar dates, not Date objects or timestamps.`);
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return parseDate(value);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
throw new RangeError(`${prop}: ${JSON.stringify(value)} is well-formed but is not a real date.`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* `CalendarDate` out, ISO string back.
|
|
69
|
+
*
|
|
70
|
+
* `toString()` is NOT used, and this is not a stylistic preference. A value
|
|
71
|
+
* that came from a non-Gregorian calendar stringifies WITH its calendar
|
|
72
|
+
* annotation — `2569-05-30[u-ca-buddhist]` — which is a correct ISO 8601-2
|
|
73
|
+
* string and is not what any caller expecting `YYYY-MM-DD` will do anything
|
|
74
|
+
* sensible with. Building the string from the parts of the Gregorian
|
|
75
|
+
* projection is what keeps the wire format one shape in every locale.
|
|
76
|
+
*
|
|
77
|
+
* The projection to Gregorian happens here rather than being assumed. In
|
|
78
|
+
* practice react-aria hands back the calendar it was given — `useCalendarState`
|
|
79
|
+
* converts through `toCalendar` on the way out — so a Gregorian value in is a
|
|
80
|
+
* Gregorian value out, and this is a no-op. It is written anyway because the
|
|
81
|
+
* one path where it is NOT a no-op is an unavailable-date predicate being
|
|
82
|
+
* offered a cell from the DISPLAY calendar, which is the reader's, not ours.
|
|
83
|
+
*/
|
|
84
|
+
export function toIso(date) {
|
|
85
|
+
const g = toCalendar(new CalendarDate(date.calendar, date.era, date.year, date.month, date.day), new GregorianCalendar());
|
|
86
|
+
const pad = (n, width) => String(n).padStart(width, '0');
|
|
87
|
+
return `${pad(g.year, 4)}-${pad(g.month, 2)}-${pad(g.day, 2)}`;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Wraps an `isDateUnavailable` predicate so the caller receives an ISO string
|
|
91
|
+
* rather than a `CalendarDate`.
|
|
92
|
+
*
|
|
93
|
+
* Returned as `undefined` when there is no predicate, rather than as a function
|
|
94
|
+
* that always returns false. react-aria checks for the prop's presence in more
|
|
95
|
+
* than one place, and a no-op function is present.
|
|
96
|
+
*/
|
|
97
|
+
export function wrapUnavailable(fn) {
|
|
98
|
+
if (!fn)
|
|
99
|
+
return undefined;
|
|
100
|
+
return (date) => fn(toIso(date));
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=iso-date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iso-date.js","sourceRoot":"","sources":["../../src/components/iso-date.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,UAAU,GACX,MAAM,yBAAyB,CAAC;AAYjC,4EAA4E;AAC5E,MAAM,QAAQ,GAAG,qBAAqB,CAAC;AAEvC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAiC,EACjC,IAAY;IAEZ,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,SAAS,CACjB,GAAG,IAAI,4CAA4C,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI;YAC1E,qFAAqF,CACxF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,UAAU,CAClB,GAAG,IAAI,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,yCAAyC,CAC3E,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,KAAK,CAAC,IAAe;IACnC,MAAM,CAAC,GAAG,UAAU,CAClB,IAAI,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,EAC1E,IAAI,iBAAiB,EAAE,CACxB,CAAC;IACF,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzE,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;AACjE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,EAA4C;IAE5C,IAAI,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC;IAC1B,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACnC,CAAC"}
|