@capra/core 1.8.2 → 1.10.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.
Files changed (50) hide show
  1. package/dist/index.cjs +294 -46
  2. package/dist/index.d.cts +132 -20
  3. package/dist/index.d.mts +132 -20
  4. package/dist/index.mjs +295 -49
  5. package/dist/style.css +251 -72
  6. package/docs/core-alert--usage.md +2 -0
  7. package/docs/core-anchor--usage.md +2 -0
  8. package/docs/core-autocompletefield--usage.md +2 -0
  9. package/docs/core-badge--design.md +10 -5
  10. package/docs/core-badge--usage.md +5 -2
  11. package/docs/core-breadcrumbs--usage.md +2 -0
  12. package/docs/core-button--usage.md +2 -0
  13. package/docs/core-buttonlink--usage.md +2 -0
  14. package/docs/core-checkbox--usage.md +2 -0
  15. package/docs/core-collapse--usage.md +2 -0
  16. package/docs/core-datepickerfield--usage.md +2 -0
  17. package/docs/core-daterangepickerfield--usage.md +2 -0
  18. package/docs/core-divider--usage.md +2 -0
  19. package/docs/core-emptystate--usage.md +2 -0
  20. package/docs/core-helpertext--usage.md +2 -0
  21. package/docs/core-iconbutton--usage.md +2 -0
  22. package/docs/core-inputrow--usage.md +2 -0
  23. package/docs/core-label--usage.md +2 -0
  24. package/docs/core-link--usage.md +2 -0
  25. package/docs/core-listitem--usage.md +2 -0
  26. package/docs/core-menu--usage.md +2 -0
  27. package/docs/core-modal--usage.md +2 -0
  28. package/docs/core-pagination--usage.md +2 -0
  29. package/docs/core-pill--usage.md +2 -0
  30. package/docs/core-radio--usage.md +2 -0
  31. package/docs/core-radiogroup--usage.md +2 -0
  32. package/docs/core-radiotile--usage.md +2 -0
  33. package/docs/core-ribbon--usage.md +2 -0
  34. package/docs/core-skeleton--usage.md +1 -2
  35. package/docs/core-skeletongroup--usage.md +0 -1
  36. package/docs/core-spinner--usage.md +2 -0
  37. package/docs/core-switch--usage.md +2 -0
  38. package/docs/core-tabnav--usage.md +2 -0
  39. package/docs/core-tag--usage.md +2 -0
  40. package/docs/core-text--usage.md +2 -0
  41. package/docs/core-textarea--usage.md +2 -0
  42. package/docs/core-textinput--usage.md +2 -0
  43. package/docs/core-tooltip--usage.md +2 -0
  44. package/docs/core-topnav--usage.md +2 -0
  45. package/docs/core-tree--design.md +31 -0
  46. package/docs/core-tree--usage.md +102 -0
  47. package/docs/core-verticalnavigation--usage.md +2 -0
  48. package/docs/history-changelogs-capra-core--docs.md +34 -0
  49. package/docs/index.md +2 -0
  50. package/package.json +7 -7
package/dist/index.d.cts CHANGED
@@ -1,10 +1,14 @@
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, PressEvent, 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, Key, 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
  //#region src/utils/stylingOverride.d.ts
7
7
  interface StylingOverrideProps {
8
+ /** Use `FORCE__className` instead. */
9
+ className?: never;
10
+ /** Inline styles are not supported; use component props or `FORCE__className`. */
11
+ style?: never;
8
12
  /**
9
13
  * 🚨 This prop is meant to be an escape hatch. 🚨
10
14
  *
@@ -208,7 +212,7 @@ type TextProps<As extends React$2.ElementType> = {
208
212
  * The underlying element rendered by the component. Defaults to `span`.
209
213
  */
210
214
  as?: As;
211
- } & StylingOverrideProps & Omit<React$2.ComponentPropsWithoutRef<As>, 'className'>;
215
+ } & StylingOverrideProps & React$2.ComponentPropsWithoutRef<As>;
212
216
  /**
213
217
  * Component for displaying text. The visual display can be controlled via
214
218
  * `variant`. The underlying HTML element can be controlled via the `as` prop,
@@ -228,7 +232,7 @@ declare const Text: <As extends React$2.ElementType = "span">(props: {
228
232
  * The underlying element rendered by the component. Defaults to `span`.
229
233
  */
230
234
  as?: As | undefined;
231
- } & StylingOverrideProps & Omit<React$2.PropsWithoutRef<React$2.ComponentProps<As>>, "className"> & React$2.RefAttributes<unknown>) => React$2.ReactElement;
235
+ } & StylingOverrideProps & React$2.PropsWithoutRef<React$2.ComponentProps<As>> & React$2.RefAttributes<unknown>) => React$2.ReactElement;
232
236
  //#endregion
233
237
  //#region src/components/Card/Card.d.ts
234
238
  /**
@@ -305,6 +309,8 @@ type AccessibleLabelProps = LabelledByProp | LabelProp;
305
309
  type AccessibleBadgeProps = AccessibleLabelProps & {
306
310
  'aria-live'?: React$2.AriaAttributes['aria-live'];
307
311
  };
312
+ declare const badgeSizes: readonly ['sm', 'md'];
313
+ type BadgeSize = (typeof badgeSizes)[number];
308
314
  type BadgeProps = {
309
315
  /**
310
316
  * The variant of the badge. 'counter' displays a count, 'dot' displays only a dot.
@@ -315,7 +321,12 @@ type BadgeProps = {
315
321
  * Controls the Badge color.
316
322
  * @default 'danger'
317
323
  */
318
- appearance?: 'danger' | 'info' | 'success' | 'warning';
324
+ appearance?: 'danger' | 'info' | 'success' | 'warning' | 'neutral';
325
+ /**
326
+ * Controls the Badge dimensions.
327
+ * @default 'md'
328
+ */
329
+ size?: BadgeSize;
319
330
  /**
320
331
  * The number to display in the badge. Default is 0.
321
332
  */
