@doist/reactist 25.0.0-beta.2 → 25.0.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/README.md +35 -16
- package/dist/reactist.cjs.development.js +448 -422
- package/dist/reactist.cjs.development.js.map +1 -1
- package/dist/reactist.cjs.production.min.js +1 -1
- package/dist/reactist.cjs.production.min.js.map +1 -1
- package/es/alert/alert.js +13 -13
- package/es/alert/alert.js.map +1 -1
- package/es/alert/alert.module.css.js +1 -1
- package/es/avatar/avatar.js +6 -6
- package/es/avatar/avatar.js.map +1 -1
- package/es/avatar/avatar.module.css.js +1 -1
- package/es/avatar/utils.js.map +1 -1
- package/es/badge/badge.js +4 -4
- package/es/badge/badge.js.map +1 -1
- package/es/badge/badge.module.css.js +1 -1
- package/es/banner/banner.js +16 -16
- package/es/banner/banner.js.map +1 -1
- package/es/banner/banner.module.css.js +1 -1
- package/es/base-field/base-field.js +25 -25
- package/es/base-field/base-field.js.map +1 -1
- package/es/base-field/base-field.module.css.js +1 -1
- package/es/box/box.js +12 -12
- package/es/box/box.js.map +1 -1
- package/es/box/box.module.css.js +1 -1
- package/es/box/gap.module.css.js +1 -1
- package/es/box/margin.module.css.js +1 -1
- package/es/box/padding.module.css.js +1 -1
- package/es/box/width.module.css.js +1 -1
- package/es/button/button.js +19 -19
- package/es/button/button.js.map +1 -1
- package/es/button/button.module.css.js +1 -1
- package/es/checkbox-field/checkbox-field.js +16 -16
- package/es/checkbox-field/checkbox-field.js.map +1 -1
- package/es/checkbox-field/checkbox-field.module.css.js +1 -1
- package/es/checkbox-field/checkbox-icon.js +3 -3
- package/es/checkbox-field/checkbox-icon.js.map +1 -1
- package/es/checkbox-field/use-fork-ref.js.map +1 -1
- package/es/columns/columns.js +6 -6
- package/es/columns/columns.js.map +1 -1
- package/es/columns/columns.module.css.js +1 -1
- package/es/components/color-picker/color-picker.js +11 -11
- package/es/components/color-picker/color-picker.js.map +1 -1
- package/es/components/color-picker/index.js +1 -5
- package/es/components/color-picker/index.js.map +1 -1
- package/es/components/deprecated-button/deprecated-button.js +4 -4
- package/es/components/deprecated-button/deprecated-button.js.map +1 -1
- package/es/components/deprecated-button/index.js +1 -4
- package/es/components/deprecated-button/index.js.map +1 -1
- package/es/components/deprecated-dropdown/dropdown.js +11 -11
- package/es/components/deprecated-dropdown/dropdown.js.map +1 -1
- package/es/components/deprecated-dropdown/index.js +1 -4
- package/es/components/deprecated-dropdown/index.js.map +1 -1
- package/es/components/deprecated-input/index.js +1 -4
- package/es/components/deprecated-input/index.js.map +1 -1
- package/es/components/deprecated-input/input.js +3 -3
- package/es/components/deprecated-input/input.js.map +1 -1
- package/es/components/deprecated-select/index.js +1 -4
- package/es/components/deprecated-select/index.js.map +1 -1
- package/es/components/deprecated-select/select.js +3 -3
- package/es/components/deprecated-select/select.js.map +1 -1
- package/es/components/key-capturer/index.js +1 -5
- package/es/components/key-capturer/index.js.map +1 -1
- package/es/components/key-capturer/key-capturer.js +3 -3
- package/es/components/key-capturer/key-capturer.js.map +1 -1
- package/es/components/keyboard-shortcut/index.js +1 -4
- package/es/components/keyboard-shortcut/index.js.map +1 -1
- package/es/components/keyboard-shortcut/keyboard-shortcut.js +4 -4
- package/es/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
- package/es/components/progress-bar/index.js +1 -4
- package/es/components/progress-bar/index.js.map +1 -1
- package/es/components/progress-bar/progress-bar.js +5 -5
- package/es/components/progress-bar/progress-bar.js.map +1 -1
- package/es/components/time/index.js +1 -4
- package/es/components/time/index.js.map +1 -1
- package/es/components/time/time-utils.js.map +1 -1
- package/es/components/time/time.js +5 -5
- package/es/components/time/time.js.map +1 -1
- package/es/divider/divider.js +4 -4
- package/es/divider/divider.js.map +1 -1
- package/es/divider/divider.module.css.js +1 -1
- package/es/heading/heading.js +5 -5
- package/es/heading/heading.js.map +1 -1
- package/es/heading/heading.module.css.js +1 -1
- package/es/hidden/hidden.js +5 -5
- package/es/hidden/hidden.js.map +1 -1
- package/es/hidden/hidden.module.css.js +1 -1
- package/es/hidden-visually/hidden-visually.js +4 -4
- package/es/hidden-visually/hidden-visually.js.map +1 -1
- package/es/hidden-visually/hidden-visually.module.css.js +1 -1
- package/es/icons/alert-icon.js +10 -10
- package/es/icons/alert-icon.js.map +1 -1
- package/es/icons/close-icon.js +3 -3
- package/es/icons/close-icon.js.map +1 -1
- package/es/icons/password-hidden-icon.js +6 -6
- package/es/icons/password-hidden-icon.js.map +1 -1
- package/es/icons/password-visible-icon.js +5 -5
- package/es/icons/password-visible-icon.js.map +1 -1
- package/es/index.js +13 -15
- package/es/index.js.map +1 -1
- package/es/inline/inline.js +2 -2
- package/es/inline/inline.js.map +1 -1
- package/es/loading/loading.js +3 -3
- package/es/loading/loading.js.map +1 -1
- package/es/menu/menu.js +32 -32
- package/es/menu/menu.js.map +1 -1
- package/es/modal/modal.js +45 -45
- package/es/modal/modal.js.map +1 -1
- package/es/modal/modal.module.css.js +1 -1
- package/es/notice/notice.js +8 -8
- package/es/notice/notice.js.map +1 -1
- package/es/notice/notice.module.css.js +1 -1
- package/es/password-field/password-field.js +7 -7
- package/es/password-field/password-field.js.map +1 -1
- package/es/prose/prose.js +4 -4
- package/es/prose/prose.js.map +1 -1
- package/es/prose/prose.module.css.js +1 -1
- package/es/select-field/select-field.js +11 -11
- package/es/select-field/select-field.js.map +1 -1
- package/es/select-field/select-field.module.css.js +1 -1
- package/es/spinner/spinner.js +9 -9
- package/es/spinner/spinner.js.map +1 -1
- package/es/spinner/spinner.module.css.js +1 -1
- package/es/stack/stack.js +4 -4
- package/es/stack/stack.js.map +1 -1
- package/es/switch-field/switch-field.js +18 -18
- package/es/switch-field/switch-field.js.map +1 -1
- package/es/switch-field/switch-field.module.css.js +1 -1
- package/es/tabs/tabs.js +23 -23
- package/es/tabs/tabs.js.map +1 -1
- package/es/tabs/tabs.module.css.js +1 -1
- package/es/text/text.js +5 -5
- package/es/text/text.js.map +1 -1
- package/es/text/text.module.css.js +1 -1
- package/es/text-area/text-area.js +14 -14
- package/es/text-area/text-area.js.map +1 -1
- package/es/text-area/text-area.module.css.js +1 -1
- package/es/text-field/text-field.js +13 -13
- package/es/text-field/text-field.js.map +1 -1
- package/es/text-field/text-field.module.css.js +1 -1
- package/es/text-link/text-link.js +5 -5
- package/es/text-link/text-link.js.map +1 -1
- package/es/text-link/text-link.module.css.js +1 -1
- package/es/toast/static-toast.js +5 -5
- package/es/toast/static-toast.js.map +1 -1
- package/es/toast/toast-animation.js.map +1 -1
- package/es/toast/toast.module.css.js +1 -1
- package/es/toast/use-toasts.js +4 -4
- package/es/toast/use-toasts.js.map +1 -1
- package/es/tooltip/tooltip.js +9 -9
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/tooltip/tooltip.module.css.js +1 -1
- package/es/utils/common-helpers.js +2 -2
- package/es/utils/common-helpers.js.map +1 -1
- package/es/utils/polymorphism.js +2 -2
- package/es/utils/polymorphism.js.map +1 -1
- package/es/utils/responsive-props.js.map +1 -1
- package/lib/alert/alert.d.ts +3 -3
- package/lib/alert/alert.js +1 -1
- package/lib/alert/alert.js.map +1 -1
- package/lib/avatar/avatar.d.ts +2 -2
- package/lib/avatar/avatar.js +1 -1
- package/lib/avatar/avatar.js.map +1 -1
- package/lib/avatar/utils.js.map +1 -1
- package/lib/badge/badge.d.ts +2 -2
- package/lib/badge/badge.js +1 -1
- package/lib/badge/badge.js.map +1 -1
- package/lib/banner/banner.d.ts +2 -2
- package/lib/banner/banner.js +1 -1
- package/lib/banner/banner.js.map +1 -1
- package/lib/base-field/base-field.d.ts +9 -9
- package/lib/base-field/base-field.js +1 -1
- package/lib/base-field/base-field.js.map +1 -1
- package/lib/box/box.d.ts +15 -15
- package/lib/box/box.js +1 -1
- package/lib/box/box.js.map +1 -1
- package/lib/button/button.d.ts +4 -4
- package/lib/button/button.js +1 -1
- package/lib/button/button.js.map +1 -1
- package/lib/checkbox-field/checkbox-field.js +1 -1
- package/lib/checkbox-field/checkbox-field.js.map +1 -1
- package/lib/checkbox-field/checkbox-icon.d.ts +1 -1
- package/lib/checkbox-field/checkbox-icon.js +1 -1
- package/lib/checkbox-field/checkbox-icon.js.map +1 -1
- package/lib/checkbox-field/use-fork-ref.js.map +1 -1
- package/lib/columns/columns.d.ts +4 -4
- package/lib/columns/columns.js +1 -1
- package/lib/columns/columns.js.map +1 -1
- package/lib/components/color-picker/color-picker.d.ts +3 -3
- package/lib/components/color-picker/color-picker.js +1 -1
- package/lib/components/color-picker/color-picker.js.map +1 -1
- package/lib/components/deprecated-button/deprecated-button.d.ts +4 -4
- package/lib/components/deprecated-button/deprecated-button.js +1 -1
- package/lib/components/deprecated-button/deprecated-button.js.map +1 -1
- package/lib/components/deprecated-dropdown/dropdown.d.ts +5 -5
- package/lib/components/deprecated-dropdown/dropdown.js +1 -1
- package/lib/components/deprecated-dropdown/dropdown.js.map +1 -1
- package/lib/components/deprecated-input/input.js +1 -1
- package/lib/components/deprecated-input/input.js.map +1 -1
- package/lib/components/deprecated-select/select.d.ts +2 -2
- package/lib/components/deprecated-select/select.js +1 -1
- package/lib/components/deprecated-select/select.js.map +1 -1
- package/lib/components/key-capturer/key-capturer.d.ts +5 -5
- package/lib/components/key-capturer/key-capturer.js +1 -1
- package/lib/components/key-capturer/key-capturer.js.map +1 -1
- package/lib/components/keyboard-shortcut/keyboard-shortcut.d.ts +3 -3
- package/lib/components/keyboard-shortcut/keyboard-shortcut.js +1 -1
- package/lib/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
- package/lib/components/progress-bar/progress-bar.d.ts +1 -1
- package/lib/components/progress-bar/progress-bar.js +1 -1
- package/lib/components/progress-bar/progress-bar.js.map +1 -1
- package/lib/components/time/time-utils.d.ts +1 -1
- package/lib/components/time/time-utils.js +1 -1
- package/lib/components/time/time-utils.js.map +1 -1
- package/lib/components/time/time.d.ts +2 -2
- package/lib/components/time/time.js +1 -1
- package/lib/components/time/time.js.map +1 -1
- package/lib/divider/divider.js +1 -1
- package/lib/divider/divider.js.map +1 -1
- package/lib/heading/heading.d.ts +2 -2
- package/lib/heading/heading.js +1 -1
- package/lib/heading/heading.js.map +1 -1
- package/lib/hidden/hidden.d.ts +4 -4
- package/lib/hidden/hidden.js +1 -1
- package/lib/hidden/hidden.js.map +1 -1
- package/lib/hidden-visually/hidden-visually.d.ts +1 -1
- package/lib/hidden-visually/hidden-visually.js +1 -1
- package/lib/hidden-visually/hidden-visually.js.map +1 -1
- package/lib/icons/alert-icon.js +1 -1
- package/lib/icons/alert-icon.js.map +1 -1
- package/lib/icons/close-icon.js +1 -1
- package/lib/icons/close-icon.js.map +1 -1
- package/lib/icons/password-hidden-icon.js +1 -1
- package/lib/icons/password-hidden-icon.js.map +1 -1
- package/lib/icons/password-visible-icon.js +1 -1
- package/lib/icons/password-visible-icon.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/inline/inline.d.ts +1 -1
- package/lib/inline/inline.js +1 -1
- package/lib/inline/inline.js.map +1 -1
- package/lib/loading/loading.d.ts +3 -3
- package/lib/loading/loading.js +1 -1
- package/lib/loading/loading.js.map +1 -1
- package/lib/menu/menu.d.ts +1 -1
- package/lib/menu/menu.js +1 -1
- package/lib/menu/menu.js.map +1 -1
- package/lib/modal/modal-stories-components.d.ts +2 -2
- package/lib/modal/modal.d.ts +4 -4
- package/lib/modal/modal.js +1 -1
- package/lib/modal/modal.js.map +1 -1
- package/lib/notice/notice.d.ts +1 -1
- package/lib/notice/notice.js +1 -1
- package/lib/notice/notice.js.map +1 -1
- package/lib/password-field/password-field.js +1 -1
- package/lib/password-field/password-field.js.map +1 -1
- package/lib/prose/prose.js +1 -1
- package/lib/prose/prose.js.map +1 -1
- package/lib/select-field/select-field.js +1 -1
- package/lib/select-field/select-field.js.map +1 -1
- package/lib/spinner/spinner.js +1 -1
- package/lib/spinner/spinner.js.map +1 -1
- package/lib/stack/stack.d.ts +1 -1
- package/lib/stack/stack.js +1 -1
- package/lib/stack/stack.js.map +1 -1
- package/lib/switch-field/switch-field.js +1 -1
- package/lib/switch-field/switch-field.js.map +1 -1
- package/lib/tabs/tabs.d.ts +5 -6
- package/lib/tabs/tabs.js +1 -1
- package/lib/tabs/tabs.js.map +1 -1
- package/lib/text/text.d.ts +1 -1
- package/lib/text/text.js +1 -1
- package/lib/text/text.js.map +1 -1
- package/lib/text-area/text-area.js +1 -1
- package/lib/text-area/text-area.js.map +1 -1
- package/lib/text-field/text-field.d.ts +1 -1
- package/lib/text-field/text-field.js +1 -1
- package/lib/text-field/text-field.js.map +1 -1
- package/lib/text-link/text-link.d.ts +1 -1
- package/lib/text-link/text-link.js +1 -1
- package/lib/text-link/text-link.js.map +1 -1
- package/lib/toast/static-toast.d.ts +2 -2
- package/lib/toast/static-toast.js +1 -1
- package/lib/toast/static-toast.js.map +1 -1
- package/lib/toast/toast-animation.d.ts +1 -1
- package/lib/toast/toast-animation.js.map +1 -1
- package/lib/toast/use-toasts.d.ts +3 -3
- package/lib/toast/use-toasts.js +1 -1
- package/lib/toast/use-toasts.js.map +1 -1
- package/lib/tooltip/tooltip.js +1 -1
- package/lib/tooltip/tooltip.js.map +1 -1
- package/lib/utils/common-helpers.js +1 -1
- package/lib/utils/common-helpers.js.map +1 -1
- package/lib/utils/common-types.d.ts +8 -8
- package/lib/utils/polymorphism.d.ts +9 -9
- package/lib/utils/polymorphism.js +1 -1
- package/lib/utils/polymorphism.js.map +1 -1
- package/lib/utils/responsive-props.d.ts +3 -3
- package/lib/utils/responsive-props.js.map +1 -1
- package/lib/utils/test-helpers.d.ts +1 -1
- package/package.json +13 -7
- package/lib/alert/alert.test.d.ts +0 -1
- package/lib/avatar/avatar.test.d.ts +0 -1
- package/lib/avatar/utils.test.d.ts +0 -1
- package/lib/badge/badge.test.d.ts +0 -1
- package/lib/banner/banner.test.d.ts +0 -1
- package/lib/box/box.test.d.ts +0 -1
- package/lib/button/button.test.d.ts +0 -1
- package/lib/checkbox-field/checkbox-field.test.d.ts +0 -1
- package/lib/columns/columns.test.d.ts +0 -1
- package/lib/components/color-picker/color-picker.test.d.ts +0 -1
- package/lib/components/deprecated-button/deprecated-button.test.d.ts +0 -1
- package/lib/components/deprecated-dropdown/dropdown.test.d.ts +0 -1
- package/lib/components/deprecated-input/input.test.d.ts +0 -1
- package/lib/components/deprecated-select/select.test.d.ts +0 -1
- package/lib/components/key-capturer/key-capturer.test.d.ts +0 -1
- package/lib/components/keyboard-shortcut/keyboard-shortcut.test.d.ts +0 -1
- package/lib/components/progress-bar/progress-bar.test.d.ts +0 -1
- package/lib/components/time/time-utils.test.d.ts +0 -1
- package/lib/components/time/time.test.d.ts +0 -1
- package/lib/heading/heading.test.d.ts +0 -1
- package/lib/hidden/hidden.test.d.ts +0 -1
- package/lib/hidden-visually/hidden-visually.test.d.ts +0 -1
- package/lib/inline/inline.test.d.ts +0 -1
- package/lib/loading/loading.test.d.ts +0 -1
- package/lib/menu/menu.test.d.ts +0 -1
- package/lib/modal/modal.test.d.ts +0 -1
- package/lib/notice/notice.test.d.ts +0 -1
- package/lib/password-field/password-field.test.d.ts +0 -1
- package/lib/prose/prose.test.d.ts +0 -1
- package/lib/select-field/select-field.test.d.ts +0 -1
- package/lib/stack/stack.test.d.ts +0 -1
- package/lib/switch-field/switch-field.test.d.ts +0 -1
- package/lib/tabs/tabs.test.d.ts +0 -1
- package/lib/text/text.test.d.ts +0 -1
- package/lib/text-area/text-area.test.d.ts +0 -1
- package/lib/text-field/text-field.test.d.ts +0 -1
- package/lib/toast/toast.test.d.ts +0 -1
- package/lib/tooltip/tooltip.test.d.ts +0 -1
- package/styles/color-picker.css +0 -9
- package/styles/deprecated-button.css +0 -7
- package/styles/dropdown.css +0 -8
- package/styles/progress-bar.css +0 -7
- package/styles/select.css +0 -1
- package/styles/time.css +0 -7
- /package/styles/{input.css → index.css} +0 -0
- /package/styles/{spinner.module.css.css → spinner.css} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-shortcut.js","sources":["../../../src/components/keyboard-shortcut/keyboard-shortcut.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\n\n//\n// Support for setting up how to translate modifiers globally.\n//\n\nlet globalTranslateKey = (key: string) => key\n\ntype TranslateKey = typeof globalTranslateKey\n\nKeyboardShortcut.setTranslateKey = (tr: TranslateKey) => {\n globalTranslateKey = tr\n}\n\nfunction translateKeyMac(key: string) {\n switch (key.toLowerCase()) {\n case 'cmd':\n case 'mod':\n return '⌘'\n case 'control':\n case 'ctrl':\n return '⌃'\n case 'alt':\n return '⌥'\n case 'shift':\n return '⇧'\n case 'space':\n return '␣'\n default:\n return key\n }\n}\n\n//\n// Some helpers\n//\n\nfunction capitalize(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()\n}\n\nfunction hasModifiers(str: string) {\n return /\\b(mod|cmd|ctrl|control|alt|shift)\\b/i.test(str)\n}\n\nfunction isSpecialKey(str: string) {\n return /^(mod|cmd|ctrl|control|alt|shift|space|super)$/i.test(str)\n}\n\nfunction parseKeys(shortcut: string, isMac: boolean, translateKey: TranslateKey) {\n const t = isMac ? translateKeyMac : translateKey\n const _hasModifiers = hasModifiers(shortcut)\n\n function mapIndividualKey(str: string) {\n if (isSpecialKey(str)) {\n return capitalize(t(str))\n }\n if (_hasModifiers && str.length === 1) {\n return str.toUpperCase()\n }\n return str\n }\n\n if (!isMac) {\n shortcut = shortcut.replace(/\\b(mod|cmd)\\b/i, 'ctrl')\n }\n\n return shortcut.split(/\\s*\\+\\s*/).map(mapIndividualKey)\n}\n\n//\n// The KeyboardShortcut component\n//\n\ntype NativeSpanProps = React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLSpanElement>,\n HTMLSpanElement\n>\n\ntype Props = Omit<NativeSpanProps, 'children'> & {\n /**\n * The shortcut to be represented as markup. It supports an intuitive syntax where you can\n * combine modifiers (cmd, ctrl, shift, alt) with single keys all concatenated with plus signs.\n * You can also pass various shortcuts as an array, which will be depicted separated by commas.\n */\n children: string | string[]\n /**\n * A function that allows you to change how some key names are represented. This may be useful,\n * for instance, to translate modifier names that are expressed differently in other languages\n * (e.g. `Ctrl` is named `Strg` in German).\n *\n * It defaults to a global version that leaves the key as is. You can pass your version as a\n * prop, or you can also set your own version of this global default one, so you don't need to\n * pass your own on each invocation of this component.\n *\n * ```js\n * import { KeyboardShortcut } from '@doist/reactist'\n * KeyboardShortcut.setTranslateKey = key => { ... }\n * ```\n *\n * Note: When the component detects the macOS operating system it bypasses key translation for\n * most modifiers and uses macOS-specific symbols. See the `isMac` prop for details.\n */\n translateKey?: TranslateKey\n /**\n * This prop is not meant to be passed. The component will automatically initialize it to `true`\n * if it detects that the current browser / operating system is on macOS, in which case modifier\n * keys are represented using macOS' notation (e.g. ⌘ ⌃ ⌥ ⇧).\n *\n * Though it is discouraged, if you don't want this special treatment in macOS, you can pass\n * `isMac={false}` in all invocations of this component.\n */\n isMac?: boolean\n}\n\nfunction KeyboardShortcut({\n children,\n className,\n translateKey = globalTranslateKey,\n isMac = navigator.platform?.toUpperCase().includes('MAC') ?? false,\n ...props\n}: Props) {\n const shortcuts = typeof children === 'string' ? [children] : children\n return (\n <span\n className={classNames('reactist_keyboard_shortcut', className, {\n 'reactist_keyboard_shortcut--macos': isMac,\n })}\n {...props}\n >\n {shortcuts.map((shortcut, i) => (\n <React.Fragment key={i}>\n {i === 0 ? null : ', '}\n <kbd>\n {parseKeys(shortcut, isMac, translateKey).map((key, j) => (\n <kbd key={j}>{key}</kbd>\n ))}\n </kbd>\n </React.Fragment>\n ))}\n </span>\n )\n}\n\nexport { KeyboardShortcut }\n"],"names":["globalTranslateKey","key","KeyboardShortcut","setTranslateKey","tr","translateKeyMac","toLowerCase","capitalize","str","charAt","toUpperCase","slice","hasModifiers","test","isSpecialKey","parseKeys","shortcut","isMac","translateKey","t","_hasModifiers","mapIndividualKey","length","replace","split","map","children","className","navigator","platform","includes","props","shortcuts","React","classNames","i","j"],"mappings":";;;;;AAIA;AACA;;AAEA,IAAIA,kBAAkB,GAAIC,GAAD,IAAiBA,GAA1C;;AAIAC,gBAAgB,CAACC,eAAjB,GAAoCC,EAAD;
|
|
1
|
+
{"version":3,"file":"keyboard-shortcut.js","sources":["../../../src/components/keyboard-shortcut/keyboard-shortcut.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\n\n//\n// Support for setting up how to translate modifiers globally.\n//\n\nlet globalTranslateKey = (key: string) => key\n\ntype TranslateKey = typeof globalTranslateKey\n\nKeyboardShortcut.setTranslateKey = (tr: TranslateKey) => {\n globalTranslateKey = tr\n}\n\nfunction translateKeyMac(key: string) {\n switch (key.toLowerCase()) {\n case 'cmd':\n case 'mod':\n return '⌘'\n case 'control':\n case 'ctrl':\n return '⌃'\n case 'alt':\n return '⌥'\n case 'shift':\n return '⇧'\n case 'space':\n return '␣'\n default:\n return key\n }\n}\n\n//\n// Some helpers\n//\n\nfunction capitalize(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()\n}\n\nfunction hasModifiers(str: string) {\n return /\\b(mod|cmd|ctrl|control|alt|shift)\\b/i.test(str)\n}\n\nfunction isSpecialKey(str: string) {\n return /^(mod|cmd|ctrl|control|alt|shift|space|super)$/i.test(str)\n}\n\nfunction parseKeys(shortcut: string, isMac: boolean, translateKey: TranslateKey) {\n const t = isMac ? translateKeyMac : translateKey\n const _hasModifiers = hasModifiers(shortcut)\n\n function mapIndividualKey(str: string) {\n if (isSpecialKey(str)) {\n return capitalize(t(str))\n }\n if (_hasModifiers && str.length === 1) {\n return str.toUpperCase()\n }\n return str\n }\n\n if (!isMac) {\n shortcut = shortcut.replace(/\\b(mod|cmd)\\b/i, 'ctrl')\n }\n\n return shortcut.split(/\\s*\\+\\s*/).map(mapIndividualKey)\n}\n\n//\n// The KeyboardShortcut component\n//\n\ntype NativeSpanProps = React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLSpanElement>,\n HTMLSpanElement\n>\n\ntype Props = Omit<NativeSpanProps, 'children'> & {\n /**\n * The shortcut to be represented as markup. It supports an intuitive syntax where you can\n * combine modifiers (cmd, ctrl, shift, alt) with single keys all concatenated with plus signs.\n * You can also pass various shortcuts as an array, which will be depicted separated by commas.\n */\n children: string | string[]\n /**\n * A function that allows you to change how some key names are represented. This may be useful,\n * for instance, to translate modifier names that are expressed differently in other languages\n * (e.g. `Ctrl` is named `Strg` in German).\n *\n * It defaults to a global version that leaves the key as is. You can pass your version as a\n * prop, or you can also set your own version of this global default one, so you don't need to\n * pass your own on each invocation of this component.\n *\n * ```js\n * import { KeyboardShortcut } from '@doist/reactist'\n * KeyboardShortcut.setTranslateKey = key => { ... }\n * ```\n *\n * Note: When the component detects the macOS operating system it bypasses key translation for\n * most modifiers and uses macOS-specific symbols. See the `isMac` prop for details.\n */\n translateKey?: TranslateKey\n /**\n * This prop is not meant to be passed. The component will automatically initialize it to `true`\n * if it detects that the current browser / operating system is on macOS, in which case modifier\n * keys are represented using macOS' notation (e.g. ⌘ ⌃ ⌥ ⇧).\n *\n * Though it is discouraged, if you don't want this special treatment in macOS, you can pass\n * `isMac={false}` in all invocations of this component.\n */\n isMac?: boolean\n}\n\nfunction KeyboardShortcut({\n children,\n className,\n translateKey = globalTranslateKey,\n isMac = navigator.platform?.toUpperCase().includes('MAC') ?? false,\n ...props\n}: Props) {\n const shortcuts = typeof children === 'string' ? [children] : children\n return (\n <span\n className={classNames('reactist_keyboard_shortcut', className, {\n 'reactist_keyboard_shortcut--macos': isMac,\n })}\n {...props}\n >\n {shortcuts.map((shortcut, i) => (\n <React.Fragment key={i}>\n {i === 0 ? null : ', '}\n <kbd>\n {parseKeys(shortcut, isMac, translateKey).map((key, j) => (\n <kbd key={j}>{key}</kbd>\n ))}\n </kbd>\n </React.Fragment>\n ))}\n </span>\n )\n}\n\nexport { KeyboardShortcut }\n"],"names":["globalTranslateKey","key","KeyboardShortcut","setTranslateKey","tr","translateKeyMac","toLowerCase","capitalize","str","charAt","toUpperCase","slice","hasModifiers","test","isSpecialKey","parseKeys","shortcut","isMac","translateKey","t","_hasModifiers","mapIndividualKey","length","replace","split","map","children","className","navigator","platform","includes","props","shortcuts","React","_objectSpread","classNames","i","createElement","Fragment","j"],"mappings":";;;;;AAIA;AACA;;AAEA,IAAIA,kBAAkB,GAAIC,GAAD,IAAiBA,GAA1C,CAAA;;AAIAC,gBAAgB,CAACC,eAAjB,GAAoCC,EAAD,IAAqB;AACpDJ,EAAAA,kBAAkB,GAAGI,EAArB,CAAA;AACH,CAFD,CAAA;;AAIA,SAASC,eAAT,CAAyBJ,GAAzB,EAAoC;EAChC,QAAQA,GAAG,CAACK,WAAJ,EAAR;AACI,IAAA,KAAK,KAAL,CAAA;AACA,IAAA,KAAK,KAAL;AACI,MAAA,OAAO,GAAP,CAAA;;AACJ,IAAA,KAAK,SAAL,CAAA;AACA,IAAA,KAAK,MAAL;AACI,MAAA,OAAO,GAAP,CAAA;;AACJ,IAAA,KAAK,KAAL;AACI,MAAA,OAAO,GAAP,CAAA;;AACJ,IAAA,KAAK,OAAL;AACI,MAAA,OAAO,GAAP,CAAA;;AACJ,IAAA,KAAK,OAAL;AACI,MAAA,OAAO,GAAP,CAAA;;AACJ,IAAA;AACI,MAAA,OAAOL,GAAP,CAAA;AAdR,GAAA;AAgBH;AAGD;AACA;;;AAEA,SAASM,UAAT,CAAoBC,GAApB,EAA+B;AAC3B,EAAA,OAAOA,GAAG,CAACC,MAAJ,CAAW,CAAX,CAAcC,CAAAA,WAAd,EAA8BF,GAAAA,GAAG,CAACG,KAAJ,CAAU,CAAV,CAAA,CAAaL,WAAb,EAArC,CAAA;AACH,CAAA;;AAED,SAASM,YAAT,CAAsBJ,GAAtB,EAAiC;AAC7B,EAAA,OAAO,uCAAwCK,CAAAA,IAAxC,CAA6CL,GAA7C,CAAP,CAAA;AACH,CAAA;;AAED,SAASM,YAAT,CAAsBN,GAAtB,EAAiC;AAC7B,EAAA,OAAO,iDAAkDK,CAAAA,IAAlD,CAAuDL,GAAvD,CAAP,CAAA;AACH,CAAA;;AAED,SAASO,SAAT,CAAmBC,QAAnB,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AAA;;EACJ,MAAMC,SAAS,GAAG,OAAON,QAAP,KAAoB,QAApB,GAA+B,CAACA,QAAD,CAA/B,GAA4CA,QAA9D,CAAA;AACA,EAAA,oBACIO,mBAAA,OAAA,EAAAC,cAAA,CAAA;AACIP,IAAAA,SAAS,EAAEQ,UAAU,CAAC,4BAAD,EAA+BR,SAA/B,EAA0C;MAC3D,mCAAqCV,EAAAA,KAAAA;KADpB,CAAA;AADzB,GAAA,EAIQc,KAJR,CAMKC,EAAAA,SAAS,CAACP,GAAV,CAAc,CAACT,QAAD,EAAWoB,CAAX,kBACXH,KAAC,CAAAI,aAAD,CAACJ,KAAK,CAACK,QAAP,EAAe;AAACrC,IAAAA,GAAG,EAAEmC,CAAAA;AAAN,GAAf,EACKA,CAAC,KAAK,CAAN,GAAU,IAAV,GAAiB,IADtB,eAEIH,KAAA,CAAAI,aAAA,CAAA,KAAA,EAAA,IAAA,EACKtB,SAAS,CAACC,QAAD,EAAWC,KAAX,EAAkBC,YAAlB,CAAT,CAAyCO,GAAzC,CAA6C,CAACxB,GAAD,EAAMsC,CAAN,kBAC1CN,KAAK,CAAAI,aAAL,CAAK,KAAL,EAAK;AAAApC,IAAAA,GAAG,EAAEsC,CAAAA;AAAL,GAAL,EAActC,GAAd,CADH,CADL,CAFJ,CADH,CANL,CADJ,CAAA;AAmBH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import classNames from 'classnames';
|
|
1
|
+
import * as React from 'react';
|
|
3
2
|
import { HiddenVisually } from '../../hidden-visually/hidden-visually.js';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
function ProgressBar({
|
|
6
6
|
fillPercentage = 0,
|
|
@@ -9,14 +9,14 @@ function ProgressBar({
|
|
|
9
9
|
}) {
|
|
10
10
|
const finalClassName = classNames('reactist_progress_bar', className);
|
|
11
11
|
const width = fillPercentage < 0 ? 0 : fillPercentage > 100 ? 100 : fillPercentage;
|
|
12
|
-
return /*#__PURE__*/createElement("div", {
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
13
13
|
className: finalClassName
|
|
14
|
-
}, /*#__PURE__*/createElement("div", {
|
|
14
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
15
15
|
className: "inner",
|
|
16
16
|
style: {
|
|
17
17
|
width: width + "%"
|
|
18
18
|
}
|
|
19
|
-
}), /*#__PURE__*/createElement(HiddenVisually, null, /*#__PURE__*/createElement("progress", {
|
|
19
|
+
}), /*#__PURE__*/React.createElement(HiddenVisually, null, /*#__PURE__*/React.createElement("progress", {
|
|
20
20
|
value: width,
|
|
21
21
|
max: 100,
|
|
22
22
|
"aria-valuetext": ariaValuetext != null ? ariaValuetext : undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-bar.js","sources":["../../../src/components/progress-bar/progress-bar.tsx"],"sourcesContent":["import * as React from 'react'\nimport { HiddenVisually } from '../../hidden-visually'\nimport classNames from 'classnames'\n\nimport './progress-bar.less'\n\ntype Props = {\n /** Additional css class applied to the progress bar. */\n className?: string\n /** How much of the progress bar should be filled. Number between 0 and 100 inclusive. */\n fillPercentage?: number\n /** Defines the human readable text alternative for assitive technologies. */\n 'aria-valuetext'?: string\n}\nfunction ProgressBar({ fillPercentage = 0, className, 'aria-valuetext': ariaValuetext }: Props) {\n const finalClassName = classNames('reactist_progress_bar', className)\n const width = fillPercentage < 0 ? 0 : fillPercentage > 100 ? 100 : fillPercentage\n return (\n <div className={finalClassName}>\n <div className=\"inner\" style={{ width: `${width}%` }} />\n <HiddenVisually>\n <progress value={width} max={100} aria-valuetext={ariaValuetext ?? undefined} />\n </HiddenVisually>\n </div>\n )\n}\nProgressBar.displayName = 'ProgressBar'\n\nexport { ProgressBar }\n"],"names":["ProgressBar","fillPercentage","className","ariaValuetext","finalClassName","classNames","width","React","style","HiddenVisually","value","max","undefined","displayName"],"mappings":";;;;AAcA,SAASA,WAAT,CAAqB;
|
|
1
|
+
{"version":3,"file":"progress-bar.js","sources":["../../../src/components/progress-bar/progress-bar.tsx"],"sourcesContent":["import * as React from 'react'\nimport { HiddenVisually } from '../../hidden-visually'\nimport classNames from 'classnames'\n\nimport './progress-bar.less'\n\ntype Props = {\n /** Additional css class applied to the progress bar. */\n className?: string\n /** How much of the progress bar should be filled. Number between 0 and 100 inclusive. */\n fillPercentage?: number\n /** Defines the human readable text alternative for assitive technologies. */\n 'aria-valuetext'?: string\n}\nfunction ProgressBar({ fillPercentage = 0, className, 'aria-valuetext': ariaValuetext }: Props) {\n const finalClassName = classNames('reactist_progress_bar', className)\n const width = fillPercentage < 0 ? 0 : fillPercentage > 100 ? 100 : fillPercentage\n return (\n <div className={finalClassName}>\n <div className=\"inner\" style={{ width: `${width}%` }} />\n <HiddenVisually>\n <progress value={width} max={100} aria-valuetext={ariaValuetext ?? undefined} />\n </HiddenVisually>\n </div>\n )\n}\nProgressBar.displayName = 'ProgressBar'\n\nexport { ProgressBar }\n"],"names":["ProgressBar","fillPercentage","className","ariaValuetext","finalClassName","classNames","width","React","createElement","style","HiddenVisually","value","max","undefined","displayName"],"mappings":";;;;AAcA,SAASA,WAAT,CAAqB;AAAEC,EAAAA,cAAc,GAAG,CAAnB;EAAsBC,SAAtB;EAAiC,gBAAkBC,EAAAA,aAAAA;AAAnD,CAArB,EAA8F;AAC1F,EAAA,MAAMC,cAAc,GAAGC,UAAU,CAAC,uBAAD,EAA0BH,SAA1B,CAAjC,CAAA;AACA,EAAA,MAAMI,KAAK,GAAGL,cAAc,GAAG,CAAjB,GAAqB,CAArB,GAAyBA,cAAc,GAAG,GAAjB,GAAuB,GAAvB,GAA6BA,cAApE,CAAA;AACA,EAAA,oBACIM,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKN,IAAAA,SAAS,EAAEE,cAAAA;AAAhB,GAAA,eACIG,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKN,IAAAA,SAAS,EAAC,OAAf;AAAuBO,IAAAA,KAAK,EAAE;AAAEH,MAAAA,KAAK,EAAKA,KAAL,GAAA,GAAA;AAAP,KAAA;AAA9B,GAAA,CADJ,eAEIC,KAAA,CAAAC,aAAA,CAACE,cAAD,EAAe,IAAf,eACIH,KAAA,CAAAC,aAAA,CAAA,UAAA,EAAA;AAAUG,IAAAA,KAAK,EAAEL,KAAjB;AAAwBM,IAAAA,GAAG,EAAE,GAA7B;IAAkD,gBAAAT,EAAAA,aAAA,IAAAA,IAAAA,GAAAA,aAAA,GAAiBU,SAAAA;GAAnE,CADJ,CAFJ,CADJ,CAAA;AAQH,CAAA;;AACDb,WAAW,CAACc,WAAZ,GAA0B,aAA1B;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-utils.js","sources":["../../../src/components/time/time-utils.ts"],"sourcesContent":["import dayjs from 'dayjs'\n/**\n * There's a problem with our setup where the default export from\n * localizedFormat (and likely every other dayjs plugin) isn't properly\n * recognized. The proposed workarounds (importing with `.js` ending, or adding\n * `allowSyntheticDefaultImports` to the tsconfig) either broke linting or type\n * checking. After spending some time on this it was decided that further\n * investigations are not worth it, the code works and the eslint ignore is fine.\n * ref: https://github.com/iamkun/dayjs/issues/593\n * ref: https://day.js.org/docs/en/installation/typescript\n */\n// eslint-disable-next-line import/default\nimport LocalizedFormat from 'dayjs/plugin/localizedFormat'\n\ndayjs.extend(LocalizedFormat)\n\ntype TimeConfig = {\n locale?: string\n longFormat?: string\n shortFormatCurrentYear?: string\n shortFormatPastYear?: string\n daysSuffix?: string\n hoursSuffix?: string\n minutesSuffix?: string\n momentsAgo?: string\n}\n\nconst TimeUtils = {\n SHORT_FORMAT_CURRENT_YEAR: 'L',\n SHORT_FORMAT_PAST_YEAR: 'LL',\n LONG_FORMAT: 'LL, LT',\n\n timeAgo(timestamp: number, config: TimeConfig = {}) {\n const {\n locale = 'en',\n shortFormatCurrentYear = this.SHORT_FORMAT_CURRENT_YEAR,\n shortFormatPastYear = this.SHORT_FORMAT_PAST_YEAR,\n daysSuffix = 'd',\n hoursSuffix = 'h',\n minutesSuffix = 'm',\n momentsAgo = 'moments ago',\n } = config\n const now = dayjs()\n const date = dayjs(timestamp * 1000)\n date.locale(locale)\n const diffMinutes = now.diff(date, 'minute')\n const diffHours = now.diff(date, 'hour')\n const diffDays = now.diff(date, 'day')\n\n if (diffDays > 1) {\n if (date.isSame(now, 'year')) {\n return date.format(shortFormatCurrentYear)\n } else {\n return date.format(shortFormatPastYear)\n }\n } else if (diffDays === 1) {\n return `${diffDays}${daysSuffix}`\n } else if (diffHours > 0 && diffHours <= 23) {\n return `${diffHours}${hoursSuffix}`\n } else if (diffMinutes > 0 && diffMinutes <= 59) {\n return `${diffMinutes}${minutesSuffix}`\n } else {\n return momentsAgo\n }\n },\n\n formatTime(timestamp: number, config: TimeConfig = {}) {\n const {\n locale = 'en',\n shortFormatCurrentYear = this.SHORT_FORMAT_CURRENT_YEAR,\n shortFormatPastYear = this.SHORT_FORMAT_PAST_YEAR,\n } = config\n const date = dayjs(timestamp * 1000)\n date.locale(locale)\n if (date.isSame(dayjs(), 'year')) {\n return date.format(shortFormatCurrentYear)\n } else {\n return date.format(shortFormatPastYear)\n }\n },\n\n formatTimeLong(timestamp: number, config: TimeConfig = {}) {\n const { locale = 'en', longFormat = this.LONG_FORMAT } = config\n const date = dayjs(timestamp * 1000)\n date.locale(locale)\n return date.format(longFormat)\n },\n}\n\nexport { TimeUtils, TimeConfig }\n"],"names":["dayjs","extend","LocalizedFormat","TimeUtils","SHORT_FORMAT_CURRENT_YEAR","SHORT_FORMAT_PAST_YEAR","LONG_FORMAT","timeAgo","timestamp","config","locale","shortFormatCurrentYear","shortFormatPastYear","daysSuffix","hoursSuffix","minutesSuffix","momentsAgo","now","date","diffMinutes","diff","diffHours","diffDays","isSame","format","formatTime","formatTimeLong","longFormat"],"mappings":";;;AAcAA,KAAK,CAACC,MAAN,CAAaC,eAAb;
|
|
1
|
+
{"version":3,"file":"time-utils.js","sources":["../../../src/components/time/time-utils.ts"],"sourcesContent":["import dayjs from 'dayjs'\n/**\n * There's a problem with our setup where the default export from\n * localizedFormat (and likely every other dayjs plugin) isn't properly\n * recognized. The proposed workarounds (importing with `.js` ending, or adding\n * `allowSyntheticDefaultImports` to the tsconfig) either broke linting or type\n * checking. After spending some time on this it was decided that further\n * investigations are not worth it, the code works and the eslint ignore is fine.\n * ref: https://github.com/iamkun/dayjs/issues/593\n * ref: https://day.js.org/docs/en/installation/typescript\n */\n// eslint-disable-next-line import/default\nimport LocalizedFormat from 'dayjs/plugin/localizedFormat'\n\ndayjs.extend(LocalizedFormat)\n\ntype TimeConfig = {\n locale?: string\n longFormat?: string\n shortFormatCurrentYear?: string\n shortFormatPastYear?: string\n daysSuffix?: string\n hoursSuffix?: string\n minutesSuffix?: string\n momentsAgo?: string\n}\n\nconst TimeUtils = {\n SHORT_FORMAT_CURRENT_YEAR: 'L',\n SHORT_FORMAT_PAST_YEAR: 'LL',\n LONG_FORMAT: 'LL, LT',\n\n timeAgo(timestamp: number, config: TimeConfig = {}) {\n const {\n locale = 'en',\n shortFormatCurrentYear = this.SHORT_FORMAT_CURRENT_YEAR,\n shortFormatPastYear = this.SHORT_FORMAT_PAST_YEAR,\n daysSuffix = 'd',\n hoursSuffix = 'h',\n minutesSuffix = 'm',\n momentsAgo = 'moments ago',\n } = config\n const now = dayjs()\n const date = dayjs(timestamp * 1000)\n date.locale(locale)\n const diffMinutes = now.diff(date, 'minute')\n const diffHours = now.diff(date, 'hour')\n const diffDays = now.diff(date, 'day')\n\n if (diffDays > 1) {\n if (date.isSame(now, 'year')) {\n return date.format(shortFormatCurrentYear)\n } else {\n return date.format(shortFormatPastYear)\n }\n } else if (diffDays === 1) {\n return `${diffDays}${daysSuffix}`\n } else if (diffHours > 0 && diffHours <= 23) {\n return `${diffHours}${hoursSuffix}`\n } else if (diffMinutes > 0 && diffMinutes <= 59) {\n return `${diffMinutes}${minutesSuffix}`\n } else {\n return momentsAgo\n }\n },\n\n formatTime(timestamp: number, config: TimeConfig = {}) {\n const {\n locale = 'en',\n shortFormatCurrentYear = this.SHORT_FORMAT_CURRENT_YEAR,\n shortFormatPastYear = this.SHORT_FORMAT_PAST_YEAR,\n } = config\n const date = dayjs(timestamp * 1000)\n date.locale(locale)\n if (date.isSame(dayjs(), 'year')) {\n return date.format(shortFormatCurrentYear)\n } else {\n return date.format(shortFormatPastYear)\n }\n },\n\n formatTimeLong(timestamp: number, config: TimeConfig = {}) {\n const { locale = 'en', longFormat = this.LONG_FORMAT } = config\n const date = dayjs(timestamp * 1000)\n date.locale(locale)\n return date.format(longFormat)\n },\n}\n\nexport { TimeUtils, TimeConfig }\n"],"names":["dayjs","extend","LocalizedFormat","TimeUtils","SHORT_FORMAT_CURRENT_YEAR","SHORT_FORMAT_PAST_YEAR","LONG_FORMAT","timeAgo","timestamp","config","locale","shortFormatCurrentYear","shortFormatPastYear","daysSuffix","hoursSuffix","minutesSuffix","momentsAgo","now","date","diffMinutes","diff","diffHours","diffDays","isSame","format","formatTime","formatTimeLong","longFormat"],"mappings":";;;AAcAA,KAAK,CAACC,MAAN,CAAaC,eAAb,CAAA,CAAA;AAaA,MAAMC,SAAS,GAAG;AACdC,EAAAA,yBAAyB,EAAE,GADb;AAEdC,EAAAA,sBAAsB,EAAE,IAFV;AAGdC,EAAAA,WAAW,EAAE,QAHC;;AAKdC,EAAAA,OAAO,CAACC,SAAD,EAAoBC,MAAA,GAAqB,EAAzC,EAA2C;IAC9C,MAAM;AACFC,MAAAA,MAAM,GAAG,IADP;MAE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
2
|
import { Tooltip } from '../../tooltip/tooltip.js';
|
|
3
3
|
import { TimeUtils } from './time-utils.js';
|
|
4
4
|
|
|
5
5
|
const DELAY = 60000;
|
|
6
6
|
|
|
7
|
-
class Time extends Component {
|
|
7
|
+
class Time extends React.Component {
|
|
8
8
|
constructor(props) {
|
|
9
9
|
super(props);
|
|
10
10
|
this.refreshInterval = void 0;
|
|
@@ -93,13 +93,13 @@ class Time extends Component {
|
|
|
93
93
|
|
|
94
94
|
const timeComponent = this._renderTime(this.props.config);
|
|
95
95
|
|
|
96
|
-
return /*#__PURE__*/createElement("time", {
|
|
96
|
+
return /*#__PURE__*/React.createElement("time", {
|
|
97
97
|
className: className,
|
|
98
98
|
onMouseEnter: event => this._setHovered(true, event),
|
|
99
99
|
onMouseLeave: event => this._setHovered(false, event)
|
|
100
|
-
}, this.props.tooltipOnHover ? /*#__PURE__*/createElement(Tooltip, {
|
|
100
|
+
}, this.props.tooltipOnHover ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
101
101
|
content: this.props.tooltip || this.props.time && TimeUtils.formatTimeLong(this.props.time, this.props.config)
|
|
102
|
-
}, /*#__PURE__*/createElement("span", null, timeComponent)) : timeComponent);
|
|
102
|
+
}, /*#__PURE__*/React.createElement("span", null, timeComponent)) : timeComponent);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","sources":["../../../src/components/time/time.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Tooltip } from '../../tooltip'\nimport { TimeUtils, TimeConfig } from './time-utils'\n\nimport './time.less'\n\nconst DELAY = 60000\n\ntype Props = {\n /** UNIX timestamp of the time to display. */\n time?: number\n /** Configuration for localization. */\n config?: TimeConfig\n /** Additional css class applied to the time element. */\n className?: string\n tooltipOnHover?: boolean\n /** Refresh the component every DELAY seconds. */\n refresh?: boolean\n /** If you don't want to use the default time format on the tooltip use this prop to supply a custom text */\n tooltip?: React.ReactNode\n /** When hovering over time it expands to short absolute version. */\n expandOnHover?: boolean\n /** When hovering over time it expands to the full absolute version. */\n expandFullyOnHover?: boolean\n}\n\ntype State = {\n hovered: boolean\n mouseX?: number\n mouseY?: number\n}\n\nclass Time extends React.Component<Props, State> {\n public static displayName: string\n public static defaultProps: Props\n\n constructor(props: Props) {\n super(props)\n this.refreshInterval = undefined\n\n this.state = {\n hovered: false,\n mouseX: undefined,\n mouseY: undefined,\n }\n }\n\n componentDidMount() {\n if (this.props.refresh) {\n this._refresh()\n }\n }\n\n componentDidUpdate(prevProps: Props) {\n if (!prevProps.refresh && this.props.refresh) {\n this._refresh()\n }\n\n if (prevProps.refresh && !this.props.refresh) {\n if (this.refreshInterval) {\n clearTimeout(this.refreshInterval)\n }\n }\n }\n\n componentWillUnmount() {\n if (this.refreshInterval) {\n clearTimeout(this.refreshInterval)\n }\n }\n\n refreshInterval?: ReturnType<typeof setTimeout>\n\n _setHovered(hovered: boolean, event: React.MouseEvent) {\n const { mouseX, mouseY } = this.state\n const { clientX, clientY } = event\n if (clientX !== mouseX || clientY !== mouseY) {\n // mouse has moved\n this.setState(() => ({\n hovered,\n mouseX: clientX,\n mouseY: clientY,\n }))\n }\n }\n\n _renderTime(config: Props['config']) {\n if (!this.props.time) {\n return\n }\n if (this.state.hovered) {\n if (this.props.expandFullyOnHover && !this.props.tooltipOnHover) {\n return TimeUtils.formatTimeLong(this.props.time, config)\n }\n if (this.props.expandOnHover && !this.props.tooltipOnHover) {\n return TimeUtils.formatTime(this.props.time, config)\n }\n }\n return TimeUtils.timeAgo(this.props.time, config)\n }\n\n _refresh() {\n this.refreshInterval = setInterval(() => {\n this.forceUpdate()\n }, DELAY)\n }\n\n render() {\n let className = 'reactist_time'\n if (this.props.className) {\n className = this.props.className\n }\n\n const timeComponent = this._renderTime(this.props.config)\n\n return (\n <time\n className={className}\n onMouseEnter={(event) => this._setHovered(true, event)}\n onMouseLeave={(event) => this._setHovered(false, event)}\n >\n {this.props.tooltipOnHover ? (\n <Tooltip\n content={\n this.props.tooltip ||\n (this.props.time &&\n TimeUtils.formatTimeLong(this.props.time, this.props.config))\n }\n >\n <span>{timeComponent}</span>\n </Tooltip>\n ) : (\n timeComponent\n )}\n </time>\n )\n }\n}\nTime.displayName = 'Time'\n\nTime.defaultProps = {\n expandOnHover: false,\n expandFullyOnHover: false,\n tooltipOnHover: false,\n refresh: true,\n config: {\n locale: 'en',\n daysSuffix: 'd',\n hoursSuffix: 'h',\n minutesSuffix: 'm',\n momentsAgo: 'moments ago',\n },\n}\n\nexport { Time }\n"],"names":["DELAY","Time","React","constructor","props","refreshInterval","undefined","state","hovered","mouseX","mouseY","componentDidMount","refresh","_refresh","componentDidUpdate","prevProps","clearTimeout","componentWillUnmount","_setHovered","event","clientX","clientY","setState","_renderTime","config","time","expandFullyOnHover","tooltipOnHover","TimeUtils","formatTimeLong","expandOnHover","formatTime","timeAgo","setInterval","forceUpdate","render","className","timeComponent","onMouseEnter","onMouseLeave","Tooltip","content","tooltip","displayName","defaultProps","locale","daysSuffix","hoursSuffix","minutesSuffix","momentsAgo"],"mappings":";;;;AAOA,MAAMA,KAAK,GAAG,KAAd;;AA0BA,MAAMC,IAAN,SAAmBC,
|
|
1
|
+
{"version":3,"file":"time.js","sources":["../../../src/components/time/time.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Tooltip } from '../../tooltip'\nimport { TimeUtils, TimeConfig } from './time-utils'\n\nimport './time.less'\n\nconst DELAY = 60000\n\ntype Props = {\n /** UNIX timestamp of the time to display. */\n time?: number\n /** Configuration for localization. */\n config?: TimeConfig\n /** Additional css class applied to the time element. */\n className?: string\n tooltipOnHover?: boolean\n /** Refresh the component every DELAY seconds. */\n refresh?: boolean\n /** If you don't want to use the default time format on the tooltip use this prop to supply a custom text */\n tooltip?: React.ReactNode\n /** When hovering over time it expands to short absolute version. */\n expandOnHover?: boolean\n /** When hovering over time it expands to the full absolute version. */\n expandFullyOnHover?: boolean\n}\n\ntype State = {\n hovered: boolean\n mouseX?: number\n mouseY?: number\n}\n\nclass Time extends React.Component<Props, State> {\n public static displayName: string\n public static defaultProps: Props\n\n constructor(props: Props) {\n super(props)\n this.refreshInterval = undefined\n\n this.state = {\n hovered: false,\n mouseX: undefined,\n mouseY: undefined,\n }\n }\n\n componentDidMount() {\n if (this.props.refresh) {\n this._refresh()\n }\n }\n\n componentDidUpdate(prevProps: Props) {\n if (!prevProps.refresh && this.props.refresh) {\n this._refresh()\n }\n\n if (prevProps.refresh && !this.props.refresh) {\n if (this.refreshInterval) {\n clearTimeout(this.refreshInterval)\n }\n }\n }\n\n componentWillUnmount() {\n if (this.refreshInterval) {\n clearTimeout(this.refreshInterval)\n }\n }\n\n refreshInterval?: ReturnType<typeof setTimeout>\n\n _setHovered(hovered: boolean, event: React.MouseEvent) {\n const { mouseX, mouseY } = this.state\n const { clientX, clientY } = event\n if (clientX !== mouseX || clientY !== mouseY) {\n // mouse has moved\n this.setState(() => ({\n hovered,\n mouseX: clientX,\n mouseY: clientY,\n }))\n }\n }\n\n _renderTime(config: Props['config']) {\n if (!this.props.time) {\n return\n }\n if (this.state.hovered) {\n if (this.props.expandFullyOnHover && !this.props.tooltipOnHover) {\n return TimeUtils.formatTimeLong(this.props.time, config)\n }\n if (this.props.expandOnHover && !this.props.tooltipOnHover) {\n return TimeUtils.formatTime(this.props.time, config)\n }\n }\n return TimeUtils.timeAgo(this.props.time, config)\n }\n\n _refresh() {\n this.refreshInterval = setInterval(() => {\n this.forceUpdate()\n }, DELAY)\n }\n\n render() {\n let className = 'reactist_time'\n if (this.props.className) {\n className = this.props.className\n }\n\n const timeComponent = this._renderTime(this.props.config)\n\n return (\n <time\n className={className}\n onMouseEnter={(event) => this._setHovered(true, event)}\n onMouseLeave={(event) => this._setHovered(false, event)}\n >\n {this.props.tooltipOnHover ? (\n <Tooltip\n content={\n this.props.tooltip ||\n (this.props.time &&\n TimeUtils.formatTimeLong(this.props.time, this.props.config))\n }\n >\n <span>{timeComponent}</span>\n </Tooltip>\n ) : (\n timeComponent\n )}\n </time>\n )\n }\n}\nTime.displayName = 'Time'\n\nTime.defaultProps = {\n expandOnHover: false,\n expandFullyOnHover: false,\n tooltipOnHover: false,\n refresh: true,\n config: {\n locale: 'en',\n daysSuffix: 'd',\n hoursSuffix: 'h',\n minutesSuffix: 'm',\n momentsAgo: 'moments ago',\n },\n}\n\nexport { Time }\n"],"names":["DELAY","Time","React","Component","constructor","props","refreshInterval","undefined","state","hovered","mouseX","mouseY","componentDidMount","refresh","_refresh","componentDidUpdate","prevProps","clearTimeout","componentWillUnmount","_setHovered","event","clientX","clientY","setState","_renderTime","config","time","expandFullyOnHover","tooltipOnHover","TimeUtils","formatTimeLong","expandOnHover","formatTime","timeAgo","setInterval","forceUpdate","render","className","timeComponent","createElement","onMouseEnter","onMouseLeave","Tooltip","content","tooltip","displayName","defaultProps","locale","daysSuffix","hoursSuffix","minutesSuffix","momentsAgo"],"mappings":";;;;AAOA,MAAMA,KAAK,GAAG,KAAd,CAAA;;AA0BA,MAAMC,IAAN,SAAmBC,KAAK,CAACC,SAAzB,CAAgD;EAI5CC,WAAA,CAAYC,KAAZ,EAAwB;AACpB,IAAA,KAAA,CAAMA,KAAN,CAAA,CAAA;AADoB,IAAA,IAAA,CAmCxBC,eAnCwB,GAAA,KAAA,CAAA,CAAA;IAEpB,IAAKA,CAAAA,eAAL,GAAuBC,SAAvB,CAAA;AAEA,IAAA,IAAA,CAAKC,KAAL,GAAa;AACTC,MAAAA,OAAO,EAAE,KADA;AAETC,MAAAA,MAAM,EAAEH,SAFC;AAGTI,MAAAA,MAAM,EAAEJ,SAAAA;KAHZ,CAAA;AAKH,GAAA;;AAEDK,EAAAA,iBAAiB,GAAA;AACb,IAAA,IAAI,IAAKP,CAAAA,KAAL,CAAWQ,OAAf,EAAwB;AACpB,MAAA,IAAA,CAAKC,QAAL,EAAA,CAAA;AACH,KAAA;AACJ,GAAA;;EAEDC,kBAAkB,CAACC,SAAD,EAAiB;IAC/B,IAAI,C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BC,KAAxB,CAAA;KAH7B,EAKK,IAAKf,CAAAA,KAAL,CAAWuB,cAAX,gBACG1B,KAAA,CAAAqC,aAAA,CAACG,OAAD,EAAQ;MACJC,OAAO,EACH,KAAKtC,KAAL,CAAWuC,OAAX,IACC,IAAA,CAAKvC,KAAL,CAAWqB,IAAX,IACGG,SAAS,CAACC,cAAV,CAAyB,IAAA,CAAKzB,KAAL,CAAWqB,IAApC,EAA0C,IAAA,CAAKrB,KAAL,CAAWoB,MAArD,CAAA;AAJJ,KAAR,eAOIvB,KAAA,CAAAqC,aAAA,CAAA,MAAA,EAAA,IAAA,EAAOD,aAAP,CAPJ,CADH,GAWGA,aAhBR,CADJ,CAAA;AAqBH,GAAA;;AAxG2C,CAAA;;AAA1CrC,KACY4C;AADZ5C,KAEY6C;AAwGlB7C,IAAI,CAAC4C,WAAL,GAAmB,MAAnB,CAAA;AAEA5C,IAAI,CAAC6C,YAAL,GAAoB;AAChBf,EAAAA,aAAa,EAAE,KADC;AAEhBJ,EAAAA,kBAAkB,EAAE,KAFJ;AAGhBC,EAAAA,cAAc,EAAE,KAHA;AAIhBf,EAAAA,OAAO,EAAE,IAJO;AAKhBY,EAAAA,MAAM,EAAE;AACJsB,IAAAA,MAAM,EAAE,IADJ;AAEJC,IAAAA,UAAU,EAAE,GAFR;AAGJC,IAAAA,WAAW,EAAE,GAHT;AAIJC,IAAAA,aAAa,EAAE,GAJX;AAKJC,IAAAA,UAAU,EAAE,aAAA;AALR,GAAA;AALQ,CAApB;;;;"}
|
package/es/divider/divider.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { getClassNames } from '../utils/responsive-props.js';
|
|
4
4
|
import { Box } from '../box/box.js';
|
|
5
|
-
import
|
|
5
|
+
import modules_c742c4d7 from './divider.module.css.js';
|
|
6
6
|
|
|
7
7
|
const _excluded = ["weight"];
|
|
8
8
|
|
|
@@ -12,9 +12,9 @@ function Divider(_ref) {
|
|
|
12
12
|
} = _ref,
|
|
13
13
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
14
|
|
|
15
|
-
return /*#__PURE__*/createElement(Box, _objectSpread2({
|
|
15
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2({
|
|
16
16
|
as: "hr",
|
|
17
|
-
className: getClassNames(
|
|
17
|
+
className: getClassNames(modules_c742c4d7, 'weight', weight)
|
|
18
18
|
}, props));
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.js","sources":["../../src/divider/divider.tsx"],"sourcesContent":["import * as React from 'react'\nimport { getClassNames } from '../utils/responsive-props'\nimport { Box } from '../box'\nimport type { DividerWeight } from '../utils/common-types'\n\nimport styles from './divider.module.css'\n\ninterface DividerProps {\n weight?: Exclude<DividerWeight, 'none'>\n}\n\nfunction Divider({ weight = 'tertiary', ...props }: DividerProps) {\n return <Box as=\"hr\" className={getClassNames(styles, 'weight', weight)} {...props} />\n}\n\nexport type { DividerProps, DividerWeight }\nexport { Divider }\n"],"names":["Divider","weight","props","React","Box","as","className","getClassNames","styles"],"mappings":";;;;;;;;AAWA,SAASA,OAAT;
|
|
1
|
+
{"version":3,"file":"divider.js","sources":["../../src/divider/divider.tsx"],"sourcesContent":["import * as React from 'react'\nimport { getClassNames } from '../utils/responsive-props'\nimport { Box } from '../box'\nimport type { DividerWeight } from '../utils/common-types'\n\nimport styles from './divider.module.css'\n\ninterface DividerProps {\n weight?: Exclude<DividerWeight, 'none'>\n}\n\nfunction Divider({ weight = 'tertiary', ...props }: DividerProps) {\n return <Box as=\"hr\" className={getClassNames(styles, 'weight', weight)} {...props} />\n}\n\nexport type { DividerProps, DividerWeight }\nexport { Divider }\n"],"names":["Divider","weight","props","React","createElement","Box","_objectSpread","as","className","getClassNames","styles"],"mappings":";;;;;;;;AAWA,SAASA,OAAT,CAAgE,IAAA,EAAA;EAAA,IAA/C;AAAEC,IAAAA,MAAM,GAAG,UAAA;GAAoC,GAAA,IAAA;AAAA,MAArBC,KAAqB,GAAA,wBAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AAC5D,EAAA,oBAAOC,KAAA,CAAAC,aAAA,CAACC,GAAD,EAAAC,cAAA,CAAA;AAAKC,IAAAA,EAAE,EAAC,IAAR;AAAaC,IAAAA,SAAS,EAAEC,aAAa,CAACC,gBAAD,EAAS,QAAT,EAAmBT,MAAnB,CAAA;AAArC,GAAA,EAAqEC,KAArE,CAAP,CAAA,CAAA;AACH;;;;"}
|
package/es/heading/heading.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { getClassNames } from '../utils/responsive-props.js';
|
|
4
4
|
import { Box } from '../box/box.js';
|
|
5
|
-
import
|
|
5
|
+
import modules_949d2ff4 from './heading.module.css.js';
|
|
6
6
|
|
|
7
7
|
const _excluded = ["level", "weight", "size", "tone", "children", "lineClamp", "align", "exceptionallySetClassName"];
|
|
8
|
-
const Heading = /*#__PURE__*/forwardRef(function Heading(_ref, ref) {
|
|
8
|
+
const Heading = /*#__PURE__*/React.forwardRef(function Heading(_ref, ref) {
|
|
9
9
|
let {
|
|
10
10
|
level,
|
|
11
11
|
weight = 'regular',
|
|
@@ -22,8 +22,8 @@ const Heading = /*#__PURE__*/forwardRef(function Heading(_ref, ref) {
|
|
|
22
22
|
// https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/#template-literal-types
|
|
23
23
|
const headingElementName = "h" + level;
|
|
24
24
|
const lineClampMultipleLines = typeof lineClamp === 'string' ? parseInt(lineClamp, 10) > 1 : (lineClamp || 0) > 1;
|
|
25
|
-
return /*#__PURE__*/createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
26
|
-
className: [exceptionallySetClassName,
|
|
25
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
26
|
+
className: [exceptionallySetClassName, modules_949d2ff4.heading, weight !== 'regular' ? getClassNames(modules_949d2ff4, 'weight', weight) : null, tone !== 'normal' ? getClassNames(modules_949d2ff4, 'tone', tone) : null, getClassNames(modules_949d2ff4, 'size', size), lineClampMultipleLines ? modules_949d2ff4.lineClampMultipleLines : null, lineClamp ? getClassNames(modules_949d2ff4, 'lineClamp', lineClamp.toString()) : null],
|
|
27
27
|
textAlign: align,
|
|
28
28
|
// Prevents emojis from being cut-off
|
|
29
29
|
// See https://github.com/Doist/reactist/pull/528
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.js","sources":["../../src/heading/heading.tsx"],"sourcesContent":["import * as React from 'react'\nimport { getClassNames } from '../utils/responsive-props'\nimport { Box } from '../box'\nimport styles from './heading.module.css'\nimport type { ObfuscatedClassName, Tone } from '../utils/common-types'\nimport type { BoxProps } from '../box'\n\ntype HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6 | '1' | '2' | '3' | '4' | '5' | '6'\ntype HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n\ntype HeadingProps = Omit<React.HTMLAttributes<HTMLHeadingElement>, 'className' | 'children'> & {\n children: React.ReactNode\n /**\n * The semantic level of the heading.\n */\n level: HeadingLevel\n\n /**\n * The weight of the heading. Used to de-emphasize the heading visually when using 'medium' or 'light'.\n *\n * @default 'regular'\n */\n weight?: 'regular' | 'medium' | 'light'\n\n /**\n * Shifts the default heading visual text size up or down, depending on the original size\n * imposed by the `level`. The heading continues to be semantically at the given level.\n *\n * By default, no value is applied, and the default size from the level is applied. The values\n * have the following effect:\n *\n * - 'smaller' shifts the default level size down in the font-size scale (it tends to make the\n * level look visually as if it were of the immediately lower level).\n * - 'larger' has the opposite effect than 'smaller' shifting the visual font size up in the\n * scale.\n * - 'largest' can be thought of as applying 'larger' twice.\n *\n * @see level\n * @default undefined\n */\n size?: 'smaller' | 'larger' | 'largest'\n\n /**\n * The tone (semantic color) of the heading.\n *\n * @default 'normal'\n */\n tone?: Tone\n\n /**\n * Used to truncate the heading to a given number of lines.\n *\n * It will add an ellipsis (`…`) to the text at the end of the last line, only if the text was\n * truncated. If the text fits without it being truncated, no ellipsis is added.\n *\n * By default, the text is not truncated at all, no matter how many lines it takes to render it.\n *\n * @default undefined\n */\n lineClamp?: 1 | 2 | 3 | 4 | 5 | '1' | '2' | '3' | '4' | '5'\n\n /**\n * How to align the heading text horizontally.\n *\n * @default 'start'\n */\n align?: BoxProps['textAlign']\n}\n\nconst Heading = React.forwardRef<HTMLHeadingElement, HeadingProps & ObfuscatedClassName>(\n function Heading(\n {\n level,\n weight = 'regular',\n size,\n tone = 'normal',\n children,\n lineClamp,\n align,\n exceptionallySetClassName,\n ...props\n },\n ref,\n ) {\n // In TypeScript v4.1, this would be properly recognized without needing the type assertion\n // https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/#template-literal-types\n const headingElementName = `h${level}` as HeadingElement\n const lineClampMultipleLines =\n typeof lineClamp === 'string' ? parseInt(lineClamp, 10) > 1 : (lineClamp || 0) > 1\n\n return (\n <Box\n {...props}\n className={[\n exceptionallySetClassName,\n styles.heading,\n weight !== 'regular' ? getClassNames(styles, 'weight', weight) : null,\n tone !== 'normal' ? getClassNames(styles, 'tone', tone) : null,\n getClassNames(styles, 'size', size),\n lineClampMultipleLines ? styles.lineClampMultipleLines : null,\n lineClamp ? getClassNames(styles, 'lineClamp', lineClamp.toString()) : null,\n ]}\n textAlign={align}\n // Prevents emojis from being cut-off\n // See https://github.com/Doist/reactist/pull/528\n paddingRight={lineClamp ? 'xsmall' : undefined}\n as={headingElementName}\n ref={ref}\n >\n {children}\n </Box>\n )\n },\n)\n\nexport type { HeadingProps, HeadingLevel }\nexport { Heading }\n"],"names":["Heading","React","ref","level","weight","size","tone","children","lineClamp","align","exceptionallySetClassName","props","headingElementName","lineClampMultipleLines","parseInt","Box","className","styles","heading","getClassNames","toString","textAlign","paddingRight","undefined","as"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"heading.js","sources":["../../src/heading/heading.tsx"],"sourcesContent":["import * as React from 'react'\nimport { getClassNames } from '../utils/responsive-props'\nimport { Box } from '../box'\nimport styles from './heading.module.css'\nimport type { ObfuscatedClassName, Tone } from '../utils/common-types'\nimport type { BoxProps } from '../box'\n\ntype HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6 | '1' | '2' | '3' | '4' | '5' | '6'\ntype HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n\ntype HeadingProps = Omit<React.HTMLAttributes<HTMLHeadingElement>, 'className' | 'children'> & {\n children: React.ReactNode\n /**\n * The semantic level of the heading.\n */\n level: HeadingLevel\n\n /**\n * The weight of the heading. Used to de-emphasize the heading visually when using 'medium' or 'light'.\n *\n * @default 'regular'\n */\n weight?: 'regular' | 'medium' | 'light'\n\n /**\n * Shifts the default heading visual text size up or down, depending on the original size\n * imposed by the `level`. The heading continues to be semantically at the given level.\n *\n * By default, no value is applied, and the default size from the level is applied. The values\n * have the following effect:\n *\n * - 'smaller' shifts the default level size down in the font-size scale (it tends to make the\n * level look visually as if it were of the immediately lower level).\n * - 'larger' has the opposite effect than 'smaller' shifting the visual font size up in the\n * scale.\n * - 'largest' can be thought of as applying 'larger' twice.\n *\n * @see level\n * @default undefined\n */\n size?: 'smaller' | 'larger' | 'largest'\n\n /**\n * The tone (semantic color) of the heading.\n *\n * @default 'normal'\n */\n tone?: Tone\n\n /**\n * Used to truncate the heading to a given number of lines.\n *\n * It will add an ellipsis (`…`) to the text at the end of the last line, only if the text was\n * truncated. If the text fits without it being truncated, no ellipsis is added.\n *\n * By default, the text is not truncated at all, no matter how many lines it takes to render it.\n *\n * @default undefined\n */\n lineClamp?: 1 | 2 | 3 | 4 | 5 | '1' | '2' | '3' | '4' | '5'\n\n /**\n * How to align the heading text horizontally.\n *\n * @default 'start'\n */\n align?: BoxProps['textAlign']\n}\n\nconst Heading = React.forwardRef<HTMLHeadingElement, HeadingProps & ObfuscatedClassName>(\n function Heading(\n {\n level,\n weight = 'regular',\n size,\n tone = 'normal',\n children,\n lineClamp,\n align,\n exceptionallySetClassName,\n ...props\n },\n ref,\n ) {\n // In TypeScript v4.1, this would be properly recognized without needing the type assertion\n // https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/#template-literal-types\n const headingElementName = `h${level}` as HeadingElement\n const lineClampMultipleLines =\n typeof lineClamp === 'string' ? parseInt(lineClamp, 10) > 1 : (lineClamp || 0) > 1\n\n return (\n <Box\n {...props}\n className={[\n exceptionallySetClassName,\n styles.heading,\n weight !== 'regular' ? getClassNames(styles, 'weight', weight) : null,\n tone !== 'normal' ? getClassNames(styles, 'tone', tone) : null,\n getClassNames(styles, 'size', size),\n lineClampMultipleLines ? styles.lineClampMultipleLines : null,\n lineClamp ? getClassNames(styles, 'lineClamp', lineClamp.toString()) : null,\n ]}\n textAlign={align}\n // Prevents emojis from being cut-off\n // See https://github.com/Doist/reactist/pull/528\n paddingRight={lineClamp ? 'xsmall' : undefined}\n as={headingElementName}\n ref={ref}\n >\n {children}\n </Box>\n )\n },\n)\n\nexport type { HeadingProps, HeadingLevel }\nexport { Heading }\n"],"names":["Heading","React","forwardRef","ref","level","weight","size","tone","children","lineClamp","align","exceptionallySetClassName","props","headingElementName","lineClampMultipleLines","parseInt","createElement","Box","className","styles","heading","getClassNames","toString","textAlign","paddingRight","undefined","as"],"mappings":";;;;;;;AAqEMA,MAAAA,OAAO,gBAAGC,KAAK,CAACC,UAAN,CACZ,SAASF,OAAT,CAYIG,IAAAA,EAAAA,GAZJ,EAYO;EAAA,IAXH;IACIC,KADJ;AAEIC,IAAAA,MAAM,GAAG,SAFb;IAGIC,IAHJ;AAIIC,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@@ -1,4 +1,4 @@
|
|
|
1
1
|
var modules_949d2ff4 = {"heading":"bff24867","weight-medium":"_9b540c61","weight-light":"c6729907","tone-secondary":"d6507f70","tone-danger":"d1846d93","size-largest":"_7cbdd1ba","size-larger":"b3e14969","size-smaller":"be14a265","lineClampMultipleLines":"_71391f13","lineClamp-1":"_97298b1b","lineClamp-2":"_6d357d76","lineClamp-3":"d820b451","lineClamp-4":"_8d37487d","lineClamp-5":"_5215b4d7"};
|
|
2
2
|
|
|
3
|
-
export default
|
|
3
|
+
export { modules_949d2ff4 as default };
|
|
4
4
|
//# sourceMappingURL=heading.module.css.js.map
|
package/es/hidden/hidden.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
3
|
-
import { polymorphicComponent } from '../utils/polymorphism.js';
|
|
2
|
+
import * as React from 'react';
|
|
4
3
|
import { Box } from '../box/box.js';
|
|
5
|
-
import
|
|
4
|
+
import modules_4689e97e from './hidden.module.css.js';
|
|
5
|
+
import { polymorphicComponent } from '../utils/polymorphism.js';
|
|
6
6
|
|
|
7
7
|
const _excluded = ["display", "children", "exceptionallySetClassName"];
|
|
8
8
|
/**
|
|
@@ -41,9 +41,9 @@ const Hidden = /*#__PURE__*/polymorphicComponent(function Hidden(_ref, ref) {
|
|
|
41
41
|
if ('above' in props) delete props['above'];
|
|
42
42
|
if ('below' in props) delete props['below'];
|
|
43
43
|
if ('print' in props) delete props['print'];
|
|
44
|
-
return /*#__PURE__*/createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
44
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
45
45
|
ref: ref,
|
|
46
|
-
className: [exceptionallySetClassName, hiddenOnPrint ?
|
|
46
|
+
className: [exceptionallySetClassName, hiddenOnPrint ? modules_4689e97e.hiddenOnPrint : null],
|
|
47
47
|
display: hiddenOnDesktop && hiddenOnMobile ? 'none' : {
|
|
48
48
|
mobile: hiddenOnMobile ? 'none' : display,
|
|
49
49
|
tablet: hiddenOnTablet ? 'none' : display,
|
package/es/hidden/hidden.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hidden.js","sources":["../../src/hidden/hidden.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box } from '../box'\nimport styles from './hidden.module.css'\nimport type { ResponsiveBreakpoints } from '../utils/responsive-props'\nimport { polymorphicComponent } from '../utils/polymorphism'\n\ntype AboveProp = {\n /**\n * Hides the element on viewport sizes equal or larger to the one given.\n *\n * It is not supported to pass it alongside `below`, and the resulting behavior is undefined\n * (most likely itʼll hide the element all the time to make it apparent that there's a problem).\n *\n * @see below\n */\n above: Exclude<ResponsiveBreakpoints, 'desktop'>\n below?: never\n}\n\ntype BelowProp = {\n /**\n * Hides the element on viewport sizes equal or smaller to the one given.\n *\n * It is not supported to pass it alongside `above`, and the resulting behavior is undefined\n * (most likely itʼll hide the element all the time to make it apparent that there's a problem).\n *\n * @see above\n */\n below: Exclude<ResponsiveBreakpoints, 'mobile'>\n above?: never\n}\n\ntype CommonProps = {\n children: React.ReactNode\n /**\n * hides the element when on print media.\n */\n print?: boolean\n /**\n * Useful if you want the element to be an inline element when it is visible.\n */\n display?: 'inline' | 'block'\n}\n\ntype HiddenProps = CommonProps & (AboveProp | BelowProp | Required<Pick<CommonProps, 'print'>>)\n\n/**\n * A component that allows to specify how to hide itself on certain responsive screen sizes, or on\n * print media.\n *\n * @see HiddenProps\n * @see HiddenVisually for hiding content only visually, while keeping it available for assistive\n * technologies.\n */\nconst Hidden = polymorphicComponent<'div', HiddenProps>(function Hidden(\n { display = 'block', children, exceptionallySetClassName, ...props },\n ref,\n) {\n const hiddenOnPrint = 'print' in props && props.print\n\n const hiddenOnDesktop = 'above' in props\n const hiddenOnMobile = 'below' in props\n const hiddenOnTablet =\n ('below' in props && props.below === 'desktop') ||\n ('above' in props && props.above === 'mobile')\n\n if (hiddenOnDesktop && hiddenOnMobile) {\n // eslint-disable-next-line no-console\n console.warn('<Hidden /> should receive either above=\"…\" or below=\"…\" but not both')\n }\n\n if (!hiddenOnDesktop && !hiddenOnMobile && !hiddenOnPrint) {\n // eslint-disable-next-line no-console\n console.warn('<Hidden /> did not receive any criteria to hide itself')\n }\n\n // We need to delete these so they do not get forwarded to the Box\n if ('above' in props) delete props['above']\n if ('below' in props) delete props['below']\n if ('print' in props) delete props['print']\n\n return (\n <Box\n {...props}\n ref={ref}\n className={[exceptionallySetClassName, hiddenOnPrint ? styles.hiddenOnPrint : null]}\n display={\n hiddenOnDesktop && hiddenOnMobile\n ? 'none'\n : {\n mobile: hiddenOnMobile ? 'none' : display,\n tablet: hiddenOnTablet ? 'none' : display,\n desktop: hiddenOnDesktop ? 'none' : display,\n }\n }\n >\n {children}\n </Box>\n )\n})\n\nexport { Hidden }\nexport type { HiddenProps }\n"],"names":["Hidden","polymorphicComponent","ref","display","children","exceptionallySetClassName","props","hiddenOnPrint","print","hiddenOnDesktop","hiddenOnMobile","hiddenOnTablet","below","above","console","warn","React","Box","className","styles","mobile","tablet","desktop"],"mappings":";;;;;;;AA8CA
|
|
1
|
+
{"version":3,"file":"hidden.js","sources":["../../src/hidden/hidden.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box } from '../box'\nimport styles from './hidden.module.css'\nimport type { ResponsiveBreakpoints } from '../utils/responsive-props'\nimport { polymorphicComponent } from '../utils/polymorphism'\n\ntype AboveProp = {\n /**\n * Hides the element on viewport sizes equal or larger to the one given.\n *\n * It is not supported to pass it alongside `below`, and the resulting behavior is undefined\n * (most likely itʼll hide the element all the time to make it apparent that there's a problem).\n *\n * @see below\n */\n above: Exclude<ResponsiveBreakpoints, 'desktop'>\n below?: never\n}\n\ntype BelowProp = {\n /**\n * Hides the element on viewport sizes equal or smaller to the one given.\n *\n * It is not supported to pass it alongside `above`, and the resulting behavior is undefined\n * (most likely itʼll hide the element all the time to make it apparent that there's a problem).\n *\n * @see above\n */\n below: Exclude<ResponsiveBreakpoints, 'mobile'>\n above?: never\n}\n\ntype CommonProps = {\n children: React.ReactNode\n /**\n * hides the element when on print media.\n */\n print?: boolean\n /**\n * Useful if you want the element to be an inline element when it is visible.\n */\n display?: 'inline' | 'block'\n}\n\ntype HiddenProps = CommonProps & (AboveProp | BelowProp | Required<Pick<CommonProps, 'print'>>)\n\n/**\n * A component that allows to specify how to hide itself on certain responsive screen sizes, or on\n * print media.\n *\n * @see HiddenProps\n * @see HiddenVisually for hiding content only visually, while keeping it available for assistive\n * technologies.\n */\nconst Hidden = polymorphicComponent<'div', HiddenProps>(function Hidden(\n { display = 'block', children, exceptionallySetClassName, ...props },\n ref,\n) {\n const hiddenOnPrint = 'print' in props && props.print\n\n const hiddenOnDesktop = 'above' in props\n const hiddenOnMobile = 'below' in props\n const hiddenOnTablet =\n ('below' in props && props.below === 'desktop') ||\n ('above' in props && props.above === 'mobile')\n\n if (hiddenOnDesktop && hiddenOnMobile) {\n // eslint-disable-next-line no-console\n console.warn('<Hidden /> should receive either above=\"…\" or below=\"…\" but not both')\n }\n\n if (!hiddenOnDesktop && !hiddenOnMobile && !hiddenOnPrint) {\n // eslint-disable-next-line no-console\n console.warn('<Hidden /> did not receive any criteria to hide itself')\n }\n\n // We need to delete these so they do not get forwarded to the Box\n if ('above' in props) delete props['above']\n if ('below' in props) delete props['below']\n if ('print' in props) delete props['print']\n\n return (\n <Box\n {...props}\n ref={ref}\n className={[exceptionallySetClassName, hiddenOnPrint ? styles.hiddenOnPrint : null]}\n display={\n hiddenOnDesktop && hiddenOnMobile\n ? 'none'\n : {\n mobile: hiddenOnMobile ? 'none' : display,\n tablet: hiddenOnTablet ? 'none' : display,\n desktop: hiddenOnDesktop ? 'none' : display,\n }\n }\n >\n {children}\n </Box>\n )\n})\n\nexport { Hidden }\nexport type { HiddenProps }\n"],"names":["Hidden","polymorphicComponent","ref","display","children","exceptionallySetClassName","props","hiddenOnPrint","print","hiddenOnDesktop","hiddenOnMobile","hiddenOnTablet","below","above","console","warn","React","createElement","Box","className","styles","mobile","tablet","desktop"],"mappings":";;;;;;;AA8CA;;;;;;;AAOG;;AACGA,MAAAA,MAAM,gBAAGC,oBAAoB,CAAqB,SAASD,MAAT,CAAA,IAAA,EAEpDE,GAFoD,EAEjD;EAAA,IADH;AAAEC,IAAAA,OAAO,GAAG,OAAZ;IAAqBC,QAArB;AAA+BC,IAAAA,yBAAAA;GAC5B,GAAA,IAAA;AAAA,MAD0DC,KAC1D,GAAA,wBAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AAEH,EAAA,MAAMC,aAAa,GAAG,OAAA,IAAWD,KAAX,IAAoBA,KAAK,CAACE,KAAhD,CAAA;AAEA,EAAA,MAAMC,eAAe,IAAG,OAAWH,IAAAA,KAAd,CAArB,CAAA;AACA,EAAA,MAAMI,cAAc,IAAG,OAAWJ,IAAAA,KAAd,CAApB,CAAA;AACA,EAAA,MAAMK,cAAc,GACf,OAAA,IAAWL,KAAX,IAAoBA,KAAK,CAACM,KAAN,KAAgB,SAArC,IACC,WAAWN,KAAX,IAAoBA,KAAK,CAACO,KAAN,KAAgB,QAFzC,CAAA;;EAIA,IAAIJ,eAAe,IAAIC,cAAvB,EAAuC;AACnC;IACAI,OAAO,CAACC,IAAR,CAAa,sEAAb,CAAA,CAAA;AACH,GAAA;;EAED,IAAI,CAACN,eAAD,IAAoB,CAACC,cAArB,IAAuC,CAACH,aAA5C,EAA2D;AACvD;IACAO,OAAO,CAACC,IAAR,CAAa,wDAAb,CAAA,CAAA;AACH,GAlBE;;;AAqBH,EAAA,IAAI,WAAWT,KAAf,EAAsB,OAAOA,KAAK,CAAC,OAAD,CAAZ,CAAA;AACtB,EAAA,IAAI,WAAWA,KAAf,EAAsB,OAAOA,KAAK,CAAC,OAAD,CAAZ,CAAA;AACtB,EAAA,IAAI,WAAWA,KAAf,EAAsB,OAAOA,KAAK,CAAC,OAAD,CAAZ,CAAA;AAEtB,EAAA,oBACIU,KAAA,CAAAC,aAAA,CAACC,GAAD,oCACQZ,KADR,CAAA,EAAA,EAAA,EAAA;AAEIJ,IAAAA,GAAG,EAAEA,GAFT;IAGIiB,SAAS,EAAE,CAACd,yBAAD,EAA4BE,aAAa,GAAGa,gBAAM,CAACb,aAAV,GAA0B,IAAnE,CAHf;AAIIJ,IAAAA,OAAO,EACHM,eAAe,IAAIC,cAAnB,GACM,MADN,GAEM;AACIW,MAAAA,MAAM,EAAEX,cAAc,GAAG,MAAH,GAAYP,OADtC;AAEImB,MAAAA,MAAM,EAAEX,cAAc,GAAG,MAAH,GAAYR,OAFtC;AAGIoB,MAAAA,OAAO,EAAEd,eAAe,GAAG,MAAH,GAAYN,OAAAA;AAHxC,KAAA;AAPd,GAAA,CAAA,EAcKC,QAdL,CADJ,CAAA;AAkBH,CA7CkC;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { polymorphicComponent } from '../utils/polymorphism.js';
|
|
4
4
|
import { Box } from '../box/box.js';
|
|
5
|
-
import
|
|
5
|
+
import modules_61c16c43 from './hidden-visually.module.css.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Provides content to assistive technologies while hiding it from the screen.
|
|
@@ -11,11 +11,11 @@ import styles from './hidden-visually.module.css.js';
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
const HiddenVisually = /*#__PURE__*/polymorphicComponent(function HiddenVisually(props, ref) {
|
|
14
|
-
return /*#__PURE__*/createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
14
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
15
15
|
ref: ref,
|
|
16
16
|
position: "absolute",
|
|
17
17
|
overflow: "hidden",
|
|
18
|
-
className:
|
|
18
|
+
className: modules_61c16c43.hiddenVisually
|
|
19
19
|
}));
|
|
20
20
|
});
|
|
21
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hidden-visually.js","sources":["../../src/hidden-visually/hidden-visually.tsx"],"sourcesContent":["import * as React from 'react'\nimport { polymorphicComponent } from '../utils/polymorphism'\nimport { Box } from '../box'\nimport styles from './hidden-visually.module.css'\n\ntype Props = {\n children: React.ReactNode\n}\n\n/**\n * Provides content to assistive technologies while hiding it from the screen.\n *\n * @see Hidden for fully hiding content, and only under certain conditions.\n */\nconst HiddenVisually = polymorphicComponent<'div', Props, 'omitClassName'>(function HiddenVisually(\n props,\n ref,\n) {\n return (\n <Box\n {...props}\n ref={ref}\n position=\"absolute\"\n overflow=\"hidden\"\n className={styles.hiddenVisually}\n />\n )\n})\n\nexport { HiddenVisually }\n"],"names":["HiddenVisually","polymorphicComponent","props","ref","React","Box","position","overflow","className","styles","hiddenVisually"],"mappings":";;;;;;AASA
|
|
1
|
+
{"version":3,"file":"hidden-visually.js","sources":["../../src/hidden-visually/hidden-visually.tsx"],"sourcesContent":["import * as React from 'react'\nimport { polymorphicComponent } from '../utils/polymorphism'\nimport { Box } from '../box'\nimport styles from './hidden-visually.module.css'\n\ntype Props = {\n children: React.ReactNode\n}\n\n/**\n * Provides content to assistive technologies while hiding it from the screen.\n *\n * @see Hidden for fully hiding content, and only under certain conditions.\n */\nconst HiddenVisually = polymorphicComponent<'div', Props, 'omitClassName'>(function HiddenVisually(\n props,\n ref,\n) {\n return (\n <Box\n {...props}\n ref={ref}\n position=\"absolute\"\n overflow=\"hidden\"\n className={styles.hiddenVisually}\n />\n )\n})\n\nexport { HiddenVisually }\n"],"names":["HiddenVisually","polymorphicComponent","props","ref","React","createElement","Box","position","overflow","className","styles","hiddenVisually"],"mappings":";;;;;;AASA;;;;AAIG;;AACGA,MAAAA,cAAc,gBAAGC,oBAAoB,CAAgC,SAASD,cAAT,CACvEE,KADuE,EAEvEC,GAFuE,EAEpE;AAEH,EAAA,oBACIC,KAAC,CAAAC,aAAD,CAACC,GAAD,oCACQJ,KADR,CAAA,EAAA,EAAA,EAAA;AAEIC,IAAAA,GAAG,EAAEA,GAFT;AAGII,IAAAA,QAAQ,EAAC,UAHb;AAIIC,IAAAA,QAAQ,EAAC,QAJb;IAKIC,SAAS,EAAEC,gBAAM,CAACC,cAAAA;GAN1B,CAAA,CAAA,CAAA;AASH,CAb0C;;;;"}
|
package/es/icons/alert-icon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
const _excluded = ["tone"];
|
|
5
5
|
const alertIconForTone = {
|
|
@@ -16,16 +16,16 @@ function AlertIcon(_ref) {
|
|
|
16
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
17
|
|
|
18
18
|
const Icon = alertIconForTone[tone];
|
|
19
|
-
return Icon ? /*#__PURE__*/createElement(Icon, _objectSpread2({}, props)) : null;
|
|
19
|
+
return Icon ? /*#__PURE__*/React.createElement(Icon, _objectSpread2({}, props)) : null;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function AlertInfoIcon(props) {
|
|
23
|
-
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
23
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
24
24
|
xmlns: "http://www.w3.org/2000/svg",
|
|
25
25
|
width: "24",
|
|
26
26
|
height: "24",
|
|
27
27
|
viewBox: "0 0 24 24"
|
|
28
|
-
}, props), /*#__PURE__*/createElement("path", {
|
|
28
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
29
29
|
fillRule: "evenodd",
|
|
30
30
|
clipRule: "evenodd",
|
|
31
31
|
d: "M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-8-3.94a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM10.25 10a.75.75 0 0 0 0 1.5h1.25V15h-1.25a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5H13v-4.25a.75.75 0 0 0-.75-.75h-2Z",
|
|
@@ -34,12 +34,12 @@ function AlertInfoIcon(props) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function AlertPositiveIcon(props) {
|
|
37
|
-
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
37
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
38
38
|
xmlns: "http://www.w3.org/2000/svg",
|
|
39
39
|
width: "24",
|
|
40
40
|
height: "24",
|
|
41
41
|
viewBox: "0 0 24 24"
|
|
42
|
-
}, props), /*#__PURE__*/createElement("path", {
|
|
42
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
43
43
|
fillRule: "evenodd",
|
|
44
44
|
clipRule: "evenodd",
|
|
45
45
|
d: "M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-5.555-2.99a.75.75 0 0 1 1.06 1.06l-5.303 5.304a.748.748 0 0 1-1.061 0l-2.475-2.475a.75.75 0 0 1 1.06-1.06l1.945 1.944 4.774-4.773Z",
|
|
@@ -48,12 +48,12 @@ function AlertPositiveIcon(props) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function AlertCautionIcon(props) {
|
|
51
|
-
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
51
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
52
52
|
xmlns: "http://www.w3.org/2000/svg",
|
|
53
53
|
width: "24",
|
|
54
54
|
height: "24",
|
|
55
55
|
viewBox: "0 0 24 24"
|
|
56
|
-
}, props), /*#__PURE__*/createElement("path", {
|
|
56
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
57
57
|
fillRule: "evenodd",
|
|
58
58
|
clipRule: "evenodd",
|
|
59
59
|
d: "m10.272 4.962-7.018 12.03A2 2 0 0 0 4.982 20h14.036a2 2 0 0 0 1.727-3.008l-7.018-12.03a2 2 0 0 0-3.455 0ZM13 16.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-.014-7.013A.987.987 0 0 0 12 8.5h-.028l-.027.002a.987.987 0 0 0-.93 1.04l.236 4.25c.052.944 1.445.944 1.498 0l.236-4.25a1.925 1.925 0 0 0 .001-.055Z",
|
|
@@ -62,12 +62,12 @@ function AlertCautionIcon(props) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
function AlertCriticalIcon(props) {
|
|
65
|
-
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
65
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
66
66
|
xmlns: "http://www.w3.org/2000/svg",
|
|
67
67
|
width: "24",
|
|
68
68
|
height: "24",
|
|
69
69
|
viewBox: "0 0 24 24"
|
|
70
|
-
}, props), /*#__PURE__*/createElement("path", {
|
|
70
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
71
71
|
fillRule: "evenodd",
|
|
72
72
|
clipRule: "evenodd",
|
|
73
73
|
d: "M12.9866 2.25049C12.3729 1.91683 11.6271 1.91683 11.0134 2.25049L4.04793 6.03744C3.40122 6.38904 2.99999 7.05702 2.99999 7.78208V15.2184C2.99999 15.9435 3.40122 16.6115 4.04793 16.963L11.0134 20.75C11.6271 21.0837 12.3729 21.0837 12.9866 20.75L19.9521 16.963C20.5988 16.6114 21 15.9435 21 15.2184V7.78208C21 7.05701 20.5988 6.38904 19.9521 6.03744L12.9866 2.25049ZM12 7.00024C12.5448 7.00024 12.9865 7.44191 12.9865 7.98674C12.9864 8.00043 12.9863 8.00727 12.9861 8.01411C12.9859 8.02095 12.9856 8.02779 12.985 8.04146L12.7489 12.2918C12.6964 13.2364 11.3036 13.2364 11.2512 12.2918L11.015 8.04146C10.9848 7.49747 11.4013 7.03198 11.9453 7.00176L11.9726 7.00062L12 7.00024ZM13 15.0002C13 15.5525 12.5523 16.0002 12 16.0002C11.4477 16.0002 11 15.5525 11 15.0002C11 14.448 11.4477 14.0002 12 14.0002C12.5523 14.0002 13 14.448 13 15.0002Z",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-icon.js","sources":["../../src/icons/alert-icon.tsx"],"sourcesContent":["import * as React from 'react'\nimport type { AlertTone } from '../utils/common-types'\n\nconst alertIconForTone: Record<AlertTone, typeof AlertInfoIcon> = {\n info: AlertInfoIcon,\n positive: AlertPositiveIcon,\n caution: AlertCautionIcon,\n critical: AlertCriticalIcon,\n}\n\nfunction AlertIcon({ tone, ...props }: JSX.IntrinsicElements['svg'] & { tone: AlertTone }) {\n const Icon = alertIconForTone[tone]\n return Icon ? <Icon {...props} /> : null\n}\n\nfunction AlertInfoIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-8-3.94a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM10.25 10a.75.75 0 0 0 0 1.5h1.25V15h-1.25a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5H13v-4.25a.75.75 0 0 0-.75-.75h-2Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction AlertPositiveIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-5.555-2.99a.75.75 0 0 1 1.06 1.06l-5.303 5.304a.748.748 0 0 1-1.061 0l-2.475-2.475a.75.75 0 0 1 1.06-1.06l1.945 1.944 4.774-4.773Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction AlertCautionIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"m10.272 4.962-7.018 12.03A2 2 0 0 0 4.982 20h14.036a2 2 0 0 0 1.727-3.008l-7.018-12.03a2 2 0 0 0-3.455 0ZM13 16.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-.014-7.013A.987.987 0 0 0 12 8.5h-.028l-.027.002a.987.987 0 0 0-.93 1.04l.236 4.25c.052.944 1.445.944 1.498 0l.236-4.25a1.925 1.925 0 0 0 .001-.055Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction AlertCriticalIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.9866 2.25049C12.3729 1.91683 11.6271 1.91683 11.0134 2.25049L4.04793 6.03744C3.40122 6.38904 2.99999 7.05702 2.99999 7.78208V15.2184C2.99999 15.9435 3.40122 16.6115 4.04793 16.963L11.0134 20.75C11.6271 21.0837 12.3729 21.0837 12.9866 20.75L19.9521 16.963C20.5988 16.6114 21 15.9435 21 15.2184V7.78208C21 7.05701 20.5988 6.38904 19.9521 6.03744L12.9866 2.25049ZM12 7.00024C12.5448 7.00024 12.9865 7.44191 12.9865 7.98674C12.9864 8.00043 12.9863 8.00727 12.9861 8.01411C12.9859 8.02095 12.9856 8.02779 12.985 8.04146L12.7489 12.2918C12.6964 13.2364 11.3036 13.2364 11.2512 12.2918L11.015 8.04146C10.9848 7.49747 11.4013 7.03198 11.9453 7.00176L11.9726 7.00062L12 7.00024ZM13 15.0002C13 15.5525 12.5523 16.0002 12 16.0002C11.4477 16.0002 11 15.5525 11 15.0002C11 14.448 11.4477 14.0002 12 14.0002C12.5523 14.0002 13 14.448 13 15.0002Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nexport { AlertIcon }\n"],"names":["alertIconForTone","info","AlertInfoIcon","positive","AlertPositiveIcon","caution","AlertCautionIcon","critical","AlertCriticalIcon","AlertIcon","tone","props","Icon","React","xmlns","width","height","viewBox","fillRule","clipRule","d","fill"],"mappings":";;;;AAGA,MAAMA,gBAAgB,GAA4C;
|
|
1
|
+
{"version":3,"file":"alert-icon.js","sources":["../../src/icons/alert-icon.tsx"],"sourcesContent":["import * as React from 'react'\nimport type { AlertTone } from '../utils/common-types'\n\nconst alertIconForTone: Record<AlertTone, typeof AlertInfoIcon> = {\n info: AlertInfoIcon,\n positive: AlertPositiveIcon,\n caution: AlertCautionIcon,\n critical: AlertCriticalIcon,\n}\n\nfunction AlertIcon({ tone, ...props }: JSX.IntrinsicElements['svg'] & { tone: AlertTone }) {\n const Icon = alertIconForTone[tone]\n return Icon ? <Icon {...props} /> : null\n}\n\nfunction AlertInfoIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-8-3.94a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM10.25 10a.75.75 0 0 0 0 1.5h1.25V15h-1.25a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5H13v-4.25a.75.75 0 0 0-.75-.75h-2Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction AlertPositiveIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-5.555-2.99a.75.75 0 0 1 1.06 1.06l-5.303 5.304a.748.748 0 0 1-1.061 0l-2.475-2.475a.75.75 0 0 1 1.06-1.06l1.945 1.944 4.774-4.773Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction AlertCautionIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"m10.272 4.962-7.018 12.03A2 2 0 0 0 4.982 20h14.036a2 2 0 0 0 1.727-3.008l-7.018-12.03a2 2 0 0 0-3.455 0ZM13 16.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-.014-7.013A.987.987 0 0 0 12 8.5h-.028l-.027.002a.987.987 0 0 0-.93 1.04l.236 4.25c.052.944 1.445.944 1.498 0l.236-4.25a1.925 1.925 0 0 0 .001-.055Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction AlertCriticalIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.9866 2.25049C12.3729 1.91683 11.6271 1.91683 11.0134 2.25049L4.04793 6.03744C3.40122 6.38904 2.99999 7.05702 2.99999 7.78208V15.2184C2.99999 15.9435 3.40122 16.6115 4.04793 16.963L11.0134 20.75C11.6271 21.0837 12.3729 21.0837 12.9866 20.75L19.9521 16.963C20.5988 16.6114 21 15.9435 21 15.2184V7.78208C21 7.05701 20.5988 6.38904 19.9521 6.03744L12.9866 2.25049ZM12 7.00024C12.5448 7.00024 12.9865 7.44191 12.9865 7.98674C12.9864 8.00043 12.9863 8.00727 12.9861 8.01411C12.9859 8.02095 12.9856 8.02779 12.985 8.04146L12.7489 12.2918C12.6964 13.2364 11.3036 13.2364 11.2512 12.2918L11.015 8.04146C10.9848 7.49747 11.4013 7.03198 11.9453 7.00176L11.9726 7.00062L12 7.00024ZM13 15.0002C13 15.5525 12.5523 16.0002 12 16.0002C11.4477 16.0002 11 15.5525 11 15.0002C11 14.448 11.4477 14.0002 12 14.0002C12.5523 14.0002 13 14.448 13 15.0002Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nexport { AlertIcon }\n"],"names":["alertIconForTone","info","AlertInfoIcon","positive","AlertPositiveIcon","caution","AlertCautionIcon","critical","AlertCriticalIcon","AlertIcon","tone","props","Icon","React","createElement","_objectSpread","xmlns","width","height","viewBox","fillRule","clipRule","d","fill"],"mappings":";;;;AAGA,MAAMA,gBAAgB,GAA4C;AAC9DC,EAAAA,IAAI,EAAEC,aADwD;AAE9DC,EAAAA,QAAQ,EAAEC,iBAFoD;AAG9DC,EAAAA,OAAO,EAAEC,gBAHqD;AAI9DC,EAAAA,QAAQ,EAAEC,iBAAAA;AAJoD,CAAlE,CAAA;;AAOA,SAASC,SAAT,CAAyF,IAAA,EAAA;EAAA,IAAtE;AAAEC,IAAAA,IAAAA;GAAoE,GAAA,IAAA;AAAA,MAA3DC,KAA2D,GAAA,wBAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AACrF,EAAA,MAAMC,IAAI,GAAGZ,gBAAgB,CAACU,IAAD,CAA7B,CAAA;EACA,OAAOE,IAAI,gBAAGC,KAAC,CAAAC,aAAD,CAACF,IAAD,EAAUD,cAAAA,CAAAA,EAAAA,EAAAA,KAAV,CAAH,CAAA,GAAyB,IAApC,CAAA;AACH,CAAA;;AAED,SAAST,aAAT,CAAuBS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AAA,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AACIM,IAAAA,QAAQ,EAAC,SADb;AAEIC,IAAAA,QAAQ,EAAC,SAFb;AAGIC,IAAAA,CAAC,EAAC,sSAHN;AAIIC,IAAAA,IAAI,EAAC,cAAA;AAJT,GAAA,CAPJ,CADJ,CAAA;AAgBH,CAAA;;AAED,SAASf,iBAAT,CAA2BG,KAA3B,EAA8D;AAC1D,EAAA,oBACIE,KACI,CAAAC,aADJ,CACI,KADJ,EAAAC,cAAA,CAAA;AACIC,IAAAA,KAAK,EAAC,4BADV;AAEIC,IAAAA,KAAK,EAAC,IAFV;AAGIC,IAAAA,MAAM,EAAC,IAHX;AAIIC,IAAAA,OAAO,EAAC,WAAA;AAJZ,GAAA,EAKQR,KALR,CAOIE,eAAAA,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AACIM,IAAAA,QAAQ,EAAC,SADb;AAEIC,IAAAA,QAAQ,EAAC,SAFb;AAGIC,IAAAA,CAAC,EAAC,q0BAHN;AAIIC,IAAAA,IAAI,EAAC,cAAA;AAJT,GAAA,CAPJ,CADJ,CAAA;AAgBH;;;;"}
|
package/es/icons/close-icon.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
function CloseIcon(props) {
|
|
5
|
-
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
5
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
6
6
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7
7
|
width: "24",
|
|
8
8
|
height: "24"
|
|
9
|
-
}, props), /*#__PURE__*/createElement("path", {
|
|
9
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
10
10
|
fill: "currentColor",
|
|
11
11
|
d: "M5.146 5.146a.5.5 0 0 1 .708 0L12 11.293l6.146-6.147a.5.5 0 0 1 .638-.057l.07.057a.5.5 0 0 1 0 .708L12.707 12l6.147 6.146a.5.5 0 0 1 .057.638l-.057.07a.5.5 0 0 1-.708 0L12 12.707l-6.146 6.147a.5.5 0 0 1-.638.057l-.07-.057a.5.5 0 0 1 0-.708L11.293 12 5.146 5.854a.5.5 0 0 1-.057-.638z"
|
|
12
12
|
}));
|