@deque/cauldron-react 7.2.0 → 7.3.0-canary.588f1404

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.
@@ -1,19 +1,27 @@
1
1
  import React from 'react';
2
2
  import type { onActionCallbackFunction } from '../ActionList/ActionListContext';
3
+ import AnchoredOverlay from '../AnchoredOverlay';
3
4
  interface ActionMenuListProps {
4
5
  ref?: React.Ref<HTMLElement>;
5
6
  onAction?: onActionCallbackFunction;
6
7
  [key: string]: unknown;
7
8
  }
8
- type ActionMenuTriggerProps = Pick<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'onClick' | 'onKeyDown' | 'aria-expanded' | 'aria-haspopup' | 'aria-controls'> & {
9
- ref: React.RefObject<HTMLButtonElement | null>;
9
+ /**
10
+ * Props passed to an `ActionMenu` trigger render function. The element type
11
+ * defaults to `HTMLButtonElement`; annotate it (e.g. `ActionMenuTriggerProps<HTMLLIElement>`)
12
+ * when the trigger is not a button — for example a `MenuItem`/`TopBarItem`
13
+ * (`<li>`) in the documented `TopBar`/`MenuBar` nesting — so the `ref` and
14
+ * spread handlers type against the actual element without casts.
15
+ */
16
+ export type ActionMenuTriggerProps<E extends HTMLElement = HTMLButtonElement> = Pick<React.HTMLAttributes<E>, 'children' | 'id' | 'onClick' | 'onKeyDown' | 'aria-expanded' | 'aria-haspopup' | 'aria-controls'> & {
17
+ ref: React.RefObject<E | null>;
10
18
  };
11
- type ActionMenuTriggerFunction = (props: ActionMenuTriggerProps, open: boolean) => React.ReactElement;
12
- declare const ActionMenu: React.ForwardRefExoticComponent<{
19
+ export type ActionMenuTriggerFunction<E extends HTMLElement = HTMLButtonElement> = (props: ActionMenuTriggerProps<E>, open: boolean) => React.ReactElement;
20
+ type ActionMenuProps<E extends HTMLElement = HTMLButtonElement> = {
13
21
  children: React.ReactElement<ActionMenuListProps>;
14
- trigger: React.ReactElement | ActionMenuTriggerFunction;
22
+ trigger: React.ReactElement | ActionMenuTriggerFunction<E>;
15
23
  /** Render the action menu in a different location in the dom. */
16
- portal?: HTMLElement | React.RefObject<HTMLElement | null> | undefined;
24
+ portal?: React.RefObject<HTMLElement | null> | HTMLElement;
17
25
  /**
18
26
  * Controls whether the menu should render as a child of the trigger, as opposed to
19
27
  * rendering as a sibling. Intended for use with nested menu patterns, for example
@@ -21,25 +29,17 @@ declare const ActionMenu: React.ForwardRefExoticComponent<{
21
29
  *
22
30
  * Only supported if trigger is a function *and* portal is undefined.
23
31
  */
24
- renderInTrigger?: boolean | undefined;
25
- } & Pick<{
26
- target: HTMLElement | React.RefObject<HTMLElement | null> | React.MutableRefObject<HTMLElement | null>;
27
- placement?: "auto" | import("@floating-ui/dom").Placement | "auto-start" | "auto-end" | undefined;
28
- open?: boolean | undefined;
29
- onOpenChange?: ((open: boolean) => void) | undefined;
30
- onPlacementChange?: ((placement: import("@floating-ui/dom").Placement) => void) | undefined;
31
- onShiftChange?: ((coords: import("@floating-ui/dom").Coords) => void) | undefined;
32
- offset?: number | undefined;
33
- focusTrap?: boolean | undefined;
34
- focusTrapOptions?: {
35
- disabled?: boolean | undefined;
36
- initialFocusElement?: import("../../types").ElementOrRef<HTMLElement> | undefined;
37
- returnFocus?: boolean | undefined;
38
- returnFocusElement?: import("../../types").ElementOrRef<HTMLElement> | undefined;
39
- } | undefined;
40
- portal?: HTMLElement | React.RefObject<HTMLElement | null> | undefined;
41
- children?: React.ReactNode;
42
- } & React.HTMLAttributes<HTMLElement> & {
43
- as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
44
- } & React.RefAttributes<HTMLElement>, "placement"> & React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;
32
+ renderInTrigger?: boolean;
33
+ } & Pick<React.ComponentProps<typeof AnchoredOverlay>, 'placement'> & React.HTMLAttributes<HTMLElement>;
34
+ /**
35
+ * The trigger element type is parameterized (defaulting to `HTMLButtonElement`)
36
+ * so it can be widened for nested menu patterns where the trigger is not a
37
+ * button e.g. a `MenuItem`/`TopBarItem` (`<li>`) inside a `TopBar`/`MenuBar`.
38
+ * This only widens the public types of the `trigger` function; the internal
39
+ * implementation is unaffected. See the ActionMenu docs for a usage example.
40
+ */
41
+ type ActionMenuType = Omit<React.ForwardRefExoticComponent<ActionMenuProps>, keyof CallableFunction> & {
42
+ <E extends HTMLElement = HTMLButtonElement>(props: ActionMenuProps<E> & React.RefAttributes<HTMLElement>): React.ReactElement;
43
+ };
44
+ declare const ActionMenu: ActionMenuType;
45
45
  export default ActionMenu;
@@ -1 +1,2 @@
1
1
  export { default as ActionMenu } from './ActionMenu';
2
+ export type { ActionMenuTriggerProps, ActionMenuTriggerFunction } from './ActionMenu';
@@ -2,6 +2,6 @@
2
2
  * GENERATED CODE. DO NOT EDIT DIRECTLY!
3
3
  */
4
4
  /** IconType represents each valid icon type. */
5
- export type IconType = 'add-user' | 'arrow-circle-up' | 'arrow-circle-down' | 'arrow-circle-left' | 'arrow-circle-right' | 'arrow-up' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrows-alt' | 'bolt' | 'broken-image' | 'caution' | 'check-circle' | 'check-shield' | 'check-solid' | 'check' | 'checkbox-checked' | 'checkbox-unchecked' | 'chevron-double-up' | 'chevron-double-down' | 'chevron-double-left' | 'chevron-double-right' | 'chevron-up' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'clipboard' | 'clock' | 'close' | 'code' | 'copy' | 'download' | 'dropper' | 'exchange' | 'export-solid' | 'external-link' | 'eye' | 'filter' | 'flag' | 'gears' | 'github' | 'grid' | 'hamburger-menu' | 'hashtag' | 'highlight' | 'images' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'link' | 'linkedin' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'minus' | 'new-releases' | 'new' | 'no' | 'pause' | 'pencil' | 'person-running' | 'play' | 'plus' | 'question-circle-alt' | 'question-circle' | 'radio-checked' | 'radio-unchecked' | 'recycle-square' | 'recycle' | 'resend' | 'robot' | 'run-again' | 'save' | 'share-nodes' | 'share' | 'sort-triangle' | 'sort' | 'star-outline' | 'star' | 'step-back' | 'step-forward' | 'sun' | 'table-sort-ascending' | 'table-sort-descending' | 'tag' | 'target' | 'trash' | 'triangle-up' | 'triangle-down' | 'triangle-left' | 'triangle-right' | 'twitter' | 'upload' | 'filter-solid';
5
+ export type IconType = 'add-user' | 'arrow-circle-up' | 'arrow-circle-down' | 'arrow-circle-left' | 'arrow-circle-right' | 'arrow-up' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrows-alt' | 'bolt' | 'broken-image' | 'caution' | 'check-circle' | 'check-shield' | 'check-solid' | 'check' | 'checkbox-checked' | 'checkbox-unchecked' | 'chevron-double-up' | 'chevron-double-down' | 'chevron-double-left' | 'chevron-double-right' | 'chevron-up' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'clipboard' | 'clock' | 'close' | 'code' | 'copy' | 'download' | 'dropper' | 'exchange' | 'export-solid' | 'external-link' | 'eye' | 'filter' | 'flag' | 'gears' | 'github' | 'grid' | 'hamburger-menu' | 'hashtag' | 'highlight' | 'images' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'link' | 'linkedin' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'minus' | 'new-releases' | 'new' | 'no' | 'pause' | 'pencil' | 'person-running' | 'play' | 'plus' | 'question-circle-alt' | 'question-circle' | 'radio-checked' | 'radio-unchecked' | 'recycle-square' | 'recycle' | 'report' | 'resend' | 'robot' | 'run-again' | 'save' | 'share-nodes' | 'share' | 'sort-triangle' | 'sort' | 'star-outline' | 'star' | 'step-back' | 'step-forward' | 'sun' | 'table-sort-ascending' | 'table-sort-descending' | 'tag' | 'target' | 'trash' | 'triangle-up' | 'triangle-down' | 'triangle-left' | 'triangle-right' | 'twitter' | 'upload' | 'filter-solid';
6
6
  /** iconTypes holds each valid icon type. */
7
7
  export declare const iconTypes: string[];
@@ -0,0 +1,11 @@
1
+ import React, { type ComponentPropsWithRef } from 'react';
2
+ export type MetadataListProps = {
3
+ orientation?: 'vertical' | 'horizontal';
4
+ } & ComponentPropsWithRef<'dl'>;
5
+ export declare const MetadataList: React.ForwardRefExoticComponent<Omit<MetadataListProps, "ref"> & React.RefAttributes<HTMLDListElement>>;
6
+ export type MetadataListItemProps = ComponentPropsWithRef<'div'>;
7
+ export declare const MetadataListItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ export type MetadataListLabelProps = ComponentPropsWithRef<'dt'>;
9
+ export declare const MetadataListLabel: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
10
+ export type MetadataListValueProps = ComponentPropsWithRef<'dd'>;
11
+ export declare const MetadataListValue: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
@@ -5,6 +5,7 @@ declare const iconTypeMap: {
5
5
  caution: string;
6
6
  danger: string;
7
7
  info: string;
8
+ success: string;
8
9
  };
9
10
  export interface NoticeProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
10
11
  type?: keyof typeof iconTypeMap;
package/lib/index.d.ts CHANGED
@@ -44,6 +44,7 @@ export { default as TagButton } from './components/TagButton';
44
44
  export { default as Table, TableBody, TableCell, TableHead, TableHeader, TableRow, TableFooter } from './components/Table';
45
45
  export { default as Tabs, Tab, TabPanel } from './components/Tabs';
46
46
  export { DescriptionList, DescriptionListItem, DescriptionTerm, DescriptionDetails } from './components/DescriptionList';
47
+ export { MetadataList, MetadataListItem, MetadataListLabel, MetadataListValue } from './components/MetadataList';
47
48
  export { default as Stepper, Step } from './components/Stepper';
48
49
  export { default as Panel, PanelHeader, PanelContent } from './components/Panel';
49
50
  export { default as ProgressBar } from './components/ProgressBar';
@@ -67,7 +68,7 @@ export { default as PageHeader } from './components/PageHeader';
67
68
  export { default as SectionHeader } from './components/SectionHeader';
68
69
  export { default as EmptyState } from './components/EmptyState';
69
70
  export { ActionList, ActionListItem, ActionListGroup, ActionListSeparator, ActionListLinkItem } from './components/ActionList';
70
- export { ActionMenu } from './components/ActionMenu';
71
+ export { ActionMenu, type ActionMenuTriggerProps, type ActionMenuTriggerFunction } from './components/ActionMenu';
71
72
  export { default as TreeView, type TreeViewNode } from './components/TreeView';
72
73
  /**
73
74
  * Helpers / Utils
package/lib/index.js CHANGED
@@ -177,6 +177,7 @@ var iconTypes = [
177
177
  'radio-unchecked',
178
178
  'recycle-square',
179
179
  'recycle',
180
+ 'report',
180
181
  'resend',
181
182
  'robot',
182
183
  'run-again',
@@ -266,6 +267,7 @@ function __variableDynamicImportRuntime0__(path) {
266
267
  case './icons/radio-unchecked.svg': return Promise.resolve().then(function () { return require('./radio-unchecked.js'); });
267
268
  case './icons/recycle-square.svg': return Promise.resolve().then(function () { return require('./recycle-square.js'); });
268
269
  case './icons/recycle.svg': return Promise.resolve().then(function () { return require('./recycle.js'); });
270
+ case './icons/report.svg': return Promise.resolve().then(function () { return require('./report.js'); });
269
271
  case './icons/resend.svg': return Promise.resolve().then(function () { return require('./resend.js'); });
270
272
  case './icons/robot.svg': return Promise.resolve().then(function () { return require('./robot.js'); });
271
273
  case './icons/run-again.svg': return Promise.resolve().then(function () { return require('./run-again.js'); });
@@ -3366,6 +3368,27 @@ var DescriptionDetails = function (_a) {
3366
3368
  };
3367
3369
  DescriptionDetails.displayName = 'DescriptionDetails';
3368
3370
 
3371
+ var MetadataList = React.forwardRef(function (_a, ref) {
3372
+ var _b = _a.orientation, orientation = _b === void 0 ? 'horizontal' : _b, className = _a.className, children = _a.children, rest = tslib.__rest(_a, ["orientation", "className", "children"]);
3373
+ return (React__default["default"].createElement("dl", tslib.__assign({ className: classNames__default["default"]('MetadataList', "MetadataList--".concat(orientation), className), ref: ref }, rest), children));
3374
+ });
3375
+ MetadataList.displayName = 'MetadataList';
3376
+ var MetadataListItem = React.forwardRef(function (_a, ref) {
3377
+ var className = _a.className, children = _a.children, rest = tslib.__rest(_a, ["className", "children"]);
3378
+ return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"]('MetadataList__item', className), ref: ref }, rest), children));
3379
+ });
3380
+ MetadataListItem.displayName = 'MetadataListItem';
3381
+ var MetadataListLabel = React.forwardRef(function (_a, ref) {
3382
+ var className = _a.className, children = _a.children, rest = tslib.__rest(_a, ["className", "children"]);
3383
+ return (React__default["default"].createElement("dt", tslib.__assign({ className: classNames__default["default"]('MetadataList__label', className), ref: ref }, rest), children));
3384
+ });
3385
+ MetadataListLabel.displayName = 'MetadataListLabel';
3386
+ var MetadataListValue = React.forwardRef(function (_a, ref) {
3387
+ var className = _a.className, children = _a.children, rest = tslib.__rest(_a, ["className", "children"]);
3388
+ return (React__default["default"].createElement("dd", tslib.__assign({ className: classNames__default["default"]('MetadataList__value', className), ref: ref }, rest), children));
3389
+ });
3390
+ MetadataListValue.displayName = 'MetadataListValue';
3391
+
3369
3392
  var isTooltipProps = function (props) {
3370
3393
  return !!props.tooltip;
3371
3394
  };
@@ -3695,8 +3718,9 @@ ColumnList.displayName = 'ColumnList';
3695
3718
 
3696
3719
  var iconTypeMap = {
3697
3720
  caution: 'caution',
3698
- danger: 'caution',
3699
- info: 'info-circle'
3721
+ danger: 'report',
3722
+ info: 'info-circle',
3723
+ success: 'check-circle'
3700
3724
  };
3701
3725
  var Notice = React.forwardRef(function (_a, ref) {
3702
3726
  var _b;
@@ -5309,7 +5333,7 @@ var ActionListLinkItem = React.forwardRef(function (_a, ref) {
5309
5333
  ActionListLinkItem.displayName = 'ActionListLinkItem';
5310
5334
 
5311
5335
  var _a = tslib.__read(['ArrowDown', 'ArrowUp'], 2), ArrowDown = _a[0], ArrowUp = _a[1];
5312
- var ActionMenu = React.forwardRef(function (_a, ref) {
5336
+ var ActionMenuComponent = React.forwardRef(function (_a, ref) {
5313
5337
  var className = _a.className, style = _a.style, trigger = _a.trigger, _b = _a.placement, placement = _b === void 0 ? 'bottom-start' : _b, actionMenuList = _a.children, portal = _a.portal, _c = _a.renderInTrigger, renderInTrigger = _c === void 0 ? false : _c, props = tslib.__rest(_a, ["className", "style", "trigger", "placement", "children", "portal", "renderInTrigger"]);
5314
5338
  var _d = tslib.__read(React.useState(false), 2), open = _d[0], setOpen = _d[1];
5315
5339
  var _e = tslib.__read(React.useState('first'), 2), focusStrategy = _e[0], setFocusStrategy = _e[1];
@@ -5427,7 +5451,8 @@ var ActionMenu = React.forwardRef(function (_a, ref) {
5427
5451
  React__default["default"].createElement(ClickOutsideListener$1, { onClickOutside: handleClickOutside, mouseEvent: open ? undefined : false, touchEvent: open ? undefined : false, target: triggerProps.ref }, actionMenuTrigger),
5428
5452
  renderInTrigger ? null : overlay));
5429
5453
  });
5430
- ActionMenu.displayName = 'ActionMenu';
5454
+ ActionMenuComponent.displayName = 'ActionMenu';
5455
+ var ActionMenu = ActionMenuComponent;
5431
5456
 
5432
5457
  var TreeViewItem = function (_a) {
5433
5458
  var id = _a.id, textValue = _a.textValue, children = _a.children;
@@ -5625,7 +5650,7 @@ var ThemeProvider = function (_a) {
5625
5650
  // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
5626
5651
  _b = _a.context,
5627
5652
  // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
5628
- context = _b === void 0 ? document === null || document === void 0 ? void 0 : document.body : _b, _c = _a.initialTheme, initialTheme = _c === void 0 ? 'light' : _c;
5653
+ context = _b === void 0 ? typeof document !== 'undefined' ? document.body : undefined : _b, _c = _a.initialTheme, initialTheme = _c === void 0 ? 'light' : _c;
5629
5654
  var _d = tslib.__read(React.useState(initialTheme), 2), theme = _d[0], setTheme = _d[1];
5630
5655
  var getThemeFromContext = function () {
5631
5656
  return (context === null || context === void 0 ? void 0 : context.classList.contains(DARK_THEME_CLASS)) ? 'dark' : 'light';
@@ -5744,6 +5769,10 @@ exports.LoaderOverlay = LoaderOverlay;
5744
5769
  exports.Main = Main;
5745
5770
  exports.MenuBar = TopBar$1;
5746
5771
  exports.MenuItem = MenuItem;
5772
+ exports.MetadataList = MetadataList;
5773
+ exports.MetadataListItem = MetadataListItem;
5774
+ exports.MetadataListLabel = MetadataListLabel;
5775
+ exports.MetadataListValue = MetadataListValue;
5747
5776
  exports.Modal = Modal;
5748
5777
  exports.ModalCloseButton = ModalCloseButton;
5749
5778
  exports.ModalContent = ModalContent;
package/lib/report.js ADDED
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule) return e;
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n["default"] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
24
+
25
+ var _path;
26
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
27
+ const SvgReport = props => /*#__PURE__*/React__namespace.createElement("svg", _extends({
28
+ viewBox: "0 -960 960 960",
29
+ fill: "currentColor",
30
+ height: 24,
31
+ width: 24
32
+ }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
33
+ d: "M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240ZM330-120 120-330v-300l210-210h300l210 210v300L630-120H330Z"
34
+ })));
35
+
36
+ exports["default"] = SvgReport;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "7.2.0",
3
+ "version": "7.3.0-canary.588f1404",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",
@@ -25,6 +25,7 @@
25
25
  "tslib": "^2.4.0"
26
26
  },
27
27
  "devDependencies": {
28
+ "@arethetypeswrong/cli": "^0.18.4",
28
29
  "@babel/core": "^7.29.7",
29
30
  "@babel/plugin-proposal-export-default-from": "^7.29.7",
30
31
  "@babel/preset-env": "^7.29.7",
@@ -60,6 +61,7 @@
60
61
  "postcss-import": "^16.1.1",
61
62
  "postcss-loader": "^8.2.1",
62
63
  "prop-types": "^15.8.1",
64
+ "publint": "^0.3.21",
63
65
  "react": "^19",
64
66
  "react-dom": "^19",
65
67
  "rollup": "^2.23.0",
@@ -81,6 +83,7 @@
81
83
  "build:lib": "rollup -c",
82
84
  "build:css": "postcss --output=lib/cauldron.css src/index.css",
83
85
  "typecheck": "tsc --noEmit --skipLibCheck",
86
+ "verify:packaging": "pnpm build && node scripts/verifyPackaging.js",
84
87
  "dev": "concurrently 'pnpm build:css --watch' 'rollup -c --watch'",
85
88
  "test": "jest --maxWorkers=1 --coverage",
86
89
  "figma:parse": "figma connect parse",