@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
package/es/alert/alert.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { getClassNames } from '../utils/responsive-props.js';
|
|
3
3
|
import { Box } from '../box/box.js';
|
|
4
|
-
import { Columns, Column } from '../columns/columns.js';
|
|
5
4
|
import { Button } from '../button/button.js';
|
|
5
|
+
import { Columns, Column } from '../columns/columns.js';
|
|
6
6
|
import { AlertIcon } from '../icons/alert-icon.js';
|
|
7
7
|
import { CloseIcon } from '../icons/close-icon.js';
|
|
8
|
-
import
|
|
8
|
+
import modules_6205a58e from './alert.module.css.js';
|
|
9
9
|
|
|
10
10
|
function Alert({
|
|
11
11
|
id,
|
|
@@ -14,31 +14,31 @@ function Alert({
|
|
|
14
14
|
closeLabel,
|
|
15
15
|
onClose
|
|
16
16
|
}) {
|
|
17
|
-
return /*#__PURE__*/createElement(Box, {
|
|
17
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
18
18
|
id: id,
|
|
19
19
|
role: "alert",
|
|
20
20
|
"aria-live": "polite",
|
|
21
21
|
borderRadius: "full",
|
|
22
|
-
className: [
|
|
23
|
-
}, /*#__PURE__*/createElement(Columns, {
|
|
22
|
+
className: [modules_6205a58e.container, getClassNames(modules_6205a58e, 'tone', tone)]
|
|
23
|
+
}, /*#__PURE__*/React.createElement(Columns, {
|
|
24
24
|
space: "small",
|
|
25
25
|
alignY: "center"
|
|
26
|
-
}, /*#__PURE__*/createElement(Column, {
|
|
26
|
+
}, /*#__PURE__*/React.createElement(Column, {
|
|
27
27
|
width: "content"
|
|
28
|
-
}, /*#__PURE__*/createElement(AlertIcon, {
|
|
28
|
+
}, /*#__PURE__*/React.createElement(AlertIcon, {
|
|
29
29
|
tone: tone,
|
|
30
|
-
className:
|
|
31
|
-
})), /*#__PURE__*/createElement(Column, null, /*#__PURE__*/createElement(Box, {
|
|
30
|
+
className: modules_6205a58e.icon
|
|
31
|
+
})), /*#__PURE__*/React.createElement(Column, null, /*#__PURE__*/React.createElement(Box, {
|
|
32
32
|
paddingY: "xsmall",
|
|
33
33
|
paddingRight: onClose != null && closeLabel != null ? undefined : 'small'
|
|
34
|
-
}, children)), onClose != null && closeLabel != null ? /*#__PURE__*/createElement(Column, {
|
|
34
|
+
}, children)), onClose != null && closeLabel != null ? /*#__PURE__*/React.createElement(Column, {
|
|
35
35
|
width: "content"
|
|
36
|
-
}, /*#__PURE__*/createElement(Button, {
|
|
36
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
37
37
|
variant: "quaternary",
|
|
38
38
|
size: "small",
|
|
39
39
|
onClick: onClose,
|
|
40
40
|
"aria-label": closeLabel,
|
|
41
|
-
icon: /*#__PURE__*/createElement(CloseIcon, null),
|
|
41
|
+
icon: /*#__PURE__*/React.createElement(CloseIcon, null),
|
|
42
42
|
style: {
|
|
43
43
|
// @ts-expect-error not sure how to make TypeScript understand custom CSS properties
|
|
44
44
|
'--reactist-btn-hover-fill': 'transparent'
|
package/es/alert/alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","sources":["../../src/alert/alert.tsx"],"sourcesContent":["import * as React from 'react'\nimport { getClassNames } from '../utils/responsive-props'\nimport { Box } from '../box'\nimport { Button } from '../button'\nimport { Columns, Column } from '../columns'\n\nimport { AlertIcon } from '../icons/alert-icon'\nimport { CloseIcon } from '../icons/close-icon'\n\nimport styles from './alert.module.css'\n\nimport type { AlertTone } from '../utils/common-types'\n\ntype AllOrNone<T> = T | { [K in keyof T]?: never }\n\ntype AlertCloseProps = AllOrNone<{\n closeLabel: string\n onClose: () => void\n}>\n\ntype AlertProps = {\n id?: string\n children: React.ReactNode\n tone: AlertTone\n} & AlertCloseProps\n\nfunction Alert({ id, children, tone, closeLabel, onClose }: AlertProps) {\n return (\n <Box\n id={id}\n role=\"alert\"\n aria-live=\"polite\"\n borderRadius=\"full\"\n className={[styles.container, getClassNames(styles, 'tone', tone)]}\n >\n <Columns space=\"small\" alignY=\"center\">\n <Column width=\"content\">\n <AlertIcon tone={tone} className={styles.icon} />\n </Column>\n <Column>\n <Box\n paddingY=\"xsmall\"\n paddingRight={onClose != null && closeLabel != null ? undefined : 'small'}\n >\n {children}\n </Box>\n </Column>\n {onClose != null && closeLabel != null ? (\n <Column width=\"content\">\n <Button\n variant=\"quaternary\"\n size=\"small\"\n onClick={onClose}\n aria-label={closeLabel}\n icon={<CloseIcon />}\n style={{\n // @ts-expect-error not sure how to make TypeScript understand custom CSS properties\n '--reactist-btn-hover-fill': 'transparent',\n }}\n />\n </Column>\n ) : null}\n </Columns>\n </Box>\n )\n}\n\nexport { Alert }\nexport type { AlertProps }\n"],"names":["Alert","id","children","tone","closeLabel","onClose","React","Box","role","borderRadius","className","styles","container","getClassNames","Columns","space","alignY","Column","width","AlertIcon","icon","paddingY","paddingRight","undefined","Button","variant","size","onClick","CloseIcon","style"],"mappings":";;;;;;;;;AA0BA,SAASA,KAAT,CAAe;EAAEC,EAAF;EAAMC,QAAN;EAAgBC,IAAhB;EAAsBC,UAAtB;
|
|
1
|
+
{"version":3,"file":"alert.js","sources":["../../src/alert/alert.tsx"],"sourcesContent":["import * as React from 'react'\nimport { getClassNames } from '../utils/responsive-props'\nimport { Box } from '../box'\nimport { Button } from '../button'\nimport { Columns, Column } from '../columns'\n\nimport { AlertIcon } from '../icons/alert-icon'\nimport { CloseIcon } from '../icons/close-icon'\n\nimport styles from './alert.module.css'\n\nimport type { AlertTone } from '../utils/common-types'\n\ntype AllOrNone<T> = T | { [K in keyof T]?: never }\n\ntype AlertCloseProps = AllOrNone<{\n closeLabel: string\n onClose: () => void\n}>\n\ntype AlertProps = {\n id?: string\n children: React.ReactNode\n tone: AlertTone\n} & AlertCloseProps\n\nfunction Alert({ id, children, tone, closeLabel, onClose }: AlertProps) {\n return (\n <Box\n id={id}\n role=\"alert\"\n aria-live=\"polite\"\n borderRadius=\"full\"\n className={[styles.container, getClassNames(styles, 'tone', tone)]}\n >\n <Columns space=\"small\" alignY=\"center\">\n <Column width=\"content\">\n <AlertIcon tone={tone} className={styles.icon} />\n </Column>\n <Column>\n <Box\n paddingY=\"xsmall\"\n paddingRight={onClose != null && closeLabel != null ? undefined : 'small'}\n >\n {children}\n </Box>\n </Column>\n {onClose != null && closeLabel != null ? (\n <Column width=\"content\">\n <Button\n variant=\"quaternary\"\n size=\"small\"\n onClick={onClose}\n aria-label={closeLabel}\n icon={<CloseIcon />}\n style={{\n // @ts-expect-error not sure how to make TypeScript understand custom CSS properties\n '--reactist-btn-hover-fill': 'transparent',\n }}\n />\n </Column>\n ) : null}\n </Columns>\n </Box>\n )\n}\n\nexport { Alert }\nexport type { AlertProps }\n"],"names":["Alert","id","children","tone","closeLabel","onClose","React","createElement","Box","role","borderRadius","className","styles","container","getClassNames","Columns","space","alignY","Column","width","AlertIcon","icon","paddingY","paddingRight","undefined","Button","variant","size","onClick","CloseIcon","style"],"mappings":";;;;;;;;;AA0BA,SAASA,KAAT,CAAe;EAAEC,EAAF;EAAMC,QAAN;EAAgBC,IAAhB;EAAsBC,UAAtB;AAAkCC,EAAAA,OAAAA;AAAlC,CAAf,EAAsE;AAClE,EAAA,oBACIC,KAAA,CAAAC,aAAA,CAACC,GAAD,EAAI;AACAP,IAAAA,EAAE,EAAEA,EADJ;AAEAQ,IAAAA,IAAI,EAAC,OAFL;AAGU,IAAA,WAAA,EAAA,QAHV;AAIAC,IAAAA,YAAY,EAAC,MAJb;AAKAC,IAAAA,SAAS,EAAE,CAACC,gBAAM,CAACC,SAAR,EAAmBC,aAAa,CAACF,gBAAD,EAAS,MAAT,EAAiBT,IAAjB,CAAhC,CAAA;AALX,GAAJ,eAOIG,KAAC,CAAAC,aAAD,CAACQ,OAAD;AAASC,IAAAA,KAAK,EAAC;AAAQC,IAAAA,MAAM,EAAC,QAAA;GAA9B,eACIX,KAAA,CAAAC,aAAA,CAACW,MAAD,EAAO;AAACC,IAAAA,KAAK,EAAC,SAAA;AAAP,GAAP,eACIb,KAAA,CAAAC,aAAA,CAACa,SAAD,EAAU;AAACjB,IAAAA,IAAI,EAAEA,IAAP;IAAaQ,SAAS,EAAEC,gBAAM,CAACS,IAAAA;AAA/B,GAAV,CADJ,CADJ,eAIIf,KAAA,CAAAC,aAAA,CAACW,MAAD,EAAO,IAAP,eACIZ,KAAC,CAAAC,aAAD,CAACC,GAAD,EACI;AAAAc,IAAAA,QAAQ,EAAC,QAAT;IACAC,YAAY,EAAElB,OAAO,IAAI,IAAX,IAAmBD,UAAU,IAAI,IAAjC,GAAwCoB,SAAxC,GAAoD,OAAA;AADlE,GADJ,EAIKtB,QAJL,CADJ,CAJJ,EAYKG,OAAO,IAAI,IAAX,IAAmBD,UAAU,IAAI,IAAjC,gBACGE,KAAC,CAAAC,aAAD,CAACW,MAAD,EAAQ;AAAAC,IAAAA,KAAK,EAAC,SAAA;AAAN,GAAR,eACIb,KAAC,CAAAC,aAAD,CAACkB,MAAD;AACIC,IAAAA,OAAO,EAAC;AACRC,IAAAA,IAAI,EAAC;AACLC,IAAAA,OAAO,EAAEvB;AAAO,IAAA,YAAA,EACJD;IACZiB,IAAI,eAAEf,mBAAA,CAACuB,SAAD,EAAU,IAAV;AACNC,IAAAA,KAAK,EAAE;AACH;MACA,2BAA6B,EAAA,aAAA;AAF1B,KAAA;GANX,CADJ,CADH,GAcG,IA1BR,CAPJ,CADJ,CAAA;AAsCH;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
var modules_6205a58e = {"container":"_51a84fb3","tone-info":"_5649104a","icon":"_79fa06e2","tone-positive":"c67632e4","tone-caution":"_654ff216","tone-critical":"b1ee4ff1"};
|
|
2
2
|
|
|
3
|
-
export default
|
|
3
|
+
export { modules_6205a58e as default };
|
|
4
4
|
//# sourceMappingURL=alert.module.css.js.map
|
package/es/avatar/avatar.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { getInitials, emailToIndex } from './utils.js';
|
|
3
4
|
import { getClassNames } from '../utils/responsive-props.js';
|
|
5
|
+
import modules_08f3eeac from './avatar.module.css.js';
|
|
4
6
|
import { Box } from '../box/box.js';
|
|
5
|
-
import { getInitials, emailToIndex } from './utils.js';
|
|
6
|
-
import styles from './avatar.module.css.js';
|
|
7
7
|
|
|
8
8
|
const _excluded = ["user", "avatarUrl", "size", "className", "colorList", "exceptionallySetClassName"];
|
|
9
9
|
const AVATAR_COLORS = ['#fcc652', '#e9952c', '#e16b2d', '#d84b40', '#e8435a', '#e5198a', '#ad3889', '#86389c', '#a8a8a8', '#98be2f', '#5d9d50', '#5f9f85', '#5bbcb6', '#32a3bf', '#2bafeb', '#2d88c3', '#3863cc', '#5e5e5e'];
|
|
@@ -28,9 +28,9 @@ function Avatar(_ref) {
|
|
|
28
28
|
} : {
|
|
29
29
|
backgroundColor: colorList[emailToIndex(user.email, colorList.length)]
|
|
30
30
|
};
|
|
31
|
-
const sizeClassName = getClassNames(
|
|
32
|
-
return /*#__PURE__*/createElement(Box, _objectSpread2({
|
|
33
|
-
className: [className,
|
|
31
|
+
const sizeClassName = getClassNames(modules_08f3eeac, 'size', avatarSize);
|
|
32
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2({
|
|
33
|
+
className: [className, modules_08f3eeac.avatar, sizeClassName, exceptionallySetClassName],
|
|
34
34
|
style: style
|
|
35
35
|
}, props), userInitials);
|
|
36
36
|
}
|
package/es/avatar/avatar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","sources":["../../src/avatar/avatar.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { getInitials, emailToIndex } from './utils'\n\nimport { getClassNames, ResponsiveProp } from '../utils/responsive-props'\nimport styles from './avatar.module.css'\nimport { Box } from '../box'\nimport type { ObfuscatedClassName } from '../utils/common-types'\n\nconst AVATAR_COLORS = [\n '#fcc652',\n '#e9952c',\n '#e16b2d',\n '#d84b40',\n '#e8435a',\n '#e5198a',\n '#ad3889',\n '#86389c',\n '#a8a8a8',\n '#98be2f',\n '#5d9d50',\n '#5f9f85',\n '#5bbcb6',\n '#32a3bf',\n '#2bafeb',\n '#2d88c3',\n '#3863cc',\n '#5e5e5e',\n]\n\ntype AvatarSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl'\n\ntype Props = ObfuscatedClassName & {\n /** @deprecated Please use `exceptionallySetClassName` */\n className?: string\n /** @deprecated */\n colorList?: string[]\n size?: ResponsiveProp<AvatarSize>\n avatarUrl?: string\n user: { name?: string; email: string }\n}\n\nfunction Avatar({\n user,\n avatarUrl,\n size = 'l',\n className,\n colorList = AVATAR_COLORS,\n exceptionallySetClassName,\n ...props\n}: Props) {\n const userInitials = getInitials(user.name) || getInitials(user.email)\n const avatarSize = size ? size : 'l'\n\n const style = avatarUrl\n ? {\n backgroundImage: `url(${avatarUrl})`,\n textIndent: '-9999px', // hide the initials\n }\n : {\n backgroundColor: colorList[emailToIndex(user.email, colorList.length)],\n }\n\n const sizeClassName = getClassNames(styles, 'size', avatarSize)\n\n return (\n <Box\n className={[className, styles.avatar, sizeClassName, exceptionallySetClassName]}\n style={style}\n {...props}\n >\n {userInitials}\n </Box>\n )\n}\nAvatar.displayName = 'Avatar'\n\nexport { Avatar }\n"],"names":["AVATAR_COLORS","Avatar","user","avatarUrl","size","className","colorList","exceptionallySetClassName","props","userInitials","getInitials","name","email","avatarSize","style","backgroundImage","textIndent","backgroundColor","emailToIndex","length","sizeClassName","getClassNames","styles","React","Box","avatar","displayName"],"mappings":";;;;;;;;AASA,MAAMA,aAAa,GAAG,CAClB,SADkB,EAElB,SAFkB,EAGlB,SAHkB,EAIlB,SAJkB,EAKlB,SALkB,EAMlB,SANkB,EAOlB,SAPkB,EAQlB,SARkB,EASlB,SATkB,EAUlB,SAVkB,EAWlB,SAXkB,EAYlB,SAZkB,EAalB,SAbkB,EAclB,SAdkB,EAelB,SAfkB,EAgBlB,SAhBkB,EAiBlB,SAjBkB,EAkBlB,SAlBkB,CAAtB;;AAiCA,SAASC,MAAT;
|
|
1
|
+
{"version":3,"file":"avatar.js","sources":["../../src/avatar/avatar.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { getInitials, emailToIndex } from './utils'\n\nimport { getClassNames, ResponsiveProp } from '../utils/responsive-props'\nimport styles from './avatar.module.css'\nimport { Box } from '../box'\nimport type { ObfuscatedClassName } from '../utils/common-types'\n\nconst AVATAR_COLORS = [\n '#fcc652',\n '#e9952c',\n '#e16b2d',\n '#d84b40',\n '#e8435a',\n '#e5198a',\n '#ad3889',\n '#86389c',\n '#a8a8a8',\n '#98be2f',\n '#5d9d50',\n '#5f9f85',\n '#5bbcb6',\n '#32a3bf',\n '#2bafeb',\n '#2d88c3',\n '#3863cc',\n '#5e5e5e',\n]\n\ntype AvatarSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl'\n\ntype Props = ObfuscatedClassName & {\n /** @deprecated Please use `exceptionallySetClassName` */\n className?: string\n /** @deprecated */\n colorList?: string[]\n size?: ResponsiveProp<AvatarSize>\n avatarUrl?: string\n user: { name?: string; email: string }\n}\n\nfunction Avatar({\n user,\n avatarUrl,\n size = 'l',\n className,\n colorList = AVATAR_COLORS,\n exceptionallySetClassName,\n ...props\n}: Props) {\n const userInitials = getInitials(user.name) || getInitials(user.email)\n const avatarSize = size ? size : 'l'\n\n const style = avatarUrl\n ? {\n backgroundImage: `url(${avatarUrl})`,\n textIndent: '-9999px', // hide the initials\n }\n : {\n backgroundColor: colorList[emailToIndex(user.email, colorList.length)],\n }\n\n const sizeClassName = getClassNames(styles, 'size', avatarSize)\n\n return (\n <Box\n className={[className, styles.avatar, sizeClassName, exceptionallySetClassName]}\n style={style}\n {...props}\n >\n {userInitials}\n </Box>\n )\n}\nAvatar.displayName = 'Avatar'\n\nexport { Avatar }\n"],"names":["AVATAR_COLORS","Avatar","user","avatarUrl","size","className","colorList","exceptionallySetClassName","props","userInitials","getInitials","name","email","avatarSize","style","backgroundImage","textIndent","backgroundColor","emailToIndex","length","sizeClassName","getClassNames","styles","React","createElement","Box","_objectSpread","avatar","displayName"],"mappings":";;;;;;;;AASA,MAAMA,aAAa,GAAG,CAClB,SADkB,EAElB,SAFkB,EAGlB,SAHkB,EAIlB,SAJkB,EAKlB,SALkB,EAMlB,SANkB,EAOlB,SAPkB,EAQlB,SARkB,EASlB,SATkB,EAUlB,SAVkB,EAWlB,SAXkB,EAYlB,SAZkB,EAalB,SAbkB,EAclB,SAdkB,EAelB,SAfkB,EAgBlB,SAhBkB,EAiBlB,SAjBkB,EAkBlB,SAlBkB,CAAtB,CAAA;;AAiCA,SAASC,MAAT,CAQQ,IAAA,EAAA;EAAA,IARQ;IACZC,IADY;IAEZC,SAFY;AAGZC,IAAAA,IAAI,GAAG,GAHK;IAIZC,SAJY;AAKZC,IAAAA,SAAS,GAAGN,aALA;AAMZO,IAAAA,yBAAAA;GAEI,GAAA,IAAA;AAAA,MADDC,KACC,GAAA,wBAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AACJ,EAAA,MAAMC,YAAY,GAAGC,WAAW,CAACR,IAAI,CAACS,IAAN,CAAX,IAA0BD,WAAW,CAACR,IAAI,CAACU,KAAN,CAA1D,CAAA;AACA,EAAA,MAAMC,UAAU,GAAGT,IAAI,GAAGA,IAAH,GAAU,GAAjC,CAAA;EAEA,MAAMU,KAAK,GAAGX,SAAS,GACjB;IACIY,eAAe,EAAA,MAAA,GAASZ,SAAT,GADnB,GAAA;IAEIa,UAAU,EAAE,SAFhB;;AAAA,GADiB,GAKjB;AACIC,IAAAA,eAAe,EAAEX,SAAS,CAACY,YAAY,CAAChB,IAAI,CAACU,KAAN,EAAaN,SAAS,CAACa,MAAvB,CAAb,CAAA;GANpC,CAAA;EASA,MAAMC,aAAa,GAAGC,aAAa,CAACC,gBAAD,EAAS,MAAT,EAAiBT,UAAjB,CAAnC,CAAA;AAEA,EAAA,oBACIU,KAAC,CAAAC,aAAD,CAACC,GAAD,EAAAC,cAAA,CAAA;IACIrB,SAAS,EAAE,CAACA,SAAD,EAAYiB,gBAAM,CAACK,MAAnB,EAA2BP,aAA3B,EAA0Cb,yBAA1C,CADf;AAEIO,IAAAA,KAAK,EAAEA,KAAAA;GACHN,EAAAA,KAHR,CAKKC,EAAAA,YALL,CADJ,CAAA;AASH,CAAA;;AACDR,MAAM,CAAC2B,WAAP,GAAqB,QAArB;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
var modules_08f3eeac = {"avatar":"_38a1be89","size-xxs":"d32e92ae","size-xs":"_0667d719","size-s":"cf529fcf","size-m":"_6e268eab","size-l":"d64c62cf","size-xl":"_44fb77de","size-xxl":"_01f85e0e","size-xxxl":"_41a5fe19","tablet-size-xxs":"_6ab1577d","tablet-size-xs":"b52a4963","tablet-size-s":"_714a8419","tablet-size-m":"_81cd4d51","tablet-size-l":"bf0a4edb","tablet-size-xl":"e4f0dabd","tablet-size-xxl":"_67ea065d","tablet-size-xxxl":"_2af7f76f","desktop-size-xxs":"_759081dc","desktop-size-xs":"_8290d1c1","desktop-size-s":"_48ea172d","desktop-size-m":"_758f6641","desktop-size-l":"f9ada088","desktop-size-xl":"d3bb7470","desktop-size-xxl":"_9a312ee3","desktop-size-xxxl":"a1d30c23"};
|
|
2
2
|
|
|
3
|
-
export default
|
|
3
|
+
export { modules_08f3eeac as default };
|
|
4
4
|
//# sourceMappingURL=avatar.module.css.js.map
|
package/es/avatar/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/avatar/utils.ts"],"sourcesContent":["function getInitials(name?: string) {\n if (!name) {\n return ''\n }\n\n const seed = name.trim().split(' ')\n const firstInitial = seed[0]\n const lastInitial = seed[seed.length - 1]\n\n let initials = firstInitial?.[0]\n if (\n firstInitial != null &&\n lastInitial != null &&\n initials != null &&\n // Better readable this way.\n // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with\n firstInitial[0] !== lastInitial[0]\n ) {\n initials += lastInitial[0]\n }\n return initials?.toUpperCase()\n}\n\nfunction emailToIndex(email: string, maxIndex: number) {\n const seed = email.split('@')[0]\n const hash = seed ? seed.charCodeAt(0) + seed.charCodeAt(seed.length - 1) || 0 : 0\n return hash % maxIndex\n}\n\nexport { getInitials, emailToIndex }\n"],"names":["getInitials","name","seed","trim","split","firstInitial","lastInitial","length","initials","toUpperCase","emailToIndex","email","maxIndex","hash","charCodeAt"],"mappings":"AAAA,SAASA,WAAT,CAAqBC,IAArB
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/avatar/utils.ts"],"sourcesContent":["function getInitials(name?: string) {\n if (!name) {\n return ''\n }\n\n const seed = name.trim().split(' ')\n const firstInitial = seed[0]\n const lastInitial = seed[seed.length - 1]\n\n let initials = firstInitial?.[0]\n if (\n firstInitial != null &&\n lastInitial != null &&\n initials != null &&\n // Better readable this way.\n // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with\n firstInitial[0] !== lastInitial[0]\n ) {\n initials += lastInitial[0]\n }\n return initials?.toUpperCase()\n}\n\nfunction emailToIndex(email: string, maxIndex: number) {\n const seed = email.split('@')[0]\n const hash = seed ? seed.charCodeAt(0) + seed.charCodeAt(seed.length - 1) || 0 : 0\n return hash % maxIndex\n}\n\nexport { getInitials, emailToIndex }\n"],"names":["getInitials","name","seed","trim","split","firstInitial","lastInitial","length","initials","toUpperCase","emailToIndex","email","maxIndex","hash","charCodeAt"],"mappings":"AAAA,SAASA,WAAT,CAAqBC,IAArB,EAAkC;AAAA,EAAA,IAAA,SAAA,CAAA;;EAC9B,IAAI,CAACA,IAAL,EAAW;AACP,IAAA,OAAO,EAAP,CAAA;AACH,GAAA;;EAED,MAAMC,IAAI,GAAGD,IAAI,CAACE,IAAL,EAAYC,CAAAA,KAAZ,CAAkB,GAAlB,CAAb,CAAA;AACA,EAAA,MAAMC,YAAY,GAAGH,IAAI,CAAC,CAAD,CAAzB,CAAA;EACA,MAAMI,WAAW,GAAGJ,IAAI,CAACA,IAAI,CAACK,MAAL,GAAc,CAAf,CAAxB,CAAA;AAEA,EAAA,IAAIC,QAAQ,GAAGH,YAAH,oBAAGA,YAAY,CAAG,CAAH,CAA3B,CAAA;;EACA,IACIA,YAAY,IAAI,IAAhB,IACAC,WAAW,IAAI,IADf,IAEAE,QAAQ,IAAI,IAFZ;AAIA;EACAH,YAAY,CAAC,CAAD,CAAZ,KAAoBC,WAAW,CAAC,CAAD,CANnC,EAOE;AACEE,IAAAA,QAAQ,IAAIF,WAAW,CAAC,CAAD,CAAvB,CAAA;AACH,GAAA;;AACD,EAAA,OAAA,CAAA,SAAA,GAAOE,QAAP,KAAA,IAAA,GAAA,KAAA,CAAA,GAAO,SAAUC,CAAAA,WAAV,EAAP,CAAA;AACH,CAAA;;AAED,SAASC,YAAT,CAAsBC,KAAtB,EAAqCC,QAArC,EAAqD;EACjD,MAAMV,IAAI,GAAGS,KAAK,CAACP,KAAN,CAAY,GAAZ,CAAiB,CAAA,CAAjB,CAAb,CAAA;EACA,MAAMS,IAAI,GAAGX,IAAI,GAAGA,IAAI,CAACY,UAAL,CAAgB,CAAhB,CAAqBZ,GAAAA,IAAI,CAACY,UAAL,CAAgBZ,IAAI,CAACK,MAAL,GAAc,CAA9B,CAArB,IAAyD,CAA5D,GAAgE,CAAjF,CAAA;EACA,OAAOM,IAAI,GAAGD,QAAd,CAAA;AACH;;;;"}
|
package/es/badge/badge.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { Box } from '../box/box.js';
|
|
4
|
-
import
|
|
4
|
+
import modules_33c7c985 from './badge.module.css.js';
|
|
5
5
|
|
|
6
6
|
const _excluded = ["tone", "label"];
|
|
7
7
|
|
|
@@ -12,11 +12,11 @@ function Badge(_ref) {
|
|
|
12
12
|
} = _ref,
|
|
13
13
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
14
|
|
|
15
|
-
return /*#__PURE__*/createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
15
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
16
16
|
as: "span" // It enables putting the badge inside a button (https://stackoverflow.com/a/12982334)
|
|
17
17
|
,
|
|
18
18
|
display: "inline",
|
|
19
|
-
className: [
|
|
19
|
+
className: [modules_33c7c985.badge, modules_33c7c985["badge-" + tone]]
|
|
20
20
|
}), label);
|
|
21
21
|
}
|
|
22
22
|
|
package/es/badge/badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","sources":["../../src/badge/badge.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Box } from '../box'\n\nimport styles from './badge.module.css'\n\ntype BadgeTone = 'info' | 'positive' | 'promote' | 'attention' | 'warning'\n\ntype BadgeProps = {\n /**\n * The label to show inside the badge element.\n */\n label: string\n /**\n * The tone of the badge.\n */\n tone: BadgeTone\n}\n\nfunction Badge({ tone, label, ...props }: BadgeProps) {\n return (\n <Box\n {...props}\n as=\"span\" // It enables putting the badge inside a button (https://stackoverflow.com/a/12982334)\n display=\"inline\"\n className={[styles.badge, styles[`badge-${tone}`]]}\n >\n {label}\n </Box>\n )\n}\n\nexport { Badge }\nexport type { BadgeProps }\n"],"names":["Badge","tone","label","props","React","Box","as","display","className","styles","badge"],"mappings":";;;;;;;AAmBA,SAASA,KAAT;
|
|
1
|
+
{"version":3,"file":"badge.js","sources":["../../src/badge/badge.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Box } from '../box'\n\nimport styles from './badge.module.css'\n\ntype BadgeTone = 'info' | 'positive' | 'promote' | 'attention' | 'warning'\n\ntype BadgeProps = {\n /**\n * The label to show inside the badge element.\n */\n label: string\n /**\n * The tone of the badge.\n */\n tone: BadgeTone\n}\n\nfunction Badge({ tone, label, ...props }: BadgeProps) {\n return (\n <Box\n {...props}\n as=\"span\" // It enables putting the badge inside a button (https://stackoverflow.com/a/12982334)\n display=\"inline\"\n className={[styles.badge, styles[`badge-${tone}`]]}\n >\n {label}\n </Box>\n )\n}\n\nexport { Badge }\nexport type { BadgeProps }\n"],"names":["Badge","tone","label","props","React","createElement","Box","as","display","className","styles","badge"],"mappings":";;;;;;;AAmBA,SAASA,KAAT,CAAoD,IAAA,EAAA;EAAA,IAArC;IAAEC,IAAF;AAAQC,IAAAA,KAAAA;GAA6B,GAAA,IAAA;AAAA,MAAnBC,KAAmB,GAAA,wBAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AAChD,EAAA,oBACIC,KAAC,CAAAC,aAAD,CAACC,GAAD,oCACQH,KADR,CAAA,EAAA,EAAA,EAAA;IAEII,EAAE,EAAC,MAFP;AAAA;AAGIC,IAAAA,OAAO,EAAC,QAHZ;IAIIC,SAAS,EAAE,CAACC,gBAAM,CAACC,KAAR,EAAeD,gBAAM,CAAUT,QAAAA,GAAAA,IAAV,CAArB,CAAA;AAJf,GAAA,CAAA,EAMKC,KANL,CADJ,CAAA;AAUH;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
var modules_33c7c985 = {"badge":"c6ba5977","badge-info":"cf731337","badge-positive":"_7cfc5738","badge-promote":"_63691069","badge-attention":"_28ffb572","badge-warning":"_89e77f92"};
|
|
2
2
|
|
|
3
|
-
export default
|
|
3
|
+
export { modules_33c7c985 as default };
|
|
4
4
|
//# sourceMappingURL=badge.module.css.js.map
|
package/es/banner/banner.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { Box } from '../box/box.js';
|
|
4
4
|
import { Columns, Column } from '../columns/columns.js';
|
|
5
5
|
import { useId } from '../utils/common-helpers.js';
|
|
6
|
-
import
|
|
6
|
+
import modules_afa80466 from './banner.module.css.js';
|
|
7
7
|
|
|
8
8
|
const _excluded = ["id", "tone", "icon", "title", "description", "action"];
|
|
9
|
-
const Banner = /*#__PURE__*/forwardRef(function Banner(_ref, ref) {
|
|
9
|
+
const Banner = /*#__PURE__*/React.forwardRef(function Banner(_ref, ref) {
|
|
10
10
|
let {
|
|
11
11
|
id,
|
|
12
12
|
tone,
|
|
@@ -19,7 +19,7 @@ const Banner = /*#__PURE__*/forwardRef(function Banner(_ref, ref) {
|
|
|
19
19
|
|
|
20
20
|
const titleId = useId();
|
|
21
21
|
const descriptionId = useId();
|
|
22
|
-
return /*#__PURE__*/createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
22
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
23
23
|
ref: ref,
|
|
24
24
|
id: id,
|
|
25
25
|
role: "status",
|
|
@@ -28,31 +28,31 @@ const Banner = /*#__PURE__*/forwardRef(function Banner(_ref, ref) {
|
|
|
28
28
|
"aria-live": "polite",
|
|
29
29
|
tabIndex: 0,
|
|
30
30
|
borderRadius: "standard",
|
|
31
|
-
className: [
|
|
32
|
-
}), /*#__PURE__*/createElement(Columns, {
|
|
31
|
+
className: [modules_afa80466.banner, modules_afa80466["banner-" + tone]]
|
|
32
|
+
}), /*#__PURE__*/React.createElement(Columns, {
|
|
33
33
|
space: "medium",
|
|
34
34
|
alignY: "center"
|
|
35
|
-
}, /*#__PURE__*/createElement(Column, {
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Column, {
|
|
36
36
|
width: "content",
|
|
37
37
|
"aria-hidden": true,
|
|
38
38
|
style: {
|
|
39
39
|
/* Make sure the icon is centered vertically */
|
|
40
40
|
lineHeight: 0
|
|
41
41
|
}
|
|
42
|
-
}, icon), /*#__PURE__*/createElement(Column, null, /*#__PURE__*/createElement(Box, {
|
|
42
|
+
}, icon), /*#__PURE__*/React.createElement(Column, null, /*#__PURE__*/React.createElement(Box, {
|
|
43
43
|
paddingY: "xsmall"
|
|
44
|
-
}, description ? /*#__PURE__*/createElement(Box, {
|
|
44
|
+
}, description ? /*#__PURE__*/React.createElement(Box, {
|
|
45
45
|
id: titleId,
|
|
46
|
-
className: [
|
|
47
|
-
}, title) : /*#__PURE__*/createElement(Box, {
|
|
46
|
+
className: [modules_afa80466.title, modules_afa80466["title-" + tone]]
|
|
47
|
+
}, title) : /*#__PURE__*/React.createElement(Box, {
|
|
48
48
|
id: titleId,
|
|
49
|
-
className: [
|
|
49
|
+
className: [modules_afa80466.title, // If the banner does not have a description, we need to slightly tweak
|
|
50
50
|
// the styling of the title applying an extra css class
|
|
51
|
-
|
|
52
|
-
}, title), description ? /*#__PURE__*/createElement(Box, {
|
|
51
|
+
modules_afa80466["title-without-description"], modules_afa80466["title-" + tone]]
|
|
52
|
+
}, title), description ? /*#__PURE__*/React.createElement(Box, {
|
|
53
53
|
id: descriptionId,
|
|
54
|
-
className: [
|
|
55
|
-
}, description) : null)), action ? /*#__PURE__*/createElement(Column, {
|
|
54
|
+
className: [modules_afa80466.description, modules_afa80466["description-" + tone]]
|
|
55
|
+
}, description) : null)), action ? /*#__PURE__*/React.createElement(Column, {
|
|
56
56
|
width: "content"
|
|
57
57
|
}, action) : null));
|
|
58
58
|
});
|
package/es/banner/banner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.js","sources":["../../src/banner/banner.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box } from '../box'\nimport { Columns, Column } from '../columns'\nimport { useId } from '../utils/common-helpers'\n\nimport styles from './banner.module.css'\n\nexport type BannerTone = 'info' | 'promotion'\n\ntype BannerProps = {\n id?: string\n\n /**\n * The tone of the Banner. Affects the background color and the outline.\n */\n tone: BannerTone\n\n /**\n * The icon that should be added inside the Banner.\n */\n icon: React.ReactElement | string | number\n\n /**\n * The title to be displayed at the top of the Banner.\n */\n title: React.ReactNode\n\n /**\n * An optional description to be displayed inside the Banner.\n */\n description?: React.ReactNode\n\n /**\n * An optional action to displayed inside the Banner.\n */\n action?: React.ReactElement | string | number\n}\n\nconst Banner = React.forwardRef<HTMLDivElement, BannerProps>(function Banner(\n { id, tone, icon, title, description, action, ...props }: BannerProps,\n ref,\n) {\n const titleId = useId()\n const descriptionId = useId()\n return (\n <Box\n {...props}\n ref={ref}\n id={id}\n role=\"status\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n aria-live=\"polite\"\n tabIndex={0}\n borderRadius=\"standard\"\n className={[styles.banner, styles[`banner-${tone}`]]}\n >\n <Columns space=\"medium\" alignY=\"center\">\n <Column\n width=\"content\"\n aria-hidden\n style={{\n /* Make sure the icon is centered vertically */\n lineHeight: 0,\n }}\n >\n {icon}\n </Column>\n <Column>\n <Box paddingY=\"xsmall\">\n {description ? (\n <Box id={titleId} className={[styles.title, styles[`title-${tone}`]]}>\n {title}\n </Box>\n ) : (\n <Box\n id={titleId}\n className={[\n styles.title,\n // If the banner does not have a description, we need to slightly tweak\n // the styling of the title applying an extra css class\n styles[`title-without-description`],\n styles[`title-${tone}`],\n ]}\n >\n {title}\n </Box>\n )}\n {description ? (\n <Box\n id={descriptionId}\n className={[styles.description, styles[`description-${tone}`]]}\n >\n {description}\n </Box>\n ) : null}\n </Box>\n </Column>\n {action ? <Column width=\"content\">{action}</Column> : null}\n </Columns>\n </Box>\n )\n})\n\nexport { Banner }\nexport type { BannerProps }\n"],"names":["Banner","React","ref","id","tone","icon","title","description","action","props","titleId","useId","descriptionId","Box","role","tabIndex","borderRadius","className","styles","banner","Columns","space","alignY","Column","width","style","lineHeight","paddingY"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"banner.js","sources":["../../src/banner/banner.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box } from '../box'\nimport { Columns, Column } from '../columns'\nimport { useId } from '../utils/common-helpers'\n\nimport styles from './banner.module.css'\n\nexport type BannerTone = 'info' | 'promotion'\n\ntype BannerProps = {\n id?: string\n\n /**\n * The tone of the Banner. Affects the background color and the outline.\n */\n tone: BannerTone\n\n /**\n * The icon that should be added inside the Banner.\n */\n icon: React.ReactElement | string | number\n\n /**\n * The title to be displayed at the top of the Banner.\n */\n title: React.ReactNode\n\n /**\n * An optional description to be displayed inside the Banner.\n */\n description?: React.ReactNode\n\n /**\n * An optional action to displayed inside the Banner.\n */\n action?: React.ReactElement | string | number\n}\n\nconst Banner = React.forwardRef<HTMLDivElement, BannerProps>(function Banner(\n { id, tone, icon, title, description, action, ...props }: BannerProps,\n ref,\n) {\n const titleId = useId()\n const descriptionId = useId()\n return (\n <Box\n {...props}\n ref={ref}\n id={id}\n role=\"status\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n aria-live=\"polite\"\n tabIndex={0}\n borderRadius=\"standard\"\n className={[styles.banner, styles[`banner-${tone}`]]}\n >\n <Columns space=\"medium\" alignY=\"center\">\n <Column\n width=\"content\"\n aria-hidden\n style={{\n /* Make sure the icon is centered vertically */\n lineHeight: 0,\n }}\n >\n {icon}\n </Column>\n <Column>\n <Box paddingY=\"xsmall\">\n {description ? (\n <Box id={titleId} className={[styles.title, styles[`title-${tone}`]]}>\n {title}\n </Box>\n ) : (\n <Box\n id={titleId}\n className={[\n styles.title,\n // If the banner does not have a description, we need to slightly tweak\n // the styling of the title applying an extra css class\n styles[`title-without-description`],\n styles[`title-${tone}`],\n ]}\n >\n {title}\n </Box>\n )}\n {description ? (\n <Box\n id={descriptionId}\n className={[styles.description, styles[`description-${tone}`]]}\n >\n {description}\n </Box>\n ) : null}\n </Box>\n </Column>\n {action ? <Column width=\"content\">{action}</Column> : null}\n </Columns>\n </Box>\n )\n})\n\nexport { Banner }\nexport type { BannerProps }\n"],"names":["Banner","React","forwardRef","ref","id","tone","icon","title","description","action","props","titleId","useId","descriptionId","Box","role","tabIndex","borderRadius","className","styles","banner","createElement","Columns","space","alignY","Column","width","style","lineH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KAAA,CAAAoB,aAAA,CAACP,GAAD,EAAI;AAACe,IAAAA,QAAQ,EAAC,QAAA;GAAd,EACKrB,WAAW,gBACRP,KAAC,CAAAoB,aAAD,CAACP,GAAD;AAAKV,IAAAA,EAAE,EAAEO;IAASO,SAAS,EAAE,CAACC,gBAAM,CAACZ,KAAR,EAAeY,gBAAM,CAAUd,QAAAA,GAAAA,IAAV,CAArB,CAAA;GAA7B,EACKE,KADL,CADQ,gBAKRN,KAAA,CAAAoB,aAAA,CAACP,GAAD,EACI;AAAAV,IAAAA,EAAE,EAAEO,OAAJ;AACAO,IAAAA,SAAS,EAAE,CACPC,gBAAM,CAACZ,KADA;AAGP;AACAY,IAAAA,gBAAM,CAJC,2BAAA,CAAA,EAKPA,gBAAM,CAAA,QAAA,GAAUd,IAAV,CALC,CAAA;GAFf,EAUKE,KAVL,CANR,EAmBKC,WAAW,gBACRP,mBAAA,CAACa,GAAD,EAAI;AACAV,IAAAA,EAAE,EAAES,aADJ;IAEAK,SAAS,EAAE,CAACC,gBAAM,CAACX,WAAR,EAAqBW,gBAAM,CAAgBd,cAAAA,GAAAA,IAAhB,CAA3B,CAAA;AAFX,GAAJ,EAIKG,WAJL,CADQ,GAOR,IA1BR,CADJ,CAXJ,EAyCKC,MAAM,gBAAGR,mBAAA,CAACwB,MAAD,EAAO;AAACC,IAAAA,KAAK,EAAC,SAAA;AAAP,GAAP,EAAyBjB,MAAzB,CAAH,GAA+C,IAzC1D,CAZJ,CADJ,CAAA;AA0DH,CAhEc;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
var modules_afa80466 = {"banner":"c1dffd60","banner-info":"_9d552538","banner-promotion":"d797752e","title":"_8cd610da","title-without-description":"_78ea5373","title-info":"_319c73fa","title-promotion":"fc84253f","description":"af4bd758","description-info":"b95a8c07","description-promotion":"_3c33f615"};
|
|
2
2
|
|
|
3
|
-
export default
|
|
3
|
+
export { modules_afa80466 as default };
|
|
4
4
|
//# sourceMappingURL=banner.module.css.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { Box } from '../box/box.js';
|
|
4
|
-
import { Stack } from '../stack/stack.js';
|
|
5
|
-
import { Spinner } from '../spinner/spinner.js';
|
|
6
4
|
import { useId } from '../utils/common-helpers.js';
|
|
7
5
|
import { Text } from '../text/text.js';
|
|
8
|
-
import
|
|
6
|
+
import modules_540a88ff from './base-field.module.css.js';
|
|
7
|
+
import { Stack } from '../stack/stack.js';
|
|
8
|
+
import { Spinner } from '../spinner/spinner.js';
|
|
9
9
|
|
|
10
10
|
function FieldHint(props) {
|
|
11
|
-
return /*#__PURE__*/createElement(Text, _objectSpread2({
|
|
11
|
+
return /*#__PURE__*/React.createElement(Text, _objectSpread2({
|
|
12
12
|
as: "p",
|
|
13
13
|
tone: "secondary",
|
|
14
14
|
size: "copy"
|
|
@@ -16,13 +16,13 @@ function FieldHint(props) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function MessageIcon(props) {
|
|
19
|
-
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
19
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
20
20
|
width: "16",
|
|
21
21
|
height: "16",
|
|
22
22
|
viewBox: "0 0 16 16",
|
|
23
23
|
fill: "none",
|
|
24
24
|
xmlns: "http://www.w3.org/2000/svg"
|
|
25
|
-
}, props), /*#__PURE__*/createElement("path", {
|
|
25
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
26
26
|
fillRule: "evenodd",
|
|
27
27
|
clipRule: "evenodd",
|
|
28
28
|
d: "M8 2.5C4.96243 2.5 2.5 4.96243 2.5 8C2.5 11.0376 4.96243 13.5 8 13.5C11.0376 13.5 13.5 11.0376 13.5 8C13.5 4.96243 11.0376 2.5 8 2.5ZM1.5 8C1.5 4.41015 4.41015 1.5 8 1.5C11.5899 1.5 14.5 4.41015 14.5 8C14.5 11.5899 11.5899 14.5 8 14.5C4.41015 14.5 1.5 11.5899 1.5 8ZM8.66667 10.3333C8.66667 10.7015 8.36819 11 8 11C7.63181 11 7.33333 10.7015 7.33333 10.3333C7.33333 9.96514 7.63181 9.66667 8 9.66667C8.36819 9.66667 8.66667 9.96514 8.66667 10.3333ZM8.65766 5.65766C8.65766 5.29445 8.36322 5 8 5C7.99087 5.00008 7.98631 5.00013 7.98175 5.00025C7.97719 5.00038 7.97263 5.00059 7.96352 5.00101C7.60086 5.02116 7.3232 5.33149 7.34335 5.69415L7.50077 8.52774C7.53575 9.15742 8.46425 9.15742 8.49923 8.52774L8.65665 5.69415C8.65707 5.68503 8.65728 5.68047 8.65741 5.67591C8.65754 5.67135 8.65758 5.66679 8.65766 5.65766Z",
|
|
@@ -36,19 +36,19 @@ function FieldMessage({
|
|
|
36
36
|
tone
|
|
37
37
|
}) {
|
|
38
38
|
const textTone = tone === 'error' ? 'danger' : tone === 'success' ? 'positive' : 'normal';
|
|
39
|
-
return /*#__PURE__*/createElement(Text, {
|
|
39
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
40
40
|
as: "p",
|
|
41
41
|
tone: textTone,
|
|
42
42
|
size: "copy",
|
|
43
43
|
id: id
|
|
44
|
-
}, /*#__PURE__*/createElement(Box, {
|
|
44
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
45
45
|
as: "span",
|
|
46
46
|
marginRight: "xsmall",
|
|
47
47
|
display: "inlineFlex",
|
|
48
|
-
className:
|
|
49
|
-
}, tone === 'loading' ? /*#__PURE__*/createElement(Spinner, {
|
|
48
|
+
className: modules_540a88ff.messageIcon
|
|
49
|
+
}, tone === 'loading' ? /*#__PURE__*/React.createElement(Spinner, {
|
|
50
50
|
size: 16
|
|
51
|
-
}) : /*#__PURE__*/createElement(MessageIcon, {
|
|
51
|
+
}) : /*#__PURE__*/React.createElement(MessageIcon, {
|
|
52
52
|
"aria-hidden": true
|
|
53
53
|
})), children);
|
|
54
54
|
}
|
|
@@ -77,32 +77,32 @@ function BaseField({
|
|
|
77
77
|
'aria-describedby': ariaDescribedBy,
|
|
78
78
|
'aria-invalid': tone === 'error' ? true : undefined
|
|
79
79
|
};
|
|
80
|
-
return /*#__PURE__*/createElement(Stack, {
|
|
80
|
+
return /*#__PURE__*/React.createElement(Stack, {
|
|
81
81
|
space: "small",
|
|
82
82
|
hidden: hidden
|
|
83
|
-
}, /*#__PURE__*/createElement(Box, {
|
|
84
|
-
className: [className,
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
84
|
+
className: [className, modules_540a88ff.container, tone === 'error' ? modules_540a88ff.error : null, variant === 'bordered' ? modules_540a88ff.bordered : null],
|
|
85
85
|
maxWidth: maxWidth
|
|
86
|
-
}, label || secondaryLabel || auxiliaryLabel ? /*#__PURE__*/createElement(Box, {
|
|
86
|
+
}, label || secondaryLabel || auxiliaryLabel ? /*#__PURE__*/React.createElement(Box, {
|
|
87
87
|
as: "span",
|
|
88
88
|
display: "flex",
|
|
89
89
|
justifyContent: "spaceBetween",
|
|
90
90
|
alignItems: "flexEnd"
|
|
91
|
-
}, /*#__PURE__*/createElement(Text, {
|
|
91
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
92
92
|
size: variant === 'bordered' ? 'caption' : 'body',
|
|
93
93
|
as: "label",
|
|
94
94
|
htmlFor: id
|
|
95
|
-
}, label ? /*#__PURE__*/createElement("span", {
|
|
96
|
-
className:
|
|
97
|
-
}, label) : null, secondaryLabel ? /*#__PURE__*/createElement("span", {
|
|
98
|
-
className:
|
|
99
|
-
}, "\u00A0(", secondaryLabel, ")") : null), auxiliaryLabel ? /*#__PURE__*/createElement(Box, {
|
|
100
|
-
className:
|
|
95
|
+
}, label ? /*#__PURE__*/React.createElement("span", {
|
|
96
|
+
className: modules_540a88ff.primaryLabel
|
|
97
|
+
}, label) : null, secondaryLabel ? /*#__PURE__*/React.createElement("span", {
|
|
98
|
+
className: modules_540a88ff.secondaryLabel
|
|
99
|
+
}, "\u00A0(", secondaryLabel, ")") : null), auxiliaryLabel ? /*#__PURE__*/React.createElement(Box, {
|
|
100
|
+
className: modules_540a88ff.auxiliaryLabel,
|
|
101
101
|
paddingLeft: "small"
|
|
102
|
-
}, auxiliaryLabel) : null) : null, children(childrenProps)), message ? /*#__PURE__*/createElement(FieldMessage, {
|
|
102
|
+
}, auxiliaryLabel) : null) : null, children(childrenProps)), message ? /*#__PURE__*/React.createElement(FieldMessage, {
|
|
103
103
|
id: messageId,
|
|
104
104
|
tone: tone
|
|
105
|
-
}, message) : null, hint ? /*#__PURE__*/createElement(FieldHint, {
|
|
105
|
+
}, message) : null, hint ? /*#__PURE__*/React.createElement(FieldHint, {
|
|
106
106
|
id: hintId
|
|
107
107
|
}, hint) : null);
|
|
108
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-field.js","sources":["../../src/base-field/base-field.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box, BoxProps } from '../box'\nimport { useId } from '../utils/common-helpers'\nimport { Text } from '../text'\nimport styles from './base-field.module.css'\nimport { Stack } from '../stack'\n\nimport type { WithEnhancedClassName } from '../utils/common-types'\nimport { Spinner } from '../spinner'\n\ntype FieldHintProps = {\n id: string\n children: React.ReactNode\n}\n\nfunction FieldHint(props: FieldHintProps) {\n return <Text as=\"p\" tone=\"secondary\" size=\"copy\" {...props} />\n}\n\nfunction MessageIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M8 2.5C4.96243 2.5 2.5 4.96243 2.5 8C2.5 11.0376 4.96243 13.5 8 13.5C11.0376 13.5 13.5 11.0376 13.5 8C13.5 4.96243 11.0376 2.5 8 2.5ZM1.5 8C1.5 4.41015 4.41015 1.5 8 1.5C11.5899 1.5 14.5 4.41015 14.5 8C14.5 11.5899 11.5899 14.5 8 14.5C4.41015 14.5 1.5 11.5899 1.5 8ZM8.66667 10.3333C8.66667 10.7015 8.36819 11 8 11C7.63181 11 7.33333 10.7015 7.33333 10.3333C7.33333 9.96514 7.63181 9.66667 8 9.66667C8.36819 9.66667 8.66667 9.96514 8.66667 10.3333ZM8.65766 5.65766C8.65766 5.29445 8.36322 5 8 5C7.99087 5.00008 7.98631 5.00013 7.98175 5.00025C7.97719 5.00038 7.97263 5.00059 7.96352 5.00101C7.60086 5.02116 7.3232 5.33149 7.34335 5.69415L7.50077 8.52774C7.53575 9.15742 8.46425 9.15742 8.49923 8.52774L8.65665 5.69415C8.65707 5.68503 8.65728 5.68047 8.65741 5.67591C8.65754 5.67135 8.65758 5.66679 8.65766 5.65766Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\ntype FieldTone = 'neutral' | 'success' | 'error' | 'loading'\n\ntype FieldMessageProps = FieldHintProps & {\n tone: FieldTone\n}\n\nfunction FieldMessage({ id, children, tone }: FieldMessageProps) {\n const textTone = tone === 'error' ? 'danger' : tone === 'success' ? 'positive' : 'normal'\n return (\n <Text as=\"p\" tone={textTone} size=\"copy\" id={id}>\n <Box as=\"span\" marginRight=\"xsmall\" display=\"inlineFlex\" className={styles.messageIcon}>\n {tone === 'loading' ? <Spinner size={16} /> : <MessageIcon aria-hidden />}\n </Box>\n {children}\n </Text>\n )\n}\n\n//\n// BaseField\n//\n\ntype ChildrenRenderProps = {\n id: string\n 'aria-describedby'?: string\n 'aria-invalid'?: true\n}\n\ntype HtmlInputProps<T extends HTMLElement> = React.DetailedHTMLProps<\n React.InputHTMLAttributes<T>,\n T\n>\n\ntype BaseFieldVariant = 'default' | 'bordered'\ntype BaseFieldVariantProps = {\n /**\n * Provides alternative visual layouts or modes that the field can be rendered in.\n *\n * Namely, there are two variants supported:\n *\n * - the default one\n * - a \"bordered\" variant, where the border of the field surrounds also the labels, instead\n * of just surrounding the actual field element\n *\n * In both cases, the message and description texts for the field lie outside the bordered\n * area.\n */\n variant?: BaseFieldVariant\n}\n\ntype BaseFieldProps = WithEnhancedClassName &\n Pick<HtmlInputProps<HTMLInputElement>, 'id' | 'hidden' | 'aria-describedby'> & {\n /**\n * The main label for this field element.\n *\n * This prop is not optional. Consumers of field components must be explicit about not\n * wanting a label by passing `label=\"\"` or `label={null}`. In those situations, consumers\n * should make sure that fields are properly labelled semantically by other means (e.g using\n * `aria-labelledby`, or rendering a `<label />` element referencing the field by id).\n *\n * Avoid providing interactive elements in the label. Prefer `auxiliaryLabel` for that.\n *\n * @see BaseFieldProps['secondaryLabel']\n * @see BaseFieldProps['auxiliaryLabel']\n */\n label: React.ReactNode\n\n /**\n * An optional secondary label for this field element. It is combined with the `label` to\n * form the field's entire accessible name (unless the field label is overriden by using\n * `aria-label` or `aria-labelledby`).\n *\n * Avoid providing interactive elements in the label. Prefer `auxiliaryLabel` for that.\n *\n * @see BaseFieldProps['label']\n * @see BaseFieldProps['auxiliaryLabel']\n */\n secondaryLabel?: React.ReactNode\n\n /**\n * An optional extra element to be placed to the right of the main and secondary labels.\n *\n * This extra element is not included in the accessible name of the field element. Its only\n * purpose is either visual, or functional (if you include interactive elements in it).\n *\n * @see BaseFieldProps['label']\n * @see BaseFieldProps['secondaryLabel']\n */\n auxiliaryLabel?: React.ReactNode\n\n /**\n * A message associated with the field. It is rendered below the field, and with an\n * appearance that conveys the tone of the field (e.g. coloured red for errors, green for\n * success, etc).\n *\n * The message element is associated to the field via the `aria-describedby` attribute. If a\n * `hint` is provided, both the hint and the message are associated as the field accessible\n * description.\n *\n * In the future, when `aria-errormessage` gets better user agent support, we should use it\n * to associate the filed with a message when tone is `\"error\"`.\n *\n * @see BaseFieldProps['tone']\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-errormessage\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid\n */\n message?: React.ReactNode\n\n /**\n * The tone with which the message, if any, is presented.\n *\n * If the tone is `\"error\"`, the field border turns red, and the message, if any, is also\n * red.\n *\n * When the tone is `\"loading\"`, it is recommended that you also disable the field. However,\n * this is not enforced by the component. It is only a recommendation.\n *\n * @see BaseFieldProps['message']\n * @see BaseFieldProps['hint']\n */\n tone?: FieldTone\n\n /**\n * A hint or help-like content associated as the accessible description of the field. It is\n * generally rendered below it, and with a visual style that reduces its prominence (i.e.\n * as secondary text).\n *\n * It sets the `aria-describedby` attribute pointing to the element that holds the hint\n * content.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby\n */\n hint?: React.ReactNode\n\n /**\n * The maximum width that the input field can expand to.\n */\n maxWidth?: BoxProps['maxWidth']\n\n /**\n * Used internally by components composed using `BaseField`. It is not exposed as part of\n * the public props of such components.\n */\n children: (props: ChildrenRenderProps) => React.ReactNode\n }\n\ntype FieldComponentProps<T extends HTMLElement> = Omit<\n BaseFieldProps,\n 'children' | 'className' | 'variant'\n> &\n Omit<HtmlInputProps<T>, 'className' | 'style'>\n\nfunction BaseField({\n variant = 'default',\n label,\n secondaryLabel,\n auxiliaryLabel,\n hint,\n message,\n tone = 'neutral',\n className,\n children,\n maxWidth,\n hidden,\n 'aria-describedby': originalAriaDescribedBy,\n id: originalId,\n}: BaseFieldProps & BaseFieldVariantProps & WithEnhancedClassName) {\n const id = useId(originalId)\n const hintId = useId()\n const messageId = useId()\n\n const ariaDescribedBy =\n originalAriaDescribedBy ?? [message ? messageId : null, hintId].filter(Boolean).join(' ')\n\n const childrenProps: ChildrenRenderProps = {\n id,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': tone === 'error' ? true : undefined,\n }\n\n return (\n <Stack space=\"small\" hidden={hidden}>\n <Box\n className={[\n className,\n styles.container,\n tone === 'error' ? styles.error : null,\n variant === 'bordered' ? styles.bordered : null,\n ]}\n maxWidth={maxWidth}\n >\n {label || secondaryLabel || auxiliaryLabel ? (\n <Box\n as=\"span\"\n display=\"flex\"\n justifyContent=\"spaceBetween\"\n alignItems=\"flexEnd\"\n >\n <Text\n size={variant === 'bordered' ? 'caption' : 'body'}\n as=\"label\"\n htmlFor={id}\n >\n {label ? <span className={styles.primaryLabel}>{label}</span> : null}\n {secondaryLabel ? (\n <span className={styles.secondaryLabel}>\n ({secondaryLabel})\n </span>\n ) : null}\n </Text>\n {auxiliaryLabel ? (\n <Box className={styles.auxiliaryLabel} paddingLeft=\"small\">\n {auxiliaryLabel}\n </Box>\n ) : null}\n </Box>\n ) : null}\n {children(childrenProps)}\n </Box>\n {message ? (\n <FieldMessage id={messageId} tone={tone}>\n {message}\n </FieldMessage>\n ) : null}\n {hint ? <FieldHint id={hintId}>{hint}</FieldHint> : null}\n </Stack>\n )\n}\n\nexport { BaseField, FieldHint, FieldMessage }\nexport type { BaseFieldVariant, BaseFieldVariantProps, FieldComponentProps }\n"],"names":["FieldHint","props","React","Text","as","tone","size","MessageIcon","width","height","viewBox","fill","xmlns","fillRule","clipRule","d","FieldMessage","id","children","textTone","Box","marginRight","display","className","styles","messageIcon","Spinner","BaseField","variant","label","secondaryLabel","auxiliaryLabel","hint","message","maxWidth","hidden","originalAriaDescribedBy","originalId","useId","hintId","messageId","ariaDescribedBy","filter","Boolean","join","childrenProps","undefined","Stack","space","container","error","bordered","justifyContent","alignItems","htmlFor","primaryLabel","paddingLeft"],"mappings":";;;;;;;;;AAeA,SAASA,SAAT,CAAmBC,KAAnB;EACI,oBAAOC,aAAA,CAACC,IAAD;IAAMC,EAAE,EAAC,GAAT;IAAaC,IAAI,EAAC,WAAlB;IAA8BC,IAAI,EAAC;KAAWL,KAA9C,EAAP;AACH;;AAED,SAASM,WAAT,CAAqBN,KAArB;EACI,oBACIC,aAAA,MAAA;IACIM,KAAK,EAAC,IADV;IAEIC,MAAM,EAAC,IAFX;IAGIC,OAAO,EAAC,WAHZ;IAIIC,IAAI,EAAC,MAJT;IAKIC,KAA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J,EAsCKZ,OAAO,gBACJ/B,aAAA,CAACc,YAAD;IAAcC,EAAE,EAAEuB;IAAWnC,IAAI,EAAEA;GAAnC,EACK4B,OADL,CADI,GAIJ,IA1CR,EA2CKD,IAAI,gBAAG9B,aAAA,CAACF,SAAD;IAAWiB,EAAE,EAAEsB;GAAf,EAAwBP,IAAxB,CAAH,GAA+C,IA3CxD,CADJ;AA+CH;;;;"}
|
|
1
|
+
{"version":3,"file":"base-field.js","sources":["../../src/base-field/base-field.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box, BoxProps } from '../box'\nimport { useId } from '../utils/common-helpers'\nimport { Text } from '../text'\nimport styles from './base-field.module.css'\nimport { Stack } from '../stack'\n\nimport type { WithEnhancedClassName } from '../utils/common-types'\nimport { Spinner } from '../spinner'\n\ntype FieldHintProps = {\n id: string\n children: React.ReactNode\n}\n\nfunction FieldHint(props: FieldHintProps) {\n return <Text as=\"p\" tone=\"secondary\" size=\"copy\" {...props} />\n}\n\nfunction MessageIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M8 2.5C4.96243 2.5 2.5 4.96243 2.5 8C2.5 11.0376 4.96243 13.5 8 13.5C11.0376 13.5 13.5 11.0376 13.5 8C13.5 4.96243 11.0376 2.5 8 2.5ZM1.5 8C1.5 4.41015 4.41015 1.5 8 1.5C11.5899 1.5 14.5 4.41015 14.5 8C14.5 11.5899 11.5899 14.5 8 14.5C4.41015 14.5 1.5 11.5899 1.5 8ZM8.66667 10.3333C8.66667 10.7015 8.36819 11 8 11C7.63181 11 7.33333 10.7015 7.33333 10.3333C7.33333 9.96514 7.63181 9.66667 8 9.66667C8.36819 9.66667 8.66667 9.96514 8.66667 10.3333ZM8.65766 5.65766C8.65766 5.29445 8.36322 5 8 5C7.99087 5.00008 7.98631 5.00013 7.98175 5.00025C7.97719 5.00038 7.97263 5.00059 7.96352 5.00101C7.60086 5.02116 7.3232 5.33149 7.34335 5.69415L7.50077 8.52774C7.53575 9.15742 8.46425 9.15742 8.49923 8.52774L8.65665 5.69415C8.65707 5.68503 8.65728 5.68047 8.65741 5.67591C8.65754 5.67135 8.65758 5.66679 8.65766 5.65766Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\ntype FieldTone = 'neutral' | 'success' | 'error' | 'loading'\n\ntype FieldMessageProps = FieldHintProps & {\n tone: FieldTone\n}\n\nfunction FieldMessage({ id, children, tone }: FieldMessageProps) {\n const textTone = tone === 'error' ? 'danger' : tone === 'success' ? 'positive' : 'normal'\n return (\n <Text as=\"p\" tone={textTone} size=\"copy\" id={id}>\n <Box as=\"span\" marginRight=\"xsmall\" display=\"inlineFlex\" className={styles.messageIcon}>\n {tone === 'loading' ? <Spinner size={16} /> : <MessageIcon aria-hidden />}\n </Box>\n {children}\n </Text>\n )\n}\n\n//\n// BaseField\n//\n\ntype ChildrenRenderProps = {\n id: string\n 'aria-describedby'?: string\n 'aria-invalid'?: true\n}\n\ntype HtmlInputProps<T extends HTMLElement> = React.DetailedHTMLProps<\n React.InputHTMLAttributes<T>,\n T\n>\n\ntype BaseFieldVariant = 'default' | 'bordered'\ntype BaseFieldVariantProps = {\n /**\n * Provides alternative visual layouts or modes that the field can be rendered in.\n *\n * Namely, there are two variants supported:\n *\n * - the default one\n * - a \"bordered\" variant, where the border of the field surrounds also the labels, instead\n * of just surrounding the actual field element\n *\n * In both cases, the message and description texts for the field lie outside the bordered\n * area.\n */\n variant?: BaseFieldVariant\n}\n\ntype BaseFieldProps = WithEnhancedClassName &\n Pick<HtmlInputProps<HTMLInputElement>, 'id' | 'hidden' | 'aria-describedby'> & {\n /**\n * The main label for this field element.\n *\n * This prop is not optional. Consumers of field components must be explicit about not\n * wanting a label by passing `label=\"\"` or `label={null}`. In those situations, consumers\n * should make sure that fields are properly labelled semantically by other means (e.g using\n * `aria-labelledby`, or rendering a `<label />` element referencing the field by id).\n *\n * Avoid providing interactive elements in the label. Prefer `auxiliaryLabel` for that.\n *\n * @see BaseFieldProps['secondaryLabel']\n * @see BaseFieldProps['auxiliaryLabel']\n */\n label: React.ReactNode\n\n /**\n * An optional secondary label for this field element. It is combined with the `label` to\n * form the field's entire accessible name (unless the field label is overriden by using\n * `aria-label` or `aria-labelledby`).\n *\n * Avoid providing interactive elements in the label. Prefer `auxiliaryLabel` for that.\n *\n * @see BaseFieldProps['label']\n * @see BaseFieldProps['auxiliaryLabel']\n */\n secondaryLabel?: React.ReactNode\n\n /**\n * An optional extra element to be placed to the right of the main and secondary labels.\n *\n * This extra element is not included in the accessible name of the field element. Its only\n * purpose is either visual, or functional (if you include interactive elements in it).\n *\n * @see BaseFieldProps['label']\n * @see BaseFieldProps['secondaryLabel']\n */\n auxiliaryLabel?: React.ReactNode\n\n /**\n * A message associated with the field. It is rendered below the field, and with an\n * appearance that conveys the tone of the field (e.g. coloured red for errors, green for\n * success, etc).\n *\n * The message element is associated to the field via the `aria-describedby` attribute. If a\n * `hint` is provided, both the hint and the message are associated as the field accessible\n * description.\n *\n * In the future, when `aria-errormessage` gets better user agent support, we should use it\n * to associate the filed with a message when tone is `\"error\"`.\n *\n * @see BaseFieldProps['tone']\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-errormessage\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid\n */\n message?: React.ReactNode\n\n /**\n * The tone with which the message, if any, is presented.\n *\n * If the tone is `\"error\"`, the field border turns red, and the message, if any, is also\n * red.\n *\n * When the tone is `\"loading\"`, it is recommended that you also disable the field. However,\n * this is not enforced by the component. It is only a recommendation.\n *\n * @see BaseFieldProps['message']\n * @see BaseFieldProps['hint']\n */\n tone?: FieldTone\n\n /**\n * A hint or help-like content associated as the accessible description of the field. It is\n * generally rendered below it, and with a visual style that reduces its prominence (i.e.\n * as secondary text).\n *\n * It sets the `aria-describedby` attribute pointing to the element that holds the hint\n * content.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby\n */\n hint?: React.ReactNode\n\n /**\n * The maximum width that the input field can expand to.\n */\n maxWidth?: BoxProps['maxWidth']\n\n /**\n * Used internally by components composed using `BaseField`. It is not exposed as part of\n * the public props of such components.\n */\n children: (props: ChildrenRenderProps) => React.ReactNode\n }\n\ntype FieldComponentProps<T extends HTMLElement> = Omit<\n BaseFieldProps,\n 'children' | 'className' | 'variant'\n> &\n Omit<HtmlInputProps<T>, 'className' | 'style'>\n\nfunction BaseField({\n variant = 'default',\n label,\n secondaryLabel,\n auxiliaryLabel,\n hint,\n message,\n tone = 'neutral',\n className,\n children,\n maxWidth,\n hidden,\n 'aria-describedby': originalAriaDescribedBy,\n id: originalId,\n}: BaseFieldProps & BaseFieldVariantProps & WithEnhancedClassName) {\n const id = useId(originalId)\n const hintId = useId()\n const messageId = useId()\n\n const ariaDescribedBy =\n originalAriaDescribedBy ?? [message ? messageId : null, hintId].filter(Boolean).join(' ')\n\n const childrenProps: ChildrenRenderProps = {\n id,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': tone === 'error' ? true : undefined,\n }\n\n return (\n <Stack space=\"small\" hidden={hidden}>\n <Box\n className={[\n className,\n styles.container,\n tone === 'error' ? styles.error : null,\n variant === 'bordered' ? styles.bordered : null,\n ]}\n maxWidth={maxWidth}\n >\n {label || secondaryLabel || auxiliaryLabel ? (\n <Box\n as=\"span\"\n display=\"flex\"\n justifyContent=\"spaceBetween\"\n alignItems=\"flexEnd\"\n >\n <Text\n size={variant === 'bordered' ? 'caption' : 'body'}\n as=\"label\"\n htmlFor={id}\n >\n {label ? <span className={styles.primaryLabel}>{label}</span> : null}\n {secondaryLabel ? (\n <span className={styles.secondaryLabel}>\n ({secondaryLabel})\n </span>\n ) : null}\n </Text>\n {auxiliaryLabel ? (\n <Box className={styles.auxiliaryLabel} paddingLeft=\"small\">\n {auxiliaryLabel}\n </Box>\n ) : null}\n </Box>\n ) : null}\n {children(childrenProps)}\n </Box>\n {message ? (\n <FieldMessage id={messageId} tone={tone}>\n {message}\n </FieldMessage>\n ) : null}\n {hint ? <FieldHint id={hintId}>{hint}</FieldHint> : null}\n </Stack>\n )\n}\n\nexport { BaseField, FieldHint, FieldMessage }\nexport type { BaseFieldVariant, BaseFieldVariantProps, FieldComponentProps }\n"],"names":["FieldHint","props","React","Text","_objectSpread","as","tone","size","MessageIcon","width","height","viewBox","fill","xmlns","createElement","fillRule","clipRule","d","FieldMessage","id","children","textTone","Box","marginRight","display","className","styles","messageIcon","Spinner","BaseField","variant","label","secondaryLabel","auxiliaryLabel","hint","message","maxWidth","hidden","originalAriaDescribedBy","originalId","useId","hintId","messageId","ariaDescribedBy","filter","Boolean","join","childrenProps","undefined","Stack","space","container","error","bordered","justifyContent","alignItems","htmlFor","primaryLabel","paddingLeft"],"mappings":";;;;;;;;;AAeA,SAASA,SAAT,CAAmBC,KAAnB,EAAwC;AACpC,EAAA,oBAAOC,mBAAA,CAACC,IAAD,EAAAC,cAAA,CAAA;AAAMC,IAAAA,EAAE,EAAC,GAAT;AAAaC,IAAAA,IAAI,EAAC,WAAlB;AAA8BC,IAAAA,IAAI,EAAC,MAAA;AAAnC,GAAA,EAA8CN,KAA9C,CAAP,CAAA,CAAA;AACH,CAAA;;AAED,SAASO,WAAT,CAAqBP,KAArB,EAAyD;AACrD,EAAA,oBACIC,mBAAA,MAAA,EAAAE,cAAA,CAAA;AACIK,IAAAA,KAAK,EAAC,IADV;AAEIC,IAAAA,MAAM,EAAC,IAFX;AAGIC,IAAAA,OAAO,EAAC,WAHZ;AAIIC,IAAAA,IAAI,EAAC,MAJT;AAKIC,IAAAA,KAAK,EAAC,4BAAA;AALV,GAAA,EAMQZ,KANR,CAQIC,eAAAA,KAAA,CAAAY,aAAA,CAAA,MAAA,EAAA;AACIC,IAAAA,QAAQ,E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J,eAMIrD,KAAC,CAAAY,aAAD,CAACX,IAAD;AACII,IAAAA,IAAI,EAAEuB,OAAO,KAAK,UAAZ,GAAyB,SAAzB,GAAqC;AAC3CzB,IAAAA,EAAE,EAAC;AACHmD,IAAAA,OAAO,EAAErC,EAAAA;GAHb,EAKKY,KAAK,gBAAG7B,KAAA,CAAAY,aAAA,CAAA,MAAA,EAAA;IAAMW,SAAS,EAAEC,gBAAM,CAAC+B,YAAAA;AAAxB,GAAA,EAAuC1B,KAAvC,CAAH,GAA0D,IALpE,EAMKC,cAAc,gBACX9B,mBAAA,OAAA;IAAMuB,SAAS,EAAEC,gBAAM,CAACM,cAAAA;GAAxB,WAAA,EACYA,cADZ,EAEO,GAFP,CADW,GAIX,IAVR,CANJ,EAkBKC,cAAc,gBACX/B,KAAC,CAAAY,aAAD,CAACQ,GAAD,EAAK;IAAAG,SAAS,EAAEC,gBAAM,CAACO,cAAlB;AAAkCyB,IAAAA,WAAW,EAAC,OAAA;GAAnD,EACKzB,cADL,CADW,GAIX,IAtBR,CADH,GAyBG,IAlCR,EAmCKb,QAAQ,CAAC2B,aAAD,CAnCb,CADJ,EAsCKZ,OAAO,gBACJjC,mBAAA,CAACgB,YAAD,EAAa;AAACC,IAAAA,EAAE,EAAEuB,SAAL;AAAgBpC,IAAAA,IAAI,EAAEA,IAAAA;AAAtB,GAAb,EACK6B,OADL,CADI,GAIJ,IA1CR,EA2CKD,IAAI,gBAAGhC,mBAAA,CAACF,SAAD,EAAU;AAACmB,IAAAA,EAAE,EAAEsB,MAAAA;AAAL,GAAV,EAAwBP,IAAxB,CAAH,GAA+C,IA3CxD,CADJ,CAAA;AA+CH;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
var modules_540a88ff = {"container":"_7acdc928","auxiliaryLabel":"_815bad88","bordered":"e35886fe","error":"_6c7b5dc8","primaryLabel":"ec74af87","secondaryLabel":"_6db0ec44","messageIcon":"_05c35af8"};
|
|
2
2
|
|
|
3
|
-
export default
|
|
3
|
+
export { modules_540a88ff as default };
|
|
4
4
|
//# sourceMappingURL=base-field.module.css.js.map
|
package/es/box/box.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { polymorphicComponent } from '../utils/polymorphism.js';
|
|
5
5
|
import { getClassNames } from '../utils/responsive-props.js';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
6
|
+
import modules_54d944f2 from './box.module.css.js';
|
|
7
|
+
import modules_b537a8ee from './padding.module.css.js';
|
|
8
|
+
import modules_131405ac from './margin.module.css.js';
|
|
9
|
+
import modules_89b7671c from './width.module.css.js';
|
|
10
|
+
import modules_8b5c09cb from './gap.module.css.js';
|
|
11
11
|
|
|
12
12
|
const _excluded = ["as", "position", "display", "flexDirection", "flexWrap", "flexGrow", "flexShrink", "gap", "alignItems", "justifyContent", "alignSelf", "overflow", "width", "height", "background", "border", "borderRadius", "minWidth", "maxWidth", "textAlign", "padding", "paddingY", "paddingX", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "margin", "marginY", "marginX", "marginTop", "marginRight", "marginBottom", "marginLeft", "className", "children"];
|
|
13
13
|
|
|
@@ -58,11 +58,11 @@ function getBoxClassNames({
|
|
|
58
58
|
const resolvedMarginBottom = (_ref7 = marginBottom != null ? marginBottom : marginY) != null ? _ref7 : margin;
|
|
59
59
|
const resolvedMarginLeft = (_ref8 = marginLeft != null ? marginLeft : marginX) != null ? _ref8 : margin;
|
|
60
60
|
const omitFlex = !display || typeof display === 'string' && display !== 'flex' && display !== 'inlineFlex';
|
|
61
|
-
return classNames(className,
|
|
62
|
-
getClassNames(
|
|
63
|
-
getClassNames(
|
|
64
|
-
omitFlex ? null : getClassNames(
|
|
65
|
-
getClassNames(
|
|
61
|
+
return classNames(className, modules_54d944f2.box, display ? getClassNames(modules_54d944f2, 'display', display) : null, position !== 'static' ? getClassNames(modules_54d944f2, 'position', position) : null, minWidth != null ? getClassNames(modules_89b7671c, 'minWidth', String(minWidth)) : null, getClassNames(modules_89b7671c, 'maxWidth', maxWidth), getClassNames(modules_54d944f2, 'textAlign', textAlign), // padding
|
|
62
|
+
getClassNames(modules_b537a8ee, 'paddingTop', resolvedPaddingTop), getClassNames(modules_b537a8ee, 'paddingRight', resolvedPaddingRight), getClassNames(modules_b537a8ee, 'paddingBottom', resolvedPaddingBottom), getClassNames(modules_b537a8ee, 'paddingLeft', resolvedPaddingLeft), // margin
|
|
63
|
+
getClassNames(modules_131405ac, 'marginTop', resolvedMarginTop), getClassNames(modules_131405ac, 'marginRight', resolvedMarginRight), getClassNames(modules_131405ac, 'marginBottom', resolvedMarginBottom), getClassNames(modules_131405ac, 'marginLeft', resolvedMarginLeft), // flex props
|
|
64
|
+
omitFlex ? null : getClassNames(modules_54d944f2, 'flexDirection', flexDirection), omitFlex ? null : getClassNames(modules_54d944f2, 'flexWrap', flexWrap), omitFlex ? null : getClassNames(modules_54d944f2, 'alignItems', alignItems), omitFlex ? null : getClassNames(modules_54d944f2, 'justifyContent', justifyContent), alignSelf != null ? getClassNames(modules_54d944f2, 'alignSelf', alignSelf) : null, flexShrink != null ? getClassNames(modules_54d944f2, 'flexShrink', String(flexShrink)) : null, flexGrow != null ? getClassNames(modules_54d944f2, 'flexGrow', String(flexGrow)) : null, gap ? getClassNames(modules_8b5c09cb, 'gap', gap) : null, // other props
|
|
65
|
+
getClassNames(modules_54d944f2, 'overflow', overflow), width != null ? getClassNames(modules_89b7671c, 'width', String(width)) : null, getClassNames(modules_54d944f2, 'height', height), getClassNames(modules_54d944f2, 'bg', background), borderRadius !== 'none' ? getClassNames(modules_54d944f2, 'borderRadius', borderRadius) : null, border !== 'none' ? getClassNames(modules_54d944f2, 'border', border) : null);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
const Box = /*#__PURE__*/polymorphicComponent(function Box(_ref9, ref) {
|
|
@@ -106,7 +106,7 @@ const Box = /*#__PURE__*/polymorphicComponent(function Box(_ref9, ref) {
|
|
|
106
106
|
} = _ref9,
|
|
107
107
|
props = _objectWithoutProperties(_ref9, _excluded);
|
|
108
108
|
|
|
109
|
-
return /*#__PURE__*/createElement(component, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
109
|
+
return /*#__PURE__*/React.createElement(component, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
110
110
|
className: getBoxClassNames({
|
|
111
111
|
position,
|
|
112
112
|
display,
|