@capra/core 1.6.0 → 1.7.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/index.cjs CHANGED
@@ -4196,7 +4196,7 @@ const MenuSection = ({ children, "aria-label": ariaLabel, "aria-labelledby": ari
4196
4196
  }, resolvedChildren));
4197
4197
  };
4198
4198
  MenuSection.displayName = "Menu.Section";
4199
- const MenuItem = ({ as, label, description, ariaLabel, href, disabled = false, active = false, variant = "default", icon, indent: indentProp, shortcut, parent = false, onClick, FORCE__className, children, ...rest }) => {
4199
+ const MenuItem = ({ as: Component, label, description, ariaLabel, href, disabled = false, active = false, variant = "default", icon, indent: indentProp, shortcut, parent = false, onPress, onClick, FORCE__className, children, ...rest }) => {
4200
4200
  const indentFromSectionHeader = react.useContext(MenuSectionIndentContext);
4201
4201
  const indent = indentProp !== void 0 ? indentProp : indentFromSectionHeader ? true : false;
4202
4202
  const labelContent = children ?? label;
@@ -4210,59 +4210,27 @@ const MenuItem = ({ as, label, description, ariaLabel, href, disabled = false, a
4210
4210
  size: "xs",
4211
4211
  "aria-hidden": true
4212
4212
  }) : null])));
4213
- const itemClassName = clsx(Menu_module_default.menuItem, FORCE__className);
4214
- const menuItemDataAttributes = {
4215
- "data-variant": variant,
4216
- "data-active": active || void 0,
4217
- "data-indent": indent || void 0,
4218
- "data-has-description": showDescription || void 0
4219
- };
4220
- /** React Aria runs menu activation through `onAction` (pointer + Enter/Space), not only `onPress`. */
4221
- const handleAction = () => {
4222
- if (!disabled && onClick) onClick({});
4223
- };
4224
- if (as) {
4225
- const Component = as;
4226
- return /* @__PURE__ */ react.createElement(react_aria_components.MenuItem, {
4227
- isDisabled: disabled,
4228
- textValue,
4229
- "aria-label": ariaLabel,
4230
- "aria-current": active ? "page" : void 0,
4231
- className: itemClassName,
4232
- ...menuItemDataAttributes,
4233
- render: (domProps) => /* @__PURE__ */ react.createElement(Component, {
4234
- ...domProps,
4235
- ...rest
4236
- }),
4237
- onAction: handleAction
4238
- }, /* @__PURE__ */ react.createElement(ListItem, {
4239
- as: "div",
4240
- role: "presentation",
4241
- FORCE__className: Menu_module_default.menuItemListItemShell
4242
- }, listItemContent));
4243
- }
4244
- if (Boolean(href) && !disabled) return /* @__PURE__ */ react.createElement(react_aria_components.MenuItem, {
4245
- href,
4246
- isDisabled: disabled,
4247
- textValue,
4248
- "aria-label": ariaLabel,
4249
- "aria-current": active ? "page" : void 0,
4250
- className: itemClassName,
4251
- ...menuItemDataAttributes,
4252
- onAction: handleAction
4253
- }, /* @__PURE__ */ react.createElement(ListItem, {
4254
- as: "div",
4255
- role: "presentation",
4256
- FORCE__className: Menu_module_default.menuItemListItemShell
4257
- }, listItemContent));
4213
+ const render = Component ? (domProps) => {
4214
+ const Element = Component;
4215
+ return /* @__PURE__ */ react.createElement(Element, {
4216
+ ...domProps,
4217
+ ...rest
4218
+ });
4219
+ } : void 0;
4258
4220
  return /* @__PURE__ */ react.createElement(react_aria_components.MenuItem, {
4221
+ href,
4259
4222
  isDisabled: disabled,
4260
4223
  textValue,
4261
4224
  "aria-label": ariaLabel,
4262
4225
  "aria-current": active ? "page" : void 0,
4263
- className: itemClassName,
4264
- ...menuItemDataAttributes,
4265
- onAction: handleAction
4226
+ className: clsx(Menu_module_default.menuItem, FORCE__className),
4227
+ "data-variant": variant,
4228
+ "data-active": active || void 0,
4229
+ "data-indent": indent || void 0,
4230
+ "data-has-description": showDescription || void 0,
4231
+ render,
4232
+ onClick,
4233
+ onPress
4266
4234
  }, /* @__PURE__ */ react.createElement(ListItem, {
4267
4235
  as: "div",
4268
4236
  role: "presentation",
@@ -4294,10 +4262,9 @@ const MenuSubmenu = ({ label, children, itemHoverAppearance = "default", itemAct
4294
4262
  size: "xs",
4295
4263
  "aria-hidden": true
4296
4264
  }))));
