@conductor-by-89soone/react 0.1.1 → 0.2.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/dist/action.js CHANGED
@@ -1,2 +1,3 @@
1
- export { Button, IconButton } from './chunk-EA2W7T64.js';
1
+ export { Button, IconButton } from './chunk-G7TRTZRR.js';
2
+ import './chunk-NF3ZHADJ.js';
2
3
  import './chunk-WEIMKRZV.js';
@@ -2,7 +2,7 @@ import { cx } from './chunk-WEIMKRZV.js';
2
2
  import * as RadixCheckbox from '@radix-ui/react-checkbox';
3
3
  import * as RadixSelect from '@radix-ui/react-select';
4
4
  import * as RadixSwitch from '@radix-ui/react-switch';
5
- import { createContext, forwardRef, useId, cloneElement, useContext, useEffect } from 'react';
5
+ import { createContext, forwardRef, useId, useContext, useEffect } from 'react';
6
6
  import { jsx, jsxs } from 'react/jsx-runtime';
7
7
 
8
8
  var FieldContext = createContext(null);
@@ -33,7 +33,7 @@ var Field = forwardRef(function Field2({ children, className, description, error
33
33
  required ? /* @__PURE__ */ jsx("span", { className: "cdt-field__required", "aria-hidden": "true", children: "*" }) : null
34
34
  ] }),
35
35
  description === void 0 ? null : /* @__PURE__ */ jsx("div", { id: descriptionId, className: "cdt-field__description", children: description }),
36
- required ? cloneElement(children, { required }) : children,
36
+ children,
37
37
  error === void 0 ? null : /* @__PURE__ */ jsx("div", { id: errorId, className: "cdt-field__error", children: error })
38
38
  ] }) });
39
39
  });
