@hyphen/hyphen-components 2.25.2 → 3.0.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/components/Drawer/Drawer.d.ts +36 -13
- package/dist/components/Drawer/Drawer.stories.d.ts +56 -11
- package/dist/css/index.css +1 -1
- package/dist/hyphen-components.cjs.development.js +254 -122
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +1 -1
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +249 -124
- package/dist/hyphen-components.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Drawer/Drawer.mdx +9 -24
- package/src/components/Drawer/Drawer.module.scss +4 -3
- package/src/components/Drawer/Drawer.stories.tsx +255 -296
- package/src/components/Drawer/Drawer.test.tsx +141 -71
- package/src/components/Drawer/Drawer.tsx +244 -76
|
@@ -14,6 +14,7 @@ var reactPopper = require('react-popper');
|
|
|
14
14
|
var FocusTrap = require('focus-trap-react');
|
|
15
15
|
var designTokens = require('@hyphen/hyphen-design-tokens/build/json/variables');
|
|
16
16
|
require('@hyphen/hyphen-design-tokens/build/assets/icons');
|
|
17
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
17
18
|
var ReactModal = require('react-modal');
|
|
18
19
|
var FocusLock = require('react-focus-lock');
|
|
19
20
|
var reactRemoveScroll = require('react-remove-scroll');
|
|
@@ -23,7 +24,6 @@ var Select = require('react-select');
|
|
|
23
24
|
var AsyncCreatableSelect = require('react-select/async-creatable');
|
|
24
25
|
var AsyncSelect = require('react-select/async');
|
|
25
26
|
var CreatableSelect = require('react-select/creatable');
|
|
26
|
-
var reactSlot = require('@radix-ui/react-slot');
|
|
27
27
|
var uuid = require('uuid');
|
|
28
28
|
|
|
29
29
|
function _interopNamespaceDefault(e) {
|
|
@@ -275,7 +275,7 @@ Component, props, getDefault) {
|
|
|
275
275
|
|
|
276
276
|
var styles$w = {"box-transition":"Box-module_box-transition__eQx8C"};
|
|
277
277
|
|
|
278
|
-
var _excluded$
|
|
278
|
+
var _excluded$M = ["as", "alignItems", "alignContent", "alignSelf", "background", "borderColor", "borderWidth", "children", "childGap", "className", "color", "columnGap", "cursor", "display", "direction", "flex", "fontFamily", "fontSize", "focus", "fontWeight", "gap", "height", "hover", "justifyContent", "margin", "maxHeight", "minHeight", "maxWidth", "minWidth", "overflow", "padding", "position", "radius", "rowGap", "shadow", "style", "textAlign", "wrap", "width", "zIndex"];
|
|
279
279
|
/**
|
|
280
280
|
* A `<Box>` is a layout component to build UIs with consistent padding and spacing between
|
|
281
281
|
* elements.
|
|
@@ -362,7 +362,7 @@ var Box = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
362
362
|
width = _ref$width === void 0 ? undefined : _ref$width,
|
|
363
363
|
_ref$zIndex = _ref.zIndex,
|
|
364
364
|
zIndex = _ref$zIndex === void 0 ? undefined : _ref$zIndex,
|
|
365
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
365
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$M);
|
|
366
366
|
var heightCss = getDimensionCss('h', height);
|
|
367
367
|
var widthCss = getDimensionCss('w', width);
|
|
368
368
|
var maxHeightCss = getDimensionCss('mh', maxHeight);
|
|
@@ -513,14 +513,14 @@ var Box = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
513
513
|
});
|
|
514
514
|
var boxPropsKeys = ['as', 'alignItems', 'alignContent', 'alignSelf', 'background', 'borderColor', 'borderWidth', 'className', 'childGap', 'children', 'color', 'columnGap', 'cursor', 'direction', 'display', 'flex', 'focus', 'fontFamily', 'fontSize', 'fontWeight', 'gap', 'height', 'hover', 'justifyContent', 'margin', 'maxHeight', 'minHeight', 'maxWidth', 'minWidth', 'overflow', 'padding', 'position', 'radius', 'rowGap', 'shadow', 'style', 'textAlign', 'wrap', 'width', 'zIndex'];
|
|
515
515
|
|
|
516
|
-
var _excluded$
|
|
516
|
+
var _excluded$L = ["className", "name", "color", "size"];
|
|
517
517
|
var Icon = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
518
518
|
var _ref$className = _ref.className,
|
|
519
519
|
className = _ref$className === void 0 ? undefined : _ref$className,
|
|
520
520
|
name = _ref.name,
|
|
521
521
|
color = _ref.color,
|
|
522
522
|
size = _ref.size,
|
|
523
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
523
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$L);
|
|
524
524
|
var IconComponent = icons[name];
|
|
525
525
|
if (!IconComponent) console.error("Icon '" + name + "' not found"); // eslint-disable-line no-console
|
|
526
526
|
var iconClasses = classNames(className, generateResponsiveClasses('font-color', color), generateResponsiveClasses('font-size', size));
|
|
@@ -559,7 +559,7 @@ var ALERT_ICONS_MAP = {
|
|
|
559
559
|
}
|
|
560
560
|
};
|
|
561
561
|
|
|
562
|
-
var _excluded$
|
|
562
|
+
var _excluded$K = ["className", "closeText", "hasIcon", "isCompact", "isClosable", "message", "onClose", "render", "title", "variant"];
|
|
563
563
|
var Alert = function Alert(_ref) {
|
|
564
564
|
var _ref$className = _ref.className,
|
|
565
565
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
@@ -581,7 +581,7 @@ var Alert = function Alert(_ref) {
|
|
|
581
581
|
title = _ref$title === void 0 ? '' : _ref$title,
|
|
582
582
|
_ref$variant = _ref.variant,
|
|
583
583
|
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
584
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
584
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$K);
|
|
585
585
|
var handleClose = function handleClose(event) {
|
|
586
586
|
if (!onClose) return;
|
|
587
587
|
onClose(event);
|
|
@@ -635,7 +635,7 @@ var Alert = function Alert(_ref) {
|
|
|
635
635
|
|
|
636
636
|
var styles$u = {"badge":"Badge-module_badge__ZbEBU","size-sm":"Badge-module_size-sm__rL8a6","size-md":"Badge-module_size-md__kf6IH","size-lg":"Badge-module_size-lg__of6XJ","inverse":"Badge-module_inverse__qZCFA","purple":"Badge-module_purple__rX-xW","green":"Badge-module_green__W03uU","red":"Badge-module_red__fl2jg","blue":"Badge-module_blue__C7kyV","yellow":"Badge-module_yellow__gGZ6R","light-grey":"Badge-module_light-grey__Wtrhx","dark-grey":"Badge-module_dark-grey__X-807","hyphen":"Badge-module_hyphen__9pe7x","size-sm-tablet":"Badge-module_size-sm-tablet__6xMVk","size-md-tablet":"Badge-module_size-md-tablet__4w-7I","size-lg-tablet":"Badge-module_size-lg-tablet__8xyRF","size-sm-desktop":"Badge-module_size-sm-desktop__Ayf5L","size-md-desktop":"Badge-module_size-md-desktop__XSq7m","size-lg-desktop":"Badge-module_size-lg-desktop__Baw3S","size-sm-hd":"Badge-module_size-sm-hd__Da6Au","size-md-hd":"Badge-module_size-md-hd__-VNMk","size-lg-hd":"Badge-module_size-lg-hd__6MOwL"};
|
|
637
637
|
|
|
638
|
-
var _excluded$
|
|
638
|
+
var _excluded$J = ["className", "message", "variant", "size"];
|
|
639
639
|
var Badge = function Badge(_ref) {
|
|
640
640
|
var _classNames;
|
|
641
641
|
var _ref$className = _ref.className,
|
|
@@ -646,7 +646,7 @@ var Badge = function Badge(_ref) {
|
|
|
646
646
|
variant = _ref$variant === void 0 ? 'light-grey' : _ref$variant,
|
|
647
647
|
_ref$size = _ref.size,
|
|
648
648
|
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
649
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
649
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$J);
|
|
650
650
|
var responsiveClasses = generateResponsiveClasses('size', size).map(function (c) {
|
|
651
651
|
return styles$u[c];
|
|
652
652
|
});
|
|
@@ -781,7 +781,7 @@ var handleReactRouterClick = function handleReactRouterClick(event, onClick, tar
|
|
|
781
781
|
|
|
782
782
|
var styles$s = {"button":"Button-module_button__18Bed","size-sm":"Button-module_size-sm__6Xrjw","size-md":"Button-module_size-md__BkuGu","size-lg":"Button-module_size-lg__JVYWV","primary":"Button-module_primary__st6yY","secondary":"Button-module_secondary__j-3rj","tertiary":"Button-module_tertiary__Nd7xM","danger":"Button-module_danger__Hxs5n","size-sm-tablet":"Button-module_size-sm-tablet__9XaSx","size-md-tablet":"Button-module_size-md-tablet__YQxaI","size-lg-tablet":"Button-module_size-lg-tablet__h3l97","size-sm-desktop":"Button-module_size-sm-desktop__8tTsg","size-md-desktop":"Button-module_size-md-desktop__OCdDi","size-lg-desktop":"Button-module_size-lg-desktop__uFc4f","size-sm-hd":"Button-module_size-sm-hd__INFfD","size-md-hd":"Button-module_size-md-hd__8e2mW","size-lg-hd":"Button-module_size-lg-hd__DH60l","loading":"Button-module_loading__QfItr","label":"Button-module_label__1PsXG","full-width":"Button-module_full-width__qDri6","spinner-wrapper":"Button-module_spinner-wrapper__rALNw"};
|
|
783
783
|
|
|
784
|
-
var _excluded$
|
|
784
|
+
var _excluded$I = ["children", "as", "className", "fullWidth", "id", "href", "iconPrefix", "iconSuffix", "isDisabled", "isLoading", "navigate", "onClick", "onFocus", "onBlur", "shadow", "size", "tabIndex", "target", "type", "variant"];
|
|
785
785
|
var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
786
786
|
var _classNames, _extends2;
|
|
787
787
|
var _ref$children = _ref.children,
|
|
@@ -824,7 +824,7 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
824
824
|
type = _ref$type === void 0 ? undefined : _ref$type,
|
|
825
825
|
_ref$variant = _ref.variant,
|
|
826
826
|
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
827
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
827
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$I);
|
|
828
828
|
var disabled = isLoading || isDisabled;
|
|
829
829
|
var responsiveClasses = generateResponsiveClasses('size', size).map(function (c) {
|
|
830
830
|
return styles$s[c];
|
|
@@ -878,7 +878,7 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
878
878
|
}, _extends2.onFocus = handleFocus, _extends2.ref = ref, _extends2.type = type || (as !== 'a' && !href ? 'button' : undefined), _extends2.tabIndex = tabIndex, _extends2), restProps), buttonContent);
|
|
879
879
|
});
|
|
880
880
|
|
|
881
|
-
var _excluded$
|
|
881
|
+
var _excluded$H = ["background", "borderColor", "borderWidth", "children", "display", "padding"];
|
|
882
882
|
var CardFooter = function CardFooter(_ref) {
|
|
883
883
|
var _ref$background = _ref.background,
|
|
884
884
|
background = _ref$background === void 0 ? 'secondary' : _ref$background,
|
|
@@ -892,7 +892,7 @@ var CardFooter = function CardFooter(_ref) {
|
|
|
892
892
|
display = _ref$display === void 0 ? 'block' : _ref$display,
|
|
893
893
|
_ref$padding = _ref.padding,
|
|
894
894
|
padding = _ref$padding === void 0 ? '2xl' : _ref$padding,
|
|
895
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
895
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$H);
|
|
896
896
|
return React.createElement(Box, _extends({
|
|
897
897
|
display: display,
|
|
898
898
|
padding: padding,
|
|
@@ -913,7 +913,7 @@ var HEADING_DEFAULT_SIZE_MAP = {
|
|
|
913
913
|
|
|
914
914
|
var styles$r = {"heading":"Heading-module_heading__zKyv7"};
|
|
915
915
|
|
|
916
|
-
var _excluded$
|
|
916
|
+
var _excluded$G = ["as", "children", "className", "color", "size"];
|
|
917
917
|
var Heading = function Heading(_ref) {
|
|
918
918
|
var _classNames;
|
|
919
919
|
var _ref$as = _ref.as,
|
|
@@ -922,7 +922,7 @@ var Heading = function Heading(_ref) {
|
|
|
922
922
|
className = _ref.className,
|
|
923
923
|
color = _ref.color,
|
|
924
924
|
size = _ref.size,
|
|
925
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
925
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$G);
|
|
926
926
|
var element = getElementType(Heading, {
|
|
927
927
|
as: as
|
|
928
928
|
});
|
|
@@ -933,7 +933,7 @@ var Heading = function Heading(_ref) {
|
|
|
933
933
|
}, restProps), children);
|
|
934
934
|
};
|
|
935
935
|
|
|
936
|
-
var _excluded$
|
|
936
|
+
var _excluded$F = ["childGap", "children", "className", "display", "padding", "title"];
|
|
937
937
|
var CardHeader = function CardHeader(_ref) {
|
|
938
938
|
var _ref$childGap = _ref.childGap,
|
|
939
939
|
childGap = _ref$childGap === void 0 ? '2xs' : _ref$childGap,
|
|
@@ -947,7 +947,7 @@ var CardHeader = function CardHeader(_ref) {
|
|
|
947
947
|
padding = _ref$padding === void 0 ? '2xl' : _ref$padding,
|
|
948
948
|
_ref$title = _ref.title,
|
|
949
949
|
title = _ref$title === void 0 ? null : _ref$title,
|
|
950
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
950
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$F);
|
|
951
951
|
var renderTitle = function renderTitle() {
|
|
952
952
|
return typeof title === 'string' ? React.createElement(Heading, {
|
|
953
953
|
size: "sm",
|
|
@@ -964,7 +964,7 @@ var CardHeader = function CardHeader(_ref) {
|
|
|
964
964
|
|
|
965
965
|
var styles$q = {"card-section-border":"Card-module_card-section-border__OefDX"};
|
|
966
966
|
|
|
967
|
-
var _excluded$
|
|
967
|
+
var _excluded$E = ["background", "borderColor", "borderWidth", "children", "childGap", "gap", "className", "display", "padding", "subdued", "title"];
|
|
968
968
|
var CardSection = function CardSection(_ref) {
|
|
969
969
|
var _classNames;
|
|
970
970
|
var _ref$background = _ref.background,
|
|
@@ -989,7 +989,7 @@ var CardSection = function CardSection(_ref) {
|
|
|
989
989
|
subdued = _ref$subdued === void 0 ? undefined : _ref$subdued,
|
|
990
990
|
_ref$title = _ref.title,
|
|
991
991
|
title = _ref$title === void 0 ? undefined : _ref$title,
|
|
992
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
992
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$E);
|
|
993
993
|
var renderTitle = typeof title === 'string' ? React.createElement(Box, {
|
|
994
994
|
className: "m-bottom-md"
|
|
995
995
|
}, React.createElement(Box, {
|
|
@@ -1012,7 +1012,7 @@ var CardSection = function CardSection(_ref) {
|
|
|
1012
1012
|
}, children));
|
|
1013
1013
|
};
|
|
1014
1014
|
|
|
1015
|
-
var _excluded$
|
|
1015
|
+
var _excluded$D = ["children", "subdued", "overflow", "display", "width"];
|
|
1016
1016
|
var CardBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1017
1017
|
var children = _ref.children,
|
|
1018
1018
|
subdued = _ref.subdued,
|
|
@@ -1022,7 +1022,7 @@ var CardBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1022
1022
|
display = _ref$display === void 0 ? 'block' : _ref$display,
|
|
1023
1023
|
_ref$width = _ref.width,
|
|
1024
1024
|
width = _ref$width === void 0 ? '100' : _ref$width,
|
|
1025
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1025
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$D);
|
|
1026
1026
|
return React.createElement(Box, _extends({
|
|
1027
1027
|
background: subdued ? 'secondary' : 'primary',
|
|
1028
1028
|
borderWidth: "sm",
|
|
@@ -1045,7 +1045,7 @@ var Card = /*#__PURE__*/function () {
|
|
|
1045
1045
|
return Card;
|
|
1046
1046
|
}();
|
|
1047
1047
|
|
|
1048
|
-
var _excluded$
|
|
1048
|
+
var _excluded$C = ["className", "error", "isChecked", "isDisabled", "isIndeterminate"];
|
|
1049
1049
|
var CheckboxIcon = function CheckboxIcon(_ref) {
|
|
1050
1050
|
var _ref$className = _ref.className,
|
|
1051
1051
|
className = _ref$className === void 0 ? undefined : _ref$className,
|
|
@@ -1057,7 +1057,7 @@ var CheckboxIcon = function CheckboxIcon(_ref) {
|
|
|
1057
1057
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
1058
1058
|
_ref$isIndeterminate = _ref.isIndeterminate,
|
|
1059
1059
|
isIndeterminate = _ref$isIndeterminate === void 0 ? false : _ref$isIndeterminate,
|
|
1060
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1060
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$C);
|
|
1061
1061
|
var color = 'base';
|
|
1062
1062
|
var name = 'checkbox-btn';
|
|
1063
1063
|
if (isChecked) name = 'checkbox-btn-checked';else name = 'checkbox-btn';
|
|
@@ -1082,7 +1082,7 @@ var CheckboxIcon = function CheckboxIcon(_ref) {
|
|
|
1082
1082
|
|
|
1083
1083
|
var styles$p = {"checkbox":"Checkbox-module_checkbox__dY-7P","size-sm":"Checkbox-module_size-sm__mJkMQ","size-md":"Checkbox-module_size-md__I2s8g","size-lg":"Checkbox-module_size-lg__rFFnb","hidden":"Checkbox-module_hidden__2y7Zr","size-sm-tablet":"Checkbox-module_size-sm-tablet__GhQUW","size-md-tablet":"Checkbox-module_size-md-tablet__XRHf4","size-lg-tablet":"Checkbox-module_size-lg-tablet__quoAJ","size-sm-desktop":"Checkbox-module_size-sm-desktop__fqeEc","size-md-desktop":"Checkbox-module_size-md-desktop__9a278","size-lg-desktop":"Checkbox-module_size-lg-desktop__WQnv0","size-sm-hd":"Checkbox-module_size-sm-hd__X3yIF","size-md-hd":"Checkbox-module_size-md-hd__6T0dF","size-lg-hd":"Checkbox-module_size-lg-hd__UXCt1"};
|
|
1084
1084
|
|
|
1085
|
-
var _excluded$
|
|
1085
|
+
var _excluded$B = ["className", "display", "id", "isChecked", "label", "labelledby", "onChange", "error", "isDisabled", "isHidden", "isIndeterminate", "isRequired", "onBlur", "onFocus", "size", "value"];
|
|
1086
1086
|
var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1087
1087
|
var _ref2;
|
|
1088
1088
|
var _ref$className = _ref.className,
|
|
@@ -1112,7 +1112,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1112
1112
|
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
1113
1113
|
_ref$value = _ref.value,
|
|
1114
1114
|
value = _ref$value === void 0 ? undefined : _ref$value,
|
|
1115
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1115
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$B);
|
|
1116
1116
|
var inputRef = React.useRef(null);
|
|
1117
1117
|
React.useEffect(function () {
|
|
1118
1118
|
if (inputRef != null && inputRef.current) {
|
|
@@ -1201,7 +1201,7 @@ var HelpText = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1201
1201
|
}, children);
|
|
1202
1202
|
});
|
|
1203
1203
|
|
|
1204
|
-
var _excluded$
|
|
1204
|
+
var _excluded$A = ["children", "inputId", "className", "display", "helpText", "isDisabled", "isFieldRequired", "isRadioInputLabel", "requiredIndicator", "margin", "padding"];
|
|
1205
1205
|
var FormLabel = function FormLabel(_ref) {
|
|
1206
1206
|
var _classNames;
|
|
1207
1207
|
var children = _ref.children,
|
|
@@ -1223,7 +1223,7 @@ var FormLabel = function FormLabel(_ref) {
|
|
|
1223
1223
|
margin = _ref$margin === void 0 ? '0' : _ref$margin,
|
|
1224
1224
|
_ref$padding = _ref.padding,
|
|
1225
1225
|
padding = _ref$padding === void 0 ? '0' : _ref$padding,
|
|
1226
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1226
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$A);
|
|
1227
1227
|
var labelClasses = classNames('hyphen-components__variables__form-control', styles$n.label, className, (_classNames = {}, _classNames[styles$n.disabled] = isDisabled, _classNames[styles$n.disabled] = isDisabled, _classNames[styles$n['radio-input-label']] = isRadioInputLabel, _classNames));
|
|
1228
1228
|
return React.createElement(Box, _extends({
|
|
1229
1229
|
as: "label",
|
|
@@ -1236,7 +1236,7 @@ var FormLabel = function FormLabel(_ref) {
|
|
|
1236
1236
|
}, restProps), children, isFieldRequired && requiredIndicator && React.createElement("span", null, requiredIndicator), helpText && React.createElement(HelpText, null, helpText));
|
|
1237
1237
|
};
|
|
1238
1238
|
|
|
1239
|
-
var _excluded$
|
|
1239
|
+
var _excluded$z = ["id", "isChecked", "label", "onChange", "className", "error", "hideLabel", "helpText", "isDisabled", "isIndeterminate", "isRequired", "onBlur", "onFocus", "requiredIndicator", "size"];
|
|
1240
1240
|
var labelMarginSizeMap = {
|
|
1241
1241
|
sm: '2xs 0 0 0',
|
|
1242
1242
|
md: 'xs 0 0 0',
|
|
@@ -1281,7 +1281,7 @@ var CheckboxInput = function CheckboxInput(_ref2) {
|
|
|
1281
1281
|
requiredIndicator = _ref2$requiredIndicat === void 0 ? ' *' : _ref2$requiredIndicat,
|
|
1282
1282
|
_ref2$size = _ref2.size,
|
|
1283
1283
|
size = _ref2$size === void 0 ? 'md' : _ref2$size,
|
|
1284
|
-
restProps = _objectWithoutPropertiesLoose(_ref2, _excluded$
|
|
1284
|
+
restProps = _objectWithoutPropertiesLoose(_ref2, _excluded$z);
|
|
1285
1285
|
var handleBlur = function handleBlur(event) {
|
|
1286
1286
|
if (onBlur) onBlur(event);
|
|
1287
1287
|
};
|
|
@@ -1329,7 +1329,7 @@ var CollapsibleContent = CollapsiblePrimitive__namespace.CollapsibleContent;
|
|
|
1329
1329
|
|
|
1330
1330
|
var styles$l = {};
|
|
1331
1331
|
|
|
1332
|
-
var _excluded$
|
|
1332
|
+
var _excluded$y = ["children", "dayClassName", "maxDate", "minDate", "monthsShown", "openToDate", "startDate", "selected", "selectsRange", "showTwoColumnMonthYearPicker", "showFullMonthYearPicker", "showMonthYearPicker", "className", "formatWeekDay"];
|
|
1333
1333
|
var DatePicker = function DatePicker(_ref) {
|
|
1334
1334
|
var _ref$children = _ref.children,
|
|
1335
1335
|
children = _ref$children === void 0 ? null : _ref$children,
|
|
@@ -1361,7 +1361,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
1361
1361
|
formatWeekDay = _ref$formatWeekDay === void 0 ? function (formattedDate) {
|
|
1362
1362
|
return formattedDate[0];
|
|
1363
1363
|
} : _ref$formatWeekDay,
|
|
1364
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1364
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$y);
|
|
1365
1365
|
var datePickerClasses = classNames(styles$l['react-datepicker'], className);
|
|
1366
1366
|
return React.createElement(ReactDatePicker, _extends({
|
|
1367
1367
|
inline: true,
|
|
@@ -1381,7 +1381,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
1381
1381
|
}, restProps), children);
|
|
1382
1382
|
};
|
|
1383
1383
|
|
|
1384
|
-
var _excluded$
|
|
1384
|
+
var _excluded$x = ["label", "hideLabel", "children", "error", "id", "isRequired", "helpText", "isDisabled", "requiredIndicator", "width"];
|
|
1385
1385
|
var FormControl = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1386
1386
|
var label = _ref.label,
|
|
1387
1387
|
hideLabel = _ref.hideLabel,
|
|
@@ -1394,7 +1394,7 @@ var FormControl = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1394
1394
|
requiredIndicator = _ref.requiredIndicator,
|
|
1395
1395
|
_ref$width = _ref.width,
|
|
1396
1396
|
width = _ref$width === void 0 ? '100' : _ref$width,
|
|
1397
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1397
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$x);
|
|
1398
1398
|
var labelProps = {
|
|
1399
1399
|
inputId: id,
|
|
1400
1400
|
helpText: helpText,
|
|
@@ -1422,7 +1422,7 @@ function getAutoCompleteValue(value) {
|
|
|
1422
1422
|
|
|
1423
1423
|
var styles$k = {"text-input-wrapper":"TextInput-module_text-input-wrapper__HCnQD","size-sm":"TextInput-module_size-sm__qWJn7","prefix":"TextInput-module_prefix__-wFO9","suffix":"TextInput-module_suffix__327yL","clear-button":"TextInput-module_clear-button__LUJpO","is-clearable":"TextInput-module_is-clearable__ExAY3","size-md":"TextInput-module_size-md__UFPtt","size-lg":"TextInput-module_size-lg__Hjfez","disabled":"TextInput-module_disabled__lrifj","size-sm-tablet":"TextInput-module_size-sm-tablet__neC5C","size-md-tablet":"TextInput-module_size-md-tablet__u29oc","size-lg-tablet":"TextInput-module_size-lg-tablet__3PUB3","size-sm-desktop":"TextInput-module_size-sm-desktop__kA12V","size-md-desktop":"TextInput-module_size-md-desktop__yLJGr","size-lg-desktop":"TextInput-module_size-lg-desktop__A1pcS","size-sm-hd":"TextInput-module_size-sm-hd__f7Thr","size-md-hd":"TextInput-module_size-md-hd__Tsnqc","size-lg-hd":"TextInput-module_size-lg-hd__XLMos","error":"TextInput-module_error__p6zZq","text-input-label":"TextInput-module_text-input-label__3PlSG"};
|
|
1424
1424
|
|
|
1425
|
-
var _excluded$
|
|
1425
|
+
var _excluded$w = ["id", "label", "onChange", "value", "autoComplete", "autoFocus", "error", "helpText", "hideLabel", "inputProps", "isDisabled", "isRequired", "maxLength", "name", "onBlur", "onClear", "onFocus", "prefix", "placeholder", "requiredIndicator", "suffix", "size", "type"];
|
|
1426
1426
|
var TextInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1427
1427
|
var _ref2;
|
|
1428
1428
|
var id = _ref.id,
|
|
@@ -1466,7 +1466,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1466
1466
|
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
1467
1467
|
_ref$type = _ref.type,
|
|
1468
1468
|
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
1469
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1469
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$w);
|
|
1470
1470
|
var responsiveClasses = generateResponsiveClasses('size', size);
|
|
1471
1471
|
var inputWrapperClasses = classNames.apply(void 0, ['hyphen-components__variables__form-control', styles$k['text-input-wrapper']].concat(responsiveClasses.map(function (c) {
|
|
1472
1472
|
return styles$k[c];
|
|
@@ -1615,7 +1615,7 @@ var BREAKPOINTS = /*#__PURE__*/[].concat(Object.entries(designTokens.size.breakp
|
|
|
1615
1615
|
var Z_INDEX_VALUES = designTokens.size['z-index'];
|
|
1616
1616
|
// export const BOX_SHADOW_VALUES = designTokens.size['box-shadow'];
|
|
1617
1617
|
|
|
1618
|
-
var _excluded$
|
|
1618
|
+
var _excluded$v = ["className", "isOpen", "children", "content", "arrowColor", "contentContainerProps", "hasArrow", "offsetFromTarget", "onClickOutside", "placement", "withPortal", "portalTarget", "trapFocus"];
|
|
1619
1619
|
var contentContainerDefaults = {
|
|
1620
1620
|
background: 'primary',
|
|
1621
1621
|
padding: 'sm',
|
|
@@ -1644,7 +1644,7 @@ var Popover = function Popover(_ref) {
|
|
|
1644
1644
|
portalTarget = _ref.portalTarget,
|
|
1645
1645
|
_ref$trapFocus = _ref.trapFocus,
|
|
1646
1646
|
trapFocus = _ref$trapFocus === void 0 ? false : _ref$trapFocus,
|
|
1647
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1647
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$v);
|
|
1648
1648
|
var triggerRef = React.useRef(null);
|
|
1649
1649
|
var popperRef = React.useRef(null);
|
|
1650
1650
|
var _useState = React.useState(null),
|
|
@@ -1750,7 +1750,7 @@ var Popover = function Popover(_ref) {
|
|
|
1750
1750
|
withPortal && portalTarget ? reactDom.createPortal(renderPopperContent(), portalTarget) : renderPopperContent()));
|
|
1751
1751
|
};
|
|
1752
1752
|
|
|
1753
|
-
var _excluded$
|
|
1753
|
+
var _excluded$u = ["datePickerProps", "textInputProps", "dateFormat", "dateOptions", "popoverProps"];
|
|
1754
1754
|
var defaultDatePickerProps = {
|
|
1755
1755
|
selected: null,
|
|
1756
1756
|
selectsRange: false
|
|
@@ -1770,7 +1770,7 @@ var DateInput = function DateInput(_ref) {
|
|
|
1770
1770
|
dateOptions = _ref$dateOptions === void 0 ? undefined : _ref$dateOptions,
|
|
1771
1771
|
_ref$popoverProps = _ref.popoverProps,
|
|
1772
1772
|
popoverProps = _ref$popoverProps === void 0 ? _extends({}, defaultPopoverProps) : _ref$popoverProps,
|
|
1773
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1773
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$u);
|
|
1774
1774
|
var mergedDatePickerProps = _extends({}, defaultDatePickerProps, datePickerProps);
|
|
1775
1775
|
var mergedPopoverProps = _extends({}, defaultPopoverProps, popoverProps);
|
|
1776
1776
|
var mergedTextInputProps = _extends({}, defaultTextInputProps, textInputProps);
|
|
@@ -1847,14 +1847,14 @@ var DateInput = function DateInput(_ref) {
|
|
|
1847
1847
|
var ENTER = 13;
|
|
1848
1848
|
var SPACE = 32;
|
|
1849
1849
|
|
|
1850
|
-
var _excluded$
|
|
1850
|
+
var _excluded$t = ["children", "display", "isDetailsOpen", "onToggle"];
|
|
1851
1851
|
var DetailsSummary = function DetailsSummary(_ref) {
|
|
1852
1852
|
var children = _ref.children,
|
|
1853
1853
|
_ref$display = _ref.display,
|
|
1854
1854
|
display = _ref$display === void 0 ? 'block' : _ref$display,
|
|
1855
1855
|
isDetailsOpen = _ref.isDetailsOpen,
|
|
1856
1856
|
onToggle = _ref.onToggle,
|
|
1857
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1857
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$t);
|
|
1858
1858
|
var handleClick = function handleClick(event) {
|
|
1859
1859
|
// Needed to avoid default `details` behavior on a click event and keep this as controlled component.
|
|
1860
1860
|
event.preventDefault();
|
|
@@ -1892,14 +1892,14 @@ var DetailsSummary = function DetailsSummary(_ref) {
|
|
|
1892
1892
|
|
|
1893
1893
|
var styles$i = {"details-reset":"Details-module_details-reset__HWtSD"};
|
|
1894
1894
|
|
|
1895
|
-
var _excluded$
|
|
1895
|
+
var _excluded$s = ["children", "className", "display", "isOpen"];
|
|
1896
1896
|
var DetailsBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1897
1897
|
var children = _ref.children,
|
|
1898
1898
|
className = _ref.className,
|
|
1899
1899
|
_ref$display = _ref.display,
|
|
1900
1900
|
display = _ref$display === void 0 ? 'block' : _ref$display,
|
|
1901
1901
|
isOpen = _ref.isOpen,
|
|
1902
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1902
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$s);
|
|
1903
1903
|
var detailsClasses = classNames(className, styles$i['details-reset'], styles$i.details);
|
|
1904
1904
|
return React.createElement(Box, _extends({
|
|
1905
1905
|
as: "details",
|
|
@@ -1919,41 +1919,136 @@ var Details = /*#__PURE__*/function () {
|
|
|
1919
1919
|
|
|
1920
1920
|
var styles$h = {"drawer":"Drawer-module_drawer__IKoOm","hide-overlay-right":"Drawer-module_hide-overlay-right__FANA9","hide-overlay-left":"Drawer-module_hide-overlay-left__xZFa3","hide-overlay-bottom":"Drawer-module_hide-overlay-bottom__11EB1","hide-overlay-top":"Drawer-module_hide-overlay-top__kEsV5","drawer-content":"Drawer-module_drawer-content__zZ9xR","left":"Drawer-module_left__pwTcW","right":"Drawer-module_right__EzGpI","bottom":"Drawer-module_bottom__r3Q5Z","top":"Drawer-module_top__xQejO"};
|
|
1921
1921
|
|
|
1922
|
-
var
|
|
1922
|
+
var _excluded$r = ["defaultIsOpen", "open", "onOpenChange", "className", "children"],
|
|
1923
|
+
_excluded2$2 = ["asChild", "onClick"],
|
|
1924
|
+
_excluded3$2 = ["className"],
|
|
1925
|
+
_excluded4$2 = ["className", "onClick", "onClose"],
|
|
1926
|
+
_excluded5$2 = ["className"];
|
|
1927
|
+
var DrawerContext = /*#__PURE__*/React.createContext(null);
|
|
1928
|
+
function useDrawer() {
|
|
1929
|
+
var context = React.useContext(DrawerContext);
|
|
1930
|
+
if (!context) {
|
|
1931
|
+
throw new Error('useDrawer must be used within a DrawerProvider.');
|
|
1932
|
+
}
|
|
1933
|
+
return context;
|
|
1934
|
+
}
|
|
1935
|
+
var DrawerProvider = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1936
|
+
var _ref$defaultIsOpen = _ref.defaultIsOpen,
|
|
1937
|
+
defaultIsOpen = _ref$defaultIsOpen === void 0 ? false : _ref$defaultIsOpen,
|
|
1938
|
+
openProp = _ref.open,
|
|
1939
|
+
setOpenProp = _ref.onOpenChange,
|
|
1940
|
+
className = _ref.className,
|
|
1941
|
+
children = _ref.children,
|
|
1942
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$r);
|
|
1943
|
+
var _useState = React.useState(openProp != null ? openProp : defaultIsOpen),
|
|
1944
|
+
_open = _useState[0],
|
|
1945
|
+
_setOpen = _useState[1];
|
|
1946
|
+
var open = openProp != null ? openProp : _open;
|
|
1947
|
+
var setOpen = React.useCallback(function (value) {
|
|
1948
|
+
var newOpen = typeof value === 'function' ? value(open) : value;
|
|
1949
|
+
if (newOpen !== open) {
|
|
1950
|
+
if (setOpenProp) {
|
|
1951
|
+
setOpenProp(newOpen); // Controlled
|
|
1952
|
+
} else {
|
|
1953
|
+
_setOpen(newOpen); // Uncontrolled
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
}, [open, setOpenProp]);
|
|
1957
|
+
var toggleDrawer = React.useCallback(function () {
|
|
1958
|
+
setOpen(function (prev) {
|
|
1959
|
+
return !prev;
|
|
1960
|
+
});
|
|
1961
|
+
}, [setOpen]);
|
|
1962
|
+
var contextValue = React.useMemo(function () {
|
|
1963
|
+
return {
|
|
1964
|
+
open: open,
|
|
1965
|
+
setOpen: setOpen,
|
|
1966
|
+
toggleDrawer: toggleDrawer
|
|
1967
|
+
};
|
|
1968
|
+
}, [open, setOpen, toggleDrawer]);
|
|
1969
|
+
return React.createElement(DrawerContext.Provider, {
|
|
1970
|
+
value: contextValue
|
|
1971
|
+
}, React.createElement("div", _extends({
|
|
1972
|
+
className: classNames('drawer-container', {
|
|
1973
|
+
'drawer-open': open
|
|
1974
|
+
}, className),
|
|
1975
|
+
ref: ref
|
|
1976
|
+
}, props), children));
|
|
1977
|
+
});
|
|
1978
|
+
DrawerProvider.displayName = 'DrawerProvider';
|
|
1979
|
+
var DrawerTrigger = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
1980
|
+
var _ref2$asChild = _ref2.asChild,
|
|
1981
|
+
asChild = _ref2$asChild === void 0 ? false : _ref2$asChild,
|
|
1982
|
+
onClick = _ref2.onClick,
|
|
1983
|
+
triggerProps = _objectWithoutPropertiesLoose(_ref2, _excluded2$2);
|
|
1984
|
+
var context = React.useContext(DrawerContext);
|
|
1985
|
+
var isStandalone = !context;
|
|
1986
|
+
var handleClick = function handleClick(event) {
|
|
1987
|
+
onClick == null || onClick(event);
|
|
1988
|
+
if (!isStandalone) {
|
|
1989
|
+
// Use context to toggle the drawer
|
|
1990
|
+
context == null || context.toggleDrawer();
|
|
1991
|
+
}
|
|
1992
|
+
};
|
|
1993
|
+
var Comp = asChild ? reactSlot.Slot : 'button';
|
|
1994
|
+
return React.createElement(Comp, _extends({
|
|
1995
|
+
ref: ref,
|
|
1996
|
+
"data-drawer": "trigger",
|
|
1997
|
+
"aria-haspopup": "dialog",
|
|
1998
|
+
"aria-expanded": context == null ? void 0 : context.open,
|
|
1999
|
+
"data-state": context == null ? void 0 : context.open,
|
|
2000
|
+
"aria-label": "toggle drawer"
|
|
2001
|
+
}, triggerProps, {
|
|
2002
|
+
onClick: handleClick
|
|
2003
|
+
}));
|
|
2004
|
+
});
|
|
2005
|
+
DrawerTrigger.displayName = 'SidebarTrigger';
|
|
2006
|
+
var Drawer = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
|
|
1923
2007
|
var _dynamicStyle, _classNames, _classNames2;
|
|
1924
|
-
var
|
|
1925
|
-
ariaLabel =
|
|
1926
|
-
|
|
1927
|
-
ariaLabelledBy =
|
|
1928
|
-
|
|
1929
|
-
allowPinchZoom =
|
|
1930
|
-
|
|
1931
|
-
children =
|
|
1932
|
-
|
|
1933
|
-
className =
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
onDismiss =
|
|
1951
|
-
|
|
1952
|
-
placement =
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
2008
|
+
var _ref3$ariaLabel = _ref3.ariaLabel,
|
|
2009
|
+
ariaLabel = _ref3$ariaLabel === void 0 ? undefined : _ref3$ariaLabel,
|
|
2010
|
+
_ref3$ariaLabelledBy = _ref3.ariaLabelledBy,
|
|
2011
|
+
ariaLabelledBy = _ref3$ariaLabelledBy === void 0 ? undefined : _ref3$ariaLabelledBy,
|
|
2012
|
+
_ref3$allowPinchZoom = _ref3.allowPinchZoom,
|
|
2013
|
+
allowPinchZoom = _ref3$allowPinchZoom === void 0 ? false : _ref3$allowPinchZoom,
|
|
2014
|
+
_ref3$children = _ref3.children,
|
|
2015
|
+
children = _ref3$children === void 0 ? undefined : _ref3$children,
|
|
2016
|
+
_ref3$className = _ref3.className,
|
|
2017
|
+
className = _ref3$className === void 0 ? undefined : _ref3$className,
|
|
2018
|
+
_ref3$closeOnOverlayC = _ref3.closeOnOverlayClick,
|
|
2019
|
+
closeOnOverlayClick = _ref3$closeOnOverlayC === void 0 ? true : _ref3$closeOnOverlayC,
|
|
2020
|
+
_ref3$containerRef = _ref3.containerRef,
|
|
2021
|
+
containerRef = _ref3$containerRef === void 0 ? undefined : _ref3$containerRef,
|
|
2022
|
+
_ref3$dangerouslyBypa = _ref3.dangerouslyBypassFocusLock,
|
|
2023
|
+
dangerouslyBypassFocusLock = _ref3$dangerouslyBypa === void 0 ? false : _ref3$dangerouslyBypa,
|
|
2024
|
+
_ref3$dangerouslyBypa2 = _ref3.dangerouslyBypassScrollLock,
|
|
2025
|
+
dangerouslyBypassScrollLock = _ref3$dangerouslyBypa2 === void 0 ? false : _ref3$dangerouslyBypa2,
|
|
2026
|
+
_ref3$hideOverlay = _ref3.hideOverlay,
|
|
2027
|
+
hideOverlay = _ref3$hideOverlay === void 0 ? false : _ref3$hideOverlay,
|
|
2028
|
+
_ref3$initialFocusRef = _ref3.initialFocusRef,
|
|
2029
|
+
initialFocusRef = _ref3$initialFocusRef === void 0 ? undefined : _ref3$initialFocusRef,
|
|
2030
|
+
controlledIsOpen = _ref3.isOpen,
|
|
2031
|
+
_ref3$defaultIsOpen = _ref3.defaultIsOpen,
|
|
2032
|
+
defaultIsOpen = _ref3$defaultIsOpen === void 0 ? false : _ref3$defaultIsOpen,
|
|
2033
|
+
_ref3$onDismiss = _ref3.onDismiss,
|
|
2034
|
+
onDismiss = _ref3$onDismiss === void 0 ? undefined : _ref3$onDismiss,
|
|
2035
|
+
_ref3$placement = _ref3.placement,
|
|
2036
|
+
placement = _ref3$placement === void 0 ? 'right' : _ref3$placement,
|
|
2037
|
+
_ref3$width = _ref3.width,
|
|
2038
|
+
width = _ref3$width === void 0 ? undefined : _ref3$width;
|
|
2039
|
+
var context = React.useContext(DrawerContext);
|
|
2040
|
+
var isStandalone = !context; // Determine if there's no provider
|
|
2041
|
+
var _useState2 = React.useState(defaultIsOpen),
|
|
2042
|
+
uncontrolledOpen = _useState2[0],
|
|
2043
|
+
setUncontrolledOpen = _useState2[1];
|
|
2044
|
+
var isOpen = isStandalone ? controlledIsOpen != null ? controlledIsOpen : uncontrolledOpen // Use internal or prop-based state
|
|
2045
|
+
: context.open; // Use context-provided state
|
|
2046
|
+
var setOpen = isStandalone ? setUncontrolledOpen // Update internal state
|
|
2047
|
+
: context.setOpen; // Update context state
|
|
2048
|
+
var handleDismiss = React.useCallback(function (event) {
|
|
2049
|
+
setOpen(false); // Update state (context or standalone)
|
|
2050
|
+
onDismiss == null || onDismiss(event); // Trigger external callback
|
|
2051
|
+
}, [setOpen, onDismiss]);
|
|
1957
2052
|
var activateFocusLock = React.useCallback(function () {
|
|
1958
2053
|
setTimeout(function () {
|
|
1959
2054
|
if (initialFocusRef && initialFocusRef.current) {
|
|
@@ -1962,49 +2057,9 @@ var Drawer = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1962
2057
|
}, 100);
|
|
1963
2058
|
}, [initialFocusRef]);
|
|
1964
2059
|
var dynamicWidth = width;
|
|
1965
|
-
var dynamicStyle = (_dynamicStyle = {}, _dynamicStyle['--
|
|
2060
|
+
var dynamicStyle = (_dynamicStyle = {}, _dynamicStyle['--drawer-width'] = dynamicWidth, _dynamicStyle);
|
|
1966
2061
|
var overlayClassnames = classNames(styles$h.overlay, styles$h.drawer, (_classNames = {}, _classNames[styles$h['hide-overlay']] = hideOverlay, _classNames[styles$h["hide-overlay-" + placement]] = hideOverlay, _classNames['position-fixed'] = containerRef === undefined, _classNames['position-absolute'] = containerRef !== undefined, _classNames));
|
|
1967
|
-
var contentClassnames = classNames(styles$h['drawer-content'], styles$h[placement], (_classNames2 = {}, _classNames2[styles$h['hide-overlay']] = hideOverlay, _classNames2
|
|
1968
|
-
var renderHeader = function renderHeader() {
|
|
1969
|
-
if (closeButton && onDismiss && !title) {
|
|
1970
|
-
return React.createElement(Box, {
|
|
1971
|
-
alignItems: "flex-end",
|
|
1972
|
-
justifyContent: "center",
|
|
1973
|
-
padding: "md lg"
|
|
1974
|
-
}, React.createElement(Button, {
|
|
1975
|
-
variant: "tertiary",
|
|
1976
|
-
onClick: onDismiss,
|
|
1977
|
-
"aria-label": "close",
|
|
1978
|
-
type: "button",
|
|
1979
|
-
iconPrefix: "remove"
|
|
1980
|
-
}));
|
|
1981
|
-
}
|
|
1982
|
-
if (title) {
|
|
1983
|
-
return React.createElement(Box, {
|
|
1984
|
-
direction: "row",
|
|
1985
|
-
justifyContent: "space-between",
|
|
1986
|
-
alignItems: "center",
|
|
1987
|
-
padding: {
|
|
1988
|
-
base: '2xl',
|
|
1989
|
-
tablet: '4xl'
|
|
1990
|
-
}
|
|
1991
|
-
}, React.createElement(Box, {
|
|
1992
|
-
className: styles$h.title,
|
|
1993
|
-
fontWeight: "bold"
|
|
1994
|
-
}, title), onDismiss && React.createElement(Button, {
|
|
1995
|
-
variant: "tertiary",
|
|
1996
|
-
onClick: onDismiss,
|
|
1997
|
-
"aria-label": "close",
|
|
1998
|
-
type: "button",
|
|
1999
|
-
iconPrefix: "remove"
|
|
2000
|
-
}));
|
|
2001
|
-
}
|
|
2002
|
-
return null;
|
|
2003
|
-
};
|
|
2004
|
-
var content = title || closeButton ? React.createElement(Box, {
|
|
2005
|
-
flex: "auto",
|
|
2006
|
-
overflow: "auto"
|
|
2007
|
-
}, children) : children;
|
|
2062
|
+
var contentClassnames = classNames(styles$h['drawer-content'], styles$h[placement], (_classNames2 = {}, _classNames2[styles$h['hide-overlay']] = hideOverlay, _classNames2));
|
|
2008
2063
|
var parentElement = containerRef != null && containerRef.current ? containerRef.current : document.body;
|
|
2009
2064
|
var isDisabledFocusLock = hideOverlay || dangerouslyBypassFocusLock;
|
|
2010
2065
|
var isDisabledRemoveScroll = hideOverlay || dangerouslyBypassScrollLock;
|
|
@@ -2022,7 +2077,7 @@ var Drawer = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
2022
2077
|
isOpen: isOpen,
|
|
2023
2078
|
overlayClassName: overlayClassnames,
|
|
2024
2079
|
className: contentClassnames,
|
|
2025
|
-
onRequestClose: closeOnOverlayClick ?
|
|
2080
|
+
onRequestClose: closeOnOverlayClick ? handleDismiss : undefined,
|
|
2026
2081
|
ariaHideApp: false,
|
|
2027
2082
|
style: {
|
|
2028
2083
|
content: dynamicStyle,
|
|
@@ -2034,8 +2089,78 @@ var Drawer = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
2034
2089
|
}, React.createElement(Box, {
|
|
2035
2090
|
"aria-label": ariaLabel,
|
|
2036
2091
|
"aria-labelledby": ariaLabelledBy,
|
|
2037
|
-
height: "100
|
|
2038
|
-
|
|
2092
|
+
height: "100",
|
|
2093
|
+
"data-testid": "drawer-content",
|
|
2094
|
+
className: className
|
|
2095
|
+
}, children)))));
|
|
2096
|
+
});
|
|
2097
|
+
var DrawerHeader = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
|
|
2098
|
+
var props = _objectWithoutPropertiesLoose(_ref4, _excluded3$2);
|
|
2099
|
+
return React.createElement(Box, _extends({
|
|
2100
|
+
ref: ref,
|
|
2101
|
+
"data-drawer": "header",
|
|
2102
|
+
direction: "row",
|
|
2103
|
+
justifyContent: "space-between",
|
|
2104
|
+
alignItems: "center",
|
|
2105
|
+
padding: {
|
|
2106
|
+
base: '2xl 2xl 0 2xl',
|
|
2107
|
+
tablet: '3xl 3xl 0 3xl'
|
|
2108
|
+
}
|
|
2109
|
+
}, props));
|
|
2110
|
+
});
|
|
2111
|
+
DrawerHeader.displayName = 'DrawerHeader';
|
|
2112
|
+
var DrawerTitle = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
|
|
2113
|
+
var props = _extends({}, (_objectDestructuringEmpty(_ref5), _ref5));
|
|
2114
|
+
return React.createElement(Box, _extends({
|
|
2115
|
+
ref: ref,
|
|
2116
|
+
"data-drawer": "title",
|
|
2117
|
+
fontWeight: "bold"
|
|
2118
|
+
}, props));
|
|
2119
|
+
});
|
|
2120
|
+
var DrawerCloseButton = /*#__PURE__*/React.forwardRef(function (_ref6, ref) {
|
|
2121
|
+
var className = _ref6.className,
|
|
2122
|
+
onClick = _ref6.onClick,
|
|
2123
|
+
onClose = _ref6.onClose,
|
|
2124
|
+
props = _objectWithoutPropertiesLoose(_ref6, _excluded4$2);
|
|
2125
|
+
var context = React.useContext(DrawerContext);
|
|
2126
|
+
var isStandalone = !context;
|
|
2127
|
+
var handleClick = function handleClick(event) {
|
|
2128
|
+
onClick == null || onClick(event);
|
|
2129
|
+
if (isStandalone) {
|
|
2130
|
+
// Fallback to onClose if provided
|
|
2131
|
+
onClose == null || onClose();
|
|
2132
|
+
} else {
|
|
2133
|
+
// Use context to toggle the drawer
|
|
2134
|
+
context == null || context.toggleDrawer();
|
|
2135
|
+
}
|
|
2136
|
+
};
|
|
2137
|
+
return React.createElement(Button, _extends({
|
|
2138
|
+
ref: ref,
|
|
2139
|
+
variant: "tertiary",
|
|
2140
|
+
"aria-label": "close",
|
|
2141
|
+
type: "button",
|
|
2142
|
+
iconPrefix: "remove",
|
|
2143
|
+
"data-drawer": "close",
|
|
2144
|
+
className: classNames('m-left-auto', className),
|
|
2145
|
+
size: "sm",
|
|
2146
|
+
onClick: handleClick
|
|
2147
|
+
}, props));
|
|
2148
|
+
});
|
|
2149
|
+
DrawerCloseButton.displayName = 'DrawerCloseButton';
|
|
2150
|
+
var DrawerContent = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
2151
|
+
var props = _objectWithoutPropertiesLoose(_ref7, _excluded5$2);
|
|
2152
|
+
return React.createElement(Box, _extends({
|
|
2153
|
+
ref: ref,
|
|
2154
|
+
"data-drawer": "content",
|
|
2155
|
+
flex: "auto",
|
|
2156
|
+
overflow: "auto",
|
|
2157
|
+
alignItems: "flex-start",
|
|
2158
|
+
padding: {
|
|
2159
|
+
base: '2xl',
|
|
2160
|
+
tablet: '3xl'
|
|
2161
|
+
},
|
|
2162
|
+
gap: "md"
|
|
2163
|
+
}, props));
|
|
2039
2164
|
});
|
|
2040
2165
|
|
|
2041
2166
|
var _excluded$q = ["className", "inset"],
|
|
@@ -5298,6 +5423,12 @@ exports.Details = Details;
|
|
|
5298
5423
|
exports.DetailsBaseComponent = DetailsBaseComponent;
|
|
5299
5424
|
exports.DetailsSummary = DetailsSummary;
|
|
5300
5425
|
exports.Drawer = Drawer;
|
|
5426
|
+
exports.DrawerCloseButton = DrawerCloseButton;
|
|
5427
|
+
exports.DrawerContent = DrawerContent;
|
|
5428
|
+
exports.DrawerHeader = DrawerHeader;
|
|
5429
|
+
exports.DrawerProvider = DrawerProvider;
|
|
5430
|
+
exports.DrawerTitle = DrawerTitle;
|
|
5431
|
+
exports.DrawerTrigger = DrawerTrigger;
|
|
5301
5432
|
exports.DropdownMenu = DropdownMenu;
|
|
5302
5433
|
exports.DropdownMenuContent = DropdownMenuContent;
|
|
5303
5434
|
exports.DropdownMenuGroup = DropdownMenuGroup;
|
|
@@ -5372,6 +5503,7 @@ exports.boxPropsKeys = boxPropsKeys;
|
|
|
5372
5503
|
exports.createRectRef = createRectRef;
|
|
5373
5504
|
exports.toast = toast;
|
|
5374
5505
|
exports.useBreakpoint = useBreakpoint;
|
|
5506
|
+
exports.useDrawer = useDrawer;
|
|
5375
5507
|
exports.useIsMobile = useIsMobile;
|
|
5376
5508
|
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
5377
5509
|
exports.useOpenClose = useOpenClose;
|