@lumx/react 3.20.1-alpha.30 → 3.20.1-alpha.31
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/_internal/{Button-4b67daa8.js → Button-f382ee1c.js} +3 -3
- package/_internal/{Button-4b67daa8.js.map → Button-f382ee1c.js.map} +1 -1
- package/_internal/{IconButton-8d61f5be.js → IconButton-1790b47e.js} +2 -2
- package/_internal/{IconButton-8d61f5be.js.map → IconButton-1790b47e.js.map} +1 -1
- package/_internal/{ImageCaption-db44ec9e.js → ImageCaption-16bf224b.js} +2 -2
- package/_internal/{ImageCaption-db44ec9e.js.map → ImageCaption-16bf224b.js.map} +1 -1
- package/_internal/{PopoverDialog-35b2d87d.js → PopoverDialog-3b63f140.js} +6 -7
- package/_internal/PopoverDialog-3b63f140.js.map +1 -0
- package/_internal/{Slides-ce641b5f.js → Slides-2a427c44.js} +3 -6
- package/_internal/Slides-2a427c44.js.map +1 -0
- package/_internal/{Thumbnail-02bd6869.js → Thumbnail-d2001ccb.js} +3 -3
- package/_internal/Thumbnail-d2001ccb.js.map +1 -0
- package/_internal/components/{alert-dialog-a24330ed.js → alert-dialog-bd1b2532.js} +4 -7
- package/_internal/components/alert-dialog-bd1b2532.js.map +1 -0
- package/_internal/components/{autocomplete-70749e51.js → autocomplete-8ae2c4f9.js} +4 -4
- package/_internal/components/autocomplete-8ae2c4f9.js.map +1 -0
- package/_internal/components/{avatar-ed9f4869.js → avatar-778d7df6.js} +2 -2
- package/_internal/components/{avatar-ed9f4869.js.map → avatar-778d7df6.js.map} +1 -1
- package/_internal/components/{button-9f710830.js → button-4aff084a.js} +3 -3
- package/_internal/components/{button-9f710830.js.map → button-4aff084a.js.map} +1 -1
- package/_internal/components/{checkbox-8ab51ef9.js → checkbox-a448ca6c.js} +3 -4
- package/_internal/components/checkbox-a448ca6c.js.map +1 -0
- package/_internal/components/{comment-block-bb6a0603.js → comment-block-bcbedf3c.js} +2 -2
- package/_internal/components/{comment-block-bb6a0603.js.map → comment-block-bcbedf3c.js.map} +1 -1
- package/_internal/components/date-picker-b6d4048e.js +2 -0
- package/_internal/components/date-picker-b6d4048e.js.map +1 -0
- package/_internal/components/{drag-handle-ba2e7e67.js → drag-handle-137f71b6.js} +3 -3
- package/_internal/components/drag-handle-137f71b6.js.map +1 -0
- package/_internal/components/{expansion-panel-0b263437.js → expansion-panel-38ed3d9f.js} +4 -5
- package/_internal/components/expansion-panel-38ed3d9f.js.map +1 -0
- package/_internal/components/{flag-8f9a498a.js → flag-c2e41e8d.js} +3 -3
- package/_internal/components/{flag-8f9a498a.js.map → flag-c2e41e8d.js.map} +1 -1
- package/_internal/components/{heading-7bfafd7d.js → heading-28520e1c.js} +2 -2
- package/_internal/components/{heading-7bfafd7d.js.map → heading-28520e1c.js.map} +1 -1
- package/_internal/components/{icon-ee15673b.js → icon-a00d698b.js} +2 -2
- package/_internal/components/icon-a00d698b.js.map +1 -0
- package/_internal/components/{image-block-3479abda.js → image-block-10976174.js} +3 -3
- package/_internal/components/{image-block-3479abda.js.map → image-block-10976174.js.map} +1 -1
- package/_internal/components/{image-lightbox-1d7ca133.js → image-lightbox-86f1e1fb.js} +7 -8
- package/_internal/components/image-lightbox-86f1e1fb.js.map +1 -0
- package/_internal/components/{lightbox-c5f9afd0.js → lightbox-c618a33b.js} +3 -3
- package/_internal/components/lightbox-c618a33b.js.map +1 -0
- package/_internal/components/{link-43ee103e.js → link-9c3feb34.js} +3 -3
- package/_internal/components/{link-43ee103e.js.map → link-9c3feb34.js.map} +1 -1
- package/_internal/components/{link-preview-db0ee2d6.js → link-preview-79500604.js} +3 -3
- package/_internal/components/{link-preview-db0ee2d6.js.map → link-preview-79500604.js.map} +1 -1
- package/_internal/components/{message-f7674e0e.js → message-a3806f51.js} +4 -8
- package/_internal/components/message-a3806f51.js.map +1 -0
- package/_internal/components/{mosaic-3effd0cf.js → mosaic-e6581097.js} +2 -2
- package/_internal/components/{mosaic-3effd0cf.js.map → mosaic-e6581097.js.map} +1 -1
- package/_internal/components/{navigation-3a5dc270.js → navigation-5378f128.js} +4 -5
- package/_internal/components/{navigation-3a5dc270.js.map → navigation-5378f128.js.map} +1 -1
- package/_internal/components/{notification-098c5600.js → notification-49837625.js} +4 -7
- package/_internal/components/notification-49837625.js.map +1 -0
- package/_internal/components/{post-block-69797e4d.js → post-block-478bc3b8.js} +3 -3
- package/_internal/components/{post-block-69797e4d.js.map → post-block-478bc3b8.js.map} +1 -1
- package/_internal/components/{progress-tracker-e0981fcc.js → progress-tracker-0fd35bea.js} +3 -6
- package/_internal/components/progress-tracker-0fd35bea.js.map +1 -0
- package/_internal/components/{select-64bc72a0.js → select-a145edbb.js} +4 -8
- package/_internal/components/select-a145edbb.js.map +1 -0
- package/_internal/components/{side-navigation-c610c689.js → side-navigation-b99d6022.js} +4 -5
- package/_internal/components/side-navigation-b99d6022.js.map +1 -0
- package/_internal/components/{slideshow-d8a943a7.js → slideshow-b78ac3d6.js} +3 -3
- package/_internal/components/{slideshow-d8a943a7.js.map → slideshow-b78ac3d6.js.map} +1 -1
- package/_internal/components/{table-ec20c66c.js → table-3cbee034.js} +3 -4
- package/_internal/components/table-3cbee034.js.map +1 -0
- package/_internal/components/{tabs-89c055bd.js → tabs-5d8ea1a5.js} +3 -3
- package/_internal/components/{tabs-89c055bd.js.map → tabs-5d8ea1a5.js.map} +1 -1
- package/_internal/components/text-f84a5417.js +2 -0
- package/_internal/components/text-f84a5417.js.map +1 -0
- package/_internal/components/{text-field-8f13957e.js → text-field-c26582c5.js} +4 -6
- package/_internal/components/text-field-c26582c5.js.map +1 -0
- package/_internal/components/{thumbnail-1255957f.js → thumbnail-cb55b26c.js} +2 -2
- package/_internal/components/{thumbnail-1255957f.js.map → thumbnail-cb55b26c.js.map} +1 -1
- package/_internal/components/{uploader-7ef4db39.js → uploader-873b9bc1.js} +2 -2
- package/_internal/components/{uploader-7ef4db39.js.map → uploader-873b9bc1.js.map} +1 -1
- package/_internal/components/{user-block-24d97650.js → user-block-7cbaffe0.js} +3 -3
- package/_internal/components/{user-block-24d97650.js.map → user-block-7cbaffe0.js.map} +1 -1
- package/_internal/{index-25c9e8c2.js → index-151e2652.js} +2 -2
- package/_internal/{index-25c9e8c2.js.map → index-151e2652.js.map} +1 -1
- package/_internal/{wrapChildrenIconWithSpaces-50d705e6.js → wrapChildrenIconWithSpaces-ef2a6772.js} +2 -2
- package/_internal/{wrapChildrenIconWithSpaces-50d705e6.js.map → wrapChildrenIconWithSpaces-ef2a6772.js.map} +1 -1
- package/index.js +37 -37
- package/package.json +3 -3
- package/_internal/PopoverDialog-35b2d87d.js.map +0 -1
- package/_internal/Slides-ce641b5f.js.map +0 -1
- package/_internal/Thumbnail-02bd6869.js.map +0 -1
- package/_internal/components/alert-dialog-a24330ed.js.map +0 -1
- package/_internal/components/autocomplete-70749e51.js.map +0 -1
- package/_internal/components/checkbox-8ab51ef9.js.map +0 -1
- package/_internal/components/date-picker-e4209b01.js +0 -2
- package/_internal/components/date-picker-e4209b01.js.map +0 -1
- package/_internal/components/drag-handle-ba2e7e67.js.map +0 -1
- package/_internal/components/expansion-panel-0b263437.js.map +0 -1
- package/_internal/components/icon-ee15673b.js.map +0 -1
- package/_internal/components/image-lightbox-1d7ca133.js.map +0 -1
- package/_internal/components/lightbox-c5f9afd0.js.map +0 -1
- package/_internal/components/message-f7674e0e.js.map +0 -1
- package/_internal/components/notification-098c5600.js.map +0 -1
- package/_internal/components/progress-tracker-e0981fcc.js.map +0 -1
- package/_internal/components/select-64bc72a0.js.map +0 -1
- package/_internal/components/side-navigation-c610c689.js.map +0 -1
- package/_internal/components/table-ec20c66c.js.map +0 -1
- package/_internal/components/text-d04d0f1b.js +0 -2
- package/_internal/components/text-d04d0f1b.js.map +0 -1
- package/_internal/components/text-field-8f13957e.js.map +0 -1
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { mdiAlert } from '@lumx/icons
|
|
4
|
-
import { mdiAlertCircle } from '@lumx/icons/esm/alert-circle';
|
|
5
|
-
import { mdiCheckCircle } from '@lumx/icons/esm/check-circle';
|
|
6
|
-
import { mdiInformation } from '@lumx/icons/esm/information';
|
|
3
|
+
import { mdiAlert, mdiInformation, mdiCheckCircle, mdiAlertCircle } from '@lumx/icons';
|
|
7
4
|
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
8
5
|
import { u as useId } from '../useId-3a1facc0.js';
|
|
9
6
|
import { f as forwardRef } from '../forwardRef-8bce732e.js';
|
|
10
7
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
8
|
import { Dialog } from './dialog-30336ccb.js';
|
|
12
9
|
import { Toolbar } from './toolbar-e7c984e6.js';
|
|
13
|
-
import { Icon } from './icon-
|
|
14
|
-
import { a as Button } from '../Button-
|
|
10
|
+
import { Icon } from './icon-a00d698b.js';
|
|
11
|
+
import { a as Button } from '../Button-f382ee1c.js';
|
|
15
12
|
import { Kind, ColorPalette, Size, Emphasis } from '@lumx/core/js/constants';
|
|
16
13
|
|
|
17
14
|
/**
|
|
@@ -163,4 +160,4 @@ AlertDialog.className = CLASSNAME;
|
|
|
163
160
|
AlertDialog.defaultProps = DEFAULT_PROPS;
|
|
164
161
|
|
|
165
162
|
export { AlertDialog };
|
|
166
|
-
//# sourceMappingURL=alert-dialog-
|
|
163
|
+
//# sourceMappingURL=alert-dialog-bd1b2532.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog-bd1b2532.js","sources":["../../../src/components/alert-dialog/AlertDialog.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n DialogProps,\n Dialog,\n Button,\n Emphasis,\n ColorPalette,\n Icon,\n Size,\n Kind,\n Toolbar,\n ButtonProps,\n} from '@lumx/react';\nimport { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiInformation } from '@lumx/icons';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { useId } from '@lumx/react/hooks/useId';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nexport interface AlertDialogProps extends Omit<DialogProps, 'header' | 'footer'> {\n /** Message variant. */\n kind?: Kind;\n /** Dialog title. */\n title?: string;\n /** Props forwarded to the confirm button */\n confirmProps: ButtonProps & {\n onClick(): void;\n label: string;\n };\n /**\n * Props forwarded to the cancel button.\n * Will not render a cancel button if undefined.\n */\n cancelProps?: ButtonProps & {\n onClick(): void;\n label: string;\n };\n /**\n * Children\n */\n children?: React.ReactNode;\n}\n\n/**\n * Associative map from message kind to color and icon.\n */\nconst CONFIG = {\n [Kind.error]: { color: ColorPalette.red, icon: mdiAlert },\n [Kind.info]: { color: ColorPalette.blue, icon: mdiInformation },\n [Kind.success]: { color: ColorPalette.green, icon: mdiCheckCircle },\n [Kind.warning]: { color: ColorPalette.yellow, icon: mdiAlertCircle },\n};\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'AlertDialog';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<DialogProps> = {\n size: Size.tiny,\n kind: Kind.info,\n};\n\n/**\n * AlertDialog component.\n *\n * An alert dialog is a modal dialog that interrupts the user's workflow to\n * communicate an important message and acquire a response.\n *\n * It should not have a complex content.\n * Children of this component should only be strings, paragraphs or links.\n */\nexport const AlertDialog = forwardRef<AlertDialogProps, HTMLDivElement>((props, ref) => {\n const {\n id,\n title,\n className,\n cancelProps,\n confirmProps,\n kind = DEFAULT_PROPS.kind,\n size = DEFAULT_PROPS.size,\n dialogProps,\n children,\n ...forwardedProps\n } = props;\n\n const cancelButtonRef = React.useRef(null);\n const confirmationButtonRef = React.useRef(null);\n const { color, icon } = CONFIG[kind as Kind] || {};\n\n // Define a unique ID to target title and description for aria attributes.\n const generatedId = useId();\n const uniqueId = id || generatedId;\n const titleId = `${uniqueId}-title`;\n const descriptionId = `${uniqueId}-description`;\n\n // If content is a string, set in a paragraph.\n const DescriptionElement = typeof children === 'string' ? 'p' : 'div';\n\n const { label: confirmLabel, onClick: confirmOnClick, ...forwardedConfirmProps } = confirmProps;\n const { label: cancelLabel, onClick: cancelOnClick, ...forwardedCancelProps } = cancelProps || {};\n\n return (\n <Dialog\n ref={ref}\n focusElement={cancelProps ? cancelButtonRef : confirmationButtonRef}\n size={size}\n dialogProps={{\n id: uniqueId,\n role: 'alertdialog',\n 'aria-labelledby': titleId,\n 'aria-describedby': descriptionId,\n ...dialogProps,\n }}\n className={classNames(\n className,\n handleBasicClasses({\n kind,\n prefix: CLASSNAME,\n }),\n )}\n {...forwardedProps}\n >\n <header>\n <Toolbar\n className=\"lumx-spacing-margin-horizontal\"\n before={<Icon icon={icon} size={Size.s} color={color} />}\n label={\n <h2 id={titleId} className=\"lumx-typography-title\">\n {title}\n </h2>\n }\n />\n </header>\n\n {children && (\n <DescriptionElement\n id={descriptionId}\n className=\"lumx-typography-body2 lumx-spacing-padding-vertical-big lumx-spacing-padding-horizontal-huge\"\n >\n {children}\n </DescriptionElement>\n )}\n\n <footer>\n <Toolbar\n className=\"lumx-spacing-margin-horizontal\"\n after={\n <>\n {cancelProps && (\n <Button\n {...forwardedCancelProps}\n ref={cancelButtonRef}\n emphasis={Emphasis.medium}\n onClick={cancelOnClick}\n >\n {cancelLabel}\n </Button>\n )}\n <Button\n {...forwardedConfirmProps}\n ref={confirmationButtonRef}\n color={color}\n className=\"lumx-spacing-margin-left-regular\"\n onClick={confirmOnClick}\n >\n {confirmLabel}\n </Button>\n </>\n }\n />\n </footer>\n </Dialog>\n );\n});\n\nAlertDialog.displayName = COMPONENT_NAME;\nAlertDialog.className = CLASSNAME;\nAlertDialog.defaultProps = DEFAULT_PROPS;\n"],"names":["CONFIG","Kind","error","color","ColorPalette","red","icon","mdiAlert","info","blue","mdiInformation","success","green","mdiCheckCircle","warning","yellow","mdiAlertCircle","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","tiny","kind","AlertDialog","forwardRef","props","ref","id","title","className","cancelProps","confirmProps","dialogProps","children","forwardedProps","cancelButtonRef","React","useRef","confirmationButtonRef","generatedId","useId","uniqueId","titleId","descriptionId","DescriptionElement","label","confirmLabel","onClick","confirmOnClick","forwardedConfirmProps","cancelLabel","cancelOnClick","forwardedCancelProps","_jsxs","Dialog","focusElement","role","classNames","handleBasicClasses","prefix","_jsx","Toolbar","before","Icon","s","after","_Fragment","Button","emphasis","Emphasis","medium","displayName","defaultProps"],"mappings":";;;;;;;;;;;;;AA6CA;AACA;AACA;AACA,MAAMA,MAAM,GAAG;EACX,CAACC,IAAI,CAACC,KAAK,GAAG;IAAEC,KAAK,EAAEC,YAAY,CAACC,GAAG;AAAEC,IAAAA,IAAI,EAAEC,QAAAA;GAAU;EACzD,CAACN,IAAI,CAACO,IAAI,GAAG;IAAEL,KAAK,EAAEC,YAAY,CAACK,IAAI;AAAEH,IAAAA,IAAI,EAAEI,cAAAA;GAAgB;EAC/D,CAACT,IAAI,CAACU,OAAO,GAAG;IAAER,KAAK,EAAEC,YAAY,CAACQ,KAAK;AAAEN,IAAAA,IAAI,EAAEO,cAAAA;GAAgB;EACnE,CAACZ,IAAI,CAACa,OAAO,GAAG;IAAEX,KAAK,EAAEC,YAAY,CAACW,MAAM;AAAET,IAAAA,IAAI,EAAEU,cAAAA;AAAe,GAAA;AACvE,CAAC,CAAA;;AAED;AACA;AACA;AACA,MAAMC,cAAc,GAAG,aAAa,CAAA;;AAEpC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAmC,GAAG;EACxCC,IAAI,EAAEC,IAAI,CAACC,IAAI;EACfC,IAAI,EAAEvB,IAAI,CAACO,IAAAA;AACf,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MA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O,EAAA;AACJhC,QAAAA,SAAS,EAAC,gCAAgC;QAC1CoC,KAAK,eACDZ,IAAA,CAAAa,QAAA,EAAA;AAAAjC,UAAAA,QAAA,EACKH,CAAAA,WAAW,iBACR8B,GAAA,CAACO,MAAM,EAAA;AAAA,YAAA,GACCf,oBAAoB;AACxB1B,YAAAA,GAAG,EAAES,eAAgB;YACrBiC,QAAQ,EAAEC,QAAQ,CAACC,MAAO;AAC1BvB,YAAAA,OAAO,EAAEI,aAAc;AAAAlB,YAAAA,QAAA,EAEtBiB,WAAAA;AAAW,WACR,CACX,eACDU,GAAA,CAACO,MAAM,EAAA;AAAA,YAAA,GACClB,qBAAqB;AACzBvB,YAAAA,GAAG,EAAEY,qBAAsB;AAC3BrC,YAAAA,KAAK,EAAEA,KAAM;AACb4B,YAAAA,SAAS,EAAC,kCAAkC;AAC5CkB,YAAAA,OAAO,EAAEC,cAAe;AAAAf,YAAAA,QAAA,EAEvBa,YAAAA;AAAY,WACT,CAAC,CAAA;SACX,CAAA;OAET,CAAA;AAAC,KACE,CAAC,CAAA;AAAA,GACL,CAAC,CAAA;AAEjB,CAAC,EAAC;AAEFvB,WAAW,CAACgD,WAAW,GAAGxD,cAAc,CAAA;AACxCQ,WAAW,CAACM,SAAS,GAAGb,SAAS,CAAA;AACjCO,WAAW,CAACiD,YAAY,GAAGtD,aAAa;;;;"}
|
|
@@ -7,11 +7,11 @@ import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
|
7
7
|
import { f as forwardRef } from '../forwardRef-8bce732e.js';
|
|
8
8
|
import { u as useDisableStateProps } from '../useDisableStateProps-69e16b7c.js';
|
|
9
9
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
-
import { TextField } from './text-field-
|
|
10
|
+
import { TextField } from './text-field-c26582c5.js';
|
|
11
11
|
import { Dropdown } from './dropdown-d18122d7.js';
|
|
12
|
-
import { mdiClose } from '@lumx/icons
|
|
12
|
+
import { mdiClose } from '@lumx/icons';
|
|
13
13
|
import { C as Chip } from '../Chip-70af04b4.js';
|
|
14
|
-
import { Icon } from './icon-
|
|
14
|
+
import { Icon } from './icon-a00d698b.js';
|
|
15
15
|
import { Size } from '@lumx/core/js/constants';
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -259,4 +259,4 @@ AutocompleteMultiple.className = CLASSNAME;
|
|
|
259
259
|
AutocompleteMultiple.defaultProps = DEFAULT_PROPS;
|
|
260
260
|
|
|
261
261
|
export { Autocomplete, AutocompleteMultiple };
|
|
262
|
-
//# sourceMappingURL=autocomplete-
|
|
262
|
+
//# sourceMappingURL=autocomplete-8ae2c4f9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete-8ae2c4f9.js","sources":["../../../src/components/autocomplete/Autocomplete.tsx","../../../src/components/autocomplete/AutocompleteMultiple.tsx"],"sourcesContent":["import { ReactNode, SyntheticEvent, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Dropdown, DropdownProps, IconButtonProps, Offset, Placement, TextField, TextFieldProps } from '@lumx/react';\n\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName } from '@lumx/core/js/utils/className';\nimport { useFocus } from '@lumx/react/hooks/useFocus';\nimport { mergeRefs } from '@lumx/react/utils/react/mergeRefs';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nimport { useDisableStateProps } from '@lumx/react/utils/disabled/useDisableStateProps';\n\n/**\n * Defines the props of the component.\n */\nexport interface AutocompleteProps extends GenericProps, HasTheme {\n /**\n * Whether the suggestions list should display anchored to the input or to the wrapper.\n * @see {@link DropdownProps#anchorToInput}\n */\n anchorToInput?: boolean;\n /**\n * Props to pass to the clear button (minus those already set by the TextField props).\n * If not specified, the button won't be displayed.\n * @see {@link TextFieldProps#clearButtonProps}\n */\n clearButtonProps?: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;\n /**\n * Reference to the <input> or <textarea> element.\n * @see {@link TextFieldProps#inputRef}\n */\n inputRef?: TextFieldProps['inputRef'];\n /**\n * The offset that will be applied to the Dropdown position.\n * @see {@link DropdownProps#offset}\n */\n offset?: Offset;\n /**\n * The preferred Dropdown location against the anchor element.\n * @see {@link DropdownProps#placement}\n */\n placement?: Placement;\n /**\n * Manage dropdown width:\n * - `maxWidth`: dropdown not bigger than anchor\n * - `minWidth` or `true`: dropdown not smaller than anchor\n * - `width`: dropdown equal to the anchor.\n * @see {@link DropdownProps#fitToAnchorWidth}\n */\n fitToAnchorWidth?: DropdownProps['fitToAnchorWidth'];\n /**\n * The error related to the component.\n * @see {@link TextFieldProps#error}\n */\n error?: string | ReactNode;\n /**\n * Whether the text field is displayed with error style or not.\n * @see {@link TextFieldProps#hasError}\n */\n hasError?: boolean;\n /**\n * Whether the text box should be focused upon closing the suggestions or not.\n */\n shouldFocusOnClose?: boolean;\n /**\n * The helper message of the text field.\n * @see {@link TextFieldProps#helper}\n */\n helper?: string;\n /**\n * The icon of the text field (SVG path).\n * @see {@link TextFieldProps#icon}\n */\n icon?: string;\n /**\n * Whether the component is disabled or not.\n * @see {@link TextFieldProps#isDisabled}\n */\n isDisabled?: boolean;\n /**\n * Whether the component is required or not.\n * @see {@link TextFieldProps#isRequired}\n */\n isRequired?: boolean;\n /**\n * Whether the text field is displayed with valid style or not.\n * @see {@link TextFieldProps#isValid}\n */\n isValid?: boolean;\n /**\n * The label of the text field displayed in a label tag.\n * @see {@link TextFieldProps#label}\n */\n label?: string;\n /**\n * The placeholder message of the text field.\n * @see {@link TextFieldProps#placeholder}\n */\n placeholder?: string;\n /** List of suggestions to display during autocomplete. */\n children: React.ReactNode;\n /**\n * The list of chips to be displayed before the text field input.\n */\n chips?: React.ReactNode;\n /**\n * The value of the text field.\n * @see {@link TextFieldProps#value}\n */\n value: string;\n /**\n * Whether the suggestions from the autocomplete should be displayed or not.\n * @see {@link DropdownProps#isOpen}\n */\n isOpen: boolean;\n /**\n * The native input name property.\n * @see {@link TextFieldProps#name}\n */\n name?: string;\n /**\n * Whether a click in the Autocomplete dropdown would close it or not.\n * @see {@link DropdownProps#closeOnClick}\n */\n closeOnClick?: boolean;\n /**\n * Whether a click anywhere out of the Autocomplete would close it or not.\n * @see {@link DropdownProps#closeOnClickAway}\n */\n closeOnClickAway?: boolean;\n /**\n * Whether an escape key press would close the Autocomplete or not.\n * @see {@link DropdownProps#closeOnEscape}\n */\n closeOnEscape?: boolean;\n /**\n * Whether the focus should go back on the anchor when dropdown closes and focus is within.\n * @see {@link DropdownProps#focusAnchorOnClose}\n */\n focusAnchorOnClose?: DropdownProps['focusAnchorOnClose'];\n /**\n * The function called on blur.\n * @see {@link TextFieldProps#onBlur}\n */\n onBlur?(event: React.FocusEvent): void;\n /**\n * On change callback.\n * @see {@link TextFieldProps#onChange}\n */\n onChange(value: string, name?: string, event?: SyntheticEvent): void;\n /**\n * The function called on close.\n * @see {@link DropdownProps#onClose}\n */\n onClose?(): void;\n /**\n * The function called on focus.\n * @see {@link TextFieldProps#onFocus}\n */\n onFocus?(event: React.FocusEvent): void;\n /**\n * The function called when the bottom of the dropdown is reached.\n * @see {@link DropdownProps#onInfiniteScroll}\n */\n onInfiniteScroll?(): void;\n /**\n * Props forwarded to the underlying TextField component.\n * Only the props not managed by the Autocomplete can be set.\n * @see {@link TextFieldProps}\n */\n textFieldProps?: Partial<TextFieldProps>;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Autocomplete';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<AutocompleteProps> = {\n anchorToInput: false,\n closeOnClick: false,\n closeOnClickAway: true,\n closeOnEscape: true,\n shouldFocusOnClose: false,\n};\n\n/**\n * Autocomplete component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Autocomplete = forwardRef<AutocompleteProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme();\n const { disabledStateProps, otherProps } = useDisableStateProps(props);\n const {\n anchorToInput = DEFAULT_PROPS.anchorToInput,\n children,\n chips,\n className,\n closeOnClick = DEFAULT_PROPS.closeOnClick,\n closeOnClickAway = DEFAULT_PROPS.closeOnClickAway,\n closeOnEscape = DEFAULT_PROPS.closeOnEscape,\n error,\n fitToAnchorWidth,\n hasError,\n helper,\n icon,\n inputRef,\n clearButtonProps,\n isRequired,\n isOpen,\n isValid,\n label,\n name,\n offset,\n onBlur,\n onChange,\n onClose,\n onFocus,\n onInfiniteScroll,\n placeholder,\n placement,\n shouldFocusOnClose = DEFAULT_PROPS.shouldFocusOnClose,\n theme = defaultTheme,\n value,\n textFieldProps = {},\n focusAnchorOnClose,\n ...forwardedProps\n } = otherProps;\n const inputAnchorRef = useRef<HTMLElement>(null);\n const textFieldRef = useRef(null);\n useFocus(inputAnchorRef.current, !isOpen && shouldFocusOnClose);\n\n return (\n <div ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>\n <TextField\n {...textFieldProps}\n chips={chips}\n error={error}\n hasError={hasError}\n helper={helper}\n icon={icon}\n inputRef={mergeRefs(inputAnchorRef as React.RefObject<HTMLInputElement>, inputRef)}\n clearButtonProps={clearButtonProps}\n {...disabledStateProps}\n isRequired={isRequired}\n isValid={isValid}\n label={label}\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n placeholder={placeholder}\n textFieldRef={textFieldRef}\n theme={theme}\n value={value}\n />\n <Dropdown\n anchorRef={anchorToInput ? inputAnchorRef : textFieldRef}\n closeOnClick={closeOnClick}\n closeOnClickAway={closeOnClickAway}\n closeOnEscape={closeOnEscape}\n focusAnchorOnClose={focusAnchorOnClose}\n fitToAnchorWidth={fitToAnchorWidth}\n isOpen={isOpen}\n offset={offset}\n onClose={onClose}\n onInfiniteScroll={onInfiniteScroll}\n placement={placement}\n shouldFocusOnOpen={false}\n theme={theme}\n >\n {children}\n </Dropdown>\n </div>\n );\n});\nAutocomplete.displayName = COMPONENT_NAME;\nAutocomplete.className = CLASSNAME;\nAutocomplete.defaultProps = DEFAULT_PROPS;\n","import { ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { mdiClose } from '@lumx/icons';\n\nimport { Autocomplete, AutocompleteProps, Chip, HorizontalAlignment, Icon, Size } from '@lumx/react';\nimport { getRootClassName } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\n\nimport { useDisableStateProps } from '@lumx/react/utils/disabled/useDisableStateProps';\n\n/**\n * Defines the props of the component.\n */\nexport interface AutocompleteMultipleProps extends AutocompleteProps {\n /** Selected values. */\n values: any[];\n /** Alignment of the chips in the autocomplete. */\n chipsAlignment?: HorizontalAlignment;\n /** Selected value render function. Default: Renders the value inside of a Chip. */\n selectedChipRender(\n choice: any,\n index: number,\n onClear?: (event: React.MouseEvent, choice: any) => void,\n isDisabled?: boolean,\n ): ReactNode | string;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'AutocompleteMultiple';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<AutocompleteMultipleProps> = {\n closeOnClickAway: true,\n closeOnEscape: true,\n selectedChipRender(choice, index, onClear, isDisabled) {\n const onClick = (event: React.MouseEvent) => onClear && onClear(event, choice);\n return (\n <Chip\n key={index}\n after={onClear && <Icon icon={mdiClose} size={Size.xxs} />}\n isDisabled={isDisabled}\n size={Size.s}\n onAfterClick={onClick}\n onClick={onClick}\n >\n {choice}\n </Chip>\n );\n },\n values: [],\n};\n\n/**\n * AutocompleteMultiple component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const AutocompleteMultiple = forwardRef<AutocompleteMultipleProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme();\n const { disabledStateProps, otherProps } = useDisableStateProps(props);\n const {\n anchorToInput,\n children,\n // `chipsAlignment` needs to be here to remove it from `forwardedProps`.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n chipsAlignment,\n className,\n closeOnClickAway = DEFAULT_PROPS.closeOnClickAway,\n closeOnEscape = DEFAULT_PROPS.closeOnEscape,\n fitToAnchorWidth,\n hasError,\n helper,\n icon,\n inputRef,\n clearButtonProps,\n isRequired,\n isOpen,\n isValid,\n label,\n name,\n offset,\n onBlur,\n onChange,\n onClear,\n onClose,\n onFocus,\n onInfiniteScroll,\n onKeyDown,\n placeholder,\n placement,\n selectedChipRender = DEFAULT_PROPS.selectedChipRender,\n shouldFocusOnClose,\n theme = defaultTheme,\n type,\n value,\n values = DEFAULT_PROPS.values,\n ...forwardedProps\n } = otherProps;\n\n return (\n <Autocomplete\n ref={ref}\n {...forwardedProps}\n anchorToInput={anchorToInput}\n className={classNames(className, CLASSNAME)}\n name={name}\n value={value}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n shouldFocusOnClose={shouldFocusOnClose}\n onFocus={onFocus}\n hasError={hasError}\n helper={helper}\n icon={icon}\n inputRef={inputRef}\n chips={values && values.map((chip: any, index: number) => selectedChipRender?.(chip, index, onClear))}\n {...disabledStateProps}\n isRequired={isRequired}\n clearButtonProps={clearButtonProps}\n isValid={isValid}\n label={label}\n placeholder={placeholder}\n theme={theme}\n type={type}\n isOpen={isOpen}\n closeOnClick={false}\n closeOnClickAway={closeOnClickAway}\n closeOnEscape={closeOnEscape}\n onClose={onClose}\n offset={offset}\n placement={placement}\n fitToAnchorWidth={fitToAnchorWidth}\n onInfiniteScroll={onInfiniteScroll}\n >\n {children}\n </Autocomplete>\n );\n});\nAutocompleteMultiple.displayName = COMPONENT_NAME;\nAutocompleteMultiple.className = CLASSNAME;\nAutocompleteMultiple.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","anchorToInput","closeOnClick","closeOnClickAway","closeOnEscape","shouldFocusOnClose","Autocomplete","forwardRef","props","ref","defaultTheme","useTheme","disabledStateProps","otherProps","useDisableStateProps","children","chips","className","error","fitToAnchorWidth","hasError","helper","icon","inputRef","clearButtonProps","isRequired","isOpen","isValid","label","name","offset","onBlur","onChange","onClose","onFocus","onInfiniteScroll","placeholder","placement","theme","value","textFieldProps","focusAnchorOnClose","forwardedProps","inputAnchorRef","useRef","textFieldRef","useFocus","current","_jsxs","classNames","_jsx","TextField","mergeRefs","Dropdown","anchorRef","shouldFocusOnOpen","displayName","defaultProps","selectedChipRender","choice","index","onClear","isDisabled","onClick","event","Chip","after","Icon","mdiClose","size","Size","xxs","s","onAfterClick","values","AutocompleteMultiple","chipsAlignment","onKeyDown","type","map","chip"],"mappings":";;;;;;;;;;;;;;;;AAiLA;AACA;AACA;AACA,MAAMA,gBAAc,GAAG,cAAc,CAAA;;AAErC;AACA;AACA;AACA,MAAMC,WAAS,GAAGC,gBAAgB,CAACF,gBAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,eAAyC,GAAG;AAC9CC,EAAAA,aAAa,EAAE,KAAK;AACpBC,EAAAA,YAAY,EAAE,KAAK;AACnBC,EAAAA,gBAAgB,EAAE,IAAI;AACtBC,EAAAA,aAAa,EAAE,IAAI;AACnBC,EAAAA,kBAAkB,EAAE,KAAA;AACxB,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,GAAGC,UAAU,CAAoC,CAACC,KAAK,EAAEC,GAAG,KAAK;AACtF,EAAA,MAAMC,YAAY,GAAGC,QAAQ,EAAE,CAAA;EAC/B,MAAM;IAAEC,kBAAkB;AAAEC,IAAAA,UAAAA;AAAW,GAAC,GAAGC,oBAAoB,CAACN,KAAK,CAAC,CAAA;EACtE,MAAM;IACFP,aAAa,GAAGD,eAAa,CAACC,aAAa;IAC3Cc,QAAQ;IACRC,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MAAM,CAACK,GAAG,CAAC,CAACC,IAAS,EAAEpB,KAAa,KAAKF,kBAAkB,GAAGsB,IAAI,EAAEpB,KAAK,EAAEC,OAAO,CAAC,CAAE;AAAA,IAAA,GAClGjD,kBAAkB;AACtBa,IAAAA,UAAU,EAAEA,UAAW;AACvBD,IAAAA,gBAAgB,EAAEA,gBAAiB;AACnCG,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,KAAK,EAAEA,KAAM;AACbQ,IAAAA,WAAW,EAAEA,WAAY;AACzBE,IAAAA,KAAK,EAAEA,KAAM;AACbwC,IAAAA,IAAI,EAAEA,IAAK;AACXpD,IAAAA,MAAM,EAAEA,MAAO;AACfxB,IAAAA,YAAY,EAAE,KAAM;AACpBC,IAAAA,gBAAgB,EAAEA,gBAAiB;AACnCC,IAAAA,aAAa,EAAEA,aAAc;AAC7B6B,IAAAA,OAAO,EAAEA,OAAQ;AACjBH,IAAAA,MAAM,EAAEA,MAAO;AACfO,IAAAA,SAAS,EAAEA,SAAU;AACrBlB,IAAAA,gBAAgB,EAAEA,gBAAiB;AACnCgB,IAAAA,gBAAgB,EAAEA,gBAAiB;AAAApB,IAAAA,QAAA,EAElCA,QAAAA;AAAQ,GACC,CAAC,CAAA;AAEvB,CAAC,EAAC;AACF4D,oBAAoB,CAACnB,WAAW,GAAG3D,cAAc,CAAA;AACjD8E,oBAAoB,CAAC1D,SAAS,GAAGnB,SAAS,CAAA;AAC1C6E,oBAAoB,CAAClB,YAAY,GAAGzD,aAAa;;;;"}
|
|
@@ -3,7 +3,7 @@ import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/classN
|
|
|
3
3
|
import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
4
4
|
import { f as forwardRef } from '../forwardRef-8bce732e.js';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
-
import { T as Thumbnail } from '../Thumbnail-
|
|
6
|
+
import { T as Thumbnail } from '../Thumbnail-d2001ccb.js';
|
|
7
7
|
import { Size, Theme, AspectRatio } from '@lumx/core/js/constants';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -81,4 +81,4 @@ Avatar.className = CLASSNAME;
|
|
|
81
81
|
Avatar.defaultProps = DEFAULT_PROPS;
|
|
82
82
|
|
|
83
83
|
export { Avatar };
|
|
84
|
-
//# sourceMappingURL=avatar-
|
|
84
|
+
//# sourceMappingURL=avatar-778d7df6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar-
|
|
1
|
+
{"version":3,"file":"avatar-778d7df6.js","sources":["../../../src/components/avatar/Avatar.tsx"],"sourcesContent":["import { KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AspectRatio, Size, Theme, Thumbnail, ThumbnailProps } from '@lumx/react';\n\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\n/**\n * Avatar sizes.\n */\nexport type AvatarSize = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface AvatarProps extends GenericProps, HasTheme {\n /** Action toolbar content. */\n actions?: ReactNode;\n /** Image alternative text. */\n alt: string;\n /** Badge. */\n badge?: ReactElement;\n /** Image URL. */\n image: string;\n /** Props to pass to the link wrapping the thumbnail. */\n linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n /** On click callback. */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /** On key press callback. */\n onKeyPress?: KeyboardEventHandler<HTMLDivElement>;\n /** Size variant. */\n size?: AvatarSize;\n /** Props to pass to the thumbnail (minus those already set by the Avatar props). */\n thumbnailProps?: Omit<\n ThumbnailProps,\n 'image' | 'alt' | 'size' | 'theme' | 'align' | 'fillHeight' | 'variant' | 'aspectRatio'\n >;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Avatar';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<AvatarProps> = {\n size: Size.m,\n};\n\n/**\n * Avatar component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Avatar = forwardRef<AvatarProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme() || Theme.light;\n const {\n actions,\n alt,\n badge,\n className,\n image,\n linkProps,\n linkAs,\n onClick,\n onKeyPress,\n size = DEFAULT_PROPS.size,\n theme = defaultTheme,\n thumbnailProps,\n ...forwardedProps\n } = props;\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, size, theme }))}\n >\n <Thumbnail\n linkProps={linkProps}\n linkAs={linkAs}\n className={`${CLASSNAME}__thumbnail`}\n onClick={onClick}\n onKeyPress={onKeyPress}\n {...thumbnailProps}\n aspectRatio={AspectRatio.square}\n size={size}\n image={image}\n alt={alt}\n theme={theme}\n />\n {actions && <div className={`${CLASSNAME}__actions`}>{actions}</div>}\n {badge && <div className={`${CLASSNAME}__badge`}>{badge}</div>}\n </div>\n );\n});\nAvatar.displayName = COMPONENT_NAME;\nAvatar.className = CLASSNAME;\nAvatar.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","m","Avatar","forwardRef","props","ref","defaultTheme","useTheme","Theme","light","actions","alt","badge","className","image","linkProps","linkAs","onClick","onKeyPress","theme","thumbnailProps","forwardedProps","_jsxs","classNames","handleBasicClasses","prefix","children","_jsx","Thumbnail","aspectRatio","AspectRatio","square","displayName","default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,EAAEC,WAAW,CAACC,MAAO;AAChChC,MAAAA,IAAI,EAAEA,IAAK;AACXe,MAAAA,KAAK,EAAEA,KAAM;AACbH,MAAAA,GAAG,EAAEA,GAAI;AACTQ,MAAAA,KAAK,EAAEA,KAAAA;AAAM,KAChB,CAAC,EACDT,OAAO,iBAAIiB,GAAA,CAAA,KAAA,EAAA;MAAKd,SAAS,EAAE,CAAGjB,EAAAA,SAAS,CAAY,SAAA,CAAA;AAAA8B,MAAAA,QAAA,EAAEhB,OAAAA;AAAO,KAAM,CAAC,EACnEE,KAAK,iBAAIe,GAAA,CAAA,KAAA,EAAA;MAAKd,SAAS,EAAE,CAAGjB,EAAAA,SAAS,CAAU,OAAA,CAAA;AAAA8B,MAAAA,QAAA,EAAEd,KAAAA;AAAK,KAAM,CAAC,CAAA;AAAA,GAC7D,CAAC,CAAA;AAEd,CAAC,EAAC;AACFV,MAAM,CAAC8B,WAAW,GAAGrC,cAAc,CAAA;AACnCO,MAAM,CAACW,SAAS,GAAGjB,SAAS,CAAA;AAC5BM,MAAM,CAAC+B,YAAY,GAAGnC,aAAa;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { a as Button, B as ButtonEmphasis } from '../Button-
|
|
2
|
-
export { I as IconButton } from '../IconButton-
|
|
1
|
+
export { a as Button, B as ButtonEmphasis } from '../Button-f382ee1c.js';
|
|
2
|
+
export { I as IconButton } from '../IconButton-1790b47e.js';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { getRootClassName } from '@lumx/core/js/utils/className';
|
|
5
5
|
import { f as forwardRef } from '../forwardRef-8bce732e.js';
|
|
@@ -45,4 +45,4 @@ ButtonGroup.className = CLASSNAME;
|
|
|
45
45
|
ButtonGroup.defaultProps = DEFAULT_PROPS;
|
|
46
46
|
|
|
47
47
|
export { ButtonGroup };
|
|
48
|
-
//# sourceMappingURL=button-
|
|
48
|
+
//# sourceMappingURL=button-4aff084a.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-
|
|
1
|
+
{"version":3,"file":"button-4aff084a.js","sources":["../../../src/components/button/ButtonGroup.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { GenericProps } from '@lumx/react/utils/type';\nimport { getRootClassName } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\n/**\n * Defines the props of the component\n */\nexport interface ButtonGroupProps extends GenericProps {\n /**\n * Children\n */\n children?: React.ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ButtonGroup';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ButtonGroupProps> = {};\n\n/**\n * ButtonGroup component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ButtonGroup = forwardRef<ButtonGroupProps, HTMLDivElement>((props, ref) => {\n const { children, className, ...forwardedProps } = props;\n\n return (\n <div ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>\n {children}\n </div>\n );\n});\nButtonGroup.displayName = COMPONENT_NAME;\nButtonGroup.className = CLASSNAME;\nButtonGroup.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","ButtonGroup","forwardRef","props","ref","children","className","forwardedProps","_jsx","classNames","displayName","defaultProps"],"mappings":";;;;;;;AAgBA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,aAAa,CAAA;;AAEpC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAwC,GAAG,EAAE,CAAA;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,WAAW,GAAGC,UAAU,CAAmC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACpF,MAAM;IAAEC,QAAQ;IAAEC,SAAS;IAAE,GAAGC,cAAAA;AAAe,GAAC,GAAGJ,KAAK,CAAA;AAExD,EAAA,oBACIK,GAAA,CAAA,KAAA,EAAA;AAAKJ,IAAAA,GAAG,EAAEA,GAAI;AAAA,IAAA,GAAKG,cAAc;AAAED,IAAAA,SAAS,EAAEG,UAAU,CAACH,SAAS,EAAER,SAAS,CAAE;AAAAO,IAAAA,QAAA,EAC1EA,QAAAA;AAAQ,GACR,CAAC,CAAA;AAEd,CAAC,EAAC;AACFJ,WAAW,CAACS,WAAW,GAAGb,cAAc,CAAA;AACxCI,WAAW,CAACK,SAAS,GAAGR,SAAS,CAAA;AACjCG,WAAW,CAACU,YAAY,GAAGX,aAAa;;;;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { mdiCheck } from '@lumx/icons
|
|
4
|
-
import { mdiMinus } from '@lumx/icons/esm/minus';
|
|
3
|
+
import { mdiMinus, mdiCheck } from '@lumx/icons';
|
|
5
4
|
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
6
5
|
import { u as useId } from '../useId-3a1facc0.js';
|
|
7
6
|
import { u as useMergeRefs } from '../mergeRefs-f0d7d6ea.js';
|
|
@@ -12,7 +11,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
12
11
|
import { InputLabel } from './input-label-30d199c3.js';
|
|
13
12
|
import { InputHelper } from './input-helper-2e4e49fd.js';
|
|
14
13
|
import { Theme } from '@lumx/core/js/constants';
|
|
15
|
-
import { Icon } from './icon-
|
|
14
|
+
import { Icon } from './icon-a00d698b.js';
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* Intermediate state of checkbox.
|
|
@@ -139,4 +138,4 @@ Checkbox.className = CLASSNAME;
|
|
|
139
138
|
Checkbox.defaultProps = DEFAULT_PROPS;
|
|
140
139
|
|
|
141
140
|
export { Checkbox };
|
|
142
|
-
//# sourceMappingURL=checkbox-
|
|
141
|
+
//# sourceMappingURL=checkbox-a448ca6c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-a448ca6c.js","sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, { InputHTMLAttributes, ReactNode, SyntheticEvent } from 'react';\n\nimport classNames from 'classnames';\n\nimport { mdiCheck, mdiMinus } from '@lumx/icons';\n\nimport { Icon, InputHelper, InputLabel, Theme } from '@lumx/react';\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { useId } from '@lumx/react/hooks/useId';\nimport { useMergeRefs } from '@lumx/react/utils/react/mergeRefs';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\nimport { useDisableStateProps } from '@lumx/react/utils/disabled/useDisableStateProps';\nimport { HasAriaDisabled } from '@lumx/react/utils/type/HasAriaDisabled';\n\n/**\n * Intermediate state of checkbox.\n */\nconst INTERMEDIATE_STATE = 'intermediate';\n\n/**\n * Defines the props of the component.\n */\nexport interface CheckboxProps extends GenericProps, HasTheme, HasAriaDisabled {\n /** Helper text. */\n helper?: string;\n /** Native input id property. */\n id?: string;\n /** Native input ref. */\n inputRef?: React.Ref<HTMLInputElement>;\n /** Whether it is checked or not or intermediate. */\n isChecked?: boolean | 'intermediate';\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Label text. */\n label?: ReactNode;\n /** Native input name property. */\n name?: string;\n /** Native input value property. */\n value?: string;\n /** optional props for input */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n /** On change callback. */\n onChange?(isChecked: boolean, value?: string, name?: string, event?: SyntheticEvent): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Checkbox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<CheckboxProps> = {};\n\n/**\n * Checkbox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Checkbox = forwardRef<CheckboxProps, HTMLDivElement>((props, ref) => {\n const { isAnyDisabled, disabledStateProps, otherProps } = useDisableStateProps(props);\n const defaultTheme = useTheme() || Theme.light;\n const {\n checked,\n className,\n helper,\n id,\n inputRef,\n isChecked = checked,\n label,\n name,\n onChange,\n theme = defaultTheme,\n value,\n inputProps = {},\n ...forwardedProps\n } = otherProps;\n const localInputRef = React.useRef<HTMLInputElement>(null);\n const generatedInputId = useId();\n const inputId = id || generatedInputId;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(!isChecked, value, name, event);\n }\n };\n\n const intermediateState = isChecked === INTERMEDIATE_STATE;\n\n React.useEffect(() => {\n const input = localInputRef.current;\n if (input) input.indeterminate = intermediateState;\n }, [intermediateState]);\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n // Whether state is intermediate class name will \"-checked\"\n isChecked: intermediateState ? true : isChecked,\n isDisabled: isAnyDisabled,\n isUnchecked: !isChecked,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n >\n <div className={`${CLASSNAME}__input-wrapper`}>\n <input\n ref={useMergeRefs(inputRef, localInputRef)}\n type=\"checkbox\"\n id={inputId}\n className={`${CLASSNAME}__input-native`}\n {...disabledStateProps}\n name={name}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n aria-describedby={helper ? `${inputId}-helper` : undefined}\n aria-checked={intermediateState ? 'mixed' : Boolean(isChecked)}\n readOnly={inputProps.readOnly || disabledStateProps['aria-disabled']}\n {...inputProps}\n />\n\n <div className={`${CLASSNAME}__input-placeholder`}>\n <div className={`${CLASSNAME}__input-background`} />\n\n <div className={`${CLASSNAME}__input-indicator`}>\n <Icon icon={intermediateState ? mdiMinus : mdiCheck} />\n </div>\n </div>\n </div>\n\n <div className={`${CLASSNAME}__content`}>\n {label && (\n <InputLabel htmlFor={inputId} className={`${CLASSNAME}__label`} theme={theme}>\n {label}\n </InputLabel>\n )}\n {helper && (\n <InputHelper id={`${inputId}-helper`} className={`${CLASSNAME}__helper`} theme={theme}>\n {helper}\n </InputHelper>\n )}\n </div>\n </div>\n );\n});\nCheckbox.displayName = COMPONENT_NAME;\nCheckbox.className = CLASSNAME;\nCheckbox.defaultProps = DEFAULT_PROPS;\n"],"names":["INTERMEDIATE_STATE","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","Checkbox","forwardRef","props","ref","isAnyDisabled","disabledStateProps","otherProps","useDisableStateProps","defaultTheme","useTheme","Theme","light","checked","className","helper","id","inputRef","isChecked","label","name","onChange","theme","value","inputProps","forwardedProps","localInputRef","React","useRef","generatedInputId","useId","inputId","handleChange","event","intermediateState","useEffect","input","current","indeterminate","_jsxs","classNames","handleBasicClasses","isDisabled","isUnchecked","prefix","children","_jsx","useMergeRefs","type","undefined","Boolean","readOnly","Icon","icon","mdiMinus","mdiCheck","InputLabel","htmlFor","InputHelper","displayName","defaultProps"],"mappings":";;;;;;;;;;;;;;;AAgBA;AACA;AACA;AACA,MAAMA,kBAAkB,GAAG,cAAc,CAAA;;AAEzC;AACA;AACA;;AAwBA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,UAAU,CAAA;;AAEjC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAqC,GAAG,EAAE,CAAA;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,QAAQ,GAAGC,UAAU,CAAgC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC9E,MAAM;IAAEC,aAAa;IAAEC,kBAAkB;AAAEC,IAAAA,UAAAA;AAAW,GAAC,GAAGC,oBAAoB,CAACL,KAAK,CAAC,CAAA;EACrF,MAAMM,YAAY,GAAGC,QAAQ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AS,CAAoB,iBAAA,CAAA;UAAA+C,QAAA,eAC5CC,GAAA,CAACM,IAAI,EAAA;AAACC,YAAAA,IAAI,EAAEnB,iBAAiB,GAAGoB,QAAQ,GAAGC,QAAAA;WAAW,CAAA;AAAC,SACtD,CAAC,CAAA;AAAA,OACL,CAAC,CAAA;KACL,CAAC,eAENhB,IAAA,CAAA,KAAA,EAAA;MAAKzB,SAAS,EAAE,CAAGhB,EAAAA,SAAS,CAAY,SAAA,CAAA;AAAA+C,MAAAA,QAAA,EACnC1B,CAAAA,KAAK,iBACF2B,GAAA,CAACU,UAAU,EAAA;AAACC,QAAAA,OAAO,EAAE1B,OAAQ;QAACjB,SAAS,EAAE,CAAGhB,EAAAA,SAAS,CAAU,OAAA,CAAA;AAACwB,QAAAA,KAAK,EAAEA,KAAM;AAAAuB,QAAAA,QAAA,EACxE1B,KAAAA;AAAK,OACE,CACf,EACAJ,MAAM,iBACH+B,GAAA,CAACY,WAAW,EAAA;QAAC1C,EAAE,EAAE,CAAGe,EAAAA,OAAO,CAAU,OAAA,CAAA;QAACjB,SAAS,EAAE,CAAGhB,EAAAA,SAAS,CAAW,QAAA,CAAA;AAACwB,QAAAA,KAAK,EAAEA,KAAM;AAAAuB,QAAAA,QAAA,EACjF9B,MAAAA;AAAM,OACE,CAChB,CAAA;AAAA,KACA,CAAC,CAAA;AAAA,GACL,CAAC,CAAA;AAEd,CAAC,EAAC;AACFd,QAAQ,CAAC0D,WAAW,GAAG9D,cAAc,CAAA;AACrCI,QAAQ,CAACa,SAAS,GAAGhB,SAAS,CAAA;AAC9BG,QAAQ,CAAC2D,YAAY,GAAG5D,aAAa;;;;"}
|
|
@@ -4,7 +4,7 @@ import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/classN
|
|
|
4
4
|
import { f as forwardRef } from '../forwardRef-8bce732e.js';
|
|
5
5
|
import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
6
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
-
import { Avatar } from './avatar-
|
|
7
|
+
import { Avatar } from './avatar-778d7df6.js';
|
|
8
8
|
import { Theme, Size } from '@lumx/core/js/constants';
|
|
9
9
|
import { Tooltip } from './tooltip-dcb43bbe.js';
|
|
10
10
|
|
|
@@ -136,4 +136,4 @@ CommentBlock.className = CLASSNAME;
|
|
|
136
136
|
CommentBlock.defaultProps = DEFAULT_PROPS;
|
|
137
137
|
|
|
138
138
|
export { CommentBlock, CommentBlockVariant };
|
|
139
|
-
//# sourceMappingURL=comment-block-
|
|
139
|
+
//# sourceMappingURL=comment-block-bcbedf3c.js.map
|
package/_internal/components/{comment-block-bb6a0603.js.map → comment-block-bcbedf3c.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment-block-bb6a0603.js","sources":["../../../src/components/comment-block/CommentBlock.tsx"],"sourcesContent":["import { Children, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Avatar, Size, Theme, Tooltip } from '@lumx/react';\nimport { GenericProps, HasTheme, ValueOf } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { AvatarProps } from '../avatar/Avatar';\n\n/**\n * Comment block variants.\n */\nexport const CommentBlockVariant = {\n indented: 'indented',\n linear: 'linear',\n} as const;\nexport type CommentBlockVariant = ValueOf<typeof CommentBlockVariant>;\n\n/**\n * Defines the props of the component.\n */\nexport interface CommentBlockProps extends GenericProps, HasTheme {\n /** Action toolbar content. */\n actions?: ReactNode;\n /** Props to pass to the avatar. */\n avatarProps: AvatarProps;\n /** Comment block replies. */\n children?: ReactNode;\n /** Comment date with the minimal timestamp information (xx minutes, x hours, yesterday, 6 days, Month Day, Month Day Year)*/\n date?: string;\n /** Comment date with the full timestamp information (day, month, year, time) */\n fullDate?: string;\n /** Whether the component has actions to display or not. */\n hasActions?: boolean;\n /** Action toolbar header content. */\n headerActions?: ReactNode;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Whether the comment is relevant or not. */\n isRelevant?: boolean;\n /** Comment author name. */\n name?: React.ReactNode;\n /**\n * On click callback.\n * @deprecated Use avatarProps instead and/or inject a clickable component in `name`\n */\n onClick?(): void;\n /**\n * On mouse enter callback.\n * @deprecated Use avatarProps instead and/or inject a clickable component in `name`\n */\n onMouseEnter?(): void;\n /**\n * On mouse leave callback.\n * @deprecated Use avatarProps instead and/or inject a clickable component in `name`\n */\n onMouseLeave?(): void;\n /** Comment content. */\n text: ReactNode | string;\n /** Comment variant. */\n variant?: CommentBlockVariant;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'CommentBlock';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<CommentBlockProps> = {\n variant: CommentBlockVariant.indented,\n};\n\n/**\n * CommentBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const CommentBlock = forwardRef<CommentBlockProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme() || Theme.light;\n const {\n actions,\n avatarProps,\n children,\n className,\n date,\n fullDate,\n hasActions,\n headerActions,\n isOpen,\n isRelevant,\n name,\n onClick,\n onMouseEnter,\n onMouseLeave,\n text,\n theme = defaultTheme,\n variant = DEFAULT_PROPS.variant,\n ...forwardedProps\n } = props;\n const hasChildren = Children.count(children) > 0;\n\n return (\n <div\n ref={ref}\n className={classNames(\n className,\n handleBasicClasses({\n hasChildren: hasChildren && isOpen,\n hasIndentedChildren: hasChildren && variant === CommentBlockVariant.indented,\n hasLinearChildren: hasChildren && variant === CommentBlockVariant.linear,\n isRelevant,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n {...forwardedProps}\n >\n <div className={`${CLASSNAME}__wrapper`}>\n <div className={`${CLASSNAME}__avatar`}>\n <Avatar {...avatarProps} size={Size.m} onClick={onClick} />\n </div>\n\n <div className={`${CLASSNAME}__container`}>\n <div className={`${CLASSNAME}__content`}>\n <div className={`${CLASSNAME}__meta`}>\n {name && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <span\n className={`${CLASSNAME}__name`}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n {name}\n </span>\n )}\n {headerActions && <span className={`${CLASSNAME}__header-actions`}>{headerActions}</span>}\n </div>\n\n <div className={`${CLASSNAME}__text`}>{text}</div>\n {date &&\n (fullDate ? (\n <Tooltip label={fullDate} placement=\"top\">\n <span className={`${CLASSNAME}__date`}>{date}</span>\n </Tooltip>\n ) : (\n <span className={`${CLASSNAME}__date`}>{date}</span>\n ))}\n </div>\n {hasActions && <div className={`${CLASSNAME}__actions`}>{actions}</div>}\n </div>\n </div>\n {hasChildren && isOpen && <div className={`${CLASSNAME}__children`}>{children}</div>}\n </div>\n );\n});\nCommentBlock.displayName = COMPONENT_NAME;\nCommentBlock.className = CLASSNAME;\nCommentBlock.defaultProps = DEFAULT_PROPS;\n"],"names":["CommentBlockVariant","indented","linear","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","variant","CommentBlock","forwardRef","props","ref","defaultTheme","useTheme","Theme","light","actions","avatarProps","children","className","date","fullDate","hasActions","headerActions","isOpen","isRelevant","name","onClick","onMouseEnter","onMouseLeave","text","theme","forwardedProps","hasChildren","Children","count","_jsxs","classNames","handleBasicClasses","hasIndentedChildren","hasLinearChildren","prefix","_jsx","Avatar","size","Size","m","Tooltip","label","placement","displayName","defaultProps"],"mappings":";;;;;;;;;;AAYA;AACA;AACA;AACO,MAAMA,mBAAmB,GAAG;AAC/BC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,MAAM,EAAE,QAAA;AACZ,EAAU;;AAGV;AACA;AACA;;AA2CA;AACA;AACA;AACA,MAAMC,cAAc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children, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Avatar, Size, Theme, Tooltip } from '@lumx/react';\nimport { GenericProps, HasTheme, ValueOf } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { AvatarProps } from '../avatar/Avatar';\n\n/**\n * Comment block variants.\n */\nexport const CommentBlockVariant = {\n indented: 'indented',\n linear: 'linear',\n} as const;\nexport type CommentBlockVariant = ValueOf<typeof CommentBlockVariant>;\n\n/**\n * Defines the props of the component.\n */\nexport interface CommentBlockProps extends GenericProps, HasTheme {\n /** Action toolbar content. */\n actions?: ReactNode;\n /** Props to pass to the avatar. */\n avatarProps: AvatarProps;\n /** Comment block replies. */\n children?: ReactNode;\n /** Comment date with the minimal timestamp information (xx minutes, x hours, yesterday, 6 days, Month Day, Month Day Year)*/\n date?: string;\n /** Comment date with the full timestamp information (day, month, year, time) */\n fullDate?: string;\n /** Whether the component has actions to display or not. */\n hasActions?: boolean;\n /** Action toolbar header content. */\n headerActions?: ReactNode;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Whether the comment is relevant or not. */\n isRelevant?: boolean;\n /** Comment author name. */\n name?: React.ReactNode;\n /**\n * On click callback.\n * @deprecated Use avatarProps instead and/or inject a clickable component in `name`\n */\n onClick?(): void;\n /**\n * On mouse enter callback.\n * @deprecated Use avatarProps instead and/or inject a clickable component in `name`\n */\n onMouseEnter?(): void;\n /**\n * On mouse leave callback.\n * @deprecated Use avatarProps instead and/or inject a clickable component in `name`\n */\n onMouseLeave?(): void;\n /** Comment content. */\n text: ReactNode | string;\n /** Comment variant. */\n variant?: CommentBlockVariant;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'CommentBlock';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<CommentBlockProps> = {\n variant: CommentBlockVariant.indented,\n};\n\n/**\n * CommentBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const CommentBlock = forwardRef<CommentBlockProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme() || Theme.light;\n const {\n actions,\n avatarProps,\n children,\n className,\n date,\n fullDate,\n hasActions,\n headerActions,\n isOpen,\n isRelevant,\n name,\n onClick,\n onMouseEnter,\n onMouseLeave,\n text,\n theme = defaultTheme,\n variant = DEFAULT_PROPS.variant,\n ...forwardedProps\n } = props;\n const hasChildren = Children.count(children) > 0;\n\n return (\n <div\n ref={ref}\n className={classNames(\n className,\n handleBasicClasses({\n hasChildren: hasChildren && isOpen,\n hasIndentedChildren: hasChildren && variant === CommentBlockVariant.indented,\n hasLinearChildren: hasChildren && variant === CommentBlockVariant.linear,\n isRelevant,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n {...forwardedProps}\n >\n <div className={`${CLASSNAME}__wrapper`}>\n <div className={`${CLASSNAME}__avatar`}>\n <Avatar {...avatarProps} size={Size.m} onClick={onClick} />\n </div>\n\n <div className={`${CLASSNAME}__container`}>\n <div className={`${CLASSNAME}__content`}>\n <div className={`${CLASSNAME}__meta`}>\n {name && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <span\n className={`${CLASSNAME}__name`}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n {name}\n </span>\n )}\n {headerActions && <span className={`${CLASSNAME}__header-actions`}>{headerActions}</span>}\n </div>\n\n <div className={`${CLASSNAME}__text`}>{text}</div>\n {date &&\n (fullDate ? (\n <Tooltip label={fullDate} placement=\"top\">\n <span className={`${CLASSNAME}__date`}>{date}</span>\n </Tooltip>\n ) : (\n <span className={`${CLASSNAME}__date`}>{date}</span>\n ))}\n </div>\n {hasActions && <div className={`${CLASSNAME}__actions`}>{actions}</div>}\n </div>\n </div>\n {hasChildren && isOpen && <div className={`${CLASSNAME}__children`}>{children}</div>}\n </div>\n );\n});\nCommentBlock.displayName = COMPONENT_NAME;\nCommentBlock.className = CLASSNAME;\nCommentBlock.defaultProps = DEFAULT_PROPS;\n"],"names":["CommentBlockVariant","indented","linear","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","variant","CommentBlock","forwardRef","props","ref","defaultTheme","useTheme","Theme","light","actions","avatarProps","children","className","date","fullDate","hasActions","headerActions","isOpen","isRelevant","name","onClick","onMouseEnter","onMouseLeave","text","theme","forwardedProps","hasChildren","Children","count","_jsxs","classNames","handleBasicClasses","hasIndentedChildren","hasLinearChildren","prefix","_jsx","Avatar","size","Size","m","Tooltip","label","placement","displayName","defaultProps"],"mappings":";;;;;;;;;;AAYA;AACA;AACA;AACO,MAAMA,mBAAmB,GAAG;AAC/BC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,MAAM,EAAE,QAAA;AACZ,EAAU;;AAGV;AACA;AACA;;AA2CA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,cAAc,CAAA;;AAErC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAyC,GAAG;EAC9CC,OAAO,EAAEP,mBAAmB,CAACC,QAAAA;AACjC,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMO,YAAY,GAAGC,UAAU,CAAoC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACtF,MAAMC,YAAY,GAAGC,QAAQ,EAAE,IAAIC,KAAK,CAACC,KAAK,CAAA;EAC9C,MAAM;IACFC,OAAO;IACPC,WAAW;IACXC,QAAQ;IACRC,SAAS;IACTC,IAAI;IACJC,QAAQ;IACRC,UAAU;IACVC,aAAa;IACbC,MAAM;IACNC,UAAU;IACVC,IAAI;IACJC,OAAO;IACPC,YAA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tD,CAAC,CAAA;AAAA,SACL,CAAC,EACLE,UAAU,iBAAIoB,GAAA,CAAA,KAAA,EAAA;UAAKvB,SAAS,EAAE,CAAGf,EAAAA,SAAS,CAAY,SAAA,CAAA;AAAAc,UAAAA,QAAA,EAAEF,OAAAA;AAAO,SAAM,CAAC,CAAA;AAAA,OACtE,CAAC,CAAA;AAAA,KACL,CAAC,EACLiB,WAAW,IAAIT,MAAM,iBAAIkB,GAAA,CAAA,KAAA,EAAA;MAAKvB,SAAS,EAAE,CAAGf,EAAAA,SAAS,CAAa,UAAA,CAAA;AAAAc,MAAAA,QAAA,EAAEA,QAAAA;AAAQ,KAAM,CAAC,CAAA;AAAA,GACnF,CAAC,CAAA;AAEd,CAAC,EAAC;AACFV,YAAY,CAAC0C,WAAW,GAAG/C,cAAc,CAAA;AACzCK,YAAY,CAACW,SAAS,GAAGf,SAAS,CAAA;AAClCI,YAAY,CAAC2C,YAAY,GAAG7C,aAAa;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker-b6d4048e.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { mdiDragVertical } from '@lumx/icons
|
|
2
|
+
import { mdiDragVertical } from '@lumx/icons';
|
|
3
3
|
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
4
4
|
import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
5
5
|
import { f as forwardRef } from '../forwardRef-8bce732e.js';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
|
-
import { Icon } from './icon-
|
|
7
|
+
import { Icon } from './icon-a00d698b.js';
|
|
8
8
|
import { Theme, ColorPalette, Size } from '@lumx/core/js/constants';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -49,4 +49,4 @@ DragHandle.displayName = COMPONENT_NAME;
|
|
|
49
49
|
DragHandle.className = CLASSNAME;
|
|
50
50
|
|
|
51
51
|
export { DragHandle };
|
|
52
|
-
//# sourceMappingURL=drag-handle-
|
|
52
|
+
//# sourceMappingURL=drag-handle-137f71b6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drag-handle-137f71b6.js","sources":["../../../src/components/drag-handle/DragHandle.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { mdiDragVertical } from '@lumx/icons';\nimport { ColorPalette, Icon, Size, Theme } from '@lumx/react';\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\n/**\n * Defines the props of the component.\n */\nexport interface DragHandleProps extends GenericProps, HasTheme {}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'DragHandle';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * DragHandle component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const DragHandle = forwardRef<DragHandleProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme();\n const { className, theme = defaultTheme, ...forwardedProps } = props;\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme }))}\n >\n <Icon\n icon={mdiDragVertical}\n color={theme === Theme.dark ? ColorPalette.light : ColorPalette.dark}\n size={Size.xs}\n />\n </div>\n );\n});\nDragHandle.displayName = COMPONENT_NAME;\nDragHandle.className = CLASSNAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DragHandle","forwardRef","props","ref","defaultTheme","useTheme","className","theme","forwardedProps","_jsx","classNames","handleBasicClasses","prefix","children","Icon","icon","mdiDragVertical","color","Theme","dark","ColorPalette","light","size","Size","xs","displayName"],"mappings":";;;;;;;;;AAcA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,YAAY,CAAA;;AAEnC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,UAAU,GAAGC,UAAU,CAAkC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAClF,EAAA,MAAMC,YAAY,GAAGC,QAAQ,EAAE,CAAA;EAC/B,MAAM;IAAEC,SAAS;AAAEC,IAAAA,KAAK,GAAGH,YAAY;IAAE,GAAGI,cAAAA;AAAe,GAAC,GAAGN,KAAK,CAAA;AAEpE,EAAA,oBACIO,GAAA,CAAA,KAAA,EAAA;AACIN,IAAAA,GAAG,EAAEA,GAAI;AAAA,IAAA,GACLK,cAAc;AAClBF,IAAAA,SAAS,EAAEI,UAAU,CAACJ,SAAS,EAAEK,kBAAkB,CAAC;AAAEC,MAAAA,MAAM,EAAEd,SAAS;AAAES,MAAAA,KAAAA;AAAM,KAAC,CAAC,CAAE;IAAAM,QAAA,eAEnFJ,GAAA,CAACK,IAAI,EAAA;AACDC,MAAAA,IAAI,EAAEC,eAAgB;AACtBC,MAAAA,KAAK,EAAEV,KAAK,KAAKW,KAAK,CAACC,IAAI,GAAGC,YAAY,CAACC,KAAK,GAAGD,YAAY,CAACD,IAAK;MACrEG,IAAI,EAAEC,IAAI,CAACC,EAAAA;KACd,CAAA;AAAC,GACD,CAAC,CAAA;AAEd,CAAC,EAAC;AACFxB,UAAU,CAACyB,WAAW,GAAG5B,cAAc,CAAA;AACvCG,UAAU,CAACM,SAAS,GAAGR,SAAS;;;;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React__default, { Children, useRef } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { mdiChevronDown } from '@lumx/icons
|
|
4
|
-
import { mdiChevronUp } from '@lumx/icons/esm/chevron-up';
|
|
3
|
+
import { mdiChevronUp, mdiChevronDown } from '@lumx/icons';
|
|
5
4
|
import { i as isComponent } from '../isComponent-b9762ff1.js';
|
|
6
5
|
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
7
6
|
import { partitionMulti } from '@lumx/core/js/utils/collection/partitionMulti';
|
|
@@ -10,9 +9,9 @@ import { f as forwardRef } from '../forwardRef-8bce732e.js';
|
|
|
10
9
|
import { isEmpty } from '@lumx/core/js/utils/collection/isEmpty';
|
|
11
10
|
import { I as IS_BROWSER } from '../constants-d0e3f49e.js';
|
|
12
11
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
|
-
import { DragHandle } from './drag-handle-
|
|
12
|
+
import { DragHandle } from './drag-handle-137f71b6.js';
|
|
14
13
|
import { Theme, ColorPalette, Emphasis } from '@lumx/core/js/constants';
|
|
15
|
-
import { I as IconButton } from '../IconButton-
|
|
14
|
+
import { I as IconButton } from '../IconButton-1790b47e.js';
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* Component display name.
|
|
@@ -166,4 +165,4 @@ ExpansionPanel.className = CLASSNAME;
|
|
|
166
165
|
ExpansionPanel.defaultProps = DEFAULT_PROPS;
|
|
167
166
|
|
|
168
167
|
export { ExpansionPanel };
|
|
169
|
-
//# sourceMappingURL=expansion-panel-
|
|
168
|
+
//# sourceMappingURL=expansion-panel-38ed3d9f.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expansion-panel-38ed3d9f.js","sources":["../../../src/components/expansion-panel/ExpansionPanel.tsx"],"sourcesContent":["import React, { Children, PropsWithChildren, ReactNode, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { mdiChevronDown, mdiChevronUp } from '@lumx/icons';\n\nimport { ColorPalette, DragHandle, Emphasis, IconButton, IconButtonProps, Theme } from '@lumx/react';\nimport { GenericProps, HasCloseMode, HasTheme, isComponent } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { partitionMulti } from '@lumx/core/js/utils/collection/partitionMulti';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\nimport { isEmpty } from '@lumx/core/js/utils/collection/isEmpty';\nimport { IS_BROWSER } from '@lumx/react/constants';\n\n/**\n * Defines the props of the component.\n */\nexport interface ExpansionPanelProps extends GenericProps, HasCloseMode, HasTheme {\n /** Whether the expansion panel has a background. */\n hasBackground?: boolean;\n /** Whether the header has a divider. */\n hasHeaderDivider?: boolean;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Label text (overwritten if a `<header>` is provided in the children). */\n label?: string;\n /** On open callback. */\n onOpen?: (event: React.MouseEvent) => void;\n /** On close callback. */\n onClose?: (event: React.MouseEvent) => void;\n /** Props to pass to the toggle button (minus those already set by the ExpansionPanel props). */\n toggleButtonProps: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;\n /** On toggle open or close callback. */\n onToggleOpen?(shouldOpen: boolean, event: React.MouseEvent): void;\n /** Children */\n children?: React.ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ExpansionPanel';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ExpansionPanelProps> = {\n closeMode: 'unmount',\n};\n\nconst isDragHandle = isComponent(DragHandle);\nconst isHeader = isComponent('header');\nconst isFooter = isComponent('footer');\n\n/**\n * ExpansionPanel component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ExpansionPanel = forwardRef<ExpansionPanelProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme() || Theme.light;\n const {\n className,\n closeMode = DEFAULT_PROPS.closeMode,\n children: anyChildren,\n hasBackground,\n hasHeaderDivider,\n isOpen,\n label,\n onClose,\n onOpen,\n onToggleOpen,\n theme = defaultTheme,\n toggleButtonProps,\n ...forwardedProps\n } = props;\n\n const children: ReactNode[] = Children.toArray(anyChildren);\n\n // Partition children by types.\n const [[dragHandle], [header], [footer], content] = partitionMulti(children, [isDragHandle, isHeader, isFooter]);\n\n // Either take the header in children or create one with the label.\n const headerProps: PropsWithChildren<any> = React.isValidElement(header) ? header.props : {};\n const headerContent =\n React.Children.count(headerProps.children) > 0 ? (\n headerProps.children\n ) : (\n <span className={`${CLASSNAME}__label`}>{label}</span>\n );\n\n const toggleOpen = (event: React.MouseEvent) => {\n const shouldOpen = !isOpen;\n\n if (onOpen && shouldOpen) {\n onOpen(event);\n }\n if (onClose && !shouldOpen) {\n onClose(event);\n }\n if (onToggleOpen) {\n onToggleOpen(shouldOpen, event);\n }\n };\n\n const color = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;\n\n const rootClassName = classNames(\n className,\n handleBasicClasses({\n hasBackground,\n hasHeader: !isEmpty(headerProps.children),\n hasHeaderDivider,\n isClose: !isOpen,\n isDraggable: Boolean(dragHandle),\n isOpen,\n prefix: CLASSNAME,\n theme,\n }),\n );\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n // Children stay visible while the open/close transition is running\n const [isChildrenVisible, setChildrenVisible] = React.useState(isOpen);\n\n const isOpenRef = React.useRef(isOpen);\n React.useEffect(() => {\n if (isOpen || closeMode === 'hide') {\n setChildrenVisible(true);\n } else if (!IS_BROWSER) {\n // Outside a browser we can't wait for the transition\n setChildrenVisible(false);\n }\n isOpenRef.current = isOpen;\n }, [closeMode, isOpen]);\n\n // Change children's visibility on the transition end\n React.useEffect(() => {\n const { current: wrapper } = wrapperRef;\n if (!IS_BROWSER || !wrapper) {\n return undefined;\n }\n const onTransitionEnd = () => {\n setChildrenVisible(isOpenRef.current || closeMode === 'hide');\n };\n wrapper.addEventListener('transitionend', onTransitionEnd);\n return () => wrapper.removeEventListener('transitionend', onTransitionEnd);\n }, [closeMode]);\n\n return (\n <section ref={ref} {...forwardedProps} className={rootClassName}>\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}\n <header className={`${CLASSNAME}__header`} onClick={toggleOpen}>\n {dragHandle && <div className={`${CLASSNAME}__header-drag`}>{dragHandle}</div>}\n\n <div {...headerProps} className={`${CLASSNAME}__header-content`}>\n {headerContent}\n </div>\n\n <div className={`${CLASSNAME}__header-toggle`}>\n <IconButton\n {...toggleButtonProps}\n color={color}\n emphasis={Emphasis.low}\n icon={isOpen ? mdiChevronUp : mdiChevronDown}\n aria-expanded={isOpen || 'false'}\n />\n </div>\n </header>\n\n <div className={`${CLASSNAME}__wrapper`} ref={wrapperRef}>\n {(isOpen || isChildrenVisible) && (\n <div className={`${CLASSNAME}__container`}>\n <div className={`${CLASSNAME}__content`}>{content}</div>\n\n {footer && <div className={`${CLASSNAME}__footer`}>{footer}</div>}\n </div>\n )}\n </div>\n </section>\n );\n});\nExpansionPanel.displayName = COMPONENT_NAME;\nExpansionPanel.className = CLASSNAME;\nExpansionPanel.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","closeMode","isDragHandle","isComponent","DragHandle","isHeader","isFooter","ExpansionPanel","forwardRef","props","ref","defaultTheme","useTheme","Theme","light","className","children","anyChildren","hasBackground","hasHeaderDivider","isOpen","label","onClose","onOpen","onToggleOpen","theme","toggleButtonProps","forwardedProps","Children","toArray","dragHandle","header","footer","content","partitionMulti","headerProps","React","isValidElement","headerContent","count","_jsx","toggleOpen","event","shouldOpen","color","dark","ColorPalette","rootClassName","classNames","handleBasicClasses","hasHeader","isEmpty","isClose","isDraggable","Boolean","prefix","wrapperRef","useRef","isChildrenVisible","setChildrenVisible","useState","isOpenRef","useEffect","IS_BROWSER","current","wrapper","undefined","onTransitionEnd","addEventListener","removeEventListener","_jsxs","onClick","IconButton","emphasis","Emphasis","low","icon","mdiChevronUp","mdiChevronDown","displayName","defaultProps"],"mappings":";;;;;;;;;;;;;;;AAwCA;AACA;AACA;AACA,M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A,KAAA,EAAA;UAAKzB,SAAS,EAAE,CAAGjB,EAAAA,SAAS,CAAY,SAAA,CAAA;AAAAkB,UAAAA,QAAA,EAAEiB,OAAAA;AAAO,SAAM,CAAC,EAEvDD,MAAM,iBAAIQ,GAAA,CAAA,KAAA,EAAA;UAAKzB,SAAS,EAAE,CAAGjB,EAAAA,SAAS,CAAW,QAAA,CAAA;AAAAkB,UAAAA,QAAA,EAAEgB,MAAAA;AAAM,SAAM,CAAC,CAAA;OAChE,CAAA;AACR,KACA,CAAC,CAAA;AAAA,GACD,CAAC,CAAA;AAElB,CAAC,EAAC;AACFzB,cAAc,CAACwE,WAAW,GAAGlF,cAAc,CAAA;AAC3CU,cAAc,CAACQ,SAAS,GAAGjB,SAAS,CAAA;AACpCS,cAAc,CAACyE,YAAY,GAAGhF,aAAa;;;;"}
|
|
@@ -4,8 +4,8 @@ import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
|
4
4
|
import { f as forwardRef } from '../forwardRef-8bce732e.js';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
6
|
import { Theme, ColorPalette, Size } from '@lumx/core/js/constants';
|
|
7
|
-
import { Icon } from './icon-
|
|
8
|
-
import { T as Text } from '../index-
|
|
7
|
+
import { Icon } from './icon-a00d698b.js';
|
|
8
|
+
import { T as Text } from '../index-151e2652.js';
|
|
9
9
|
|
|
10
10
|
const COMPONENT_NAME = 'Flag';
|
|
11
11
|
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
@@ -57,4 +57,4 @@ Flag.className = CLASSNAME;
|
|
|
57
57
|
Flag.defaultProps = DEFAULT_PROPS;
|
|
58
58
|
|
|
59
59
|
export { Flag };
|
|
60
|
-
//# sourceMappingURL=flag-
|
|
60
|
+
//# sourceMappingURL=flag-c2e41e8d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flag-
|
|
1
|
+
{"version":3,"file":"flag-c2e41e8d.js","sources":["../../../src/components/flag/Flag.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { ColorPalette, Icon, Size, Theme, Text } from '@lumx/react';\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nexport interface FlagProps extends GenericProps, HasTheme {\n /** Color of the component. */\n color?: ColorPalette;\n /** Icon to use before the label. */\n icon?: string;\n /** Text label of the flag. */\n label: React.ReactNode;\n /** Enable text truncate on overflow */\n truncate?: boolean;\n}\n\nconst COMPONENT_NAME = 'Flag';\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\nconst DEFAULT_PROPS: Partial<FlagProps> = {};\n\n/**\n * Flag component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Flag = forwardRef<FlagProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme() || Theme.light;\n const { label, icon, color, className, theme = defaultTheme, truncate, ...forwardedProps } = props;\n const flagColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);\n const isTruncated = !!truncate;\n\n return (\n <div\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, color: flagColor, isTruncated }))}\n ref={ref}\n >\n {icon && <Icon icon={icon} size={Size.xxs} className={`${CLASSNAME}__icon`} />}\n <Text as=\"span\" truncate={isTruncated} typography=\"overline\" className={`${CLASSNAME}__label`}>\n {label}\n </Text>\n </div>\n );\n});\nFlag.displayName = COMPONENT_NAME;\nFlag.className = CLASSNAME;\nFlag.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","Flag","forwardRef","props","ref","defaultTheme","useTheme","Theme","light","label","icon","color","className","theme","truncate","forwardedProps","flagColor","ColorPalette","dark","isTruncated","_jsxs","classNames","handleBasicClasses","prefix","children","_jsx","Icon","size","Size","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GAAA,CAACK,IAAI,EAAA;AAACC,MAAAA,EAAE,EAAC,MAAM;AAACjB,MAAAA,QAAQ,EAAEK,WAAY;AAACa,MAAAA,UAAU,EAAC,UAAU;MAACpB,SAAS,EAAE,CAAGd,EAAAA,SAAS,CAAU,OAAA,CAAA;AAAA0B,MAAAA,QAAA,EACzFf,KAAAA;AAAK,KACJ,CAAC,CAAA;AAAA,GACN,CAAC,CAAA;AAEd,CAAC,EAAC;AACFR,IAAI,CAACgC,WAAW,GAAGpC,cAAc,CAAA;AACjCI,IAAI,CAACW,SAAS,GAAGd,SAAS,CAAA;AAC1BG,IAAI,CAACiC,YAAY,GAAGlC,aAAa;;;;"}
|
|
@@ -4,7 +4,7 @@ import { f as forwardRef } from '../forwardRef-8bce732e.js';
|
|
|
4
4
|
import { u as useHeadingLevel, D as DEFAULT_TYPOGRAPHY_BY_LEVEL } from '../HeadingLevelProvider-ebdcb0c7.js';
|
|
5
5
|
export { H as HeadingLevelProvider } from '../HeadingLevelProvider-ebdcb0c7.js';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
|
-
import { T as Text } from '../index-
|
|
7
|
+
import { T as Text } from '../index-151e2652.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Component display name.
|
|
@@ -51,4 +51,4 @@ Heading.className = CLASSNAME;
|
|
|
51
51
|
Heading.defaultProps = DEFAULT_PROPS;
|
|
52
52
|
|
|
53
53
|
export { Heading, useHeadingLevel };
|
|
54
|
-
//# sourceMappingURL=heading-
|
|
54
|
+
//# sourceMappingURL=heading-28520e1c.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading-
|
|
1
|
+
{"version":3,"file":"heading-28520e1c.js","sources":["../../../src/components/heading/Heading.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { HeadingElement } from '@lumx/react/utils/type';\nimport { getRootClassName } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nimport { Text, TextProps } from '../text';\nimport { DEFAULT_TYPOGRAPHY_BY_LEVEL } from './constants';\nimport { useHeadingLevel } from './useHeadingLevel';\n\n/**\n * Defines the props of the component.\n */\nexport interface HeadingProps extends Partial<TextProps> {\n /**\n * Display a specific heading level instead of the one provided by parent context provider.\n */\n as?: HeadingElement;\n /**\n * Children\n */\n children?: React.ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Heading';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS = {} as const;\n\n/**\n * Renders a heading component.\n * Extends the `Text` Component with the heading level automatically computed based on\n * the current level provided by the context.\n */\nexport const Heading = forwardRef<HeadingProps>((props, ref) => {\n const { children, as, className, ...forwardedProps } = props;\n const { headingElement } = useHeadingLevel();\n\n const computedHeadingElement = as || headingElement;\n return (\n <Text\n ref={ref}\n className={classNames(className, CLASSNAME)}\n as={computedHeadingElement}\n typography={DEFAULT_TYPOGRAPHY_BY_LEVEL[computedHeadingElement]}\n {...forwardedProps}\n >\n {children}\n </Text>\n );\n});\n\nHeading.displayName = COMPONENT_NAME;\nHeading.className = CLASSNAME;\nHeading.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","Heading","forwardRef","props","ref","children","as","className","forwardedProps","headingElement","useHeadingLevel","computedHeadingElement","_jsx","Text","classNames","typography","DEFAULT_TYPOGRAPHY_BY_LEVEL","displayName","defaultProps"],"mappings":";;;;;;;;AAwBA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,SAAS,CAAA;;AAEhC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAa,GAAG,EAAW,CAAA;;AAEjC;AACA;AACA;AACA;AACA;AACO,MAAMC,OAAO,GAAGC,UAAU,CAAe,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC5D,MAAM;IAAEC,QAAQ;IAAEC,EAAE;IAAEC,SAAS;IAAE,GAAGC,cAAAA;AAAe,GAAC,GAAGL,KAAK,CAAA;EAC5D,MAAM;AAAEM,IAAAA,cAAAA;GAAgB,GAAGC,eAAe,EAAE,CAAA;AAE5C,EAAA,MAAMC,sBAAsB,GAAGL,EAAE,IAAIG,cAAc,CAAA;EACnD,oBACIG,GAAA,CAACC,IAAI,EAAA;AACDT,IAAAA,GAAG,EAAEA,GAAI;AACTG,IAAAA,SAAS,EAAEO,UAAU,CAACP,SAAS,EAAET,SAAS,CAAE;AAC5CQ,IAAAA,EAAE,EAAEK,sBAAuB;AAC3BI,IAAAA,UAAU,EAAEC,2BAA2B,CAACL,sBAAsB,CAAE;AAAA,IAAA,GAC5DH,cAAc;AAAAH,IAAAA,QAAA,EAEjBA,QAAAA;AAAQ,GACP,CAAC,CAAA;AAEf,CAAC,EAAC;AAEFJ,OAAO,CAACgB,WAAW,GAAGpB,cAAc,CAAA;AACpCI,OAAO,CAACM,SAAS,GAAGT,SAAS,CAAA;AAC7BG,OAAO,CAACiB,YAAY,GAAGlB,aAAa;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { mdiAlertCircle } from '@lumx/icons
|
|
2
|
+
import { mdiAlertCircle } from '@lumx/icons';
|
|
3
3
|
import { getRootClassName, resolveColorWithVariants, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
4
4
|
import { f as forwardRef } from '../forwardRef-8bce732e.js';
|
|
5
5
|
import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
@@ -100,4 +100,4 @@ Icon.className = CLASSNAME;
|
|
|
100
100
|
Icon.defaultProps = DEFAULT_PROPS;
|
|
101
101
|
|
|
102
102
|
export { Icon };
|
|
103
|
-
//# sourceMappingURL=icon-
|
|
103
|
+
//# sourceMappingURL=icon-a00d698b.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-a00d698b.js","sources":["../../../src/components/icon/Icon.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { mdiAlertCircle } from '@lumx/icons';\nimport { ColorPalette, ColorVariant, ColorWithVariants, Size, Theme } from '@lumx/react';\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses, resolveColorWithVariants } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\n\nexport type IconSizes = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface IconProps extends GenericProps, HasTheme {\n /** Color variant. */\n color?: ColorWithVariants;\n /** Lightened or darkened variant of the selected icon color. */\n colorVariant?: ColorVariant;\n /** Whether the icon has a shape. */\n hasShape?: boolean;\n /**\n * Icon (SVG path) draw code (`d` property of the `<path>` SVG element).\n * See https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths\n */\n icon: string;\n /** Size variant. */\n size?: IconSizes;\n /** Sets an alternative text on the svg. Will set an `img` role to the svg. */\n alt?: string;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Icon';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<IconProps> = {};\n\n/**\n * Icon component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Icon = forwardRef<IconProps, HTMLElement>((props, ref) => {\n const defaultTheme = useTheme();\n const {\n className,\n color: propColor,\n colorVariant: propColorVariant,\n hasShape,\n icon,\n size,\n theme = defaultTheme,\n alt,\n ...forwardedProps\n } = props;\n const [color, colorVariant] = resolveColorWithVariants(propColor, propColorVariant);\n\n // Color\n let iconColor = color;\n if (!iconColor && (hasShape || theme)) {\n iconColor = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;\n }\n\n // Color variant\n let iconColorVariant = colorVariant;\n if (!iconColorVariant && hasShape && iconColor === ColorPalette.dark) {\n iconColorVariant = 'L2';\n }\n\n // Size\n let iconSize = size;\n if (size && hasShape) {\n if (size === Size.xxs || size === Size.xs) {\n iconSize = Size.s;\n } else if (size === Size.xxl) {\n iconSize = Size.xl;\n }\n } else if (hasShape) {\n iconSize = Size.m;\n }\n\n return (\n <i\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n color: iconColor,\n colorVariant: iconColorVariant,\n hasShape,\n prefix: CLASSNAME,\n theme,\n size: iconSize,\n }),\n !hasShape && `${CLASSNAME}--no-shape`,\n !hasShape &&\n iconColor === ColorPalette.yellow &&\n icon === mdiAlertCircle &&\n `${CLASSNAME}--has-dark-layer`,\n `${CLASSNAME}--path`,\n )}\n >\n <svg\n aria-hidden={alt ? undefined : 'true'}\n role={alt ? 'img' : undefined}\n aria-label={alt}\n height=\"1em\"\n preserveAspectRatio=\"xMidYMid meet\"\n style={{ verticalAlign: '-0.125em' }}\n viewBox=\"0 0 24 24\"\n width=\"1em\"\n >\n <path d={icon} fill=\"currentColor\" />\n </svg>\n </i>\n );\n});\nIcon.displayName = COMPONENT_NAME;\nIcon.className = CLASSNAME;\nIcon.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","Icon","forwardRef","props","ref","defaultTheme","useTheme","className","color","propColor","colorVariant","propColorVariant","hasShape","icon","size","theme","alt","forwardedProps","resolveColorWithVariants","iconColor","Theme","dark","ColorPalette","light","iconColorVariant","iconSize","Size","xxs","xs","s","xxl","xl","m","_jsx","classNames","handleBasicClasses","prefix","yellow","mdiAlertCircle","children","undefined","role","height","preserveAspectRatio","style","verticalAlign","viewBox","width","d","fill","displayName","defaultProps"],"mappings":";;;;;;;;AAgCA;AACA;AACA;AACA,MAAMA,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W;AACnBC,MAAAA,KAAK,EAAC,KAAK;AAAAR,MAAAA,QAAA,eAEXN,GAAA,CAAA,MAAA,EAAA;AAAMe,QAAAA,CAAC,EAAEnC,IAAK;AAACoC,QAAAA,IAAI,EAAC,cAAA;OAAgB,CAAA;KACnC,CAAA;AAAC,GACP,CAAC,CAAA;AAEZ,CAAC,EAAC;AACFhD,IAAI,CAACiD,WAAW,GAAGrD,cAAc,CAAA;AACjCI,IAAI,CAACM,SAAS,GAAGT,SAAS,CAAA;AAC1BG,IAAI,CAACkD,YAAY,GAAGnD,aAAa;;;;"}
|
|
@@ -2,10 +2,10 @@ import classNames from 'classnames';
|
|
|
2
2
|
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
3
3
|
import { f as forwardRef } from '../forwardRef-8bce732e.js';
|
|
4
4
|
import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
5
|
-
import { I as ImageCaption } from '../ImageCaption-
|
|
5
|
+
import { I as ImageCaption } from '../ImageCaption-16bf224b.js';
|
|
6
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
7
|
import { Alignment, Theme } from '@lumx/core/js/constants';
|
|
8
|
-
import { T as Thumbnail } from '../Thumbnail-
|
|
8
|
+
import { T as Thumbnail } from '../Thumbnail-d2001ccb.js';
|
|
9
9
|
|
|
10
10
|
const ImageBlockCaptionPosition = {
|
|
11
11
|
below: 'below',
|
|
@@ -108,4 +108,4 @@ ImageBlock.className = CLASSNAME;
|
|
|
108
108
|
ImageBlock.defaultProps = DEFAULT_PROPS;
|
|
109
109
|
|
|
110
110
|
export { ImageBlock, ImageBlockCaptionPosition };
|
|
111
|
-
//# sourceMappingURL=image-block-
|
|
111
|
+
//# sourceMappingURL=image-block-10976174.js.map
|