@kaizen/components 1.35.2 → 1.37.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/cjs/KaizenProvider/KaizenProvider.cjs +6 -1
- package/dist/cjs/KaizenProvider/KaizenProvider.cjs.map +1 -1
- package/dist/cjs/Modal/ContextModal/ContextModal.cjs +9 -6
- package/dist/cjs/Modal/ContextModal/ContextModal.cjs.map +1 -1
- package/dist/cjs/Notification/ToastNotification/ToastNotification/ToastNotification.cjs +33 -0
- package/dist/cjs/Notification/ToastNotification/ToastNotification/ToastNotification.cjs.map +1 -0
- package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.cjs +36 -0
- package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.cjs.map +1 -0
- package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.module.scss.cjs +7 -0
- package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.module.scss.cjs.map +1 -0
- package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.cjs +42 -0
- package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.cjs.map +1 -0
- package/dist/cjs/Notification/ToastNotification/context/ToastNotificationContext.cjs +72 -0
- package/dist/cjs/Notification/ToastNotification/context/ToastNotificationContext.cjs.map +1 -0
- package/dist/cjs/Notification/ToastNotification/hooks/useToastNotification.cjs +9 -0
- package/dist/cjs/Notification/ToastNotification/hooks/useToastNotification.cjs.map +1 -0
- package/dist/cjs/RichTextEditor/RichTextEditor/RichTextEditor.cjs +6 -2
- package/dist/cjs/RichTextEditor/RichTextEditor/RichTextEditor.cjs.map +1 -1
- package/dist/cjs/__future__/Select/Select.cjs +14 -1
- package/dist/cjs/__future__/Select/Select.cjs.map +1 -1
- package/dist/cjs/dts/Modal/ContextModal/ContextModal.d.ts +2 -1
- package/dist/cjs/dts/Notification/ToastNotification/ToastNotification/ToastNotification.d.ts +16 -0
- package/dist/cjs/dts/Notification/ToastNotification/ToastNotification/index.d.ts +1 -0
- package/dist/cjs/dts/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.d.ts +4 -0
- package/dist/cjs/dts/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.d.ts +12 -0
- package/dist/cjs/dts/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/index.d.ts +1 -0
- package/dist/cjs/dts/Notification/ToastNotification/context/ToastNotificationContext.d.ts +21 -0
- package/dist/cjs/dts/Notification/ToastNotification/hooks/useToastNotification.d.ts +2 -0
- package/dist/cjs/dts/Notification/ToastNotification/index.d.ts +3 -2
- package/dist/cjs/dts/Notification/ToastNotification/types.d.ts +1 -9
- package/dist/cjs/dts/Notification/index.d.ts +1 -0
- package/dist/cjs/dts/RichTextEditor/RichTextEditor/RichTextEditor.d.ts +1 -1
- package/dist/cjs/dts/__future__/Select/Select.d.ts +5 -1
- package/dist/cjs/dts/index.d.ts +4 -3
- package/dist/cjs/index.cjs +16 -8
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.css +9 -8
- package/dist/esm/KaizenProvider/KaizenProvider.mjs +6 -1
- package/dist/esm/KaizenProvider/KaizenProvider.mjs.map +1 -1
- package/dist/esm/Modal/ContextModal/ContextModal.mjs +9 -6
- package/dist/esm/Modal/ContextModal/ContextModal.mjs.map +1 -1
- package/dist/esm/Notification/ToastNotification/ToastNotification/ToastNotification.mjs +31 -0
- package/dist/esm/Notification/ToastNotification/ToastNotification/ToastNotification.mjs.map +1 -0
- package/dist/esm/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.mjs +34 -0
- package/dist/esm/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.mjs.map +1 -0
- package/dist/esm/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.module.scss.mjs +5 -0
- package/dist/esm/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.module.scss.mjs.map +1 -0
- package/dist/esm/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.mjs +40 -0
- package/dist/esm/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.mjs.map +1 -0
- package/dist/esm/Notification/ToastNotification/context/ToastNotificationContext.mjs +69 -0
- package/dist/esm/Notification/ToastNotification/context/ToastNotificationContext.mjs.map +1 -0
- package/dist/esm/Notification/ToastNotification/hooks/useToastNotification.mjs +7 -0
- package/dist/esm/Notification/ToastNotification/hooks/useToastNotification.mjs.map +1 -0
- package/dist/esm/RichTextEditor/RichTextEditor/RichTextEditor.mjs +6 -2
- package/dist/esm/RichTextEditor/RichTextEditor/RichTextEditor.mjs.map +1 -1
- package/dist/esm/__future__/Select/Select.mjs +15 -2
- package/dist/esm/__future__/Select/Select.mjs.map +1 -1
- package/dist/esm/dts/Modal/ContextModal/ContextModal.d.ts +2 -1
- package/dist/esm/dts/Notification/ToastNotification/ToastNotification/ToastNotification.d.ts +16 -0
- package/dist/esm/dts/Notification/ToastNotification/ToastNotification/index.d.ts +1 -0
- package/dist/esm/dts/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.d.ts +4 -0
- package/dist/esm/dts/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.d.ts +12 -0
- package/dist/esm/dts/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/index.d.ts +1 -0
- package/dist/esm/dts/Notification/ToastNotification/context/ToastNotificationContext.d.ts +21 -0
- package/dist/esm/dts/Notification/ToastNotification/hooks/useToastNotification.d.ts +2 -0
- package/dist/esm/dts/Notification/ToastNotification/index.d.ts +3 -2
- package/dist/esm/dts/Notification/ToastNotification/types.d.ts +1 -9
- package/dist/esm/dts/Notification/index.d.ts +1 -0
- package/dist/esm/dts/RichTextEditor/RichTextEditor/RichTextEditor.d.ts +1 -1
- package/dist/esm/dts/__future__/Select/Select.d.ts +5 -1
- package/dist/esm/dts/index.d.ts +4 -3
- package/dist/esm/index.css +8 -7
- package/dist/esm/index.mjs +8 -4
- package/dist/esm/index.mjs.map +1 -1
- package/dist/index.d.ts +136 -81
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/src/DatePicker/DatePicker.spec.tsx +1 -1
- package/src/KaizenProvider/KaizenProvider.tsx +6 -1
- package/src/Modal/ContextModal/ContextModal.spec.tsx +3 -3
- package/src/Modal/ContextModal/ContextModal.tsx +9 -5
- package/src/Notification/ToastNotification/ToastNotification/ToastNotification.spec.tsx +33 -0
- package/src/Notification/ToastNotification/ToastNotification/ToastNotification.tsx +48 -0
- package/src/Notification/ToastNotification/ToastNotification/index.ts +1 -0
- package/src/Notification/ToastNotification/{subcomponents/ToastNotificationsList → ToastNotificationsList}/ToastNotificationsList.module.scss +1 -1
- package/src/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.tsx +40 -0
- package/src/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.tsx +49 -0
- package/src/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/index.ts +1 -0
- package/src/Notification/ToastNotification/_docs/ToastNotification.mdx +19 -14
- package/src/Notification/ToastNotification/_docs/ToastNotification.stickersheet.stories.tsx +33 -70
- package/src/Notification/ToastNotification/_docs/ToastNotification.stories.tsx +123 -93
- package/src/Notification/ToastNotification/context/ToastNotificationContext.tsx +96 -0
- package/src/Notification/ToastNotification/hooks/useToastNotification.ts +9 -0
- package/src/Notification/ToastNotification/index.ts +3 -2
- package/src/Notification/ToastNotification/types.ts +1 -18
- package/src/Notification/index.ts +1 -0
- package/src/RichTextEditor/RichTextEditor/RichTextEditor.tsx +6 -1
- package/src/RichTextEditor/utils/commands/addMark.spec.ts +0 -1
- package/src/Tooltip/Tooltip.spec.tsx +6 -1
- package/src/__future__/Select/Select.spec.tsx +78 -2
- package/src/__future__/Select/Select.tsx +18 -2
- package/src/__future__/Select/_docs/Select.mdx +8 -0
- package/src/__future__/Select/_docs/Select.stories.tsx +29 -0
- package/src/index.ts +4 -3
- package/dist/cjs/dts/Notification/ToastNotification/ToastNotification.d.ts +0 -14
- package/dist/cjs/dts/Notification/ToastNotification/subcomponents/ToastNotificationManager/ToastNotificationManager.d.ts +0 -7
- package/dist/cjs/dts/Notification/ToastNotification/subcomponents/ToastNotificationManager/index.d.ts +0 -1
- package/dist/cjs/dts/Notification/ToastNotification/subcomponents/ToastNotificationsList/ToastNotificationsList.d.ts +0 -11
- package/dist/cjs/dts/Notification/ToastNotification/subcomponents/ToastNotificationsListContainer/ToastNotificationsListContainer.d.ts +0 -7
- package/dist/cjs/dts/Notification/ToastNotification/subcomponents/ToastNotificationsListContainer/index.d.ts +0 -1
- package/dist/esm/dts/Notification/ToastNotification/ToastNotification.d.ts +0 -14
- package/dist/esm/dts/Notification/ToastNotification/subcomponents/ToastNotificationManager/ToastNotificationManager.d.ts +0 -7
- package/dist/esm/dts/Notification/ToastNotification/subcomponents/ToastNotificationManager/index.d.ts +0 -1
- package/dist/esm/dts/Notification/ToastNotification/subcomponents/ToastNotificationsList/ToastNotificationsList.d.ts +0 -11
- package/dist/esm/dts/Notification/ToastNotification/subcomponents/ToastNotificationsListContainer/ToastNotificationsListContainer.d.ts +0 -7
- package/dist/esm/dts/Notification/ToastNotification/subcomponents/ToastNotificationsListContainer/index.d.ts +0 -1
- package/src/Notification/ToastNotification/ToastNotification.spec.tsx +0 -31
- package/src/Notification/ToastNotification/ToastNotification.tsx +0 -43
- package/src/Notification/ToastNotification/subcomponents/ToastNotificationManager/ToastNotificationManager.spec.tsx +0 -144
- package/src/Notification/ToastNotification/subcomponents/ToastNotificationManager/ToastNotificationManager.tsx +0 -135
- package/src/Notification/ToastNotification/subcomponents/ToastNotificationManager/index.ts +0 -1
- package/src/Notification/ToastNotification/subcomponents/ToastNotificationsList/ToastNotificationsList.tsx +0 -40
- package/src/Notification/ToastNotification/subcomponents/ToastNotificationsListContainer/ToastNotificationsListContainer.spec.tsx +0 -73
- package/src/Notification/ToastNotification/subcomponents/ToastNotificationsListContainer/ToastNotificationsListContainer.tsx +0 -31
- package/src/Notification/ToastNotification/subcomponents/ToastNotificationsListContainer/index.ts +0 -1
- /package/dist/cjs/dts/Notification/ToastNotification/{subcomponents/ToastNotificationsList → ToastNotificationsList}/index.d.ts +0 -0
- /package/dist/esm/dts/Notification/ToastNotification/{subcomponents/ToastNotificationsList → ToastNotificationsList}/index.d.ts +0 -0
- /package/src/Notification/ToastNotification/{subcomponents/ToastNotificationsList → ToastNotificationsList}/index.ts +0 -0
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
+
require('../Notification/InlineNotification/InlineNotification.cjs');
|
|
5
|
+
require('../Notification/GlobalNotification/GlobalNotification.cjs');
|
|
6
|
+
require('../Notification/ToastNotification/ToastNotification/ToastNotification.cjs');
|
|
7
|
+
var ToastNotificationsList = require('../Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.cjs');
|
|
8
|
+
var ToastNotificationContext = require('../Notification/ToastNotification/context/ToastNotificationContext.cjs');
|
|
4
9
|
var FontDefinitions = require('./subcomponents/FontDefinitions/FontDefinitions.cjs');
|
|
5
10
|
var OptionalIntlProvider = require('./subcomponents/OptionalIntlProvider/OptionalIntlProvider.cjs');
|
|
6
11
|
const KaizenProvider = /*#__PURE__*/function () {
|
|
@@ -10,7 +15,7 @@ const KaizenProvider = /*#__PURE__*/function () {
|
|
|
10
15
|
locale = _b === void 0 ? "en" : _b;
|
|
11
16
|
return React.createElement(OptionalIntlProvider.OptionalIntlProvider, {
|
|
12
17
|
locale: locale
|
|
13
|
-
}, React.createElement(React.Fragment, null, children, React.createElement(FontDefinitions.FontDefinitions, null)));
|
|
18
|
+
}, React.createElement(React.Fragment, null, React.createElement(ToastNotificationContext.ToastNotificationProvider, null, React.createElement(ToastNotificationsList.ToastNotificationsList, null), children), React.createElement(FontDefinitions.FontDefinitions, null)));
|
|
14
19
|
};
|
|
15
20
|
KaizenProvider.displayName = "KaizenProvider";
|
|
16
21
|
return KaizenProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KaizenProvider.cjs","sources":["../../../src/KaizenProvider/KaizenProvider.tsx"],"sourcesContent":["import React from \"react\"\nimport { FontDefinitions } from \"./subcomponents/FontDefinitions\"\nimport { OptionalIntlProvider } from \"./subcomponents/OptionalIntlProvider\"\n\nexport type KaizenProviderProps = {\n children: React.ReactNode\n locale?: string\n}\n\nexport const KaizenProvider = ({\n children,\n locale = \"en\",\n}: KaizenProviderProps): JSX.Element => (\n <OptionalIntlProvider locale={locale}>\n <>\n {children}\n <FontDefinitions />\n </>\n </OptionalIntlProvider>\n)\n\nKaizenProvider.displayName = \"KaizenProvider\"\n"],"names":["KaizenProvider","_a","children","_b","locale","React","createElement","OptionalIntlProvider","Fragment","FontDefinitions","displayName"],"mappings":"
|
|
1
|
+
{"version":3,"file":"KaizenProvider.cjs","sources":["../../../src/KaizenProvider/KaizenProvider.tsx"],"sourcesContent":["import React from \"react\"\nimport { ToastNotificationsList } from \"~components/Notification\"\nimport { ToastNotificationProvider } from \"~components/Notification/ToastNotification/context/ToastNotificationContext\"\nimport { FontDefinitions } from \"./subcomponents/FontDefinitions\"\nimport { OptionalIntlProvider } from \"./subcomponents/OptionalIntlProvider\"\n\nexport type KaizenProviderProps = {\n children: React.ReactNode\n locale?: string\n}\n\nexport const KaizenProvider = ({\n children,\n locale = \"en\",\n}: KaizenProviderProps): JSX.Element => (\n <OptionalIntlProvider locale={locale}>\n <>\n <ToastNotificationProvider>\n <ToastNotificationsList />\n {children}\n </ToastNotificationProvider>\n <FontDefinitions />\n </>\n </OptionalIntlProvider>\n)\n\nKaizenProvider.displayName = \"KaizenProvider\"\n"],"names":["KaizenProvider","_a","children","_b","locale","React","createElement","OptionalIntlProvider","Fragment","ToastNotificationProvider","ToastNotificationsList","FontDefinitions","displayName"],"mappings":";;;;;;;;;;MAWaA,cAAc;EAAA,MAAdA,cAAc,GAAG,SAAAA,CAACC,EAGT,EAAA;IAFpB,IAAAC,QAAQ,cAAA;MACRC,EAAA,GAAAF,EAAA,CAAAG,MAAa;MAAbA,MAAM,GAAAD,EAAA,KAAA,KAAA,CAAA,GAAG,IAAI,GAAAA,EAAA;IACyB,OACtCE,KAAC,CAAAC,aAAA,CAAAC,oBAAoB,CAAAA,oBAAA,EAAC;MAAAH,MAAM,EAAEA;IAAM,CAAA,EAClCC,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAG,QAAA,EAAA,IAAA,EACEH,KAAA,CAAAC,aAAA,CAACG,wBAAAA,CAAAA,yBAAyB,EAAA,IAAA,EACxBJ,KAAA,CAAAC,aAAA,CAACI,sBAAsB,CAAAA,sBAAA,EAAG,IAAA,CAAA,EACzBR,QAAQ,CACiB,EAC5BG,KAAA,CAAAC,aAAA,CAACK,eAAAA,CAAAA,eAAe,EAAA,IAAA,CAAG,CAClB,CACkB;EATe,CAUvC;EAEDX,cAAc,CAACY,WAAW,GAAG,gBAAgB;EAAA,OAfhCZ,cAAc;AAAA;"}
|
|
@@ -26,6 +26,7 @@ const ContextModal = /*#__PURE__*/function () {
|
|
|
26
26
|
layout = _c === void 0 ? "portrait" : _c,
|
|
27
27
|
title = _a.title,
|
|
28
28
|
onConfirm = _a.onConfirm,
|
|
29
|
+
propsOnDismiss = _a.onDismiss,
|
|
29
30
|
onAfterLeave = _a.onAfterLeave,
|
|
30
31
|
_d = _a.confirmLabel,
|
|
31
32
|
confirmLabel = _d === void 0 ? "Confirm" : _d,
|
|
@@ -34,8 +35,10 @@ const ContextModal = /*#__PURE__*/function () {
|
|
|
34
35
|
children = _a.children,
|
|
35
36
|
contentHeader = _a.contentHeader,
|
|
36
37
|
image = _a.image,
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
secondaryLabel = _a.secondaryLabel,
|
|
39
|
+
onSecondaryAction = _a.onSecondaryAction,
|
|
40
|
+
props = tslib.__rest(_a, ["isOpen", "unpadded", "layout", "title", "onConfirm", "onDismiss", "onAfterLeave", "confirmLabel", "confirmWorking", "renderBackground", "children", "contentHeader", "image", "secondaryLabel", "onSecondaryAction"]);
|
|
41
|
+
var onDismiss = confirmWorking ? undefined : propsOnDismiss;
|
|
39
42
|
var footerActions = [];
|
|
40
43
|
var workingProps = confirmWorking ? {
|
|
41
44
|
working: true,
|
|
@@ -49,10 +52,10 @@ const ContextModal = /*#__PURE__*/function () {
|
|
|
49
52
|
};
|
|
50
53
|
footerActions.push(tslib.__assign(tslib.__assign({}, confirmAction), workingProps));
|
|
51
54
|
}
|
|
52
|
-
if (
|
|
55
|
+
if (secondaryLabel) {
|
|
53
56
|
footerActions.push({
|
|
54
|
-
label:
|
|
55
|
-
onClick:
|
|
57
|
+
label: secondaryLabel,
|
|
58
|
+
onClick: onSecondaryAction,
|
|
56
59
|
disabled: !!confirmWorking
|
|
57
60
|
});
|
|
58
61
|
}
|
|
@@ -80,7 +83,7 @@ const ContextModal = /*#__PURE__*/function () {
|
|
|
80
83
|
}, image), React.createElement("div", {
|
|
81
84
|
className: ContextModal_module.content
|
|
82
85
|
}, children, onConfirm != null && React.createElement("div", {
|
|
83
|
-
className:
|
|
86
|
+
className: secondaryLabel ? ContextModal_module.footerWithSecondaryAction : ContextModal_module.footer
|
|
84
87
|
})))), React.createElement(ModalFooter.ModalFooter, {
|
|
85
88
|
variant: image ? "context" : undefined,
|
|
86
89
|
actions: footerActions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextModal.cjs","sources":["../../../../src/Modal/ContextModal/ContextModal.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\"\nimport classnames from \"classnames\"\nimport { ButtonProps } from \"~components/Button\"\nimport { Heading } from \"~components/Heading\"\nimport {\n GenericModal,\n ModalFooter,\n ModalHeader,\n ModalAccessibleLabel,\n ModalBody,\n} from \"~components/Modal/GenericModal\"\nimport styles from \"./ContextModal.module.scss\"\n\nexport type ContextModalSecondaryActionProps =\n | {\n secondaryLabel: string\n onSecondaryAction: () => void\n }\n | {\n secondaryLabel?: undefined\n }\n\nexport type ContextModalProps = Readonly<\n {\n isOpen: boolean\n unpadded?: boolean\n /**\n * Defines the orientation layout of the image and content\n */\n layout?: \"portrait\" | \"landscape\"\n title: string\n onConfirm?: () => void\n onDismiss: () => void\n onAfterLeave?: () => void\n confirmLabel?: string\n confirmWorking?: { label: string; labelHidden?: boolean }\n /**\n * @deprecated use data-testid instead\n */\n automationId?: string\n renderBackground?: () => React.ReactNode\n image?: React.ReactNode\n children: React.ReactNode\n contentHeader?: React.ReactNode\n } & ContextModalSecondaryActionProps &\n HTMLAttributes<HTMLDivElement>\n>\n\n/**\n * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082093114/Modal Guidance} |\n * {@link https://cultureamp.design/?path=/docs/components-modals--contextmodal--docs Storybook}\n */\nexport const ContextModal = ({\n isOpen,\n unpadded = false,\n layout = \"portrait\",\n title,\n onConfirm,\n onAfterLeave,\n confirmLabel = \"Confirm\",\n confirmWorking,\n renderBackground,\n children,\n contentHeader,\n image,\n ...props\n}: ContextModalProps): JSX.Element => {\n const onDismiss = confirmWorking ? undefined :
|
|
1
|
+
{"version":3,"file":"ContextModal.cjs","sources":["../../../../src/Modal/ContextModal/ContextModal.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\"\nimport classnames from \"classnames\"\nimport { ButtonProps } from \"~components/Button\"\nimport { Heading } from \"~components/Heading\"\nimport {\n GenericModal,\n ModalFooter,\n ModalHeader,\n ModalAccessibleLabel,\n ModalBody,\n} from \"~components/Modal/GenericModal\"\nimport styles from \"./ContextModal.module.scss\"\n\nexport type ContextModalSecondaryActionProps =\n | {\n secondaryLabel: string\n onSecondaryAction: () => void\n }\n | {\n secondaryLabel?: undefined\n onSecondaryAction?: never\n }\n\nexport type ContextModalProps = Readonly<\n {\n isOpen: boolean\n unpadded?: boolean\n /**\n * Defines the orientation layout of the image and content\n */\n layout?: \"portrait\" | \"landscape\"\n title: string\n onConfirm?: () => void\n onDismiss: () => void\n onAfterLeave?: () => void\n confirmLabel?: string\n confirmWorking?: { label: string; labelHidden?: boolean }\n /**\n * @deprecated use data-testid instead\n */\n automationId?: string\n renderBackground?: () => React.ReactNode\n image?: React.ReactNode\n children: React.ReactNode\n contentHeader?: React.ReactNode\n } & ContextModalSecondaryActionProps &\n HTMLAttributes<HTMLDivElement>\n>\n\n/**\n * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082093114/Modal Guidance} |\n * {@link https://cultureamp.design/?path=/docs/components-modals--contextmodal--docs Storybook}\n */\nexport const ContextModal = ({\n isOpen,\n unpadded = false,\n layout = \"portrait\",\n title,\n onConfirm,\n onDismiss: propsOnDismiss,\n onAfterLeave,\n confirmLabel = \"Confirm\",\n confirmWorking,\n renderBackground,\n children,\n contentHeader,\n image,\n secondaryLabel,\n onSecondaryAction,\n ...props\n}: ContextModalProps): JSX.Element => {\n const onDismiss = confirmWorking ? undefined : propsOnDismiss\n\n const footerActions: ButtonProps[] = []\n\n const workingProps = confirmWorking\n ? {\n working: true,\n workingLabel: confirmWorking.label,\n workingLabelHidden: confirmWorking.labelHidden,\n }\n : {}\n\n if (onConfirm) {\n const confirmAction = { label: confirmLabel, onClick: onConfirm }\n footerActions.push({ ...confirmAction, ...workingProps })\n }\n\n if (secondaryLabel) {\n footerActions.push({\n label: secondaryLabel,\n onClick: onSecondaryAction,\n disabled: !!confirmWorking,\n })\n }\n\n return (\n <GenericModal\n isOpen={isOpen}\n onEscapeKeyup={onDismiss}\n onOutsideModalClick={onDismiss}\n onAfterLeave={onAfterLeave}\n >\n <div className={styles.modal} data-modal {...props}>\n {renderBackground && renderBackground()}\n <ModalHeader onDismiss={onDismiss}>\n <div\n className={classnames(styles.header, !unpadded && styles.padded)}\n >\n <ModalAccessibleLabel>\n <Heading variant=\"heading-2\" tag=\"h2\">\n {title}\n </Heading>\n </ModalAccessibleLabel>\n </div>\n </ModalHeader>\n {contentHeader && (\n <div className={styles.contentHeader}>{contentHeader}</div>\n )}\n <ModalBody>\n <div\n className={classnames(\n styles.contentLayout,\n styles[`${layout}Contentlayout`]\n )}\n >\n {image && <div className={styles.image}>{image}</div>}\n <div className={styles.content}>\n {children}\n {onConfirm != null && (\n <div\n className={\n secondaryLabel\n ? styles.footerWithSecondaryAction\n : styles.footer\n }\n ></div>\n )}\n </div>\n </div>\n </ModalBody>\n <ModalFooter\n variant={image ? \"context\" : undefined}\n actions={footerActions}\n appearance=\"primary\"\n unpadded={unpadded}\n />\n </div>\n </GenericModal>\n )\n}\n\nContextModal.displayName = \"ContextModal\"\n"],"names":["ContextModal","_a","isOpen","_b","unpadded","_c","layout","title","onConfirm","propsOnDismiss","onDismiss","onAfterLeave","_d","confirmLabel","confirmWorking","renderBackground","children","contentHeader","image","secondaryLabel","onSecondaryAction","props","__rest","undefined","footerActions","workingProps","working","workingLabel","label","workingLabelHidden","labelHidden","confirmAction","onClick","push","__assign","disabled","React","createElement","GenericModal","onEscapeKeyup","onOutsideModalClick","className","styles","modal","ModalHeader","classnames","header","padded","ModalAccessibleLabel","Heading","variant","tag","ModalBody","contentLayout","concat","content","footerWithSecondaryAction","footer","ModalFooter","actions","appearance","displayName"],"mappings":";;;;;;;;;;;;;;;AAiDA;;;AAGG;AAHH,MAIaA,YAAY;EAAA,MAAZA,YAAY,GAAG,SAAAA,CAACC,EAiBT,EAAA;IAhBlB,IAAAC,MAAM,GAAAD,EAAA,CAAAC,MAAA;MACNC,EAAA,GAAAF,EAAA,CAAAG,QAAgB;MAAhBA,QAAQ,GAAGD,EAAA,KAAA,KAAA,CAAA,GAAA,KAAK,GAAAA,EAAA;MAChBE,EAAmB,GAAAJ,EAAA,CAAAK,MAAA;MAAnBA,MAAM,GAAAD,EAAA,KAAA,KAAA,CAAA,GAAG,U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AAA,CAACe,SAAAA,CAAAA,SAAS,EAAA,IAAA,EACRhB,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;MACEI,SAAS,EAAEI,UAAU,CACnBH,mBAAM,CAACW,aAAa,EACpBX,mBAAM,CAAC,EAAA,CAAAY,MAAA,CAAGhD,MAAM,EAAA,eAAA,CAAe,CAAC;IACjC,CAAA,EAEAY,KAAK,IAAIkB;MAAKK,SAAS,EAAEC,mBAAM,CAACxB;IAAQ,CAAA,EAAAA,KAAK,CAAO,EACrDkB,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;MAAKI,SAAS,EAAEC,mBAAM,CAACa;IAAO,CAAA,EAC3BvC,QAAQ,EACRR,SAAS,IAAI,IAAI,IAChB4B,KACE,CAAAC,aAAA,CAAA,KAAA,EAAA;MAAAI,SAAS,EACPtB,cAAc,GACVuB,mBAAM,CAACc,yBAAyB,GAChCd,mBAAM,CAACe;IAAM,EAGtB,CACG,CACF,CACI,EACZrB,KAAA,CAAAC,aAAA,CAACqB,WAAW,CAAAA,WAAA,EAAA;MACVR,OAAO,EAAEhC,KAAK,GAAG,SAAS,GAAGK,SAAS;MACtCoC,OAAO,EAAEnC,aAAa;MACtBoC,UAAU,EAAC,SAAS;MACpBxD,QAAQ,EAAEA;IAAQ,CAAA,CAClB,CACE,CACO;EAEnB,CAAC;EAEDJ,YAAY,CAAC6D,WAAW,GAAG,cAAc;EAAA,OAnG5B7D,YAAY;AAAA;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var ToastNotificationContext = require('../context/ToastNotificationContext.cjs');
|
|
6
|
+
var ToastNotification = function (_a) {
|
|
7
|
+
var propsId = _a.id,
|
|
8
|
+
_b = _a.hideCloseIcon,
|
|
9
|
+
hideCloseIcon = _b === void 0 ? false : _b,
|
|
10
|
+
type = _a.type,
|
|
11
|
+
title = _a.title,
|
|
12
|
+
onHide = _a.onHide,
|
|
13
|
+
children = _a.children,
|
|
14
|
+
restProps = tslib.__rest(_a, ["id", "hideCloseIcon", "type", "title", "onHide", "children"]);
|
|
15
|
+
var reactId = React.useId();
|
|
16
|
+
var id = propsId || reactId;
|
|
17
|
+
var addToastNotification = ToastNotificationContext.useToastNotificationContext().addToastNotification;
|
|
18
|
+
var persistent = hideCloseIcon;
|
|
19
|
+
React.useEffect(function () {
|
|
20
|
+
addToastNotification(tslib.__assign({
|
|
21
|
+
id: id,
|
|
22
|
+
type: type,
|
|
23
|
+
title: title,
|
|
24
|
+
message: children,
|
|
25
|
+
persistent: persistent,
|
|
26
|
+
onHide: onHide
|
|
27
|
+
}, restProps));
|
|
28
|
+
}, []);
|
|
29
|
+
return null;
|
|
30
|
+
};
|
|
31
|
+
ToastNotification.displayName = "ToastNotification";
|
|
32
|
+
exports.ToastNotification = ToastNotification;
|
|
33
|
+
//# sourceMappingURL=ToastNotification.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastNotification.cjs","sources":["../../../../../src/Notification/ToastNotification/ToastNotification/ToastNotification.tsx"],"sourcesContent":["import React, { useEffect, useId } from \"react\"\nimport { useToastNotificationContext } from \"../context/ToastNotificationContext\"\nimport { ToastNotificationObj } from \"../types\"\n\nexport type ToastNotificationProps = Omit<\n ToastNotificationObj,\n \"id\" | \"message\" | \"persistent\"\n> & {\n children: React.ReactNode\n id?: string\n /**\n * Removes the dismiss trigger. Functions the same as `persistent` in `addToastNotification`.\n * If this is true you will need to manage the removal of notifications manually.\n * @default false\n */\n hideCloseIcon?: boolean\n}\n\nexport const ToastNotification = ({\n id: propsId,\n hideCloseIcon = false,\n type,\n title,\n onHide,\n children,\n ...restProps\n}: ToastNotificationProps): null => {\n const reactId = useId()\n const id = propsId || reactId\n const { addToastNotification } = useToastNotificationContext()\n const persistent = hideCloseIcon\n\n useEffect(() => {\n addToastNotification({\n id,\n type,\n title,\n message: children,\n persistent,\n onHide,\n ...restProps,\n })\n }, [])\n\n return null\n}\n\nToastNotification.displayName = \"ToastNotification\"\n"],"names":["ToastNotification","_a","propsId","id","_b","hideCloseIcon","type","title","onHide","children","restProps","__rest","reactId","useId","addToastNotification","useToastNotificationContext","persistent","useEffect","__assign","message","displayName"],"mappings":";;;;;AAkBO,IAAMA,iBAAiB,GAAG,SAAAA,CAACC,EAQT,EAAA;EAPvB,IAAIC,OAAO,GAAAD,EAAA,CAAAE,EAAA;IACXC,EAAqB,GAAAH,EAAA,CAAAI,aAAA;IAArBA,aAAa,GAAGD,EAAA,KAAA,KAAA,CAAA,GAAA,KAAK,GAAAA,EAAA;IACrBE,IAAI,GAAAL,EAAA,CAAAK,IAAA;IACJC,KAAK,GAAAN,EAAA,CAAAM,KAAA;IACLC,MAAM,GAAAP,EAAA,CAAAO,MAAA;IACNC,QAAQ,GAAAR,EAAA,CAAAQ,QAAA;IACLC,SAAS,GAPoBC,KAAA,CAAAA,MAAA,CAAAV,EAAA,EAAA,CAAA,IAAA,EAAA,eAAA,EAAA,MAAA,EAAA,OAAA,EAAA,QAAA,EAAA,UAAA,CAQjC,CADa;EAEZ,IAAMW,OAAO,GAAGC,KAAAA,CAAAA,KAAK,EAAE;EACvB,IAAMV,EAAE,GAAGD,OAAO,IAAIU,OAAO;EACrB,IAAAE,oBAAoB,GAAKC,oDAA2B,CAAE,CAAA,qBAAlC;EAC5B,IAAMC,UAAU,GAAGX,aAAa;EAEhCY,KAAAA,CAAAA,SAAS,CAAC,YAAA;IACRH,oBAAoB,CAAAI,KAAA,CAAAA,QAAA,CAAA;MAClBf,EAAE,EAAAA,EAAA;MACFG,IAAI,EAAAA,IAAA;MACJC,KAAK,EAAAA,KAAA;MACLY,OAAO,EAAEV,QAAQ;MACjBO,UAAU,EAAAA,UAAA;MACVR,MAAM,EAAAA;IAAA,CAAA,EACHE,SAAS,CAAA,CACZ;EACH,CAAA,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACb,CAAC;AAEDV,iBAAiB,CAACoB,WAAW,GAAG,mBAAmB;"}
|
package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.cjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var ReactDOM = require('react-dom');
|
|
5
|
+
var ToastNotificationContext = require('../context/ToastNotificationContext.cjs');
|
|
6
|
+
var ToastNotificationsMap = require('./subcomponents/ToastNotificationsMap/ToastNotificationsMap.cjs');
|
|
7
|
+
var ToastNotificationsList_module = require('./ToastNotificationsList.module.scss.cjs');
|
|
8
|
+
const ToastNotificationsList = /*#__PURE__*/function () {
|
|
9
|
+
const ToastNotificationsList = function () {
|
|
10
|
+
var _a = ToastNotificationContext.useToastNotificationContext(),
|
|
11
|
+
notifications = _a.notifications,
|
|
12
|
+
removeToastNotification = _a.removeToastNotification;
|
|
13
|
+
var containers = document.querySelectorAll('[data-testid="toast-notifications-list"');
|
|
14
|
+
if (containers) {
|
|
15
|
+
// Remove any duplicate instances
|
|
16
|
+
// (eg. Storybook docs page has multiple stories each with their own context)
|
|
17
|
+
containers.forEach(function (c, i) {
|
|
18
|
+
if (i === 0) return;
|
|
19
|
+
c.remove();
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return ReactDOM.createPortal(React.createElement("div", {
|
|
23
|
+
"data-testid": "toast-notifications-list",
|
|
24
|
+
role: "status",
|
|
25
|
+
className: ToastNotificationsList_module.toastNotificationsList
|
|
26
|
+
}, React.createElement(ToastNotificationsMap.ToastNotificationsMap, {
|
|
27
|
+
notifications: notifications,
|
|
28
|
+
onHide: removeToastNotification,
|
|
29
|
+
container: containers[0]
|
|
30
|
+
})), document.body);
|
|
31
|
+
};
|
|
32
|
+
ToastNotificationsList.displayName = "ToastNotificationsList";
|
|
33
|
+
return ToastNotificationsList;
|
|
34
|
+
}();
|
|
35
|
+
exports.ToastNotificationsList = ToastNotificationsList;
|
|
36
|
+
//# sourceMappingURL=ToastNotificationsList.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastNotificationsList.cjs","sources":["../../../../../src/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.tsx"],"sourcesContent":["import React from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { useToastNotificationContext } from \"../context/ToastNotificationContext\"\nimport { ToastNotificationsMap } from \"./subcomponents/ToastNotificationsMap\"\nimport styles from \"./ToastNotificationsList.module.scss\"\n\nexport const ToastNotificationsList = (): JSX.Element => {\n const { notifications, removeToastNotification } =\n useToastNotificationContext()\n\n const containers = document.querySelectorAll(\n '[data-testid=\"toast-notifications-list\"'\n )\n\n if (containers) {\n // Remove any duplicate instances\n // (eg. Storybook docs page has multiple stories each with their own context)\n containers.forEach((c, i) => {\n if (i === 0) return\n c.remove()\n })\n }\n\n return createPortal(\n <div\n data-testid=\"toast-notifications-list\"\n role=\"status\"\n className={styles.toastNotificationsList}\n >\n <ToastNotificationsMap\n notifications={notifications}\n onHide={removeToastNotification}\n container={containers[0]}\n />\n </div>,\n document.body\n )\n}\n\nToastNotificationsList.displayName = \"ToastNotificationsList\"\n"],"names":["ToastNotificationsList","_a","useToastNotificationContext","notifications","removeToastNotification","containers","document","querySelectorAll","forEach","c","i","remove","createPortal","React","createElement","role","className","styles","toastNotificationsList","ToastNotificationsMap","onHide","container","body","displayName"],"mappings":";;;;;;;MAMaA,sBAAsB;EAAA,MAAtBA,sBAAsB,GAAG,SAAAA,CAAA,EAAA;IAC9B,IAAAC,EAAA,GACJC,wBAA2B,CAAAA,2BAAA,CAAA,CAAE;MADvBC,aAAa,GAAAF,EAAA,CAAAE,aAAA;MAAEC,uBAAuB,GAAAH,EAAA,CAAAG,uBACf;IAE/B,IAAMC,UAAU,GAAGC,QAAQ,CAACC,gBAAgB,CAC1C,yCAAyC,CAC1C;IAED,IAAIF,UAAU,EAAE;;;MAGdA,UAAU,CAACG,OAAO,CAAC,UAACC,CAAC,EAAEC,CAAC,EAAA;QACtB,IAAIA,CAAC,KAAK,CAAC,EAAE;QACbD,CAAC,CAACE,MAAM,CAAA,CAAE;MACZ,CAAC,CAAC;IACH;IAED,OAAOC,qBAAY,CACjBC,KACc,CAAAC,aAAA,CAAA,KAAA,EAAA;MAAA,aAAA,EAAA,0BAA0B;MACtCC,IAAI,EAAC,QAAQ;MACbC,SAAS,EAAEC,6BAAM,CAACC;IAAsB,CAAA,EAExCL,KAAC,CAAAC,aAAA,CAAAK,qBAAqB,CAAAA,qBAAA;MACpBhB,aAAa,EAAEA,aAAa;MAC5BiB,MAAM,EAAEhB,uBAAuB;MAC/BiB,SAAS,EAAEhB,UAAU,CAAC,CAAC;IAAC,CACxB,CAAA,CACE,EACNC,QAAQ,CAACgB,IAAI,CACd;EACH,CAAC;EAEDtB,sBAAsB,CAACuB,WAAW,GAAG,wBAAwB;EAAA,OAjChDvB,sBAAsB;AAAA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastNotificationsList.module.scss.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var ReactDOM = require('react-dom');
|
|
6
|
+
var GenericNotification = require('../../../../subcomponents/GenericNotification/GenericNotification.cjs');
|
|
7
|
+
const ToastNotificationsMap = /*#__PURE__*/function () {
|
|
8
|
+
const ToastNotificationsMap = function (_a) {
|
|
9
|
+
var notifications = _a.notifications,
|
|
10
|
+
defaultOnHide = _a.onHide,
|
|
11
|
+
container = _a.container;
|
|
12
|
+
if (!container) return null;
|
|
13
|
+
// To consolidate all notifications into a single list when there are multiple contexts,
|
|
14
|
+
// this list cannot render with a container (must be portalled into one).
|
|
15
|
+
return ReactDOM.createPortal(React.createElement(React.Fragment, null, notifications.map(function (_a) {
|
|
16
|
+
var id = _a.id,
|
|
17
|
+
type = _a.type,
|
|
18
|
+
title = _a.title,
|
|
19
|
+
persistent = _a.persistent,
|
|
20
|
+
onHide = _a.onHide,
|
|
21
|
+
message = _a.message,
|
|
22
|
+
restProps = tslib.__rest(_a, ["id", "type", "title", "persistent", "onHide", "message"]);
|
|
23
|
+
return React.createElement(GenericNotification.GenericNotification, tslib.__assign({
|
|
24
|
+
key: id,
|
|
25
|
+
style: "toast",
|
|
26
|
+
type: type,
|
|
27
|
+
title: title,
|
|
28
|
+
persistent: persistent,
|
|
29
|
+
onHide: function () {
|
|
30
|
+
if (typeof onHide !== "undefined") {
|
|
31
|
+
onHide();
|
|
32
|
+
}
|
|
33
|
+
defaultOnHide(id);
|
|
34
|
+
}
|
|
35
|
+
}, restProps), message);
|
|
36
|
+
})), container);
|
|
37
|
+
};
|
|
38
|
+
ToastNotificationsMap.displayName = "ToastNotificationsMap";
|
|
39
|
+
return ToastNotificationsMap;
|
|
40
|
+
}();
|
|
41
|
+
exports.ToastNotificationsMap = ToastNotificationsMap;
|
|
42
|
+
//# sourceMappingURL=ToastNotificationsMap.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastNotificationsMap.cjs","sources":["../../../../../../../src/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { GenericNotification } from \"~components/Notification/subcomponents/GenericNotification\"\nimport { OverrideClassName } from \"~types/OverrideClassName\"\nimport { ToastNotificationObj } from \"../../../types\"\n\nexport type ToastNotificationsMapProps = {\n notifications: ToastNotificationObj[]\n onHide: (notificationId: string) => void\n container: Element | null\n} & OverrideClassName<HTMLAttributes<HTMLDivElement>>\n\nexport const ToastNotificationsMap = ({\n notifications,\n onHide: defaultOnHide,\n container,\n}: ToastNotificationsMapProps): JSX.Element | null => {\n if (!container) return null\n\n // To consolidate all notifications into a single list when there are multiple contexts,\n // this list cannot render with a container (must be portalled into one).\n return createPortal(\n <>\n {notifications.map(\n ({ id, type, title, persistent, onHide, message, ...restProps }) => (\n <GenericNotification\n key={id}\n style=\"toast\"\n type={type}\n title={title}\n persistent={persistent}\n onHide={(): void => {\n if (typeof onHide !== \"undefined\") {\n onHide()\n }\n defaultOnHide(id)\n }}\n {...restProps}\n >\n {message}\n </GenericNotification>\n )\n )}\n </>,\n container\n )\n}\n\nToastNotificationsMap.displayName = \"ToastNotificationsMap\"\n"],"names":["ToastNotificationsMap","_a","notifications","defaultOnHide","onHide","container","createPortal","React","createElement","Fragment","map","id","type","title","persistent","message","restProps","__rest","GenericNotification","__assign","key","style","displayName"],"mappings":";;;;;;MAYaA,qBAAqB;EAAA,MAArBA,qBAAqB,GAAG,SAAAA,CAACC,EAIT,EAAA;IAH3B,IAAAC,aAAa,mBAAA;MACLC,aAAa,GAAAF,EAAA,CAAAG,MAAA;MACrBC,SAAS,GAAAJ,EAAA,CAAAI,SAAA;IAET,IAAI,CAACA,SAAS,EAAE,OAAO,IAAI;;;IAI3B,OAAOC,QAAY,CAAAA,YAAA,CACjBC,KACG,CAAAC,aAAA,CAAAD,KAAA,CAAAE,QAAA,EAAA,IAAA,EAAAP,aAAa,CAACQ,GAAG,CAChB,UAACT,EAA8D,EAAA;MAA5D,IAAAU,EAAE,QAAA;QAAEC,IAAI,UAAA;QAAEC,KAAK,WAAA;QAAEC,UAAU,gBAAA;QAAEV,MAAM,YAAA;QAAEW,OAAO,aAAA;QAAKC,SAAS,GAA5DC,KAAA,CAAAA,MAAA,CAAAhB,EAAA,EAAA,CAAA,IAAA,EAAA,MAAA,EAAA,OAAA,EAAA,YAAA,EAAA,QAAA,EAAA,SAAA,CAA8D,CAAF;MAAO,OAClEM,KAAC,CAAAC,aAAA,CAAAU,mBAAmB,CAAAA,mBAAA,EAClBC,KAAA,CAAAA,QAAA,CAAA;QAAAC,GAAG,EAAET,EAAE;QACPU,KAAK,EAAC,OAAO;QACbT,IAAI,EAAEA,IAAI;QACVC,KAAK,EAAEA,KAAK;QACZC,UAAU,EAAEA,UAAU;QACtBV,MAAM,EAAE,SAAAA,CAAA,EAAA;UACN,IAAI,OAAOA,MAAM,KAAK,WAAW,EAAE;YACjCA,MAAM,EAAE;UACT;UACDD,aAAa,CAACQ,EAAE,CAAC;QACnB;SACIK,SAAS,CAAA,EAEZD,OAAO,CACY;IACvB,CAAA,CACF,CACA,EACHV,SAAS,CACV;EACH,CAAC;EAEDL,qBAAqB,CAACsB,WAAW,GAAG,uBAAuB;EAAA,OApC9CtB,qBAAqB;AAAA;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var uuid = require('uuid');
|
|
6
|
+
var ToastNotificationContext = React.createContext(null);
|
|
7
|
+
var useToastNotificationContext = function () {
|
|
8
|
+
var context = React.useContext(ToastNotificationContext);
|
|
9
|
+
if (!context) {
|
|
10
|
+
throw new Error("useToastNotificationContext must be used within the ToastNotificationContext.Provider");
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
};
|
|
14
|
+
const ToastNotificationProvider = /*#__PURE__*/function () {
|
|
15
|
+
const ToastNotificationProvider = function (_a) {
|
|
16
|
+
var children = _a.children;
|
|
17
|
+
var _b = React.useState([]),
|
|
18
|
+
notifications = _b[0],
|
|
19
|
+
setNotifications = _b[1];
|
|
20
|
+
var addToastNotification = function (notification) {
|
|
21
|
+
var uuid$1 = uuid.v4();
|
|
22
|
+
var notificationWithId = tslib.__assign({
|
|
23
|
+
id: uuid$1
|
|
24
|
+
}, notification);
|
|
25
|
+
var notificationExists = notifications.find(function (_a) {
|
|
26
|
+
var id = _a.id;
|
|
27
|
+
return id === notification.id;
|
|
28
|
+
});
|
|
29
|
+
if (!notificationExists) {
|
|
30
|
+
setNotifications(function (existing) {
|
|
31
|
+
return tslib.__spreadArray(tslib.__spreadArray([], existing, true), [notificationWithId], false);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var updateToastNotification = function (notification) {
|
|
36
|
+
var notificationIndex = notifications.findIndex(function (_a) {
|
|
37
|
+
var id = _a.id;
|
|
38
|
+
return id === notification.id;
|
|
39
|
+
});
|
|
40
|
+
var copy = notifications.slice();
|
|
41
|
+
copy.splice(notificationIndex, 1, notification); // Mutation to insert notification over itself
|
|
42
|
+
setNotifications(copy);
|
|
43
|
+
};
|
|
44
|
+
var removeToastNotification = function (notificationID) {
|
|
45
|
+
var notificationIndex = notifications.findIndex(function (_a) {
|
|
46
|
+
var id = _a.id;
|
|
47
|
+
return id === notificationID;
|
|
48
|
+
});
|
|
49
|
+
var copy = notifications.slice();
|
|
50
|
+
copy.splice(notificationIndex, 1); // Mutation
|
|
51
|
+
setNotifications(copy);
|
|
52
|
+
};
|
|
53
|
+
var clearToastNotifications = function () {
|
|
54
|
+
setNotifications([]);
|
|
55
|
+
};
|
|
56
|
+
var value = {
|
|
57
|
+
notifications: notifications,
|
|
58
|
+
addToastNotification: addToastNotification,
|
|
59
|
+
updateToastNotification: updateToastNotification,
|
|
60
|
+
removeToastNotification: removeToastNotification,
|
|
61
|
+
clearToastNotifications: clearToastNotifications
|
|
62
|
+
};
|
|
63
|
+
return React.createElement(ToastNotificationContext.Provider, {
|
|
64
|
+
value: value
|
|
65
|
+
}, children);
|
|
66
|
+
};
|
|
67
|
+
ToastNotificationProvider.displayName = "ToastNotificationProvider";
|
|
68
|
+
return ToastNotificationProvider;
|
|
69
|
+
}();
|
|
70
|
+
exports.ToastNotificationProvider = ToastNotificationProvider;
|
|
71
|
+
exports.useToastNotificationContext = useToastNotificationContext;
|
|
72
|
+
//# sourceMappingURL=ToastNotificationContext.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastNotificationContext.cjs","sources":["../../../../../src/Notification/ToastNotification/context/ToastNotificationContext.tsx"],"sourcesContent":["import React, { useContext, useState } from \"react\"\nimport { v4 as uuidv4 } from \"uuid\"\nimport { ToastNotificationObj } from \"../types\"\n\ntype ToastNotificationObjOptionalId = Omit<ToastNotificationObj, \"id\"> & {\n id?: string\n}\n\nexport type ToastNotificationContextValue = {\n notifications: ToastNotificationObj[]\n addToastNotification: (notification: ToastNotificationObjOptionalId) => void\n updateToastNotification: (notification: ToastNotificationObj) => void\n removeToastNotification: (notificationId: string) => void\n clearToastNotifications: () => void\n}\n\nconst ToastNotificationContext =\n React.createContext<ToastNotificationContextValue | null>(null)\n\nexport const useToastNotificationContext =\n (): ToastNotificationContextValue => {\n const context = useContext(ToastNotificationContext)\n\n if (!context) {\n throw new Error(\n \"useToastNotificationContext must be used within the ToastNotificationContext.Provider\"\n )\n }\n\n return context\n }\n\ntype ToastNotificationProviderProps = {\n children: React.ReactNode\n}\n\nexport const ToastNotificationProvider = ({\n children,\n}: ToastNotificationProviderProps): JSX.Element | null => {\n const [notifications, setNotifications] = useState<ToastNotificationObj[]>([])\n\n const addToastNotification: ToastNotificationContextValue[\"addToastNotification\"] =\n notification => {\n const uuid = uuidv4()\n const notificationWithId = { id: uuid, ...notification }\n\n const notificationExists = notifications.find(\n ({ id }) => id === notification.id\n )\n\n if (!notificationExists) {\n setNotifications(existing => [...existing, notificationWithId])\n }\n }\n\n const updateToastNotification = (\n notification: ToastNotificationObj\n ): void => {\n const notificationIndex = notifications.findIndex(\n ({ id }) => id === notification.id\n )\n\n const copy = notifications.slice()\n copy.splice(notificationIndex, 1, notification) // Mutation to insert notification over itself\n setNotifications(copy)\n }\n\n const removeToastNotification = (notificationID: string): void => {\n const notificationIndex = notifications.findIndex(\n ({ id }) => id === notificationID\n )\n const copy = notifications.slice()\n copy.splice(notificationIndex, 1) // Mutation\n setNotifications(copy)\n }\n\n const clearToastNotifications = (): void => {\n setNotifications([])\n }\n\n const value = {\n notifications,\n addToastNotification,\n updateToastNotification,\n removeToastNotification,\n clearToastNotifications,\n } satisfies ToastNotificationContextValue\n\n return (\n <ToastNotificationContext.Provider value={value}>\n {children}\n </ToastNotificationContext.Provider>\n )\n}\n\nToastNotificationProvider.displayName = \"ToastNotificationProvider\"\n"],"names":["ToastNotificationContext","React","createContext","useToastNotificationContext","context","useContext","Error","ToastNotificationProvider","_a","children","_b","useState","notifications","setNotifications","addToastNotification","notification","uuid","uuidv4","notificationWithId","id","notificationExists","find","existing","__spreadArray","updateToastNotification","notificationIndex","findIndex","copy","slice","splice","removeToastNotification","notificationID","clearToastNotifications","value","createElement","Provider","displayName"],"mappings":";;;;;AAgBA,IAAMA,wBAAwB,GAC5BC,KAAK,CAACC,aAAa,CAAuC,IAAI,CAAC;AAEpD,IAAAC,2BAA2B,GACtC,SAAAA,CAAA,EAAA;EACE,IAAMC,OAAO,GAAGC,gBAAU,CAACL,wBAAwB,CAAC;EAEpD,IAAI,CAACI,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CACb,uFAAuF,CACxF;EACF;EAED,OAAOF,OAAO;AAChB,CAAC;AAAA,MAMUG,yBAAyB;EAAA,MAAzBA,yBAAyB,GAAG,SAAAA,CAACC,EAET,EAAA;IAD/B,IAAAC,QAAQ,GAAAD,EAAA,CAAAC,QAAA;IAEF,IAAAC,EAAA,GAAoCC,KAAAA,CAAAA,QAAQ,CAAyB,EAAE,CAAC;MAAvEC,aAAa,GAAAF,EAAA,CAAA,CAAA,CAAA;MAAEG,gBAAgB,GAAAH,EAAA,CAAA,CAAA,CAAwC;IAE9E,IAAMI,oBAAoB,GACxB,SAAAA,CAAAC,YAAY,EAAA;MACV,IAAMC,MAAI,GAAGC,IAAAA,CAAAA,EAAM,EAAE;MACrB,IAAMC,kBAAkB;QAAKC,EAAE,EAAEH;MAAI,CAAK,EAAAD,YAAY,CAAE;MAExD,IAAMK,kBAAkB,GAAGR,aAAa,CAACS,IAAI,CAC3C,UAACb,EAAM,EAAA;QAAJ,IAAAW,EAAE,GAAAX,EAAA,CAAAW,EAAA;QAAO,OAAAA,EAAE,KAAKJ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GAAG;MACZrB,aAAa,EAAAA,aAAA;MACbE,oBAAoB,EAAAA,oBAAA;MACpBU,uBAAuB,EAAAA,uBAAA;MACvBM,uBAAuB,EAAAA,uBAAA;MACvBE,uBAAuB,EAAAA;KACgB;IAEzC,OACE/B,KAAA,CAAAiC,aAAA,CAAClC,wBAAwB,CAACmC,QAAQ,EAAA;MAACF,KAAK,EAAEA;KAAK,EAC5CxB,QAAQ,CACyB;EAExC,CAAC;EAEDF,yBAAyB,CAAC6B,WAAW,GAAG,2BAA2B;EAAA,OA3DtD7B,yBAAyB;AAAA;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ToastNotificationContext = require('../context/ToastNotificationContext.cjs');
|
|
4
|
+
var useToastNotification = function () {
|
|
5
|
+
var context = ToastNotificationContext.useToastNotificationContext();
|
|
6
|
+
return context;
|
|
7
|
+
};
|
|
8
|
+
exports.useToastNotification = useToastNotification;
|
|
9
|
+
//# sourceMappingURL=useToastNotification.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToastNotification.cjs","sources":["../../../../../src/Notification/ToastNotification/hooks/useToastNotification.ts"],"sourcesContent":["import {\n ToastNotificationContextValue,\n useToastNotificationContext,\n} from \"../context/ToastNotificationContext\"\n\nexport const useToastNotification = (): ToastNotificationContextValue => {\n const context = useToastNotificationContext()\n return context\n}\n"],"names":["useToastNotification","context","useToastNotificationContext"],"mappings":";;;AAKa,IAAAA,oBAAoB,GAAG,SAAAA,CAAA,EAAA;EAClC,IAAMC,OAAO,GAAGC,wBAAAA,CAAAA,2BAA2B,EAAE;EAC7C,OAAOD,OAAO;AAChB,CAAA;"}
|
|
@@ -7,6 +7,9 @@ var FieldMessage = require('../../FieldMessage/FieldMessage.cjs');
|
|
|
7
7
|
var Label = require('../../Label/Label.cjs');
|
|
8
8
|
var InlineNotification = require('../../Notification/InlineNotification/InlineNotification.cjs');
|
|
9
9
|
require('../../Notification/GlobalNotification/GlobalNotification.cjs');
|
|
10
|
+
require('../../Notification/ToastNotification/ToastNotification/ToastNotification.cjs');
|
|
11
|
+
require('../../Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.cjs');
|
|
12
|
+
require('../../Notification/ToastNotification/context/ToastNotificationContext.cjs');
|
|
10
13
|
var ProseMirrorState = require('prosemirror-state');
|
|
11
14
|
require('prosemirror-view');
|
|
12
15
|
var useRichTextEditor = require('../utils/core/hooks/useRichTextEditor.cjs');
|
|
@@ -62,6 +65,7 @@ const RichTextEditor = /*#__PURE__*/function () {
|
|
|
62
65
|
defaultValue = _a.defaultValue,
|
|
63
66
|
labelText = _a.labelText,
|
|
64
67
|
labelledBy = _a["aria-labelledby"],
|
|
68
|
+
describedBy = _a["aria-describedby"],
|
|
65
69
|
classNameOverride = _a.classNameOverride,
|
|
66
70
|
controls = _a.controls,
|
|
67
71
|
_b = _a.rows,
|
|
@@ -72,7 +76,7 @@ const RichTextEditor = /*#__PURE__*/function () {
|
|
|
72
76
|
description = _a.description,
|
|
73
77
|
_c = _a.status,
|
|
74
78
|
status = _c === void 0 ? "default" : _c,
|
|
75
|
-
restProps = tslib.__rest(_a, ["onChange", "defaultValue", "labelText", "aria-labelledby", "classNameOverride", "controls", "rows", "dataError", "onDataError", "validationMessage", "description", "status"]);
|
|
79
|
+
restProps = tslib.__rest(_a, ["onChange", "defaultValue", "labelText", "aria-labelledby", "aria-describedby", "classNameOverride", "controls", "rows", "dataError", "onDataError", "validationMessage", "description", "status"]);
|
|
76
80
|
var reactId = React.useId();
|
|
77
81
|
var schema$1 = React.useState(schema.createSchemaFromControls(controls))[0];
|
|
78
82
|
var labelId = React.useState(labelledBy || reactId)[0];
|
|
@@ -119,7 +123,7 @@ const RichTextEditor = /*#__PURE__*/function () {
|
|
|
119
123
|
}, [editorState]);
|
|
120
124
|
var validationMessageAria = validationMessage ? "".concat(editorId, "-rte-validation-message") : "";
|
|
121
125
|
var descriptionAria = description ? "".concat(editorId, "-rte-description") : "";
|
|
122
|
-
var ariaDescribedBy =
|
|
126
|
+
var ariaDescribedBy = classnames(validationMessageAria, descriptionAria, describedBy);
|
|
123
127
|
return React.createElement(React.Fragment, null, !labelledBy && labelText && React.createElement(Label.Label, {
|
|
124
128
|
id: labelId,
|
|
125
129
|
labelText: labelText
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditor.cjs","sources":["../../../../src/RichTextEditor/RichTextEditor/RichTextEditor.tsx"],"sourcesContent":["import React, {\n useState,\n useEffect,\n HTMLAttributes,\n ReactNode,\n useId,\n} from \"react\"\nimport classnames from \"classnames\"\nimport { FieldMessage } from \"~components/FieldMessage\"\nimport { Label } from \"~components/Label\"\nimport { InlineNotification } from \"~components/Notification\"\nimport { OverrideClassName } from \"~types/OverrideClassName\"\nimport { ToolbarItems, EditorContentArray, EditorRows } from \"../types\"\nimport { useRichTextEditor } from \"../utils/core\"\nimport { createLinkManager } from \"../utils/plugins\"\nimport {\n ProseMirrorCommands,\n ProseMirrorHistory,\n ProseMirrorKeymap,\n ProseMirrorModel,\n ProseMirrorState,\n} from \"../utils/prosemirror\"\nimport { createSchemaFromControls } from \"./schema\"\nimport { ToggleIconButton } from \"./subcomponents/ToggleIconButton\"\nimport { Toolbar } from \"./subcomponents/Toolbar\"\nimport { ToolbarSection } from \"./subcomponents/ToolbarSection\"\nimport { buildControlMap } from \"./utils/controlmap\"\nimport { buildInputRules } from \"./utils/inputrules\"\nimport { buildKeymap } from \"./utils/keymap\"\nimport styles from \"./RichTextEditor.module.scss\"\n\ntype BaseRichTextEditorProps = {\n onChange: (content: ProseMirrorState.EditorState) => void\n defaultValue: EditorContentArray\n controls?: ToolbarItems[]\n /**\n * Sets a default min-height for the editable area in units of body paragraph line height, similar to the 'rows' attribute on <textarea>.\n * The editable area will autogrow, so this only affects the component when the content doesn't exceed this height.\n */\n rows?: EditorRows\n dataError?: React.ReactElement\n onDataError?: () => void\n status?: \"default\" | \"error\" | \"caution\"\n /**\n * A descriptive message for `error` or `caution` states\n */\n validationMessage?: React.ReactNode\n /**\n * A description that provides context\n */\n description?: React.ReactNode\n} & OverrideClassName<\n Omit<HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\">\n>\n\ntype WithLabelText = {\n labelText: ReactNode\n \"aria-labelledby\"?: never\n}\n\ntype WithLabelledBy = {\n labelText?: never\n \"aria-labelledby\": string\n}\n\nexport type RichTextEditorProps = BaseRichTextEditorProps &\n (WithLabelText | WithLabelledBy)\n/**\n * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081896752/Rich+Text+Editor Guidance} |\n * {@link https://cultureamp.design/?path=/docs/components-richtexteditor--docs Storybook}\n */\nexport const RichTextEditor = ({\n onChange,\n defaultValue,\n labelText,\n \"aria-labelledby\": labelledBy,\n classNameOverride,\n controls,\n rows = 3,\n dataError,\n onDataError,\n validationMessage,\n description,\n status = \"default\",\n ...restProps\n}: RichTextEditorProps): JSX.Element => {\n const reactId = useId()\n const [schema] = useState<ProseMirrorModel.Schema>(\n createSchemaFromControls(controls)\n )\n const [labelId] = useState<string>(labelledBy || reactId)\n const [editorId] = useState<string>(reactId)\n\n const useRichTextEditorResult = (():\n | ReturnType<typeof useRichTextEditor>\n | Error => {\n try {\n return useRichTextEditor(\n ProseMirrorState.EditorState.create({\n doc: ProseMirrorModel.Node.fromJSON(schema, {\n type: \"doc\",\n // we're converting empty arrays to the ProseMirror default \"empty\" state because when\n // given an empty array ProseMirror returns undefined, breaking the type\n content:\n defaultValue?.length > 0 ? defaultValue : [{ type: \"paragraph\" }],\n }),\n schema,\n plugins: getPlugins(controls, schema),\n }),\n { \"aria-labelledby\": labelId, role: \"textbox\" }\n )\n } catch {\n return new Error(\"Bad data error\")\n }\n })()\n\n if (useRichTextEditorResult instanceof Error) {\n onDataError && onDataError()\n return (\n <InlineNotification\n headingProps={{\n children: \"Error\",\n variant: \"heading-6\",\n }}\n type=\"negative\"\n persistent\n >\n {dataError || \"Something went wrong\"}\n </InlineNotification>\n )\n }\n\n const [editorRef, editorState, dispatchTransaction] = useRichTextEditorResult\n\n const controlMap = buildControlMap(schema, editorState, controls)\n\n useEffect(() => {\n onChange(editorState)\n // Including `onContentChange` in the dependencies here will cause a 'Maximum update depth exceeded' issue\n }, [editorState])\n\n const validationMessageAria = validationMessage\n ? `${editorId}-rte-validation-message`\n : \"\"\n const descriptionAria = description ? `${editorId}-rte-description` : \"\"\n\n const ariaDescribedBy = `${validationMessageAria} ${descriptionAria}`\n\n return (\n <>\n {!labelledBy && labelText && <Label id={labelId} labelText={labelText} />}\n {/* TODO: add a bit of margin here once we have a classNameOverride on Label */}\n <div className={classnames(styles.editorWrapper, styles[status])}>\n {controls && (\n <Toolbar\n aria-controls={editorId}\n aria-label=\"Text formatting\"\n classNameOverride={styles.toolbar}\n >\n {controlMap.map((section, index) => (\n <ToolbarSection key={index}>\n {section.map((controlConfig, controlKeyIndex) => (\n <ToggleIconButton\n key={controlKeyIndex}\n icon={controlConfig.icon}\n disabled={controlConfig.disabled}\n label={controlConfig.label}\n isActive={controlConfig.isActive}\n onClick={(): void =>\n dispatchTransaction(controlConfig.action)\n }\n />\n ))}\n </ToolbarSection>\n ))}\n </Toolbar>\n )}\n <div\n id={editorId}\n ref={editorRef}\n className={classnames(\n styles.editor,\n styles[`rows${rows}`],\n classNameOverride,\n controls != null && controls.length > 0 && styles.hasToolbar\n )}\n aria-describedby={ariaDescribedBy}\n {...restProps}\n />\n </div>\n\n {validationMessage && (\n <FieldMessage\n id={validationMessageAria}\n message={validationMessage}\n status={status}\n />\n )}\n\n {description && (\n <FieldMessage id={descriptionAria} message={description} />\n )}\n </>\n )\n}\n\nRichTextEditor.displayName = \"RichTextEditor\"\n\nfunction getPlugins(\n controls: ToolbarItems[] | undefined,\n schema: ProseMirrorModel.Schema\n): Array<\n | ProseMirrorState.Plugin<unknown>\n | ProseMirrorState.Plugin<{\n transform: ProseMirrorState.Transaction\n from: number\n to: number\n text: string\n } | null>\n> {\n const allControlNames: string[] = controls\n ? controls.reduce((acc: string[], c: ToolbarItems) => [...acc, c.name], [])\n : []\n const plugins = [\n ProseMirrorHistory.history(),\n ProseMirrorKeymap.keymap(buildKeymap(schema)),\n ProseMirrorKeymap.keymap(ProseMirrorCommands.baseKeymap),\n buildInputRules(schema),\n ]\n\n if (allControlNames.includes(\"link\")) {\n plugins.push(\n createLinkManager({\n markType: schema.marks.link,\n })\n )\n }\n\n return plugins\n}\n"],"names":["RichTextEditor","_a","onChange","defaultValue","labelText","labelledBy","classNameOverride","controls","_b","rows","dataError","onDataError","validationMessage","description","_c","status","restProps","__rest","reactId","useId","schema","useState","createSchemaFromControls","labelId","editorId","useRichTextEditorResult","useRichTextEditor","ProseMirrorState","EditorState","create","doc","ProseMirrorModel","Node","fromJSON","type","content","length","plugins","getPlugins","role","Error","React","createElement","InlineNotification","headingProps","children","variant","persistent","editorRef","editorState","dispatchTransaction","controlMap","buildControlMap","useEffect","validationMessageAria","concat","descriptionAria","ariaDescribedBy","Fragment","Label","id","className","classnames","styles","editorWrapper","Toolbar","toolbar","map","section","index","ToolbarSection","key","controlConfig","controlKeyIndex","ToggleIconButton","icon","disabled","label","isActive","onClick","action","__assign","ref","editor","hasToolbar","FieldMessage","message","displayName","allControlNames","reduce","acc","c","name","ProseMirrorHistory","history","ProseMirrorKeymap","keymap","buildKeymap","ProseMirrorCommands","baseKeymap","buildInputRules","includes","push","createLinkManager","markType","marks","link"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA;;;AAGG;AAHH,MAIaA,cAAc;EAAA,MAAdA,cAAc,GAAG,SAAAA,CAACC,EAcT,EAAA;IAbpB,IAAAC,QAAQ,cAAA;MACRC,YAAY,kBAAA;MACZC,SAAS,eAAA;MACUC,UAAU,wBAAA;MAC7BC,iBAAiB,uBAAA;MACjBC,QAAQ,cAAA;MACRC,EAAA,GAAAP,EAAA,CAAAQ,IAAQ;MAARA,IA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B,CAACC,UAAU,CAAC,EACxDC,UAAAA,CAAAA,eAAe,CAAChF,MAAM,CAAC,CACxB;EAED,IAAIoE,eAAe,CAACa,QAAQ,CAAC,MAAM,CAAC,EAAE;IACpChE,OAAO,CAACiE,IAAI,CACVC,6BAAiB,CAAC;MAChBC,QAAQ,EAAEpF,MAAM,CAACqF,KAAK,CAACC;IACxB,CAAA,CAAC,CACH;EACF;EAED,OAAOrE,OAAO;AAChB;"}
|
|
1
|
+
{"version":3,"file":"RichTextEditor.cjs","sources":["../../../../src/RichTextEditor/RichTextEditor/RichTextEditor.tsx"],"sourcesContent":["import React, {\n useState,\n useEffect,\n HTMLAttributes,\n ReactNode,\n useId,\n} from \"react\"\nimport classnames from \"classnames\"\nimport { FieldMessage } from \"~components/FieldMessage\"\nimport { Label } from \"~components/Label\"\nimport { InlineNotification } from \"~components/Notification\"\nimport { OverrideClassName } from \"~types/OverrideClassName\"\nimport { ToolbarItems, EditorContentArray, EditorRows } from \"../types\"\nimport { useRichTextEditor } from \"../utils/core\"\nimport { createLinkManager } from \"../utils/plugins\"\nimport {\n ProseMirrorCommands,\n ProseMirrorHistory,\n ProseMirrorKeymap,\n ProseMirrorModel,\n ProseMirrorState,\n} from \"../utils/prosemirror\"\nimport { createSchemaFromControls } from \"./schema\"\nimport { ToggleIconButton } from \"./subcomponents/ToggleIconButton\"\nimport { Toolbar } from \"./subcomponents/Toolbar\"\nimport { ToolbarSection } from \"./subcomponents/ToolbarSection\"\nimport { buildControlMap } from \"./utils/controlmap\"\nimport { buildInputRules } from \"./utils/inputrules\"\nimport { buildKeymap } from \"./utils/keymap\"\nimport styles from \"./RichTextEditor.module.scss\"\n\ntype BaseRichTextEditorProps = {\n onChange: (content: ProseMirrorState.EditorState) => void\n defaultValue: EditorContentArray\n controls?: ToolbarItems[]\n /**\n * Sets a default min-height for the editable area in units of body paragraph line height, similar to the 'rows' attribute on <textarea>.\n * The editable area will autogrow, so this only affects the component when the content doesn't exceed this height.\n */\n rows?: EditorRows\n dataError?: React.ReactElement\n onDataError?: () => void\n status?: \"default\" | \"error\" | \"caution\"\n /**\n * A descriptive message for `error` or `caution` states\n */\n validationMessage?: React.ReactNode\n /**\n * A description that provides context\n */\n description?: React.ReactNode\n} & OverrideClassName<\n Omit<HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\">\n>\n\ntype WithLabelText = {\n labelText: ReactNode\n \"aria-labelledby\"?: never\n}\n\ntype WithLabelledBy = {\n labelText?: never\n \"aria-labelledby\": string\n}\n\nexport type RichTextEditorProps = BaseRichTextEditorProps &\n (WithLabelText | WithLabelledBy)\n/**\n * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081896752/Rich+Text+Editor Guidance} |\n * {@link https://cultureamp.design/?path=/docs/components-richtexteditor--docs Storybook}\n */\nexport const RichTextEditor = ({\n onChange,\n defaultValue,\n labelText,\n \"aria-labelledby\": labelledBy,\n \"aria-describedby\": describedBy,\n classNameOverride,\n controls,\n rows = 3,\n dataError,\n onDataError,\n validationMessage,\n description,\n status = \"default\",\n ...restProps\n}: RichTextEditorProps): JSX.Element => {\n const reactId = useId()\n const [schema] = useState<ProseMirrorModel.Schema>(\n createSchemaFromControls(controls)\n )\n const [labelId] = useState<string>(labelledBy || reactId)\n const [editorId] = useState<string>(reactId)\n\n const useRichTextEditorResult = (():\n | ReturnType<typeof useRichTextEditor>\n | Error => {\n try {\n return useRichTextEditor(\n ProseMirrorState.EditorState.create({\n doc: ProseMirrorModel.Node.fromJSON(schema, {\n type: \"doc\",\n // we're converting empty arrays to the ProseMirror default \"empty\" state because when\n // given an empty array ProseMirror returns undefined, breaking the type\n content:\n defaultValue?.length > 0 ? defaultValue : [{ type: \"paragraph\" }],\n }),\n schema,\n plugins: getPlugins(controls, schema),\n }),\n { \"aria-labelledby\": labelId, role: \"textbox\" }\n )\n } catch {\n return new Error(\"Bad data error\")\n }\n })()\n\n if (useRichTextEditorResult instanceof Error) {\n onDataError && onDataError()\n return (\n <InlineNotification\n headingProps={{\n children: \"Error\",\n variant: \"heading-6\",\n }}\n type=\"negative\"\n persistent\n >\n {dataError || \"Something went wrong\"}\n </InlineNotification>\n )\n }\n\n const [editorRef, editorState, dispatchTransaction] = useRichTextEditorResult\n\n const controlMap = buildControlMap(schema, editorState, controls)\n\n useEffect(() => {\n onChange(editorState)\n // Including `onContentChange` in the dependencies here will cause a 'Maximum update depth exceeded' issue\n }, [editorState])\n\n const validationMessageAria = validationMessage\n ? `${editorId}-rte-validation-message`\n : \"\"\n const descriptionAria = description ? `${editorId}-rte-description` : \"\"\n\n const ariaDescribedBy = classnames(\n validationMessageAria,\n descriptionAria,\n describedBy\n )\n\n return (\n <>\n {!labelledBy && labelText && <Label id={labelId} labelText={labelText} />}\n {/* TODO: add a bit of margin here once we have a classNameOverride on Label */}\n <div className={classnames(styles.editorWrapper, styles[status])}>\n {controls && (\n <Toolbar\n aria-controls={editorId}\n aria-label=\"Text formatting\"\n classNameOverride={styles.toolbar}\n >\n {controlMap.map((section, index) => (\n <ToolbarSection key={index}>\n {section.map((controlConfig, controlKeyIndex) => (\n <ToggleIconButton\n key={controlKeyIndex}\n icon={controlConfig.icon}\n disabled={controlConfig.disabled}\n label={controlConfig.label}\n isActive={controlConfig.isActive}\n onClick={(): void =>\n dispatchTransaction(controlConfig.action)\n }\n />\n ))}\n </ToolbarSection>\n ))}\n </Toolbar>\n )}\n <div\n id={editorId}\n ref={editorRef}\n className={classnames(\n styles.editor,\n styles[`rows${rows}`],\n classNameOverride,\n controls != null && controls.length > 0 && styles.hasToolbar\n )}\n aria-describedby={ariaDescribedBy}\n {...restProps}\n />\n </div>\n\n {validationMessage && (\n <FieldMessage\n id={validationMessageAria}\n message={validationMessage}\n status={status}\n />\n )}\n\n {description && (\n <FieldMessage id={descriptionAria} message={description} />\n )}\n </>\n )\n}\n\nRichTextEditor.displayName = \"RichTextEditor\"\n\nfunction getPlugins(\n controls: ToolbarItems[] | undefined,\n schema: ProseMirrorModel.Schema\n): Array<\n | ProseMirrorState.Plugin<unknown>\n | ProseMirrorState.Plugin<{\n transform: ProseMirrorState.Transaction\n from: number\n to: number\n text: string\n } | null>\n> {\n const allControlNames: string[] = controls\n ? controls.reduce((acc: string[], c: ToolbarItems) => [...acc, c.name], [])\n : []\n const plugins = [\n ProseMirrorHistory.history(),\n ProseMirrorKeymap.keymap(buildKeymap(schema)),\n ProseMirrorKeymap.keymap(ProseMirrorCommands.baseKeymap),\n buildInputRules(schema),\n ]\n\n if (allControlNames.includes(\"link\")) {\n plugins.push(\n createLinkManager({\n markType: schema.marks.link,\n })\n )\n }\n\n return plugins\n}\n"],"names":["RichTextEditor","_a","onChange","defaultValue","labelText","labelledBy","describedBy","classNameOverride","controls","_b","rows","dataError","onDataError","validationMessage","description","_c","status","restProps","__rest","reactId","useId","schema","useState","createSchemaFromControls","labelId","editorId","useRichTextEditorResult","useRichTextEditor","ProseMirrorState","EditorState","create","doc","ProseMirrorModel","Node","fromJSON","type","content","length","plugins","getPlugins","role","Error","React","createElement","InlineNotification","headingProps","children","variant","persistent","editorRef","editorState","dispatchTransaction","controlMap","buildControlMap","useEffect","validationMessageAria","concat","descriptionAria","ariaDescribedBy","classnames","Fragment","Label","id","className","styles","editorWrapper","Toolbar","toolbar","map","section","index","ToolbarSection","key","controlConfig","controlKeyIndex","ToggleIconButton","icon","disabled","label","isActive","onClick","action","__assign","ref","editor","hasToolbar","FieldMessage","message","displayName","allControlNames","reduce","acc","c","name","ProseMirrorHistory","history","ProseMirrorKeymap","keymap","buildKeymap","ProseMirrorCommands","baseKeymap","buildInputRules","includes","push","createLinkManager","markType","marks","link"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA;;;AAGG;AAHH,MAIaA,cAAc;EAAA,MAAdA,cAAc,GAAG,SAAAA,CAACC,EAeT,EAAA;IAdpB,IAAAC,QAAQ,cAAA;MACRC,YAAY,kBAAA;MACZC,SAAS,GAAAH,EAAA,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EAAA,CAAEC,CAAC,CAACC,IAAI;EAAC,CAAA,EAAE,EAAE,CAAC,GACzE,EAAE;EACN,IAAMvD,OAAO,GAAG,CACdwD,6BAAkB,CAACC,OAAO,CAAE,CAAA,EAC5BC,4BAAiB,CAACC,MAAM,CAACC,kBAAW,CAAC7E,MAAM,CAAC,CAAC,EAC7C2E,4BAAiB,CAACC,MAAM,CAACE,8BAAmB,CAACC,UAAU,CAAC,EACxDC,UAAAA,CAAAA,eAAe,CAAChF,MAAM,CAAC,CACxB;EAED,IAAIoE,eAAe,CAACa,QAAQ,CAAC,MAAM,CAAC,EAAE;IACpChE,OAAO,CAACiE,IAAI,CACVC,6BAAiB,CAAC;MAChBC,QAAQ,EAAEpF,MAAM,CAACqF,KAAK,CAACC;IACxB,CAAA,CAAC,CACH;EACF;EAED,OAAOrE,OAAO;AAChB;"}
|
|
@@ -45,11 +45,13 @@ const Select = /*#__PURE__*/function () {
|
|
|
45
45
|
description = _a.description,
|
|
46
46
|
placeholder = _a.placeholder,
|
|
47
47
|
isDisabled = _a.isDisabled,
|
|
48
|
-
|
|
48
|
+
portalContainerId = _a.portalContainerId,
|
|
49
|
+
restProps = tslib.__rest(_a, ["label", "items", "id", "trigger", "children", "status", "validationMessage", "isReversed", "isFullWidth", "disabledValues", "classNameOverride", "selectedKey", "description", "placeholder", "isDisabled", "portalContainerId"]);
|
|
49
50
|
var refs = reactDom.useFloating().refs;
|
|
50
51
|
var triggerRef = refs.reference;
|
|
51
52
|
var id = propsId !== null && propsId !== void 0 ? propsId : React.useId();
|
|
52
53
|
var descriptionId = "".concat(id, "--description");
|
|
54
|
+
var popoverId = "".concat(id, "--popover");
|
|
53
55
|
var disabledKeys = getDisabledKeysFromItems.getDisabledKeysFromItems(items);
|
|
54
56
|
var ariaSelectProps = tslib.__assign({
|
|
55
57
|
label: label,
|
|
@@ -91,6 +93,15 @@ const Select = /*#__PURE__*/function () {
|
|
|
91
93
|
isReversed: isReversed,
|
|
92
94
|
ref: refs.setReference
|
|
93
95
|
});
|
|
96
|
+
var _d = React.useState(),
|
|
97
|
+
portalContainer = _d[0],
|
|
98
|
+
setPortalContainer = _d[1];
|
|
99
|
+
React.useEffect(function () {
|
|
100
|
+
if (portalContainerId) {
|
|
101
|
+
var portalElement = document.getElementById(portalContainerId);
|
|
102
|
+
portalElement && setPortalContainer(portalElement);
|
|
103
|
+
}
|
|
104
|
+
}, []);
|
|
94
105
|
return React.createElement("div", {
|
|
95
106
|
className: classnames(!isFullWidth && Select_module.notFullWidth, classNameOverride)
|
|
96
107
|
}, React.createElement(select$1.HiddenSelect, {
|
|
@@ -101,6 +112,8 @@ const Select = /*#__PURE__*/function () {
|
|
|
101
112
|
}), React.createElement("div", {
|
|
102
113
|
className: Select_module.container
|
|
103
114
|
}, trigger === undefined ? React.createElement(SelectToggle.SelectToggle, tslib.__assign({}, selectToggleProps)) : trigger(selectToggleProps, selectToggleProps.ref), state.isOpen && React.createElement(Popover.Popover, {
|
|
115
|
+
id: popoverId,
|
|
116
|
+
portalContainer: portalContainer,
|
|
104
117
|
refs: refs,
|
|
105
118
|
focusOnProps: {
|
|
106
119
|
onEscapeKey: state.close,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.cjs","sources":["../../../../src/__future__/Select/Select.tsx"],"sourcesContent":["import React, { useId } from \"react\"\nimport { UseFloatingReturn } from \"@floating-ui/react-dom\"\nimport { useButton } from \"@react-aria/button\"\nimport { HiddenSelect, useSelect } from \"@react-aria/select\"\nimport {\n useSelectState,\n SelectProps as AriaSelectProps,\n} from \"@react-stately/select\"\nimport { Key } from \"@react-types/shared\"\nimport classnames from \"classnames\"\nimport { FieldMessage } from \"~components/FieldMessage\"\nimport {\n Popover,\n useFloating,\n} from \"~components/MultiSelect/subcomponents/Popover\"\nimport { OverrideClassName } from \"~types/OverrideClassName\"\nimport { SelectProvider } from \"./context\"\nimport {\n ListBox,\n ListBoxSection,\n ListItem,\n Option,\n SectionDivider,\n SelectPopoverContents,\n SelectPopoverContentsProps,\n SelectToggle,\n SelectToggleProps,\n} from \"./subcomponents\"\nimport { SelectItem, SelectOption } from \"./types\"\nimport { getDisabledKeysFromItems } from \"./utils/getDisabledKeysFromItems\"\nimport { transformSelectItemToCollectionElement } from \"./utils/transformSelectItemToCollectionElement\"\nimport styles from \"./Select.module.scss\"\n\ntype OmittedAriaSelectProps = \"children\" | \"items\"\n\nexport type SelectProps<Option extends SelectOption = SelectOption> = {\n /**\n * Item objects in the collection.\n */\n items: Array<SelectItem<Option>>\n id?: string\n trigger?: (\n selectToggleProps: SelectToggleProps & {\n ref: UseFloatingReturn<HTMLButtonElement>[\"refs\"][\"setReference\"]\n },\n // @deprecated: This arg is unnecessary now, but provided for legacy usages\n ref: UseFloatingReturn<HTMLButtonElement>[\"refs\"][\"setReference\"]\n ) => JSX.Element\n children?: SelectPopoverContentsProps<Option>[\"children\"]\n /**\n * Updates the styling of the validation FieldMessage.\n */\n status?: \"error\" | \"caution\"\n /**\n * A descriptive message for the 'status' states.\n */\n validationMessage?: React.ReactNode | undefined\n /**\n * Use the `reversed` styles.\n */\n isReversed?: boolean\n /**\n * Use the `fullWidth` styles.\n */\n isFullWidth?: boolean\n /**\n * @deprecated: Either define `disabled` in your `Option` (in `items`), or use `disabledKeys`\n */\n disabledValues?: Key[]\n} & OverrideClassName<Omit<AriaSelectProps<Option>, OmittedAriaSelectProps>>\n\n/**\n * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081896474/Select Guidance} |\n * {@link https://cultureamp.design/?path=/docs/components-select--docs Storybook}\n */\nexport const Select = <Option extends SelectOption = SelectOption>({\n label,\n items,\n id: propsId,\n trigger,\n children,\n status,\n validationMessage,\n isReversed,\n isFullWidth,\n disabledValues,\n classNameOverride,\n selectedKey,\n description,\n placeholder,\n isDisabled,\n ...restProps\n}: SelectProps<Option>): JSX.Element => {\n const { refs } = useFloating<HTMLButtonElement>()\n const triggerRef = refs.reference\n\n const id = propsId ?? useId()\n const descriptionId = `${id}--description`\n\n const disabledKeys = getDisabledKeysFromItems(items)\n\n const ariaSelectProps: AriaSelectProps<SelectItem<Option>> = {\n label,\n items,\n children: transformSelectItemToCollectionElement,\n disabledKeys: disabledValues ?? disabledKeys,\n selectedKey:\n typeof selectedKey === \"number\" ? selectedKey.toString() : selectedKey,\n description,\n placeholder,\n isDisabled,\n ...restProps,\n }\n\n const state = useSelectState(ariaSelectProps)\n\n const {\n labelProps,\n triggerProps: reactAriaTriggerProps,\n valueProps,\n menuProps,\n errorMessageProps,\n descriptionProps,\n } = useSelect(ariaSelectProps, state, triggerRef)\n\n // Hack incoming:\n // react-aria/useSelect wants to prefix the combobox's accessible name with the value of the select.\n // We use role=combobox, meaning screen readers will read the value.\n // So we're modifying the `aria-labelledby` property to remove the value element id.\n // Issue: https://github.com/adobe/react-spectrum/issues/4091\n const reactAriaLabelledBy = reactAriaTriggerProps[\"aria-labelledby\"]\n const triggerProps = {\n ...reactAriaTriggerProps,\n \"aria-labelledby\": reactAriaLabelledBy?.substring(\n reactAriaLabelledBy.indexOf(\" \") + 1\n ),\n }\n\n const { buttonProps } = useButton(triggerProps, triggerRef)\n const selectToggleProps = {\n ...buttonProps,\n label,\n labelProps,\n value: state?.selectedItem?.rendered,\n valueProps,\n isOpen: state.isOpen,\n placeholder,\n status,\n isDisabled: triggerProps.isDisabled,\n isReversed,\n ref: refs.setReference,\n }\n\n return (\n <div\n className={classnames(\n !isFullWidth && styles.notFullWidth,\n classNameOverride\n )}\n >\n <HiddenSelect\n label={label}\n name={id}\n state={state}\n triggerRef={triggerRef}\n />\n\n <div className={styles.container}>\n {trigger === undefined ? (\n <SelectToggle {...selectToggleProps} />\n ) : (\n trigger(selectToggleProps, selectToggleProps.ref)\n )}\n {state.isOpen && (\n <Popover\n refs={refs}\n focusOnProps={{\n onEscapeKey: state.close,\n onClickOutside: state.close,\n noIsolation: true,\n }}\n >\n <SelectProvider<Option> state={state}>\n <SelectPopoverContents menuProps={menuProps}>\n {children}\n </SelectPopoverContents>\n </SelectProvider>\n </Popover>\n )}\n </div>\n\n {validationMessage && (\n <FieldMessage\n {...errorMessageProps}\n message={validationMessage}\n status={status}\n reversed={isReversed}\n />\n )}\n\n {description && (\n <FieldMessage\n {...descriptionProps}\n id={descriptionId}\n message={description}\n reversed={isReversed}\n />\n )}\n </div>\n )\n}\n\nSelect.displayName = \"Select\"\n\nSelect.Section = ListBoxSection\nSelect.SectionDivider = SectionDivider\nSelect.Option = Option\nSelect.ItemDefaultRender = ListItem\n\n// @deprecated Legacy exported aliases\nSelect.TriggerButton = SelectToggle\nSelect.ListBox = ListBox\n"],"names":["Select","_a","label","items","propsId","id","trigger","children","status","validationMessage","isReversed","isFullWidth","disabledValues","classNameOverride","selectedKey","description","placeholder","isDisabled","restProps","__rest","refs","useFloating","triggerRef","reference","useId","descriptionId","concat","disabledKeys","getDisabledKeysFromItems","ariaSelectProps","transformSelectItemToCollectionElement","toString","state","useSelectState","_c","useSelect","labelProps","reactAriaTriggerProps","triggerProps","valueProps","menuProps","errorMessageProps","descriptionProps","reactAriaLabelledBy","__assign","substring","indexOf","buttonProps","useButton","selectToggleProps","value","selectedItem","_b","rendered","isOpen","ref","setReference","React","createElement","className","classnames","styles","notFullWidth","HiddenSelect","name","container","undefined","SelectToggle","Popover","focusOnProps","onEscapeKey","close","onClickOutside","noIsolation","SelectProvider","SelectPopoverContents","FieldMessage","message","reversed","displayName","Section","ListBoxSection","SectionDivider","Option","ItemDefaultRender","ListItem","TriggerButton","ListBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuEA;;;AAGG;AAHH,MAIaA,MAAM;EAAA,MAANA,MAAM,GAAG,SAAAA,CAA6CC,EAiB7C,EAAA;;IAhBpB,IAAAC,KAAK,WAAA;MACLC,KAAK,WAAA;MACDC,OAAO,GAAAH,EAAA,CAAAI,EAAA;MACXC,OAAO,GAAAL,EAAA,CAAAK,OAAA;MACPC,QAAQ,GAAAN,EAAA,CAAAM,QAAA;MACRC,MAAM,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,CAAAA,cAAc,EAAA;MAAS1C,KAAK,EAAEA;IAAK,CAAA,EAClCyB,KAAC,CAAAC,aAAA,CAAAiB,qBAAAA,CAAAA,qBAAqB,EAAC;MAAAnC,SAAS,EAAEA;KAC/B,EAAAjC,QAAQ,CACa,CACT,CAEpB,CACG,EAELE,iBAAiB,IAChBgD,KAAA,CAAAC,aAAA,CAACkB,YAAY,CAAAA,YAAA,EACPhC,KAAA,CAAAA,QAAA,CAAA,CAAA,CAAA,EAAAH,iBAAiB;MACrBoC,OAAO,EAAEpE,iBAAiB;MAC1BD,MAAM,EAAEA,MAAM;MACdsE,QAAQ,EAAEpE;OAEb,EAEAK,WAAW,IACV0C,KAAC,CAAAC,aAAA,CAAAkB,YAAY,CAAAA,YAAA,qBACPlC,gBAAgB,EAAA;MACpBrC,EAAE,EAAEoB,aAAa;MACjBoD,OAAO,EAAE9D,WAAW;MACpB+D,QAAQ,EAAEpE;IACV,CAAA,CAAA,CACH,CACG;EAEV,CAAC;EAEDV,MAAM,CAAC+E,WAAW,GAAG,QAAQ;EAE7B/E,MAAM,CAACgF,OAAO,GAAGC,cAAAA,CAAAA,cAAc;EAC/BjF,MAAM,CAACkF,cAAc,GAAGA,cAAAA,CAAAA,cAAc;EACtClF,MAAM,CAACmF,MAAM,GAAGA,MAAAA,CAAAA,MAAM;EACtBnF,MAAM,CAACoF,iBAAiB,GAAGC,QAAAA,CAAAA,QAAQ;EAEnC;EACArF,MAAM,CAACsF,aAAa,GAAGnB,YAAAA,CAAAA,YAAY;EACnCnE,MAAM,CAACuF,OAAO,GAAGA,OAAO,CAAAA,OAAA;EAAA,OAlJXvF,MAAM;AAAA;"}
|
|
1
|
+
{"version":3,"file":"Select.cjs","sources":["../../../../src/__future__/Select/Select.tsx"],"sourcesContent":["import React, { useEffect, useId, useState } from \"react\"\nimport { UseFloatingReturn } from \"@floating-ui/react-dom\"\nimport { useButton } from \"@react-aria/button\"\nimport { HiddenSelect, useSelect } from \"@react-aria/select\"\nimport {\n useSelectState,\n SelectProps as AriaSelectProps,\n} from \"@react-stately/select\"\nimport { Key } from \"@react-types/shared\"\nimport classnames from \"classnames\"\nimport { FieldMessage } from \"~components/FieldMessage\"\nimport {\n Popover,\n useFloating,\n} from \"~components/MultiSelect/subcomponents/Popover\"\nimport { OverrideClassName } from \"~types/OverrideClassName\"\nimport { SelectProvider } from \"./context\"\nimport {\n ListBox,\n ListBoxSection,\n ListItem,\n Option,\n SectionDivider,\n SelectPopoverContents,\n SelectPopoverContentsProps,\n SelectToggle,\n SelectToggleProps,\n} from \"./subcomponents\"\nimport { SelectItem, SelectOption } from \"./types\"\nimport { getDisabledKeysFromItems } from \"./utils/getDisabledKeysFromItems\"\nimport { transformSelectItemToCollectionElement } from \"./utils/transformSelectItemToCollectionElement\"\nimport styles from \"./Select.module.scss\"\n\ntype OmittedAriaSelectProps = \"children\" | \"items\"\n\nexport type SelectProps<Option extends SelectOption = SelectOption> = {\n /**\n * Item objects in the collection.\n */\n items: Array<SelectItem<Option>>\n id?: string\n trigger?: (\n selectToggleProps: SelectToggleProps & {\n ref: UseFloatingReturn<HTMLButtonElement>[\"refs\"][\"setReference\"]\n },\n // @deprecated: This arg is unnecessary now, but provided for legacy usages\n ref: UseFloatingReturn<HTMLButtonElement>[\"refs\"][\"setReference\"]\n ) => JSX.Element\n children?: SelectPopoverContentsProps<Option>[\"children\"]\n /**\n * Updates the styling of the validation FieldMessage.\n */\n status?: \"error\" | \"caution\"\n /**\n * A descriptive message for the 'status' states.\n */\n validationMessage?: React.ReactNode | undefined\n /**\n * Use the `reversed` styles.\n */\n isReversed?: boolean\n /**\n * Use the `fullWidth` styles.\n */\n isFullWidth?: boolean\n /**\n * @deprecated: Either define `disabled` in your `Option` (in `items`), or use `disabledKeys`\n */\n disabledValues?: Key[]\n /**\n * Creates a portal for the Popover to the matching element id\n */\n portalContainerId?: string\n} & OverrideClassName<Omit<AriaSelectProps<Option>, OmittedAriaSelectProps>>\n\n/**\n * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081896474/Select Guidance} |\n * {@link https://cultureamp.design/?path=/docs/components-select--docs Storybook}\n */\nexport const Select = <Option extends SelectOption = SelectOption>({\n label,\n items,\n id: propsId,\n trigger,\n children,\n status,\n validationMessage,\n isReversed,\n isFullWidth,\n disabledValues,\n classNameOverride,\n selectedKey,\n description,\n placeholder,\n isDisabled,\n portalContainerId,\n ...restProps\n}: SelectProps<Option>): JSX.Element => {\n const { refs } = useFloating<HTMLButtonElement>()\n const triggerRef = refs.reference\n const id = propsId ?? useId()\n const descriptionId = `${id}--description`\n const popoverId = `${id}--popover`\n\n const disabledKeys = getDisabledKeysFromItems(items)\n\n const ariaSelectProps: AriaSelectProps<SelectItem<Option>> = {\n label,\n items,\n children: transformSelectItemToCollectionElement,\n disabledKeys: disabledValues ?? disabledKeys,\n selectedKey:\n typeof selectedKey === \"number\" ? selectedKey.toString() : selectedKey,\n description,\n placeholder,\n isDisabled,\n ...restProps,\n }\n\n const state = useSelectState(ariaSelectProps)\n\n const {\n labelProps,\n triggerProps: reactAriaTriggerProps,\n valueProps,\n menuProps,\n errorMessageProps,\n descriptionProps,\n } = useSelect(ariaSelectProps, state, triggerRef)\n\n // Hack incoming:\n // react-aria/useSelect wants to prefix the combobox's accessible name with the value of the select.\n // We use role=combobox, meaning screen readers will read the value.\n // So we're modifying the `aria-labelledby` property to remove the value element id.\n // Issue: https://github.com/adobe/react-spectrum/issues/4091\n const reactAriaLabelledBy = reactAriaTriggerProps[\"aria-labelledby\"]\n const triggerProps = {\n ...reactAriaTriggerProps,\n \"aria-labelledby\": reactAriaLabelledBy?.substring(\n reactAriaLabelledBy.indexOf(\" \") + 1\n ),\n }\n\n const { buttonProps } = useButton(triggerProps, triggerRef)\n const selectToggleProps = {\n ...buttonProps,\n label,\n labelProps,\n value: state?.selectedItem?.rendered,\n valueProps,\n isOpen: state.isOpen,\n placeholder,\n status,\n isDisabled: triggerProps.isDisabled,\n isReversed,\n ref: refs.setReference,\n }\n\n const [portalContainer, setPortalContainer] = useState<HTMLElement>()\n\n useEffect(() => {\n if (portalContainerId) {\n const portalElement = document.getElementById(portalContainerId)\n portalElement && setPortalContainer(portalElement)\n }\n }, [])\n\n return (\n <div\n className={classnames(\n !isFullWidth && styles.notFullWidth,\n classNameOverride\n )}\n >\n <HiddenSelect\n label={label}\n name={id}\n state={state}\n triggerRef={triggerRef}\n />\n\n <div className={styles.container}>\n {trigger === undefined ? (\n <SelectToggle {...selectToggleProps} />\n ) : (\n trigger(selectToggleProps, selectToggleProps.ref)\n )}\n {state.isOpen && (\n <Popover\n id={popoverId}\n portalContainer={portalContainer}\n refs={refs}\n focusOnProps={{\n onEscapeKey: state.close,\n onClickOutside: state.close,\n noIsolation: true,\n }}\n >\n <SelectProvider<Option> state={state}>\n <SelectPopoverContents menuProps={menuProps}>\n {children}\n </SelectPopoverContents>\n </SelectProvider>\n </Popover>\n )}\n </div>\n\n {validationMessage && (\n <FieldMessage\n {...errorMessageProps}\n message={validationMessage}\n status={status}\n reversed={isReversed}\n />\n )}\n\n {description && (\n <FieldMessage\n {...descriptionProps}\n id={descriptionId}\n message={description}\n reversed={isReversed}\n />\n )}\n </div>\n )\n}\n\nSelect.displayName = \"Select\"\n\nSelect.Section = ListBoxSection\nSelect.SectionDivider = SectionDivider\nSelect.Option = Option\nSelect.ItemDefaultRender = ListItem\n\n// @deprecated Legacy exported aliases\nSelect.TriggerButton = SelectToggle\nSelect.ListBox = ListBox\n"],"names":["Select","_a","label","items","propsId","id","trigger","children","status","validationMessage","isReversed","isFullWidth","disabledValues","classNameOverride","selectedKey","description","placeholder","isDisabled","portalContainerId","restProps","__rest","refs","useFloating","triggerRef","reference","useId","descriptionId","concat","popoverId","disabledKeys","getDisabledKeysFromItems","ariaSelectProps","transformSelectItemToCollectionElement","toString","state","useSelectState","_c","useSelect","labelProps","reactAriaTriggerProps","triggerProps","valueProps","menuProps","errorMessageProps","descriptionProps","reactAriaLabelledBy","__assign","substring","indexOf","buttonProps","useButton","selectToggleProps","value","selectedItem","_b","rendered","isOpen","ref","setReference","_d","useState","portalContainer","setPortalContainer","useEffect","portalElement","document","getElementById","React","createElement","className","classnames","styles","notFullWidth","HiddenSelect","name","container","undefined","SelectToggle","Popover","focusOnProps","onEscapeKey","close","onClickOutside","noIsolation","SelectProvider","SelectPopoverContents","FieldMessage","message","reversed","displayName","Section","ListBoxSection","SectionDivider","Option","ItemDefaultRender","ListItem","TriggerButton","ListBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2EA;;;AAGG;AAHH,MAIaA,MAAM;EAAA,MAANA,MAAM,GAAG,SAAAA,CAA6CC,EAkB7C,EAAA;;IAjBpB,IAAAC,KAAK,WAAA;MACLC,KAAK,WAAA;MACDC,OAAO,GAAAH,EAAA,CAAAI,EAAA;MACXC,OAAO,GAAAL,EAAA,CAAAK,OAAA;MACPC,QAAQ,GAAAN,EAAA,CAAAM,QAAA;MACRC,MAAM,GAAAP,EAAA,CAAAO,MAAA;MACNC,iBAAiB,GAAAR,EAAA,CAAAQ,iBAAA;MACjBC,UAAU,GAAAT,EAAA,CAAAS,UAAA;MACVC,WAAW,iBAAA;MACXC,cAAc,GAAAX,EAAA,CAAAW,cAAA;MACdC,iBAAiB,GAAAZ,EAAA,CAAAY,iBAAA;MACjBC,WAAW,GAAAb,EAAA,CAAAa,WAAA;MACXC,WAAW,GAAAd,EAAA,CAAAc,WAAA;MACXC,WAAW,GAAAf,EAAA,CAAAe,WAAA;MACXC,UAAU,GAAAhB,EAAA,CAAAgB,UAAA;MACVC,iBAAiB,uBAAA;MACdC,SAAS,GAjBqDC,KAAAA,CAAAA,MAAA,CAAAnB,EAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,IAAA,EAAA,SAAA,EAAA,UAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,YAAA,EAAA,aAAA,EAAA,gBAAA,EAAA,mBAAA,EAAA,aAAA,EAAA,aAAA,EAAA,aAAA,EAAA,YAAA,EAAA,m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