@@ -63,24 +63,30 @@ var TextArea = forwardRef(function TextArea2({ "aria-describedby": ariaDescribed
63
63
  return /* @__PURE__ */ jsx("textarea", { ...props, ref, id: ownId ?? (field === null ? void 0 : control.id), rows, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": control.describedBy, "aria-invalid": ariaInvalid ?? (control.invalid || void 0), required: required ?? control.required, className: cx("cdt-textarea", variant === "glass" && "cdt-textarea--glass", control.invalid && "cdt-textarea--invalid", className) });
64
64
  });
65
65
  TextArea.displayName = "TextArea";
66
- var SelectTrigger = forwardRef(function SelectTrigger2({ "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, className, id: ownId, invalid, size = "md", ...props }, ref) {
66
+ var SelectTrigger = forwardRef(function SelectTrigger2({ "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, className, id: ownId, invalid, size = "md", ...props }, ref) {
67
67
  const field = useContext(FieldContext);
68
68
  const control = useFieldControl(invalid, ariaDescribedBy);
69
- return /* @__PURE__ */ jsx(RadixSelect.Trigger, { ...props, ref, id: ownId ?? (field === null ? void 0 : control.id), "aria-describedby": control.describedBy, "aria-invalid": ariaInvalid ?? (control.invalid || void 0), className: cx("cdt-select__trigger", size === "sm" && "cdt-select__trigger--sm", control.invalid && "cdt-select__trigger--invalid", className) });
69
+ const requiredAttribute = ariaRequired ?? (control.required ? true : void 0);
70
+ return /* @__PURE__ */ jsx(RadixSelect.Trigger, { ...props, ref, id: ownId ?? (field === null ? void 0 : control.id), "aria-describedby": control.describedBy, "aria-invalid": ariaInvalid ?? (control.invalid || void 0), ...requiredAttribute === void 0 ? {} : { "aria-required": requiredAttribute }, className: cx("cdt-select__trigger", size === "sm" && "cdt-select__trigger--sm", control.invalid && "cdt-select__trigger--invalid", className) });
70
71
  });
71
72
  SelectTrigger.displayName = "Select.Trigger";
72
73
  var SelectContent = forwardRef(function SelectContent2({ children, className, ...props }, ref) {
73
74
  return /* @__PURE__ */ jsx(RadixSelect.Portal, { children: /* @__PURE__ */ jsx(RadixSelect.Content, { ...props, ref, className: cx("cdt-select__content", className), children: /* @__PURE__ */ jsx(RadixSelect.Viewport, { children }) }) });
74
75
  });
75
76
  SelectContent.displayName = "Select.Content";
76
- var SelectItem = forwardRef(function SelectItem2({ children, className, ...props }, ref) {
77
+ var SelectItem = forwardRef(function SelectItem2({ children, className, indicator = "\u2713", ...props }, ref) {
77
78
  return /* @__PURE__ */ jsxs(RadixSelect.Item, { ...props, ref, className: cx("cdt-select__item", className), children: [
78
79
  /* @__PURE__ */ jsx(RadixSelect.ItemText, { children }),
79
- /* @__PURE__ */ jsx(RadixSelect.ItemIndicator, { className: "cdt-select__indicator", "aria-hidden": "true", children: "\u2713" })
80
+ /* @__PURE__ */ jsx(RadixSelect.ItemIndicator, { className: "cdt-select__indicator", "aria-hidden": "true", children: indicator })
80
81
  ] });
81
82
  });
82
83
  SelectItem.displayName = "Select.Item";
83
- var Select = { Root: RadixSelect.Root, Trigger: SelectTrigger, Value: RadixSelect.Value, Content: SelectContent, Item: SelectItem, Group: RadixSelect.Group, Label: RadixSelect.Label };
84
+ function SelectRoot({ required, ...props }) {
85
+ const field = useContext(FieldContext);
86
+ return /* @__PURE__ */ jsx(RadixSelect.Root, { ...props, required: required ?? field?.required });
87
+ }
88
+ SelectRoot.displayName = "Select.Root";
89
+ var Select = { Root: SelectRoot, Trigger: SelectTrigger, Value: RadixSelect.Value, Content: SelectContent, Item: SelectItem, Group: RadixSelect.Group, Label: RadixSelect.Label };
84
90
  var Switch = forwardRef(function Switch2({ className, ...props }, ref) {
85
91
  const field = useContext(FieldContext);
86
92
  const control = useFieldControl(void 0, props["aria-describedby"]);
@@ -1,4 +1,5 @@
1
1
  import { cx } from './chunk-WEIMKRZV.js';
2
+ import { STATUS_ICONS, SEVERITY_ICONS } from '@conductor-by-89soone/tokens';
2
3
  import { forwardRef } from 'react';
3
4
  import { jsxs, jsx } from 'react/jsx-runtime';
4
5
 
@@ -15,14 +16,14 @@ var StatusBadge = forwardRef(function StatusBadge2({ className, icon, label, sta
15
16
  const statusClass = status === "neutralEnd" ? "neutral-end" : status;
16
17
  return /* @__PURE__ */ jsxs("span", { ...props, ref, className: cx("cdt-badge", "cdt-status-badge", `cdt-status-badge--${statusClass}`, className), children: [
17
18
  isMarker ? /* @__PURE__ */ jsx("span", { className: cx("cdt-status-badge__marker", status === "neutralEnd" && "cdt-status-badge__marker--neutral-end"), "aria-hidden": "true" }) : null,
18
- /* @__PURE__ */ jsx("span", { className: "cdt-badge__icon", "aria-hidden": "true", children: icon }),
19
+ /* @__PURE__ */ jsx("span", { className: "cdt-badge__icon", "aria-hidden": "true", "data-cdt-icon": STATUS_ICONS[status], children: icon }),
19
20
  label
20
21
  ] });
21
22
  });
22
23
  StatusBadge.displayName = "StatusBadge";
23
24
  var SeverityTag = forwardRef(function SeverityTag2({ className, icon, label, severity, ...props }, ref) {
24
25
  return /* @__PURE__ */ jsxs("span", { ...props, ref, className: cx("cdt-badge", "cdt-severity-tag", `cdt-severity-tag--${severity}`, className), children: [
25
- /* @__PURE__ */ jsx("span", { className: "cdt-badge__icon", "aria-hidden": "true", children: icon }),
26
+ /* @__PURE__ */ jsx("span", { className: "cdt-badge__icon", "aria-hidden": "true", "data-cdt-icon": SEVERITY_ICONS[severity], children: icon }),
26
27
  label
27
28
  ] });
28
29
  });
@@ -1,3 +1,4 @@
1
+ import { Spinner } from './chunk-NF3ZHADJ.js';
1
2
  import { cx } from './chunk-WEIMKRZV.js';
2
3
  import { forwardRef } from 'react';
3
4
  import { jsxs, jsx } from 'react/jsx-runtime';
@@ -33,7 +34,7 @@ var Button = forwardRef(function Button2({ blockedReason, className, disabled, i
33
34
  onClick?.(event);
34
35
  },
35
36
  children: [
36
- iconStart === void 0 ? null : /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: iconStart }),
37
+ loading ? /* @__PURE__ */ jsx(Spinner, { size: "sm", label: "", "aria-hidden": "true" }) : iconStart === void 0 ? null : /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: iconStart }),
37
38
  children,
38
39
  iconEnd === void 0 ? null : /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: iconEnd })
39
40
  ]
@@ -42,7 +43,17 @@ var Button = forwardRef(function Button2({ blockedReason, className, disabled, i
42
43
  });
43
44
  Button.displayName = "Button";
44
45
  var IconButton = forwardRef(function IconButton2({ icon, size, ...props }, ref) {
45
- return /* @__PURE__ */ jsx(Button, { ...props, ref, size, className: cx("cdt-btn--icon", size === "sm" && "cdt-btn--icon-sm", props.className), children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: icon }) });
46
+ return /* @__PURE__ */ jsx(
47
+ Button,
48
+ {
49
+ ...props,
50
+ ref,
51
+ size,
52
+ iconStart: icon,
53
+ className: cx("cdt-btn--icon", props.className),
54
+ children: null
55
+ }
56
+ );
46
57
  });
47
58
  IconButton.displayName = "IconButton";
48
59
 
@@ -8,6 +8,7 @@ var AppShell = forwardRef(function AppShell2({
8
8
  className,
9
9
  mainId = "cdt-main",
10
10
  nav,
11
+ navCloseLabel = "Close navigation",
11
12
  navOpen,
12
13
  onNavOpenChange,
13
14
  skipLinkLabel,
@@ -36,7 +37,7 @@ var AppShell = forwardRef(function AppShell2({
36
37
  ] })
37
38
  ] }),
38
39
  /* @__PURE__ */ jsxs(RadixDialog.Portal, { children: [
39
- /* @__PURE__ */ jsx("div", { className: "cdt-app-shell__overlay", "aria-hidden": "true" }),
40
+ /* @__PURE__ */ jsx(RadixDialog.Close, { asChild: true, children: /* @__PURE__ */ jsx("button", { type: "button", className: "cdt-app-shell__overlay", "aria-label": navCloseLabel }) }),
40
41
  /* @__PURE__ */ jsxs(RadixDialog.Content, { className: "cdt-app-shell__nav", "data-mobile": "", children: [
41
42
  /* @__PURE__ */ jsx(RadixDialog.Title, { className: "cdt-sr-only", children: "Navigation" }),
42
43
  nav
package/dist/form.d.ts CHANGED
@@ -29,15 +29,38 @@ type SelectTriggerProps = ComponentPropsWithoutRef<typeof RadixSelect.Trigger> &
29
29
  readonly size?: "sm" | "md";
30
30
  readonly invalid?: boolean;
31
31
  };
32
+ /** `indicator` matches `Checkbox`: the check glyph is a text character unless a consumer swaps it. */
33
+ type SelectItemProps = ComponentPropsWithoutRef<typeof RadixSelect.Item> & {
34
+ readonly indicator?: ReactNode;
35
+ };
36
+ /**
37
+ * `Select.Root` that carries Field's `required` into Radix (PR #8 review P1).
38
+ *
39
+ * Radix configures the hidden form control from the **root**, not the trigger. Exporting
40
+ * `RadixSelect.Root` unchanged left `aria-required` on the trigger as the only signal: screen
41
+ * readers announced the state while the owning form still submitted with no selection. The
42
+ * documented `<Field required><Select.Root>…` composition therefore lost the constraint it
43
+ * looked like it was setting.
44
+ *
45
+ * An explicit `required` on the element still wins — the context is a default, not an override,
46
+ * the same shape `Switch` and the other controls already use.
47
+ */
48
+ type SelectRootProps = ComponentPropsWithoutRef<typeof RadixSelect.Root>;
49
+ declare function SelectRoot({ required, ...props }: SelectRootProps): ReactElement;
50
+ declare namespace SelectRoot {
51
+ var displayName: string;
52
+ }
32
53
  declare const Select: {
33
- readonly Root: react.FC<RadixSelect.SelectProps>;
54
+ readonly Root: typeof SelectRoot;
34
55
  readonly Trigger: react.ForwardRefExoticComponent<Omit<RadixSelect.SelectTriggerProps & react.RefAttributes<HTMLButtonElement>, "ref"> & {
35
56
  readonly size?: "sm" | "md";
36
57
  readonly invalid?: boolean;
37
58
  } & react.RefAttributes<HTMLButtonElement>>;
38
59
  readonly Value: react.ForwardRefExoticComponent<RadixSelect.SelectValueProps & react.RefAttributes<HTMLSpanElement>>;
39
60
  readonly Content: react.ForwardRefExoticComponent<Omit<RadixSelect.SelectContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
40
- readonly Item: react.ForwardRefExoticComponent<Omit<RadixSelect.SelectItemProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
61
+ readonly Item: react.ForwardRefExoticComponent<Omit<RadixSelect.SelectItemProps & react.RefAttributes<HTMLDivElement>, "ref"> & {
62
+ readonly indicator?: ReactNode;
63
+ } & react.RefAttributes<HTMLDivElement>>;
41
64
  readonly Group: react.ForwardRefExoticComponent<RadixSelect.SelectGroupProps & react.RefAttributes<HTMLDivElement>>;
42
65
  readonly Label: react.ForwardRefExoticComponent<RadixSelect.SelectLabelProps & react.RefAttributes<HTMLDivElement>>;
43
66
  };
@@ -50,4 +73,4 @@ declare const Checkbox: react.ForwardRefExoticComponent<Omit<RadixCheckbox.Check
50
73
  readonly indicator?: ReactNode;
51
74
  } & react.RefAttributes<HTMLButtonElement>>;
52
75
 
53
- export { Checkbox, type CheckboxProps, Field, type FieldProps, Select, type SelectTriggerProps, Switch, type SwitchProps, TextArea, type TextAreaProps, TextField, type TextFieldProps };
76
+ export { Checkbox, type CheckboxProps, Field, type FieldProps, Select, type SelectItemProps, type SelectRootProps, type SelectTriggerProps, Switch, type SwitchProps, TextArea, type TextAreaProps, TextField, type TextFieldProps };
package/dist/form.js CHANGED
@@ -1,2 +1,2 @@
1
- export { Checkbox, Field, Select, Switch, TextArea, TextField } from './chunk-FBQXGRI7.js';
1
+ export { Checkbox, Field, Select, Switch, TextArea, TextField } from './chunk-3YDK2JBK.js';
2
2
  import './chunk-WEIMKRZV.js';
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { Card, CardGrid, CardGridProps, CardProps, Panel, PanelProps } from './s
5
5
  export { Badge, BadgeProps, Severity, SeverityTag, SeverityTagProps, Status, StatusBadge, StatusBadgeProps } from './status.js';
6
6
  export { CodeBlock, CodeBlockProps, Kbd, KbdProps, Table, TableCellProps, TableHeaderCellProps, TableProps, Timeline, TimelineProps, TimelineStepProps } from './data.js';
7
7
  export { Dialog, DialogContentProps, Drawer, DrawerContentProps, DropdownMenu, DropdownMenuItemProps, Tooltip, TooltipContentProps } from './overlay.js';
8
- export { Checkbox, CheckboxProps, Field, FieldProps, Select, SelectTriggerProps, Switch, SwitchProps, TextArea, TextAreaProps, TextField, TextFieldProps } from './form.js';
8
+ export { Checkbox, CheckboxProps, Field, FieldProps, Select, SelectItemProps, SelectTriggerProps, Switch, SwitchProps, TextArea, TextAreaProps, TextField, TextFieldProps } from './form.js';
9
9
  export { Banner, BannerProps, EmptyState, EmptyStateProps, Meter, MeterProps, ProgressRing, ProgressRingProps, Spinner, SpinnerProps } from './feedback.js';
10
10
  export { AppShell, AppShellProps, NavItem, NavLinkRenderProps, NavList, NavListProps, TopBar, TopBarProps } from './shell.js';
11
11
  import 'react';
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- export { Badge, SeverityTag, StatusBadge } from './chunk-PXSSKHWF.js';
1
+ export { Badge, SeverityTag, StatusBadge } from './chunk-535YGQAR.js';
2
2
  export { Card, CardGrid, Panel } from './chunk-TUHWL5JC.js';
3
- export { Button, IconButton } from './chunk-EA2W7T64.js';
3
+ export { Button, IconButton } from './chunk-G7TRTZRR.js';
4
4
  export { CodeBlock, Kbd, Table, Timeline } from './chunk-RBD5Z2LR.js';
5
5
  export { Banner, EmptyState, Meter, ProgressRing, Spinner } from './chunk-NF3ZHADJ.js';
6
- export { Checkbox, Field, Select, Switch, TextArea, TextField } from './chunk-FBQXGRI7.js';
6
+ export { Checkbox, Field, Select, Switch, TextArea, TextField } from './chunk-3YDK2JBK.js';
7
7
  export { Dialog, Drawer, DropdownMenu, Tooltip } from './chunk-MR7FIZKV.js';
8
- export { AppShell, NavList, TopBar } from './chunk-VLBBY4MW.js';
8
+ export { AppShell, NavList, TopBar } from './chunk-R5BLKHR2.js';
9
9
  export { cx } from './chunk-WEIMKRZV.js';
10
10
  import { PACKAGE_NAME as PACKAGE_NAME$1, CDT_PREFIX } from '@conductor-by-89soone/tokens';
11
11
 
package/dist/shell.d.ts CHANGED
@@ -7,6 +7,8 @@ interface AppShellProps extends Omit<HTMLAttributes<HTMLDivElement>, "children">
7
7
  readonly navOpen?: boolean;
8
8
  readonly onNavOpenChange?: (open: boolean) => void;
9
9
  readonly skipLinkLabel: string;
10
+ /** Accessible name of the mobile navigation scrim, which closes the drawer. */
11
+ readonly navCloseLabel?: string;
10
12
  readonly mainId?: string;
11
13
  readonly children: ReactNode;
12
14
  }
package/dist/shell.js CHANGED
@@ -1,2 +1,2 @@
1
- export { AppShell, NavList, TopBar } from './chunk-VLBBY4MW.js';
1
+ export { AppShell, NavList, TopBar } from './chunk-R5BLKHR2.js';
2
2
  import './chunk-WEIMKRZV.js';
package/dist/status.d.ts CHANGED
@@ -11,6 +11,12 @@ declare const Badge: react.ForwardRefExoticComponent<BadgeProps & react.RefAttri
11
11
  type Status = "queued" | "running" | "waiting" | "success" | "partial" | "danger" | "neutralEnd";
12
12
  interface StatusBadgeProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
13
13
  readonly status: Status;
14
+ /**
15
+ * The status icon. Required: FR-CMP-004 AC-1 renders colour, icon and text as three channels,
16
+ * and Conductor bundles no icon set. `STATUS_ICONS[status]` from
17
+ * `@conductor-by-89soone/tokens` names the icon to pass; the rendered element repeats that name
18
+ * as `data-cdt-icon` so the choice is checkable from the DOM.
19
+ */
14
20
  readonly icon: ReactNode;
15
21
  readonly label: string;
16
22
  }
@@ -18,6 +24,7 @@ declare const StatusBadge: react.ForwardRefExoticComponent<StatusBadgeProps & re
18
24
  type Severity = "read" | "write" | "destructive" | "blocked";
19
25
  interface SeverityTagProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
20
26
  readonly severity: Severity;
27
+ /** The severity icon. `SEVERITY_ICONS[severity]` names it; see `StatusBadgeProps.icon`. */
21
28
  readonly icon: ReactNode;
22
29
  readonly label: string;
23
30
  }
package/dist/status.js CHANGED
@@ -1,2 +1,2 @@
1
- export { Badge, SeverityTag, StatusBadge } from './chunk-PXSSKHWF.js';
1
+ export { Badge, SeverityTag, StatusBadge } from './chunk-535YGQAR.js';
2
2
  import './chunk-WEIMKRZV.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conductor-by-89soone/react",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Accessible React primitives for Conductor.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://89sooner.github.io/design-system/",
@@ -34,8 +34,8 @@
34
34
  "@radix-ui/react-select": "2.2.5",
35
35
  "@radix-ui/react-switch": "1.2.5",
36
36
  "@radix-ui/react-tooltip": "1.2.12",
37
- "@conductor-by-89soone/css": "0.1.0",
38
- "@conductor-by-89soone/tokens": "0.1.0"
37
+ "@conductor-by-89soone/css": "0.2.1",
38
+ "@conductor-by-89soone/tokens": "0.2.1"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "lucide-react": ">=0.400.0 <2",