@doist/reactist 11.5.1 → 12.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/reactist.cjs.development.js +1336 -1496
- 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/_virtual/_rollupPluginBabelHelpers.js +18 -21
- package/es/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/es/components/checkbox/checkbox.js +7 -9
- package/es/components/checkbox/checkbox.js.map +1 -1
- package/es/components/color-picker/color-picker.js +24 -28
- package/es/components/color-picker/color-picker.js.map +1 -1
- package/es/components/deprecated-button/deprecated-button.js +16 -18
- package/es/components/deprecated-button/deprecated-button.js.map +1 -1
- package/es/components/deprecated-loading/deprecated-loading.js +7 -10
- package/es/components/deprecated-loading/deprecated-loading.js.map +1 -1
- package/es/components/deprecated-modal/deprecated-modal.js +69 -101
- package/es/components/deprecated-modal/deprecated-modal.js.map +1 -1
- package/es/components/deprecated-modal/index.js +4 -4
- package/es/components/deprecated-modal/index.js.map +1 -1
- package/es/components/dropdown/dropdown.js +86 -85
- package/es/components/dropdown/dropdown.js.map +1 -1
- package/es/components/icons/CloseIcon.svg.js +9 -11
- package/es/components/icons/CloseIcon.svg.js.map +1 -1
- package/es/components/input/input.js +4 -3
- package/es/components/input/input.js.map +1 -1
- package/es/components/key-capturer/key-capturer.js +22 -19
- package/es/components/key-capturer/key-capturer.js.map +1 -1
- package/es/components/keyboard-shortcut/keyboard-shortcut.js +20 -26
- package/es/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
- package/es/components/menu/menu.js +112 -142
- package/es/components/menu/menu.js.map +1 -1
- package/es/components/notification/notification.js +32 -32
- package/es/components/notification/notification.js.map +1 -1
- package/es/components/popover/popover.js +85 -91
- package/es/components/popover/popover.js.map +1 -1
- package/es/components/popover/positioning-utils.js +49 -65
- package/es/components/popover/positioning-utils.js.map +1 -1
- package/es/components/progress-bar/progress-bar.js +8 -8
- package/es/components/progress-bar/progress-bar.js.map +1 -1
- package/es/components/select/select.js +20 -25
- package/es/components/select/select.js.map +1 -1
- package/es/components/time/time-utils.js +30 -47
- package/es/components/time/time-utils.js.map +1 -1
- package/es/components/time/time.js +43 -56
- package/es/components/time/time.js.map +1 -1
- package/es/components/tooltip/tooltip.js +40 -46
- package/es/components/tooltip/tooltip.js.map +1 -1
- package/es/hooks/use-previous/use-previous.js +2 -2
- package/es/hooks/use-previous/use-previous.js.map +1 -1
- package/es/new-components/alert/alert.js +7 -6
- package/es/new-components/alert/alert.js.map +1 -1
- package/es/new-components/avatar/avatar.js +19 -18
- package/es/new-components/avatar/avatar.js.map +1 -1
- package/es/new-components/avatar/utils.js +12 -9
- package/es/new-components/avatar/utils.js.map +1 -1
- package/es/new-components/base-button/base-button.js +25 -29
- package/es/new-components/base-button/base-button.js.map +1 -1
- package/es/new-components/base-field/base-field.js +20 -18
- package/es/new-components/base-field/base-field.js.map +1 -1
- package/es/new-components/box/box.js +51 -52
- package/es/new-components/box/box.js.map +1 -1
- package/es/new-components/button/button.js +13 -15
- package/es/new-components/button/button.js.map +1 -1
- package/es/new-components/button-link/button-link.js +13 -15
- package/es/new-components/button-link/button-link.js.map +1 -1
- package/es/new-components/checkbox-field/checkbox-field.js +25 -33
- package/es/new-components/checkbox-field/checkbox-field.js.map +1 -1
- package/es/new-components/checkbox-field/checkbox-icon.js +21 -19
- package/es/new-components/checkbox-field/checkbox-icon.js.map +1 -1
- package/es/new-components/columns/columns.js +24 -27
- package/es/new-components/columns/columns.js.map +1 -1
- package/es/new-components/common-helpers.js +3 -3
- package/es/new-components/common-helpers.js.map +1 -1
- package/es/new-components/divider/divider.js +7 -6
- package/es/new-components/divider/divider.js.map +1 -1
- package/es/new-components/heading/heading.js +17 -17
- package/es/new-components/heading/heading.js.map +1 -1
- package/es/new-components/hidden/hidden.js +14 -13
- package/es/new-components/hidden/hidden.js.map +1 -1
- package/es/new-components/hidden-visually/hidden-visually.js +3 -2
- package/es/new-components/hidden-visually/hidden-visually.js.map +1 -1
- package/es/new-components/icons/alert-icon.js +13 -11
- package/es/new-components/icons/alert-icon.js.map +1 -1
- package/es/new-components/icons/close-icon.js +2 -1
- package/es/new-components/icons/close-icon.js.map +1 -1
- package/es/new-components/icons/password-hidden-icon.js +2 -1
- package/es/new-components/icons/password-hidden-icon.js.map +1 -1
- package/es/new-components/icons/password-visible-icon.js +2 -1
- package/es/new-components/icons/password-visible-icon.js.map +1 -1
- package/es/new-components/inline/inline.js +15 -19
- package/es/new-components/inline/inline.js.map +1 -1
- package/es/new-components/loading/loading.js +12 -10
- package/es/new-components/loading/loading.js.map +1 -1
- package/es/new-components/modal/modal.js +60 -64
- package/es/new-components/modal/modal.js.map +1 -1
- package/es/new-components/notice/notice.js +5 -4
- package/es/new-components/notice/notice.js.map +1 -1
- package/es/new-components/password-field/password-field.js +40 -46
- package/es/new-components/password-field/password-field.js.map +1 -1
- package/es/new-components/responsive-props.js +5 -5
- package/es/new-components/responsive-props.js.map +1 -1
- package/es/new-components/select-field/select-field.js +23 -23
- package/es/new-components/select-field/select-field.js.map +1 -1
- package/es/new-components/spinner/spinner.js +3 -3
- package/es/new-components/spinner/spinner.js.map +1 -1
- package/es/new-components/stack/stack.js +18 -22
- package/es/new-components/stack/stack.js.map +1 -1
- package/es/new-components/switch-field/switch-field.js +31 -41
- package/es/new-components/switch-field/switch-field.js.map +1 -1
- package/es/new-components/tabs/tabs.js +92 -78
- package/es/new-components/tabs/tabs.js.map +1 -1
- package/es/new-components/tabs/tabs.module.css.js +1 -1
- package/es/new-components/text/text.js +16 -17
- package/es/new-components/text/text.js.map +1 -1
- package/es/new-components/text/text.module.css.js +1 -1
- package/es/new-components/text-area/text-area.js +14 -14
- package/es/new-components/text-area/text-area.js.map +1 -1
- package/es/new-components/text-field/text-field.js +21 -22
- package/es/new-components/text-field/text-field.js.map +1 -1
- package/es/new-components/text-link/text-link.js +10 -10
- package/es/new-components/text-link/text-link.js.map +1 -1
- package/es/new-components/text-link/text-link.module.css.js +1 -1
- package/es/utils/polymorphism.js.map +1 -1
- package/lib/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/lib/components/checkbox/checkbox.js +1 -1
- package/lib/components/checkbox/checkbox.js.map +1 -1
- 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 +3 -3
- 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-loading/deprecated-loading.js +1 -1
- package/lib/components/deprecated-loading/deprecated-loading.js.map +1 -1
- package/lib/components/deprecated-modal/deprecated-modal.d.ts +2 -2
- package/lib/components/deprecated-modal/deprecated-modal.js +1 -1
- package/lib/components/deprecated-modal/deprecated-modal.js.map +1 -1
- package/lib/components/deprecated-modal/index.js.map +1 -1
- package/lib/components/dropdown/dropdown.d.ts +5 -2
- package/lib/components/dropdown/dropdown.js +1 -1
- package/lib/components/dropdown/dropdown.js.map +1 -1
- package/lib/components/icons/CloseIcon.svg.js +1 -1
- package/lib/components/icons/CloseIcon.svg.js.map +1 -1
- package/lib/components/input/input.js +1 -1
- package/lib/components/input/input.js.map +1 -1
- package/lib/components/key-capturer/key-capturer.d.ts +1 -1
- 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.js +1 -1
- package/lib/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
- package/lib/components/menu/menu.d.ts +7 -7
- package/lib/components/menu/menu.js +1 -1
- package/lib/components/menu/menu.js.map +1 -1
- package/lib/components/notification/notification.js +1 -1
- package/lib/components/notification/notification.js.map +1 -1
- package/lib/components/popover/popover.d.ts +1 -1
- package/lib/components/popover/popover.js +1 -1
- package/lib/components/popover/popover.js.map +1 -1
- package/lib/components/popover/positioning-utils.js +1 -1
- package/lib/components/popover/positioning-utils.js.map +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/select/select.js +1 -1
- package/lib/components/select/select.js.map +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.js +1 -1
- package/lib/components/time/time.js.map +1 -1
- package/lib/components/tooltip/index.d.ts +1 -2
- package/lib/components/tooltip/tooltip.d.ts +3 -3
- package/lib/components/tooltip/tooltip.js +1 -1
- package/lib/components/tooltip/tooltip.js.map +1 -1
- package/lib/hooks/use-previous/use-previous.js +1 -1
- package/lib/hooks/use-previous/use-previous.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/new-components/alert/alert.d.ts +1 -1
- package/lib/new-components/alert/alert.js +1 -1
- package/lib/new-components/alert/alert.js.map +1 -1
- package/lib/new-components/avatar/avatar.js +1 -1
- package/lib/new-components/avatar/avatar.js.map +1 -1
- package/lib/new-components/avatar/utils.d.ts +1 -1
- package/lib/new-components/avatar/utils.js +1 -1
- package/lib/new-components/avatar/utils.js.map +1 -1
- package/lib/new-components/base-button/base-button.js +1 -1
- package/lib/new-components/base-button/base-button.js.map +1 -1
- package/lib/new-components/base-field/base-field.d.ts +1 -1
- package/lib/new-components/base-field/base-field.js +1 -1
- package/lib/new-components/base-field/base-field.js.map +1 -1
- package/lib/new-components/box/box.js +1 -1
- package/lib/new-components/box/box.js.map +1 -1
- package/lib/new-components/button/button.d.ts +1 -58
- package/lib/new-components/button/button.js +1 -1
- package/lib/new-components/button/button.js.map +1 -1
- package/lib/new-components/button-link/button-link.js +1 -1
- package/lib/new-components/button-link/button-link.js.map +1 -1
- package/lib/new-components/checkbox-field/checkbox-field.d.ts +1 -1
- package/lib/new-components/checkbox-field/checkbox-field.js +1 -1
- package/lib/new-components/checkbox-field/checkbox-field.js.map +1 -1
- package/lib/new-components/checkbox-field/checkbox-icon.js +1 -1
- package/lib/new-components/checkbox-field/checkbox-icon.js.map +1 -1
- package/lib/new-components/columns/columns.js +1 -1
- package/lib/new-components/columns/columns.js.map +1 -1
- package/lib/new-components/common-helpers.js +1 -1
- package/lib/new-components/common-helpers.js.map +1 -1
- package/lib/new-components/common-types.d.ts +2 -2
- package/lib/new-components/divider/divider.js +1 -1
- package/lib/new-components/divider/divider.js.map +1 -1
- package/lib/new-components/heading/heading.d.ts +2 -2
- package/lib/new-components/heading/heading.js +1 -1
- package/lib/new-components/heading/heading.js.map +1 -1
- package/lib/new-components/hidden/hidden.js +1 -1
- package/lib/new-components/hidden/hidden.js.map +1 -1
- package/lib/new-components/hidden-visually/hidden-visually.js +1 -1
- package/lib/new-components/hidden-visually/hidden-visually.js.map +1 -1
- package/lib/new-components/icons/alert-icon.d.ts +1 -1
- package/lib/new-components/icons/alert-icon.js +1 -1
- package/lib/new-components/icons/alert-icon.js.map +1 -1
- package/lib/new-components/icons/close-icon.js +1 -1
- package/lib/new-components/icons/close-icon.js.map +1 -1
- package/lib/new-components/icons/password-hidden-icon.js +1 -1
- package/lib/new-components/icons/password-hidden-icon.js.map +1 -1
- package/lib/new-components/icons/password-visible-icon.js +1 -1
- package/lib/new-components/icons/password-visible-icon.js.map +1 -1
- package/lib/new-components/inline/inline.js +1 -1
- package/lib/new-components/inline/inline.js.map +1 -1
- package/lib/new-components/loading/loading.d.ts +1 -1
- package/lib/new-components/loading/loading.js +1 -1
- package/lib/new-components/loading/loading.js.map +1 -1
- package/lib/new-components/modal/modal.js +1 -1
- package/lib/new-components/modal/modal.js.map +1 -1
- package/lib/new-components/notice/notice.d.ts +1 -1
- package/lib/new-components/notice/notice.js +1 -1
- package/lib/new-components/notice/notice.js.map +1 -1
- package/lib/new-components/password-field/password-field.d.ts +1 -1
- package/lib/new-components/password-field/password-field.js +1 -1
- package/lib/new-components/password-field/password-field.js.map +1 -1
- package/lib/new-components/responsive-props.d.ts +1 -1
- package/lib/new-components/responsive-props.js +1 -1
- package/lib/new-components/responsive-props.js.map +1 -1
- package/lib/new-components/select-field/select-field.d.ts +1 -1
- package/lib/new-components/select-field/select-field.js +1 -1
- package/lib/new-components/select-field/select-field.js.map +1 -1
- package/lib/new-components/spinner/spinner.js +1 -1
- package/lib/new-components/spinner/spinner.js.map +1 -1
- package/lib/new-components/stack/stack.js +1 -1
- package/lib/new-components/stack/stack.js.map +1 -1
- package/lib/new-components/switch-field/switch-field.d.ts +1 -1
- package/lib/new-components/switch-field/switch-field.js +1 -1
- package/lib/new-components/switch-field/switch-field.js.map +1 -1
- package/lib/new-components/tabs/tabs.d.ts +13 -3
- package/lib/new-components/tabs/tabs.js +1 -1
- package/lib/new-components/tabs/tabs.js.map +1 -1
- package/lib/new-components/tabs/tabs.module.css.js +1 -1
- package/lib/new-components/test-helpers.d.ts +4 -3
- package/lib/new-components/text/text.js +1 -1
- package/lib/new-components/text/text.js.map +1 -1
- package/lib/new-components/text/text.module.css.js +1 -1
- package/lib/new-components/text-area/text-area.js +1 -1
- package/lib/new-components/text-area/text-area.js.map +1 -1
- package/lib/new-components/text-field/text-field.d.ts +1 -1
- package/lib/new-components/text-field/text-field.js +1 -1
- package/lib/new-components/text-field/text-field.js.map +1 -1
- package/lib/new-components/text-link/text-link.js +1 -1
- package/lib/new-components/text-link/text-link.js.map +1 -1
- package/lib/new-components/text-link/text-link.module.css.js +1 -1
- package/lib/utils/polymorphism.js.map +1 -1
- package/package.json +45 -38
- package/styles/base-field.css +1 -1
- package/styles/checkbox-field.css +1 -1
- package/styles/menu.css +1 -1
- package/styles/password-field.css +1 -1
- package/styles/reactist.css +5 -5
- package/styles/select-field.css +1 -1
- package/styles/switch-field.css +1 -1
- package/styles/tabs.css +1 -1
- package/styles/tabs.module.css.css +1 -1
- package/styles/text-area.css +1 -1
- package/styles/text-field.css +1 -1
- package/styles/text-link.css +1 -1
- package/styles/text-link.module.css.css +1 -1
- package/styles/text.css +1 -1
- package/styles/text.module.css.css +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import { createElement } from 'react';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const _excluded = ["tone"];
|
|
5
|
+
const alertIconForTone = {
|
|
6
6
|
info: AlertInfoIcon,
|
|
7
7
|
positive: AlertPositiveIcon,
|
|
8
8
|
caution: AlertCautionIcon,
|
|
@@ -10,15 +10,17 @@ var alertIconForTone = {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
function AlertIcon(_ref) {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
let {
|
|
14
|
+
tone
|
|
15
|
+
} = _ref,
|
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
return Icon ? /*#__PURE__*/createElement(Icon,
|
|
18
|
+
const Icon = alertIconForTone[tone];
|
|
19
|
+
return Icon ? /*#__PURE__*/createElement(Icon, _objectSpread2({}, props)) : null;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
function AlertInfoIcon(props) {
|
|
21
|
-
return /*#__PURE__*/createElement("svg",
|
|
23
|
+
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
22
24
|
width: "24",
|
|
23
25
|
height: "24",
|
|
24
26
|
fill: "none",
|
|
@@ -32,7 +34,7 @@ function AlertInfoIcon(props) {
|
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
function AlertPositiveIcon(props) {
|
|
35
|
-
return /*#__PURE__*/createElement("svg",
|
|
37
|
+
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
36
38
|
width: "24",
|
|
37
39
|
height: "24",
|
|
38
40
|
fill: "none",
|
|
@@ -46,7 +48,7 @@ function AlertPositiveIcon(props) {
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
function AlertCautionIcon(props) {
|
|
49
|
-
return /*#__PURE__*/createElement("svg",
|
|
51
|
+
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
50
52
|
width: "24",
|
|
51
53
|
height: "24",
|
|
52
54
|
fill: "none",
|
|
@@ -60,7 +62,7 @@ function AlertCautionIcon(props) {
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
function AlertCriticalIcon(props) {
|
|
63
|
-
return /*#__PURE__*/createElement("svg",
|
|
65
|
+
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
64
66
|
width: "24",
|
|
65
67
|
height: "24",
|
|
66
68
|
fill: "none",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-icon.js","sources":["../../../src/new-components/icons/alert-icon.tsx"],"sourcesContent":["import * as React from 'react'\nimport { AlertTone } from '../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 width=\"24\" height=\"24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-1a8 8 0 1 1 0-16 8 8 0 0 1 0 16zm1.18-11.84a.84.84 0 1 1-1.68 0 .84.84 0 0 1 1.68 0zM12.5 10a.5.5 0 0 1 .5.5V15h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1v-4h-1a.5.5 0 0 1 0-1h1.5z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction AlertPositiveIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg width=\"24\" height=\"24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-1a8 8 0 1 1 0-16 8 8 0 0 1 0 16zm-4.354-8.104a.5.5 0 0 1 .708 0l2.146 2.147 5.146-5.147a.5.5 0 0 1 .708.708l-5.5 5.5a.5.5 0 0 1-.708 0l-2.5-2.5a.5.5 0 0 1 0-.708z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction AlertCautionIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg width=\"24\" height=\"24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"m3.254 16.992 7.018-12.03a2 2 0 0 1 3.455 0l7.018 12.03A2 2 0 0 1 19.018 20H4.982a2 2 0 0 1-1.728-3.008zm8.242-11.887a1 1 0 0 0-.36.36l-7.018 12.03A1 1 0 0 0 4.982 19h14.036a1 1 0 0 0 .864-1.504l-7.018-12.03a1 1 0 0 0-1.368-.36zM13 16.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-.014-7.014a.987.987 0 1 0-1.971.055l.236 4.25c.053.945 1.445.945 1.498 0l.236-4.25.001-.027v-.028z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction AlertCriticalIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg width=\"24\" height=\"24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12 3.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17zM2.5 12a9.5 9.5 0 1 1 19 0 9.5 9.5 0 0 1-19 0zM13 15.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-.014-7.014A.987.987 0 0 0 12 7.5h-.027l-.028.002a.987.987 0 0 0-.93 1.04l.236 4.25c.053.944 1.445.944 1.498 0l.236-4.25.001-.028v-.027z\"\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","width","height","fill","xmlns","fillRule","clipRule","d"],"mappings":";;;;AAGA,
|
|
1
|
+
{"version":3,"file":"alert-icon.js","sources":["../../../src/new-components/icons/alert-icon.tsx"],"sourcesContent":["import * as React from 'react'\nimport type { AlertTone } from '../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 width=\"24\" height=\"24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-1a8 8 0 1 1 0-16 8 8 0 0 1 0 16zm1.18-11.84a.84.84 0 1 1-1.68 0 .84.84 0 0 1 1.68 0zM12.5 10a.5.5 0 0 1 .5.5V15h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1v-4h-1a.5.5 0 0 1 0-1h1.5z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction AlertPositiveIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg width=\"24\" height=\"24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-1a8 8 0 1 1 0-16 8 8 0 0 1 0 16zm-4.354-8.104a.5.5 0 0 1 .708 0l2.146 2.147 5.146-5.147a.5.5 0 0 1 .708.708l-5.5 5.5a.5.5 0 0 1-.708 0l-2.5-2.5a.5.5 0 0 1 0-.708z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction AlertCautionIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg width=\"24\" height=\"24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"m3.254 16.992 7.018-12.03a2 2 0 0 1 3.455 0l7.018 12.03A2 2 0 0 1 19.018 20H4.982a2 2 0 0 1-1.728-3.008zm8.242-11.887a1 1 0 0 0-.36.36l-7.018 12.03A1 1 0 0 0 4.982 19h14.036a1 1 0 0 0 .864-1.504l-7.018-12.03a1 1 0 0 0-1.368-.36zM13 16.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-.014-7.014a.987.987 0 1 0-1.971.055l.236 4.25c.053.945 1.445.945 1.498 0l.236-4.25.001-.027v-.028z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nfunction AlertCriticalIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg width=\"24\" height=\"24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12 3.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17zM2.5 12a9.5 9.5 0 1 1 19 0 9.5 9.5 0 0 1-19 0zM13 15.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-.014-7.014A.987.987 0 0 0 12 7.5h-.027l-.028.002a.987.987 0 0 0-.93 1.04l.236 4.25c.053.944 1.445.944 1.498 0l.236-4.25.001-.028v-.027z\"\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","width","height","fill","xmlns","fillRule","clipRule","d"],"mappings":";;;;AAGA,MAAMA,gBAAgB,GAA4C;EAC9DC,IAAI,EAAEC,aADwD;EAE9DC,QAAQ,EAAEC,iBAFoD;EAG9DC,OAAO,EAAEC,gBAHqD;EAI9DC,QAAQ,EAAEC;AAJoD,CAAlE;;AAOA,SAASC,SAAT;MAAmB;IAAEC;;MAASC;;EAC1B,MAAMC,IAAI,GAAGZ,gBAAgB,CAACU,IAAD,CAA7B;EACA,OAAOE,IAAI,gBAAGC,aAAA,CAACD,IAAD,qBAAUD,KAAV,EAAH,GAAyB,IAApC;AACH;;AAED,SAAST,aAAT,CAAuBS,KAAvB;EACI,oBACIE,aAAA,MAAA;IAAKC,KAAK,EAAC,IAAX;IAAgBC,MAAM,EAAC,IAAvB;IAA4BC,IAAI,EAAC,MAAjC;IAAwCC,KAAK,EAAC;KAAiCN,KAA/E,gBACIE,aAAA,OAAA;IACIK,QAAQ,EAAC;IACTC,QAAQ,EAAC;IACTC,CAAC,EAAC;IACFJ,IAAI,EAAC;GAJT,CADJ,CADJ;AAUH;;AAED,SAASZ,iBAAT,CAA2BO,KAA3B;EACI,oBACIE,aAAA,MAAA;IAAKC,KAAK,EAAC,IAAX;IAAgBC,MAAM,EAAC,IAAvB;IAA4BC,IAAI,EAAC,MAAjC;IAAwCC,KAAK,EAAC;KAAiCN,KAA/E,gBACIE,aAAA,OAAA;IACIK,QAAQ,EAAC;IACTC,QAAQ,EAAC;IACTC,CAAC,EAAC;IACFJ,IAAI,EAAC;GAJT,CADJ,CADJ;AAUH;;AAED,SAASV,gBAAT,CAA0BK,KAA1B;EACI,oBACIE,aAAA,MAAA;IAAKC,KAAK,EAAC,IAAX;IAAgBC,MAAM,EAAC,IAAvB;IAA4BC,IAAI,EAAC,MAAjC;IAAwCC,KAAK,EAAC;KAAiCN,KAA/E,gBACIE,aAAA,OAAA;IACIK,QAAQ,EAAC;IACTC,QAAQ,EAAC;IACTC,CAAC,EAAC;IACFJ,IAAI,EAAC;GAJT,CADJ,CADJ;AAUH;;AAED,SAASR,iBAAT,CAA2BG,KAA3B;EACI,oBACIE,aAAA,MAAA;IAAKC,KAAK,EAAC,IAAX;IAAgBC,MAAM,EAAC,IAAvB;IAA4BC,IAAI,EAAC,MAAjC;IAAwCC,KAAK,EAAC;KAAiCN,KAA/E,gBACIE,aAAA,OAAA;IACIK,QAAQ,EAAC;IACTC,QAAQ,EAAC;IACTC,CAAC,EAAC;IACFJ,IAAI,EAAC;GAJT,CADJ,CADJ;AAUH;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
1
2
|
import { createElement } from 'react';
|
|
2
3
|
|
|
3
4
|
function CloseIcon(props) {
|
|
4
|
-
return /*#__PURE__*/createElement("svg",
|
|
5
|
+
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
5
6
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6
7
|
width: "24",
|
|
7
8
|
height: "24"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close-icon.js","sources":["../../../src/new-components/icons/close-icon.tsx"],"sourcesContent":["import * as React from 'react'\n\nfunction CloseIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" {...props}>\n <path\n fill=\"currentColor\"\n 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\"\n />\n </svg>\n )\n}\n\nexport { CloseIcon }\n"],"names":["CloseIcon","props","React","xmlns","width","height","fill","d"],"mappings":"
|
|
1
|
+
{"version":3,"file":"close-icon.js","sources":["../../../src/new-components/icons/close-icon.tsx"],"sourcesContent":["import * as React from 'react'\n\nfunction CloseIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" {...props}>\n <path\n fill=\"currentColor\"\n 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\"\n />\n </svg>\n )\n}\n\nexport { CloseIcon }\n"],"names":["CloseIcon","props","React","xmlns","width","height","fill","d"],"mappings":";;;AAEA,SAASA,SAAT,CAAmBC,KAAnB;EACI,oBACIC,aAAA,MAAA;IAAKC,KAAK,EAAC,4BAAX;IAAwCC,KAAK,EAAC,IAA9C;IAAmDC,MAAM,EAAC;KAASJ,KAAnE,gBACIC,aAAA,OAAA;IACII,IAAI,EAAC;IACLC,CAAC,EAAC;GAFN,CADJ,CADJ;AAQH;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
1
2
|
import { createElement } from 'react';
|
|
2
3
|
|
|
3
4
|
function PasswordHiddenIcon(props) {
|
|
4
|
-
return /*#__PURE__*/createElement("svg",
|
|
5
|
+
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
5
6
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6
7
|
width: "24",
|
|
7
8
|
height: "24"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password-hidden-icon.js","sources":["../../../src/new-components/icons/password-hidden-icon.tsx"],"sourcesContent":["import * as React from 'react'\n\nfunction PasswordHiddenIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" {...props}>\n <g fill=\"gray\" fillRule=\"evenodd\" transform=\"translate(2 4)\">\n <path\n fillRule=\"nonzero\"\n d=\"M13.047 2.888C11.962 2.294 10.944 2 10 2 7.56 2 4.63 3.966 1.288 8c1.133 1.368 2.218 2.497 3.253 3.394l-.708.708c-1.068-.93-2.173-2.085-3.315-3.464a1 1 0 0 1 0-1.276C4.031 3.121 7.192 1 10 1c1.196 0 2.456.385 3.78 1.154l-.733.734zm-6.02 10.263C8.084 13.72 9.076 14 10 14c2.443 0 5.373-1.969 8.712-6-1.11-1.34-2.176-2.453-3.193-3.341l.708-.709C17.437 5.013 18.695 6.363 20 8c-3.721 4.667-7.054 7-10 7-1.175 0-2.411-.371-3.709-1.113l.735-.736z\"\n />\n <path\n fillRule=\"nonzero\"\n d=\"M8.478 11.7l.79-.79a3 3 0 0 0 3.642-3.642l.79-.79A4 4 0 0 1 8.477 11.7zM6.334 9.602a4 4 0 0 1 5.268-5.268l-.78.78A3.002 3.002 0 0 0 7.113 8.82l-.78.78z\"\n />\n <rect\n width=\"21\"\n height=\"1\"\n x=\"-.722\"\n y=\"7.778\"\n rx=\".5\"\n transform=\"rotate(-45 9.778 8.278)\"\n />\n </g>\n </svg>\n )\n}\n\nexport { PasswordHiddenIcon }\n"],"names":["PasswordHiddenIcon","props","React","xmlns","width","height","fill","fillRule","transform","d","x","y","rx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"password-hidden-icon.js","sources":["../../../src/new-components/icons/password-hidden-icon.tsx"],"sourcesContent":["import * as React from 'react'\n\nfunction PasswordHiddenIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" {...props}>\n <g fill=\"gray\" fillRule=\"evenodd\" transform=\"translate(2 4)\">\n <path\n fillRule=\"nonzero\"\n d=\"M13.047 2.888C11.962 2.294 10.944 2 10 2 7.56 2 4.63 3.966 1.288 8c1.133 1.368 2.218 2.497 3.253 3.394l-.708.708c-1.068-.93-2.173-2.085-3.315-3.464a1 1 0 0 1 0-1.276C4.031 3.121 7.192 1 10 1c1.196 0 2.456.385 3.78 1.154l-.733.734zm-6.02 10.263C8.084 13.72 9.076 14 10 14c2.443 0 5.373-1.969 8.712-6-1.11-1.34-2.176-2.453-3.193-3.341l.708-.709C17.437 5.013 18.695 6.363 20 8c-3.721 4.667-7.054 7-10 7-1.175 0-2.411-.371-3.709-1.113l.735-.736z\"\n />\n <path\n fillRule=\"nonzero\"\n d=\"M8.478 11.7l.79-.79a3 3 0 0 0 3.642-3.642l.79-.79A4 4 0 0 1 8.477 11.7zM6.334 9.602a4 4 0 0 1 5.268-5.268l-.78.78A3.002 3.002 0 0 0 7.113 8.82l-.78.78z\"\n />\n <rect\n width=\"21\"\n height=\"1\"\n x=\"-.722\"\n y=\"7.778\"\n rx=\".5\"\n transform=\"rotate(-45 9.778 8.278)\"\n />\n </g>\n </svg>\n )\n}\n\nexport { PasswordHiddenIcon }\n"],"names":["PasswordHiddenIcon","props","React","xmlns","width","height","fill","fillRule","transform","d","x","y","rx"],"mappings":";;;AAEA,SAASA,kBAAT,CAA4BC,KAA5B;EACI,oBACIC,aAAA,MAAA;IAAKC,KAAK,EAAC,4BAAX;IAAwCC,KAAK,EAAC,IAA9C;IAAmDC,MAAM,EAAC;KAASJ,KAAnE,gBACIC,aAAA,IAAA;IAAGI,IAAI,EAAC;IAAOC,QAAQ,EAAC;IAAUC,SAAS,EAAC;GAA5C,eACIN,aAAA,OAAA;IACIK,QAAQ,EAAC;IACTE,CAAC,EAAC;GAFN,CADJ,eAKIP,aAAA,OAAA;IACIK,QAAQ,EAAC;IACTE,CAAC,EAAC;GAFN,CALJ,eASIP,aAAA,OAAA;IACIE,KAAK,EAAC;IACNC,MAAM,EAAC;IACPK,CAAC,EAAC;IACFC,CAAC,EAAC;IACFC,EAAE,EAAC;IACHJ,SAAS,EAAC;GANd,CATJ,CADJ,CADJ;AAsBH;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
1
2
|
import { createElement } from 'react';
|
|
2
3
|
|
|
3
4
|
function PasswordVisibleIcon(props) {
|
|
4
|
-
return /*#__PURE__*/createElement("svg",
|
|
5
|
+
return /*#__PURE__*/createElement("svg", _objectSpread2({
|
|
5
6
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6
7
|
width: "24",
|
|
7
8
|
height: "24"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password-visible-icon.js","sources":["../../../src/new-components/icons/password-visible-icon.tsx"],"sourcesContent":["import * as React from 'react'\n\nfunction PasswordVisibleIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" {...props}>\n <g fill=\"none\" fillRule=\"evenodd\" stroke=\"gray\">\n <path d=\"M21.358 12C17.825 7.65 14.692 5.5 12 5.5c-2.624 0-5.67 2.043-9.097 6.181a.5.5 0 0 0 0 .638C6.331 16.457 9.376 18.5 12 18.5c2.692 0 5.825-2.15 9.358-6.5z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3.5\" />\n </g>\n </svg>\n )\n}\n\nexport { PasswordVisibleIcon }\n"],"names":["PasswordVisibleIcon","props","React","xmlns","width","height","fill","fillRule","stroke","d","cx","cy","r"],"mappings":"
|
|
1
|
+
{"version":3,"file":"password-visible-icon.js","sources":["../../../src/new-components/icons/password-visible-icon.tsx"],"sourcesContent":["import * as React from 'react'\n\nfunction PasswordVisibleIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" {...props}>\n <g fill=\"none\" fillRule=\"evenodd\" stroke=\"gray\">\n <path d=\"M21.358 12C17.825 7.65 14.692 5.5 12 5.5c-2.624 0-5.67 2.043-9.097 6.181a.5.5 0 0 0 0 .638C6.331 16.457 9.376 18.5 12 18.5c2.692 0 5.825-2.15 9.358-6.5z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3.5\" />\n </g>\n </svg>\n )\n}\n\nexport { PasswordVisibleIcon }\n"],"names":["PasswordVisibleIcon","props","React","xmlns","width","height","fill","fillRule","stroke","d","cx","cy","r"],"mappings":";;;AAEA,SAASA,mBAAT,CAA6BC,KAA7B;EACI,oBACIC,aAAA,MAAA;IAAKC,KAAK,EAAC,4BAAX;IAAwCC,KAAK,EAAC,IAA9C;IAAmDC,MAAM,EAAC;KAASJ,KAAnE,gBACIC,aAAA,IAAA;IAAGI,IAAI,EAAC;IAAOC,QAAQ,EAAC;IAAUC,MAAM,EAAC;GAAzC,eACIN,aAAA,OAAA;IAAMO,CAAC,EAAC;GAAR,CADJ,eAEIP,aAAA,SAAA;IAAQQ,EAAE,EAAC;IAAKC,EAAE,EAAC;IAAKC,CAAC,EAAC;GAA1B,CAFJ,CADJ,CADJ;AAQH;;;;"}
|
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import { createElement } from 'react';
|
|
3
3
|
import { polymorphicComponent } from '../../utils/polymorphism.js';
|
|
4
4
|
import { getClassNames, mapResponsiveProp } from '../responsive-props.js';
|
|
5
5
|
import { Box } from '../box/box.js';
|
|
6
6
|
import styles from './inline.module.css.js';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
props =
|
|
8
|
+
const _excluded = ["as", "space", "align", "alignY", "children", "exceptionallySetClassName"];
|
|
9
|
+
const Inline = /*#__PURE__*/polymorphicComponent(function Inline(_ref, ref) {
|
|
10
|
+
let {
|
|
11
|
+
as,
|
|
12
|
+
space,
|
|
13
|
+
align = 'left',
|
|
14
|
+
alignY = 'center',
|
|
15
|
+
children,
|
|
16
|
+
exceptionallySetClassName
|
|
17
|
+
} = _ref,
|
|
18
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
19
|
|
|
20
|
-
return /*#__PURE__*/createElement(Box,
|
|
20
|
+
return /*#__PURE__*/createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
21
21
|
as: as,
|
|
22
22
|
display: "flex",
|
|
23
23
|
flexWrap: "wrap",
|
|
24
24
|
className: [exceptionallySetClassName, getClassNames(styles, 'space', space)],
|
|
25
25
|
ref: ref,
|
|
26
|
-
alignItems: mapResponsiveProp(alignY,
|
|
27
|
-
|
|
28
|
-
}),
|
|
29
|
-
justifyContent: mapResponsiveProp(align, function (align) {
|
|
30
|
-
return align === 'left' ? 'flexStart' : align === 'right' ? 'flexEnd' : 'center';
|
|
31
|
-
})
|
|
26
|
+
alignItems: mapResponsiveProp(alignY, alignY => alignY === 'top' ? 'flexStart' : alignY === 'bottom' ? 'flexEnd' : 'center'),
|
|
27
|
+
justifyContent: mapResponsiveProp(align, align => align === 'left' ? 'flexStart' : align === 'right' ? 'flexEnd' : 'center')
|
|
32
28
|
}), children);
|
|
33
29
|
});
|
|
34
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline.js","sources":["../../../src/new-components/inline/inline.tsx"],"sourcesContent":["import * as React from 'react'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { getClassNames, mapResponsiveProp } from '../responsive-props'\nimport { Box } from '../box'\n\nimport type { ResponsiveProp } from '../responsive-props'\nimport type { Space } from '../common-types'\nimport type { ReusableBoxProps } from '../box'\n\nimport styles from './inline.module.css'\n\ntype InlineAlign = 'left' | 'center' | 'right'\n\ninterface InlineProps extends ReusableBoxProps {\n space?: ResponsiveProp<Space>\n align?: ResponsiveProp<InlineAlign>\n alignY?: ResponsiveProp<'top' | 'center' | 'bottom'>\n}\n\nconst Inline = polymorphicComponent<'div', InlineProps>(function Inline(\n { as, space, align = 'left', alignY = 'center', children, exceptionallySetClassName, ...props },\n ref,\n) {\n return (\n <Box\n {...props}\n as={as}\n display=\"flex\"\n flexWrap=\"wrap\"\n className={[exceptionallySetClassName, getClassNames(styles, 'space', space)]}\n ref={ref}\n alignItems={mapResponsiveProp(alignY, (alignY) =>\n alignY === 'top' ? 'flexStart' : alignY === 'bottom' ? 'flexEnd' : 'center',\n )}\n justifyContent={mapResponsiveProp(align, (align) =>\n align === 'left' ? 'flexStart' : align === 'right' ? 'flexEnd' : 'center',\n )}\n >\n {children}\n </Box>\n )\n})\n\nexport type { InlineProps, InlineAlign }\nexport { Inline }\n"],"names":["Inline","polymorphicComponent","ref","as","space","align","alignY","children","exceptionallySetClassName","props","React","Box","display","flexWrap","className","getClassNames","styles","alignItems","mapResponsiveProp","justifyContent"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"inline.js","sources":["../../../src/new-components/inline/inline.tsx"],"sourcesContent":["import * as React from 'react'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { getClassNames, mapResponsiveProp } from '../responsive-props'\nimport { Box } from '../box'\n\nimport type { ResponsiveProp } from '../responsive-props'\nimport type { Space } from '../common-types'\nimport type { ReusableBoxProps } from '../box'\n\nimport styles from './inline.module.css'\n\ntype InlineAlign = 'left' | 'center' | 'right'\n\ninterface InlineProps extends ReusableBoxProps {\n space?: ResponsiveProp<Space>\n align?: ResponsiveProp<InlineAlign>\n alignY?: ResponsiveProp<'top' | 'center' | 'bottom'>\n}\n\nconst Inline = polymorphicComponent<'div', InlineProps>(function Inline(\n { as, space, align = 'left', alignY = 'center', children, exceptionallySetClassName, ...props },\n ref,\n) {\n return (\n <Box\n {...props}\n as={as}\n display=\"flex\"\n flexWrap=\"wrap\"\n className={[exceptionallySetClassName, getClassNames(styles, 'space', space)]}\n ref={ref}\n alignItems={mapResponsiveProp(alignY, (alignY) =>\n alignY === 'top' ? 'flexStart' : alignY === 'bottom' ? 'flexEnd' : 'center',\n )}\n justifyContent={mapResponsiveProp(align, (align) =>\n align === 'left' ? 'flexStart' : align === 'right' ? 'flexEnd' : 'center',\n )}\n >\n {children}\n </Box>\n )\n})\n\nexport type { InlineProps, InlineAlign }\nexport { Inline }\n"],"names":["Inline","polymorphicComponent","ref","as","space","align","alignY","children","exceptionallySetClassName","props","React","Box","display","flexWrap","className","getClassNames","styles","alignItems","mapResponsiveProp","justifyContent"],"mappings":";;;;;;;;MAmBMA,MAAM,gBAAGC,oBAAoB,CAAqB,SAASD,MAAT,OAEpDE,GAFoD;MACpD;IAAEC,EAAF;IAAMC,KAAN;IAAaC,KAAK,GAAG,MAArB;IAA6BC,MAAM,GAAG,QAAtC;IAAgDC,QAAhD;IAA0DC;;MAA8BC;;EAGxF,oBACIC,aAAA,CAACC,GAAD,oCACQF,KADR;IAEIN,EAAE,EAAEA,EAFR;IAGIS,OAAO,EAAC,MAHZ;IAIIC,QAAQ,EAAC,MAJb;IAKIC,SAAS,EAAE,CAACN,yBAAD,EAA4BO,aAAa,CAACC,MAAD,EAAS,OAAT,EAAkBZ,KAAlB,CAAzC,CALf;IAMIF,GAAG,EAAEA,GANT;IAOIe,UAAU,EAAEC,iBAAiB,CAACZ,MAAD,EAAUA,MAAD,IAClCA,MAAM,KAAK,KAAX,GAAmB,WAAnB,GAAiCA,MAAM,KAAK,QAAX,GAAsB,SAAtB,GAAkC,QAD1C,CAPjC;IAUIa,cAAc,EAAED,iBAAiB,CAACb,KAAD,EAASA,KAAD,IACrCA,KAAK,KAAK,MAAV,GAAmB,WAAnB,GAAiCA,KAAK,KAAK,OAAV,GAAoB,SAApB,GAAgC,QADpC;MAIhCE,QAdL,CADJ;AAkBH,CAtBkC;;;;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { Box } from '../box/box.js';
|
|
4
4
|
import { Spinner } from '../spinner/spinner.js';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const _excluded = ["size", "exceptionallySetClassName"];
|
|
7
|
+
const sizeMapping = {
|
|
8
|
+
xsmall: 16,
|
|
8
9
|
small: 24,
|
|
9
10
|
medium: 36,
|
|
10
11
|
large: 48
|
|
@@ -13,14 +14,15 @@ var sizeMapping = {
|
|
|
13
14
|
function Loading(_ref) {
|
|
14
15
|
var _sizeMapping$size;
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
let {
|
|
18
|
+
size = 'small',
|
|
19
|
+
exceptionallySetClassName
|
|
20
|
+
} = _ref,
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return /*#__PURE__*/React__default.createElement(Box,
|
|
23
|
+
const numericSize = (_sizeMapping$size = sizeMapping[size]) != null ? _sizeMapping$size : sizeMapping.small;
|
|
24
|
+
const ariaLabel = props['aria-label'] ? props['aria-label'] : !props['aria-labelledby'] ? 'Loading…' : undefined;
|
|
25
|
+
return /*#__PURE__*/React__default.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
24
26
|
"aria-label": ariaLabel,
|
|
25
27
|
className: exceptionallySetClassName,
|
|
26
28
|
display: "flex",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.js","sources":["../../../src/new-components/loading/loading.tsx"],"sourcesContent":["import React from 'react'\nimport { Box } from '../box'\nimport { Spinner } from '../spinner'\n\ntype Size = 'small' | 'medium' | 'large'\n\ntype NativeProps = Omit<\n JSX.IntrinsicElements['div'],\n 'className' | 'aria-describedby' | 'aria-label' | 'aria-labelledby' | 'role' | 'size'\n>\n\ntype LoadingProps = NativeProps & {\n /**\n * The size of the loading spinner.\n * @default 'small'\n */\n size?: Size\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n /** Identifies the element (or elements) that describes the loading component for assistive technologies. */\n 'aria-describedby'?: string\n} & (\n | {\n /** Defines a string value that labels the current loading component for assistive technologies. */\n 'aria-label': string\n 'aria-labelledby'?: never\n }\n | {\n /** Identifies the element (or elements) that labels the current loading component for assistive technologies. */\n 'aria-labelledby': string\n 'aria-label'?: never\n }\n )\n\nconst sizeMapping: Record<Size, number> = {\n small: 24,\n medium: 36,\n large: 48,\n}\n\nfunction Loading({ size = 'small', exceptionallySetClassName, ...props }: LoadingProps) {\n const numericSize = sizeMapping[size] ?? sizeMapping.small\n const ariaLabel = props['aria-label']\n ? props['aria-label']\n : !props['aria-labelledby']\n ? 'Loading…'\n : undefined\n\n return (\n <Box\n {...props}\n aria-label={ariaLabel}\n className={exceptionallySetClassName}\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n role=\"progressbar\"\n >\n <Spinner size={numericSize} aria-hidden />\n </Box>\n )\n}\n\nexport { Loading }\nexport type { LoadingProps }\n"],"names":["sizeMapping","small","medium","large","Loading","size","exceptionallySetClassName","props","numericSize","ariaLabel","undefined","React","Box","className","display","alignItems","justifyContent","role","Spinner"],"mappings":";;;;;;AAoCA,
|
|
1
|
+
{"version":3,"file":"loading.js","sources":["../../../src/new-components/loading/loading.tsx"],"sourcesContent":["import React from 'react'\nimport { Box } from '../box'\nimport { Spinner } from '../spinner'\n\ntype Size = 'xsmall' | 'small' | 'medium' | 'large'\n\ntype NativeProps = Omit<\n JSX.IntrinsicElements['div'],\n 'className' | 'aria-describedby' | 'aria-label' | 'aria-labelledby' | 'role' | 'size'\n>\n\ntype LoadingProps = NativeProps & {\n /**\n * The size of the loading spinner.\n * @default 'small'\n */\n size?: Size\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n /** Identifies the element (or elements) that describes the loading component for assistive technologies. */\n 'aria-describedby'?: string\n} & (\n | {\n /** Defines a string value that labels the current loading component for assistive technologies. */\n 'aria-label': string\n 'aria-labelledby'?: never\n }\n | {\n /** Identifies the element (or elements) that labels the current loading component for assistive technologies. */\n 'aria-labelledby': string\n 'aria-label'?: never\n }\n )\n\nconst sizeMapping: Record<Size, number> = {\n xsmall: 16,\n small: 24,\n medium: 36,\n large: 48,\n}\n\nfunction Loading({ size = 'small', exceptionallySetClassName, ...props }: LoadingProps) {\n const numericSize = sizeMapping[size] ?? sizeMapping.small\n const ariaLabel = props['aria-label']\n ? props['aria-label']\n : !props['aria-labelledby']\n ? 'Loading…'\n : undefined\n\n return (\n <Box\n {...props}\n aria-label={ariaLabel}\n className={exceptionallySetClassName}\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n role=\"progressbar\"\n >\n <Spinner size={numericSize} aria-hidden />\n </Box>\n )\n}\n\nexport { Loading }\nexport type { LoadingProps }\n"],"names":["sizeMapping","xsmall","small","medium","large","Loading","size","exceptionallySetClassName","props","numericSize","ariaLabel","undefined","React","Box","className","display","alignItems","justifyContent","role","Spinner"],"mappings":";;;;;;AAoCA,MAAMA,WAAW,GAAyB;EACtCC,MAAM,EAAE,EAD8B;EAEtCC,KAAK,EAAE,EAF+B;EAGtCC,MAAM,EAAE,EAH8B;EAItCC,KAAK,EAAE;AAJ+B,CAA1C;;AAOA,SAASC,OAAT;;;MAAiB;IAAEC,IAAI,GAAG,OAAT;IAAkBC;;MAA8BC;;EAC7D,MAAMC,WAAW,wBAAGT,WAAW,CAACM,IAAD,CAAd,gCAAwBN,WAAW,CAACE,KAArD;EACA,MAAMQ,SAAS,GAAGF,KAAK,CAAC,YAAD,CAAL,GACZA,KAAK,CAAC,YAAD,CADO,GAEZ,CAACA,KAAK,CAAC,iBAAD,CAAN,GACA,UADA,GAEAG,SAJN;EAMA,oBACIC,4BAAA,CAACC,GAAD,oCACQL,KADR;kBAEgBE,SAFhB;IAGII,SAAS,EAAEP,yBAHf;IAIIQ,OAAO,EAAC,MAJZ;IAKIC,UAAU,EAAC,QALf;IAMIC,cAAc,EAAC,QANnB;IAOIC,IAAI,EAAC;mBAELN,4BAAA,CAACO,OAAD;IAASb,IAAI,EAAEG;;GAAf,CATJ,CADJ;AAaH;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import { useMemo, createElement, useContext, useState, useEffect, Fragment, createContext } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { Box } from '../box/box.js';
|
|
@@ -11,12 +11,12 @@ import { DialogOverlay, DialogContent } from '@reach/dialog';
|
|
|
11
11
|
import FocusLock from 'react-focus-lock';
|
|
12
12
|
import styles from './modal.module.css.js';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const _excluded = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "autoFocus", "children"],
|
|
15
|
+
_excluded2 = ["children", "button", "withDivider", "exceptionallySetClassName"],
|
|
16
|
+
_excluded3 = ["exceptionallySetClassName", "children"],
|
|
17
|
+
_excluded4 = ["exceptionallySetClassName", "withDivider"],
|
|
18
|
+
_excluded5 = ["children"];
|
|
19
|
+
const ModalContext = /*#__PURE__*/createContext({
|
|
20
20
|
onDismiss: undefined,
|
|
21
21
|
height: 'fitContent'
|
|
22
22
|
});
|
|
@@ -36,24 +36,21 @@ function isNotInternalFrame(element) {
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
function Modal(_ref) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
height: height
|
|
55
|
-
};
|
|
56
|
-
}, [onDismiss, height]);
|
|
39
|
+
let {
|
|
40
|
+
isOpen,
|
|
41
|
+
onDismiss,
|
|
42
|
+
height = 'fitContent',
|
|
43
|
+
width = 'medium',
|
|
44
|
+
exceptionallySetClassName,
|
|
45
|
+
autoFocus = true,
|
|
46
|
+
children
|
|
47
|
+
} = _ref,
|
|
48
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
49
|
+
|
|
50
|
+
const contextValue = useMemo(() => ({
|
|
51
|
+
onDismiss,
|
|
52
|
+
height
|
|
53
|
+
}), [onDismiss, height]);
|
|
57
54
|
return /*#__PURE__*/createElement(DialogOverlay, {
|
|
58
55
|
isOpen: isOpen,
|
|
59
56
|
onDismiss: onDismiss,
|
|
@@ -65,7 +62,7 @@ function Modal(_ref) {
|
|
|
65
62
|
autoFocus: autoFocus,
|
|
66
63
|
whiteList: isNotInternalFrame,
|
|
67
64
|
returnFocus: true
|
|
68
|
-
}, /*#__PURE__*/createElement(DialogContent,
|
|
65
|
+
}, /*#__PURE__*/createElement(DialogContent, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
69
66
|
as: Box,
|
|
70
67
|
borderRadius: "full",
|
|
71
68
|
background: "default",
|
|
@@ -87,17 +84,11 @@ function Modal(_ref) {
|
|
|
87
84
|
*/
|
|
88
85
|
|
|
89
86
|
function ModalCloseButton(props) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
setIncludeInTabOrder = _React$useState[1];
|
|
96
|
-
|
|
97
|
-
var _React$useState2 = useState(false),
|
|
98
|
-
isMounted = _React$useState2[0],
|
|
99
|
-
setIsMounted = _React$useState2[1];
|
|
100
|
-
|
|
87
|
+
const {
|
|
88
|
+
onDismiss
|
|
89
|
+
} = useContext(ModalContext);
|
|
90
|
+
const [includeInTabOrder, setIncludeInTabOrder] = useState(false);
|
|
91
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
101
92
|
useEffect(function skipAutoFocus() {
|
|
102
93
|
if (isMounted) {
|
|
103
94
|
setIncludeInTabOrder(true);
|
|
@@ -105,7 +96,7 @@ function ModalCloseButton(props) {
|
|
|
105
96
|
setIsMounted(true);
|
|
106
97
|
}
|
|
107
98
|
}, [isMounted]);
|
|
108
|
-
return /*#__PURE__*/createElement(Button,
|
|
99
|
+
return /*#__PURE__*/createElement(Button, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
109
100
|
variant: "quaternary",
|
|
110
101
|
onClick: onDismiss,
|
|
111
102
|
icon: /*#__PURE__*/createElement(CloseIcon, null),
|
|
@@ -121,15 +112,15 @@ function ModalCloseButton(props) {
|
|
|
121
112
|
*/
|
|
122
113
|
|
|
123
114
|
function ModalHeader(_ref2) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
props =
|
|
131
|
-
|
|
132
|
-
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Box,
|
|
115
|
+
let {
|
|
116
|
+
children,
|
|
117
|
+
button = true,
|
|
118
|
+
withDivider = false,
|
|
119
|
+
exceptionallySetClassName
|
|
120
|
+
} = _ref2,
|
|
121
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
122
|
+
|
|
123
|
+
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
133
124
|
as: "header",
|
|
134
125
|
paddingLeft: "large",
|
|
135
126
|
paddingRight: button === false || button === null ? 'large' : 'small',
|
|
@@ -165,14 +156,16 @@ function ModalHeader(_ref2) {
|
|
|
165
156
|
*/
|
|
166
157
|
|
|
167
158
|
function ModalBody(_ref3) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
159
|
+
let {
|
|
160
|
+
exceptionallySetClassName,
|
|
161
|
+
children
|
|
162
|
+
} = _ref3,
|
|
163
|
+
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
164
|
+
|
|
165
|
+
const {
|
|
166
|
+
height
|
|
167
|
+
} = useContext(ModalContext);
|
|
168
|
+
return /*#__PURE__*/createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
176
169
|
className: exceptionallySetClassName,
|
|
177
170
|
flexGrow: height === 'expand' ? 1 : 0,
|
|
178
171
|
height: height === 'expand' ? 'full' : undefined,
|
|
@@ -191,14 +184,15 @@ function ModalBody(_ref3) {
|
|
|
191
184
|
*/
|
|
192
185
|
|
|
193
186
|
function ModalFooter(_ref4) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
187
|
+
let {
|
|
188
|
+
exceptionallySetClassName,
|
|
189
|
+
withDivider = false
|
|
190
|
+
} = _ref4,
|
|
191
|
+
props = _objectWithoutProperties(_ref4, _excluded4);
|
|
198
192
|
|
|
199
|
-
return /*#__PURE__*/createElement(Fragment, null, withDivider ? /*#__PURE__*/createElement(Divider, null) : null, /*#__PURE__*/createElement(Box,
|
|
193
|
+
return /*#__PURE__*/createElement(Fragment, null, withDivider ? /*#__PURE__*/createElement(Divider, null) : null, /*#__PURE__*/createElement(Box, _objectSpread2(_objectSpread2({
|
|
200
194
|
as: "footer"
|
|
201
|
-
}, props, {
|
|
195
|
+
}, props), {}, {
|
|
202
196
|
className: exceptionallySetClassName,
|
|
203
197
|
padding: "large"
|
|
204
198
|
})));
|
|
@@ -209,10 +203,12 @@ function ModalFooter(_ref4) {
|
|
|
209
203
|
*/
|
|
210
204
|
|
|
211
205
|
function ModalActions(_ref5) {
|
|
212
|
-
|
|
213
|
-
|
|
206
|
+
let {
|
|
207
|
+
children
|
|
208
|
+
} = _ref5,
|
|
209
|
+
props = _objectWithoutProperties(_ref5, _excluded5);
|
|
214
210
|
|
|
215
|
-
return /*#__PURE__*/createElement(ModalFooter,
|
|
211
|
+
return /*#__PURE__*/createElement(ModalFooter, _objectSpread2({}, props), /*#__PURE__*/createElement(Inline, {
|
|
216
212
|
align: "right",
|
|
217
213
|
space: "large"
|
|
218
214
|
}, children));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sources":["../../../src/new-components/modal/modal.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\nimport { DialogOverlay, DialogContent } from '@reach/dialog'\nimport FocusLock from 'react-focus-lock'\n\nimport { CloseIcon } from '../icons/close-icon'\nimport { Column, Columns } from '../columns'\nimport { Inline } from '../inline'\nimport { Divider } from '../divider'\nimport { Box } from '../box'\nimport { Button, ButtonProps } from '../button'\n\nimport styles from './modal.module.css'\n\ntype ModalWidth = 'small' | 'medium' | 'large' | 'xlarge' | 'full'\ntype ModalHeightMode = 'expand' | 'fitContent'\n\n//\n// ModalContext\n//\n\ntype ModalContextValue = {\n onDismiss?(this: void): void\n height: ModalHeightMode\n}\n\nconst ModalContext = React.createContext<ModalContextValue>({\n onDismiss: undefined,\n height: 'fitContent',\n})\n\n//\n// Modal container\n//\n\ntype DivProps = Omit<\n React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLDivElement>, HTMLDivElement>,\n 'className' | 'children' | `aria-label` | `aria-labelledby`\n>\n\nexport type ModalProps = DivProps & {\n /**\n * The content of the modal.\n */\n children: React.ReactNode\n /**\n * Whether the modal is open and visible or not.\n */\n isOpen: boolean\n /**\n * Called when the user triggers closing the modal.\n */\n onDismiss?(): void\n /**\n * A descriptive setting for how wide the modal should aim to be, depending on how much space\n * it has on screen.\n * @default 'medium'\n */\n width?: ModalWidth\n /**\n * A descriptive setting for how tall the modal should aim to be.\n *\n * - 'expand': the modal aims to fill most of the available screen height, leaving only a small\n * padding above and below.\n * - 'fitContent': the modal shrinks to the smallest size that allow it to fit its content.\n *\n * In either case, if content does not fit, the content of the main body is set to scroll\n * (provided you use `ModalBody`) so that the modal never has to strech vertically beyond the\n * viewport boundaries.\n *\n * If you do not use `ModalBody`, the modal still prevents overflow, and you are in charge of\n * the inner layout to ensure scroll, or whatever other strategy you may want.\n */\n height?: ModalHeightMode\n /**\n * Whether to set or not the focus initially to the first focusable element inside the modal.\n */\n autoFocus?: boolean\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n /** Defines a string value that labels the current modal for assistive technologies. */\n 'aria-label'?: string\n /** Identifies the element (or elements) that labels the current modal for assistive technologies. */\n 'aria-labelledby'?: string\n}\n\nfunction isNotInternalFrame(element: HTMLElement) {\n return !(element.ownerDocument === document && element.tagName.toLowerCase() === 'iframe')\n}\n\n/**\n * Renders a modal that sits on top of the rest of the content in the entire page.\n *\n * Follows the WAI-ARIA Dialog (Modal) Pattern.\n *\n * @see ModalHeader\n * @see ModalFooter\n * @see ModalBody\n */\nexport function Modal({\n isOpen,\n onDismiss,\n height = 'fitContent',\n width = 'medium',\n exceptionallySetClassName,\n autoFocus = true,\n children,\n ...props\n}: ModalProps) {\n const contextValue: ModalContextValue = React.useMemo(() => ({ onDismiss, height }), [\n onDismiss,\n height,\n ])\n\n return (\n <DialogOverlay\n isOpen={isOpen}\n onDismiss={onDismiss}\n dangerouslyBypassFocusLock // We're setting up our own focus lock below\n className={classNames(styles.overlay, styles[height], styles[width])}\n data-testid=\"modal-overlay\"\n >\n <FocusLock autoFocus={autoFocus} whiteList={isNotInternalFrame} returnFocus={true}>\n <DialogContent\n {...props}\n as={Box}\n borderRadius=\"full\"\n background=\"default\"\n display=\"flex\"\n flexDirection=\"column\"\n overflow=\"hidden\"\n height={height === 'expand' ? 'full' : undefined}\n flexGrow={height === 'expand' ? 1 : 0}\n className={[exceptionallySetClassName, styles.container]}\n >\n <ModalContext.Provider value={contextValue}>{children}</ModalContext.Provider>\n </DialogContent>\n </FocusLock>\n </DialogOverlay>\n )\n}\n\n//\n// ModalCloseButton\n//\n\nexport type ModalCloseButtonProps = Omit<\n ButtonProps,\n | 'type'\n | 'children'\n | 'variant'\n | 'icon'\n | 'startIcon'\n | 'endIcon'\n | 'disabled'\n | 'loading'\n | 'tabIndex'\n | 'width'\n | 'align'\n> & {\n /**\n * The descriptive label of the button.\n */\n 'aria-label': string\n}\n\n/**\n * The close button rendered by ModalHeader. Provided independently so that consumers can customize\n * the button's label.\n *\n * @see ModalHeader\n */\nexport function ModalCloseButton(props: ModalCloseButtonProps) {\n const { onDismiss } = React.useContext(ModalContext)\n const [includeInTabOrder, setIncludeInTabOrder] = React.useState(false)\n const [isMounted, setIsMounted] = React.useState(false)\n\n React.useEffect(\n function skipAutoFocus() {\n if (isMounted) {\n setIncludeInTabOrder(true)\n } else {\n setIsMounted(true)\n }\n },\n [isMounted],\n )\n\n return (\n <Button\n {...props}\n variant=\"quaternary\"\n onClick={onDismiss}\n icon={<CloseIcon />}\n tabIndex={includeInTabOrder ? 0 : -1}\n />\n )\n}\n\n//\n// ModalHeader\n//\n\nexport type ModalHeaderProps = DivProps & {\n /**\n * The content of the header.\n */\n children: React.ReactNode\n /**\n * Allows to provide a custom button element, or to omit the close button if set to false.\n * @see ModalCloseButton\n */\n button?: React.ReactNode | boolean\n /**\n * Whether to render a divider line below the header.\n * @default false\n */\n withDivider?: boolean\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\n/**\n * Renders a standard modal header area with an optional close button.\n *\n * @see Modal\n * @see ModalFooter\n * @see ModalBody\n */\nexport function ModalHeader({\n children,\n button = true,\n withDivider = false,\n exceptionallySetClassName,\n ...props\n}: ModalHeaderProps) {\n return (\n <>\n <Box\n {...props}\n as=\"header\"\n paddingLeft=\"large\"\n paddingRight={button === false || button === null ? 'large' : 'small'}\n paddingY=\"small\"\n className={exceptionallySetClassName}\n >\n <Columns space=\"large\" alignY=\"center\">\n <Column width=\"auto\">{children}</Column>\n {button === false || button === null ? (\n <div className={styles.headerContent} />\n ) : (\n <Column\n width=\"content\"\n exceptionallySetClassName={styles.buttonContainer}\n data-testid=\"button-container\"\n >\n {typeof button === 'boolean' ? (\n <ModalCloseButton aria-label=\"Close modal\" autoFocus={false} />\n ) : (\n button\n )}\n </Column>\n )}\n </Columns>\n </Box>\n {withDivider ? <Divider /> : null}\n </>\n )\n}\n\n//\n// ModalBody\n//\n\nexport type ModalBodyProps = DivProps & {\n /**\n * The content of the modal body.\n */\n children: React.ReactNode\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\n/**\n * Renders the body of a modal.\n *\n * Convenient to use alongside ModalHeader and/or ModalFooter as needed. It ensures, among other\n * things, that the contet of the modal body expands or contracts depending on the modal height\n * setting or the size of the content. The body content also automatically scrolls when it's too\n * large to fit the available space.\n *\n * @see Modal\n * @see ModalHeader\n * @see ModalFooter\n */\nexport function ModalBody({ exceptionallySetClassName, children, ...props }: ModalBodyProps) {\n const { height } = React.useContext(ModalContext)\n return (\n <Box\n {...props}\n className={exceptionallySetClassName}\n flexGrow={height === 'expand' ? 1 : 0}\n height={height === 'expand' ? 'full' : undefined}\n overflow=\"auto\"\n >\n <Box padding=\"large\" paddingBottom=\"xxlarge\">\n {children}\n </Box>\n </Box>\n )\n}\n\n//\n// ModalFooter\n//\n\nexport type ModalFooterProps = DivProps & {\n /**\n * The contant of the modal footer.\n */\n children: React.ReactNode\n /**\n * Whether to render a divider line below the footer.\n * @default false\n */\n withDivider?: boolean\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\n/**\n * Renders a standard modal footer area.\n *\n * @see Modal\n * @see ModalHeader\n * @see ModalBody\n */\nexport function ModalFooter({\n exceptionallySetClassName,\n withDivider = false,\n ...props\n}: ModalFooterProps) {\n return (\n <>\n {withDivider ? <Divider /> : null}\n <Box as=\"footer\" {...props} className={exceptionallySetClassName} padding=\"large\" />\n </>\n )\n}\n\n//\n// ModalActions\n//\n\nexport type ModalActionsProps = ModalFooterProps\n\n/**\n * A specific version of the ModalFooter, tailored to showing an inline list of actions (buttons).\n * @see ModalFooter\n */\nexport function ModalActions({ children, ...props }: ModalActionsProps) {\n return (\n <ModalFooter {...props}>\n <Inline align=\"right\" space=\"large\">\n {children}\n </Inline>\n </ModalFooter>\n )\n}\n"],"names":["ModalContext","React","onDismiss","undefined","height","isNotInternalFrame","element","ownerDocument","document","tagName","toLowerCase","Modal","isOpen","width","exceptionallySetClassName","autoFocus","children","props","contextValue","DialogOverlay","dangerouslyBypassFocusLock","className","classNames","styles","overlay","FocusLock","whiteList","returnFocus","DialogContent","as","Box","borderRadius","background","display","flexDirection","overflow","flexGrow","container","Provider","value","ModalCloseButton","includeInTabOrder","setIncludeInTabOrder","isMounted","setIsMounted","skipAutoFocus","Button","variant","onClick","icon","CloseIcon","tabIndex","ModalHeader","button","withDivider","paddingLeft","paddingRight","paddingY","Columns","space","alignY","Column","headerContent","buttonContainer","Divider","ModalBody","padding","paddingBottom","ModalFooter","ModalActions","Inline","align"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,IAAMA,YAAY,gBAAGC,aAAA,CAAuC;AACxDC,EAAAA,SAAS,EAAEC,SAD6C;AAExDC,EAAAA,MAAM,EAAE;AAFgD,CAAvC,CAArB;;AA8DA,SAASC,kBAAT,CAA4BC,OAA5B;AACI,SAAO,EAAEA,OAAO,CAACC,aAAR,KAA0BC,QAA1B,IAAsCF,OAAO,CAACG,OAAR,CAAgBC,WAAhB,OAAkC,QAA1E,CAAP;AACH;AAED;;;;;;;;;;;SASgBC;MACZC,cAAAA;MACAV,iBAAAA;yBACAE;MAAAA,kCAAS;wBACTS;MAAAA,gCAAQ;MACRC,iCAAAA;4BACAC;MAAAA,wCAAY;MACZC,gBAAAA;MACGC;;AAEH,MAAMC,YA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,aAAA,CAACmE,WAAD,oBAAiBnD,MAAjB,eACIhB,aAAA,CAACqE,MAAD;AAAQC,IAAAA,KAAK,EAAC;AAAQZ,IAAAA,KAAK,EAAC;GAA5B,EACK3C,QADL,CADJ,CADJ;AAOH;;;;"}
|
|
1
|
+
{"version":3,"file":"modal.js","sources":["../../../src/new-components/modal/modal.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\nimport { DialogOverlay, DialogContent } from '@reach/dialog'\nimport FocusLock from 'react-focus-lock'\n\nimport { CloseIcon } from '../icons/close-icon'\nimport { Column, Columns } from '../columns'\nimport { Inline } from '../inline'\nimport { Divider } from '../divider'\nimport { Box } from '../box'\nimport { Button, ButtonProps } from '../button'\n\nimport styles from './modal.module.css'\n\ntype ModalWidth = 'small' | 'medium' | 'large' | 'xlarge' | 'full'\ntype ModalHeightMode = 'expand' | 'fitContent'\n\n//\n// ModalContext\n//\n\ntype ModalContextValue = {\n onDismiss?(this: void): void\n height: ModalHeightMode\n}\n\nconst ModalContext = React.createContext<ModalContextValue>({\n onDismiss: undefined,\n height: 'fitContent',\n})\n\n//\n// Modal container\n//\n\ntype DivProps = Omit<\n React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLDivElement>, HTMLDivElement>,\n 'className' | 'children' | `aria-label` | `aria-labelledby`\n>\n\nexport type ModalProps = DivProps & {\n /**\n * The content of the modal.\n */\n children: React.ReactNode\n /**\n * Whether the modal is open and visible or not.\n */\n isOpen: boolean\n /**\n * Called when the user triggers closing the modal.\n */\n onDismiss?(): void\n /**\n * A descriptive setting for how wide the modal should aim to be, depending on how much space\n * it has on screen.\n * @default 'medium'\n */\n width?: ModalWidth\n /**\n * A descriptive setting for how tall the modal should aim to be.\n *\n * - 'expand': the modal aims to fill most of the available screen height, leaving only a small\n * padding above and below.\n * - 'fitContent': the modal shrinks to the smallest size that allow it to fit its content.\n *\n * In either case, if content does not fit, the content of the main body is set to scroll\n * (provided you use `ModalBody`) so that the modal never has to strech vertically beyond the\n * viewport boundaries.\n *\n * If you do not use `ModalBody`, the modal still prevents overflow, and you are in charge of\n * the inner layout to ensure scroll, or whatever other strategy you may want.\n */\n height?: ModalHeightMode\n /**\n * Whether to set or not the focus initially to the first focusable element inside the modal.\n */\n autoFocus?: boolean\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n /** Defines a string value that labels the current modal for assistive technologies. */\n 'aria-label'?: string\n /** Identifies the element (or elements) that labels the current modal for assistive technologies. */\n 'aria-labelledby'?: string\n}\n\nfunction isNotInternalFrame(element: HTMLElement) {\n return !(element.ownerDocument === document && element.tagName.toLowerCase() === 'iframe')\n}\n\n/**\n * Renders a modal that sits on top of the rest of the content in the entire page.\n *\n * Follows the WAI-ARIA Dialog (Modal) Pattern.\n *\n * @see ModalHeader\n * @see ModalFooter\n * @see ModalBody\n */\nexport function Modal({\n isOpen,\n onDismiss,\n height = 'fitContent',\n width = 'medium',\n exceptionallySetClassName,\n autoFocus = true,\n children,\n ...props\n}: ModalProps) {\n const contextValue: ModalContextValue = React.useMemo(() => ({ onDismiss, height }), [\n onDismiss,\n height,\n ])\n\n return (\n <DialogOverlay\n isOpen={isOpen}\n onDismiss={onDismiss}\n dangerouslyBypassFocusLock // We're setting up our own focus lock below\n className={classNames(styles.overlay, styles[height], styles[width])}\n data-testid=\"modal-overlay\"\n >\n <FocusLock autoFocus={autoFocus} whiteList={isNotInternalFrame} returnFocus={true}>\n <DialogContent\n {...props}\n as={Box}\n borderRadius=\"full\"\n background=\"default\"\n display=\"flex\"\n flexDirection=\"column\"\n overflow=\"hidden\"\n height={height === 'expand' ? 'full' : undefined}\n flexGrow={height === 'expand' ? 1 : 0}\n className={[exceptionallySetClassName, styles.container]}\n >\n <ModalContext.Provider value={contextValue}>{children}</ModalContext.Provider>\n </DialogContent>\n </FocusLock>\n </DialogOverlay>\n )\n}\n\n//\n// ModalCloseButton\n//\n\nexport type ModalCloseButtonProps = Omit<\n ButtonProps,\n | 'type'\n | 'children'\n | 'variant'\n | 'icon'\n | 'startIcon'\n | 'endIcon'\n | 'disabled'\n | 'loading'\n | 'tabIndex'\n | 'width'\n | 'align'\n> & {\n /**\n * The descriptive label of the button.\n */\n 'aria-label': string\n}\n\n/**\n * The close button rendered by ModalHeader. Provided independently so that consumers can customize\n * the button's label.\n *\n * @see ModalHeader\n */\nexport function ModalCloseButton(props: ModalCloseButtonProps) {\n const { onDismiss } = React.useContext(ModalContext)\n const [includeInTabOrder, setIncludeInTabOrder] = React.useState(false)\n const [isMounted, setIsMounted] = React.useState(false)\n\n React.useEffect(\n function skipAutoFocus() {\n if (isMounted) {\n setIncludeInTabOrder(true)\n } else {\n setIsMounted(true)\n }\n },\n [isMounted],\n )\n\n return (\n <Button\n {...props}\n variant=\"quaternary\"\n onClick={onDismiss}\n icon={<CloseIcon />}\n tabIndex={includeInTabOrder ? 0 : -1}\n />\n )\n}\n\n//\n// ModalHeader\n//\n\nexport type ModalHeaderProps = DivProps & {\n /**\n * The content of the header.\n */\n children: React.ReactNode\n /**\n * Allows to provide a custom button element, or to omit the close button if set to false.\n * @see ModalCloseButton\n */\n button?: React.ReactNode | boolean\n /**\n * Whether to render a divider line below the header.\n * @default false\n */\n withDivider?: boolean\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\n/**\n * Renders a standard modal header area with an optional close button.\n *\n * @see Modal\n * @see ModalFooter\n * @see ModalBody\n */\nexport function ModalHeader({\n children,\n button = true,\n withDivider = false,\n exceptionallySetClassName,\n ...props\n}: ModalHeaderProps) {\n return (\n <>\n <Box\n {...props}\n as=\"header\"\n paddingLeft=\"large\"\n paddingRight={button === false || button === null ? 'large' : 'small'}\n paddingY=\"small\"\n className={exceptionallySetClassName}\n >\n <Columns space=\"large\" alignY=\"center\">\n <Column width=\"auto\">{children}</Column>\n {button === false || button === null ? (\n <div className={styles.headerContent} />\n ) : (\n <Column\n width=\"content\"\n exceptionallySetClassName={styles.buttonContainer}\n data-testid=\"button-container\"\n >\n {typeof button === 'boolean' ? (\n <ModalCloseButton aria-label=\"Close modal\" autoFocus={false} />\n ) : (\n button\n )}\n </Column>\n )}\n </Columns>\n </Box>\n {withDivider ? <Divider /> : null}\n </>\n )\n}\n\n//\n// ModalBody\n//\n\nexport type ModalBodyProps = DivProps & {\n /**\n * The content of the modal body.\n */\n children: React.ReactNode\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\n/**\n * Renders the body of a modal.\n *\n * Convenient to use alongside ModalHeader and/or ModalFooter as needed. It ensures, among other\n * things, that the contet of the modal body expands or contracts depending on the modal height\n * setting or the size of the content. The body content also automatically scrolls when it's too\n * large to fit the available space.\n *\n * @see Modal\n * @see ModalHeader\n * @see ModalFooter\n */\nexport function ModalBody({ exceptionallySetClassName, children, ...props }: ModalBodyProps) {\n const { height } = React.useContext(ModalContext)\n return (\n <Box\n {...props}\n className={exceptionallySetClassName}\n flexGrow={height === 'expand' ? 1 : 0}\n height={height === 'expand' ? 'full' : undefined}\n overflow=\"auto\"\n >\n <Box padding=\"large\" paddingBottom=\"xxlarge\">\n {children}\n </Box>\n </Box>\n )\n}\n\n//\n// ModalFooter\n//\n\nexport type ModalFooterProps = DivProps & {\n /**\n * The contant of the modal footer.\n */\n children: React.ReactNode\n /**\n * Whether to render a divider line below the footer.\n * @default false\n */\n withDivider?: boolean\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\n/**\n * Renders a standard modal footer area.\n *\n * @see Modal\n * @see ModalHeader\n * @see ModalBody\n */\nexport function ModalFooter({\n exceptionallySetClassName,\n withDivider = false,\n ...props\n}: ModalFooterProps) {\n return (\n <>\n {withDivider ? <Divider /> : null}\n <Box as=\"footer\" {...props} className={exceptionallySetClassName} padding=\"large\" />\n </>\n )\n}\n\n//\n// ModalActions\n//\n\nexport type ModalActionsProps = ModalFooterProps\n\n/**\n * A specific version of the ModalFooter, tailored to showing an inline list of actions (buttons).\n * @see ModalFooter\n */\nexport function ModalActions({ children, ...props }: ModalActionsProps) {\n return (\n <ModalFooter {...props}>\n <Inline align=\"right\" space=\"large\">\n {children}\n </Inline>\n </ModalFooter>\n )\n}\n"],"names":["ModalContext","React","onDismiss","undefined","height","isNotInternalFrame","element","ownerDocument","document","tagName","toLowerCase","Modal","isOpen","width","exceptionallySetClassName","autoFocus","children","props","contextValue","DialogOverlay","dangerouslyBypassFocusLock","className","classNames","styles","overlay","FocusLock","whiteList","returnFocus","DialogContent","as","Box","borderRadius","background","display","flexDirection","overflow","flexGrow","container","Provider","value","ModalCloseButton","includeInTabOrder","setIncludeInTabOrder","isMounted","setIsMounted","skipAutoFocus","Button","variant","onClick","icon","CloseIcon","tabIndex","ModalHeader","button","withDivider","paddingLeft","paddingRight","paddingY","Columns","space","alignY","Column","headerContent","buttonContainer","Divider","ModalBody","padding","paddingBottom","ModalFooter","ModalActions","Inline","align"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,MAAMA,YAAY,gBAAGC,aAAA,CAAuC;EACxDC,SAAS,EAAEC,SAD6C;EAExDC,MAAM,EAAE;AAFgD,CAAvC,CAArB;;AA8DA,SAASC,kBAAT,CAA4BC,OAA5B;EACI,OAAO,EAAEA,OAAO,CAACC,aAAR,KAA0BC,QAA1B,IAAsCF,OAAO,CAACG,OAAR,CAAgBC,WAAhB,OAAkC,QAA1E,CAAP;AACH;AAED;;;;;;;;;;;SASgBC;MAAM;IAClBC,MADkB;IAElBV,SAFkB;IAGlBE,MAAM,GAAG,YAHS;IAIlBS,KAAK,GAAG,QAJU;IAKlBC,yBALkB;IAMlBC,SAAS,GAAG,IANM;IAOlBC;;MACGC;;EAEH,MAAMC,YAAY,GAAsBjB,OAAA,CAAc,OAAO;IAAEC,SAAF;IAAaE;GAApB,CAAd,EAA6C,CACjFF,SADiF,EAEjFE,MAFiF,CAA7C,CAAxC;EAKA,oBACIH,aAAA,CAACkB,aAAD;IACIP,MAAM,E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IAAEb;MAAWH,UAAA,CAAiBD,YAAjB,CAAnB;EACA,oBACIC,aAAA,CAAC6B,GAAD,oCACQb,KADR;IAEII,SAAS,EAAEP,yBAFf;IAGIsB,QAAQ,EAAEhC,MAAM,KAAK,QAAX,GAAsB,CAAtB,GAA0B,CAHxC;IAIIA,MAAM,EAAEA,MAAM,KAAK,QAAX,GAAsB,MAAtB,GAA+BD,SAJ3C;IAKIgC,QAAQ,EAAC;mBAETlC,aAAA,CAAC6B,GAAD;IAAKoC,OAAO,EAAC;IAAQC,aAAa,EAAC;GAAnC,EACKnD,QADL,CAPJ,CADJ;AAaH;AAsBD;;;;;;;;SAOgBoD;MAAY;IACxBtD,yBADwB;IAExBwC,WAAW,GAAG;;MACXrC;;EAEH,oBACIhB,aAAA,SAAA,MAAA,EACKqD,WAAW,gBAAGrD,aAAA,CAAC+D,OAAD,MAAA,CAAH,GAAiB,IADjC,eAEI/D,aAAA,CAAC6B,GAAD;IAAKD,EAAE,EAAC;KAAaZ,KAArB;IAA4BI,SAAS,EAAEP,yBAAvC;IAAkEoD,OAAO,EAAC;KAF9E,CADJ;AAMH;AAQD;;;;;SAIgBG;MAAa;IAAErD;;MAAaC;;EACxC,oBACIhB,aAAA,CAACmE,WAAD,qBAAiBnD,KAAjB,gBACIhB,aAAA,CAACqE,MAAD;IAAQC,KAAK,EAAC;IAAQZ,KAAK,EAAC;GAA5B,EACK3C,QADL,CADJ,CADJ;AAOH;;;;"}
|
|
@@ -5,10 +5,11 @@ import { Columns, Column } from '../columns/columns.js';
|
|
|
5
5
|
import { AlertIcon } from '../icons/alert-icon.js';
|
|
6
6
|
import styles from './notice.module.css.js';
|
|
7
7
|
|
|
8
|
-
function Notice(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
function Notice({
|
|
9
|
+
id,
|
|
10
|
+
children,
|
|
11
|
+
tone
|
|
12
|
+
}) {
|
|
12
13
|
return /*#__PURE__*/createElement(Box, {
|
|
13
14
|
id: id,
|
|
14
15
|
role: "alert",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notice.js","sources":["../../../src/new-components/notice/notice.tsx"],"sourcesContent":["import * as React from 'react'\nimport {
|
|
1
|
+
{"version":3,"file":"notice.js","sources":["../../../src/new-components/notice/notice.tsx"],"sourcesContent":["import * as React from 'react'\nimport { getClassNames } from '../responsive-props'\nimport { Box } from '../box'\nimport { Columns, Column } from '../columns'\nimport { AlertIcon } from '../icons/alert-icon'\n\nimport type { AlertTone } from '../common-types'\n\nimport styles from './notice.module.css'\n\ntype NoticeProps = {\n id?: string\n children: React.ReactNode\n tone: AlertTone\n}\n\nfunction Notice({ id, children, tone }: NoticeProps) {\n return (\n <Box\n id={id}\n role=\"alert\"\n aria-live=\"polite\"\n className={[styles.container, getClassNames(styles, 'tone', tone)]}\n >\n <Columns space=\"small\" alignY=\"top\">\n <Column width=\"content\">\n <AlertIcon tone={tone} />\n </Column>\n <Column>\n <Box paddingY=\"xsmall\">{children}</Box>\n </Column>\n </Columns>\n </Box>\n )\n}\n\nexport { Notice }\nexport type { NoticeProps }\n"],"names":["Notice","id","children","tone","React","Box","role","className","styles","container","getClassNames","Columns","space","alignY","Column","width","AlertIcon","paddingY"],"mappings":";;;;;;;AAgBA,SAASA,MAAT,CAAgB;EAAEC,EAAF;EAAMC,QAAN;EAAgBC;AAAhB,CAAhB;EACI,oBACIC,aAAA,CAACC,GAAD;IACIJ,EAAE,EAAEA;IACJK,IAAI,EAAC;iBACK;IACVC,SAAS,EAAE,CAACC,MAAM,CAACC,SAAR,EAAmBC,aAAa,CAACF,MAAD,EAAS,MAAT,EAAiBL,IAAjB,CAAhC;GAJf,eAMIC,aAAA,CAACO,OAAD;IAASC,KAAK,EAAC;IAAQC,MAAM,EAAC;GAA9B,eACIT,aAAA,CAACU,MAAD;IAAQC,KAAK,EAAC;GAAd,eACIX,aAAA,CAACY,SAAD;IAAWb,IAAI,EAAEA;GAAjB,CADJ,CADJ,eAIIC,aAAA,CAACU,MAAD,MAAA,eACIV,aAAA,CAACC,GAAD;IAAKY,QAAQ,EAAC;GAAd,EAAwBf,QAAxB,CADJ,CAJJ,CANJ,CADJ;AAiBH;;;;"}
|