@jobber/components 6.41.0 → 6.42.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/Combobox/components/ComboboxContent/index.cjs +1 -0
- package/dist/Combobox/components/ComboboxContent/index.mjs +1 -0
- package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +2 -0
- package/dist/Combobox/index.cjs +1 -0
- package/dist/Combobox/index.mjs +1 -0
- package/dist/ComboboxContent-cjs.js +33 -3726
- package/dist/ComboboxContent-es.js +28 -3703
- package/dist/ConfirmationModal/index.cjs +14 -2
- package/dist/ConfirmationModal/index.mjs +14 -2
- package/dist/ConfirmationModal-cjs.js +2 -2
- package/dist/ConfirmationModal-es.js +1 -1
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +1 -0
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +1 -0
- package/dist/DataList/components/DataListFilters/index.cjs +1 -0
- package/dist/DataList/components/DataListFilters/index.mjs +1 -0
- package/dist/DataList/index.cjs +1 -0
- package/dist/DataList/index.mjs +1 -0
- package/dist/FormatFile/index.cjs +14 -2
- package/dist/FormatFile/index.mjs +14 -2
- package/dist/Gallery/index.cjs +4 -1
- package/dist/Gallery/index.mjs +4 -1
- package/dist/Heading/Heading.d.ts +1 -1
- package/dist/Heading/index.d.ts +1 -0
- package/dist/Modal/Modal.d.ts +2 -21
- package/dist/Modal/Modal.rebuilt.d.ts +10 -0
- package/dist/Modal/Modal.types.d.ts +118 -0
- package/dist/Modal/ModalContext.rebuilt.d.ts +15 -0
- package/dist/Modal/index.cjs +213 -12
- package/dist/Modal/index.d.ts +15 -1
- package/dist/Modal/index.mjs +214 -11
- package/dist/Modal/useModal.d.ts +35 -0
- package/dist/Modal/useModalStyles.d.ts +10 -0
- package/dist/floating-ui.react-cjs.js +5610 -0
- package/dist/floating-ui.react-es.js +5574 -0
- package/dist/index.cjs +5 -2
- package/dist/index.mjs +2 -1
- package/dist/styles.css +156 -0
- package/dist/utils/meta/meta.json +6 -1
- package/package.json +2 -2
- package/dist/Modal-cjs.js +0 -63
- package/dist/Modal-es.js +0 -61
package/dist/index.cjs
CHANGED
|
@@ -75,7 +75,7 @@ var Link = require('./Link-cjs.js');
|
|
|
75
75
|
var List = require('./List-cjs.js');
|
|
76
76
|
var Markdown = require('./Markdown-cjs.js');
|
|
77
77
|
var Menu = require('./Menu-cjs.js');
|
|
78
|
-
var
|
|
78
|
+
var Modal_index = require('./Modal/index.cjs');
|
|
79
79
|
var MultiSelect = require('./MultiSelect-cjs.js');
|
|
80
80
|
var Page = require('./Page-cjs.js');
|
|
81
81
|
var Popover = require('./Popover-cjs.js');
|
|
@@ -129,6 +129,7 @@ require('./_baseGet-cjs.js');
|
|
|
129
129
|
require('./_getTag-cjs.js');
|
|
130
130
|
require('./_baseEach-cjs.js');
|
|
131
131
|
require('./ComboboxContent-cjs.js');
|
|
132
|
+
require('./floating-ui.react-cjs.js');
|
|
132
133
|
require('./ComboboxContentSearch-cjs.js');
|
|
133
134
|
require('./ComboboxContentList-cjs.js');
|
|
134
135
|
require('./ComboboxOption-cjs.js');
|
|
@@ -289,7 +290,9 @@ exports.List = List.List;
|
|
|
289
290
|
exports.ListItem = List.ListItem;
|
|
290
291
|
exports.Markdown = Markdown.Markdown;
|
|
291
292
|
exports.Menu = Menu.Menu;
|
|
292
|
-
exports.Modal =
|
|
293
|
+
exports.Modal = Modal_index.Modal;
|
|
294
|
+
exports.useModalContext = Modal_index.useModalContext;
|
|
295
|
+
exports.useModalStyles = Modal_index.useModalStyles;
|
|
293
296
|
exports.MultiSelect = MultiSelect.MultiSelect;
|
|
294
297
|
exports.Page = Page.Page;
|
|
295
298
|
exports.Popover = Popover.Popover;
|
package/dist/index.mjs
CHANGED
|
@@ -73,7 +73,7 @@ export { L as Link } from './Link-es.js';
|
|
|
73
73
|
export { L as List, a as ListItem } from './List-es.js';
|
|
74
74
|
export { M as Markdown } from './Markdown-es.js';
|
|
75
75
|
export { M as Menu } from './Menu-es.js';
|
|
76
|
-
export {
|
|
76
|
+
export { Modal, useModalContext, useModalStyles } from './Modal/index.mjs';
|
|
77
77
|
export { M as MultiSelect } from './MultiSelect-es.js';
|
|
78
78
|
export { P as Page } from './Page-es.js';
|
|
79
79
|
export { P as Popover, u as usePopoverContext, a as usePopoverStyles } from './Popover-es.js';
|
|
@@ -127,6 +127,7 @@ import './_baseGet-es.js';
|
|
|
127
127
|
import './_getTag-es.js';
|
|
128
128
|
import './_baseEach-es.js';
|
|
129
129
|
import './ComboboxContent-es.js';
|
|
130
|
+
import './floating-ui.react-es.js';
|
|
130
131
|
import './ComboboxContentSearch-es.js';
|
|
131
132
|
import './ComboboxContentList-es.js';
|
|
132
133
|
import './ComboboxOption-es.js';
|
package/dist/styles.css
CHANGED
|
@@ -4403,6 +4403,162 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
4403
4403
|
max-width: 940px;
|
|
4404
4404
|
}
|
|
4405
4405
|
|
|
4406
|
+
:root {
|
|
4407
|
+
--modal--width: 600px;
|
|
4408
|
+
--modal--padding-horizontal: var(--space-base);
|
|
4409
|
+
--modal--padding-vertical: var(--space-base);
|
|
4410
|
+
--modal--padding: var(--modal--padding-vertical)
|
|
4411
|
+
var(--modal--padding-horizontal);
|
|
4412
|
+
|
|
4413
|
+
--modal--shadow: var(--shadow-base);
|
|
4414
|
+
}
|
|
4415
|
+
|
|
4416
|
+
@media (min-width: 768px) {
|
|
4417
|
+
|
|
4418
|
+
:root {
|
|
4419
|
+
--modal--padding-horizontal: var(--space-large);
|
|
4420
|
+
--modal--padding-vertical: var(--space-large);
|
|
4421
|
+
--modal--padding: var(--modal--padding-vertical)
|
|
4422
|
+
var(--modal--padding-horizontal);
|
|
4423
|
+
}
|
|
4424
|
+
}
|
|
4425
|
+
|
|
4426
|
+
@media (--medium-screens-and-up) {
|
|
4427
|
+
|
|
4428
|
+
:root {
|
|
4429
|
+
--modal--padding-horizontal: var(--space-large);
|
|
4430
|
+
--modal--padding-vertical: var(--space-large);
|
|
4431
|
+
--modal--padding: var(--modal--padding-vertical)
|
|
4432
|
+
var(--modal--padding-horizontal);
|
|
4433
|
+
}
|
|
4434
|
+
}
|
|
4435
|
+
|
|
4436
|
+
.cRhQeXmZobs- {
|
|
4437
|
+
display: grid;
|
|
4438
|
+
z-index: 1001;
|
|
4439
|
+
z-index: var(--elevation-modal);
|
|
4440
|
+
background-color: rgba(0, 0, 0, 0.32);
|
|
4441
|
+
background-color: var(--color-overlay);
|
|
4442
|
+
-ms-flex-align: center;
|
|
4443
|
+
align-items: center;
|
|
4444
|
+
justify-items: center;
|
|
4445
|
+
place-items: center;
|
|
4446
|
+
}
|
|
4447
|
+
|
|
4448
|
+
.OiqCKNmbHZ0- {
|
|
4449
|
+
position: relative;
|
|
4450
|
+
z-index: 1001;
|
|
4451
|
+
z-index: var(--elevation-modal);
|
|
4452
|
+
width: 100%;
|
|
4453
|
+
max-width: 600px;
|
|
4454
|
+
max-width: var(--modal--width);
|
|
4455
|
+
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1), 0px 4px 12px 0px rgba(0, 0, 0, 0.05);
|
|
4456
|
+
box-shadow: var(--modal--shadow);
|
|
4457
|
+
margin: auto;
|
|
4458
|
+
padding: 8px;
|
|
4459
|
+
padding: var(--space-small);
|
|
4460
|
+
border: 1px solid hsl(200, 13%, 87%);
|
|
4461
|
+
border: var(--border-base) solid var(--color-border);
|
|
4462
|
+
border-radius: 8px;
|
|
4463
|
+
border-radius: var(--radius-base);
|
|
4464
|
+
background-color: rgba(255, 255, 255, 1);
|
|
4465
|
+
background-color: var(--color-surface);
|
|
4466
|
+
-ms-flex: 0 0 auto;
|
|
4467
|
+
flex: 0 0 auto;
|
|
4468
|
+
outline-color: hsl(198, 12%, 57%);
|
|
4469
|
+
outline-color: var(--color-focus);
|
|
4470
|
+
}
|
|
4471
|
+
|
|
4472
|
+
/* Adjust `Content` and `Tab` components public padding to match the modal */
|
|
4473
|
+
|
|
4474
|
+
.OiqCKNmbHZ0- > * {
|
|
4475
|
+
--public-content--padding: var(--modal--padding);
|
|
4476
|
+
--public-tab--inset: var(--modal--padding-horizontal);
|
|
4477
|
+
}
|
|
4478
|
+
|
|
4479
|
+
/* Remove the nested `Content` components public padding */
|
|
4480
|
+
|
|
4481
|
+
.OiqCKNmbHZ0- > * > * {
|
|
4482
|
+
--public-content--padding: 0;
|
|
4483
|
+
}
|
|
4484
|
+
|
|
4485
|
+
.GDWGHwmjgAc- {
|
|
4486
|
+
display: -ms-flexbox;
|
|
4487
|
+
display: flex;
|
|
4488
|
+
-ms-flex-pack: justify;
|
|
4489
|
+
justify-content: space-between;
|
|
4490
|
+
padding: 16px
|
|
4491
|
+
16px;
|
|
4492
|
+
padding: var(--modal--padding);
|
|
4493
|
+
background-color: transparent;
|
|
4494
|
+
}
|
|
4495
|
+
|
|
4496
|
+
/**
|
|
4497
|
+
* Ensure there's no extra padding top on the next element. This mostly negates
|
|
4498
|
+
* the <Content /> padding
|
|
4499
|
+
*/
|
|
4500
|
+
|
|
4501
|
+
.GDWGHwmjgAc- + * {
|
|
4502
|
+
padding-top: 0;
|
|
4503
|
+
}
|
|
4504
|
+
|
|
4505
|
+
.KJlGo4z-E6Q- {
|
|
4506
|
+
margin-top: -6px;
|
|
4507
|
+
margin-right: -6px;
|
|
4508
|
+
}
|
|
4509
|
+
|
|
4510
|
+
.ZGrhWCAymCw- {
|
|
4511
|
+
display: -ms-flexbox;
|
|
4512
|
+
display: flex;
|
|
4513
|
+
padding: 16px
|
|
4514
|
+
16px;
|
|
4515
|
+
padding: var(--modal--padding);
|
|
4516
|
+
padding-top: 0;
|
|
4517
|
+
-ms-flex: 1 1 100%;
|
|
4518
|
+
flex: 1 1 100%;
|
|
4519
|
+
-ms-flex-pack: end;
|
|
4520
|
+
justify-content: flex-end;
|
|
4521
|
+
}
|
|
4522
|
+
|
|
4523
|
+
/**
|
|
4524
|
+
* 1. Use CSS `order` to adjust the buttons position on the UI
|
|
4525
|
+
*/
|
|
4526
|
+
|
|
4527
|
+
.hOiEWds2Vq8- {
|
|
4528
|
+
-ms-flex: 1 1 auto;
|
|
4529
|
+
flex: 1 1 auto;
|
|
4530
|
+
-ms-flex-order: 1;
|
|
4531
|
+
order: 1; /* 1 */
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4534
|
+
.K31NzxPZP9s- {
|
|
4535
|
+
display: -ms-flexbox;
|
|
4536
|
+
display: flex;
|
|
4537
|
+
-ms-flex: 0 0 auto;
|
|
4538
|
+
flex: 0 0 auto;
|
|
4539
|
+
-ms-flex-order: 2;
|
|
4540
|
+
order: 2; /* 1 */
|
|
4541
|
+
}
|
|
4542
|
+
|
|
4543
|
+
/* This is in a correct position and order */
|
|
4544
|
+
|
|
4545
|
+
/* stylelint-disable-next-line no-descending-specificity */
|
|
4546
|
+
|
|
4547
|
+
.K31NzxPZP9s- > * {
|
|
4548
|
+
margin-left: 8px;
|
|
4549
|
+
margin-left: var(--space-small);
|
|
4550
|
+
}
|
|
4551
|
+
|
|
4552
|
+
.K31NzxPZP9s- > *:first-child {
|
|
4553
|
+
-ms-flex-order: 2;
|
|
4554
|
+
order: 2; /* 1 */
|
|
4555
|
+
}
|
|
4556
|
+
|
|
4557
|
+
.K31NzxPZP9s- > *:nth-child(2) {
|
|
4558
|
+
-ms-flex-order: 1;
|
|
4559
|
+
order: 1; /* 1 */
|
|
4560
|
+
}
|
|
4561
|
+
|
|
4406
4562
|
.rJamQZ6fRes- {
|
|
4407
4563
|
--content-block-max-width: 100ch;
|
|
4408
4564
|
--content-block-gutters: 0;
|
|
@@ -116,6 +116,11 @@
|
|
|
116
116
|
"Markdown",
|
|
117
117
|
"Menu",
|
|
118
118
|
"Modal",
|
|
119
|
+
"Modal.Actions",
|
|
120
|
+
"Modal.Activator",
|
|
121
|
+
"Modal.Content",
|
|
122
|
+
"Modal.Header",
|
|
123
|
+
"Modal.Provider",
|
|
119
124
|
"MultiSelect",
|
|
120
125
|
"Option",
|
|
121
126
|
"Page",
|
|
@@ -157,4 +162,4 @@
|
|
|
157
162
|
"Tooltip",
|
|
158
163
|
"Typography"
|
|
159
164
|
]
|
|
160
|
-
}
|
|
165
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.42.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -534,5 +534,5 @@
|
|
|
534
534
|
"> 1%",
|
|
535
535
|
"IE 10"
|
|
536
536
|
],
|
|
537
|
-
"gitHead": "
|
|
537
|
+
"gitHead": "39b7324adf214f1d5e9b4ca1bdc5dc4b3d373793"
|
|
538
538
|
}
|
package/dist/Modal-cjs.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var ReactDOM = require('react-dom');
|
|
5
|
-
var classnames = require('classnames');
|
|
6
|
-
var framerMotion = require('framer-motion');
|
|
7
|
-
var useRefocusOnActivator = require('./useRefocusOnActivator-cjs.js');
|
|
8
|
-
var useOnKeyDown = require('./useOnKeyDown-cjs.js');
|
|
9
|
-
var useFocusTrap = require('./useFocusTrap-cjs.js');
|
|
10
|
-
var Heading = require('./Heading-cjs.js');
|
|
11
|
-
var Button = require('./Button-cjs.js');
|
|
12
|
-
var ButtonDismiss = require('./ButtonDismiss-cjs.js');
|
|
13
|
-
|
|
14
|
-
var styles = {"container":"y3M-9xoEnk0-","overlay":"zkyJp1mib-U-","modal":"gMPgiggaud8-","header":"_5sBzUnyOqD0-","closeButton":"_4gw63G7IYG0-","actionBar":"cwVJrrJkNDg-","leftAction":"MkD4pNUKeAA-","rightAction":"C-yC8JKpQLg-","spinning":"_7hYqr6OrfHs-"};
|
|
15
|
-
|
|
16
|
-
var sizes = {"small":"BSZvIAUzFEU-","large":"-ydIALYVvGg-","spinning":"_10FfgKITqY0-"};
|
|
17
|
-
|
|
18
|
-
function Modal({ open = false, title, size, dismissible = true, children, primaryAction, secondaryAction, tertiaryAction, onRequestClose, }) {
|
|
19
|
-
const modalClassName = classnames(styles.modal, size && sizes[size]);
|
|
20
|
-
useRefocusOnActivator.useRefocusOnActivator_2(open);
|
|
21
|
-
const modalRef = useFocusTrap.useFocusTrap_2(open);
|
|
22
|
-
useOnKeyDown.useOnKeyDown_2(handleRequestClose, "Escape");
|
|
23
|
-
const template = (React.createElement(framerMotion.AnimatePresence, null, open && (React.createElement("div", { ref: modalRef, role: "dialog", className: styles.container, tabIndex: 0 },
|
|
24
|
-
React.createElement(framerMotion.motion.div, { key: styles.overlay, className: styles.overlay, onClick: onRequestClose, initial: { opacity: 0 }, animate: { opacity: 0.8 }, exit: { opacity: 0 }, transition: { duration: 0.2 } }),
|
|
25
|
-
React.createElement(framerMotion.motion.div, { key: styles.modal, className: modalClassName, initial: { scale: 0.9, opacity: 0 }, animate: { scale: 1, opacity: 1 }, exit: { scale: 0.9, opacity: 0 }, transition: {
|
|
26
|
-
duration: 0.2,
|
|
27
|
-
ease: "easeInOut",
|
|
28
|
-
} },
|
|
29
|
-
title != undefined && (React.createElement(Header, { title: title, dismissible: dismissible, onRequestClose: onRequestClose })),
|
|
30
|
-
children,
|
|
31
|
-
React.createElement(Actions, { primary: primaryAction, secondary: secondaryAction, tertiary: tertiaryAction }))))));
|
|
32
|
-
return (globalThis === null || globalThis === void 0 ? void 0 : globalThis.document)
|
|
33
|
-
? ReactDOM.createPortal(template, document.body)
|
|
34
|
-
: template;
|
|
35
|
-
function handleRequestClose() {
|
|
36
|
-
if (open && onRequestClose) {
|
|
37
|
-
onRequestClose();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function Header({ title, dismissible, onRequestClose }) {
|
|
42
|
-
return (React.createElement("div", { className: styles.header, "data-testid": "modal-header" },
|
|
43
|
-
React.createElement(Heading.Heading, { level: 2 }, title),
|
|
44
|
-
dismissible && (React.createElement("div", { className: styles.closeButton },
|
|
45
|
-
React.createElement(ButtonDismiss.ButtonDismiss, { onClick: onRequestClose, ariaLabel: "Close modal" })))));
|
|
46
|
-
}
|
|
47
|
-
function Actions({ primary, secondary, tertiary }) {
|
|
48
|
-
const shouldShow = primary != undefined || secondary != undefined || tertiary != undefined;
|
|
49
|
-
if (secondary != undefined) {
|
|
50
|
-
secondary = Object.assign({ type: "primary", variation: "subtle" }, secondary);
|
|
51
|
-
}
|
|
52
|
-
if (tertiary != undefined) {
|
|
53
|
-
tertiary = Object.assign({ type: "secondary", variation: "destructive" }, tertiary);
|
|
54
|
-
}
|
|
55
|
-
return (React.createElement(React.Fragment, null, shouldShow && (React.createElement("div", { className: styles.actionBar },
|
|
56
|
-
React.createElement("div", { className: styles.rightAction },
|
|
57
|
-
primary && React.createElement(Button.Button, Object.assign({}, primary)),
|
|
58
|
-
secondary && React.createElement(Button.Button, Object.assign({}, secondary))),
|
|
59
|
-
tertiary && (React.createElement("div", { className: styles.leftAction },
|
|
60
|
-
React.createElement(Button.Button, Object.assign({}, tertiary))))))));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
exports.Modal = Modal;
|
package/dist/Modal-es.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import ReactDOM__default from 'react-dom';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
|
-
import { AnimatePresence, motion } from 'framer-motion';
|
|
5
|
-
import { u as useRefocusOnActivator_2 } from './useRefocusOnActivator-es.js';
|
|
6
|
-
import { u as useOnKeyDown_2 } from './useOnKeyDown-es.js';
|
|
7
|
-
import { u as useFocusTrap_2 } from './useFocusTrap-es.js';
|
|
8
|
-
import { H as Heading } from './Heading-es.js';
|
|
9
|
-
import { B as Button } from './Button-es.js';
|
|
10
|
-
import { B as ButtonDismiss } from './ButtonDismiss-es.js';
|
|
11
|
-
|
|
12
|
-
var styles = {"container":"y3M-9xoEnk0-","overlay":"zkyJp1mib-U-","modal":"gMPgiggaud8-","header":"_5sBzUnyOqD0-","closeButton":"_4gw63G7IYG0-","actionBar":"cwVJrrJkNDg-","leftAction":"MkD4pNUKeAA-","rightAction":"C-yC8JKpQLg-","spinning":"_7hYqr6OrfHs-"};
|
|
13
|
-
|
|
14
|
-
var sizes = {"small":"BSZvIAUzFEU-","large":"-ydIALYVvGg-","spinning":"_10FfgKITqY0-"};
|
|
15
|
-
|
|
16
|
-
function Modal({ open = false, title, size, dismissible = true, children, primaryAction, secondaryAction, tertiaryAction, onRequestClose, }) {
|
|
17
|
-
const modalClassName = classnames(styles.modal, size && sizes[size]);
|
|
18
|
-
useRefocusOnActivator_2(open);
|
|
19
|
-
const modalRef = useFocusTrap_2(open);
|
|
20
|
-
useOnKeyDown_2(handleRequestClose, "Escape");
|
|
21
|
-
const template = (React__default.createElement(AnimatePresence, null, open && (React__default.createElement("div", { ref: modalRef, role: "dialog", className: styles.container, tabIndex: 0 },
|
|
22
|
-
React__default.createElement(motion.div, { key: styles.overlay, className: styles.overlay, onClick: onRequestClose, initial: { opacity: 0 }, animate: { opacity: 0.8 }, exit: { opacity: 0 }, transition: { duration: 0.2 } }),
|
|
23
|
-
React__default.createElement(motion.div, { key: styles.modal, className: modalClassName, initial: { scale: 0.9, opacity: 0 }, animate: { scale: 1, opacity: 1 }, exit: { scale: 0.9, opacity: 0 }, transition: {
|
|
24
|
-
duration: 0.2,
|
|
25
|
-
ease: "easeInOut",
|
|
26
|
-
} },
|
|
27
|
-
title != undefined && (React__default.createElement(Header, { title: title, dismissible: dismissible, onRequestClose: onRequestClose })),
|
|
28
|
-
children,
|
|
29
|
-
React__default.createElement(Actions, { primary: primaryAction, secondary: secondaryAction, tertiary: tertiaryAction }))))));
|
|
30
|
-
return (globalThis === null || globalThis === void 0 ? void 0 : globalThis.document)
|
|
31
|
-
? ReactDOM__default.createPortal(template, document.body)
|
|
32
|
-
: template;
|
|
33
|
-
function handleRequestClose() {
|
|
34
|
-
if (open && onRequestClose) {
|
|
35
|
-
onRequestClose();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function Header({ title, dismissible, onRequestClose }) {
|
|
40
|
-
return (React__default.createElement("div", { className: styles.header, "data-testid": "modal-header" },
|
|
41
|
-
React__default.createElement(Heading, { level: 2 }, title),
|
|
42
|
-
dismissible && (React__default.createElement("div", { className: styles.closeButton },
|
|
43
|
-
React__default.createElement(ButtonDismiss, { onClick: onRequestClose, ariaLabel: "Close modal" })))));
|
|
44
|
-
}
|
|
45
|
-
function Actions({ primary, secondary, tertiary }) {
|
|
46
|
-
const shouldShow = primary != undefined || secondary != undefined || tertiary != undefined;
|
|
47
|
-
if (secondary != undefined) {
|
|
48
|
-
secondary = Object.assign({ type: "primary", variation: "subtle" }, secondary);
|
|
49
|
-
}
|
|
50
|
-
if (tertiary != undefined) {
|
|
51
|
-
tertiary = Object.assign({ type: "secondary", variation: "destructive" }, tertiary);
|
|
52
|
-
}
|
|
53
|
-
return (React__default.createElement(React__default.Fragment, null, shouldShow && (React__default.createElement("div", { className: styles.actionBar },
|
|
54
|
-
React__default.createElement("div", { className: styles.rightAction },
|
|
55
|
-
primary && React__default.createElement(Button, Object.assign({}, primary)),
|
|
56
|
-
secondary && React__default.createElement(Button, Object.assign({}, secondary))),
|
|
57
|
-
tertiary && (React__default.createElement("div", { className: styles.leftAction },
|
|
58
|
-
React__default.createElement(Button, Object.assign({}, tertiary))))))));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { Modal as M };
|