@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { forwardRef, Children, createElement, cloneElement, useRef, useState, useEffect, isValidElement, useCallback, useMemo,
|
|
3
|
+
import React__default, { forwardRef, Children, createElement, cloneElement, useRef, useState, useEffect, isValidElement, useContext, useCallback, useMemo, createContext, useLayoutEffect } from 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import icons from '@hyphen/hyphen-design-tokens/build/assets/icons/react';
|
|
6
6
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
@@ -11,6 +11,7 @@ import { usePopper } from 'react-popper';
|
|
|
11
11
|
import FocusTrap from 'focus-trap-react';
|
|
12
12
|
import designTokens from '@hyphen/hyphen-design-tokens/build/json/variables';
|
|
13
13
|
import '@hyphen/hyphen-design-tokens/build/assets/icons';
|
|
14
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
14
15
|
import ReactModal from 'react-modal';
|
|
15
16
|
import FocusLock from 'react-focus-lock';
|
|
16
17
|
import { RemoveScroll } from 'react-remove-scroll';
|
|
@@ -20,7 +21,6 @@ import Select, { components } from 'react-select';
|
|
|
20
21
|
import AsyncCreatableSelect from 'react-select/async-creatable';
|
|
21
22
|
import AsyncSelect from 'react-select/async';
|
|
22
23
|
import CreatableSelect from 'react-select/creatable';
|
|
23
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
24
24
|
import { v4 } from 'uuid';
|
|
25
25
|
|
|
26
26
|
function _extends() {
|
|
@@ -251,7 +251,7 @@ Component, props, getDefault) {
|
|
|
251
251
|
|
|
252
252
|
var styles$w = {"box-transition":"Box-module_box-transition__eQx8C"};
|
|
253
253
|
|
|
254
|
-
var _excluded$
|
|
254
|
+
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"];
|
|
255
255
|
/**
|
|
256
256
|
* A `<Box>` is a layout component to build UIs with consistent padding and spacing between
|
|
257
257
|
* elements.
|
|
@@ -338,7 +338,7 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
338
338
|
width = _ref$width === void 0 ? undefined : _ref$width,
|
|
339
339
|
_ref$zIndex = _ref.zIndex,
|
|
340
340
|
zIndex = _ref$zIndex === void 0 ? undefined : _ref$zIndex,
|
|
341
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
341
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$M);
|
|
342
342
|
var heightCss = getDimensionCss('h', height);
|
|
343
343
|
var widthCss = getDimensionCss('w', width);
|
|
344
344
|
var maxHeightCss = getDimensionCss('mh', maxHeight);
|
|
@@ -489,14 +489,14 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
489
489
|
});
|
|
490
490
|
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'];
|
|
491
491
|
|
|
492
|
-
var _excluded$
|
|
492
|
+
var _excluded$L = ["className", "name", "color", "size"];
|
|
493
493
|
var Icon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
494
494
|
var _ref$className = _ref.className,
|
|
495
495
|
className = _ref$className === void 0 ? undefined : _ref$className,
|
|
496
496
|
name = _ref.name,
|
|
497
497
|
color = _ref.color,
|
|
498
498
|
size = _ref.size,
|
|
499
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
499
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$L);
|
|
500
500
|
var IconComponent = icons[name];
|
|
501
501
|
if (!IconComponent) console.error("Icon '" + name + "' not found"); // eslint-disable-line no-console
|
|
502
502
|
var iconClasses = classNames(className, generateResponsiveClasses('font-color', color), generateResponsiveClasses('font-size', size));
|
|
@@ -535,7 +535,7 @@ var ALERT_ICONS_MAP = {
|
|
|
535
535
|
}
|
|
536
536
|
};
|
|
537
537
|
|
|
538
|
-
var _excluded$
|
|
538
|
+
var _excluded$K = ["className", "closeText", "hasIcon", "isCompact", "isClosable", "message", "onClose", "render", "title", "variant"];
|
|
539
539
|
var Alert = function Alert(_ref) {
|
|
540
540
|
var _ref$className = _ref.className,
|
|
541
541
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
@@ -557,7 +557,7 @@ var Alert = function Alert(_ref) {
|
|
|
557
557
|
title = _ref$title === void 0 ? '' : _ref$title,
|
|
558
558
|
_ref$variant = _ref.variant,
|
|
559
559
|
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
560
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
560
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$K);
|
|
561
561
|
var handleClose = function handleClose(event) {
|
|
562
562
|
if (!onClose) return;
|
|
563
563
|
onClose(event);
|
|
@@ -611,7 +611,7 @@ var Alert = function Alert(_ref) {
|
|
|
611
611
|
|
|
612
612
|
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"};
|
|
613
613
|
|
|
614
|
-
var _excluded$
|
|
614
|
+
var _excluded$J = ["className", "message", "variant", "size"];
|
|
615
615
|
var Badge = function Badge(_ref) {
|
|
616
616
|
var _classNames;
|
|
617
617
|
var _ref$className = _ref.className,
|
|
@@ -622,7 +622,7 @@ var Badge = function Badge(_ref) {
|
|
|
622
622
|
variant = _ref$variant === void 0 ? 'light-grey' : _ref$variant,
|
|
623
623
|
_ref$size = _ref.size,
|
|
624
624
|
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
625
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
625
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$J);
|
|
626
626
|
var responsiveClasses = generateResponsiveClasses('size', size).map(function (c) {
|
|
627
627
|
return styles$u[c];
|
|
628
628
|
});
|
|
@@ -757,7 +757,7 @@ var handleReactRouterClick = function handleReactRouterClick(event, onClick, tar
|
|
|
757
757
|
|
|
758
758
|
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"};
|
|
759
759
|
|
|
760
|
-
var _excluded$
|
|
760
|
+
var _excluded$I = ["children", "as", "className", "fullWidth", "id", "href", "iconPrefix", "iconSuffix", "isDisabled", "isLoading", "navigate", "onClick", "onFocus", "onBlur", "shadow", "size", "tabIndex", "target", "type", "variant"];
|
|
761
761
|
var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
762
762
|
var _classNames, _extends2;
|
|
763
763
|
var _ref$children = _ref.children,
|
|
@@ -800,7 +800,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
800
800
|
type = _ref$type === void 0 ? undefined : _ref$type,
|
|
801
801
|
_ref$variant = _ref.variant,
|
|
802
802
|
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
803
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
803
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$I);
|
|
804
804
|
var disabled = isLoading || isDisabled;
|
|
805
805
|
var responsiveClasses = generateResponsiveClasses('size', size).map(function (c) {
|
|
806
806
|
return styles$s[c];
|
|
@@ -854,7 +854,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
854
854
|
}, _extends2.onFocus = handleFocus, _extends2.ref = ref, _extends2.type = type || (as !== 'a' && !href ? 'button' : undefined), _extends2.tabIndex = tabIndex, _extends2), restProps), buttonContent);
|
|
855
855
|
});
|
|
856
856
|
|
|
857
|
-
var _excluded$
|
|
857
|
+
var _excluded$H = ["background", "borderColor", "borderWidth", "children", "display", "padding"];
|
|
858
858
|
var CardFooter = function CardFooter(_ref) {
|
|
859
859
|
var _ref$background = _ref.background,
|
|
860
860
|
background = _ref$background === void 0 ? 'secondary' : _ref$background,
|
|
@@ -868,7 +868,7 @@ var CardFooter = function CardFooter(_ref) {
|
|
|
868
868
|
display = _ref$display === void 0 ? 'block' : _ref$display,
|
|
869
869
|
_ref$padding = _ref.padding,
|
|
870
870
|
padding = _ref$padding === void 0 ? '2xl' : _ref$padding,
|
|
871
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
871
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$H);
|
|
872
872
|
return React__default.createElement(Box, _extends({
|
|
873
873
|
display: display,
|
|
874
874
|
padding: padding,
|
|
@@ -889,7 +889,7 @@ var HEADING_DEFAULT_SIZE_MAP = {
|
|
|
889
889
|
|
|
890
890
|
var styles$r = {"heading":"Heading-module_heading__zKyv7"};
|
|
891
891
|
|
|
892
|
-
var _excluded$
|
|
892
|
+
var _excluded$G = ["as", "children", "className", "color", "size"];
|
|
893
893
|
var Heading = function Heading(_ref) {
|
|
894
894
|
var _classNames;
|
|
895
895
|
var _ref$as = _ref.as,
|
|
@@ -898,7 +898,7 @@ var Heading = function Heading(_ref) {
|
|
|
898
898
|
className = _ref.className,
|
|
899
899
|
color = _ref.color,
|
|
900
900
|
size = _ref.size,
|
|
901
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
901
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$G);
|
|
902
902
|
var element = getElementType(Heading, {
|
|
903
903
|
as: as
|
|
904
904
|
});
|
|
@@ -909,7 +909,7 @@ var Heading = function Heading(_ref) {
|
|
|
909
909
|
}, restProps), children);
|
|
910
910
|
};
|
|
911
911
|
|
|
912
|
-
var _excluded$
|
|
912
|
+
var _excluded$F = ["childGap", "children", "className", "display", "padding", "title"];
|
|
913
913
|
var CardHeader = function CardHeader(_ref) {
|
|
914
914
|
var _ref$childGap = _ref.childGap,
|
|
915
915
|
childGap = _ref$childGap === void 0 ? '2xs' : _ref$childGap,
|
|
@@ -923,7 +923,7 @@ var CardHeader = function CardHeader(_ref) {
|
|
|
923
923
|
padding = _ref$padding === void 0 ? '2xl' : _ref$padding,
|
|
924
924
|
_ref$title = _ref.title,
|
|
925
925
|
title = _ref$title === void 0 ? null : _ref$title,
|
|
926
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
926
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$F);
|
|
927
927
|
var renderTitle = function renderTitle() {
|
|
928
928
|
return typeof title === 'string' ? React__default.createElement(Heading, {
|
|
929
929
|
size: "sm",
|
|
@@ -940,7 +940,7 @@ var CardHeader = function CardHeader(_ref) {
|
|
|
940
940
|
|
|
941
941
|
var styles$q = {"card-section-border":"Card-module_card-section-border__OefDX"};
|
|
942
942
|
|
|
943
|
-
var _excluded$
|
|
943
|
+
var _excluded$E = ["background", "borderColor", "borderWidth", "children", "childGap", "gap", "className", "display", "padding", "subdued", "title"];
|
|
944
944
|
var CardSection = function CardSection(_ref) {
|
|
945
945
|
var _classNames;
|
|
946
946
|
var _ref$background = _ref.background,
|
|
@@ -965,7 +965,7 @@ var CardSection = function CardSection(_ref) {
|
|
|
965
965
|
subdued = _ref$subdued === void 0 ? undefined : _ref$subdued,
|
|
966
966
|
_ref$title = _ref.title,
|
|
967
967
|
title = _ref$title === void 0 ? undefined : _ref$title,
|
|
968
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
968
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$E);
|
|
969
969
|
var renderTitle = typeof title === 'string' ? React__default.createElement(Box, {
|
|
970
970
|
className: "m-bottom-md"
|
|
971
971
|
}, React__default.createElement(Box, {
|
|
@@ -988,7 +988,7 @@ var CardSection = function CardSection(_ref) {
|
|
|
988
988
|
}, children));
|
|
989
989
|
};
|
|
990
990
|
|
|
991
|
-
var _excluded$
|
|
991
|
+
var _excluded$D = ["children", "subdued", "overflow", "display", "width"];
|
|
992
992
|
var CardBaseComponent = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
993
993
|
var children = _ref.children,
|
|
994
994
|
subdued = _ref.subdued,
|
|
@@ -998,7 +998,7 @@ var CardBaseComponent = /*#__PURE__*/React__default.forwardRef(function (_ref, r
|
|
|
998
998
|
display = _ref$display === void 0 ? 'block' : _ref$display,
|
|
999
999
|
_ref$width = _ref.width,
|
|
1000
1000
|
width = _ref$width === void 0 ? '100' : _ref$width,
|
|
1001
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1001
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$D);
|
|
1002
1002
|
return React__default.createElement(Box, _extends({
|
|
1003
1003
|
background: subdued ? 'secondary' : 'primary',
|
|
1004
1004
|
borderWidth: "sm",
|
|
@@ -1021,7 +1021,7 @@ var Card = /*#__PURE__*/function () {
|
|
|
1021
1021
|
return Card;
|
|
1022
1022
|
}();
|
|
1023
1023
|
|
|
1024
|
-
var _excluded$
|
|
1024
|
+
var _excluded$C = ["className", "error", "isChecked", "isDisabled", "isIndeterminate"];
|
|
1025
1025
|
var CheckboxIcon = function CheckboxIcon(_ref) {
|
|
1026
1026
|
var _ref$className = _ref.className,
|
|
1027
1027
|
className = _ref$className === void 0 ? undefined : _ref$className,
|
|
@@ -1033,7 +1033,7 @@ var CheckboxIcon = function CheckboxIcon(_ref) {
|
|
|
1033
1033
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
1034
1034
|
_ref$isIndeterminate = _ref.isIndeterminate,
|
|
1035
1035
|
isIndeterminate = _ref$isIndeterminate === void 0 ? false : _ref$isIndeterminate,
|
|
1036
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1036
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$C);
|
|
1037
1037
|
var color = 'base';
|
|
1038
1038
|
var name = 'checkbox-btn';
|
|
1039
1039
|
if (isChecked) name = 'checkbox-btn-checked';else name = 'checkbox-btn';
|
|
@@ -1058,7 +1058,7 @@ var CheckboxIcon = function CheckboxIcon(_ref) {
|
|
|
1058
1058
|
|
|
1059
1059
|
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"};
|
|
1060
1060
|
|
|
1061
|
-
var _excluded$
|
|
1061
|
+
var _excluded$B = ["className", "display", "id", "isChecked", "label", "labelledby", "onChange", "error", "isDisabled", "isHidden", "isIndeterminate", "isRequired", "onBlur", "onFocus", "size", "value"];
|
|
1062
1062
|
var Checkbox = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
1063
1063
|
var _ref2;
|
|
1064
1064
|
var _ref$className = _ref.className,
|
|
@@ -1088,7 +1088,7 @@ var Checkbox = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
1088
1088
|
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
1089
1089
|
_ref$value = _ref.value,
|
|
1090
1090
|
value = _ref$value === void 0 ? undefined : _ref$value,
|
|
1091
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1091
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$B);
|
|
1092
1092
|
var inputRef = React__default.useRef(null);
|
|
1093
1093
|
React__default.useEffect(function () {
|
|
1094
1094
|
if (inputRef != null && inputRef.current) {
|
|
@@ -1177,7 +1177,7 @@ var HelpText = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
1177
1177
|
}, children);
|
|
1178
1178
|
});
|
|
1179
1179
|
|
|
1180
|
-
var _excluded$
|
|
1180
|
+
var _excluded$A = ["children", "inputId", "className", "display", "helpText", "isDisabled", "isFieldRequired", "isRadioInputLabel", "requiredIndicator", "margin", "padding"];
|
|
1181
1181
|
var FormLabel = function FormLabel(_ref) {
|
|
1182
1182
|
var _classNames;
|
|
1183
1183
|
var children = _ref.children,
|
|
@@ -1199,7 +1199,7 @@ var FormLabel = function FormLabel(_ref) {
|
|
|
1199
1199
|
margin = _ref$margin === void 0 ? '0' : _ref$margin,
|
|
1200
1200
|
_ref$padding = _ref.padding,
|
|
1201
1201
|
padding = _ref$padding === void 0 ? '0' : _ref$padding,
|
|
1202
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1202
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$A);
|
|
1203
1203
|
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));
|
|
1204
1204
|
return React__default.createElement(Box, _extends({
|
|
1205
1205
|
as: "label",
|
|
@@ -1212,7 +1212,7 @@ var FormLabel = function FormLabel(_ref) {
|
|
|
1212
1212
|
}, restProps), children, isFieldRequired && requiredIndicator && React__default.createElement("span", null, requiredIndicator), helpText && React__default.createElement(HelpText, null, helpText));
|
|
1213
1213
|
};
|
|
1214
1214
|
|
|
1215
|
-
var _excluded$
|
|
1215
|
+
var _excluded$z = ["id", "isChecked", "label", "onChange", "className", "error", "hideLabel", "helpText", "isDisabled", "isIndeterminate", "isRequired", "onBlur", "onFocus", "requiredIndicator", "size"];
|
|
1216
1216
|
var labelMarginSizeMap = {
|
|
1217
1217
|
sm: '2xs 0 0 0',
|
|
1218
1218
|
md: 'xs 0 0 0',
|
|
@@ -1257,7 +1257,7 @@ var CheckboxInput = function CheckboxInput(_ref2) {
|
|
|
1257
1257
|
requiredIndicator = _ref2$requiredIndicat === void 0 ? ' *' : _ref2$requiredIndicat,
|
|
1258
1258
|
_ref2$size = _ref2.size,
|
|
1259
1259
|
size = _ref2$size === void 0 ? 'md' : _ref2$size,
|
|
1260
|
-
restProps = _objectWithoutPropertiesLoose(_ref2, _excluded$
|
|
1260
|
+
restProps = _objectWithoutPropertiesLoose(_ref2, _excluded$z);
|
|
1261
1261
|
var handleBlur = function handleBlur(event) {
|
|
1262
1262
|
if (onBlur) onBlur(event);
|
|
1263
1263
|
};
|
|
@@ -1305,7 +1305,7 @@ var CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
|
1305
1305
|
|
|
1306
1306
|
var styles$l = {};
|
|
1307
1307
|
|
|
1308
|
-
var _excluded$
|
|
1308
|
+
var _excluded$y = ["children", "dayClassName", "maxDate", "minDate", "monthsShown", "openToDate", "startDate", "selected", "selectsRange", "showTwoColumnMonthYearPicker", "showFullMonthYearPicker", "showMonthYearPicker", "className", "formatWeekDay"];
|
|
1309
1309
|
var DatePicker = function DatePicker(_ref) {
|
|
1310
1310
|
var _ref$children = _ref.children,
|
|
1311
1311
|
children = _ref$children === void 0 ? null : _ref$children,
|
|
@@ -1337,7 +1337,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
1337
1337
|
formatWeekDay = _ref$formatWeekDay === void 0 ? function (formattedDate) {
|
|
1338
1338
|
return formattedDate[0];
|
|
1339
1339
|
} : _ref$formatWeekDay,
|
|
1340
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1340
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$y);
|
|
1341
1341
|
var datePickerClasses = classNames(styles$l['react-datepicker'], className);
|
|
1342
1342
|
return React__default.createElement(ReactDatePicker, _extends({
|
|
1343
1343
|
inline: true,
|
|
@@ -1357,7 +1357,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
1357
1357
|
}, restProps), children);
|
|
1358
1358
|
};
|
|
1359
1359
|
|
|
1360
|
-
var _excluded$
|
|
1360
|
+
var _excluded$x = ["label", "hideLabel", "children", "error", "id", "isRequired", "helpText", "isDisabled", "requiredIndicator", "width"];
|
|
1361
1361
|
var FormControl = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
1362
1362
|
var label = _ref.label,
|
|
1363
1363
|
hideLabel = _ref.hideLabel,
|
|
@@ -1370,7 +1370,7 @@ var FormControl = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
1370
1370
|
requiredIndicator = _ref.requiredIndicator,
|
|
1371
1371
|
_ref$width = _ref.width,
|
|
1372
1372
|
width = _ref$width === void 0 ? '100' : _ref$width,
|
|
1373
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1373
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$x);
|
|
1374
1374
|
var labelProps = {
|
|
1375
1375
|
inputId: id,
|
|
1376
1376
|
helpText: helpText,
|
|
@@ -1398,7 +1398,7 @@ function getAutoCompleteValue(value) {
|
|
|
1398
1398
|
|
|
1399
1399
|
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"};
|
|
1400
1400
|
|
|
1401
|
-
var _excluded$
|
|
1401
|
+
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"];
|
|
1402
1402
|
var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
1403
1403
|
var _ref2;
|
|
1404
1404
|
var id = _ref.id,
|
|
@@ -1442,7 +1442,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
1442
1442
|
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
1443
1443
|
_ref$type = _ref.type,
|
|
1444
1444
|
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
1445
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1445
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$w);
|
|
1446
1446
|
var responsiveClasses = generateResponsiveClasses('size', size);
|
|
1447
1447
|
var inputWrapperClasses = classNames.apply(void 0, ['hyphen-components__variables__form-control', styles$k['text-input-wrapper']].concat(responsiveClasses.map(function (c) {
|
|
1448
1448
|
return styles$k[c];
|
|
@@ -1591,7 +1591,7 @@ var BREAKPOINTS = /*#__PURE__*/[].concat(Object.entries(designTokens.size.breakp
|
|
|
1591
1591
|
var Z_INDEX_VALUES = designTokens.size['z-index'];
|
|
1592
1592
|
// export const BOX_SHADOW_VALUES = designTokens.size['box-shadow'];
|
|
1593
1593
|
|
|
1594
|
-
var _excluded$
|
|
1594
|
+
var _excluded$v = ["className", "isOpen", "children", "content", "arrowColor", "contentContainerProps", "hasArrow", "offsetFromTarget", "onClickOutside", "placement", "withPortal", "portalTarget", "trapFocus"];
|
|
1595
1595
|
var contentContainerDefaults = {
|
|
1596
1596
|
background: 'primary',
|
|
1597
1597
|
padding: 'sm',
|
|
@@ -1620,7 +1620,7 @@ var Popover = function Popover(_ref) {
|
|
|
1620
1620
|
portalTarget = _ref.portalTarget,
|
|
1621
1621
|
_ref$trapFocus = _ref.trapFocus,
|
|
1622
1622
|
trapFocus = _ref$trapFocus === void 0 ? false : _ref$trapFocus,
|
|
1623
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1623
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$v);
|
|
1624
1624
|
var triggerRef = useRef(null);
|
|
1625
1625
|
var popperRef = useRef(null);
|
|
1626
1626
|
var _useState = useState(null),
|
|
@@ -1726,7 +1726,7 @@ var Popover = function Popover(_ref) {
|
|
|
1726
1726
|
withPortal && portalTarget ? createPortal(renderPopperContent(), portalTarget) : renderPopperContent()));
|
|
1727
1727
|
};
|
|
1728
1728
|
|
|
1729
|
-
var _excluded$
|
|
1729
|
+
var _excluded$u = ["datePickerProps", "textInputProps", "dateFormat", "dateOptions", "popoverProps"];
|
|
1730
1730
|
var defaultDatePickerProps = {
|
|
1731
1731
|
selected: null,
|
|
1732
1732
|
selectsRange: false
|
|
@@ -1746,7 +1746,7 @@ var DateInput = function DateInput(_ref) {
|
|
|
1746
1746
|
dateOptions = _ref$dateOptions === void 0 ? undefined : _ref$dateOptions,
|
|
1747
1747
|
_ref$popoverProps = _ref.popoverProps,
|
|
1748
1748
|
popoverProps = _ref$popoverProps === void 0 ? _extends({}, defaultPopoverProps) : _ref$popoverProps,
|
|
1749
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1749
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$u);
|
|
1750
1750
|
var mergedDatePickerProps = _extends({}, defaultDatePickerProps, datePickerProps);
|
|
1751
1751
|
var mergedPopoverProps = _extends({}, defaultPopoverProps, popoverProps);
|
|
1752
1752
|
var mergedTextInputProps = _extends({}, defaultTextInputProps, textInputProps);
|
|
@@ -1823,14 +1823,14 @@ var DateInput = function DateInput(_ref) {
|
|
|
1823
1823
|
var ENTER = 13;
|
|
1824
1824
|
var SPACE = 32;
|
|
1825
1825
|
|
|
1826
|
-
var _excluded$
|
|
1826
|
+
var _excluded$t = ["children", "display", "isDetailsOpen", "onToggle"];
|
|
1827
1827
|
var DetailsSummary = function DetailsSummary(_ref) {
|
|
1828
1828
|
var children = _ref.children,
|
|
1829
1829
|
_ref$display = _ref.display,
|
|
1830
1830
|
display = _ref$display === void 0 ? 'block' : _ref$display,
|
|
1831
1831
|
isDetailsOpen = _ref.isDetailsOpen,
|
|
1832
1832
|
onToggle = _ref.onToggle,
|
|
1833
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1833
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$t);
|
|
1834
1834
|
var handleClick = function handleClick(event) {
|
|
1835
1835
|
// Needed to avoid default `details` behavior on a click event and keep this as controlled component.
|
|
1836
1836
|
event.preventDefault();
|
|
@@ -1868,14 +1868,14 @@ var DetailsSummary = function DetailsSummary(_ref) {
|
|
|
1868
1868
|
|
|
1869
1869
|
var styles$i = {"details-reset":"Details-module_details-reset__HWtSD"};
|
|
1870
1870
|
|
|
1871
|
-
var _excluded$
|
|
1871
|
+
var _excluded$s = ["children", "className", "display", "isOpen"];
|
|
1872
1872
|
var DetailsBaseComponent = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
1873
1873
|
var children = _ref.children,
|
|
1874
1874
|
className = _ref.className,
|
|
1875
1875
|
_ref$display = _ref.display,
|
|
1876
1876
|
display = _ref$display === void 0 ? 'block' : _ref$display,
|
|
1877
1877
|
isOpen = _ref.isOpen,
|
|
1878
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1878
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$s);
|
|
1879
1879
|
var detailsClasses = classNames(className, styles$i['details-reset'], styles$i.details);
|
|
1880
1880
|
return React__default.createElement(Box, _extends({
|
|
1881
1881
|
as: "details",
|
|
@@ -1895,41 +1895,136 @@ var Details = /*#__PURE__*/function () {
|
|
|
1895
1895
|
|
|
1896
1896
|
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"};
|
|
1897
1897
|
|
|
1898
|
-
var
|
|
1898
|
+
var _excluded$r = ["defaultIsOpen", "open", "onOpenChange", "className", "children"],
|
|
1899
|
+
_excluded2$2 = ["asChild", "onClick"],
|
|
1900
|
+
_excluded3$2 = ["className"],
|
|
1901
|
+
_excluded4$2 = ["className", "onClick", "onClose"],
|
|
1902
|
+
_excluded5$2 = ["className"];
|
|
1903
|
+
var DrawerContext = /*#__PURE__*/createContext(null);
|
|
1904
|
+
function useDrawer() {
|
|
1905
|
+
var context = useContext(DrawerContext);
|
|
1906
|
+
if (!context) {
|
|
1907
|
+
throw new Error('useDrawer must be used within a DrawerProvider.');
|
|
1908
|
+
}
|
|
1909
|
+
return context;
|
|
1910
|
+
}
|
|
1911
|
+
var DrawerProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
1912
|
+
var _ref$defaultIsOpen = _ref.defaultIsOpen,
|
|
1913
|
+
defaultIsOpen = _ref$defaultIsOpen === void 0 ? false : _ref$defaultIsOpen,
|
|
1914
|
+
openProp = _ref.open,
|
|
1915
|
+
setOpenProp = _ref.onOpenChange,
|
|
1916
|
+
className = _ref.className,
|
|
1917
|
+
children = _ref.children,
|
|
1918
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$r);
|
|
1919
|
+
var _useState = useState(openProp != null ? openProp : defaultIsOpen),
|
|
1920
|
+
_open = _useState[0],
|
|
1921
|
+
_setOpen = _useState[1];
|
|
1922
|
+
var open = openProp != null ? openProp : _open;
|
|
1923
|
+
var setOpen = useCallback(function (value) {
|
|
1924
|
+
var newOpen = typeof value === 'function' ? value(open) : value;
|
|
1925
|
+
if (newOpen !== open) {
|
|
1926
|
+
if (setOpenProp) {
|
|
1927
|
+
setOpenProp(newOpen); // Controlled
|
|
1928
|
+
} else {
|
|
1929
|
+
_setOpen(newOpen); // Uncontrolled
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
}, [open, setOpenProp]);
|
|
1933
|
+
var toggleDrawer = useCallback(function () {
|
|
1934
|
+
setOpen(function (prev) {
|
|
1935
|
+
return !prev;
|
|
1936
|
+
});
|
|
1937
|
+
}, [setOpen]);
|
|
1938
|
+
var contextValue = useMemo(function () {
|
|
1939
|
+
return {
|
|
1940
|
+
open: open,
|
|
1941
|
+
setOpen: setOpen,
|
|
1942
|
+
toggleDrawer: toggleDrawer
|
|
1943
|
+
};
|
|
1944
|
+
}, [open, setOpen, toggleDrawer]);
|
|
1945
|
+
return React__default.createElement(DrawerContext.Provider, {
|
|
1946
|
+
value: contextValue
|
|
1947
|
+
}, React__default.createElement("div", _extends({
|
|
1948
|
+
className: classNames('drawer-container', {
|
|
1949
|
+
'drawer-open': open
|
|
1950
|
+
}, className),
|
|
1951
|
+
ref: ref
|
|
1952
|
+
}, props), children));
|
|
1953
|
+
});
|
|
1954
|
+
DrawerProvider.displayName = 'DrawerProvider';
|
|
1955
|
+
var DrawerTrigger = /*#__PURE__*/React__default.forwardRef(function (_ref2, ref) {
|
|
1956
|
+
var _ref2$asChild = _ref2.asChild,
|
|
1957
|
+
asChild = _ref2$asChild === void 0 ? false : _ref2$asChild,
|
|
1958
|
+
onClick = _ref2.onClick,
|
|
1959
|
+
triggerProps = _objectWithoutPropertiesLoose(_ref2, _excluded2$2);
|
|
1960
|
+
var context = useContext(DrawerContext);
|
|
1961
|
+
var isStandalone = !context;
|
|
1962
|
+
var handleClick = function handleClick(event) {
|
|
1963
|
+
onClick == null || onClick(event);
|
|
1964
|
+
if (!isStandalone) {
|
|
1965
|
+
// Use context to toggle the drawer
|
|
1966
|
+
context == null || context.toggleDrawer();
|
|
1967
|
+
}
|
|
1968
|
+
};
|
|
1969
|
+
var Comp = asChild ? Slot : 'button';
|
|
1970
|
+
return React__default.createElement(Comp, _extends({
|
|
1971
|
+
ref: ref,
|
|
1972
|
+
"data-drawer": "trigger",
|
|
1973
|
+
"aria-haspopup": "dialog",
|
|
1974
|
+
"aria-expanded": context == null ? void 0 : context.open,
|
|
1975
|
+
"data-state": context == null ? void 0 : context.open,
|
|
1976
|
+
"aria-label": "toggle drawer"
|
|
1977
|
+
}, triggerProps, {
|
|
1978
|
+
onClick: handleClick
|
|
1979
|
+
}));
|
|
1980
|
+
});
|
|
1981
|
+
DrawerTrigger.displayName = 'SidebarTrigger';
|
|
1982
|
+
var Drawer = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
1899
1983
|
var _dynamicStyle, _classNames, _classNames2;
|
|
1900
|
-
var
|
|
1901
|
-
ariaLabel =
|
|
1902
|
-
|
|
1903
|
-
ariaLabelledBy =
|
|
1904
|
-
|
|
1905
|
-
allowPinchZoom =
|
|
1906
|
-
|
|
1907
|
-
children =
|
|
1908
|
-
|
|
1909
|
-
className =
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
onDismiss =
|
|
1927
|
-
|
|
1928
|
-
placement =
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1984
|
+
var _ref3$ariaLabel = _ref3.ariaLabel,
|
|
1985
|
+
ariaLabel = _ref3$ariaLabel === void 0 ? undefined : _ref3$ariaLabel,
|
|
1986
|
+
_ref3$ariaLabelledBy = _ref3.ariaLabelledBy,
|
|
1987
|
+
ariaLabelledBy = _ref3$ariaLabelledBy === void 0 ? undefined : _ref3$ariaLabelledBy,
|
|
1988
|
+
_ref3$allowPinchZoom = _ref3.allowPinchZoom,
|
|
1989
|
+
allowPinchZoom = _ref3$allowPinchZoom === void 0 ? false : _ref3$allowPinchZoom,
|
|
1990
|
+
_ref3$children = _ref3.children,
|
|
1991
|
+
children = _ref3$children === void 0 ? undefined : _ref3$children,
|
|
1992
|
+
_ref3$className = _ref3.className,
|
|
1993
|
+
className = _ref3$className === void 0 ? undefined : _ref3$className,
|
|
1994
|
+
_ref3$closeOnOverlayC = _ref3.closeOnOverlayClick,
|
|
1995
|
+
closeOnOverlayClick = _ref3$closeOnOverlayC === void 0 ? true : _ref3$closeOnOverlayC,
|
|
1996
|
+
_ref3$containerRef = _ref3.containerRef,
|
|
1997
|
+
containerRef = _ref3$containerRef === void 0 ? undefined : _ref3$containerRef,
|
|
1998
|
+
_ref3$dangerouslyBypa = _ref3.dangerouslyBypassFocusLock,
|
|
1999
|
+
dangerouslyBypassFocusLock = _ref3$dangerouslyBypa === void 0 ? false : _ref3$dangerouslyBypa,
|
|
2000
|
+
_ref3$dangerouslyBypa2 = _ref3.dangerouslyBypassScrollLock,
|
|
2001
|
+
dangerouslyBypassScrollLock = _ref3$dangerouslyBypa2 === void 0 ? false : _ref3$dangerouslyBypa2,
|
|
2002
|
+
_ref3$hideOverlay = _ref3.hideOverlay,
|
|
2003
|
+
hideOverlay = _ref3$hideOverlay === void 0 ? false : _ref3$hideOverlay,
|
|
2004
|
+
_ref3$initialFocusRef = _ref3.initialFocusRef,
|
|
2005
|
+
initialFocusRef = _ref3$initialFocusRef === void 0 ? undefined : _ref3$initialFocusRef,
|
|
2006
|
+
controlledIsOpen = _ref3.isOpen,
|
|
2007
|
+
_ref3$defaultIsOpen = _ref3.defaultIsOpen,
|
|
2008
|
+
defaultIsOpen = _ref3$defaultIsOpen === void 0 ? false : _ref3$defaultIsOpen,
|
|
2009
|
+
_ref3$onDismiss = _ref3.onDismiss,
|
|
2010
|
+
onDismiss = _ref3$onDismiss === void 0 ? undefined : _ref3$onDismiss,
|
|
2011
|
+
_ref3$placement = _ref3.placement,
|
|
2012
|
+
placement = _ref3$placement === void 0 ? 'right' : _ref3$placement,
|
|
2013
|
+
_ref3$width = _ref3.width,
|
|
2014
|
+
width = _ref3$width === void 0 ? undefined : _ref3$width;
|
|
2015
|
+
var context = useContext(DrawerContext);
|
|
2016
|
+
var isStandalone = !context; // Determine if there's no provider
|
|
2017
|
+
var _useState2 = useState(defaultIsOpen),
|
|
2018
|
+
uncontrolledOpen = _useState2[0],
|
|
2019
|
+
setUncontrolledOpen = _useState2[1];
|
|
2020
|
+
var isOpen = isStandalone ? controlledIsOpen != null ? controlledIsOpen : uncontrolledOpen // Use internal or prop-based state
|
|
2021
|
+
: context.open; // Use context-provided state
|
|
2022
|
+
var setOpen = isStandalone ? setUncontrolledOpen // Update internal state
|
|
2023
|
+
: context.setOpen; // Update context state
|
|
2024
|
+
var handleDismiss = useCallback(function (event) {
|
|
2025
|
+
setOpen(false); // Update state (context or standalone)
|
|
2026
|
+
onDismiss == null || onDismiss(event); // Trigger external callback
|
|
2027
|
+
}, [setOpen, onDismiss]);
|
|
1933
2028
|
var activateFocusLock = useCallback(function () {
|
|
1934
2029
|
setTimeout(function () {
|
|
1935
2030
|
if (initialFocusRef && initialFocusRef.current) {
|
|
@@ -1938,49 +2033,9 @@ var Drawer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
1938
2033
|
}, 100);
|
|
1939
2034
|
}, [initialFocusRef]);
|
|
1940
2035
|
var dynamicWidth = width;
|
|
1941
|
-
var dynamicStyle = (_dynamicStyle = {}, _dynamicStyle['--
|
|
2036
|
+
var dynamicStyle = (_dynamicStyle = {}, _dynamicStyle['--drawer-width'] = dynamicWidth, _dynamicStyle);
|
|
1942
2037
|
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));
|
|
1943
|
-
var contentClassnames = classNames(styles$h['drawer-content'], styles$h[placement], (_classNames2 = {}, _classNames2[styles$h['hide-overlay']] = hideOverlay, _classNames2
|
|
1944
|
-
var renderHeader = function renderHeader() {
|
|
1945
|
-
if (closeButton && onDismiss && !title) {
|
|
1946
|
-
return React__default.createElement(Box, {
|
|
1947
|
-
alignItems: "flex-end",
|
|
1948
|
-
justifyContent: "center",
|
|
1949
|
-
padding: "md lg"
|
|
1950
|
-
}, React__default.createElement(Button, {
|
|
1951
|
-
variant: "tertiary",
|
|
1952
|
-
onClick: onDismiss,
|
|
1953
|
-
"aria-label": "close",
|
|
1954
|
-
type: "button",
|
|
1955
|
-
iconPrefix: "remove"
|
|
1956
|
-
}));
|
|
1957
|
-
}
|
|
1958
|
-
if (title) {
|
|
1959
|
-
return React__default.createElement(Box, {
|
|
1960
|
-
direction: "row",
|
|
1961
|
-
justifyContent: "space-between",
|
|
1962
|
-
alignItems: "center",
|
|
1963
|
-
padding: {
|
|
1964
|
-
base: '2xl',
|
|
1965
|
-
tablet: '4xl'
|
|
1966
|
-
}
|
|
1967
|
-
}, React__default.createElement(Box, {
|
|
1968
|
-
className: styles$h.title,
|
|
1969
|
-
fontWeight: "bold"
|
|
1970
|
-
}, title), onDismiss && React__default.createElement(Button, {
|
|
1971
|
-
variant: "tertiary",
|
|
1972
|
-
onClick: onDismiss,
|
|
1973
|
-
"aria-label": "close",
|
|
1974
|
-
type: "button",
|
|
1975
|
-
iconPrefix: "remove"
|
|
1976
|
-
}));
|
|
1977
|
-
}
|
|
1978
|
-
return null;
|
|
1979
|
-
};
|
|
1980
|
-
var content = title || closeButton ? React__default.createElement(Box, {
|
|
1981
|
-
flex: "auto",
|
|
1982
|
-
overflow: "auto"
|
|
1983
|
-
}, children) : children;
|
|
2038
|
+
var contentClassnames = classNames(styles$h['drawer-content'], styles$h[placement], (_classNames2 = {}, _classNames2[styles$h['hide-overlay']] = hideOverlay, _classNames2));
|
|
1984
2039
|
var parentElement = containerRef != null && containerRef.current ? containerRef.current : document.body;
|
|
1985
2040
|
var isDisabledFocusLock = hideOverlay || dangerouslyBypassFocusLock;
|
|
1986
2041
|
var isDisabledRemoveScroll = hideOverlay || dangerouslyBypassScrollLock;
|
|
@@ -1998,7 +2053,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
1998
2053
|
isOpen: isOpen,
|
|
1999
2054
|
overlayClassName: overlayClassnames,
|
|
2000
2055
|
className: contentClassnames,
|
|
2001
|
-
onRequestClose: closeOnOverlayClick ?
|
|
2056
|
+
onRequestClose: closeOnOverlayClick ? handleDismiss : undefined,
|
|
2002
2057
|
ariaHideApp: false,
|
|
2003
2058
|
style: {
|
|
2004
2059
|
content: dynamicStyle,
|
|
@@ -2010,8 +2065,78 @@ var Drawer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
2010
2065
|
}, React__default.createElement(Box, {
|
|
2011
2066
|
"aria-label": ariaLabel,
|
|
2012
2067
|
"aria-labelledby": ariaLabelledBy,
|
|
2013
|
-
height: "100
|
|
2014
|
-
|
|
2068
|
+
height: "100",
|
|
2069
|
+
"data-testid": "drawer-content",
|
|
2070
|
+
className: className
|
|
2071
|
+
}, children)))));
|
|
2072
|
+
});
|
|
2073
|
+
var DrawerHeader = /*#__PURE__*/React__default.forwardRef(function (_ref4, ref) {
|
|
2074
|
+
var props = _objectWithoutPropertiesLoose(_ref4, _excluded3$2);
|
|
2075
|
+
return React__default.createElement(Box, _extends({
|
|
2076
|
+
ref: ref,
|
|
2077
|
+
"data-drawer": "header",
|
|
2078
|
+
direction: "row",
|
|
2079
|
+
justifyContent: "space-between",
|
|
2080
|
+
alignItems: "center",
|
|
2081
|
+
padding: {
|
|
2082
|
+
base: '2xl 2xl 0 2xl',
|
|
2083
|
+
tablet: '3xl 3xl 0 3xl'
|
|
2084
|
+
}
|
|
2085
|
+
}, props));
|
|
2086
|
+
});
|
|
2087
|
+
DrawerHeader.displayName = 'DrawerHeader';
|
|
2088
|
+
var DrawerTitle = /*#__PURE__*/React__default.forwardRef(function (_ref5, ref) {
|
|
2089
|
+
var props = _extends({}, (_objectDestructuringEmpty(_ref5), _ref5));
|
|
2090
|
+
return React__default.createElement(Box, _extends({
|
|
2091
|
+
ref: ref,
|
|
2092
|
+
"data-drawer": "title",
|
|
2093
|
+
fontWeight: "bold"
|
|
2094
|
+
}, props));
|
|
2095
|
+
});
|
|
2096
|
+
var DrawerCloseButton = /*#__PURE__*/React__default.forwardRef(function (_ref6, ref) {
|
|
2097
|
+
var className = _ref6.className,
|
|
2098
|
+
onClick = _ref6.onClick,
|
|
2099
|
+
onClose = _ref6.onClose,
|
|
2100
|
+
props = _objectWithoutPropertiesLoose(_ref6, _excluded4$2);
|
|
2101
|
+
var context = useContext(DrawerContext);
|
|
2102
|
+
var isStandalone = !context;
|
|
2103
|
+
var handleClick = function handleClick(event) {
|
|
2104
|
+
onClick == null || onClick(event);
|
|
2105
|
+
if (isStandalone) {
|
|
2106
|
+
// Fallback to onClose if provided
|
|
2107
|
+
onClose == null || onClose();
|
|
2108
|
+
} else {
|
|
2109
|
+
// Use context to toggle the drawer
|
|
2110
|
+
context == null || context.toggleDrawer();
|
|
2111
|
+
}
|
|
2112
|
+
};
|
|
2113
|
+
return React__default.createElement(Button, _extends({
|
|
2114
|
+
ref: ref,
|
|
2115
|
+
variant: "tertiary",
|
|
2116
|
+
"aria-label": "close",
|
|
2117
|
+
type: "button",
|
|
2118
|
+
iconPrefix: "remove",
|
|
2119
|
+
"data-drawer": "close",
|
|
2120
|
+
className: classNames('m-left-auto', className),
|
|
2121
|
+
size: "sm",
|
|
2122
|
+
onClick: handleClick
|
|
2123
|
+
}, props));
|
|
2124
|
+
});
|
|
2125
|
+
DrawerCloseButton.displayName = 'DrawerCloseButton';
|
|
2126
|
+
var DrawerContent = /*#__PURE__*/React__default.forwardRef(function (_ref7, ref) {
|
|
2127
|
+
var props = _objectWithoutPropertiesLoose(_ref7, _excluded5$2);
|
|
2128
|
+
return React__default.createElement(Box, _extends({
|
|
2129
|
+
ref: ref,
|
|
2130
|
+
"data-drawer": "content",
|
|
2131
|
+
flex: "auto",
|
|
2132
|
+
overflow: "auto",
|
|
2133
|
+
alignItems: "flex-start",
|
|
2134
|
+
padding: {
|
|
2135
|
+
base: '2xl',
|
|
2136
|
+
tablet: '3xl'
|
|
2137
|
+
},
|
|
2138
|
+
gap: "md"
|
|
2139
|
+
}, props));
|
|
2015
2140
|
});
|
|
2016
2141
|
|
|
2017
2142
|
var _excluded$q = ["className", "inset"],
|
|
@@ -5257,5 +5382,5 @@ var useTheme = function useTheme() {
|
|
|
5257
5382
|
return context;
|
|
5258
5383
|
};
|
|
5259
5384
|
|
|
5260
|
-
export { Alert, Badge, Box, Button, Card, CardBaseComponent, Checkbox, CheckboxInput, Collapsible, CollapsibleContent, CollapsibleTrigger, DateInput, DatePicker, Details, DetailsBaseComponent, DetailsSummary, Drawer, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FormControl, FormLabel, FormikCheckboxInput, FormikRadioGroup, FormikSelectInput, FormikSelectInputInset, FormikSelectInputNative, FormikTextInput, FormikTextInputInset, FormikTextareaInput, FormikTextareaInputInset, FormikTimePicker, FormikTimePickerNative, FormikToggle, Heading, Icon, Modal, ModalBaseComponent, Pagination, Popover, RadioGroup, RangeInput, ResponsiveContext, ResponsiveProvider, SelectInput, SelectInputInset, SelectInputNative, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarTrigger, Spinner, Table, TextInput, TextInputInset, TextareaInput, TextareaInputInset, ThemeProvider, ThemeProviderContext, TimePicker, TimePickerNative, ToastContainer, Toggle, boxPropsKeys, createRectRef, toast, useBreakpoint, useIsMobile, useIsomorphicLayoutEffect, useOpenClose, useSidebar, useTheme, useToasts, useWindowSize };
|
|
5385
|
+
export { Alert, Badge, Box, Button, Card, CardBaseComponent, Checkbox, CheckboxInput, Collapsible, CollapsibleContent, CollapsibleTrigger, DateInput, DatePicker, Details, DetailsBaseComponent, DetailsSummary, Drawer, DrawerCloseButton, DrawerContent, DrawerHeader, DrawerProvider, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FormControl, FormLabel, FormikCheckboxInput, FormikRadioGroup, FormikSelectInput, FormikSelectInputInset, FormikSelectInputNative, FormikTextInput, FormikTextInputInset, FormikTextareaInput, FormikTextareaInputInset, FormikTimePicker, FormikTimePickerNative, FormikToggle, Heading, Icon, Modal, ModalBaseComponent, Pagination, Popover, RadioGroup, RangeInput, ResponsiveContext, ResponsiveProvider, SelectInput, SelectInputInset, SelectInputNative, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarTrigger, Spinner, Table, TextInput, TextInputInset, TextareaInput, TextareaInputInset, ThemeProvider, ThemeProviderContext, TimePicker, TimePickerNative, ToastContainer, Toggle, boxPropsKeys, createRectRef, toast, useBreakpoint, useDrawer, useIsMobile, useIsomorphicLayoutEffect, useOpenClose, useSidebar, useTheme, useToasts, useWindowSize };
|
|
5261
5386
|
//# sourceMappingURL=hyphen-components.esm.js.map
|