@kosdev-code/kos-ddk-components 3.1.0 → 3.1.2
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/components/modal/index.d.ts +1 -0
- package/components/modal/index.d.ts.map +1 -1
- package/components/modal/utility-modal/index.d.ts +2 -0
- package/components/modal/utility-modal/index.d.ts.map +1 -0
- package/components/modal/utility-modal/use-utility-modal.d.ts +51 -0
- package/components/modal/utility-modal/use-utility-modal.d.ts.map +1 -0
- package/index.cjs +83 -19
- package/index.cjs.map +1 -1
- package/index.js +83 -19
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -4849,6 +4849,88 @@ const ModalContainer = styled.div`
|
|
|
4849
4849
|
gap: var(--ddk-component-base-modal-container-gap);
|
|
4850
4850
|
height: 100%;
|
|
4851
4851
|
`;
|
|
4852
|
+
const BackText = () => {
|
|
4853
|
+
const { t } = useKosTranslation("common");
|
|
4854
|
+
return t("close");
|
|
4855
|
+
};
|
|
4856
|
+
const VolumeBackButton = ({
|
|
4857
|
+
children,
|
|
4858
|
+
fill,
|
|
4859
|
+
label,
|
|
4860
|
+
size = "medium",
|
|
4861
|
+
...props
|
|
4862
|
+
}) => /* @__PURE__ */ jsx(
|
|
4863
|
+
IconButton,
|
|
4864
|
+
{
|
|
4865
|
+
icon: fill ? ChevronLeftIcon : ChevronLeftIcon,
|
|
4866
|
+
size,
|
|
4867
|
+
...props,
|
|
4868
|
+
children: label ?? /* @__PURE__ */ jsx(BackText, {})
|
|
4869
|
+
}
|
|
4870
|
+
);
|
|
4871
|
+
const backButton = (label) => function UtilityBackButton({ onPointerDown }) {
|
|
4872
|
+
return /* @__PURE__ */ jsx(
|
|
4873
|
+
VolumeBackButton,
|
|
4874
|
+
{
|
|
4875
|
+
onPointerDown,
|
|
4876
|
+
label,
|
|
4877
|
+
size: "small"
|
|
4878
|
+
}
|
|
4879
|
+
);
|
|
4880
|
+
};
|
|
4881
|
+
const useUtilityModal = ({
|
|
4882
|
+
onComplete,
|
|
4883
|
+
onClose,
|
|
4884
|
+
layout = "maximized",
|
|
4885
|
+
onBack,
|
|
4886
|
+
showBack = !!onBack,
|
|
4887
|
+
backButtonLabel = "Back",
|
|
4888
|
+
closeButtonLabel = "Close"
|
|
4889
|
+
} = {}) => {
|
|
4890
|
+
const { componentModeOverride } = useComponentConfigurationContext();
|
|
4891
|
+
const isCompact = componentModeOverride === "compact";
|
|
4892
|
+
const [closing, setClosing] = useState(false);
|
|
4893
|
+
const close = useCallback(() => {
|
|
4894
|
+
onClose?.();
|
|
4895
|
+
setClosing(true);
|
|
4896
|
+
}, [onClose]);
|
|
4897
|
+
const BackButton2 = useMemo(() => backButton(backButtonLabel), [
|
|
4898
|
+
backButtonLabel
|
|
4899
|
+
]);
|
|
4900
|
+
const fullscreen = layout === "fullscreen";
|
|
4901
|
+
const modalProps = {
|
|
4902
|
+
show: !closing,
|
|
4903
|
+
mode: layout,
|
|
4904
|
+
contain: fullscreen ? false : !isCompact,
|
|
4905
|
+
// A utility closes from its own controls, never from a tap outside it.
|
|
4906
|
+
closeOnShroudClick: false,
|
|
4907
|
+
onClose: close,
|
|
4908
|
+
onClosed: onComplete
|
|
4909
|
+
};
|
|
4910
|
+
const headerProps = fullscreen ? {
|
|
4911
|
+
contain: true,
|
|
4912
|
+
raiseCloseButton: true,
|
|
4913
|
+
showCloseButton: true,
|
|
4914
|
+
closeButtonLabel,
|
|
4915
|
+
onClose: close
|
|
4916
|
+
} : {
|
|
4917
|
+
contain: isCompact,
|
|
4918
|
+
CloseButton: isCompact ? CompactCloseButton : void 0,
|
|
4919
|
+
showCloseButton: true,
|
|
4920
|
+
closeButtonLabel,
|
|
4921
|
+
onClose: close,
|
|
4922
|
+
OpenButton: BackButton2,
|
|
4923
|
+
showOpenButton: !isCompact && showBack,
|
|
4924
|
+
onOpen: onBack
|
|
4925
|
+
};
|
|
4926
|
+
return {
|
|
4927
|
+
isCompact,
|
|
4928
|
+
close,
|
|
4929
|
+
modalProps,
|
|
4930
|
+
headerProps,
|
|
4931
|
+
showFooterBack: isCompact && showBack
|
|
4932
|
+
};
|
|
4933
|
+
};
|
|
4852
4934
|
const WorkflowModalBase = styled(Modal)`
|
|
4853
4935
|
--ddk-component-modal-min-height: var(
|
|
4854
4936
|
--ddk-component-workflow-modal-min-height
|
|
@@ -11104,25 +11186,6 @@ const viewStyles = css`
|
|
|
11104
11186
|
padding: var(--ddk-component-view-padding);
|
|
11105
11187
|
`;
|
|
11106
11188
|
const View = ({ children, contain = true, style }) => contain ? /* @__PURE__ */ jsx(Container$8, { children: /* @__PURE__ */ jsx("div", { css: [viewStyles, style], children }) }) : /* @__PURE__ */ jsx("div", { css: [viewStyles, style], children });
|
|
11107
|
-
const BackText = () => {
|
|
11108
|
-
const { t } = useKosTranslation("common");
|
|
11109
|
-
return t("close");
|
|
11110
|
-
};
|
|
11111
|
-
const VolumeBackButton = ({
|
|
11112
|
-
children,
|
|
11113
|
-
fill,
|
|
11114
|
-
label,
|
|
11115
|
-
size = "medium",
|
|
11116
|
-
...props
|
|
11117
|
-
}) => /* @__PURE__ */ jsx(
|
|
11118
|
-
IconButton,
|
|
11119
|
-
{
|
|
11120
|
-
icon: fill ? ChevronLeftIcon : ChevronLeftIcon,
|
|
11121
|
-
size,
|
|
11122
|
-
...props,
|
|
11123
|
-
children: label ?? /* @__PURE__ */ jsx(BackText, {})
|
|
11124
|
-
}
|
|
11125
|
-
);
|
|
11126
11189
|
export {
|
|
11127
11190
|
ActionCard,
|
|
11128
11191
|
ActionItem,
|
|
@@ -11297,6 +11360,7 @@ export {
|
|
|
11297
11360
|
useExperience,
|
|
11298
11361
|
useKeyboardToggle,
|
|
11299
11362
|
useNavigate,
|
|
11363
|
+
useUtilityModal,
|
|
11300
11364
|
useViewExperience,
|
|
11301
11365
|
useViewExperienceListMap
|
|
11302
11366
|
};
|