@kaizen/components 0.0.0-canary-kaio-moduleres-bundler-20240308005620 → 0.0.0-canary-less-gung-ho-20240308011930
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 +17 -26
- package/dist/cjs/KaizenProvider/KaizenProvider.cjs.map +1 -1
- package/dist/cjs/Notification/ToastNotification/context/ToastNotificationContext.cjs +2 -59
- package/dist/cjs/Notification/ToastNotification/context/ToastNotificationContext.cjs.map +1 -1
- package/dist/cjs/Tag/Tag.cjs +3 -123
- package/dist/cjs/Tag/Tag.cjs.map +1 -1
- package/dist/cjs/dts/Tag/Tag.d.ts +0 -4
- package/dist/cjs/index.css +3 -4
- package/dist/esm/KaizenProvider/KaizenProvider.mjs +19 -27
- package/dist/esm/KaizenProvider/KaizenProvider.mjs.map +1 -1
- package/dist/esm/Notification/ToastNotification/context/ToastNotificationContext.mjs +4 -60
- package/dist/esm/Notification/ToastNotification/context/ToastNotificationContext.mjs.map +1 -1
- package/dist/esm/Tag/Tag.mjs +3 -123
- package/dist/esm/Tag/Tag.mjs.map +1 -1
- package/dist/esm/dts/Tag/Tag.d.ts +0 -4
- package/dist/esm/index.css +5 -6
- package/dist/index.d.ts +0 -4
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/BrandMoment/_docs/BrandMoment.stories.tsx +1 -1
- package/src/EmptyState/_docs/EmptyState.stickersheet.stories.tsx +1 -1
- package/src/Filter/Filter/_docs/Filter.stickersheet.stories.tsx +1 -1
- package/src/Filter/FilterDatePicker/_docs/FilterDatePicker.stickersheet.stories.tsx +1 -1
- package/src/Filter/FilterDateRangePicker/_docs/FilterDateRangePicker.stickersheet.stories.tsx +1 -1
- package/src/Filter/FilterMultiSelect/_docs/FilterMultiSelect.stories.tsx +1 -1
- package/src/Filter/FilterSelect/_docs/FilterSelect.stickersheet.stories.tsx +1 -1
- package/src/KaizenProvider/KaizenProvider.tsx +22 -22
- package/src/Modal/ConfirmationModal/_docs/ConfirmationModal.stories.tsx +1 -1
- package/src/Modal/ContextModal/_docs/ContextModal.stories.tsx +1 -1
- package/src/Modal/InputEditModal/_docs/InputEditModal.stories.tsx +1 -1
- package/src/Modal/_docs/controls.tsx +1 -1
- package/src/MultiSelect/_docs/MultiSelect.stickersheet.stories.tsx +1 -1
- package/src/Tag/Tag.tsx +3 -159
- package/src/__future__/Select/_docs/Select.stickersheet.stories.tsx +1 -1
- package/dist/cjs/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.cjs +0 -20
- package/dist/cjs/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.cjs.map +0 -1
- package/dist/cjs/Tag/Tag.module.scss.cjs +0 -38
- package/dist/cjs/Tag/Tag.module.scss.cjs.map +0 -1
- package/dist/esm/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.mjs +0 -18
- package/dist/esm/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.mjs.map +0 -1
- package/dist/esm/Tag/Tag.module.scss.mjs +0 -36
- package/dist/esm/Tag/Tag.module.scss.mjs.map +0 -1
|
@@ -1,33 +1,25 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import '../Notification/InlineNotification/InlineNotification.mjs';
|
|
3
|
-
import '../Notification/GlobalNotification/GlobalNotification.mjs';
|
|
4
|
-
import '../Notification/ToastNotification/ToastNotification/ToastNotification.mjs';
|
|
5
|
-
import { ToastNotificationsList } from '../Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.mjs';
|
|
6
|
-
import { ToastNotificationProvider } from '../Notification/ToastNotification/context/ToastNotificationContext.mjs';
|
|
1
|
+
import React from 'react';
|
|
7
2
|
import { FontDefinitions } from './subcomponents/FontDefinitions/FontDefinitions.mjs';
|
|
8
|
-
import { OptionalIntlProvider } from './subcomponents/OptionalIntlProvider/OptionalIntlProvider.mjs';
|
|
9
3
|
const KaizenProvider = /*#__PURE__*/function () {
|
|
10
4
|
const KaizenProvider = function (_a) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
locale: locale
|
|
30
|
-
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ToastNotificationProvider, null, notificationsList, children), /*#__PURE__*/React.createElement(FontDefinitions, null)));
|
|
5
|
+
// const [documentIsAvailable, setDocumentIsAvailable] = useState<boolean>(false)
|
|
6
|
+
// const [notificationsList, setNotificationsList] = useState<JSX.Element>()
|
|
7
|
+
var children = _a.children;
|
|
8
|
+
_a.locale;
|
|
9
|
+
// useEffect(() => {
|
|
10
|
+
// // SSR does not have a document, which is required for ToastNotificationsList.
|
|
11
|
+
// // Await document render before rendering the component.
|
|
12
|
+
// if (document !== undefined) {
|
|
13
|
+
// setNotificationsList(<ToastNotificationsList />)
|
|
14
|
+
// setDocumentIsAvailable(true)
|
|
15
|
+
// }
|
|
16
|
+
// }, [documentIsAvailable])
|
|
17
|
+
return (
|
|
18
|
+
/*#__PURE__*/
|
|
19
|
+
// <OptionalIntlProvider locale={locale}>
|
|
20
|
+
React.createElement(React.Fragment, null, children, /*#__PURE__*/React.createElement(FontDefinitions, null))
|
|
21
|
+
// </OptionalIntlProvider>
|
|
22
|
+
);
|
|
31
23
|
};
|
|
32
24
|
KaizenProvider.displayName = "KaizenProvider";
|
|
33
25
|
return KaizenProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KaizenProvider.mjs","sources":["../../../src/KaizenProvider/KaizenProvider.tsx"],"sourcesContent":["import React
|
|
1
|
+
{"version":3,"file":"KaizenProvider.mjs","sources":["../../../src/KaizenProvider/KaizenProvider.tsx"],"sourcesContent":["import React from \"react\"\n// import { ToastNotificationsList } from \"~components/Notification\"\n// import { ToastNotificationProvider } from \"~components/Notification/ToastNotification/context/ToastNotificationContext\"\nimport { FontDefinitions } from \"./subcomponents/FontDefinitions\"\n// import { 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 // const [documentIsAvailable, setDocumentIsAvailable] = useState<boolean>(false)\n // const [notificationsList, setNotificationsList] = useState<JSX.Element>()\n\n // useEffect(() => {\n // // SSR does not have a document, which is required for ToastNotificationsList.\n // // Await document render before rendering the component.\n // if (document !== undefined) {\n // setNotificationsList(<ToastNotificationsList />)\n // setDocumentIsAvailable(true)\n // }\n // }, [documentIsAvailable])\n\n (\n // <OptionalIntlProvider locale={locale}>\n <>\n {/* <ToastNotificationProvider> */}\n {/* {notificationsList} */}\n {children}\n {/* </ToastNotificationProvider> */}\n <FontDefinitions />\n </>\n // </OptionalIntlProvider>\n )\n\n\nKaizenProvider.displayName = \"KaizenProvider\"\n"],"names":["KaizenProvider","_a","children","locale","React","createElement","Fragment","FontDefinitions","displayName"],"mappings":";;MAWaA,cAAc;EAAA,MAAdA,cAAc,GAAG,SAAAA,CAACC,EAGT,EAAA;;;IAFpB,IAAAC,QAAQ,cAAA;IACRD,EAAA,CAAAE,MAAa;;;;;;;;;IAcZ;MAAA;;MAEGC,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAE,QAAA,EAAA,IAAA,EAGKJ,QAAQ,eAEXE,KAAC,CAAAC,aAAA,CAAAE,eAAe,OAAG;;;EAPxB,CAUA;EAGHP,cAAc,CAACQ,WAAW,GAAG,gBAAgB;EAAA,OA7BhCR,cAAc;AAAA;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { useContext
|
|
3
|
-
import
|
|
1
|
+
import 'tslib';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import 'uuid';
|
|
4
4
|
var ToastNotificationContext = /*#__PURE__*/React.createContext(null);
|
|
5
5
|
var useToastNotificationContext = function () {
|
|
6
6
|
var context = useContext(ToastNotificationContext);
|
|
@@ -9,61 +9,5 @@ var useToastNotificationContext = function () {
|
|
|
9
9
|
}
|
|
10
10
|
return context;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
const ToastNotificationProvider = function (_a) {
|
|
14
|
-
var children = _a.children;
|
|
15
|
-
var _b = useState([]),
|
|
16
|
-
notifications = _b[0],
|
|
17
|
-
setNotifications = _b[1];
|
|
18
|
-
var addToastNotification = function (notification) {
|
|
19
|
-
var uuid = v4();
|
|
20
|
-
var notificationWithId = __assign({
|
|
21
|
-
id: uuid
|
|
22
|
-
}, notification);
|
|
23
|
-
var notificationExists = notifications.find(function (_a) {
|
|
24
|
-
var id = _a.id;
|
|
25
|
-
return id === notification.id;
|
|
26
|
-
});
|
|
27
|
-
if (!notificationExists) {
|
|
28
|
-
setNotifications(function (existing) {
|
|
29
|
-
return __spreadArray(__spreadArray([], existing, true), [notificationWithId], false);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var updateToastNotification = function (notification) {
|
|
34
|
-
var notificationIndex = notifications.findIndex(function (_a) {
|
|
35
|
-
var id = _a.id;
|
|
36
|
-
return id === notification.id;
|
|
37
|
-
});
|
|
38
|
-
var copy = notifications.slice();
|
|
39
|
-
copy.splice(notificationIndex, 1, notification); // Mutation to insert notification over itself
|
|
40
|
-
setNotifications(copy);
|
|
41
|
-
};
|
|
42
|
-
var removeToastNotification = function (notificationID) {
|
|
43
|
-
var notificationIndex = notifications.findIndex(function (_a) {
|
|
44
|
-
var id = _a.id;
|
|
45
|
-
return id === notificationID;
|
|
46
|
-
});
|
|
47
|
-
var copy = notifications.slice();
|
|
48
|
-
copy.splice(notificationIndex, 1); // Mutation
|
|
49
|
-
setNotifications(copy);
|
|
50
|
-
};
|
|
51
|
-
var clearToastNotifications = function () {
|
|
52
|
-
setNotifications([]);
|
|
53
|
-
};
|
|
54
|
-
var value = {
|
|
55
|
-
notifications: notifications,
|
|
56
|
-
addToastNotification: addToastNotification,
|
|
57
|
-
updateToastNotification: updateToastNotification,
|
|
58
|
-
removeToastNotification: removeToastNotification,
|
|
59
|
-
clearToastNotifications: clearToastNotifications
|
|
60
|
-
};
|
|
61
|
-
return /*#__PURE__*/React.createElement(ToastNotificationContext.Provider, {
|
|
62
|
-
value: value
|
|
63
|
-
}, children);
|
|
64
|
-
};
|
|
65
|
-
ToastNotificationProvider.displayName = "ToastNotificationProvider";
|
|
66
|
-
return ToastNotificationProvider;
|
|
67
|
-
}();
|
|
68
|
-
export { ToastNotificationProvider, useToastNotificationContext };
|
|
12
|
+
export { useToastNotificationContext };
|
|
69
13
|
//# sourceMappingURL=ToastNotificationContext.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastNotificationContext.mjs","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"
|
|
1
|
+
{"version":3,"file":"ToastNotificationContext.mjs","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"],"mappings":";;;AAgBA,IAAMA,wBAAwB,gBAC5BC,KAAK,CAACC,aAAa,CAAuC,IAAI,CAAC;AAEpD,IAAAC,2BAA2B,GACtC,SAAAA,CAAA,EAAA;EACE,IAAMC,OAAO,GAAGC,UAAU,CAACL,wBAAwB,CAAC;EAEpD,IAAI,CAACI,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CACb,uFAAuF,CACxF;EACF;EAED,OAAOF,OAAO;AAChB,CAAA;"}
|
package/dist/esm/Tag/Tag.mjs
CHANGED
|
@@ -1,129 +1,9 @@
|
|
|
1
|
-
import { __assign } from 'tslib';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
|
-
import { Avatar } from '../Avatar/Avatar.mjs';
|
|
5
|
-
import '../Icon/subcomponents/SVG/SVG.mjs';
|
|
6
|
-
import { CautionIcon } from '../Icon/CautionIcon.mjs';
|
|
7
|
-
import { ClearIcon } from '../Icon/ClearIcon.mjs';
|
|
8
|
-
import { ExclamationIcon } from '../Icon/ExclamationIcon.mjs';
|
|
9
|
-
import { InformationIcon } from '../Icon/InformationIcon.mjs';
|
|
10
|
-
import { LiveIcon } from '../Icon/LiveIcon.mjs';
|
|
11
|
-
import { SuccessIcon } from '../Icon/SuccessIcon.mjs';
|
|
12
|
-
import styles from './Tag.module.scss.mjs';
|
|
13
|
-
var isJSXElement = function (imageElementOrAvatarProps) {
|
|
14
|
-
return "props" in imageElementOrAvatarProps;
|
|
15
|
-
};
|
|
16
|
-
var renderAvatar = function (imageElementOrAvatarProps) {
|
|
17
|
-
return isJSXElement(imageElementOrAvatarProps) ? ( /*#__PURE__*/React.createElement(React.Fragment, null, imageElementOrAvatarProps)) : ( /*#__PURE__*/React.createElement(Avatar, __assign({}, imageElementOrAvatarProps, {
|
|
18
|
-
size: "small"
|
|
19
|
-
})));
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081928978/Tags Guidance} |
|
|
23
|
-
* {@link https://cultureamp.design/?path=/docs/components-tag--docs Storybook}
|
|
24
|
-
*/
|
|
25
2
|
const Tag = /*#__PURE__*/function () {
|
|
26
3
|
const Tag = function (props) {
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_b = props.size,
|
|
31
|
-
size = _b === void 0 ? "medium" : _b,
|
|
32
|
-
_c = props.inline,
|
|
33
|
-
inline = _c === void 0 ? false : _c,
|
|
34
|
-
_d = props.dismissible,
|
|
35
|
-
dismissible = _d === void 0 ? false : _d,
|
|
36
|
-
onDismiss = props.onDismiss,
|
|
37
|
-
onMouseDown = props.onMouseDown,
|
|
38
|
-
onMouseLeave = props.onMouseLeave,
|
|
39
|
-
truncateWidth = props.truncateWidth;
|
|
40
|
-
var isTruncated = truncateWidth && truncateWidth > 0;
|
|
41
|
-
var canShowIcon = size === "medium";
|
|
42
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
-
className: classnames(styles.root, styles[variant], variant === "profile" && styles.default, styles[size], inline && styles.inline, dismissible && styles.dismissible)
|
|
44
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
45
|
-
className: styles.layoutContainer
|
|
46
|
-
}, /*#__PURE__*/React.createElement(React.Fragment, null, canShowIcon && function () {
|
|
47
|
-
switch (props.variant) {
|
|
48
|
-
case "validationPositive":
|
|
49
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
50
|
-
className: styles.validationIcon
|
|
51
|
-
}, /*#__PURE__*/React.createElement(SuccessIcon, {
|
|
52
|
-
role: "presentation"
|
|
53
|
-
}));
|
|
54
|
-
case "validationNegative":
|
|
55
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
56
|
-
className: styles.validationIcon
|
|
57
|
-
}, /*#__PURE__*/React.createElement(ExclamationIcon, {
|
|
58
|
-
role: "presentation"
|
|
59
|
-
}));
|
|
60
|
-
case "validationCautionary":
|
|
61
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
62
|
-
className: styles.validationIcon
|
|
63
|
-
}, /*#__PURE__*/React.createElement(CautionIcon, {
|
|
64
|
-
role: "presentation"
|
|
65
|
-
}));
|
|
66
|
-
case "validationInformative":
|
|
67
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
68
|
-
className: styles.validationIcon
|
|
69
|
-
}, /*#__PURE__*/React.createElement(InformationIcon, {
|
|
70
|
-
role: "presentation"
|
|
71
|
-
}));
|
|
72
|
-
case "profile":
|
|
73
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
74
|
-
className: styles.profile
|
|
75
|
-
}, props.avatar && renderAvatar(props.avatar));
|
|
76
|
-
default:
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
}(), /*#__PURE__*/React.createElement("span", {
|
|
80
|
-
className: classnames(styles.textContent, isTruncated && styles.truncate),
|
|
81
|
-
style: {
|
|
82
|
-
maxWidth: isTruncated ? truncateWidth : undefined
|
|
83
|
-
}
|
|
84
|
-
}, children), dismissible && ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
85
|
-
type: "button",
|
|
86
|
-
className: styles.dismissButton,
|
|
87
|
-
onClick: onDismiss,
|
|
88
|
-
onMouseDown: onMouseDown,
|
|
89
|
-
onMouseLeave: onMouseLeave
|
|
90
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
91
|
-
className: styles.iconWrapper
|
|
92
|
-
}, /*#__PURE__*/React.createElement(ClearIcon, {
|
|
93
|
-
inheritSize: true,
|
|
94
|
-
role: "img",
|
|
95
|
-
"aria-label": "Dismiss"
|
|
96
|
-
}))))), variant === "statusLive" && ( /*#__PURE__*/React.createElement("span", {
|
|
97
|
-
className: styles.liveIcon
|
|
98
|
-
}, /*#__PURE__*/React.createElement(LiveIcon, {
|
|
99
|
-
role: "presentation",
|
|
100
|
-
classNameOverride: styles.liveIcon_base,
|
|
101
|
-
width: "16",
|
|
102
|
-
height: "16",
|
|
103
|
-
viewBox: "0 0 16 16",
|
|
104
|
-
fill: "none"
|
|
105
|
-
}), /*#__PURE__*/React.createElement(LiveIcon, {
|
|
106
|
-
role: "presentation",
|
|
107
|
-
classNameOverride: styles.liveIcon_1,
|
|
108
|
-
width: "16",
|
|
109
|
-
height: "16",
|
|
110
|
-
viewBox: "0 0 16 16",
|
|
111
|
-
fill: "none"
|
|
112
|
-
}), /*#__PURE__*/React.createElement(LiveIcon, {
|
|
113
|
-
role: "presentation",
|
|
114
|
-
classNameOverride: styles.liveIcon_2,
|
|
115
|
-
width: "16",
|
|
116
|
-
height: "16",
|
|
117
|
-
viewBox: "0 0 16 16",
|
|
118
|
-
fill: "none"
|
|
119
|
-
}), /*#__PURE__*/React.createElement(LiveIcon, {
|
|
120
|
-
role: "presentation",
|
|
121
|
-
classNameOverride: styles.liveIcon_3,
|
|
122
|
-
width: "16",
|
|
123
|
-
height: "16",
|
|
124
|
-
viewBox: "0 0 16 16",
|
|
125
|
-
fill: "none"
|
|
126
|
-
}))))));
|
|
4
|
+
var _a = props.variant,
|
|
5
|
+
variant = _a === void 0 ? "default" : _a;
|
|
6
|
+
return /*#__PURE__*/React.createElement("div", null, "Testing Tag component ", variant);
|
|
127
7
|
};
|
|
128
8
|
Tag.displayName = "Tag";
|
|
129
9
|
return Tag;
|
package/dist/esm/Tag/Tag.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.mjs","sources":["../../../src/Tag/Tag.tsx"],"sourcesContent":["import React from \"react\"\nimport classnames from \"classnames\"\nimport { Avatar, AvatarProps } from \"~components/Avatar\"\nimport {\n CautionIcon,\n ClearIcon,\n ExclamationIcon,\n InformationIcon,\n LiveIcon,\n SuccessIcon,\n} from \"~components/Icon\"\nimport { TagVariants } from \"./types\"\nimport styles from \"./Tag.module.scss\"\n\nexport type TagWithAvatarProps = Omit<DefaultTagProps, \"variant\"> & {\n variant: \"profile\"\n avatar: JSX.Element | AvatarProps\n}\n\ntype Variant = (typeof TagVariants)[number]\n\nexport interface DefaultTagProps {\n variant?: Variant\n children: React.ReactNode\n size?: \"medium\" | \"small\"\n inline?: boolean\n dismissible?: boolean\n onDismiss?: React.MouseEventHandler<HTMLSpanElement>\n onMouseDown?: React.MouseEventHandler<HTMLSpanElement>\n onMouseLeave?: React.MouseEventHandler<HTMLSpanElement>\n truncateWidth?: number\n}\n\nexport type TagProps = DefaultTagProps | TagWithAvatarProps\n\nconst isJSXElement = (\n imageElementOrAvatarProps: JSX.Element | AvatarProps\n): imageElementOrAvatarProps is JSX.Element =>\n \"props\" in imageElementOrAvatarProps\n\nconst renderAvatar = (\n imageElementOrAvatarProps: JSX.Element | AvatarProps\n): JSX.Element =>\n isJSXElement(imageElementOrAvatarProps) ? (\n <>{imageElementOrAvatarProps}</>\n ) : (\n <Avatar {...imageElementOrAvatarProps} size=\"small\" />\n )\n\n/**\n * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081928978/Tags Guidance} |\n * {@link https://cultureamp.design/?path=/docs/components-tag--docs Storybook}\n */\nexport const Tag = (props: TagProps): JSX.Element => {\n const {\n children,\n variant = \"default\",\n size = \"medium\",\n inline = false,\n dismissible = false,\n onDismiss,\n onMouseDown,\n onMouseLeave,\n truncateWidth,\n } = props\n\n const isTruncated = truncateWidth && truncateWidth > 0\n const canShowIcon = size === \"medium\"\n return (\n <div\n className={classnames(\n styles.root,\n styles[variant],\n variant === \"profile\" && styles.default,\n styles[size],\n inline && styles.inline,\n dismissible && styles.dismissible\n )}\n >\n <div className={styles.layoutContainer}>\n <>\n {canShowIcon &&\n ((): JSX.Element | void => {\n switch (props.variant) {\n case \"validationPositive\":\n return (\n <span className={styles.validationIcon}>\n <SuccessIcon role=\"presentation\" />\n </span>\n )\n case \"validationNegative\":\n return (\n <span className={styles.validationIcon}>\n <ExclamationIcon role=\"presentation\" />\n </span>\n )\n case \"validationCautionary\":\n return (\n <span className={styles.validationIcon}>\n <CautionIcon role=\"presentation\" />\n </span>\n )\n case \"validationInformative\":\n return (\n <span className={styles.validationIcon}>\n <InformationIcon role=\"presentation\" />\n </span>\n )\n case \"profile\":\n return (\n <span className={styles.profile}>\n {props.avatar && renderAvatar(props.avatar)}\n </span>\n )\n default:\n return\n }\n })()}\n <span\n className={classnames(\n styles.textContent,\n isTruncated && styles.truncate\n )}\n style={{\n maxWidth: isTruncated ? truncateWidth : undefined,\n }}\n >\n {children}\n </span>\n {dismissible && (\n <>\n <button\n type=\"button\"\n className={styles.dismissButton}\n onClick={onDismiss}\n onMouseDown={onMouseDown}\n onMouseLeave={onMouseLeave}\n >\n <div className={styles.iconWrapper}>\n <ClearIcon inheritSize role=\"img\" aria-label=\"Dismiss\" />\n </div>\n </button>\n </>\n )}\n {variant === \"statusLive\" && (\n <span className={styles.liveIcon}>\n <LiveIcon\n role=\"presentation\"\n classNameOverride={styles.liveIcon_base}\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n />\n <LiveIcon\n role=\"presentation\"\n classNameOverride={styles.liveIcon_1}\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n />\n <LiveIcon\n role=\"presentation\"\n classNameOverride={styles.liveIcon_2}\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n />\n <LiveIcon\n role=\"presentation\"\n classNameOverride={styles.liveIcon_3}\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n />\n </span>\n )}\n </>\n </div>\n </div>\n )\n}\n\nTag.displayName = \"Tag\"\n"],"names":["isJSXElement","imageElementOrAvatarProps","renderAvatar","React","createElement","Fragment","Avatar","__assign","size","Tag","props","children","_a","variant","_b","_c","inline","_d","dismissible","onDismiss","onMouseDown","onMouseLeave","truncateWidth","isTruncated","canShowIcon","className","classnames","styles","root","default","layoutContainer","validationIcon","SuccessIcon","role","ExclamationIcon","CautionIcon","InformationIcon","profile","avatar","textContent","truncate","style","maxWidth","undefined","type","dismissButton","onClick","iconWrapper","ClearIcon","inheritSize","liveIcon","LiveIcon","classNameOverride","liveIcon_base","width","height","viewBox","fill","liveIcon_1","liveIcon_2","liveIcon_3","displayName"],"mappings":";;;;;;;;;;;;AAm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mB,iBAAiB,EAAEzB,MAAM,CAAC0B,aAAa;MACvCC,KAAK,EAAC,IAAI;MACVC,MAAM,EAAC,IAAI;MACXC,OAAO,EAAC,WAAW;MACnBC,IAAI,EAAC;KACL,CAAA,eACFtD,KAAC,CAAAC,aAAA,CAAA+C,QAAQ,EACP;MAAAlB,IAAI,EAAC,cAAc;MACnBmB,iBAAiB,EAAEzB,MAAM,CAAC+B,UAAU;MACpCJ,KAAK,EAAC,IAAI;MACVC,MAAM,EAAC,IAAI;MACXC,OAAO,EAAC,WAAW;MACnBC,IAAI,EAAC;KACL,CAAA,eACFtD,KAAC,CAAAC,aAAA,CAAA+C,QAAQ,EACP;MAAAlB,IAAI,EAAC,cAAc;MACnBmB,iBAAiB,EAAEzB,MAAM,CAACgC,UAAU;MACpCL,KAAK,EAAC,IAAI;MACVC,MAAM,EAAC,IAAI;MACXC,OAAO,EAAC,WAAW;MACnBC,IAAI,EAAC;KACL,CAAA,eACFtD,KAAA,CAAAC,aAAA,CAAC+C,QAAQ,EAAA;MACPlB,IAAI,EAAC,cAAc;MACnBmB,iBAAiB,EAAEzB,MAAM,CAACiC,UAAU;MACpCN,KAAK,EAAC,IAAI;MACVC,MAAM,EAAC,IAAI;MACXC,OAAO,EAAC,WAAW;MACnBC,IAAI,EAAC;KAAM,CACX,CACG,CACR,CACA,CACC,CACF;EAEV,CAAC;EAEDhD,GAAG,CAACoD,WAAW,GAAG,KAAK;EAAA,OArIVpD,GAAG;AAAA;"}
|
|
1
|
+
{"version":3,"file":"Tag.mjs","sources":["../../../src/Tag/Tag.tsx"],"sourcesContent":["import React from \"react\"\nimport { AvatarProps } from \"~components/Avatar\"\nimport { TagVariants } from \"./types\"\n\nexport type TagWithAvatarProps = Omit<DefaultTagProps, \"variant\"> & {\n variant: \"profile\"\n avatar: JSX.Element | AvatarProps\n}\n\ntype Variant = (typeof TagVariants)[number]\n\nexport interface DefaultTagProps {\n variant?: Variant\n children: React.ReactNode\n size?: \"medium\" | \"small\"\n inline?: boolean\n dismissible?: boolean\n onDismiss?: React.MouseEventHandler<HTMLSpanElement>\n onMouseDown?: React.MouseEventHandler<HTMLSpanElement>\n onMouseLeave?: React.MouseEventHandler<HTMLSpanElement>\n truncateWidth?: number\n}\n\nexport type TagProps = DefaultTagProps | TagWithAvatarProps\n\nexport const Tag = (props: TagProps): JSX.Element => {\n const { variant = \"default\" } = props\n return <div>Testing Tag component {variant}</div>\n}\n\nTag.displayName = \"Tag\"\n"],"names":["Tag","props","_a","variant","React","createElement","displayName"],"mappings":";MAyBaA,GAAG;EAAA,MAAHA,GAAG,GAAG,SAAAA,CAACC,KAAe,EAAA;IACzB,IAAAC,EAAA,GAAwBD,KAAK,CAAVE,OAAA;MAAnBA,OAAO,GAAGD,EAAA,KAAA,KAAA,CAAA,GAAA,SAAS,KAAA;IAC3B,oBAAOE,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA,IAAA,4BAA4BF,OAAO,CAAO;EACnD,CAAC;EAEDH,GAAG,CAACM,WAAW,GAAG,KAAK;EAAA,OALVN,GAAG;AAAA;"}
|
|
@@ -18,10 +18,6 @@ export interface DefaultTagProps {
|
|
|
18
18
|
truncateWidth?: number;
|
|
19
19
|
}
|
|
20
20
|
export type TagProps = DefaultTagProps | TagWithAvatarProps;
|
|
21
|
-
/**
|
|
22
|
-
* {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081928978/Tags Guidance} |
|
|
23
|
-
* {@link https://cultureamp.design/?path=/docs/components-tag--docs Storybook}
|
|
24
|
-
*/
|
|
25
21
|
export declare const Tag: {
|
|
26
22
|
(props: TagProps): JSX.Element;
|
|
27
23
|
displayName: string;
|