@hyphen/hyphen-components 2.18.1 → 2.19.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/Modal/Modal.stories.d.ts +3 -1
- package/dist/components/Modal/components/ModalFooter/ModalFooter.d.ts +1 -1
- package/dist/hyphen-components.cjs.development.js +24 -28
- 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 +24 -28
- package/dist/hyphen-components.esm.js.map +1 -1
- package/package.json +3 -1
- package/src/components/Modal/Modal.stories.tsx +37 -9
- package/src/components/Modal/Modal.test.tsx +30 -23
- package/src/components/Modal/Modal.tsx +5 -1
- package/src/components/Modal/components/ModalBody/ModalBody.test.tsx +23 -5
- package/src/components/Modal/components/ModalBody/ModalBody.tsx +0 -2
- package/src/components/Modal/components/ModalFooter/ModalFooter.test.tsx +45 -9
- package/src/components/Modal/components/ModalFooter/ModalFooter.tsx +3 -10
- package/src/components/Modal/components/ModalHeader/ModalHeader.test.tsx +23 -4
- package/src/components/Modal/components/ModalHeader/ModalHeader.tsx +7 -11
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Modal } from './Modal';
|
|
3
|
-
import type { Meta } from '@storybook/react';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
4
|
declare const meta: Meta<typeof Modal>;
|
|
5
5
|
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof Modal>;
|
|
6
7
|
export declare const BasicUsage: () => React.JSX.Element;
|
|
8
|
+
export declare const OpenModal: Story;
|
|
7
9
|
export declare const BodyAndFooter: () => React.JSX.Element;
|
|
8
10
|
export declare const CloseButton: () => React.JSX.Element;
|
|
9
11
|
export declare const WithoutHeader: () => React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { BoxProps } from '../../../Box/Box';
|
|
3
|
-
export type ModalFooterProps = Omit<BoxProps, 'as' | '
|
|
3
|
+
export type ModalFooterProps = Omit<BoxProps, 'as' | 'radius'>;
|
|
4
4
|
export declare const ModalFooter: FC<ModalFooterProps>;
|
|
@@ -3240,31 +3240,25 @@ var FormikToggle = function FormikToggle(_ref) {
|
|
|
3240
3240
|
}, props));
|
|
3241
3241
|
};
|
|
3242
3242
|
|
|
3243
|
-
var _excluded$5 = ["children", "padding", "direction", "alignItems", "justifyContent", "
|
|
3243
|
+
var _excluded$5 = ["children", "padding", "direction", "alignItems", "justifyContent", "gap", "style"];
|
|
3244
3244
|
var ModalFooter = function ModalFooter(_ref) {
|
|
3245
3245
|
var children = _ref.children,
|
|
3246
|
-
|
|
3247
|
-
padding = _ref$padding === void 0 ? 'xl' : _ref$padding,
|
|
3246
|
+
padding = _ref.padding,
|
|
3248
3247
|
_ref$direction = _ref.direction,
|
|
3249
3248
|
direction = _ref$direction === void 0 ? 'row' : _ref$direction,
|
|
3250
3249
|
_ref$alignItems = _ref.alignItems,
|
|
3251
3250
|
alignItems = _ref$alignItems === void 0 ? 'center' : _ref$alignItems,
|
|
3252
3251
|
_ref$justifyContent = _ref.justifyContent,
|
|
3253
3252
|
justifyContent = _ref$justifyContent === void 0 ? 'flex-end' : _ref$justifyContent,
|
|
3254
|
-
_ref$background = _ref.background,
|
|
3255
|
-
background = _ref$background === void 0 ? 'secondary' : _ref$background,
|
|
3256
3253
|
_ref$gap = _ref.gap,
|
|
3257
|
-
gap = _ref$gap === void 0 ? '
|
|
3254
|
+
gap = _ref$gap === void 0 ? 'md' : _ref$gap,
|
|
3258
3255
|
style = _ref.style,
|
|
3259
3256
|
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
3260
3257
|
return React.createElement(Box, _extends({
|
|
3261
|
-
background: background,
|
|
3262
3258
|
padding: padding,
|
|
3263
3259
|
direction: direction,
|
|
3264
3260
|
alignItems: alignItems,
|
|
3265
3261
|
justifyContent: justifyContent,
|
|
3266
|
-
borderWidth: "sm 0 0 0",
|
|
3267
|
-
borderColor: "default",
|
|
3268
3262
|
gap: gap,
|
|
3269
3263
|
style: _extends({
|
|
3270
3264
|
flexShrink: 0
|
|
@@ -3272,8 +3266,6 @@ var ModalFooter = function ModalFooter(_ref) {
|
|
|
3272
3266
|
}, restProps), children);
|
|
3273
3267
|
};
|
|
3274
3268
|
|
|
3275
|
-
var styles$7 = {"modal-close":"Modal-module_modal-close__1YmMa","modal":"Modal-module_modal__yNG-7","modal-content":"Modal-module_modal-content__GMtBm"};
|
|
3276
|
-
|
|
3277
3269
|
var ModalHeader = function ModalHeader(_ref) {
|
|
3278
3270
|
var id = _ref.id,
|
|
3279
3271
|
onDismiss = _ref.onDismiss,
|
|
@@ -3281,12 +3273,10 @@ var ModalHeader = function ModalHeader(_ref) {
|
|
|
3281
3273
|
title = _ref$title === void 0 ? undefined : _ref$title;
|
|
3282
3274
|
var justifyContentValue = title === undefined && onDismiss ? 'flex-end' : 'space-between';
|
|
3283
3275
|
return React.createElement(Box, {
|
|
3284
|
-
padding: "xl",
|
|
3285
3276
|
direction: "row",
|
|
3286
3277
|
alignItems: "center",
|
|
3287
3278
|
justifyContent: justifyContentValue,
|
|
3288
|
-
|
|
3289
|
-
borderColor: "default",
|
|
3279
|
+
gap: "3xl",
|
|
3290
3280
|
style: {
|
|
3291
3281
|
flexShrink: 0
|
|
3292
3282
|
}
|
|
@@ -3297,30 +3287,26 @@ var ModalHeader = function ModalHeader(_ref) {
|
|
|
3297
3287
|
tablet: 'lg'
|
|
3298
3288
|
},
|
|
3299
3289
|
id: id
|
|
3300
|
-
}, title), onDismiss && React.createElement(
|
|
3290
|
+
}, title), onDismiss && React.createElement(Button, {
|
|
3301
3291
|
"aria-label": "close",
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
})));
|
|
3292
|
+
variant: "tertiary",
|
|
3293
|
+
onClick: onDismiss,
|
|
3294
|
+
iconPrefix: "remove",
|
|
3295
|
+
size: "sm"
|
|
3296
|
+
}));
|
|
3308
3297
|
};
|
|
3309
3298
|
|
|
3310
|
-
var _excluded$4 = ["children", "flex", "
|
|
3299
|
+
var _excluded$4 = ["children", "flex", "overflow", "height"];
|
|
3311
3300
|
var ModalBody = function ModalBody(_ref) {
|
|
3312
3301
|
var children = _ref.children,
|
|
3313
3302
|
_ref$flex = _ref.flex,
|
|
3314
3303
|
flex = _ref$flex === void 0 ? 'auto' : _ref$flex,
|
|
3315
|
-
_ref$padding = _ref.padding,
|
|
3316
|
-
padding = _ref$padding === void 0 ? 'xl' : _ref$padding,
|
|
3317
3304
|
_ref$overflow = _ref.overflow,
|
|
3318
3305
|
overflow = _ref$overflow === void 0 ? 'auto' : _ref$overflow,
|
|
3319
3306
|
_ref$height = _ref.height,
|
|
3320
3307
|
height = _ref$height === void 0 ? '100' : _ref$height,
|
|
3321
3308
|
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
3322
3309
|
return React.createElement(Box, _extends({
|
|
3323
|
-
padding: padding,
|
|
3324
3310
|
flex: flex,
|
|
3325
3311
|
overflow: overflow,
|
|
3326
3312
|
height: height,
|
|
@@ -3330,6 +3316,8 @@ var ModalBody = function ModalBody(_ref) {
|
|
|
3330
3316
|
}, restProps), children);
|
|
3331
3317
|
};
|
|
3332
3318
|
|
|
3319
|
+
var styles$7 = {"modal-close":"Modal-module_modal-close__1YmMa","modal":"Modal-module_modal__yNG-7","modal-content":"Modal-module_modal-content__GMtBm"};
|
|
3320
|
+
|
|
3333
3321
|
var _excluded$3 = ["ariaLabel", "ariaLabelledBy", "allowPinchZoom", "children", "className", "containerRef", "fullScreenMobile", "initialFocusRef", "isOpen", "maxWidth", "onDismiss", "overflow"];
|
|
3334
3322
|
var ModalBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3335
3323
|
var _classNames;
|
|
@@ -3363,6 +3351,7 @@ var ModalBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3363
3351
|
fullscreen: fullScreenMobile
|
|
3364
3352
|
});
|
|
3365
3353
|
var contentClassnames = classNames(styles$7['modal-content'], className, maxWidthCss.classes, (_classNames = {}, _classNames["overflow-" + overflow] = overflow, _classNames));
|
|
3354
|
+
if (!isOpen) return null;
|
|
3366
3355
|
var parentElement = containerRef != null && containerRef.current ? containerRef.current : undefined;
|
|
3367
3356
|
return React.createElement(FocusLock, {
|
|
3368
3357
|
autoFocus: true,
|
|
@@ -3383,12 +3372,19 @@ var ModalBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3383
3372
|
ariaHideApp: false,
|
|
3384
3373
|
parentSelector: parentElement ? function () {
|
|
3385
3374
|
return parentElement;
|
|
3386
|
-
} : undefined
|
|
3375
|
+
} : undefined,
|
|
3376
|
+
style: {
|
|
3377
|
+
content: _extends({}, maxWidthCss.styles)
|
|
3378
|
+
}
|
|
3387
3379
|
}, restProps), React.createElement(Box, {
|
|
3388
3380
|
"aria-label": ariaLabel,
|
|
3389
3381
|
"aria-labelledby": ariaLabelledBy,
|
|
3390
|
-
|
|
3391
|
-
|
|
3382
|
+
height: "100",
|
|
3383
|
+
padding: {
|
|
3384
|
+
base: '2xl',
|
|
3385
|
+
tablet: '4xl'
|
|
3386
|
+
},
|
|
3387
|
+
gap: "3xl"
|
|
3392
3388
|
}, children)))));
|
|
3393
3389
|
});
|
|
3394
3390
|
// Actual component is wrapped in an IIFE for the export
|