@a4ui/core 0.8.0 → 0.9.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.
@@ -7,10 +7,10 @@ export interface CalendarProps {
7
7
  class?: string;
8
8
  }
9
9
  /**
10
- * Full-month calendar: a header with the month/year and prev/next navigation, a
11
- * row of weekday labels, and a 6×7 grid of day buttons. Days outside the shown
12
- * month are muted; the selected day is filled and "today" gets a ring. Clicking a
13
- * day calls `onChange`. Theme-agnostic (semantic tokens only), always visible.
10
+ * Full-month calendar: a header with month/year navigation and a 6×7 grid of
11
+ * day buttons. Click the month or year in the header to jump straight to a month
12
+ * or year picker; the double chevrons step a whole year at a time. The selected
13
+ * day is filled and "today" gets a ring. Theme-agnostic, always visible.
14
14
  *
15
15
  * @example
16
16
  * ```tsx
@@ -0,0 +1,29 @@
1
+ import { JSX } from 'solid-js';
2
+ export interface DateRange {
3
+ /** 'YYYY-MM-DD' (local) or '' if unset. */
4
+ start: string;
5
+ end: string;
6
+ }
7
+ export interface DateRangePickerProps {
8
+ value: DateRange;
9
+ onChange: (value: DateRange) => void;
10
+ /** Placeholder shown when nothing is selected. */
11
+ label?: string;
12
+ disabled?: boolean;
13
+ months?: string[];
14
+ weekdays?: string[];
15
+ class?: string;
16
+ }
17
+ /**
18
+ * Compact hand-rolled range picker built on the same popover mechanism as
19
+ * `DateField`, but tracking a start/end pair instead of a single day. The
20
+ * first click begins a range, the second completes it (closing the popover);
21
+ * clicking again once complete starts a fresh range.
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * const [range, setRange] = createSignal<DateRange>({ start: '2026-03-15', end: '' })
26
+ * <DateRangePicker value={range()} onChange={setRange} label="Stay dates" />
27
+ * ```
28
+ */
29
+ export declare function DateRangePicker(props: DateRangePickerProps): JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { JSX } from 'solid-js';
2
+ export interface DateTimeFieldProps {
3
+ /** Selected moment as `YYYY-MM-DD HH:MM` (local), or `''` for none. */
4
+ value: string;
5
+ /** Called with the combined `YYYY-MM-DD HH:MM` (either part may be missing). */
6
+ onChange: (value: string) => void;
7
+ /** 12-hour time display with AM/PM. @default false */
8
+ hour12?: boolean;
9
+ /** Minute increment for the time options. @default 5 */
10
+ minuteStep?: number;
11
+ /** Placeholder for the date half. */
12
+ dateLabel?: string;
13
+ /** Placeholder for the time half. */
14
+ timeLabel?: string;
15
+ disabled?: boolean;
16
+ class?: string;
17
+ }
18
+ /**
19
+ * Date + time picker built from {@link DateField} and {@link TimeField}. Speaks a
20
+ * single `YYYY-MM-DD HH:MM` string; the two halves fill in independently.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * const [when, setWhen] = createSignal('2026-07-15 09:30')
25
+ * <DateTimeField value={when()} onChange={setWhen} hour12 />
26
+ * ```
27
+ */
28
+ export declare function DateTimeField(props: DateTimeFieldProps): JSX.Element;
@@ -0,0 +1,57 @@
1
+ import { JSX } from 'solid-js';
2
+ export interface FormFieldProps {
3
+ /** Optional explicit id; otherwise auto-generated. */
4
+ id?: string;
5
+ children: JSX.Element;
6
+ class?: string;
7
+ }
8
+ /**
9
+ * Container/provider that gives `FormLabel`, `FormControl`,
10
+ * `FormDescription`, and `FormError` a shared field id so they wire up
11
+ * `for`/`id`/`aria-describedby` automatically.
12
+ *
13
+ * Pairs well with a schema validator (Valibot/Zod): the consumer computes
14
+ * the error string and passes it to `FormError`.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <FormField>
19
+ * <FormLabel>Email</FormLabel>
20
+ * <FormControl>
21
+ * {(fieldProps) => <input type="email" {...fieldProps} />}
22
+ * </FormControl>
23
+ * <FormDescription>We'll never share your email.</FormDescription>
24
+ * <FormError>{errors().email}</FormError>
25
+ * </FormField>
26
+ * ```
27
+ */
28
+ export declare function FormField(props: FormFieldProps): JSX.Element;
29
+ /** Label associated with the enclosing `FormField`'s control via `for`. */
30
+ export declare function FormLabel(props: {
31
+ children: JSX.Element;
32
+ class?: string;
33
+ }): JSX.Element;
34
+ /**
35
+ * Render-prop bridge that hands the enclosing `FormField`'s `id` and
36
+ * `aria-describedby` to the caller's control, to be spread onto the actual
37
+ * input/select/textarea element.
38
+ */
39
+ export declare function FormControl(props: {
40
+ children: (fieldProps: {
41
+ id: string;
42
+ 'aria-describedby': string;
43
+ }) => JSX.Element;
44
+ }): JSX.Element;
45
+ /** Helper text for the enclosing `FormField`, linked via `aria-describedby`. */
46
+ export declare function FormDescription(props: {
47
+ children: JSX.Element;
48
+ class?: string;
49
+ }): JSX.Element;
50
+ /**
51
+ * Error text for the enclosing `FormField`, linked via `aria-describedby`.
52
+ * Renders nothing when there is no error to show.
53
+ */
54
+ export declare function FormError(props: {
55
+ children?: JSX.Element;
56
+ class?: string;
57
+ }): JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { JSX } from 'solid-js';
2
+ export interface TimeFieldProps {
3
+ /** Selected time as canonical 24h "HH:MM" (e.g. "15:05"), or "" for none. */
4
+ value: string;
5
+ /** Called with the newly picked time as "HH:MM" (24h). */
6
+ onChange: (value: string) => void;
7
+ /** 12-hour display with AM/PM instead of 24-hour. @default false */
8
+ hour12?: boolean;
9
+ /** Minute increment for the options list. @default 5 */
10
+ minuteStep?: number;
11
+ /** Placeholder shown on the trigger when value is empty. */
12
+ label?: string;
13
+ disabled?: boolean;
14
+ class?: string;
15
+ }
16
+ /**
17
+ * Compact hand-rolled hour/minute (/ AM-PM) column picker (no Kobalte primitive
18
+ * covers this yet). Trigger button opens a portaled popover; closes on outside
19
+ * click, Escape, scroll, or resize. Speaks plain 24h `HH:MM` strings.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * const [time, setTime] = createSignal('15:05')
24
+ * <TimeField value={time()} onChange={setTime} label="Start time" hour12 />
25
+ * ```
26
+ */
27
+ export declare function TimeField(props: TimeFieldProps): JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { JSX } from 'solid-js';
2
+ export interface CalendarCoreProps {
3
+ /** Currently selected day (for highlight); undefined = none. */
4
+ selected?: Date;
5
+ /** Range start — endpoints fill, days strictly between get a soft band. */
6
+ rangeStart?: Date;
7
+ /** Range end (see `rangeStart`). */
8
+ rangeEnd?: Date;
9
+ /** Called with the newly picked day. */
10
+ onPick: (date: Date) => void;
11
+ /** 0 = Sunday-first, 1 = Monday-first. @default 0 */
12
+ weekStart?: 0 | 1;
13
+ /** Full month names, January…December order (12). */
14
+ months?: string[];
15
+ /** Weekday headers in DISPLAY order, matching `weekStart` (7). */
16
+ weekdays?: string[];
17
+ /** Month first shown (its year/month seed the view). @default today */
18
+ initialView?: Date;
19
+ class?: string;
20
+ }
21
+ /**
22
+ * The interactive calendar body: a header (year/month jumps + drill-down) and a
23
+ * grid that switches between day, month, and year views. Stateless about
24
+ * open/closed — the caller decides where it lives.
25
+ */
26
+ export declare function CalendarCore(props: CalendarCoreProps): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a4ui/core",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "A4ui — Spatial Glass design system & component library for SolidJS (Kobalte behavior + Tailwind glass tokens + motion).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -37,14 +37,28 @@
37
37
  "exports": {
38
38
  ".": {
39
39
  "types": "./dist/index.d.ts",
40
- "import": "./dist/index.js"
40
+ "import": "./dist/index.js",
41
+ "default": "./dist/index.js"
42
+ },
43
+ "./commerce": {
44
+ "types": "./dist/commerce/index.d.ts",
45
+ "import": "./dist/commerce.js",
46
+ "default": "./dist/commerce.js"
47
+ },
48
+ "./preset": {
49
+ "import": "./preset.js",
50
+ "default": "./preset.js"
41
51
  },
42
- "./preset": "./preset.js",
43
52
  "./styles.css": "./dist/styles.css",
44
53
  "./elements": {
45
- "import": "./dist/elements.js"
54
+ "import": "./dist/elements.js",
55
+ "default": "./dist/elements.js"
46
56
  },
47
- "./elements.css": "./dist/elements.css"
57
+ "./elements.css": "./dist/elements.css",
58
+ "./package.json": "./package.json"
59
+ },
60
+ "engines": {
61
+ "node": ">=20"
48
62
  },
49
63
  "publishConfig": {
50
64
  "access": "public"
@@ -65,7 +79,9 @@
65
79
  "test:ui": "playwright test --ui",
66
80
  "test:a11y": "playwright test a11y --project=desktop",
67
81
  "test:report": "playwright show-report",
68
- "prepublishOnly": "npm run build",
82
+ "test:package": "node scripts/test-package.mjs",
83
+ "validate": "npm run typecheck && npm run lint && npm run test:unit && npm run build",
84
+ "prepublishOnly": "npm run validate",
69
85
  "prepare": "husky"
70
86
  },
71
87
  "lint-staged": {