4297
- const triggerClassName = clsx(Menu_module_default.menuItem, classNameOverride);
4298
4265
  return /* @__PURE__ */ react.createElement(react_aria_components.SubmenuTrigger, { delay }, /* @__PURE__ */ react.createElement(react_aria_components.MenuItem, {
4299
4266
  textValue,
4300
- className: triggerClassName
4267
+ className: clsx(Menu_module_default.menuItem, classNameOverride)
4301
4268
  }, /* @__PURE__ */ react.createElement(ListItem, {
4302
4269
  as: "div",
4303
4270
  role: "presentation",
@@ -4708,10 +4675,7 @@ const TabNav = ({ activeKey, onTabClick, items, tabPlacement = "horizontal", cen
4708
4675
  role: "navigation",
4709
4676
  "aria-label": ariaLabel,
4710
4677
  className: TabNav_module_default.tabBar
4711
- }, /* @__PURE__ */ react.createElement("div", {
4712
- className: TabNav_module_default.tabList,
4713
- "aria-orientation": tabPlacement === "horizontal" ? "horizontal" : "vertical"
4714
- }, items.map((item) => {
4678
+ }, /* @__PURE__ */ react.createElement("div", { className: TabNav_module_default.tabList }, items.map((item) => {
4715
4679
  const hasSubItems = Boolean(item.subItems?.length);
4716
4680
  const showDropdown = hasSubItems || item.variant === "dropdown";
4717
4681
  /** Accent “active” tab styling: current route only (not merely flyout open — open + non-route stays grey). */
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React$2 from "react";
2
2
  import React$1, { HTMLAttributeAnchorTarget, HTMLAttributeReferrerPolicy } from "react";
3
- import { BreadcrumbProps as BreadcrumbProps$1, BreadcrumbsProps as BreadcrumbsProps$1, ButtonProps as ButtonProps$1, ComboBoxRenderProps, DatePickerProps, DateRangePickerProps, DateValue, DisclosureProps, Focusable, LinkProps as LinkProps$1, ListBoxItemProps, PopoverProps as PopoverProps$1, RouterProvider } from "react-aria-components";
3
+ import { BreadcrumbProps as BreadcrumbProps$1, BreadcrumbsProps as BreadcrumbsProps$1, ButtonProps as ButtonProps$1, ComboBoxRenderProps, DatePickerProps, DateRangePickerProps, DateValue, DisclosureProps, Focusable, LinkProps as LinkProps$1, ListBoxItemProps, PopoverProps as PopoverProps$1, PressEvent, RouterProvider } from "react-aria-components";
4
4
  import { SvgIcon } from "@capra/icons";
5
5
  import { SvgLogo } from "@capra/icons/logos";
6
6
 
@@ -125,7 +125,7 @@ declare const TextInput: React$2.ForwardRefExoticComponent<{
125
125
  */
126
126
  size?: Size$3; /** Content after the input (e.g. icon or clear button). */
127
127
  trailingSlot?: React$2.ReactNode;
128
- } & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "style" | "size" | "className"> & React$2.RefAttributes<HTMLInputElement>>;
128
+ } & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "style" | "className" | "size"> & React$2.RefAttributes<HTMLInputElement>>;
129
129
  //#endregion
130
130
  //#region src/components/input-helpers/fieldLayout.d.ts
131
131
  type FieldLayoutProps = {
@@ -172,7 +172,7 @@ declare const AutocompleteField: ((props: {
172
172
  leadingSlot?: React$1.ReactNode;
173
173
  size?: Size$3;
174
174
  trailingSlot?: React$1.ReactNode;
175
- } & StylingOverrideProps & Omit<Omit<React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "style" | "size" | "className"> & React$1.RefAttributes<HTMLInputElement>, "ref">, "value" | "onChange"> & React$1.RefAttributes<HTMLInputElement>) => React$1.ReactElement) & {
175
+ } & StylingOverrideProps & Omit<Omit<React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "style" | "className" | "size"> & React$1.RefAttributes<HTMLInputElement>, "ref">, "onChange" | "value"> & React$1.RefAttributes<HTMLInputElement>) => React$1.ReactElement) & {
176
176
  Item: typeof AutocompleteItem;
177
177
  };
178
178
  //#endregion
@@ -429,7 +429,7 @@ type RadioGroupProps = RadioGroupContextValue & StylingOverrideProps & Omit<Reac
429
429
  /**
430
430
  * A control wrapper for a group of radio buttons.
431
431
  */
432
- declare const RadioGroup: (props: RadioGroupContextValue & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref">, "onChange" | "className"> & React$2.RefAttributes<HTMLFieldSetElement>) => React$2.ReactElement;
432
+ declare const RadioGroup: (props: RadioGroupContextValue & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref">, "className" | "onChange"> & React$2.RefAttributes<HTMLFieldSetElement>) => React$2.ReactElement;
433
433
  //#endregion
434
434
  //#region src/components/Radio/Radio.d.ts
435
435
  type ChildrenLabel = {
@@ -562,7 +562,7 @@ declare const Checkbox: React$2.ForwardRefExoticComponent<{
562
562
  checked?: boolean; /** Default checked state for uncontrolled component. */
563
563
  defaultChecked?: boolean; /** The label for the checkbox. */
564
564
  children?: string | React$2.ReactNode;
565
- } & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "type" | "className"> & React$2.RefAttributes<HTMLInputElement>>;
565
+ } & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "className" | "type"> & React$2.RefAttributes<HTMLInputElement>>;
566
566
  //#endregion
567
567
  //#region src/components/Collapse/Collapse.d.ts
568
568
  /** Props forwarded to React Aria `Disclosure`; see https://reactaria.adobe.com/Disclosure */
@@ -636,7 +636,7 @@ declare const TextField: React$2.ForwardRefExoticComponent<{
636
636
  /** Called with the new string value when the input changes. */onChange?: (value: string) => void; /** When true, shows a character count. */
637
637
  showCount?: boolean;
638
638
  value?: string | number | undefined;
639
- } & FieldLayoutProps & Omit<TextInputProps, "value" | "onChange"> & React$2.RefAttributes<HTMLInputElement>>;
639
+ } & FieldLayoutProps & Omit<TextInputProps, "onChange" | "value"> & React$2.RefAttributes<HTMLInputElement>>;
640
640
  //#endregion
641
641
  //#region src/components/PasswordField/PasswordField.d.ts
642
642
  type PasswordFieldProps = Omit<TextFieldProps, 'trailingSlot' | 'type'>;
@@ -660,7 +660,7 @@ type NumberFieldProps = Omit<TextInputProps, 'type' | 'onChange' | 'min' | 'max'
660
660
  /**
661
661
  * Number field built on React Aria `NumberField`, with custom increment/decrement controls (native spinners hidden).
662
662
  */
663
- declare const NumberField: React$2.ForwardRefExoticComponent<Omit<TextInputProps, "max" | "min" | "step" | "type" | "onChange"> & {
663
+ declare const NumberField: React$2.ForwardRefExoticComponent<Omit<TextInputProps, "onChange" | "max" | "min" | "type" | "step"> & {
664
664
  /** Called with the unformatted number value when the number changes. */onChange?: (value: number) => void; /** Locale-aware display and parsing for the displayed value (see https://react-aria.adobe.com/NumberField#format-options) */
665
665
  formatOptions?: Intl.NumberFormatOptions; /** Minimum value */
666
666
  min?: number; /** Maximum value */
@@ -682,7 +682,7 @@ type DatePickerFieldProps<T extends DateValue = DateValue> = FieldLayoutProps &
682
682
  required?: boolean; /** Invalid value; `appearance="danger"` also forces an invalid state for display. */
683
683
  isInvalid?: boolean;
684
684
  };
685
- declare const DatePickerField: React$2.ForwardRefExoticComponent<FieldLayoutProps & Pick<TextInputProps, "placeholder" | "size" | "appearance" | "leadingSlot"> & Pick<DatePickerProps<DateValue>, "value" | "onChange" | "defaultValue"> & {
685
+ declare const DatePickerField: React$2.ForwardRefExoticComponent<FieldLayoutProps & Pick<TextInputProps, "placeholder" | "size" | "appearance" | "leadingSlot"> & Pick<DatePickerProps<DateValue>, "defaultValue" | "onChange" | "value"> & {
686
686
  /** Smallest date/time unit shown in the field. Only `day` and `second` are supported. */granularity?: "day" | "second";
687
687
  } & StylingOverrideProps & {
688
688
  /** When true, shows a clear control to the left of the calendar button while the field has a value. */canClear?: boolean; /** Disables the field. */
@@ -710,7 +710,7 @@ type DateRangePickerFieldProps<T extends DateValue = DateValue> = FieldLayoutPro
710
710
  };
711
711
  declare const DateRangePickerField: React$2.ForwardRefExoticComponent<FieldLayoutProps & Pick<TextInputProps, "size" | "appearance" | "leadingSlot"> & {
712
712
  /** Placeholders for empty start and end, shown with a swap icon between them when the group is not focus-within. */placeholder?: DateRangePickerFieldPlaceholder;
713
- } & Pick<DateRangePickerProps<DateValue>, "value" | "onChange" | "defaultValue" | "shouldCloseOnSelect"> & {
713
+ } & Pick<DateRangePickerProps<DateValue>, "defaultValue" | "onChange" | "value" | "shouldCloseOnSelect"> & {
714
714
  /** Smallest date/time unit shown in the fields. Only `day` and `second` are supported. */granularity?: "day" | "second";
715
715
  } & StylingOverrideProps & {
716
716
  /** When true, shows a clear control to the left of the calendar button while the field has a value. */canClear?: boolean; /** Disables the field. */
@@ -770,7 +770,7 @@ declare const TextArea: React$2.ForwardRefExoticComponent<{
770
770
  autoSize?: TextAreaAutoSize; /** When true, shows a character count. */
771
771
  showCount?: boolean; /** Called with the new string value when the input changes. */
772
772
  onChange?: (value: string) => void;
773
- } & FieldLayoutProps & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, "style" | "size" | "onChange" | "className"> & React$2.RefAttributes<HTMLTextAreaElement>>;
773
+ } & FieldLayoutProps & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, "style" | "className" | "onChange" | "size"> & React$2.RefAttributes<HTMLTextAreaElement>>;
774
774
  //#endregion
775
775
  //#region src/components/Modal/Modal.d.ts
776
776
  type ModalSize = 'sm' | 'md' | 'lg';
@@ -1763,8 +1763,13 @@ type MenuItemProps<As extends React$2.ElementType = 'a'> = Omit<React$2.Componen
1763
1763
  * Whether to show chevron (for submenu/parent items).
1764
1764
  */
1765
1765
  parent?: boolean;
1766
+ /**
1767
+ * Press handler.
1768
+ */
1769
+ onPress?: (e: PressEvent) => void;
1766
1770
  /**
1767
1771
  * Click handler.
1772
+ * @deprecated Use `onPress` instead.
1768
1773
  */
1769
1774
  onClick?: (e: React$2.MouseEvent) => void;
1770
1775
  /**
@@ -1906,7 +1911,7 @@ declare const Menu: {
1906
1911
  displayName: string;
1907
1912
  Item: {
1908
1913
  <As extends React$2.ElementType = "a">({
1909
- as,
1914
+ as: Component,
1910
1915
  label,
1911
1916
  description,
1912
1917
  ariaLabel,
@@ -1918,6 +1923,7 @@ declare const Menu: {
1918
1923
  indent: indentProp,
1919
1924
  shortcut,
1920
1925
  parent,
1926
+ onPress,
1921
1927
  onClick,
1922
1928
  FORCE__className,
1923
1929
  children,
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React$2 from "react";
2
2
  import React$1, { HTMLAttributeAnchorTarget, HTMLAttributeReferrerPolicy } from "react";
3
3
  import { SvgIcon } from "@capra/icons";
4
- import { BreadcrumbProps as BreadcrumbProps$1, BreadcrumbsProps as BreadcrumbsProps$1, ButtonProps as ButtonProps$1, ComboBoxRenderProps, DatePickerProps, DateRangePickerProps, DateValue, DisclosureProps, Focusable, LinkProps as LinkProps$1, ListBoxItemProps, PopoverProps as PopoverProps$1, RouterProvider } from "react-aria-components";
4
+ import { BreadcrumbProps as BreadcrumbProps$1, BreadcrumbsProps as BreadcrumbsProps$1, ButtonProps as ButtonProps$1, ComboBoxRenderProps, DatePickerProps, DateRangePickerProps, DateValue, DisclosureProps, Focusable, LinkProps as LinkProps$1, ListBoxItemProps, PopoverProps as PopoverProps$1, PressEvent, RouterProvider } from "react-aria-components";
5
5
  import { SvgLogo } from "@capra/icons/logos";
6
6
 
7
7
  //#region src/utils/stylingOverride.d.ts
@@ -125,7 +125,7 @@ declare const TextInput: React$2.ForwardRefExoticComponent<{
125
125
  */
126
126
  size?: Size$3; /** Content after the input (e.g. icon or clear button). */
127
127
  trailingSlot?: React$2.ReactNode;
128
- } & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "style" | "size" | "className"> & React$2.RefAttributes<HTMLInputElement>>;
128
+ } & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "style" | "className" | "size"> & React$2.RefAttributes<HTMLInputElement>>;
129
129
  //#endregion
130
130
  //#region src/components/input-helpers/fieldLayout.d.ts
131
131
  type FieldLayoutProps = {
@@ -172,7 +172,7 @@ declare const AutocompleteField: ((props: {
172
172
  leadingSlot?: React$1.ReactNode;
173
173
  size?: Size$3;
174
174
  trailingSlot?: React$1.ReactNode;
175
- } & StylingOverrideProps & Omit<Omit<React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "style" | "size" | "className"> & React$1.RefAttributes<HTMLInputElement>, "ref">, "value" | "onChange"> & React$1.RefAttributes<HTMLInputElement>) => React$1.ReactElement) & {
175
+ } & StylingOverrideProps & Omit<Omit<React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "style" | "className" | "size"> & React$1.RefAttributes<HTMLInputElement>, "ref">, "onChange" | "value"> & React$1.RefAttributes<HTMLInputElement>) => React$1.ReactElement) & {
176
176
  Item: typeof AutocompleteItem;
177
177
  };
178
178
  //#endregion
@@ -429,7 +429,7 @@ type RadioGroupProps = RadioGroupContextValue & StylingOverrideProps & Omit<Reac
429
429
  /**
430
430
  * A control wrapper for a group of radio buttons.
431
431
  */
432
- declare const RadioGroup: (props: RadioGroupContextValue & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref">, "onChange" | "className"> & React$2.RefAttributes<HTMLFieldSetElement>) => React$2.ReactElement;
432
+ declare const RadioGroup: (props: RadioGroupContextValue & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref">, "className" | "onChange"> & React$2.RefAttributes<HTMLFieldSetElement>) => React$2.ReactElement;
433
433
  //#endregion
434
434
  //#region src/components/Radio/Radio.d.ts
435
435
  type ChildrenLabel = {
@@ -562,7 +562,7 @@ declare const Checkbox: React$2.ForwardRefExoticComponent<{
562
562
  checked?: boolean; /** Default checked state for uncontrolled component. */
563
563
  defaultChecked?: boolean; /** The label for the checkbox. */
564
564
  children?: string | React$2.ReactNode;
565
- } & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "type" | "className"> & React$2.RefAttributes<HTMLInputElement>>;
565
+ } & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "className" | "type"> & React$2.RefAttributes<HTMLInputElement>>;
566
566
  //#endregion
567
567
  //#region src/components/Collapse/Collapse.d.ts
568
568
  /** Props forwarded to React Aria `Disclosure`; see https://reactaria.adobe.com/Disclosure */
@@ -636,7 +636,7 @@ declare const TextField: React$2.ForwardRefExoticComponent<{
636
636
  /** Called with the new string value when the input changes. */onChange?: (value: string) => void; /** When true, shows a character count. */
637
637
  showCount?: boolean;
638
638
  value?: string | number | undefined;
639
- } & FieldLayoutProps & Omit<TextInputProps, "value" | "onChange"> & React$2.RefAttributes<HTMLInputElement>>;
639
+ } & FieldLayoutProps & Omit<TextInputProps, "onChange" | "value"> & React$2.RefAttributes<HTMLInputElement>>;
640
640
  //#endregion
641
641
  //#region src/components/PasswordField/PasswordField.d.ts
642
642
  type PasswordFieldProps = Omit<TextFieldProps, 'trailingSlot' | 'type'>;
@@ -660,7 +660,7 @@ type NumberFieldProps = Omit<TextInputProps, 'type' | 'onChange' | 'min' | 'max'
660
660
  /**
661
661
  * Number field built on React Aria `NumberField`, with custom increment/decrement controls (native spinners hidden).
662
662
  */
663
- declare const NumberField: React$2.ForwardRefExoticComponent<Omit<TextInputProps, "max" | "min" | "step" | "type" | "onChange"> & {
663
+ declare const NumberField: React$2.ForwardRefExoticComponent<Omit<TextInputProps, "onChange" | "max" | "min" | "type" | "step"> & {
664
664
  /** Called with the unformatted number value when the number changes. */onChange?: (value: number) => void; /** Locale-aware display and parsing for the displayed value (see https://react-aria.adobe.com/NumberField#format-options) */
665
665
  formatOptions?: Intl.NumberFormatOptions; /** Minimum value */
666
666
  min?: number; /** Maximum value */
@@ -682,7 +682,7 @@ type DatePickerFieldProps<T extends DateValue = DateValue> = FieldLayoutProps &
682
682
  required?: boolean; /** Invalid value; `appearance="danger"` also forces an invalid state for display. */
683
683
  isInvalid?: boolean;
684
684
  };
685
- declare const DatePickerField: React$2.ForwardRefExoticComponent<FieldLayoutProps & Pick<TextInputProps, "placeholder" | "size" | "appearance" | "leadingSlot"> & Pick<DatePickerProps<DateValue>, "value" | "onChange" | "defaultValue"> & {
685
+ declare const DatePickerField: React$2.ForwardRefExoticComponent<FieldLayoutProps & Pick<TextInputProps, "placeholder" | "size" | "appearance" | "leadingSlot"> & Pick<DatePickerProps<DateValue>, "defaultValue" | "onChange" | "value"> & {
686
686
  /** Smallest date/time unit shown in the field. Only `day` and `second` are supported. */granularity?: "day" | "second";
687
687
  } & StylingOverrideProps & {
688
688
  /** When true, shows a clear control to the left of the calendar button while the field has a value. */canClear?: boolean; /** Disables the field. */
@@ -710,7 +710,7 @@ type DateRangePickerFieldProps<T extends DateValue = DateValue> = FieldLayoutPro
710
710
  };
711
711
  declare const DateRangePickerField: React$2.ForwardRefExoticComponent<FieldLayoutProps & Pick<TextInputProps, "size" | "appearance" | "leadingSlot"> & {
712
712
  /** Placeholders for empty start and end, shown with a swap icon between them when the group is not focus-within. */placeholder?: DateRangePickerFieldPlaceholder;
713
- } & Pick<DateRangePickerProps<DateValue>, "value" | "onChange" | "defaultValue" | "shouldCloseOnSelect"> & {
713
+ } & Pick<DateRangePickerProps<DateValue>, "defaultValue" | "onChange" | "value" | "shouldCloseOnSelect"> & {
714
714
  /** Smallest date/time unit shown in the fields. Only `day` and `second` are supported. */granularity?: "day" | "second";
715
715
  } & StylingOverrideProps & {
716
716
  /** When true, shows a clear control to the left of the calendar button while the field has a value. */canClear?: boolean; /** Disables the field. */
@@ -770,7 +770,7 @@ declare const TextArea: React$2.ForwardRefExoticComponent<{
770
770
  autoSize?: TextAreaAutoSize; /** When true, shows a character count. */
771
771
  showCount?: boolean; /** Called with the new string value when the input changes. */
772
772
  onChange?: (value: string) => void;
773
- } & FieldLayoutProps & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, "style" | "size" | "onChange" | "className"> & React$2.RefAttributes<HTMLTextAreaElement>>;
773
+ } & FieldLayoutProps & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, "style" | "className" | "onChange" | "size"> & React$2.RefAttributes<HTMLTextAreaElement>>;
774
774
  //#endregion
775
775
  //#region src/components/Modal/Modal.d.ts
776
776
  type ModalSize = 'sm' | 'md' | 'lg';
@@ -1763,8 +1763,13 @@ type MenuItemProps<As extends React$2.ElementType = 'a'> = Omit<React$2.Componen
1763
1763
  * Whether to show chevron (for submenu/parent items).
1764
1764
  */
1765
1765
  parent?: boolean;
1766
+ /**
1767
+ * Press handler.
1768
+ */
1769
+ onPress?: (e: PressEvent) => void;
1766
1770
  /**
1767
1771
  * Click handler.
1772
+ * @deprecated Use `onPress` instead.
1768
1773
  */
1769
1774
  onClick?: (e: React$2.MouseEvent) => void;
1770
1775
  /**
@@ -1906,7 +1911,7 @@ declare const Menu: {
1906
1911
  displayName: string;
1907
1912
  Item: {
1908
1913
  <As extends React$2.ElementType = "a">({
1909
- as,
1914
+ as: Component,
1910
1915
  label,
1911
1916
  description,
1912
1917
  ariaLabel,
@@ -1918,6 +1923,7 @@ declare const Menu: {
1918
1923
  indent: indentProp,
1919
1924
  shortcut,
1920
1925
  parent,
1926
+ onPress,
1921
1927
  onClick,
1922
1928
  FORCE__className,
1923
1929
  children,
package/dist/index.mjs CHANGED
@@ -4172,7 +4172,7 @@ const MenuSection$1 = ({ children, "aria-label": ariaLabel, "aria-labelledby": a
4172
4172
  }, resolvedChildren));
4173
4173
  };
4174
4174
  MenuSection$1.displayName = "Menu.Section";
4175
- const MenuItem$1 = ({ as, label, description, ariaLabel, href, disabled = false, active = false, variant = "default", icon, indent: indentProp, shortcut, parent = false, onClick, FORCE__className, children, ...rest }) => {
4175
+ const MenuItem$1 = ({ as: Component, label, description, ariaLabel, href, disabled = false, active = false, variant = "default", icon, indent: indentProp, shortcut, parent = false, onPress, onClick, FORCE__className, children, ...rest }) => {
4176
4176
  const indentFromSectionHeader = React$1.useContext(MenuSectionIndentContext);
4177
4177
  const indent = indentProp !== void 0 ? indentProp : indentFromSectionHeader ? true : false;
4178
4178
  const labelContent = children ?? label;
@@ -4186,59 +4186,27 @@ const MenuItem$1 = ({ as, label, description, ariaLabel, href, disabled = false,
4186
4186
  size: "xs",
4187
4187
  "aria-hidden": true
4188
4188
  }) : null])));
4189
- const itemClassName = clsx(Menu_module_default.menuItem, FORCE__className);
4190
- const menuItemDataAttributes = {
4191
- "data-variant": variant,
4192
- "data-active": active || void 0,
4193
- "data-indent": indent || void 0,
4194
- "data-has-description": showDescription || void 0
4195
- };
4196
- /** React Aria runs menu activation through `onAction` (pointer + Enter/Space), not only `onPress`. */
4197
- const handleAction = () => {
4198
- if (!disabled && onClick) onClick({});
4199
- };
4200
- if (as) {
4201
- const Component = as;
4202
- return /* @__PURE__ */ React$1.createElement(MenuItem, {
4203
- isDisabled: disabled,
4204
- textValue,
4205
- "aria-label": ariaLabel,
4206
- "aria-current": active ? "page" : void 0,
4207
- className: itemClassName,
4208
- ...menuItemDataAttributes,
4209
- render: (domProps) => /* @__PURE__ */ React$1.createElement(Component, {
4210
- ...domProps,
4211
- ...rest
4212
- }),
4213
- onAction: handleAction
4214
- }, /* @__PURE__ */ React$1.createElement(ListItem, {
4215
- as: "div",
4216
- role: "presentation",
4217
- FORCE__className: Menu_module_default.menuItemListItemShell
4218
- }, listItemContent));
4219
- }
4220
- if (Boolean(href) && !disabled) return /* @__PURE__ */ React$1.createElement(MenuItem, {
4221
- href,
4222
- isDisabled: disabled,
4223
- textValue,
4224
- "aria-label": ariaLabel,
4225
- "aria-current": active ? "page" : void 0,
4226
- className: itemClassName,
4227
- ...menuItemDataAttributes,
4228
- onAction: handleAction
4229
- }, /* @__PURE__ */ React$1.createElement(ListItem, {
4230
- as: "div",
4231
- role: "presentation",
4232
- FORCE__className: Menu_module_default.menuItemListItemShell
4233
- }, listItemContent));
4189
+ const render = Component ? (domProps) => {
4190
+ const Element = Component;
4191
+ return /* @__PURE__ */ React$1.createElement(Element, {
4192
+ ...domProps,
4193
+ ...rest
4194
+ });
4195
+ } : void 0;
4234
4196
  return /* @__PURE__ */ React$1.createElement(MenuItem, {
4197
+ href,
4235
4198
  isDisabled: disabled,
4236
4199
  textValue,
4237
4200
  "aria-label": ariaLabel,
4238
4201
  "aria-current": active ? "page" : void 0,
4239
- className: itemClassName,
4240
- ...menuItemDataAttributes,
4241
- onAction: handleAction
4202
+ className: clsx(Menu_module_default.menuItem, FORCE__className),
4203
+ "data-variant": variant,
4204
+ "data-active": active || void 0,
4205
+ "data-indent": indent || void 0,
4206
+ "data-has-description": showDescription || void 0,
4207
+ render,
4208
+ onClick,
4209
+ onPress
4242
4210
  }, /* @__PURE__ */ React$1.createElement(ListItem, {
4243
4211
  as: "div",
4244
4212
  role: "presentation",
@@ -4270,10 +4238,9 @@ const MenuSubmenu = ({ label, children, itemHoverAppearance = "default", itemAct
4270
4238
  size: "xs",
4271
4239
  "aria-hidden": true
4272
4240
  }))));
4273
- const triggerClassName = clsx(Menu_module_default.menuItem, classNameOverride);
4274
4241
  return /* @__PURE__ */ React$1.createElement(SubmenuTrigger, { delay }, /* @__PURE__ */ React$1.createElement(MenuItem, {
4275
4242
  textValue,
4276
- className: triggerClassName
4243
+ className: clsx(Menu_module_default.menuItem, classNameOverride)
4277
4244
  }, /* @__PURE__ */ React$1.createElement(ListItem, {
4278
4245
  as: "div",
4279
4246
  role: "presentation",
@@ -4684,10 +4651,7 @@ const TabNav = ({ activeKey, onTabClick, items, tabPlacement = "horizontal", cen
4684
4651
  role: "navigation",
4685
4652
  "aria-label": ariaLabel,
4686
4653
  className: TabNav_module_default.tabBar
4687
- }, /* @__PURE__ */ React$1.createElement("div", {
4688
- className: TabNav_module_default.tabList,
4689
- "aria-orientation": tabPlacement === "horizontal" ? "horizontal" : "vertical"
4690
- }, items.map((item) => {
4654
+ }, /* @__PURE__ */ React$1.createElement("div", { className: TabNav_module_default.tabList }, items.map((item) => {
4691
4655
  const hasSubItems = Boolean(item.subItems?.length);
4692
4656
  const showDropdown = hasSubItems || item.variant === "dropdown";
4693
4657
  /** Accent “active” tab styling: current route only (not merely flyout open — open + non-route stays grey). */
@@ -56,12 +56,12 @@ Tab labels should be one or two words, using title case (Tab Label). Labels shou
56
56
 
57
57
  ### Keyboard interaction
58
58
 
59
- | Key | Function |
60
- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
- | `Tab` / `Shift + Tab` | Moves focus into the tab list, putting focus onto the active tab. When the tab list has focus, moves focus to the next focusable element (generally within the tab panel). |
62
- | `Left Arrow` / `Up Arrow` | Moves focus to, and activate, the previous tab. If focus is on the first tab, move focus to the last tab. Up performs the same action when `aria-orientation="vertical"` is set. |
63
- | `Right Arrow` / `Down Arrow` | Moves focus to, and activate, the next tab. If focus is on the last tab, move focus to the first tab. Down performs the same action when `aria-orientation="vertical"` is set. |
64
- | `Shift+F10` | Opens the menu for tabs with a dropdown. |
59
+ | Key | Function |
60
+ | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | `Tab` / `Shift + Tab` | Moves focus into the tab list, putting focus onto the active tab. When the tab list has focus, moves focus to the next focusable element (generally within the tab panel). |
62
+ | `Left Arrow` / `Up Arrow` | Moves focus to, and activate, the previous tab. If focus is on the first tab, move focus to the last tab. Up performs the same action when `tabPlacement="vertical"`. |
63
+ | `Right Arrow` / `Down Arrow` | Moves focus to, and activate, the next tab. If focus is on the last tab, move focus to the first tab. Down performs the same action when `tabPlacement="vertical"`. |
64
+ | `Shift+F10` | Opens the menu for tabs with a dropdown. |
65
65
 
66
66
  ### ARIA considerations
67
67
 
@@ -74,4 +74,4 @@ TabNav uses link-based navigation. The following apply:
74
74
 
75
75
  ### Orientation
76
76
 
77
- Use `tabPlacement="horizontal"` (default) for a horizontal tab bar at the bottom, or `tabPlacement="vertical"` for a vertical tab bar on the left. Vertical tabs have `aria-orientation="vertical"` set.
77
+ Use `tabPlacement="horizontal"` (default) for a horizontal tab bar at the bottom, or `tabPlacement="vertical"` for a vertical tab bar on the left.
@@ -1,5 +1,16 @@
1
1
  # History/Changelogs/@capra-core
2
2
 
3
+ ### 1.7.0
4
+
5
+ #### Minor Changes
6
+
7
+ * [540b651](https://bitbucket.org/cribl/capra-ui/commits/540b651): Add `onPress` event handler to `Menu.Item` and deprecate `onClick`
8
+
9
+ #### Patch Changes
10
+
11
+ * [540b651](https://bitbucket.org/cribl/capra-ui/commits/540b651): Fix issue where event in `Menu.Item` `onClick` was not bubbling correctly
12
+ * [684cc26](https://bitbucket.org/cribl/capra-ui/commits/684cc26): Remove invalid `aria-orientation` attribute in TabNav component.
13
+
3
14
  ### 1.6.0
4
15
 
5
16
  #### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capra/core",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "description": "Core React components for the Capra design system",
@@ -44,9 +44,9 @@
44
44
  "antd": "4.24.16",
45
45
  "storybook": "^10.4.6",
46
46
  "tsdown": "^0.22.0",
47
- "@capra/theme": "1.3.0",
48
- "@private/linting": "0.0.0",
49
47
  "@private/building": "0.0.4",
48
+ "@private/linting": "0.0.0",
49
+ "@capra/theme": "1.3.0",
50
50
  "@private/stories": "0.0.0",
51
51
  "@private/testing": "0.0.7"
52
52
  },