@zenkigen-inc/component-ui 1.1.3 → 1.2.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/index.esm.js +57 -136
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +61 -139
- package/dist/index.js.map +1 -1
- package/dist/modal/modal-body.d.ts +2 -0
- package/dist/modal/modal-context.d.ts +0 -1
- package/dist/modal/modal-footer.d.ts +6 -0
- package/dist/modal/modal-header.d.ts +2 -3
- package/dist/modal/modal.d.ts +7 -11
- package/package.json +3 -3
- package/dist/modal/modal-button-tab.d.ts +0 -25
- package/dist/modal/modal-tab.d.ts +0 -11
package/dist/index.js
CHANGED
|
@@ -31414,85 +31414,29 @@ if (process.env.NODE_ENV === 'production') {
|
|
|
31414
31414
|
}
|
|
31415
31415
|
});
|
|
31416
31416
|
|
|
31417
|
+
function ModalBody({
|
|
31418
|
+
children
|
|
31419
|
+
}) {
|
|
31420
|
+
return /*#__PURE__*/jsx("div", {
|
|
31421
|
+
className: "overflow-y-auto",
|
|
31422
|
+
children: children
|
|
31423
|
+
});
|
|
31424
|
+
}
|
|
31425
|
+
|
|
31417
31426
|
const ModalContext = /*#__PURE__*/createContext({
|
|
31418
|
-
width: 480,
|
|
31419
31427
|
setIsOpen: () => false
|
|
31420
31428
|
});
|
|
31421
31429
|
|
|
31422
|
-
|
|
31423
|
-
|
|
31424
|
-
|
|
31425
|
-
secondaryButtonLabel,
|
|
31426
|
-
onClickPrimaryButton,
|
|
31427
|
-
onClickSecondaryButton,
|
|
31428
|
-
isDanger,
|
|
31429
|
-
isNoBorder,
|
|
31430
|
-
isWithCheckbox,
|
|
31431
|
-
checkboxLabel,
|
|
31432
|
-
isChecked,
|
|
31433
|
-
onChange,
|
|
31434
|
-
subButtonLabel,
|
|
31435
|
-
onClickSubButton
|
|
31430
|
+
function ModalFooter({
|
|
31431
|
+
children,
|
|
31432
|
+
isNoBorder
|
|
31436
31433
|
}) {
|
|
31437
|
-
const {
|
|
31438
|
-
width,
|
|
31439
|
-
setIsOpen
|
|
31440
|
-
} = useContext(ModalContext);
|
|
31441
|
-
const handleClickPrimaryButton = useCallback(() => {
|
|
31442
|
-
onClickPrimaryButton();
|
|
31443
|
-
setIsOpen(false);
|
|
31444
|
-
}, [onClickPrimaryButton, setIsOpen]);
|
|
31445
|
-
const handleClickSecondaryButton = useCallback(() => {
|
|
31446
|
-
onClickSecondaryButton();
|
|
31447
|
-
setIsOpen(false);
|
|
31448
|
-
}, [onClickSecondaryButton, setIsOpen]);
|
|
31449
|
-
const handleClickSubButton = useCallback(() => {
|
|
31450
|
-
onClickSubButton == null || onClickSubButton();
|
|
31451
|
-
}, [onClickSubButton]);
|
|
31452
31434
|
const wrapperClasses = clsx$1('flex', 'shrink-0', 'items-center', 'w-full', 'rounded-b-lg', 'py-4', 'px-6', {
|
|
31453
|
-
'
|
|
31454
|
-
'justify-end': !isWithCheckbox || !subButtonLabel,
|
|
31455
|
-
'justify-center': subButtonLabel && width < sizeSmallLimit,
|
|
31456
|
-
'border-t-[1px] border-border-uiBorder01': !isNoBorder,
|
|
31457
|
-
'gap-y-4': width < sizeSmallLimit,
|
|
31458
|
-
'flex-wrap': width < sizeSmallLimit && isWithCheckbox,
|
|
31459
|
-
'flex-wrap-reverse': width < sizeSmallLimit && subButtonLabel
|
|
31460
|
-
});
|
|
31461
|
-
const buttonContainerClasses = clsx$1('flex', 'items-center', {
|
|
31462
|
-
'w-full justify-center': width < sizeSmallLimit,
|
|
31463
|
-
'gap-x-2': width < sizeSmallLimit,
|
|
31464
|
-
'gap-x-4': sizeSmallLimit <= width
|
|
31435
|
+
'border-t-[1px] border-border-uiBorder01': !isNoBorder
|
|
31465
31436
|
});
|
|
31466
|
-
return /*#__PURE__*/
|
|
31437
|
+
return /*#__PURE__*/jsx("div", {
|
|
31467
31438
|
className: wrapperClasses,
|
|
31468
|
-
children:
|
|
31469
|
-
children: /*#__PURE__*/jsx(Checkbox, {
|
|
31470
|
-
id: "modal-checkbox",
|
|
31471
|
-
label: checkboxLabel,
|
|
31472
|
-
isChecked: isChecked,
|
|
31473
|
-
onChange: onChange
|
|
31474
|
-
})
|
|
31475
|
-
}) : subButtonLabel && onClickSubButton ? /*#__PURE__*/jsx(Button, {
|
|
31476
|
-
variant: "text",
|
|
31477
|
-
size: "large",
|
|
31478
|
-
onClick: handleClickSubButton,
|
|
31479
|
-
children: subButtonLabel
|
|
31480
|
-
}, "0") : null, /*#__PURE__*/jsxs("div", {
|
|
31481
|
-
className: buttonContainerClasses,
|
|
31482
|
-
children: [/*#__PURE__*/jsx(Button, {
|
|
31483
|
-
variant: "outline",
|
|
31484
|
-
size: "large",
|
|
31485
|
-
width: width < sizeSmallLimit ? 132 : 'auto',
|
|
31486
|
-
onClick: handleClickSecondaryButton,
|
|
31487
|
-
children: secondaryButtonLabel
|
|
31488
|
-
}, "1"), /*#__PURE__*/jsx(Button, {
|
|
31489
|
-
variant: isDanger ? 'fillDanger' : 'fill',
|
|
31490
|
-
size: "large",
|
|
31491
|
-
width: width < sizeSmallLimit ? 132 : 'auto',
|
|
31492
|
-
onClick: handleClickPrimaryButton,
|
|
31493
|
-
children: primaryButtonLabel
|
|
31494
|
-
}, "2")]
|
|
31495
|
-
})]
|
|
31439
|
+
children: children
|
|
31496
31440
|
});
|
|
31497
31441
|
}
|
|
31498
31442
|
|
|
@@ -31511,7 +31455,9 @@ function ModalHeader({
|
|
|
31511
31455
|
});
|
|
31512
31456
|
return /*#__PURE__*/jsxs("div", {
|
|
31513
31457
|
className: headerClasses,
|
|
31514
|
-
children: [
|
|
31458
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
31459
|
+
children: children
|
|
31460
|
+
}), !isNoCloseButton && /*#__PURE__*/jsx(IconButton, {
|
|
31515
31461
|
icon: "close",
|
|
31516
31462
|
size: "small",
|
|
31517
31463
|
variant: "text",
|
|
@@ -31520,92 +31466,38 @@ function ModalHeader({
|
|
|
31520
31466
|
});
|
|
31521
31467
|
}
|
|
31522
31468
|
|
|
31523
|
-
const
|
|
31524
|
-
|
|
31525
|
-
[`${typography.label.label2regular}`]: !props.isSelected,
|
|
31526
|
-
['text-interactive-interactive02 hover:before:bg-border-uiBorder02Dark']: !props.isSelected,
|
|
31527
|
-
[`${typography.label.label2bold}`]: props.isSelected,
|
|
31528
|
-
['before:bg-interactive-interactive01 hover:before:bg-interactive-interactive01 pointer-events-none']: props.isSelected
|
|
31529
|
-
});
|
|
31530
|
-
return /*#__PURE__*/jsx("button", {
|
|
31531
|
-
type: "button",
|
|
31532
|
-
role: "tab",
|
|
31533
|
-
"aria-selected": props.isSelected,
|
|
31534
|
-
className: classes,
|
|
31535
|
-
disabled: props.isDisabled,
|
|
31536
|
-
onClick: () => props.onClick(props.id),
|
|
31537
|
-
children: props.children
|
|
31538
|
-
});
|
|
31539
|
-
};
|
|
31540
|
-
|
|
31541
|
-
function Tab({
|
|
31542
|
-
children
|
|
31543
|
-
}) {
|
|
31544
|
-
const classes = clsx('flex', 'px-6', 'gap-4', 'relative', 'before:bg-border-uiBorder01', 'before:h-px', 'before:bottom-0', 'before:left-0', 'before:right-0', 'before:absolute', {});
|
|
31545
|
-
return /*#__PURE__*/jsx("div", {
|
|
31546
|
-
role: "tablist",
|
|
31547
|
-
className: classes,
|
|
31548
|
-
children: children
|
|
31549
|
-
});
|
|
31550
|
-
}
|
|
31551
|
-
Tab.Item = TabItem;
|
|
31552
|
-
|
|
31553
|
-
function ModalTab({
|
|
31554
|
-
tabItems,
|
|
31555
|
-
selectedTab,
|
|
31556
|
-
setSelectedTab
|
|
31557
|
-
}) {
|
|
31558
|
-
return /*#__PURE__*/jsx("div", {
|
|
31559
|
-
className: "mt-2 w-full",
|
|
31560
|
-
children: /*#__PURE__*/jsx(Tab, {
|
|
31561
|
-
children: tabItems.map(item => /*#__PURE__*/jsx(TabItem, {
|
|
31562
|
-
id: item.id,
|
|
31563
|
-
isSelected: selectedTab === item.id,
|
|
31564
|
-
onClick: setSelectedTab,
|
|
31565
|
-
children: item.label
|
|
31566
|
-
}, item.id))
|
|
31567
|
-
})
|
|
31568
|
-
});
|
|
31569
|
-
}
|
|
31570
|
-
|
|
31469
|
+
const LIMIT_WIDTH = 320;
|
|
31470
|
+
const LIMIT_HEIGHT = 184;
|
|
31571
31471
|
function Modal({
|
|
31572
31472
|
children,
|
|
31573
31473
|
width = 480,
|
|
31574
31474
|
height,
|
|
31575
31475
|
isOpen,
|
|
31576
31476
|
setIsOpen,
|
|
31577
|
-
portalTargetRef
|
|
31578
|
-
headerElement,
|
|
31579
|
-
tabElement,
|
|
31580
|
-
buttonTabElement
|
|
31477
|
+
portalTargetRef
|
|
31581
31478
|
}) {
|
|
31582
|
-
const
|
|
31583
|
-
const
|
|
31584
|
-
const contentClasses = 'flex items-center justify-center overflow-y-auto';
|
|
31479
|
+
const renderWidth = typeof width === 'number' ? Math.max(width, LIMIT_WIDTH) : width;
|
|
31480
|
+
const renderHeight = typeof height === 'number' ? Math.max(height, LIMIT_HEIGHT) : height;
|
|
31585
31481
|
return /*#__PURE__*/reactDom.createPortal(isOpen && /*#__PURE__*/jsx(ModalContext.Provider, {
|
|
31586
31482
|
value: {
|
|
31587
|
-
width,
|
|
31588
31483
|
setIsOpen
|
|
31589
31484
|
},
|
|
31590
31485
|
children: /*#__PURE__*/jsx("div", {
|
|
31591
|
-
className:
|
|
31592
|
-
children: /*#__PURE__*/
|
|
31593
|
-
className:
|
|
31486
|
+
className: "fixed left-0 top-0 z-overlay flex h-full w-full items-center justify-center bg-background-backgroundOverlayBlack",
|
|
31487
|
+
children: /*#__PURE__*/jsx("div", {
|
|
31488
|
+
className: "flex shrink-0 flex-col rounded-lg bg-background-uiBackground01 shadow-modalShadow",
|
|
31594
31489
|
style: {
|
|
31595
|
-
width,
|
|
31596
|
-
height
|
|
31490
|
+
width: renderWidth,
|
|
31491
|
+
height: renderHeight
|
|
31597
31492
|
},
|
|
31598
|
-
children:
|
|
31599
|
-
className: contentClasses,
|
|
31600
|
-
children: children
|
|
31601
|
-
}), buttonTabElement]
|
|
31493
|
+
children: children
|
|
31602
31494
|
})
|
|
31603
31495
|
})
|
|
31604
31496
|
}), !portalTargetRef || (portalTargetRef == null ? void 0 : portalTargetRef.current) === null ? document.body : portalTargetRef.current);
|
|
31605
31497
|
}
|
|
31498
|
+
Modal.Body = ModalBody;
|
|
31606
31499
|
Modal.Header = ModalHeader;
|
|
31607
|
-
Modal.
|
|
31608
|
-
Modal.ButtonTab = ModalButtonTab;
|
|
31500
|
+
Modal.Footer = ModalFooter;
|
|
31609
31501
|
|
|
31610
31502
|
const _excluded$1 = ["state", "size"];
|
|
31611
31503
|
function NotificationInline(_ref) {
|
|
@@ -32138,6 +32030,36 @@ function SelectSort({
|
|
|
32138
32030
|
});
|
|
32139
32031
|
}
|
|
32140
32032
|
|
|
32033
|
+
const TabItem = props => {
|
|
32034
|
+
const classes = clsx('relative', 'flex', 'z-0', 'py-2', 'leading-[24px]', 'before:h-px', 'before:absolute', 'before:left-0', 'before:right-0', 'before:bottom-0', 'hover:text-text-text01', 'disabled:text-disabled-disabled01', 'disabled:pointer-events-none', {
|
|
32035
|
+
[`${typography.label.label2regular}`]: !props.isSelected,
|
|
32036
|
+
['text-interactive-interactive02 hover:before:bg-border-uiBorder02Dark']: !props.isSelected,
|
|
32037
|
+
[`${typography.label.label2bold}`]: props.isSelected,
|
|
32038
|
+
['before:bg-interactive-interactive01 hover:before:bg-interactive-interactive01 pointer-events-none']: props.isSelected
|
|
32039
|
+
});
|
|
32040
|
+
return /*#__PURE__*/jsx("button", {
|
|
32041
|
+
type: "button",
|
|
32042
|
+
role: "tab",
|
|
32043
|
+
"aria-selected": props.isSelected,
|
|
32044
|
+
className: classes,
|
|
32045
|
+
disabled: props.isDisabled,
|
|
32046
|
+
onClick: () => props.onClick(props.id),
|
|
32047
|
+
children: props.children
|
|
32048
|
+
});
|
|
32049
|
+
};
|
|
32050
|
+
|
|
32051
|
+
function Tab({
|
|
32052
|
+
children
|
|
32053
|
+
}) {
|
|
32054
|
+
const classes = clsx('flex', 'px-6', 'gap-4', 'relative', 'before:bg-border-uiBorder01', 'before:h-px', 'before:bottom-0', 'before:left-0', 'before:right-0', 'before:absolute', {});
|
|
32055
|
+
return /*#__PURE__*/jsx("div", {
|
|
32056
|
+
role: "tablist",
|
|
32057
|
+
className: classes,
|
|
32058
|
+
children: children
|
|
32059
|
+
});
|
|
32060
|
+
}
|
|
32061
|
+
Tab.Item = TabItem;
|
|
32062
|
+
|
|
32141
32063
|
function TableCell({
|
|
32142
32064
|
children,
|
|
32143
32065
|
className
|