@deque/cauldron-react 6.16.0-canary.e69e3805 → 6.16.0-canary.edbb1fd9
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/lib/components/AnchoredOverlay/index.d.ts +3 -1
- package/lib/components/EmptyState/index.d.ts +13 -0
- package/lib/components/FieldGroup/index.d.ts +9 -0
- package/lib/components/PageHeader/index.d.ts +8 -0
- package/lib/components/SectionHeader/index.d.ts +7 -0
- package/lib/components/Stepper/index.d.ts +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.js +92 -7
- package/package.json +1 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Placement } from '@floating-ui/dom';
|
|
1
|
+
import { type Placement, type Coords } from '@floating-ui/dom';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import useFocusTrap from '../../utils/useFocusTrap';
|
|
4
4
|
declare const AnchoredOverlay: React.ForwardRefExoticComponent<{
|
|
@@ -12,6 +12,8 @@ declare const AnchoredOverlay: React.ForwardRefExoticComponent<{
|
|
|
12
12
|
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
13
13
|
/** A callback function that is called when the placement of the overlay changes. */
|
|
14
14
|
onPlacementChange?: ((placement: Placement) => void) | undefined;
|
|
15
|
+
/** A callback function that is called when the shift of the overlay changes. */
|
|
16
|
+
onShiftChange?: ((coords: Coords) => void) | undefined;
|
|
15
17
|
/** An optional offset number to position the anchor element from its anchored target. */
|
|
16
18
|
offset?: number | undefined;
|
|
17
19
|
/** When set, traps focus within the AnchoredOverlay. */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface EmptyStateProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Heading text to be displayed for the empty state. */
|
|
4
|
+
heading: React.ReactNode;
|
|
5
|
+
/** Description for the empty state. */
|
|
6
|
+
description: React.ReactNode;
|
|
7
|
+
/** Slot for primary actions. */
|
|
8
|
+
primaryActions?: React.ReactNode;
|
|
9
|
+
/** Slot for secondary actions. */
|
|
10
|
+
secondaryActions?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
declare const EmptyState: React.ForwardRefExoticComponent<EmptyStateProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export default EmptyState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface FieldGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
label: React.ReactNode;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
error?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const FieldGroup: React.ForwardRefExoticComponent<FieldGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export default FieldGroup;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export interface PageHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
heading: ReactNode;
|
|
4
|
+
overline?: ReactNode;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const PageHeader: React.ForwardRefExoticComponent<PageHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export default PageHeader;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export interface SectionHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
heading: ReactNode;
|
|
4
|
+
description?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
declare const SectionHeader: React.ForwardRefExoticComponent<SectionHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export default SectionHeader;
|
|
@@ -14,7 +14,7 @@ export declare const Step: {
|
|
|
14
14
|
(props: StepProps): React.JSX.Element;
|
|
15
15
|
displayName: string;
|
|
16
16
|
};
|
|
17
|
-
interface StepperProps {
|
|
17
|
+
interface StepperProps extends React.HTMLAttributes<HTMLOListElement> {
|
|
18
18
|
children: React.ReactNode;
|
|
19
19
|
className?: string;
|
|
20
20
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -62,6 +62,10 @@ export { default as CopyButton } from './components/CopyButton';
|
|
|
62
62
|
export { default as Drawer } from './components/Drawer';
|
|
63
63
|
export { default as BottomSheet } from './components/BottomSheet';
|
|
64
64
|
export { default as AnchoredOverlay } from './components/AnchoredOverlay';
|
|
65
|
+
export { default as FieldGroup } from './components/FieldGroup';
|
|
66
|
+
export { default as PageHeader } from './components/PageHeader';
|
|
67
|
+
export { default as SectionHeader } from './components/SectionHeader';
|
|
68
|
+
export { default as EmptyState } from './components/EmptyState';
|
|
65
69
|
/**
|
|
66
70
|
* Helpers / Utils
|
|
67
71
|
*/
|
package/lib/index.js
CHANGED
|
@@ -1782,10 +1782,11 @@ function getAutoAlignment(placement) {
|
|
|
1782
1782
|
}
|
|
1783
1783
|
}
|
|
1784
1784
|
var AnchoredOverlay = React.forwardRef(function (_a, refProp) {
|
|
1785
|
-
var
|
|
1785
|
+
var _b, _c;
|
|
1786
|
+
var as = _a.as, _d = _a.placement, initialPlacement = _d === void 0 ? 'auto' : _d, target = _a.target, children = _a.children, style = _a.style, _e = _a.open, open = _e === void 0 ? false : _e, offset = _a.offset, focusTrap = _a.focusTrap, focusTrapOptions = _a.focusTrapOptions, onOpenChange = _a.onOpenChange, onPlacementChange = _a.onPlacementChange, onShiftChange = _a.onShiftChange, props = tslib.__rest(_a, ["as", "placement", "target", "children", "style", "open", "offset", "focusTrap", "focusTrapOptions", "onOpenChange", "onPlacementChange", "onShiftChange"]);
|
|
1786
1787
|
var ref = useSharedRef(refProp);
|
|
1787
1788
|
var Component = as || 'div';
|
|
1788
|
-
var
|
|
1789
|
+
var _f = reactDom$1.useFloating({
|
|
1789
1790
|
open: open,
|
|
1790
1791
|
// default to initial placement on top when placement is auto
|
|
1791
1792
|
// @ts-expect-error auto placement is not a valid placement for floating-ui
|
|
@@ -1796,14 +1797,15 @@ var AnchoredOverlay = React.forwardRef(function (_a, refProp) {
|
|
|
1796
1797
|
? reactDom$1.autoPlacement({
|
|
1797
1798
|
alignment: getAutoAlignment(initialPlacement)
|
|
1798
1799
|
})
|
|
1799
|
-
: reactDom$1.flip()
|
|
1800
|
+
: reactDom$1.flip(),
|
|
1801
|
+
reactDom$1.shift({ crossAxis: false })
|
|
1800
1802
|
].filter(Boolean),
|
|
1801
1803
|
elements: {
|
|
1802
1804
|
reference: resolveElement(target),
|
|
1803
1805
|
floating: ref.current
|
|
1804
1806
|
},
|
|
1805
1807
|
whileElementsMounted: dom.autoUpdate
|
|
1806
|
-
}), floatingStyles =
|
|
1808
|
+
}), floatingStyles = _f.floatingStyles, placement = _f.placement, middlewareData = _f.middlewareData;
|
|
1807
1809
|
useEscapeKey({
|
|
1808
1810
|
active: open,
|
|
1809
1811
|
capture: true,
|
|
@@ -1823,7 +1825,16 @@ var AnchoredOverlay = React.forwardRef(function (_a, refProp) {
|
|
|
1823
1825
|
if (typeof onPlacementChange === 'function') {
|
|
1824
1826
|
onPlacementChange(placement);
|
|
1825
1827
|
}
|
|
1826
|
-
}, [placement]);
|
|
1828
|
+
}, [onPlacementChange, placement]);
|
|
1829
|
+
React.useEffect(function () {
|
|
1830
|
+
var _a, _b;
|
|
1831
|
+
if (typeof onShiftChange === 'function') {
|
|
1832
|
+
onShiftChange({
|
|
1833
|
+
x: ((_a = middlewareData.shift) === null || _a === void 0 ? void 0 : _a.x) || 0,
|
|
1834
|
+
y: ((_b = middlewareData.shift) === null || _b === void 0 ? void 0 : _b.y) || 0
|
|
1835
|
+
});
|
|
1836
|
+
}
|
|
1837
|
+
}, [onShiftChange, (_b = middlewareData.shift) === null || _b === void 0 ? void 0 : _b.x, (_c = middlewareData.shift) === null || _c === void 0 ? void 0 : _c.y]);
|
|
1827
1838
|
return (React__default["default"].createElement(Component, tslib.__assign({ ref: ref }, props, { style: tslib.__assign(tslib.__assign({}, floatingStyles), style) }), children));
|
|
1828
1839
|
});
|
|
1829
1840
|
AnchoredOverlay.displayName = 'AnchoredOverlay';
|
|
@@ -1885,6 +1896,7 @@ function Tooltip(_a) {
|
|
|
1885
1896
|
var _h = tslib.__read(React.useState(!!showProp || defaultShow), 2), showTooltip = _h[0], setShowTooltip = _h[1];
|
|
1886
1897
|
var _j = tslib.__read(React.useState(null), 2), tooltipElement = _j[0], setTooltipElement = _j[1];
|
|
1887
1898
|
var _k = tslib.__read(React.useState(initialPlacement), 2), placement = _k[0], setPlacement = _k[1];
|
|
1899
|
+
var _l = tslib.__read(React.useState(), 2), arrowShift = _l[0], setArrowShift = _l[1];
|
|
1888
1900
|
var hasAriaAssociation = association !== 'none';
|
|
1889
1901
|
// Show the tooltip
|
|
1890
1902
|
var show = React.useCallback(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
@@ -1963,13 +1975,23 @@ function Tooltip(_a) {
|
|
|
1963
1975
|
}
|
|
1964
1976
|
};
|
|
1965
1977
|
}, [target, id, association]);
|
|
1978
|
+
var updateArrowShiftPosition = React.useCallback(function (_a) {
|
|
1979
|
+
var x = _a.x;
|
|
1980
|
+
if (variant === 'big' || x === 0) {
|
|
1981
|
+
setArrowShift(null);
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
// The tooltip shift position is inversely related to the direction
|
|
1985
|
+
// that the arrow needs to shift
|
|
1986
|
+
setArrowShift(x * -1);
|
|
1987
|
+
}, [variant]);
|
|
1966
1988
|
return (React__default["default"].createElement(React__default["default"].Fragment, null, (showTooltip || hideElementOnHidden) && isBrowser()
|
|
1967
|
-
? reactDom.createPortal(React__default["default"].createElement(AnchoredOverlay, tslib.__assign({ id: id, target: target, placement: initialPlacement, onPlacementChange: setPlacement, open: showTooltip && typeof showProp !== 'boolean', onOpenChange: setShowTooltip, className: classNames__default["default"]('Tooltip', "Tooltip--".concat(placement), className, {
|
|
1989
|
+
? reactDom.createPortal(React__default["default"].createElement(AnchoredOverlay, tslib.__assign({ id: id, target: target, placement: initialPlacement, onPlacementChange: setPlacement, open: showTooltip && typeof showProp !== 'boolean', onOpenChange: setShowTooltip, onShiftChange: updateArrowShiftPosition, className: classNames__default["default"]('Tooltip', "Tooltip--".concat(placement), className, {
|
|
1968
1990
|
TooltipInfo: variant === 'info',
|
|
1969
1991
|
'Tooltip--hidden': !showTooltip && hideElementOnHidden,
|
|
1970
1992
|
'Tooltip--big': variant === 'big'
|
|
1971
1993
|
}), ref: setTooltipElement, role: "tooltip", offset: 8 }, props),
|
|
1972
|
-
variant !== 'big' && React__default["default"].createElement("div", { className: "TooltipArrow" }),
|
|
1994
|
+
variant !== 'big' && React__default["default"].createElement("div", { className: "TooltipArrow", style: arrowShift ? { transform: "translateX(".concat(arrowShift, "px)") } : undefined }),
|
|
1973
1995
|
children), (portal && 'current' in portal ? portal.current : portal) ||
|
|
1974
1996
|
(
|
|
1975
1997
|
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
@@ -4768,6 +4790,65 @@ var BottomSheet = React.forwardRef(function (_a, ref) {
|
|
|
4768
4790
|
});
|
|
4769
4791
|
BottomSheet.displayName = 'BottomSheet';
|
|
4770
4792
|
|
|
4793
|
+
var FieldGroup = React.forwardRef(function (_a, ref) {
|
|
4794
|
+
var label = _a.label, description = _a.description, error = _a.error, children = _a.children, className = _a.className, propId = _a.id, props = tslib.__rest(_a, ["label", "description", "error", "children", "className", "id"]);
|
|
4795
|
+
var _b = tslib.__read(propId ? [propId] : nextId.useId(1, 'fieldgroup'), 1), id = _b[0];
|
|
4796
|
+
var descriptionId = "".concat(id, "-description");
|
|
4797
|
+
var errorId = "".concat(id, "-error");
|
|
4798
|
+
var ariaDescribedbyId = '';
|
|
4799
|
+
if (description) {
|
|
4800
|
+
ariaDescribedbyId = addIdRef(ariaDescribedbyId, descriptionId);
|
|
4801
|
+
}
|
|
4802
|
+
if (error) {
|
|
4803
|
+
ariaDescribedbyId = addIdRef(ariaDescribedbyId, errorId);
|
|
4804
|
+
}
|
|
4805
|
+
return (React__default["default"].createElement("div", tslib.__assign({ role: "group", className: classNames__default["default"]('FieldGroup', className), ref: ref }, props, { "aria-labelledby": "".concat(id, "-label"), "aria-describedby": ariaDescribedbyId || undefined }),
|
|
4806
|
+
React__default["default"].createElement("label", { id: "".concat(id, "-label"), className: "Field__label" }, label),
|
|
4807
|
+
description && (React__default["default"].createElement("div", { id: descriptionId, className: "Field__description" }, description)),
|
|
4808
|
+
error && (React__default["default"].createElement("div", { className: "Field__error", id: errorId },
|
|
4809
|
+
React__default["default"].createElement(Icon, { type: "caution" }),
|
|
4810
|
+
error)),
|
|
4811
|
+
children));
|
|
4812
|
+
});
|
|
4813
|
+
FieldGroup.displayName = 'FieldGroup';
|
|
4814
|
+
|
|
4815
|
+
var SectionHeader = React.forwardRef(function (_a, ref) {
|
|
4816
|
+
var className = _a.className, heading = _a.heading, description = _a.description, children = _a.children, otherProps = tslib.__rest(_a, ["className", "heading", "description", "children"]);
|
|
4817
|
+
if (typeof heading === 'string') {
|
|
4818
|
+
heading = React__default["default"].createElement("h2", null, heading);
|
|
4819
|
+
}
|
|
4820
|
+
return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"]('SectionHeader', className), ref: ref }, otherProps),
|
|
4821
|
+
React__default["default"].createElement("div", { className: "SectionHeader__content" },
|
|
4822
|
+
heading,
|
|
4823
|
+
description && (React__default["default"].createElement("p", { className: "SectionHeader__description" }, description)),
|
|
4824
|
+
children && React__default["default"].createElement("div", { className: "SectionHeader__actions" }, children))));
|
|
4825
|
+
});
|
|
4826
|
+
SectionHeader.displayName = 'SectionHeader';
|
|
4827
|
+
|
|
4828
|
+
var PageHeader = React.forwardRef(function (_a, ref) {
|
|
4829
|
+
var className = _a.className, heading = _a.heading, overline = _a.overline, description = _a.description, children = _a.children, otherProps = tslib.__rest(_a, ["className", "heading", "overline", "description", "children"]);
|
|
4830
|
+
if (typeof heading === 'string') {
|
|
4831
|
+
heading = React__default["default"].createElement("h1", null, heading);
|
|
4832
|
+
}
|
|
4833
|
+
return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"]('PageHeader', className), ref: ref }, otherProps),
|
|
4834
|
+
overline && React__default["default"].createElement("div", { className: "PageHeader__overline" }, overline),
|
|
4835
|
+
React__default["default"].createElement(SectionHeader, { heading: heading, description: description }, children)));
|
|
4836
|
+
});
|
|
4837
|
+
PageHeader.displayName = 'PageHeader';
|
|
4838
|
+
|
|
4839
|
+
var EmptyState = React.forwardRef(function (_a, ref) {
|
|
4840
|
+
var className = _a.className, heading = _a.heading, description = _a.description, primaryActions = _a.primaryActions, secondaryActions = _a.secondaryActions, props = tslib.__rest(_a, ["className", "heading", "description", "primaryActions", "secondaryActions"]);
|
|
4841
|
+
if (typeof heading === 'string') {
|
|
4842
|
+
heading = React__default["default"].createElement("h2", null, heading);
|
|
4843
|
+
}
|
|
4844
|
+
return (React__default["default"].createElement("div", tslib.__assign({ ref: ref, className: classNames__default["default"]('EmptyState', className) }, props),
|
|
4845
|
+
heading,
|
|
4846
|
+
React__default["default"].createElement("p", null, description),
|
|
4847
|
+
primaryActions && (React__default["default"].createElement("div", { className: "EmptyState__primary" }, primaryActions)),
|
|
4848
|
+
secondaryActions && (React__default["default"].createElement("div", { className: "EmptyState__secondary" }, secondaryActions))));
|
|
4849
|
+
});
|
|
4850
|
+
EmptyState.displayName = 'EmptyState';
|
|
4851
|
+
|
|
4771
4852
|
var LIGHT_THEME_CLASS = 'cauldron--theme-light';
|
|
4772
4853
|
var DARK_THEME_CLASS = 'cauldron--theme-dark';
|
|
4773
4854
|
var ThemeContext = React.createContext({
|
|
@@ -4873,7 +4954,9 @@ exports.Dialog = Dialog;
|
|
|
4873
4954
|
exports.DialogContent = DialogContent;
|
|
4874
4955
|
exports.DialogFooter = DialogFooter;
|
|
4875
4956
|
exports.Drawer = Drawer;
|
|
4957
|
+
exports.EmptyState = EmptyState;
|
|
4876
4958
|
exports.ExpandCollapsePanel = ExpandCollapsePanel;
|
|
4959
|
+
exports.FieldGroup = FieldGroup;
|
|
4877
4960
|
exports.FieldWrap = FieldWrap;
|
|
4878
4961
|
exports.Icon = Icon;
|
|
4879
4962
|
exports.IconButton = IconButton;
|
|
@@ -4901,6 +4984,7 @@ exports.OptionsMenuItem = OptionsMenuItem;
|
|
|
4901
4984
|
exports.OptionsMenuList = OptionsMenuList;
|
|
4902
4985
|
exports.OptionsMenuTrigger = OptionsMenuTrigger;
|
|
4903
4986
|
exports.OptionsMenuWrapper = OptionsMenuWrapper;
|
|
4987
|
+
exports.PageHeader = PageHeader;
|
|
4904
4988
|
exports.Pagination = Pagination;
|
|
4905
4989
|
exports.Panel = Panel;
|
|
4906
4990
|
exports.PanelContent = PanelContent;
|
|
@@ -4912,6 +4996,7 @@ exports.RadioCardGroup = RadioCardGroup;
|
|
|
4912
4996
|
exports.RadioGroup = RadioGroup;
|
|
4913
4997
|
exports.Scrim = Scrim;
|
|
4914
4998
|
exports.SearchField = SearchField;
|
|
4999
|
+
exports.SectionHeader = SectionHeader;
|
|
4915
5000
|
exports.Select = Select;
|
|
4916
5001
|
exports.SideBar = SideBar;
|
|
4917
5002
|
exports.SideBarItem = SideBarItem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/cauldron-react",
|
|
3
|
-
"version": "6.16.0-canary.
|
|
3
|
+
"version": "6.16.0-canary.edbb1fd9",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
6
6
|
"homepage": "https://cauldron.dequelabs.com/",
|
|
@@ -79,22 +79,5 @@
|
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"react": ">=16.6 <= 18",
|
|
81
81
|
"react-dom": ">=16.6 <= 18"
|
|
82
|
-
},
|
|
83
|
-
"nyc": {
|
|
84
|
-
"checkCoverage": true,
|
|
85
|
-
"reporter": [
|
|
86
|
-
"text-summary",
|
|
87
|
-
"html"
|
|
88
|
-
],
|
|
89
|
-
"statements": 85,
|
|
90
|
-
"branches": 78,
|
|
91
|
-
"functions": 85,
|
|
92
|
-
"lines": 85,
|
|
93
|
-
"exclude": [
|
|
94
|
-
"lib",
|
|
95
|
-
"coverage",
|
|
96
|
-
"test/**/*.js",
|
|
97
|
-
"test/**/*.e2e.tsx"
|
|
98
|
-
]
|
|
99
82
|
}
|
|
100
83
|
}
|