@@ -332,11 +343,14 @@ type BadgeProps = {
332
343
  /**
333
344
  * Badges display an indicator/counter on an associated component.
334
345
  */
335
- declare function Badge({ appearance, variant, count, showZero, overflowCount, FORCE__className, ...props }: BadgeProps): React$2.JSX.Element | null;
346
+ declare function Badge({ appearance, variant, size, count, showZero, overflowCount, FORCE__className, style, ...props }: BadgeProps): React$2.JSX.Element | null;
347
+ type BadgeLayoutProps = React$2.PropsWithChildren<{
348
+ offset?: readonly [x: number, y: number];
349
+ }>;
336
350
  /**
337
351
  * A convenience component allowing you to easily attach a badge to another component.
338
352
  */
339
- declare function BadgeLayout({ children }: React$2.PropsWithChildren): React$2.JSX.Element;
353
+ declare function BadgeLayout({ children, offset }: BadgeLayoutProps): React$2.JSX.Element;
340
354
  //#endregion
341
355
  //#region src/components/ListItem/ListItem.d.ts
342
356
  type ListItemProps<As extends React$2.ElementType> = {
@@ -345,7 +359,7 @@ type ListItemProps<As extends React$2.ElementType> = {
345
359
  declare function ListItem<As extends React$2.ElementType = 'li'>({ as: asComponent, children, FORCE__className: classNameOverride, ...props }: ListItemProps<As>): React$2.JSX.Element;
346
360
  declare namespace ListItem {
347
361
  export { Content };
348
- export { Label };
362
+ export { Label$1 as Label };
349
363
  export { Description };
350
364
  export { Suffix };
351
365
  export { Spacer };
@@ -358,7 +372,7 @@ declare const Content: ({ children, FORCE__className }: React$2.PropsWithChildre
358
372
  type ListItemLabelProps = React$2.PropsWithChildren & {
359
373
  id?: string;
360
374
  };
361
- declare const Label: ({ children, id }: ListItemLabelProps) => React$2.JSX.Element;
375
+ declare const Label$1: ({ children, id }: ListItemLabelProps) => React$2.JSX.Element;
362
376
  declare const Suffix: ({ children }: React$2.PropsWithChildren) => React$2.JSX.Element;
363
377
  declare const Description: ({ children }: React$2.PropsWithChildren) => React$2.JSX.Element;
364
378
  declare const Spacer: () => React$2.JSX.Element;
@@ -450,11 +464,11 @@ type ChildrenLabel = {
450
464
  /**
451
465
  * Require either 'aria-label', 'aria-labelledby', or 'children' for accessibility
452
466
  */
453
- type LabelProps = AccessibleLabelProps | ChildrenLabel;
467
+ type LabelProps$1 = AccessibleLabelProps | ChildrenLabel;
454
468
  type RadioProps = {
455
469
  /** The value of the radio button. */
456
470
  value: string | null;
457
- } & Partial<RadioGroupContextValue> & LabelProps & StylingOverrideProps & Omit<React$2.ComponentPropsWithoutRef<'input'>, 'className' | 'type'>;
471
+ } & Partial<RadioGroupContextValue> & LabelProps$1 & StylingOverrideProps & Omit<React$2.ComponentPropsWithoutRef<'input'>, 'className' | 'type'>;
458
472
  /**
459
473
  * A presentational radio button component. You will typically use this component within a RadioGroup component.
460
474
  */
@@ -1324,7 +1338,7 @@ declare const Link: <As extends React$2.ElementType = "a">(props: {
1324
1338
  } & RoutedLinkProps & StylingOverrideProps & Omit<React$2.PropsWithoutRef<React$2.ComponentProps<As>>, "className"> & React$2.RefAttributes<unknown>) => React$2.ReactElement;
1325
1339
  //#endregion
1326
1340
  //#region src/components/VerticalNavigation/VerticalNavigation.d.ts
1327
- interface VerticalNavigationProps extends React$2.HTMLAttributes<HTMLElement>, StylingOverrideProps {
1341
+ type VerticalNavigationProps = React$2.HTMLAttributes<HTMLElement> & StylingOverrideProps & {
1328
1342
  /**
1329
1343
  * Controlled collapsed state.
1330
1344
  */
@@ -1338,7 +1352,7 @@ interface VerticalNavigationProps extends React$2.HTMLAttributes<HTMLElement>, S
1338
1352
  * @default false
1339
1353
  */
1340
1354
  defaultCollapsed?: boolean;
1341
- }
1355
+ };
1342
1356
  type VerticalNavigationItemBaseProps<As extends React$2.ElementType> = Omit<React$2.ComponentPropsWithoutRef<As>, 'className' | 'as' | 'href' | 'isActive' | 'isDisabled' | 'rightElement' | 'label'> & StylingOverrideProps & {
1343
1357
  /**
1344
1358
  * The component to use for the item. Default is either 'a' or 'button' based on the presence of the href prop.
@@ -1391,19 +1405,19 @@ type VerticalNavigationItemProps<As extends React$2.ElementType> = VerticalNavig
1391
1405
  * Supports icons, active state, and 'subItem' variant for indentation.
1392
1406
  */
1393
1407
  declare const Item: <As extends React$2.ElementType>({ as, icon, label, isActive, href, FORCE__className, isDisabled, onClick, variant, rightElement, ...props }: VerticalNavigationItemProps<As>) => React$2.JSX.Element;
1394
- interface VerticalNavigationCollapseProps extends React$2.ButtonHTMLAttributes<HTMLButtonElement>, StylingOverrideProps {}
1408
+ type VerticalNavigationCollapseProps = React$2.ButtonHTMLAttributes<HTMLButtonElement> & StylingOverrideProps;
1395
1409
  /**
1396
1410
  * A toggle button to collapse/expand the navigation.
1397
1411
  * Should be placed within VerticalNavigation to control its state.
1398
1412
  */
1399
1413
  declare const Collapse$1: ({ FORCE__className, onClick, ...props }: VerticalNavigationCollapseProps) => React$2.JSX.Element;
1400
- interface VerticalNavigationItemListProps extends React$2.HTMLAttributes<HTMLUListElement>, StylingOverrideProps {}
1414
+ type VerticalNavigationItemListProps = React$2.HTMLAttributes<HTMLUListElement> & StylingOverrideProps;
1401
1415
  /**
1402
1416
  * Container for the primary list of navigation items.
1403
1417
  * Renders an unordered list with consistent spacing and layout.
1404
1418
  */
1405
1419
  declare const ItemList: ({ children, FORCE__className, ...props }: VerticalNavigationItemListProps) => React$2.JSX.Element;
1406
- interface VerticalNavigationFooterProps extends React$2.HTMLAttributes<HTMLUListElement>, StylingOverrideProps {}
1420
+ type VerticalNavigationFooterProps = React$2.HTMLAttributes<HTMLUListElement> & StylingOverrideProps;
1407
1421
  /**
1408
1422
  * Secondary container for footer navigation actions such as settings or help.
1409
1423
  */
@@ -1588,7 +1602,7 @@ type SkeletonProps = {
1588
1602
  * (`title={false}` and `paragraph={false}`) children render inside the placeholder while loading.
1589
1603
  */
1590
1604
  children?: React$2.ReactNode;
1591
- } & StylingOverrideProps & Omit<React$2.HTMLAttributes<HTMLSpanElement>, 'children' | 'title' | 'paragraph'>;
1605
+ } & Omit<StylingOverrideProps, 'style'> & Omit<React$2.HTMLAttributes<HTMLSpanElement>, 'children' | 'title' | 'paragraph' | 'className'>;
1592
1606
  declare function Skeleton(props: SkeletonProps): React$2.JSX.Element | null;
1593
1607
  declare namespace Skeleton {
1594
1608
  var displayName: string;
@@ -1610,7 +1624,7 @@ type SkeletonElementProps = {
1610
1624
  size?: SkeletonSize;
1611
1625
  /** Show animation effect. @default false */
1612
1626
  active?: boolean;
1613
- } & StylingOverrideProps & Omit<React$2.HTMLAttributes<HTMLSpanElement>, 'children'>;
1627
+ } & Omit<StylingOverrideProps, 'style'> & Omit<React$2.HTMLAttributes<HTMLSpanElement>, 'children' | 'className' | 'style'>;
1614
1628
  type SkeletonGroupButtonProps = SkeletonElementProps & {
1615
1629
  block?: boolean;
1616
1630
  shape?: 'circle' | 'round' | 'square' | 'default';
@@ -1810,12 +1824,12 @@ type MenuSectionProps = StylingOverrideProps & Omit<React$2.HTMLAttributes<HTMLD
1810
1824
  */
1811
1825
  children?: React$2.ReactNode;
1812
1826
  };
1813
- interface MenuListProps extends StylingOverrideProps, React$2.HTMLAttributes<HTMLDivElement> {
1827
+ type MenuListProps = StylingOverrideProps & React$2.HTMLAttributes<HTMLDivElement> & {
1814
1828
  /**
1815
1829
  * Menu content. Use Menu.Item, Menu.Section, Menu.Header, Menu.Divider.
1816
1830
  */
1817
1831
  children?: React$2.ReactNode;
1818
- }
1832
+ };
1819
1833
  interface MenuSubmenuProps extends StylingOverrideProps {
1820
1834
  /**
1821
1835
  * Label for the parent row (trailing chevron indicates a nested panel).
@@ -2133,4 +2147,102 @@ type CustomTooltipTriggerProps = {
2133
2147
  */
2134
2148
  declare const CustomTooltipTrigger: React$2.ForwardRefExoticComponent<CustomTooltipTriggerProps & React$2.RefAttributes<HTMLElement>>;
2135
2149
  //#endregion
2136
- export { Alert, type AlertProps, Anchor, type AnchorProps, AutocompleteField, type AutocompleteFieldProps, Badge, BadgeLayout, type BadgeProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonLink, type ButtonLinkProps, type ButtonProps, Card, Checkbox, type CheckboxProps, Collapse, type CollapseProps, CustomTooltipTrigger, type CustomTooltipTriggerProps, DatePickerField, type DatePickerFieldProps, DateRangePickerField, type DateRangePickerFieldPlaceholder, type DateRangePickerFieldProps, Divider, type DividerProps, type DividerType, Drawer, type DrawerPlacement, type DrawerProps, EmptyState, type EmptyStateProps, IconButton, type IconButtonProps, InputRow, type InputRowAddonProps, type InputRowProps, Link, type LinkProps, ListItem, type ListItemProps, Menu, type MenuDividerProps, type MenuHeaderProps, type MenuItemProps, type MenuListProps, type MenuPanelPadding, type MenuProps, type MenuSectionProps, type MenuSubmenuProps, Modal, type ModalProps, NumberField, type NumberFieldProps, Pagination, type PaginationProps, PasswordField, type PasswordFieldProps, Pill, type PillProps, Popover, type PopoverProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RadioTile, type RadioTileProps, Ribbon, type RibbonProps, type RoutedLinkProps, RouterProvider, SKELETON_SIZE, SKELETON_SIZE_TOKENS, Skeleton, type SkeletonElementProps, SkeletonGroup, type SkeletonGroupButtonProps, type SkeletonGroupInputProps, type SkeletonGroupNodeProps, type SkeletonParagraphProps, type SkeletonProps, type SkeletonSize, type SkeletonTitleProps, Spinner, type SpinnerProps, type StylingOverrideProps, Switch, type SwitchProps, TabNav, type TabNavItemType, type TabNavItemVariant, type TabNavPlacement, type TabNavProps, type TabNavSubItemType, Tag, type TagColor, type TagProps, Text, TextArea, type TextAreaAutoSize, type TextAreaProps, TextField, type TextFieldProps, type TextProps, Toast, type ToastOptions, type ToastPosition, type ToastType, Tooltip, type TooltipProps, TopNav, type TopNavCenterProps, type TopNavEndProps, type TopNavProps, type TopNavStartProps, VerticalNavigation, type VerticalNavigationCollapseProps, type VerticalNavigationFooterProps, type VerticalNavigationItemListProps, type VerticalNavigationItemProps, type VerticalNavigationProps, VisuallyHidden, type VisuallyHiddenProps, submenuPanelClassName, tagColors };
2150
+ //#region src/components/Tree/Tree.d.ts
2151
+ interface TreeItemType {
2152
+ /**
2153
+ * The unique key of the tree item.
2154
+ */
2155
+ key: Key;
2156
+ /**
2157
+ * The label of the tree item.
2158
+ */
2159
+ label: React$2.ReactNode;
2160
+ /**
2161
+ * The children of the tree item.
2162
+ */
2163
+ children?: TreeItemType[];
2164
+ /**
2165
+ * Whether the tree item is disabled.
2166
+ */
2167
+ isDisabled?: boolean;
2168
+ /**
2169
+ * The suffix of the tree item.
2170
+ */
2171
+ suffix?: React$2.ReactNode;
2172
+ /**
2173
+ * The trailing slot of the tree item.
2174
+ */
2175
+ trailingSlot?: React$2.ReactNode;
2176
+ }
2177
+ type TreeProps = StylingOverrideProps & {
2178
+ /**
2179
+ * Defines a string value that labels the current element.
2180
+ */
2181
+ 'aria-label'?: string;
2182
+ /**
2183
+ * Identifies the element (or elements) that labels the current element.
2184
+ */
2185
+ 'aria-labelledby'?: string;
2186
+ /**
2187
+ * Items to render in the tree.
2188
+ */
2189
+ items: TreeItemType[];
2190
+ /**
2191
+ * Handler that is called when a user performs an action on an item.
2192
+ */
2193
+ onAction?: (key: Key) => void;
2194
+ /**
2195
+ * The initial expanded keys when in uncontrolled mode.
2196
+ */
2197
+ defaultExpandedKeys?: Iterable<Key>;
2198
+ /**
2199
+ * The initial selected keys when in uncontrolled mode.
2200
+ */
2201
+ defaultSelectedKeys?: Iterable<Key>;
2202
+ /**
2203
+ * The currently expanded keys when in controlled mode.
2204
+ */
2205
+ expandedKeys?: Iterable<Key>;
2206
+ /**
2207
+ * Handler that is called when the expanded keys change.
2208
+ */
2209
+ onExpandedChange?: (keys: Set<Key>) => void;
2210
+ /**
2211
+ * Callback that is fired when the selection changes.
2212
+ */
2213
+ onSelectionChange?: (keys: Set<Key>) => void;
2214
+ /**
2215
+ * The currently selected keys when in controlled mode.
2216
+ */
2217
+ selectedKeys?: Iterable<Key>;
2218
+ /**
2219
+ * The selection mode of the tree.
2220
+ * @default 'multiple'
2221
+ */
2222
+ selectionMode?: 'none' | 'multiple';
2223
+ };
2224
+ /**
2225
+ * A hierarchical tree with cascading multi-select and Capra ListItem row layout.
2226
+ */
2227
+ declare function Tree({ FORCE__className: classNameOverride, items, selectionMode, defaultSelectedKeys, selectedKeys, onSelectionChange, expandedKeys, defaultExpandedKeys, ...props }: TreeProps): React$2.JSX.Element;
2228
+ //#endregion
2229
+ //#region src/components/input-helpers/Label.d.ts
2230
+ type LabelProps = {
2231
+ /** Text to display in the label. */
2232
+ children?: string;
2233
+ /** Whether the field the label is labeling is required (shows asterisk after label). */
2234
+ required?: boolean;
2235
+ /** Content after the label text. */
2236
+ trailingSlot?: React$2.ReactNode;
2237
+ } & StylingOverrideProps & Omit<React$2.ComponentPropsWithoutRef<'label'>, 'className' | 'style'>;
2238
+ /** Label text and optional required indicator for form fields, aligned with Capra field layouts. */
2239
+ declare const Label: React$2.ForwardRefExoticComponent<{
2240
+ /** Text to display in the label. */
2241
+ children?: string;
2242
+ /** Whether the field the label is labeling is required (shows asterisk after label). */
2243
+ required?: boolean;
2244
+ /** Content after the label text. */
2245
+ trailingSlot?: React$2.ReactNode;
2246
+ } & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref">, "className" | "style"> & React$2.RefAttributes<HTMLLabelElement>>;
2247
+ //#endregion
2248
+ export { Alert, type AlertProps, Anchor, type AnchorProps, AutocompleteField, type AutocompleteFieldProps, Badge, BadgeLayout, type BadgeProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonLink, type ButtonLinkProps, type ButtonProps, Card, Checkbox, type CheckboxProps, Collapse, type CollapseProps, CustomTooltipTrigger, type CustomTooltipTriggerProps, DatePickerField, type DatePickerFieldProps, DateRangePickerField, type DateRangePickerFieldPlaceholder, type DateRangePickerFieldProps, Divider, type DividerProps, type DividerType, Drawer, type DrawerPlacement, type DrawerProps, EmptyState, type EmptyStateProps, IconButton, type IconButtonProps, InputRow, type InputRowAddonProps, type InputRowProps, Label, type LabelProps, Link, type LinkProps, ListItem, type ListItemProps, Menu, type MenuDividerProps, type MenuHeaderProps, type MenuItemProps, type MenuListProps, type MenuPanelPadding, type MenuProps, type MenuSectionProps, type MenuSubmenuProps, Modal, type ModalProps, NumberField, type NumberFieldProps, Pagination, type PaginationProps, PasswordField, type PasswordFieldProps, Pill, type PillProps, Popover, type PopoverProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RadioTile, type RadioTileProps, Ribbon, type RibbonProps, type RoutedLinkProps, RouterProvider, SKELETON_SIZE, SKELETON_SIZE_TOKENS, Skeleton, type SkeletonElementProps, SkeletonGroup, type SkeletonGroupButtonProps, type SkeletonGroupInputProps, type SkeletonGroupNodeProps, type SkeletonParagraphProps, type SkeletonProps, type SkeletonSize, type SkeletonTitleProps, Spinner, type SpinnerProps, type StylingOverrideProps, Switch, type SwitchProps, TabNav, type TabNavItemType, type TabNavItemVariant, type TabNavPlacement, type TabNavProps, type TabNavSubItemType, Tag, type TagColor, type TagProps, Text, TextArea, type TextAreaAutoSize, type TextAreaProps, TextField, type TextFieldProps, type TextProps, Toast, type ToastOptions, type ToastPosition, type ToastType, Tooltip, type TooltipProps, TopNav, type TopNavCenterProps, type TopNavEndProps, type TopNavProps, type TopNavStartProps, Tree, type TreeItemType, type TreeProps, VerticalNavigation, type VerticalNavigationCollapseProps, type VerticalNavigationFooterProps, type VerticalNavigationItemListProps, type VerticalNavigationItemProps, type VerticalNavigationProps, VisuallyHidden, type VisuallyHiddenProps, submenuPanelClassName, tagColors };
package/dist/index.d.mts CHANGED
@@ -1,10 +1,14 @@
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, PressEvent, 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, Key, 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
  //#region src/utils/stylingOverride.d.ts
7
7
  interface StylingOverrideProps {
8
+ /** Use `FORCE__className` instead. */
9
+ className?: never;
10
+ /** Inline styles are not supported; use component props or `FORCE__className`. */
11
+ style?: never;
8
12
  /**
9
13
  * 🚨 This prop is meant to be an escape hatch. 🚨
10
14
  *
@@ -208,7 +212,7 @@ type TextProps<As extends React$2.ElementType> = {
208
212
  * The underlying element rendered by the component. Defaults to `span`.
209
213
  */
210
214
  as?: As;
211
- } & StylingOverrideProps & Omit<React$2.ComponentPropsWithoutRef<As>, 'className'>;
215
+ } & StylingOverrideProps & React$2.ComponentPropsWithoutRef<As>;
212
216
  /**
213
217
  * Component for displaying text. The visual display can be controlled via
214
218
  * `variant`. The underlying HTML element can be controlled via the `as` prop,
@@ -228,7 +232,7 @@ declare const Text: <As extends React$2.ElementType = "span">(props: {
228
232
  * The underlying element rendered by the component. Defaults to `span`.
229
233
  */
230
234
  as?: As | undefined;
231
- } & StylingOverrideProps & Omit<React$2.PropsWithoutRef<React$2.ComponentProps<As>>, "className"> & React$2.RefAttributes<unknown>) => React$2.ReactElement;
235
+ } & StylingOverrideProps & React$2.PropsWithoutRef<React$2.ComponentProps<As>> & React$2.RefAttributes<unknown>) => React$2.ReactElement;
232
236
  //#endregion
233
237
  //#region src/components/Card/Card.d.ts
234
238
  /**
@@ -305,6 +309,8 @@ type AccessibleLabelProps = LabelledByProp | LabelProp;
305
309
  type AccessibleBadgeProps = AccessibleLabelProps & {
306
310
  'aria-live'?: React$2.AriaAttributes['aria-live'];
307
311
  };
312
+ declare const badgeSizes: readonly ['sm', 'md'];
313
+ type BadgeSize = (typeof badgeSizes)[number];
308
314
  type BadgeProps = {
309
315
  /**
310
316
  * The variant of the badge. 'counter' displays a count, 'dot' displays only a dot.
@@ -315,7 +321,12 @@ type BadgeProps = {
315
321
  * Controls the Badge color.
316
322
  * @default 'danger'
317
323
  */
318
- appearance?: 'danger' | 'info' | 'success' | 'warning';
324
+ appearance?: 'danger' | 'info' | 'success' | 'warning' | 'neutral';
325
+ /**
326
+ * Controls the Badge dimensions.
327
+ * @default 'md'
328
+ */
329
+ size?: BadgeSize;
319
330
  /**
320
331
  * The number to display in the badge. Default is 0.
321
332
  */
@@ -332,11 +343,14 @@ type BadgeProps = {
332
343
  /**
333
344
  * Badges display an indicator/counter on an associated component.
334
345
  */
335
- declare function Badge({ appearance, variant, count, showZero, overflowCount, FORCE__className, ...props }: BadgeProps): React$2.JSX.Element | null;
346
+ declare function Badge({ appearance, variant, size, count, showZero, overflowCount, FORCE__className, style, ...props }: BadgeProps): React$2.JSX.Element | null;
347
+ type BadgeLayoutProps = React$2.PropsWithChildren<{
348
+ offset?: readonly [x: number, y: number];
349
+ }>;
336
350
  /**
337
351
  * A convenience component allowing you to easily attach a badge to another component.
338
352
  */
339
- declare function BadgeLayout({ children }: React$2.PropsWithChildren): React$2.JSX.Element;
353
+ declare function BadgeLayout({ children, offset }: BadgeLayoutProps): React$2.JSX.Element;
340
354
  //#endregion
341
355
  //#region src/components/ListItem/ListItem.d.ts
342
356
  type ListItemProps<As extends React$2.ElementType> = {
@@ -345,7 +359,7 @@ type ListItemProps<As extends React$2.ElementType> = {
345
359
  declare function ListItem<As extends React$2.ElementType = 'li'>({ as: asComponent, children, FORCE__className: classNameOverride, ...props }: ListItemProps<As>): React$2.JSX.Element;
346
360
  declare namespace ListItem {
347
361
  export { Content };
348
- export { Label };
362
+ export { Label$1 as Label };
349
363
  export { Description };
350
364
  export { Suffix };
351
365
  export { Spacer };
@@ -358,7 +372,7 @@ declare const Content: ({ children, FORCE__className }: React$2.PropsWithChildre
358
372
  type ListItemLabelProps = React$2.PropsWithChildren & {
359
373
  id?: string;
360
374
  };
361
- declare const Label: ({ children, id }: ListItemLabelProps) => React$2.JSX.Element;
375
+ declare const Label$1: ({ children, id }: ListItemLabelProps) => React$2.JSX.Element;
362
376
  declare const Suffix: ({ children }: React$2.PropsWithChildren) => React$2.JSX.Element;
363
377
  declare const Description: ({ children }: React$2.PropsWithChildren) => React$2.JSX.Element;
364
378
  declare const Spacer: () => React$2.JSX.Element;
@@ -450,11 +464,11 @@ type ChildrenLabel = {
450
464
  /**
451
465
  * Require either 'aria-label', 'aria-labelledby', or 'children' for accessibility
452
466
  */
453
- type LabelProps = AccessibleLabelProps | ChildrenLabel;
467
+ type LabelProps$1 = AccessibleLabelProps | ChildrenLabel;
454
468
  type RadioProps = {
455
469
  /** The value of the radio button. */
456
470
  value: string | null;
457
- } & Partial<RadioGroupContextValue> & LabelProps & StylingOverrideProps & Omit<React$2.ComponentPropsWithoutRef<'input'>, 'className' | 'type'>;
471
+ } & Partial<RadioGroupContextValue> & LabelProps$1 & StylingOverrideProps & Omit<React$2.ComponentPropsWithoutRef<'input'>, 'className' | 'type'>;
458
472
  /**
459
473
  * A presentational radio button component. You will typically use this component within a RadioGroup component.
460
474
  */
@@ -1324,7 +1338,7 @@ declare const Link: <As extends React$2.ElementType = "a">(props: {
1324
1338
  } & RoutedLinkProps & StylingOverrideProps & Omit<React$2.PropsWithoutRef<React$2.ComponentProps<As>>, "className"> & React$2.RefAttributes<unknown>) => React$2.ReactElement;
1325
1339
  //#endregion
1326
1340
  //#region src/components/VerticalNavigation/VerticalNavigation.d.ts
1327
- interface VerticalNavigationProps extends React$2.HTMLAttributes<HTMLElement>, StylingOverrideProps {
1341
+ type VerticalNavigationProps = React$2.HTMLAttributes<HTMLElement> & StylingOverrideProps & {
1328
1342
  /**
1329
1343
  * Controlled collapsed state.
1330
1344
  */
@@ -1338,7 +1352,7 @@ interface VerticalNavigationProps extends React$2.HTMLAttributes<HTMLElement>, S
1338
1352
  * @default false
1339
1353
  */
1340
1354
  defaultCollapsed?: boolean;
1341
- }
1355
+ };
1342
1356
  type VerticalNavigationItemBaseProps<As extends React$2.ElementType> = Omit<React$2.ComponentPropsWithoutRef<As>, 'className' | 'as' | 'href' | 'isActive' | 'isDisabled' | 'rightElement' | 'label'> & StylingOverrideProps & {
1343
1357
  /**
1344
1358
  * The component to use for the item. Default is either 'a' or 'button' based on the presence of the href prop.
@@ -1391,19 +1405,19 @@ type VerticalNavigationItemProps<As extends React$2.ElementType> = VerticalNavig
1391
1405
  * Supports icons, active state, and 'subItem' variant for indentation.
1392
1406
  */
1393
1407
  declare const Item: <As extends React$2.ElementType>({ as, icon, label, isActive, href, FORCE__className, isDisabled, onClick, variant, rightElement, ...props }: VerticalNavigationItemProps<As>) => React$2.JSX.Element;
1394
- interface VerticalNavigationCollapseProps extends React$2.ButtonHTMLAttributes<HTMLButtonElement>, StylingOverrideProps {}
1408
+ type VerticalNavigationCollapseProps = React$2.ButtonHTMLAttributes<HTMLButtonElement> & StylingOverrideProps;
1395
1409
  /**
1396
1410
  * A toggle button to collapse/expand the navigation.
1397
1411
  * Should be placed within VerticalNavigation to control its state.
1398
1412
  */
1399
1413
  declare const Collapse$1: ({ FORCE__className, onClick, ...props }: VerticalNavigationCollapseProps) => React$2.JSX.Element;
1400
- interface VerticalNavigationItemListProps extends React$2.HTMLAttributes<HTMLUListElement>, StylingOverrideProps {}
1414
+ type VerticalNavigationItemListProps = React$2.HTMLAttributes<HTMLUListElement> & StylingOverrideProps;
1401
1415
  /**
1402
1416
  * Container for the primary list of navigation items.
1403
1417
  * Renders an unordered list with consistent spacing and layout.
1404
1418
  */
1405
1419
  declare const ItemList: ({ children, FORCE__className, ...props }: VerticalNavigationItemListProps) => React$2.JSX.Element;
1406
- interface VerticalNavigationFooterProps extends React$2.HTMLAttributes<HTMLUListElement>, StylingOverrideProps {}
1420
+ type VerticalNavigationFooterProps = React$2.HTMLAttributes<HTMLUListElement> & StylingOverrideProps;
1407
1421
  /**
1408
1422
  * Secondary container for footer navigation actions such as settings or help.
1409
1423
  */
@@ -1588,7 +1602,7 @@ type SkeletonProps = {
1588
1602
  * (`title={false}` and `paragraph={false}`) children render inside the placeholder while loading.
1589
1603
  */
1590
1604
  children?: React$2.ReactNode;
1591
- } & StylingOverrideProps & Omit<React$2.HTMLAttributes<HTMLSpanElement>, 'children' | 'title' | 'paragraph'>;
1605
+ } & Omit<StylingOverrideProps, 'style'> & Omit<React$2.HTMLAttributes<HTMLSpanElement>, 'children' | 'title' | 'paragraph' | 'className'>;
1592
1606
  declare function Skeleton(props: SkeletonProps): React$2.JSX.Element | null;
1593
1607
  declare namespace Skeleton {
1594
1608
  var displayName: string;
@@ -1610,7 +1624,7 @@ type SkeletonElementProps = {
1610
1624
  size?: SkeletonSize;
1611
1625
  /** Show animation effect. @default false */
1612
1626
  active?: boolean;
1613
- } & StylingOverrideProps & Omit<React$2.HTMLAttributes<HTMLSpanElement>, 'children'>;
1627
+ } & Omit<StylingOverrideProps, 'style'> & Omit<React$2.HTMLAttributes<HTMLSpanElement>, 'children' | 'className' | 'style'>;
1614
1628
  type SkeletonGroupButtonProps = SkeletonElementProps & {
1615
1629
  block?: boolean;
1616
1630
  shape?: 'circle' | 'round' | 'square' | 'default';
@@ -1810,12 +1824,12 @@ type MenuSectionProps = StylingOverrideProps & Omit<React$2.HTMLAttributes<HTMLD
1810
1824
  */
1811
1825
  children?: React$2.ReactNode;
1812
1826
  };
1813
- interface MenuListProps extends StylingOverrideProps, React$2.HTMLAttributes<HTMLDivElement> {
1827
+ type MenuListProps = StylingOverrideProps & React$2.HTMLAttributes<HTMLDivElement> & {
1814
1828
  /**
1815
1829
  * Menu content. Use Menu.Item, Menu.Section, Menu.Header, Menu.Divider.
1816
1830
  */
1817
1831
  children?: React$2.ReactNode;
1818
- }
1832
+ };
1819
1833
  interface MenuSubmenuProps extends StylingOverrideProps {
1820
1834
  /**
1821
1835
  * Label for the parent row (trailing chevron indicates a nested panel).
@@ -2133,4 +2147,102 @@ type CustomTooltipTriggerProps = {
2133
2147
  */
2134
2148
  declare const CustomTooltipTrigger: React$2.ForwardRefExoticComponent<CustomTooltipTriggerProps & React$2.RefAttributes<HTMLElement>>;
2135
2149
  //#endregion
2136
- export { Alert, type AlertProps, Anchor, type AnchorProps, AutocompleteField, type AutocompleteFieldProps, Badge, BadgeLayout, type BadgeProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonLink, type ButtonLinkProps, type ButtonProps, Card, Checkbox, type CheckboxProps, Collapse, type CollapseProps, CustomTooltipTrigger, type CustomTooltipTriggerProps, DatePickerField, type DatePickerFieldProps, DateRangePickerField, type DateRangePickerFieldPlaceholder, type DateRangePickerFieldProps, Divider, type DividerProps, type DividerType, Drawer, type DrawerPlacement, type DrawerProps, EmptyState, type EmptyStateProps, IconButton, type IconButtonProps, InputRow, type InputRowAddonProps, type InputRowProps, Link, type LinkProps, ListItem, type ListItemProps, Menu, type MenuDividerProps, type MenuHeaderProps, type MenuItemProps, type MenuListProps, type MenuPanelPadding, type MenuProps, type MenuSectionProps, type MenuSubmenuProps, Modal, type ModalProps, NumberField, type NumberFieldProps, Pagination, type PaginationProps, PasswordField, type PasswordFieldProps, Pill, type PillProps, Popover, type PopoverProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RadioTile, type RadioTileProps, Ribbon, type RibbonProps, type RoutedLinkProps, RouterProvider, SKELETON_SIZE, SKELETON_SIZE_TOKENS, Skeleton, type SkeletonElementProps, SkeletonGroup, type SkeletonGroupButtonProps, type SkeletonGroupInputProps, type SkeletonGroupNodeProps, type SkeletonParagraphProps, type SkeletonProps, type SkeletonSize, type SkeletonTitleProps, Spinner, type SpinnerProps, type StylingOverrideProps, Switch, type SwitchProps, TabNav, type TabNavItemType, type TabNavItemVariant, type TabNavPlacement, type TabNavProps, type TabNavSubItemType, Tag, type TagColor, type TagProps, Text, TextArea, type TextAreaAutoSize, type TextAreaProps, TextField, type TextFieldProps, type TextProps, Toast, type ToastOptions, type ToastPosition, type ToastType, Tooltip, type TooltipProps, TopNav, type TopNavCenterProps, type TopNavEndProps, type TopNavProps, type TopNavStartProps, VerticalNavigation, type VerticalNavigationCollapseProps, type VerticalNavigationFooterProps, type VerticalNavigationItemListProps, type VerticalNavigationItemProps, type VerticalNavigationProps, VisuallyHidden, type VisuallyHiddenProps, submenuPanelClassName, tagColors };
2150
+ //#region src/components/Tree/Tree.d.ts
2151
+ interface TreeItemType {
2152
+ /**
2153
+ * The unique key of the tree item.
2154
+ */
2155
+ key: Key;
2156
+ /**
2157
+ * The label of the tree item.
2158
+ */
2159
+ label: React$2.ReactNode;
2160
+ /**
2161
+ * The children of the tree item.
2162
+ */
2163
+ children?: TreeItemType[];
2164
+ /**
2165
+ * Whether the tree item is disabled.
2166
+ */
2167
+ isDisabled?: boolean;
2168
+ /**
2169
+ * The suffix of the tree item.
2170
+ */
2171
+ suffix?: React$2.ReactNode;
2172
+ /**
2173
+ * The trailing slot of the tree item.
2174
+ */
2175
+ trailingSlot?: React$2.ReactNode;
2176
+ }
2177
+ type TreeProps = StylingOverrideProps & {
2178
+ /**
2179
+ * Defines a string value that labels the current element.
2180
+ */
2181
+ 'aria-label'?: string;
2182
+ /**
2183
+ * Identifies the element (or elements) that labels the current element.
2184
+ */
2185
+ 'aria-labelledby'?: string;
2186
+ /**
2187
+ * Items to render in the tree.
2188
+ */
2189
+ items: TreeItemType[];
2190
+ /**
2191
+ * Handler that is called when a user performs an action on an item.
2192
+ */
2193
+ onAction?: (key: Key) => void;
2194
+ /**
2195
+ * The initial expanded keys when in uncontrolled mode.
2196
+ */
2197
+ defaultExpandedKeys?: Iterable<Key>;
2198
+ /**
2199
+ * The initial selected keys when in uncontrolled mode.
2200
+ */
2201
+ defaultSelectedKeys?: Iterable<Key>;
2202
+ /**
2203
+ * The currently expanded keys when in controlled mode.
2204
+ */
2205
+ expandedKeys?: Iterable<Key>;
2206
+ /**
2207
+ * Handler that is called when the expanded keys change.
2208
+ */
2209
+ onExpandedChange?: (keys: Set<Key>) => void;
2210
+ /**
2211
+ * Callback that is fired when the selection changes.
2212
+ */
2213
+ onSelectionChange?: (keys: Set<Key>) => void;
2214
+ /**
2215
+ * The currently selected keys when in controlled mode.
2216
+ */
2217
+ selectedKeys?: Iterable<Key>;
2218
+ /**
2219
+ * The selection mode of the tree.
2220
+ * @default 'multiple'
2221
+ */
2222
+ selectionMode?: 'none' | 'multiple';
2223
+ };
2224
+ /**
2225
+ * A hierarchical tree with cascading multi-select and Capra ListItem row layout.
2226
+ */
2227
+ declare function Tree({ FORCE__className: classNameOverride, items, selectionMode, defaultSelectedKeys, selectedKeys, onSelectionChange, expandedKeys, defaultExpandedKeys, ...props }: TreeProps): React$2.JSX.Element;
2228
+ //#endregion
2229
+ //#region src/components/input-helpers/Label.d.ts
2230
+ type LabelProps = {
2231
+ /** Text to display in the label. */
2232
+ children?: string;
2233
+ /** Whether the field the label is labeling is required (shows asterisk after label). */
2234
+ required?: boolean;
2235
+ /** Content after the label text. */
2236
+ trailingSlot?: React$2.ReactNode;
2237
+ } & StylingOverrideProps & Omit<React$2.ComponentPropsWithoutRef<'label'>, 'className' | 'style'>;
2238
+ /** Label text and optional required indicator for form fields, aligned with Capra field layouts. */
2239
+ declare const Label: React$2.ForwardRefExoticComponent<{
2240
+ /** Text to display in the label. */
2241
+ children?: string;
2242
+ /** Whether the field the label is labeling is required (shows asterisk after label). */
2243
+ required?: boolean;
2244
+ /** Content after the label text. */
2245
+ trailingSlot?: React$2.ReactNode;
2246
+ } & StylingOverrideProps & Omit<Omit<React$2.DetailedHTMLProps<React$2.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref">, "className" | "style"> & React$2.RefAttributes<HTMLLabelElement>>;
2247
+ //#endregion
2248
+ export { Alert, type AlertProps, Anchor, type AnchorProps, AutocompleteField, type AutocompleteFieldProps, Badge, BadgeLayout, type BadgeProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonLink, type ButtonLinkProps, type ButtonProps, Card, Checkbox, type CheckboxProps, Collapse, type CollapseProps, CustomTooltipTrigger, type CustomTooltipTriggerProps, DatePickerField, type DatePickerFieldProps, DateRangePickerField, type DateRangePickerFieldPlaceholder, type DateRangePickerFieldProps, Divider, type DividerProps, type DividerType, Drawer, type DrawerPlacement, type DrawerProps, EmptyState, type EmptyStateProps, IconButton, type IconButtonProps, InputRow, type InputRowAddonProps, type InputRowProps, Label, type LabelProps, Link, type LinkProps, ListItem, type ListItemProps, Menu, type MenuDividerProps, type MenuHeaderProps, type MenuItemProps, type MenuListProps, type MenuPanelPadding, type MenuProps, type MenuSectionProps, type MenuSubmenuProps, Modal, type ModalProps, NumberField, type NumberFieldProps, Pagination, type PaginationProps, PasswordField, type PasswordFieldProps, Pill, type PillProps, Popover, type PopoverProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RadioTile, type RadioTileProps, Ribbon, type RibbonProps, type RoutedLinkProps, RouterProvider, SKELETON_SIZE, SKELETON_SIZE_TOKENS, Skeleton, type SkeletonElementProps, SkeletonGroup, type SkeletonGroupButtonProps, type SkeletonGroupInputProps, type SkeletonGroupNodeProps, type SkeletonParagraphProps, type SkeletonProps, type SkeletonSize, type SkeletonTitleProps, Spinner, type SpinnerProps, type StylingOverrideProps, Switch, type SwitchProps, TabNav, type TabNavItemType, type TabNavItemVariant, type TabNavPlacement, type TabNavProps, type TabNavSubItemType, Tag, type TagColor, type TagProps, Text, TextArea, type TextAreaAutoSize, type TextAreaProps, TextField, type TextFieldProps, type TextProps, Toast, type ToastOptions, type ToastPosition, type ToastType, Tooltip, type TooltipProps, TopNav, type TopNavCenterProps, type TopNavEndProps, type TopNavProps, type TopNavStartProps, Tree, type TreeItemType, type TreeProps, VerticalNavigation, type VerticalNavigationCollapseProps, type VerticalNavigationFooterProps, type VerticalNavigationItemListProps, type VerticalNavigationItemProps, type VerticalNavigationProps, VisuallyHidden, type VisuallyHiddenProps, submenuPanelClassName, tagColors };