@lumx/react 3.5.3 → 3.5.4-alpha-remove-moment-repack.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_internal/00d05efa.js +111 -0
- package/_internal/00d05efa.js.map +1 -0
- package/_internal/0110d951.js +168 -0
- package/_internal/0110d951.js.map +1 -0
- package/_internal/063bb3df.js +33 -0
- package/_internal/063bb3df.js.map +1 -0
- package/_internal/0d8b4e37.d.ts +106 -0
- package/_internal/0da969e1.d.ts +45 -0
- package/_internal/1098ba6a.js +26 -0
- package/_internal/1098ba6a.js.map +1 -0
- package/_internal/1252e3a1.js +108 -0
- package/_internal/1252e3a1.js.map +1 -0
- package/_internal/135ee91f.d.ts +32 -0
- package/_internal/13603836.js +13 -0
- package/_internal/13603836.js.map +1 -0
- package/_internal/15e9a271.d.ts +26 -0
- package/_internal/188706f1.d.ts +107 -0
- package/_internal/1e67557e.d.ts +31 -0
- package/_internal/1ee4fa8c.js +85 -0
- package/_internal/1ee4fa8c.js.map +1 -0
- package/_internal/209d0906.js +56 -0
- package/_internal/209d0906.js.map +1 -0
- package/_internal/22b8c949.d.ts +57 -0
- package/_internal/23b03795.js +115 -0
- package/_internal/23b03795.js.map +1 -0
- package/_internal/25352357.d.ts +51 -0
- package/_internal/{types.d.ts → 28b656e3.d.ts} +1 -1
- package/_internal/2bd12321.d.ts +22 -0
- package/_internal/2c279dd8.d.ts +49 -0
- package/_internal/2d7bd818.js +147 -0
- package/_internal/2d7bd818.js.map +1 -0
- package/_internal/2db3ca7a.js +221 -0
- package/_internal/2db3ca7a.js.map +1 -0
- package/_internal/2e0ba45f.js +182 -0
- package/_internal/2e0ba45f.js.map +1 -0
- package/_internal/2e6810c5.js +240 -0
- package/_internal/2e6810c5.js.map +1 -0
- package/_internal/2ed577d6.d.ts +37 -0
- package/_internal/31235bda.js +133 -0
- package/_internal/31235bda.js.map +1 -0
- package/_internal/339a4cb6.d.ts +106 -0
- package/_internal/35c3a78f.js +374 -0
- package/_internal/35c3a78f.js.map +1 -0
- package/_internal/3669449c.js +135 -0
- package/_internal/3669449c.js.map +1 -0
- package/_internal/39790d2a.d.ts +52 -0
- package/_internal/3bfda595.d.ts +62 -0
- package/_internal/3f5e7653.js +205 -0
- package/_internal/3f5e7653.js.map +1 -0
- package/_internal/43bf2236.js +189 -0
- package/_internal/43bf2236.js.map +1 -0
- package/_internal/43c20e1c.js +64 -0
- package/_internal/43c20e1c.js.map +1 -0
- package/_internal/45349a37.js +78 -0
- package/_internal/45349a37.js.map +1 -0
- package/_internal/48725bae.js +61 -0
- package/_internal/48725bae.js.map +1 -0
- package/_internal/4a5eff83.js +149 -0
- package/_internal/4a5eff83.js.map +1 -0
- package/_internal/4f5a23d0.js +74 -0
- package/_internal/4f5a23d0.js.map +1 -0
- package/_internal/50472283.js +219 -0
- package/_internal/50472283.js.map +1 -0
- package/_internal/506e7420.js +805 -0
- package/_internal/506e7420.js.map +1 -0
- package/_internal/51585e5d.d.ts +31 -0
- package/_internal/52976f60.js +123 -0
- package/_internal/52976f60.js.map +1 -0
- package/_internal/53abf616.js +112 -0
- package/_internal/53abf616.js.map +1 -0
- package/_internal/561b93a4.js +132 -0
- package/_internal/561b93a4.js.map +1 -0
- package/_internal/56827efd.js +306 -0
- package/_internal/56827efd.js.map +1 -0
- package/_internal/58085542.js +132 -0
- package/_internal/58085542.js.map +1 -0
- package/_internal/5d582985.js +55 -0
- package/_internal/5d582985.js.map +1 -0
- package/_internal/5df3d4a3.d.ts +192 -0
- package/_internal/5eac291f.js +52 -0
- package/_internal/5eac291f.js.map +1 -0
- package/_internal/5ebec897.d.ts +69 -0
- package/_internal/62a51bc3.js +73 -0
- package/_internal/62a51bc3.js.map +1 -0
- package/_internal/648a40d4.js +140 -0
- package/_internal/648a40d4.js.map +1 -0
- package/_internal/6726fa56.js +113 -0
- package/_internal/6726fa56.js.map +1 -0
- package/_internal/687128ab.js +60 -0
- package/_internal/687128ab.js.map +1 -0
- package/_internal/69ec8e49.js +2130 -0
- package/_internal/69ec8e49.js.map +1 -0
- package/_internal/6a084cc0.js +154 -0
- package/_internal/6a084cc0.js.map +1 -0
- package/_internal/6b6c99f5.d.ts +59 -0
- package/_internal/6f0b1d1c.js +100 -0
- package/_internal/6f0b1d1c.js.map +1 -0
- package/_internal/717ab5c2.d.ts +33 -0
- package/_internal/71e8fb5e.d.ts +54 -0
- package/_internal/72b3a542.js +75 -0
- package/_internal/72b3a542.js.map +1 -0
- package/_internal/73d02a65.js +338 -0
- package/_internal/73d02a65.js.map +1 -0
- package/_internal/757216a1.js +80 -0
- package/_internal/757216a1.js.map +1 -0
- package/_internal/7641c1e4.js +49 -0
- package/_internal/7641c1e4.js.map +1 -0
- package/_internal/782f6fbb.js +94 -0
- package/_internal/782f6fbb.js.map +1 -0
- package/_internal/787d5d09.js +450 -0
- package/_internal/787d5d09.js.map +1 -0
- package/_internal/79b3f9aa.d.ts +22 -0
- package/_internal/7b8c2b80.js +113 -0
- package/_internal/7b8c2b80.js.map +1 -0
- package/_internal/7c07908e.d.ts +34 -0
- package/_internal/7d468bfd.d.ts +75 -0
- package/_internal/834ad334.js +25 -0
- package/_internal/834ad334.js.map +1 -0
- package/_internal/83dab2b2.js +22 -0
- package/_internal/83dab2b2.js.map +1 -0
- package/_internal/899e4acd.js +60 -0
- package/_internal/899e4acd.js.map +1 -0
- package/_internal/89fd6c7c.js +112 -0
- package/_internal/89fd6c7c.js.map +1 -0
- package/_internal/8aeb24dd.d.ts +24 -0
- package/_internal/8c7450ba.d.ts +35 -0
- package/_internal/8ea3ecc2.d.ts +46 -0
- package/_internal/8efb9d06.js +807 -0
- package/_internal/8efb9d06.js.map +1 -0
- package/_internal/93943ac3.d.ts +37 -0
- package/_internal/96ac5af6.d.ts +47 -0
- package/_internal/975a94f4.js +88 -0
- package/_internal/975a94f4.js.map +1 -0
- package/_internal/9784d7f8.js +283 -0
- package/_internal/9784d7f8.js.map +1 -0
- package/_internal/97e802dc.d.ts +66 -0
- package/_internal/9b9393ee.d.ts +29 -0
- package/_internal/9dced38c.js +284 -0
- package/_internal/9dced38c.js.map +1 -0
- package/_internal/a07fe032.d.ts +57 -0
- package/_internal/a08b82a3.d.ts +31 -0
- package/_internal/a106724b.d.ts +43 -0
- package/_internal/a7807be3.js +120 -0
- package/_internal/a7807be3.js.map +1 -0
- package/_internal/a79b2c62.js +60 -0
- package/_internal/a79b2c62.js.map +1 -0
- package/_internal/a7b06ff0.d.ts +16 -0
- package/_internal/a8af376d.d.ts +35 -0
- package/_internal/abdb0290.d.ts +35 -0
- package/_internal/adb2e104.d.ts +101 -0
- package/_internal/b13105c1.d.ts +38 -0
- package/_internal/b3361376.d.ts +55 -0
- package/_internal/b3bb0cc4.d.ts +92 -0
- package/_internal/b447833b.d.ts +24 -0
- package/_internal/b5deecfd.d.ts +64 -0
- package/_internal/b70adcf7.js +310 -0
- package/_internal/b70adcf7.js.map +1 -0
- package/_internal/b7128df5.js +137 -0
- package/_internal/b7128df5.js.map +1 -0
- package/_internal/baf84dac.js +29 -0
- package/_internal/baf84dac.js.map +1 -0
- package/_internal/bd3b5639.d.ts +183 -0
- package/_internal/bf97c97c.js +112 -0
- package/_internal/bf97c97c.js.map +1 -0
- package/_internal/c1482714.js +63 -0
- package/_internal/c1482714.js.map +1 -0
- package/_internal/c498efeb.js +12 -0
- package/_internal/c498efeb.js.map +1 -0
- package/_internal/c672b554.d.ts +87 -0
- package/_internal/c70420da.js +120 -0
- package/_internal/c70420da.js.map +1 -0
- package/_internal/ce96edec.d.ts +41 -0
- package/_internal/cf2cb6bc.d.ts +22 -0
- package/_internal/cf312aff.d.ts +38 -0
- package/_internal/cfd18b6d.js +88 -0
- package/_internal/cfd18b6d.js.map +1 -0
- package/_internal/components/alert-dialog.d.ts +6 -0
- package/_internal/components/alert-dialog.js +2 -0
- package/_internal/components/alert-dialog.js.map +1 -0
- package/_internal/components/autocomplete.d.ts +10 -0
- package/_internal/components/autocomplete.js +2 -0
- package/_internal/components/autocomplete.js.map +1 -0
- package/_internal/components/avatar.d.ts +4 -0
- package/_internal/components/avatar.js +2 -0
- package/_internal/components/avatar.js.map +1 -0
- package/_internal/components/badge.d.ts +3 -0
- package/_internal/components/badge.js +2 -0
- package/_internal/components/badge.js.map +1 -0
- package/_internal/components/button.d.ts +8 -0
- package/_internal/components/button.js +4 -0
- package/_internal/components/button.js.map +1 -0
- package/_internal/components/checkbox.d.ts +3 -0
- package/_internal/components/checkbox.js +2 -0
- package/_internal/components/checkbox.js.map +1 -0
- package/_internal/components/chip.d.ts +3 -0
- package/_internal/components/chip.js +3 -0
- package/_internal/components/chip.js.map +1 -0
- package/_internal/components/comment-block.d.ts +5 -0
- package/_internal/components/comment-block.js +2 -0
- package/_internal/components/comment-block.js.map +1 -0
- package/_internal/components/date-picker.d.ts +7 -0
- package/_internal/components/date-picker.js +2 -0
- package/_internal/components/date-picker.js.map +1 -0
- package/_internal/components/dialog.d.ts +3 -0
- package/_internal/components/dialog.js +2 -0
- package/_internal/components/dialog.js.map +1 -0
- package/_internal/components/divider.d.ts +3 -0
- package/_internal/components/divider.js +2 -0
- package/_internal/components/divider.js.map +1 -0
- package/_internal/components/drag-handle.d.ts +3 -0
- package/_internal/components/drag-handle.js +2 -0
- package/_internal/components/drag-handle.js.map +1 -0
- package/_internal/components/dropdown.d.ts +5 -0
- package/_internal/components/dropdown.js +2 -0
- package/_internal/components/dropdown.js.map +1 -0
- package/_internal/components/expansion-panel.d.ts +7 -0
- package/_internal/components/expansion-panel.js +2 -0
- package/_internal/components/expansion-panel.js.map +1 -0
- package/_internal/components/flag.d.ts +3 -0
- package/_internal/components/flag.js +2 -0
- package/_internal/components/flag.js.map +1 -0
- package/_internal/components/flex-box.d.ts +3 -0
- package/_internal/components/flex-box.js +2 -0
- package/_internal/components/flex-box.js.map +1 -0
- package/_internal/components/generic-block.d.ts +4 -0
- package/_internal/components/generic-block.js +2 -0
- package/_internal/components/generic-block.js.map +1 -0
- package/_internal/components/grid-column.d.ts +3 -0
- package/_internal/components/grid-column.js +2 -0
- package/_internal/components/grid-column.js.map +1 -0
- package/_internal/components/grid.d.ts +3 -0
- package/_internal/components/grid.js +2 -0
- package/_internal/components/grid.js.map +1 -0
- package/_internal/components/heading.d.ts +4 -0
- package/_internal/components/heading.js +2 -0
- package/_internal/components/heading.js.map +1 -0
- package/_internal/components/icon.d.ts +3 -0
- package/_internal/components/icon.js +2 -0
- package/_internal/components/icon.js.map +1 -0
- package/_internal/components/image-block.d.ts +4 -0
- package/_internal/components/image-block.js +2 -0
- package/_internal/components/image-block.js.map +1 -0
- package/_internal/components/inline-list.d.ts +3 -0
- package/_internal/components/inline-list.js +2 -0
- package/_internal/components/inline-list.js.map +1 -0
- package/_internal/components/input-helper.d.ts +3 -0
- package/_internal/components/input-helper.js +2 -0
- package/_internal/components/input-helper.js.map +1 -0
- package/_internal/components/input-label.d.ts +3 -0
- package/_internal/components/input-label.js +2 -0
- package/_internal/components/input-label.js.map +1 -0
- package/_internal/components/lightbox.d.ts +7 -0
- package/_internal/components/lightbox.js +2 -0
- package/_internal/components/lightbox.js.map +1 -0
- package/_internal/components/link-preview.d.ts +5 -0
- package/_internal/components/link-preview.js +2 -0
- package/_internal/components/link-preview.js.map +1 -0
- package/_internal/components/link.d.ts +3 -0
- package/_internal/components/link.js +2 -0
- package/_internal/components/link.js.map +1 -0
- package/_internal/components/list.d.ts +3 -0
- package/_internal/components/list.js +3 -0
- package/_internal/components/list.js.map +1 -0
- package/_internal/components/message.d.ts +3 -0
- package/_internal/components/message.js +2 -0
- package/_internal/components/message.js.map +1 -0
- package/_internal/components/mosaic.d.ts +4 -0
- package/_internal/components/mosaic.js +2 -0
- package/_internal/components/mosaic.js.map +1 -0
- package/_internal/components/navigation.d.ts +3 -0
- package/_internal/components/navigation.js +2 -0
- package/_internal/components/navigation.js.map +1 -0
- package/_internal/components/notification.d.ts +3 -0
- package/_internal/components/notification.js +2 -0
- package/_internal/components/notification.js.map +1 -0
- package/_internal/components/popover.d.ts +4 -0
- package/_internal/components/popover.js +3 -0
- package/_internal/components/popover.js.map +1 -0
- package/_internal/components/post-block.d.ts +4 -0
- package/_internal/components/post-block.js +2 -0
- package/_internal/components/post-block.js.map +1 -0
- package/_internal/components/progress-tracker.d.ts +3 -0
- package/_internal/components/progress-tracker.js +2 -0
- package/_internal/components/progress-tracker.js.map +1 -0
- package/_internal/components/progress.d.ts +3 -0
- package/_internal/components/progress.js +2 -0
- package/_internal/components/progress.js.map +1 -0
- package/_internal/components/radio-button.d.ts +3 -0
- package/_internal/components/radio-button.js +2 -0
- package/_internal/components/radio-button.js.map +1 -0
- package/_internal/components/select.d.ts +7 -0
- package/_internal/components/select.js +2 -0
- package/_internal/components/select.js.map +1 -0
- package/_internal/components/side-navigation.d.ts +7 -0
- package/_internal/components/side-navigation.js +2 -0
- package/_internal/components/side-navigation.js.map +1 -0
- package/_internal/components/skeleton.d.ts +3 -0
- package/_internal/components/skeleton.js +2 -0
- package/_internal/components/skeleton.js.map +1 -0
- package/_internal/components/slider.d.ts +3 -0
- package/_internal/components/slider.js +2 -0
- package/_internal/components/slider.js.map +1 -0
- package/_internal/components/slideshow.d.ts +7 -0
- package/_internal/components/slideshow.js +2 -0
- package/_internal/components/slideshow.js.map +1 -0
- package/_internal/components/switch.d.ts +3 -0
- package/_internal/components/switch.js +2 -0
- package/_internal/components/switch.js.map +1 -0
- package/_internal/components/table.d.ts +3 -0
- package/_internal/components/table.js +2 -0
- package/_internal/components/table.js.map +1 -0
- package/_internal/components/tabs.d.ts +4 -0
- package/_internal/components/tabs.js +2 -0
- package/_internal/components/tabs.js.map +1 -0
- package/_internal/components/text-field.d.ts +7 -0
- package/_internal/components/text-field.js +2 -0
- package/_internal/components/text-field.js.map +1 -0
- package/_internal/components/text.d.ts +3 -0
- package/_internal/components/text.js +2 -0
- package/_internal/components/text.js.map +1 -0
- package/_internal/components/thumbnail.d.ts +4 -0
- package/_internal/components/thumbnail.js +3 -0
- package/_internal/components/thumbnail.js.map +1 -0
- package/_internal/components/toolbar.d.ts +3 -0
- package/_internal/components/toolbar.js +2 -0
- package/_internal/components/toolbar.js.map +1 -0
- package/_internal/components/tooltip.d.ts +4 -0
- package/_internal/components/tooltip.js +2 -0
- package/_internal/components/tooltip.js.map +1 -0
- package/_internal/components/uploader.d.ts +3 -0
- package/_internal/components/uploader.js +2 -0
- package/_internal/components/uploader.js.map +1 -0
- package/_internal/components/user-block.d.ts +5 -0
- package/_internal/components/user-block.js +2 -0
- package/_internal/components/user-block.js.map +1 -0
- package/_internal/d0ab9418.js +217 -0
- package/_internal/d0ab9418.js.map +1 -0
- package/_internal/d182fae6.js +402 -0
- package/_internal/d182fae6.js.map +1 -0
- package/_internal/d18db1a2.d.ts +17 -0
- package/_internal/d39f1e46.d.ts +65 -0
- package/_internal/d737c470.js +312 -0
- package/_internal/d737c470.js.map +1 -0
- package/_internal/d894ca99.d.ts +49 -0
- package/_internal/da84387d.d.ts +36 -0
- package/_internal/dbee763e.d.ts +34 -0
- package/_internal/dd592f2c.d.ts +6 -0
- package/_internal/de727831.d.ts +17 -0
- package/_internal/df1fde7b.js +125 -0
- package/_internal/df1fde7b.js.map +1 -0
- package/_internal/e238e75a.d.ts +20 -0
- package/_internal/e50751c9.js +259 -0
- package/_internal/e50751c9.js.map +1 -0
- package/_internal/e986d261.js +84 -0
- package/_internal/e986d261.js.map +1 -0
- package/_internal/ebe0cef1.d.ts +88 -0
- package/_internal/ef7b6d28.d.ts +43 -0
- package/_internal/f0bb348a.js +49 -0
- package/_internal/f0bb348a.js.map +1 -0
- package/_internal/f0edbfd3.js +399 -0
- package/_internal/f0edbfd3.js.map +1 -0
- package/_internal/f722684a.js +137 -0
- package/_internal/f722684a.js.map +1 -0
- package/_internal/{ClickAwayProvider.js → f82d943d.js} +1 -1
- package/_internal/f82d943d.js.map +1 -0
- package/_internal/f99a63fb.d.ts +118 -0
- package/_internal/fc608bd9.js +16 -0
- package/_internal/fc608bd9.js.map +1 -0
- package/_internal/ff6c8991.js +180 -0
- package/_internal/ff6c8991.js.map +1 -0
- package/index.d.ts +63 -2847
- package/index.js +97 -13086
- package/index.js.map +1 -1
- package/package.json +3 -5
- package/src/components/date-picker/DatePicker.stories.tsx +38 -0
- package/src/components/date-picker/DatePicker.tsx +8 -11
- package/src/components/date-picker/DatePickerControlled.tsx +35 -43
- package/src/components/date-picker/DatePickerField.stories.tsx +0 -1
- package/src/components/date-picker/DatePickerField.tsx +7 -8
- package/src/components/date-picker/types.ts +1 -1
- package/src/utils/date/addMonthResetDay.test.ts +13 -0
- package/src/utils/date/addMonthResetDay.ts +9 -0
- package/src/utils/date/formatDate.ts +9 -0
- package/src/utils/date/formatDayNumber.ts +2 -0
- package/src/utils/date/formatMonthYear.ts +5 -0
- package/src/utils/date/getFirstDayOfWeek.test.ts +27 -0
- package/src/utils/date/getFirstDayOfWeek.ts +59 -0
- package/src/utils/date/getMonthCalendar.test.ts +119 -0
- package/src/utils/date/getMonthCalendar.ts +52 -0
- package/src/utils/date/getWeekDays.test.ts +52 -0
- package/src/utils/date/getWeekDays.ts +32 -0
- package/src/utils/date/isDateValid.test.ts +15 -0
- package/src/utils/date/isDateValid.ts +4 -0
- package/src/utils/date/isSameDay.test.ts +27 -0
- package/src/utils/date/isSameDay.ts +7 -0
- package/src/utils/locale/getCurrentLocale.ts +4 -0
- package/src/utils/locale/getLocaleLang.ts +5 -0
- package/utils/index.d.ts +1 -1
- package/utils/index.js +1 -1
- package/_internal/ClickAwayProvider.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"31235bda.js","sources":["../../src/components/notification/constants.ts","../../src/components/notification/Notification.tsx"],"sourcesContent":["import { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiInformation } from '@lumx/icons';\n\n/**\n * Notification delay before hiding.\n */\nexport const HIDE_DELAY = 6000;\n\n/**\n * Notification icon and colors according to their type.\n */\nexport const NOTIFICATION_CONFIGURATION = {\n error: {\n color: 'red',\n icon: mdiAlert,\n },\n info: {\n color: 'dark',\n icon: mdiInformation,\n },\n success: {\n color: 'green',\n icon: mdiCheckCircle,\n },\n warning: {\n color: 'yellow',\n icon: mdiAlertCircle,\n },\n};\n","import React, { forwardRef, useRef } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport classNames from 'classnames';\n\nimport isFunction from 'lodash/isFunction';\n\nimport { Button, Emphasis, Icon, Kind, Size, Theme } from '@lumx/react';\n\nimport { DOCUMENT } from '@lumx/react/constants';\nimport { NOTIFICATION_CONFIGURATION } from '@lumx/react/components/notification/constants';\nimport { Comp, GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';\n\nimport { useTransitionVisibility } from '@lumx/react/hooks/useTransitionVisibility';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\n\n/**\n * Defines the props of the component.\n */\nexport interface NotificationProps extends GenericProps, HasTheme {\n /** Action button label. */\n actionLabel?: string;\n /** Content. */\n content?: React.ReactNode;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Notification type. */\n type?: Kind;\n /** Z-axis position. */\n zIndex?: number;\n /** On action button click callback. */\n onActionClick?(): void;\n /** On click callback. */\n onClick?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Notification';\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<NotificationProps> = {\n theme: Theme.light,\n zIndex: 9999,\n};\n\n/* eslint-disable react-hooks/rules-of-hooks, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */\n/**\n * Notification component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Notification: Comp<NotificationProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n actionLabel,\n className,\n content,\n isOpen,\n onActionClick,\n onClick,\n theme,\n type,\n zIndex,\n ...forwardedProps\n } = props;\n if (!DOCUMENT) {\n // Can't render in SSR.\n return null;\n }\n const { color, icon } = NOTIFICATION_CONFIGURATION[type as Kind] || {};\n const rootRef = useRef<HTMLDivElement>(null);\n const isVisible = useTransitionVisibility(rootRef, !!isOpen);\n const hasAction: boolean = Boolean(onActionClick) && Boolean(actionLabel);\n\n const handleCallback = (evt: React.MouseEvent) => {\n if (isFunction(onActionClick)) {\n onActionClick();\n }\n evt.stopPropagation();\n };\n\n return type && isVisible\n ? createPortal(\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n <div\n ref={mergeRefs(ref, rootRef)}\n role=\"alert\"\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n color,\n hasAction,\n isHidden: !isOpen,\n prefix: CLASSNAME,\n }),\n )}\n onClick={onClick}\n style={{ zIndex }}\n >\n <div className={`${CLASSNAME}__icon`}>\n <Icon icon={icon} size={Size.s} />\n </div>\n <div className={`${CLASSNAME}__content`}>{content}</div>\n {hasAction && (\n <div className={`${CLASSNAME}__action`}>\n <Button emphasis={Emphasis.medium} theme={theme} onClick={handleCallback}>\n <span>{actionLabel}</span>\n </Button>\n </div>\n )}\n </div>,\n document.body,\n )\n : null;\n});\nNotification.displayName = COMPONENT_NAME;\nNotification.className = CLASSNAME;\nNotification.defaultProps = DEFAULT_PROPS;\n"],"names":["NOTIFICATION_CONFIGURATION","error","color","icon","mdiAlert","info","mdiInformation","success","mdiCheckCircle","warning","mdiAlertCircle","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","zIndex","Notification","forwardRef","props","ref","actionLabel","className","content","isOpen","onActionClick","onClick","type","forwardedProps","_objectWithoutProperties","_excluded","DOCUMENT","rootRef","useRef","isVisible","useTransitionVisibility","hasAction","Boolean","handleCallback","evt","isFunction","stopPropagation","createPortal","React","createElement","_extends","mergeRefs","role","classNames","handleBasicClasses","isHidden","prefix","style","Icon","size","Size","s","Button","emphasis","Emphasis","medium","document","body","displayName","defaultProps"],"mappings":";;;;;;;;;;;A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Aa;;;;"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { r as ValueOf, C as Comp } from './28b656e3.js';
|
|
3
|
+
import { b as FlexBoxProps } from './a106724b.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Accepted gap sizes for the generic block.
|
|
7
|
+
*/
|
|
8
|
+
declare const GenericBlockGapSize: Pick<{
|
|
9
|
+
readonly xxs: "xxs";
|
|
10
|
+
readonly xs: "xs";
|
|
11
|
+
readonly s: "s";
|
|
12
|
+
readonly m: "m";
|
|
13
|
+
readonly l: "l";
|
|
14
|
+
readonly xl: "xl";
|
|
15
|
+
readonly xxl: "xxl";
|
|
16
|
+
readonly tiny: "tiny";
|
|
17
|
+
readonly regular: "regular";
|
|
18
|
+
readonly medium: "medium";
|
|
19
|
+
readonly big: "big";
|
|
20
|
+
readonly huge: "huge";
|
|
21
|
+
}, "big" | "tiny" | "regular" | "medium" | "huge">;
|
|
22
|
+
declare type GenericBlockGapSize = ValueOf<typeof GenericBlockGapSize>;
|
|
23
|
+
|
|
24
|
+
interface GenericBlockProps extends FlexBoxProps {
|
|
25
|
+
/**
|
|
26
|
+
* Component to use as visual element.
|
|
27
|
+
*/
|
|
28
|
+
figure?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Actions to set after the main content.
|
|
31
|
+
*/
|
|
32
|
+
actions?: ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Main content to display or sections components
|
|
35
|
+
* ({@see GenericBlock.Figure}, {@see GenericBlock.Content} & {@see GenericBlock.Actions})
|
|
36
|
+
*/
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Orientation of the 3 sections
|
|
40
|
+
*/
|
|
41
|
+
orientation?: FlexBoxProps['orientation'];
|
|
42
|
+
/**
|
|
43
|
+
* Horizontal alignment.
|
|
44
|
+
*/
|
|
45
|
+
hAlign?: FlexBoxProps['hAlign'];
|
|
46
|
+
/**
|
|
47
|
+
* Vertical alignment.
|
|
48
|
+
*/
|
|
49
|
+
vAlign?: FlexBoxProps['vAlign'];
|
|
50
|
+
/**
|
|
51
|
+
* The props to forward to the content.
|
|
52
|
+
* By default, the content will have the same alignment as wrapper.
|
|
53
|
+
*/
|
|
54
|
+
contentProps?: Omit<FlexBoxProps, 'children'>;
|
|
55
|
+
/**
|
|
56
|
+
* props to forward to the actions element.
|
|
57
|
+
*/
|
|
58
|
+
actionsProps?: Omit<FlexBoxProps, 'children'>;
|
|
59
|
+
/**
|
|
60
|
+
* props to forward to the figure element.
|
|
61
|
+
*/
|
|
62
|
+
figureProps?: Omit<FlexBoxProps, 'children'>;
|
|
63
|
+
/**
|
|
64
|
+
* Gap space between sections.
|
|
65
|
+
*/
|
|
66
|
+
gap?: GenericBlockGapSize;
|
|
67
|
+
}
|
|
68
|
+
interface GenericBlockSectionProps extends FlexBoxProps {
|
|
69
|
+
/**
|
|
70
|
+
* Gap space between items.
|
|
71
|
+
*/
|
|
72
|
+
gap?: GenericBlockGapSize;
|
|
73
|
+
}
|
|
74
|
+
declare type BaseGenericBlock = Comp<GenericBlockProps, HTMLDivElement>;
|
|
75
|
+
/**
|
|
76
|
+
* The GenericBlock is a layout component made of 3 sections that can be
|
|
77
|
+
* displayed either horizontally of vertically with the same gap between each section.
|
|
78
|
+
*
|
|
79
|
+
* The sections are:
|
|
80
|
+
* - `Figure` => A visual element to display before the main content.
|
|
81
|
+
* - `Content` => The main content displayed
|
|
82
|
+
* - `Actions` => One or more actions to set after the element.
|
|
83
|
+
*
|
|
84
|
+
* @see https://www.figma.com/file/lzzrQmsfaXRaOyRfoEogPZ/DS%3A-playground?node-id=1%3A4076
|
|
85
|
+
*/
|
|
86
|
+
declare const BaseGenericBlock: BaseGenericBlock;
|
|
87
|
+
interface GenericBlock extends BaseGenericBlock {
|
|
88
|
+
/**
|
|
89
|
+
* Use `GenericBlock.Figure` component as children of the `GenericBlock` component as an alternative way to inject
|
|
90
|
+
* the "figure" section of the block (instead of using `figure` and `figureProps` props).
|
|
91
|
+
*/
|
|
92
|
+
Figure: Comp<GenericBlockSectionProps>;
|
|
93
|
+
/**
|
|
94
|
+
* Use `GenericBlock.Content` component as children of the `GenericBlock` component as an alternative way to inject
|
|
95
|
+
* the "content" section of the block (instead of using `content` and `contentProps` props).
|
|
96
|
+
*/
|
|
97
|
+
Content: Comp<GenericBlockSectionProps>;
|
|
98
|
+
/**
|
|
99
|
+
* Use `GenericBlock.Actions` component as children of the `GenericBlock` component as an alternative way to inject
|
|
100
|
+
* the "actions" section of the block (instead of using `actions` and `actionsProps` props).
|
|
101
|
+
*/
|
|
102
|
+
Actions: Comp<GenericBlockSectionProps>;
|
|
103
|
+
}
|
|
104
|
+
declare const GenericBlock: GenericBlock;
|
|
105
|
+
|
|
106
|
+
export { GenericBlockGapSize as G, GenericBlockProps as a, GenericBlock as b };
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import kebabCase from 'lodash/kebabCase';
|
|
2
|
+
import 'lodash/isBoolean';
|
|
3
|
+
import 'lodash/isEmpty';
|
|
4
|
+
import 'lodash/noop';
|
|
5
|
+
|
|
6
|
+
function ownKeys(object, enumerableOnly) {
|
|
7
|
+
var keys = Object.keys(object);
|
|
8
|
+
if (Object.getOwnPropertySymbols) {
|
|
9
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
10
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
11
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
12
|
+
})), keys.push.apply(keys, symbols);
|
|
13
|
+
}
|
|
14
|
+
return keys;
|
|
15
|
+
}
|
|
16
|
+
function _objectSpread2(target) {
|
|
17
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
18
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
19
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
20
|
+
_defineProperty(target, key, source[key]);
|
|
21
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
22
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return target;
|
|
26
|
+
}
|
|
27
|
+
function _defineProperty(obj, key, value) {
|
|
28
|
+
key = _toPropertyKey(key);
|
|
29
|
+
if (key in obj) {
|
|
30
|
+
Object.defineProperty(obj, key, {
|
|
31
|
+
value: value,
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true
|
|
35
|
+
});
|
|
36
|
+
} else {
|
|
37
|
+
obj[key] = value;
|
|
38
|
+
}
|
|
39
|
+
return obj;
|
|
40
|
+
}
|
|
41
|
+
function _extends() {
|
|
42
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
43
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
44
|
+
var source = arguments[i];
|
|
45
|
+
for (var key in source) {
|
|
46
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
47
|
+
target[key] = source[key];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
};
|
|
53
|
+
return _extends.apply(this, arguments);
|
|
54
|
+
}
|
|
55
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
56
|
+
if (source == null) return {};
|
|
57
|
+
var target = {};
|
|
58
|
+
var sourceKeys = Object.keys(source);
|
|
59
|
+
var key, i;
|
|
60
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
61
|
+
key = sourceKeys[i];
|
|
62
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
63
|
+
target[key] = source[key];
|
|
64
|
+
}
|
|
65
|
+
return target;
|
|
66
|
+
}
|
|
67
|
+
function _objectWithoutProperties(source, excluded) {
|
|
68
|
+
if (source == null) return {};
|
|
69
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
70
|
+
var key, i;
|
|
71
|
+
if (Object.getOwnPropertySymbols) {
|
|
72
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
73
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
74
|
+
key = sourceSymbolKeys[i];
|
|
75
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
76
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
77
|
+
target[key] = source[key];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return target;
|
|
81
|
+
}
|
|
82
|
+
function _toPrimitive(input, hint) {
|
|
83
|
+
if (typeof input !== "object" || input === null) return input;
|
|
84
|
+
var prim = input[Symbol.toPrimitive];
|
|
85
|
+
if (prim !== undefined) {
|
|
86
|
+
var res = prim.call(input, hint || "default");
|
|
87
|
+
if (typeof res !== "object") return res;
|
|
88
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
89
|
+
}
|
|
90
|
+
return (hint === "string" ? String : Number)(input);
|
|
91
|
+
}
|
|
92
|
+
function _toPropertyKey(arg) {
|
|
93
|
+
var key = _toPrimitive(arg, "string");
|
|
94
|
+
return typeof key === "symbol" ? key : String(key);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Alignments.
|
|
99
|
+
*/
|
|
100
|
+
const Alignment = {
|
|
101
|
+
bottom: 'bottom',
|
|
102
|
+
center: 'center',
|
|
103
|
+
end: 'end',
|
|
104
|
+
left: 'left',
|
|
105
|
+
right: 'right',
|
|
106
|
+
spaceAround: 'space-around',
|
|
107
|
+
spaceBetween: 'space-between',
|
|
108
|
+
spaceEvenly: 'space-evenly',
|
|
109
|
+
start: 'start',
|
|
110
|
+
top: 'top'
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* See SCSS variable $lumx-color-palette
|
|
114
|
+
*/
|
|
115
|
+
const ColorPalette = {
|
|
116
|
+
primary: 'primary',
|
|
117
|
+
secondary: 'secondary',
|
|
118
|
+
blue: 'blue',
|
|
119
|
+
dark: 'dark',
|
|
120
|
+
green: 'green',
|
|
121
|
+
yellow: 'yellow',
|
|
122
|
+
red: 'red',
|
|
123
|
+
light: 'light',
|
|
124
|
+
grey: 'grey'
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* See SCSS variable $lumx-color-variants
|
|
128
|
+
*/
|
|
129
|
+
const ColorVariant = {
|
|
130
|
+
D1: 'D1',
|
|
131
|
+
D2: 'D2',
|
|
132
|
+
L1: 'L1',
|
|
133
|
+
L2: 'L2',
|
|
134
|
+
L3: 'L3',
|
|
135
|
+
L4: 'L4',
|
|
136
|
+
L5: 'L5',
|
|
137
|
+
L6: 'L6',
|
|
138
|
+
N: 'N'
|
|
139
|
+
};
|
|
140
|
+
const Theme = {
|
|
141
|
+
light: 'light',
|
|
142
|
+
dark: 'dark'
|
|
143
|
+
};
|
|
144
|
+
const Size = {
|
|
145
|
+
xxs: 'xxs',
|
|
146
|
+
xs: 'xs',
|
|
147
|
+
s: 's',
|
|
148
|
+
m: 'm',
|
|
149
|
+
l: 'l',
|
|
150
|
+
xl: 'xl',
|
|
151
|
+
xxl: 'xxl',
|
|
152
|
+
tiny: 'tiny',
|
|
153
|
+
regular: 'regular',
|
|
154
|
+
medium: 'medium',
|
|
155
|
+
big: 'big',
|
|
156
|
+
huge: 'huge'
|
|
157
|
+
};
|
|
158
|
+
const Orientation = {
|
|
159
|
+
horizontal: 'horizontal',
|
|
160
|
+
vertical: 'vertical'
|
|
161
|
+
};
|
|
162
|
+
const Emphasis = {
|
|
163
|
+
low: 'low',
|
|
164
|
+
medium: 'medium',
|
|
165
|
+
high: 'high'
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* List of typographies that can't be customized.
|
|
169
|
+
*/
|
|
170
|
+
const TypographyInterface = {
|
|
171
|
+
overline: 'overline',
|
|
172
|
+
caption: 'caption',
|
|
173
|
+
body1: 'body1',
|
|
174
|
+
body2: 'body2',
|
|
175
|
+
subtitle1: 'subtitle1',
|
|
176
|
+
subtitle2: 'subtitle2',
|
|
177
|
+
title: 'title',
|
|
178
|
+
headline: 'headline',
|
|
179
|
+
display1: 'display1'
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* List of title typographies that can be customized (via CSS variables).
|
|
183
|
+
*/
|
|
184
|
+
const TypographyTitleCustom = {
|
|
185
|
+
title1: 'custom-title1',
|
|
186
|
+
title2: 'custom-title2',
|
|
187
|
+
title3: 'custom-title3',
|
|
188
|
+
title4: 'custom-title4',
|
|
189
|
+
title5: 'custom-title5',
|
|
190
|
+
title6: 'custom-title6'
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* List of typographies that can be customized (via CSS variables).
|
|
194
|
+
*/
|
|
195
|
+
const TypographyCustom = _objectSpread2(_objectSpread2({}, TypographyTitleCustom), {}, {
|
|
196
|
+
intro: 'custom-intro',
|
|
197
|
+
'body-large': 'custom-body-large',
|
|
198
|
+
body: 'custom-body',
|
|
199
|
+
quote: 'custom-quote',
|
|
200
|
+
'publish-info': 'custom-publish-info',
|
|
201
|
+
button: 'custom-button'
|
|
202
|
+
});
|
|
203
|
+
/**
|
|
204
|
+
* List of all typographies.
|
|
205
|
+
*/
|
|
206
|
+
const Typography = _objectSpread2(_objectSpread2({}, TypographyInterface), {}, {
|
|
207
|
+
custom: TypographyCustom
|
|
208
|
+
});
|
|
209
|
+
/**
|
|
210
|
+
* All available aspect ratios.
|
|
211
|
+
*/
|
|
212
|
+
const AspectRatio = {
|
|
213
|
+
/** Intrinsic content ratio. */
|
|
214
|
+
original: 'original',
|
|
215
|
+
/** Ratio 3:1 */
|
|
216
|
+
panoramic: 'panoramic',
|
|
217
|
+
/** Ratio 16:9 */
|
|
218
|
+
wide: 'wide',
|
|
219
|
+
/** Ratio 3:2 */
|
|
220
|
+
horizontal: 'horizontal',
|
|
221
|
+
/** Ratio 3:2 */
|
|
222
|
+
vertical: 'vertical',
|
|
223
|
+
/** Ratio 1:1 */
|
|
224
|
+
square: 'square',
|
|
225
|
+
/** Ratio constrained by the parent. */
|
|
226
|
+
free: 'free'
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Semantic info about the purpose of the component
|
|
230
|
+
*/
|
|
231
|
+
const Kind = {
|
|
232
|
+
info: 'info',
|
|
233
|
+
success: 'success',
|
|
234
|
+
warning: 'warning',
|
|
235
|
+
error: 'error'
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Re-exporting some utils types.
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
function createCommonjsModule(fn, basedir, module) {
|
|
243
|
+
return module = {
|
|
244
|
+
path: basedir,
|
|
245
|
+
exports: {},
|
|
246
|
+
require: function (path, base) {
|
|
247
|
+
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
|
248
|
+
}
|
|
249
|
+
}, fn(module, module.exports), module.exports;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function commonjsRequire () {
|
|
253
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
var classnames = createCommonjsModule(function (module) {
|
|
257
|
+
/*!
|
|
258
|
+
Copyright (c) 2018 Jed Watson.
|
|
259
|
+
Licensed under the MIT License (MIT), see
|
|
260
|
+
http://jedwatson.github.io/classnames
|
|
261
|
+
*/
|
|
262
|
+
/* global define */
|
|
263
|
+
|
|
264
|
+
(function () {
|
|
265
|
+
|
|
266
|
+
var hasOwn = {}.hasOwnProperty;
|
|
267
|
+
|
|
268
|
+
function classNames() {
|
|
269
|
+
var classes = [];
|
|
270
|
+
|
|
271
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
272
|
+
var arg = arguments[i];
|
|
273
|
+
if (!arg) continue;
|
|
274
|
+
|
|
275
|
+
var argType = typeof arg;
|
|
276
|
+
|
|
277
|
+
if (argType === 'string' || argType === 'number') {
|
|
278
|
+
classes.push(arg);
|
|
279
|
+
} else if (Array.isArray(arg)) {
|
|
280
|
+
if (arg.length) {
|
|
281
|
+
var inner = classNames.apply(null, arg);
|
|
282
|
+
if (inner) {
|
|
283
|
+
classes.push(inner);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
} else if (argType === 'object') {
|
|
287
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
288
|
+
classes.push(arg.toString());
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
for (var key in arg) {
|
|
293
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
294
|
+
classes.push(key);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return classes.join(' ');
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if ( module.exports) {
|
|
304
|
+
classNames.default = classNames;
|
|
305
|
+
module.exports = classNames;
|
|
306
|
+
} else {
|
|
307
|
+
window.classNames = classNames;
|
|
308
|
+
}
|
|
309
|
+
}());
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* The prefix to use for the CSS classes.
|
|
314
|
+
*/
|
|
315
|
+
const CSS_PREFIX = 'lumx';
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Delay on hover after which we open or close the tooltip.
|
|
319
|
+
* Only applies to devices supporting pointer hover.
|
|
320
|
+
*/
|
|
321
|
+
const TOOLTIP_HOVER_DELAY = {
|
|
322
|
+
open: 500,
|
|
323
|
+
close: 0
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Delay on long press after which we open or close the tooltip.
|
|
328
|
+
* Only applies to devices not supporting pointer hover.
|
|
329
|
+
*/
|
|
330
|
+
const TOOLTIP_LONG_PRESS_DELAY = {
|
|
331
|
+
open: 250,
|
|
332
|
+
close: 3000
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
// See https://regex101.com/r/YjS1uI/3
|
|
336
|
+
const LAST_PART_CLASSNAME = /^(.*)-(.+)$/gi;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Get the name of the root CSS class of a component based on its name.
|
|
340
|
+
*
|
|
341
|
+
* @param componentName The name of the component. This name should contains the component prefix and be
|
|
342
|
+
* written in PascalCase.
|
|
343
|
+
* @param subComponent Whether the current component is a sub component, if true, define the class according
|
|
344
|
+
* to BEM standards.
|
|
345
|
+
* @return The name of the root CSS class. This classname include the CSS classname prefix and is written in
|
|
346
|
+
* lower-snake-case.
|
|
347
|
+
*/
|
|
348
|
+
function getRootClassName(componentName, subComponent) {
|
|
349
|
+
const formattedClassName = `${CSS_PREFIX}-${kebabCase(componentName)}`;
|
|
350
|
+
if (subComponent) {
|
|
351
|
+
return formattedClassName.replace(LAST_PART_CLASSNAME, '$1__$2');
|
|
352
|
+
}
|
|
353
|
+
return formattedClassName;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Returns the classname associated to the given color and variant.
|
|
358
|
+
* For example, for 'dark' and 'L2' it returns `lumx-color-font-dark-l2`
|
|
359
|
+
*/
|
|
360
|
+
const getFontColorClassName = function (color) {
|
|
361
|
+
let colorVariant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ColorVariant.N;
|
|
362
|
+
return `lumx-color-font-${color}-${colorVariant}`;
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Returns the classname associated to the given typography.
|
|
367
|
+
* For example, for `Typography.title` it returns `lumx-typography-title`
|
|
368
|
+
*/
|
|
369
|
+
const getTypographyClassName = typography => {
|
|
370
|
+
return `lumx-typography-${typography}`;
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
export { Alignment as A, ColorPalette as C, Emphasis as E, Kind as K, Orientation as O, Size as S, Theme as T, _objectWithoutProperties as _, _extends as a, ColorVariant as b, classnames as c, TypographyInterface as d, TypographyTitleCustom as e, TypographyCustom as f, getRootClassName as g, Typography as h, AspectRatio as i, _objectSpread2 as j, getFontColorClassName as k, getTypographyClassName as l, createCommonjsModule as m, CSS_PREFIX as n, TOOLTIP_LONG_PRESS_DELAY as o, TOOLTIP_HOVER_DELAY as p };
|
|
374
|
+
//# sourceMappingURL=35c3a78f.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"35c3a78f.js","sources":["../../src/components/index.ts","../../../../node_modules/classnames/index.js","../../../lumx-core/src/js/constants/index.ts","../../src/utils/className.ts"],"sourcesContent":["import { ValueOf } from '@lumx/react/utils/type';\n\n/**\n * Alignments.\n */\nexport const Alignment = {\n bottom: 'bottom',\n center: 'center',\n end: 'end',\n left: 'left',\n right: 'right',\n spaceAround: 'space-around',\n spaceBetween: 'space-between',\n spaceEvenly: 'space-evenly',\n start: 'start',\n top: 'top',\n} as const;\nexport type Alignment = ValueOf<typeof Alignment>;\nexport type VerticalAlignment = Extract<Alignment, 'top' | 'center' | 'bottom'>;\nexport type HorizontalAlignment = Extract<Alignment, 'right' | 'center' | 'left'>;\n\n/**\n * See SCSS variable $lumx-color-palette\n */\nexport const ColorPalette = {\n primary: 'primary',\n secondary: 'secondary',\n blue: 'blue',\n dark: 'dark',\n green: 'green',\n yellow: 'yellow',\n red: 'red',\n light: 'light',\n grey: 'grey',\n} as const;\nexport type ColorPalette = ValueOf<typeof ColorPalette>;\nexport type Color = ColorPalette | string;\n\n/**\n * See SCSS variable $lumx-color-variants\n */\nexport const ColorVariant = {\n D1: 'D1',\n D2: 'D2',\n L1: 'L1',\n L2: 'L2',\n L3: 'L3',\n L4: 'L4',\n L5: 'L5',\n L6: 'L6',\n N: 'N',\n} as const;\nexport type ColorVariant = ValueOf<typeof ColorVariant>;\n\nexport const Theme = {\n light: 'light',\n dark: 'dark',\n} as const;\nexport type Theme = ValueOf<typeof Theme>;\n\nexport const Size = {\n xxs: 'xxs',\n xs: 'xs',\n s: 's',\n m: 'm',\n l: 'l',\n xl: 'xl',\n xxl: 'xxl',\n tiny: 'tiny',\n regular: 'regular',\n medium: 'medium',\n big: 'big',\n huge: 'huge',\n} as const;\nexport type Size = ValueOf<typeof Size>;\nexport type GlobalSize = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;\n\nexport const Orientation = {\n horizontal: 'horizontal',\n vertical: 'vertical',\n} as const;\nexport type Orientation = ValueOf<typeof Orientation>;\n\nexport const Emphasis = {\n low: 'low',\n medium: 'medium',\n high: 'high',\n} as const;\nexport type Emphasis = ValueOf<typeof Emphasis>;\n\n/**\n * List of typographies that can't be customized.\n */\nexport const TypographyInterface = {\n overline: 'overline',\n caption: 'caption',\n body1: 'body1',\n body2: 'body2',\n subtitle1: 'subtitle1',\n subtitle2: 'subtitle2',\n title: 'title',\n headline: 'headline',\n display1: 'display1',\n} as const;\nexport type TypographyInterface = ValueOf<typeof TypographyInterface>;\n\n/**\n * List of title typographies that can be customized (via CSS variables).\n */\nexport const TypographyTitleCustom = {\n title1: 'custom-title1',\n title2: 'custom-title2',\n title3: 'custom-title3',\n title4: 'custom-title4',\n title5: 'custom-title5',\n title6: 'custom-title6',\n} as const;\nexport type TypographyTitleCustom = ValueOf<typeof TypographyTitleCustom>;\n\n/**\n * List of typographies that can be customized (via CSS variables).\n */\nexport const TypographyCustom = {\n ...TypographyTitleCustom,\n intro: 'custom-intro',\n 'body-large': 'custom-body-large',\n body: 'custom-body',\n quote: 'custom-quote',\n 'publish-info': 'custom-publish-info',\n button: 'custom-button',\n} as const;\nexport type TypographyCustom = ValueOf<typeof TypographyCustom>;\n\n/**\n * List of all typographies.\n */\nexport const Typography = {\n ...TypographyInterface,\n custom: TypographyCustom,\n} as const;\nexport type Typography = TypographyInterface | TypographyCustom;\n\n/**\n * All available aspect ratios.\n */\nexport const AspectRatio = {\n /** Intrinsic content ratio. */\n original: 'original',\n /** Ratio 3:1 */\n panoramic: 'panoramic',\n /** Ratio 16:9 */\n wide: 'wide',\n /** Ratio 3:2 */\n horizontal: 'horizontal',\n /** Ratio 3:2 */\n vertical: 'vertical',\n /** Ratio 1:1 */\n square: 'square',\n /** Ratio constrained by the parent. */\n free: 'free',\n} as const;\nexport type AspectRatio = ValueOf<typeof AspectRatio>;\n\n/**\n * Semantic info about the purpose of the component\n */\nexport const Kind = {\n info: 'info',\n success: 'success',\n warning: 'warning',\n error: 'error',\n} as const;\nexport type Kind = ValueOf<typeof Kind>;\n\n/**\n * Re-exporting some utils types.\n */\nexport type { HeadingElement, TextElement, GenericProps, Callback } from '../utils/type';\n","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\tvar nativeCodeString = '[native code]';\n\n\tfunction classNames() {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tif (arg.length) {\n\t\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\t\tif (inner) {\n\t\t\t\t\t\tclasses.push(inner);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\t\t\tclasses.push(arg.toString());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","/**\n * The prefix to use for the CSS classes.\n */\nexport const CSS_PREFIX = 'lumx';\n\n/**\n * Key codes.\n */\nexport * from './keycodes';\n\n/**\n * Animation duration constants. Take into consideration that if you change one of these variables,\n * you need to update their scss counterpart as well\n */\nexport const DIALOG_TRANSITION_DURATION = 400;\nexport const NOTIFICATION_TRANSITION_DURATION = 200;\nexport const SLIDESHOW_TRANSITION_DURATION = 5000;\n\n/**\n * Delay on hover after which we open or close the tooltip.\n * Only applies to devices supporting pointer hover.\n */\nexport const TOOLTIP_HOVER_DELAY = {\n open: 500,\n close: 0,\n};\n\n/**\n * Delay on long press after which we open or close the tooltip.\n * Only applies to devices not supporting pointer hover.\n */\nexport const TOOLTIP_LONG_PRESS_DELAY = {\n open: 250,\n close: 3000,\n};\n","import { CSS_PREFIX } from '@lumx/react/constants';\n\nimport kebabCase from 'lodash/kebabCase';\nimport { ColorPalette, ColorVariant, Typography } from '@lumx/react/components';\n\n// See https://regex101.com/r/YjS1uI/3\nconst LAST_PART_CLASSNAME = /^(.*)-(.+)$/gi;\n\nexport { getBasicClass, handleBasicClasses } from '@lumx/core/js/utils';\n\n/**\n * Get the name of the root CSS class of a component based on its name.\n *\n * @param componentName The name of the component. This name should contains the component prefix and be\n * written in PascalCase.\n * @param subComponent Whether the current component is a sub component, if true, define the class according\n * to BEM standards.\n * @return The name of the root CSS class. This classname include the CSS classname prefix and is written in\n * lower-snake-case.\n */\nexport function getRootClassName(componentName: string, subComponent?: boolean): string {\n const formattedClassName = `${CSS_PREFIX}-${kebabCase(componentName)}`;\n\n if (subComponent) {\n return formattedClassName.replace(LAST_PART_CLASSNAME, '$1__$2');\n }\n return formattedClassName;\n}\n\n/**\n * Returns the classname associated to the given color and variant.\n * For example, for 'dark' and 'L2' it returns `lumx-color-font-dark-l2`\n */\nexport const getFontColorClassName = (color: ColorPalette, colorVariant: ColorVariant = ColorVariant.N) => {\n return `lumx-color-font-${color}-${colorVariant}`;\n};\n\n/**\n * Returns the classname associated to the given typography.\n * For example, for `Typography.title` it returns `lumx-typography-title`\n */\nexport const getTypographyClassName = (typography: Typography) => {\n return `lumx-typography-${typography}`;\n};\n"],"names":["Alignment","bottom","center","end","left","right","spaceAround","spaceBetween","spaceEvenly","start","top","ColorPalette","primary","secondary","blue","dark","green","yellow","red","light","grey","ColorVariant","D1","D2","L1","L2","L3","L4","L5","L6","N","Theme","Size","xxs","xs","s","m","l","xl","xxl","tiny","regular","medium","big","huge","Orientation","horizontal","vertical","Emphasis","low","high","TypographyInterface","overline","caption","body1","body2","subtitle1","subtitle2","title","headline","display1","TypographyTitleCustom","title1","title2","title3","title4","title5","title6","TypographyCustom","_objectSpread","intro","body","quote","button","Typography","custom","AspectRatio","original","panoramic","wide","square","free","Kind","info","success","warning","error","CSS_PREFIX","TOOLTIP_HOVER_DELAY","open","close","TOOLTIP_LONG_PRESS_DELAY","LAST_PART_CLASSNAME","getRootClassName","componentName","subComponent","formattedClassName","kebabCase","replace","getFontColorClassName","color","colorVariant","arguments","length","undefined","getTypographyClassName","typography"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;MACaA,SAAS,GAAG;EACrBC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE,QAAQ;EAChBC,GAAG,EAAE,KAAK;EACVC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,OAAO;EACdC,WAAW,EAAE,cAAc;EAC3BC,YAAY,EAAE,eAAe;EAC7BC,WAAW,EAAE,cAAc;EAC3BC,KAAK,EAAE,OAAO;EACdC,GAAG,EAAE;AACT;AA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
+
import { g as getRootClassName, _ as _objectWithoutProperties, j as _objectSpread2, c as classnames, S as Size, a as _extends, O as Orientation, T as Theme, C as ColorPalette } from './35c3a78f.js';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import isEmpty from 'lodash/isEmpty';
|
|
4
|
+
import { h as handleBasicClasses } from './3f5e7653.js';
|
|
5
|
+
import { A as Avatar } from './cfd18b6d.js';
|
|
6
|
+
import { L as Link } from './c70420da.js';
|
|
7
|
+
import set from 'lodash/set';
|
|
8
|
+
|
|
9
|
+
const _excluded = ["avatarProps", "className", "fields", "linkProps", "linkAs", "multipleActions", "name", "nameProps", "onClick", "onMouseEnter", "onMouseLeave", "orientation", "simpleAction", "size", "theme"];
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* User block sizes.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Defines the props of the component.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Component display name.
|
|
21
|
+
*/
|
|
22
|
+
const COMPONENT_NAME = 'UserBlock';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Component default class name and class prefix.
|
|
26
|
+
*/
|
|
27
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Component default props.
|
|
31
|
+
*/
|
|
32
|
+
const DEFAULT_PROPS = {
|
|
33
|
+
orientation: Orientation.horizontal,
|
|
34
|
+
size: Size.m,
|
|
35
|
+
theme: Theme.light
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* UserBlock component.
|
|
40
|
+
*
|
|
41
|
+
* @param props Component props.
|
|
42
|
+
* @param ref Component ref.
|
|
43
|
+
* @return React element.
|
|
44
|
+
*/
|
|
45
|
+
const UserBlock = /*#__PURE__*/forwardRef((props, ref) => {
|
|
46
|
+
const {
|
|
47
|
+
avatarProps,
|
|
48
|
+
className,
|
|
49
|
+
fields,
|
|
50
|
+
linkProps,
|
|
51
|
+
linkAs,
|
|
52
|
+
multipleActions,
|
|
53
|
+
name,
|
|
54
|
+
nameProps,
|
|
55
|
+
onClick,
|
|
56
|
+
onMouseEnter,
|
|
57
|
+
onMouseLeave,
|
|
58
|
+
orientation,
|
|
59
|
+
simpleAction,
|
|
60
|
+
size,
|
|
61
|
+
theme
|
|
62
|
+
} = props,
|
|
63
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
64
|
+
let componentSize = size;
|
|
65
|
+
|
|
66
|
+
// Special case - When using vertical orientation force the size to be Sizes.l.
|
|
67
|
+
if (orientation === Orientation.vertical) {
|
|
68
|
+
componentSize = Size.l;
|
|
69
|
+
}
|
|
70
|
+
const shouldDisplayActions = orientation === Orientation.vertical;
|
|
71
|
+
const isLink = Boolean((linkProps === null || linkProps === void 0 ? void 0 : linkProps.href) || linkAs);
|
|
72
|
+
const isClickable = !!onClick || isLink;
|
|
73
|
+
const nameBlock = React.useMemo(() => {
|
|
74
|
+
if (isEmpty(name)) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
let NameComponent = 'span';
|
|
78
|
+
const nProps = _objectSpread2(_objectSpread2({}, nameProps), {}, {
|
|
79
|
+
className: classnames(`${CLASSNAME}__name`, linkProps === null || linkProps === void 0 ? void 0 : linkProps.className, nameProps === null || nameProps === void 0 ? void 0 : nameProps.className)
|
|
80
|
+
});
|
|
81
|
+
if (isClickable) {
|
|
82
|
+
NameComponent = Link;
|
|
83
|
+
Object.assign(nProps, _objectSpread2(_objectSpread2({}, linkProps), {}, {
|
|
84
|
+
onClick,
|
|
85
|
+
linkAs,
|
|
86
|
+
color: ColorPalette.dark
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
// Disable avatar focus since the name block is the same link / same button.
|
|
90
|
+
if (avatarProps) {
|
|
91
|
+
set(avatarProps, ['thumbnailProps', 'tabIndex'], -1);
|
|
92
|
+
}
|
|
93
|
+
return /*#__PURE__*/React.createElement(NameComponent, nProps, name);
|
|
94
|
+
}, [avatarProps, isClickable, linkAs, linkProps, name, nameProps, onClick]);
|
|
95
|
+
const fieldsBlock = fields && componentSize !== Size.s && /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: `${CLASSNAME}__fields`
|
|
97
|
+
}, fields.map((field, idx) => /*#__PURE__*/React.createElement("span", {
|
|
98
|
+
key: idx,
|
|
99
|
+
className: `${CLASSNAME}__field`
|
|
100
|
+
}, field)));
|
|
101
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
102
|
+
ref: ref
|
|
103
|
+
}, forwardedProps, {
|
|
104
|
+
className: classnames(className, handleBasicClasses({
|
|
105
|
+
prefix: CLASSNAME,
|
|
106
|
+
orientation,
|
|
107
|
+
size: componentSize,
|
|
108
|
+
theme,
|
|
109
|
+
isClickable
|
|
110
|
+
})),
|
|
111
|
+
onMouseLeave: onMouseLeave,
|
|
112
|
+
onMouseEnter: onMouseEnter
|
|
113
|
+
}), avatarProps && /*#__PURE__*/React.createElement(Avatar, _extends({
|
|
114
|
+
linkAs: linkAs,
|
|
115
|
+
linkProps: linkProps,
|
|
116
|
+
alt: ""
|
|
117
|
+
}, avatarProps, {
|
|
118
|
+
className: classnames(`${CLASSNAME}__avatar`, avatarProps.className),
|
|
119
|
+
size: componentSize,
|
|
120
|
+
onClick: onClick,
|
|
121
|
+
theme: theme
|
|
122
|
+
})), (fields || name) && /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
className: `${CLASSNAME}__wrapper`
|
|
124
|
+
}, nameBlock, fieldsBlock), shouldDisplayActions && simpleAction && /*#__PURE__*/React.createElement("div", {
|
|
125
|
+
className: `${CLASSNAME}__action`
|
|
126
|
+
}, simpleAction), shouldDisplayActions && multipleActions && /*#__PURE__*/React.createElement("div", {
|
|
127
|
+
className: `${CLASSNAME}__actions`
|
|
128
|
+
}, multipleActions));
|
|
129
|
+
});
|
|
130
|
+
UserBlock.displayName = COMPONENT_NAME;
|
|
131
|
+
UserBlock.className = CLASSNAME;
|
|
132
|
+
UserBlock.defaultProps = DEFAULT_PROPS;
|
|
133
|
+
|
|
134
|
+
export { UserBlock as U };
|
|
135
|
+
//# sourceMappingURL=3669449c.js.map
|