@ultraviolet/ui 1.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.
Files changed (115) hide show
  1. package/LICENSE +189 -0
  2. package/README.md +64 -0
  3. package/dist/index.d.ts +2427 -0
  4. package/dist/react-datepicker/dist/react-datepicker.min.css.js +3 -0
  5. package/dist/react-toastify/dist/ReactToastify.min.css.js +3 -0
  6. package/dist/src/components/ActionBar/index.js +55 -0
  7. package/dist/src/components/Alert/index.js +144 -0
  8. package/dist/src/components/Avatar/index.js +90 -0
  9. package/dist/src/components/Badge/index.js +143 -0
  10. package/dist/src/components/Banner/index.js +117 -0
  11. package/dist/src/components/BarChart/Tooltip.js +63 -0
  12. package/dist/src/components/BarChart/index.js +94 -0
  13. package/dist/src/components/BarStack/index.js +223 -0
  14. package/dist/src/components/Breadcrumbs/index.js +89 -0
  15. package/dist/src/components/Bullet/index.js +137 -0
  16. package/dist/src/components/Button/index.js +303 -0
  17. package/dist/src/components/Card/index.js +81 -0
  18. package/dist/src/components/Carousel/index.js +162 -0
  19. package/dist/src/components/Checkbox/index.js +338 -0
  20. package/dist/src/components/CopyButton/index.js +92 -0
  21. package/dist/src/components/DateInput/index.js +250 -0
  22. package/dist/src/components/EmptyState/index.js +124 -0
  23. package/dist/src/components/Expandable/index.js +84 -0
  24. package/dist/src/components/Icon/index.js +350 -0
  25. package/dist/src/components/LineChart/CustomLegend.js +147 -0
  26. package/dist/src/components/LineChart/Tooltip.js +58 -0
  27. package/dist/src/components/LineChart/helpers.js +75 -0
  28. package/dist/src/components/LineChart/index.js +139 -0
  29. package/dist/src/components/Link/index.js +159 -0
  30. package/dist/src/components/List/Body.js +22 -0
  31. package/dist/src/components/List/Cell.js +38 -0
  32. package/dist/src/components/List/HeaderCell.js +118 -0
  33. package/dist/src/components/List/HeaderRow.js +47 -0
  34. package/dist/src/components/List/ListContext.js +120 -0
  35. package/dist/src/components/List/Row.js +211 -0
  36. package/dist/src/components/List/SelectBar.js +52 -0
  37. package/dist/src/components/List/SkeletonRows.js +54 -0
  38. package/dist/src/components/List/constants.js +3 -0
  39. package/dist/src/components/List/index.js +77 -0
  40. package/dist/src/components/Loader/index.js +87 -0
  41. package/dist/src/components/Menu/Item.js +122 -0
  42. package/dist/src/components/Menu/index.js +143 -0
  43. package/dist/src/components/Modal/index.js +279 -0
  44. package/dist/src/components/Notice/index.js +33 -0
  45. package/dist/src/components/NumberInput/helpers.js +6 -0
  46. package/dist/src/components/NumberInput/index.js +366 -0
  47. package/dist/src/components/Pagination/getPageNumbers.js +32 -0
  48. package/dist/src/components/Pagination/index.js +118 -0
  49. package/dist/src/components/PasswordCheck/index.js +42 -0
  50. package/dist/src/components/PasswordStrengthMeter/index.js +116 -0
  51. package/dist/src/components/PieChart/Legends.js +183 -0
  52. package/dist/src/components/PieChart/Tooltip.js +64 -0
  53. package/dist/src/components/PieChart/index.js +133 -0
  54. package/dist/src/components/PieChart/patterns.js +9 -0
  55. package/dist/src/components/Popover/index.js +131 -0
  56. package/dist/src/components/ProgressBar/index.js +72 -0
  57. package/dist/src/components/Radio/index.js +231 -0
  58. package/dist/src/components/Row/index.js +43 -0
  59. package/dist/src/components/SelectInput/index.js +662 -0
  60. package/dist/src/components/SelectableCard/index.js +154 -0
  61. package/dist/src/components/Separator/index.js +91 -0
  62. package/dist/src/components/Skeleton/Block.js +53 -0
  63. package/dist/src/components/Skeleton/Blocks.js +52 -0
  64. package/dist/src/components/Skeleton/BoxWithIcon.js +47 -0
  65. package/dist/src/components/Skeleton/Donut.js +58 -0
  66. package/dist/src/components/Skeleton/IconSkeleton.js +37 -0
  67. package/dist/src/components/Skeleton/Line.js +19 -0
  68. package/dist/src/components/Skeleton/List.js +60 -0
  69. package/dist/src/components/Skeleton/Slider.js +57 -0
  70. package/dist/src/components/Skeleton/index.js +85 -0
  71. package/dist/src/components/Snippet/index.js +250 -0
  72. package/dist/src/components/Stack/index.js +24 -0
  73. package/dist/src/components/Status/index.js +101 -0
  74. package/dist/src/components/StepList/index.js +81 -0
  75. package/dist/src/components/Stepper/index.js +217 -0
  76. package/dist/src/components/SwitchButton/FocusOverlay.js +47 -0
  77. package/dist/src/components/SwitchButton/index.js +131 -0
  78. package/dist/src/components/Table/Body.js +12 -0
  79. package/dist/src/components/Table/Cell.js +27 -0
  80. package/dist/src/components/Table/Header.js +21 -0
  81. package/dist/src/components/Table/HeaderCell.js +119 -0
  82. package/dist/src/components/Table/HeaderRow.js +35 -0
  83. package/dist/src/components/Table/Row.js +70 -0
  84. package/dist/src/components/Table/SelectBar.js +52 -0
  85. package/dist/src/components/Table/SkeletonRows.js +52 -0
  86. package/dist/src/components/Table/TableContext.js +91 -0
  87. package/dist/src/components/Table/index.js +84 -0
  88. package/dist/src/components/Tabs/Tab.js +165 -0
  89. package/dist/src/components/Tabs/TabMenu.js +46 -0
  90. package/dist/src/components/Tabs/TabMenuItem.js +40 -0
  91. package/dist/src/components/Tabs/TabsContext.js +6 -0
  92. package/dist/src/components/Tabs/index.js +117 -0
  93. package/dist/src/components/Tag/index.js +177 -0
  94. package/dist/src/components/TagInput/index.js +277 -0
  95. package/dist/src/components/TagList/index.js +110 -0
  96. package/dist/src/components/Text/index.js +106 -0
  97. package/dist/src/components/TextInput/index.js +529 -0
  98. package/dist/src/components/TimeInput/index.js +38 -0
  99. package/dist/src/components/Toaster/index.js +116 -0
  100. package/dist/src/components/Toggle/index.js +192 -0
  101. package/dist/src/components/Tooltip/helpers.js +131 -0
  102. package/dist/src/components/Tooltip/index.js +275 -0
  103. package/dist/src/components/VerificationCode/index.js +203 -0
  104. package/dist/src/helpers/isJSON.js +11 -0
  105. package/dist/src/helpers/legend.js +13 -0
  106. package/dist/src/helpers/recursivelyGetChildrenString.js +12 -0
  107. package/dist/src/index.js +63 -0
  108. package/dist/src/theme/index.js +25 -0
  109. package/dist/src/utils/animations.js +250 -0
  110. package/dist/src/utils/capitalize.js +4 -0
  111. package/dist/src/utils/ids.js +12 -0
  112. package/dist/src/utils/normalize.js +36 -0
  113. package/dist/src/utils/responsive/Breakpoint.js +12 -0
  114. package/dist/src/utils/responsive/utilities.js +12 -0
  115. package/package.json +70 -0
@@ -0,0 +1,87 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { keyframes, useTheme, css } from '@emotion/react';
3
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
4
+
5
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
6
+ const VIEWBOX_WIDTH = 100;
7
+ const VIEWBOX_HEIGHT = 100;
8
+ const HALF_VIEWBOX_WIDTH = VIEWBOX_WIDTH / 2;
9
+ const HALF_VIEWBOX_HEIGHT = VIEWBOX_HEIGHT / 2;
10
+ const spin = keyframes`
11
+ from { transform: rotate(0deg); }
12
+ to { transform: rotate(360deg); }
13
+ `;
14
+ const Text = /*#__PURE__*/_styled('text', {
15
+ shouldForwardProp: prop => !['color'].includes(prop),
16
+ target: "e1y1n78x0"
17
+ })("fill:", _ref2 => {
18
+ let {
19
+ theme,
20
+ color
21
+ } = _ref2;
22
+ return theme.colors[color]?.backgroundStrong || color;
23
+ }, ";font-size:26px;dominant-baseline:middle;text-anchor:middle;");
24
+ var _ref = process.env.NODE_ENV === "production" ? {
25
+ name: "si0mpz",
26
+ styles: "transition:stroke-dashoffset 0.5s ease 0s"
27
+ } : {
28
+ name: "si0mpz",
29
+ styles: "transition:stroke-dashoffset 0.5s ease 0s",
30
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
31
+ };
32
+ const Loader = _ref3 => {
33
+ let {
34
+ percentage = 20,
35
+ text,
36
+ size = 40,
37
+ strokeWidth = 16,
38
+ color = 'primary',
39
+ trailColor = 'neutral',
40
+ active = false,
41
+ label = 'Loading'
42
+ } = _ref3;
43
+ const theme = useTheme();
44
+ const circleRadius = HALF_VIEWBOX_HEIGHT - strokeWidth / 2;
45
+ const boundedPercentage = Math.min(Math.max(percentage, 0), 100) / 100;
46
+ const circleDiameter = Math.PI * 2 * circleRadius;
47
+ return jsxs("svg", {
48
+ role: "progressbar",
49
+ "aria-label": label,
50
+ "aria-valuemin": 0,
51
+ "aria-valuemax": 100,
52
+ "aria-valuenow": percentage,
53
+ "aria-valuetext": `${percentage}%`,
54
+ css: active && /*#__PURE__*/css("animation:", spin, " 0.75s linear infinite;"),
55
+ viewBox: `0 0 ${VIEWBOX_WIDTH} ${VIEWBOX_HEIGHT}`,
56
+ style: {
57
+ height: typeof size === 'string' ? size : `${size}px`,
58
+ width: typeof size === 'string' ? size : `${size}px`
59
+ },
60
+ children: [jsx("circle", {
61
+ cx: HALF_VIEWBOX_WIDTH,
62
+ cy: HALF_VIEWBOX_HEIGHT,
63
+ r: circleRadius,
64
+ fill: "none",
65
+ strokeWidth: strokeWidth,
66
+ stroke: theme.colors[trailColor]?.borderWeak || trailColor
67
+ }), jsx("circle", {
68
+ css: _ref,
69
+ cx: HALF_VIEWBOX_WIDTH,
70
+ cy: HALF_VIEWBOX_HEIGHT,
71
+ r: circleRadius,
72
+ fill: "none",
73
+ strokeWidth: strokeWidth,
74
+ strokeDasharray: circleDiameter,
75
+ strokeDashoffset: (1 - boundedPercentage) * circleDiameter,
76
+ stroke: theme.colors[color]?.backgroundStrong || color,
77
+ strokeLinecap: "round"
78
+ }), text ? jsx(Text, {
79
+ color: color,
80
+ x: HALF_VIEWBOX_WIDTH,
81
+ y: HALF_VIEWBOX_HEIGHT,
82
+ children: text
83
+ }) : null]
84
+ });
85
+ };
86
+
87
+ export { Loader };
@@ -0,0 +1,122 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { forwardRef } from 'react';
3
+ import { Tooltip } from '../Tooltip/index.js';
4
+ import { jsx } from '@emotion/react/jsx-runtime';
5
+
6
+ const itemCoreStyle = _ref => {
7
+ let {
8
+ theme,
9
+ borderless,
10
+ sentiment,
11
+ disabled
12
+ } = _ref;
13
+ return `
14
+ display: inline-block;
15
+ font-size: ${theme.typography.bodySmall.fontSize};
16
+ line-height: ${theme.typography.bodySmall.lineHeight};
17
+ font-weight: inherit;
18
+ padding: ${`${theme.space['0.5']} ${theme.space['1']}`};
19
+ border: none;
20
+ ${borderless ? '' : `border-bottom: 1px solid ${theme.colors.neutral.border};`}
21
+ cursor: pointer;
22
+ min-width: 110px;
23
+
24
+ color: ${theme.colors[sentiment][disabled ? 'textDisabled' : 'text']};
25
+ svg {
26
+ fill: ${theme.colors[sentiment][disabled ? 'textDisabled' : 'text']};
27
+ }
28
+
29
+ ${disabled ? `
30
+ cursor: not-allowed;
31
+ ` : `
32
+ &:hover,
33
+ &:focus {
34
+ color: ${theme.colors[sentiment].textHover};
35
+ svg {
36
+ fill: ${theme.colors[sentiment].textHover};
37
+ }
38
+ }`}
39
+ `;
40
+ };
41
+ const StyledItem = /*#__PURE__*/_styled('button', {
42
+ shouldForwardProp: prop => !['borderless', 'sentiment'].includes(prop),
43
+ target: "e10f690h1"
44
+ })(_ref2 => {
45
+ let {
46
+ theme,
47
+ borderless,
48
+ sentiment,
49
+ disabled
50
+ } = _ref2;
51
+ return itemCoreStyle({
52
+ theme,
53
+ borderless,
54
+ sentiment,
55
+ disabled
56
+ });
57
+ }, " background:none;");
58
+ const StyledLinkItem = /*#__PURE__*/_styled('a', {
59
+ shouldForwardProp: prop => !['borderless', 'sentiment'].includes(prop),
60
+ target: "e10f690h0"
61
+ })(_ref3 => {
62
+ let {
63
+ theme,
64
+ borderless,
65
+ sentiment,
66
+ disabled
67
+ } = _ref3;
68
+ return itemCoreStyle({
69
+ theme,
70
+ borderless,
71
+ sentiment,
72
+ disabled
73
+ });
74
+ }, " text-decoration:none;&:focus{text-decoration:none;}");
75
+ const Item = /*#__PURE__*/forwardRef((_ref4, ref) => {
76
+ let {
77
+ borderless = false,
78
+ disabled = false,
79
+ onClick,
80
+ sentiment = 'neutral',
81
+ href,
82
+ children,
83
+ tooltip,
84
+ className,
85
+ 'data-testid': dataTestId
86
+ } = _ref4;
87
+ if (href && !disabled) {
88
+ return jsx(Tooltip, {
89
+ text: tooltip,
90
+ children: jsx(StyledLinkItem, {
91
+ borderless: true,
92
+ href: href,
93
+ ref: ref,
94
+ onClick: disabled ? undefined : onClick,
95
+ role: "menuitem",
96
+ disabled: disabled,
97
+ sentiment: sentiment,
98
+ className: className,
99
+ "data-testid": dataTestId,
100
+ children: children
101
+ })
102
+ });
103
+ }
104
+ return jsx(Tooltip, {
105
+ text: tooltip,
106
+ children: jsx(StyledItem, {
107
+ type: "button",
108
+ ref: ref,
109
+ role: "menuitem",
110
+ disabled: disabled,
111
+ onClick: onClick,
112
+ borderless: borderless,
113
+ sentiment: sentiment,
114
+ className: className,
115
+ "data-testid": dataTestId,
116
+ children: children
117
+ })
118
+ });
119
+ });
120
+ var Item$1 = Item;
121
+
122
+ export { Item$1 as default };
@@ -0,0 +1,143 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { css } from '@emotion/react';
3
+ import { forwardRef, isValidElement, useRef, useImperativeHandle, cloneElement } from 'react';
4
+ import { usePopoverState, PopoverDisclosure, Popover } from 'reakit/Popover';
5
+ import { Portal } from 'reakit/Portal';
6
+ import Item from './Item.js';
7
+ import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
8
+
9
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
10
+ const StyledPopover = /*#__PURE__*/_styled(Popover, {
11
+ target: "e1hqs9p51"
12
+ })("border-radius:", _ref => {
13
+ let {
14
+ theme
15
+ } = _ref;
16
+ return theme.radii.default;
17
+ }, ";background-color:", _ref2 => {
18
+ let {
19
+ theme
20
+ } = _ref2;
21
+ return theme.colors.neutral.background;
22
+ }, ";color:", _ref3 => {
23
+ let {
24
+ theme
25
+ } = _ref3;
26
+ return theme.colors.neutral.text;
27
+ }, ";box-shadow:", _ref4 => {
28
+ let {
29
+ theme
30
+ } = _ref4;
31
+ return theme.shadows.dropdown;
32
+ }, ";");
33
+ const bottomStyles = theme => /*#__PURE__*/css("box-shadow:", theme.shadows.menu, ";&:after,&:before{bottom:100%;}&:after{border-bottom-color:", theme.colors.neutral.background, ";}&:before{border-bottom-color:transparent;}");
34
+ const topStyles = theme => /*#__PURE__*/css("box-shadow:", theme.shadows.menu, ";&:after,&:before{top:100%;}&:after{border-top-color:", theme.colors.neutral.background, ";}&:before{border-top-color:rgba(165, 165, 205, 0.4);}");
35
+ const endStyles = process.env.NODE_ENV === "production" ? {
36
+ name: "15zu3sa",
37
+ styles: "&:after{margin-left:-9px;right:24px;}&:before{margin-left:-11px;right:24px;}"
38
+ } : {
39
+ name: "15zu3sa",
40
+ styles: "&:after{margin-left:-9px;right:24px;}&:before{margin-left:-11px;right:24px;}",
41
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
42
+ };
43
+ const startStyles = process.env.NODE_ENV === "production" ? {
44
+ name: "17k88rr",
45
+ styles: "&:after{margin-right:-9px;left:24px;}&:before{margin-right:-11px;left:24px;}"
46
+ } : {
47
+ name: "17k88rr",
48
+ styles: "&:after{margin-right:-9px;left:24px;}&:before{margin-right:-11px;left:24px;}",
49
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
50
+ };
51
+ const centerStyles = process.env.NODE_ENV === "production" ? {
52
+ name: "1qzrhtz",
53
+ styles: "&:after,&:before{left:50%;transform:translateX(-50%);}"
54
+ } : {
55
+ name: "1qzrhtz",
56
+ styles: "&:after,&:before{left:50%;transform:translateX(-50%);}",
57
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
58
+ };
59
+ const arrowPlacementStyles = {
60
+ bottom: theme => /*#__PURE__*/css(centerStyles, ";", bottomStyles(theme), ";"),
61
+ 'bottom-end': theme => /*#__PURE__*/css(endStyles, ";", bottomStyles(theme), ";"),
62
+ 'bottom-start': theme => /*#__PURE__*/css(startStyles, ";", bottomStyles(theme), ";"),
63
+ top: theme => /*#__PURE__*/css(centerStyles, ";", topStyles(theme), ";"),
64
+ 'top-end': theme => /*#__PURE__*/css(endStyles, ";", topStyles(theme), ";"),
65
+ 'top-start': theme => /*#__PURE__*/css(startStyles, ";", topStyles(theme), ";")
66
+ };
67
+ const MenuList = /*#__PURE__*/_styled("div", {
68
+ target: "e1hqs9p50"
69
+ })("&:after,&:before{border:solid transparent;border-width:9px;content:' ';height:0;width:0;position:absolute;pointer-events:none;}&:after{border-color:transparent;}&:before{border-color:transparent;}background-color:", _ref5 => {
70
+ let {
71
+ theme
72
+ } = _ref5;
73
+ return theme.colors.neutral.backgroundWeakElevated;
74
+ }, ";display:flex;flex-direction:column;text-align:center;justify-content:center;color:", _ref6 => {
75
+ let {
76
+ theme
77
+ } = _ref6;
78
+ return theme.colors.neutral.text;
79
+ }, ";border-radius:", _ref7 => {
80
+ let {
81
+ theme
82
+ } = _ref7;
83
+ return theme.radii.default;
84
+ }, ";position:relative;", _ref8 => {
85
+ let {
86
+ placement,
87
+ theme,
88
+ hasArrow
89
+ } = _ref8;
90
+ return hasArrow && arrowPlacementStyles[placement]?.(theme);
91
+ }, ";");
92
+ const FwdMenu = /*#__PURE__*/forwardRef((_ref9, ref) => {
93
+ let {
94
+ ariaLabel = 'Menu',
95
+ id,
96
+ children,
97
+ disclosure,
98
+ hasArrow = true,
99
+ placement = 'bottom',
100
+ visible = false,
101
+ className,
102
+ 'data-testid': dataTestId
103
+ } = _ref9;
104
+ const popover = usePopoverState({
105
+ baseId: id,
106
+ placement,
107
+ visible
108
+ });
109
+
110
+ // if you need dialog inside your component, use function, otherwise component is fine
111
+ const target = /*#__PURE__*/isValidElement(disclosure) ? disclosure : disclosure(popover);
112
+ const innerRef = useRef(target);
113
+ useImperativeHandle(ref, () => innerRef.current);
114
+ return jsxs(Fragment, {
115
+ children: [disclosure &&
116
+ // @ts-expect-error reakit types are invalid, no need to pass as something, default is div
117
+ jsx(PopoverDisclosure, {
118
+ ...popover,
119
+ ref: innerRef,
120
+ children: disclosureProps => /*#__PURE__*/cloneElement(target, disclosureProps)
121
+ }), jsx(Portal, {
122
+ children: jsx(StyledPopover, {
123
+ ...popover,
124
+ "aria-label": ariaLabel,
125
+ className: className,
126
+ children: /* Required to avoid loading menu content if not visible */
127
+ popover.visible ? jsx(MenuList, {
128
+ "data-testid": dataTestId,
129
+ className: className,
130
+ hasArrow: hasArrow,
131
+ placement: popover.placement,
132
+ role: "menu",
133
+ children: typeof children === 'function' ? children(popover) : children
134
+ }) : null
135
+ })
136
+ })]
137
+ });
138
+ });
139
+ const Menu = /*#__PURE__*/Object.assign(FwdMenu, {
140
+ Item
141
+ });
142
+
143
+ export { Menu };
@@ -0,0 +1,279 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { css } from '@emotion/react';
3
+ import { memo, useEffect, useCallback, isValidElement, useRef, cloneElement } from 'react';
4
+ import { useDialogState, DialogBackdrop, Dialog, DialogDisclosure } from 'reakit/Dialog';
5
+ import { Button } from '../Button/index.js';
6
+ import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
7
+ import { unfoldIn, unfoldOut, scaleForward, scaleBack, scaleUp, scaleDown, sketchIn, sketchOut, slideFromBottom, slideToBottom, slideFromLeft, slideToLeft, slideFromRight, slideToRight, slideFromTop, slideToTop, zoomIn, zoomOut } from '../../utils/animations.js';
8
+
9
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
10
+ const MODAL_WIDTH = {
11
+ large: 850,
12
+ medium: 708,
13
+ small: 616,
14
+ xsmall: 400,
15
+ xxsmall: 360
16
+ };
17
+ const MODAL_PLACEMENT = {
18
+ bottom: `
19
+ margin: auto;
20
+ margin-bottom: 0;
21
+ `,
22
+ 'bottom-left': `
23
+ margin: auto;
24
+ margin-left: 0;
25
+ margin-bottom: 0;
26
+ `,
27
+ 'bottom-right': `
28
+ margin: auto;
29
+ margin-right: 0;
30
+ margin-bottom: 0;
31
+ `,
32
+ center: `
33
+ margin: auto;
34
+ `,
35
+ left: `
36
+ margin: auto;
37
+ margin-left: 0;
38
+ `,
39
+ right: `
40
+ margin: auto;
41
+ margin-right: 0;
42
+ `,
43
+ top: `
44
+ margin: auto;
45
+ margin-top: 0px;
46
+ `,
47
+ 'top-left': `
48
+ margin: auto;
49
+ margin-left: 0;
50
+ margin-top: 0;
51
+ `,
52
+ 'top-right': `
53
+ margin: auto;
54
+ margin-right: 0;
55
+ margin-top: 0;
56
+ `
57
+ };
58
+ const MODAL_ANIMATION = {
59
+ fold: {
60
+ enter: unfoldIn,
61
+ leave: unfoldOut
62
+ },
63
+ scaleBack: {
64
+ enter: scaleForward,
65
+ leave: scaleBack
66
+ },
67
+ scaleUp: {
68
+ enter: scaleUp,
69
+ leave: scaleDown
70
+ },
71
+ sketch: {
72
+ enter: sketchIn,
73
+ leave: sketchOut
74
+ },
75
+ slideBottom: {
76
+ enter: slideFromBottom,
77
+ leave: slideToBottom
78
+ },
79
+ slideLeft: {
80
+ enter: slideFromLeft,
81
+ leave: slideToLeft
82
+ },
83
+ slideRight: {
84
+ enter: slideFromRight,
85
+ leave: slideToRight
86
+ },
87
+ slideTop: {
88
+ enter: slideFromTop,
89
+ leave: slideToTop
90
+ },
91
+ zoom: {
92
+ enter: zoomIn,
93
+ leave: zoomOut
94
+ }
95
+ };
96
+ const backdropAnimatedStyle = `
97
+ opacity: 0;
98
+ transition: opacity 250ms ease-in-out;
99
+ &[data-enter] {
100
+ opacity: 1;
101
+ transition: opacity 250ms ease-in-out;
102
+ }
103
+ &[data-leave] {
104
+ opacity: 0;
105
+ transition: opacity 400ms ease-in-out;
106
+ }
107
+ `;
108
+ const dialogAnimatedStyle = _ref => {
109
+ let {
110
+ animation
111
+ } = _ref;
112
+ return /*#__PURE__*/css("opacity:0;&[data-enter]{opacity:1;transition:opacity 500ms ease-in-out;animation:", MODAL_ANIMATION[animation].enter, " 500ms cubic-bezier(0.165, 0.84, 0.44, 1) forwards;}&[data-leave]{opacity:0;transition:opacity 500ms ease-in-out;animation:", MODAL_ANIMATION[animation].leave, " 500ms cubic-bezier(0.165, 0.84, 0.44, 1) forwards;}");
113
+ };
114
+ const Disclosure = _ref2 => {
115
+ let {
116
+ disclosure,
117
+ dialog
118
+ } = _ref2;
119
+ // if you need dialog inside your component, use function, otherwise component is fine
120
+ const target = /*#__PURE__*/isValidElement(disclosure) ? disclosure : disclosure(dialog);
121
+ const innerRef = useRef(target);
122
+ return (
123
+ // @ts-expect-error reakit types are invalid, no need to pass as something, default is div
124
+ jsx(DialogDisclosure, {
125
+ ...dialog,
126
+ ref: innerRef,
127
+ children: disclosureProps => /*#__PURE__*/cloneElement(target, disclosureProps)
128
+ })
129
+ );
130
+ };
131
+ const MemoDisclosure = /*#__PURE__*/memo(Disclosure);
132
+ const StyledDialogBackdrop = /*#__PURE__*/_styled(DialogBackdrop, {
133
+ target: "ebywm9u2"
134
+ })("display:flex;position:fixed;overflow:auto;padding:16px;top:0;bottom:0;right:0;left:0;opacity:1;background-color:", _ref3 => {
135
+ let {
136
+ theme
137
+ } = _ref3;
138
+ return theme.colors.overlay;
139
+ }, ";", _ref4 => {
140
+ let {
141
+ animated
142
+ } = _ref4;
143
+ return animated && backdropAnimatedStyle;
144
+ }, ";");
145
+ const StyledDialog = /*#__PURE__*/_styled(Dialog, {
146
+ shouldForwardProp: prop => !['animation', 'placement', 'width', 'height', 'bordered'].includes(prop),
147
+ target: "ebywm9u1"
148
+ })("background-color:", _ref5 => {
149
+ let {
150
+ theme
151
+ } = _ref5;
152
+ return theme.colors.neutral.backgroundWeakElevated;
153
+ }, ";position:relative;border-radius:", _ref6 => {
154
+ let {
155
+ bordered,
156
+ theme
157
+ } = _ref6;
158
+ return bordered ? theme.radii.default : theme.radii.none;
159
+ }, ";border:0;padding:32px;", _ref7 => {
160
+ let {
161
+ placement
162
+ } = _ref7;
163
+ return MODAL_PLACEMENT[placement];
164
+ }, " width:", _ref8 => {
165
+ let {
166
+ width
167
+ } = _ref8;
168
+ return MODAL_WIDTH[width];
169
+ }, "px;min-height:", _ref9 => {
170
+ let {
171
+ height
172
+ } = _ref9;
173
+ return height;
174
+ }, ";box-shadow:", _ref10 => {
175
+ let {
176
+ theme
177
+ } = _ref10;
178
+ return theme.shadows.modal;
179
+ }, ";opacity:1;&::before{content:'';height:100%;width:100%;}", _ref11 => {
180
+ let {
181
+ animated,
182
+ animation
183
+ } = _ref11;
184
+ return animated && dialogAnimatedStyle({
185
+ animation
186
+ });
187
+ }, ";");
188
+ const StyledContainer = /*#__PURE__*/_styled("div", {
189
+ target: "ebywm9u0"
190
+ })(process.env.NODE_ENV === "production" ? {
191
+ name: "et21s3",
192
+ styles: "display:flex;flex-grow:1;flex-wrap:wrap;justify-content:flex-end;position:absolute;top:16px;right:16px;left:16px"
193
+ } : {
194
+ name: "et21s3",
195
+ styles: "display:flex;flex-grow:1;flex-wrap:wrap;justify-content:flex-end;position:absolute;top:16px;right:16px;left:16px",
196
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
197
+ });
198
+ const Modal = /*#__PURE__*/memo(_ref12 => {
199
+ let {
200
+ animated = false,
201
+ animation = 'zoom',
202
+ ariaLabel = 'modal',
203
+ id,
204
+ bordered = true,
205
+ children,
206
+ customDialogBackdropStyles,
207
+ customDialogStyles = {},
208
+ disclosure,
209
+ height = 'initial',
210
+ hideOnClickOutside = true,
211
+ hideOnEsc = true,
212
+ isClosable = true,
213
+ modal = true,
214
+ onClose,
215
+ onBeforeClose,
216
+ opened = false,
217
+ placement = 'center',
218
+ preventBodyScroll = true,
219
+ width = 'small',
220
+ className,
221
+ 'data-testid': dataTestId
222
+ } = _ref12;
223
+ const dialog = useDialogState({
224
+ animated,
225
+ baseId: id,
226
+ modal,
227
+ visible: opened
228
+ });
229
+ const {
230
+ setVisible
231
+ } = dialog;
232
+ useEffect(() => setVisible(opened), [setVisible, opened]);
233
+ const onCloseCallBack = useCallback(async () => {
234
+ await onBeforeClose?.();
235
+ dialog.toggle();
236
+ }, [dialog, onBeforeClose]);
237
+ return jsxs(Fragment, {
238
+ children: [disclosure && jsx(MemoDisclosure, {
239
+ dialog: dialog,
240
+ disclosure: disclosure
241
+ }), jsx(StyledDialogBackdrop, {
242
+ ...dialog,
243
+ css: customDialogBackdropStyles,
244
+ children: jsx(StyledDialog, {
245
+ "aria-label": ariaLabel,
246
+ role: "dialog",
247
+ tabIndex: 0,
248
+ animation: animation,
249
+ bordered: bordered,
250
+ height: height,
251
+ placement: placement,
252
+ width: width,
253
+ css: customDialogStyles,
254
+ hideOnClickOutside: hideOnClickOutside,
255
+ hideOnEsc: hideOnEsc,
256
+ preventBodyScroll: preventBodyScroll,
257
+ ...dialog,
258
+ hide: onClose || onCloseCallBack,
259
+ className: className,
260
+ "data-testid": dataTestId,
261
+ children: jsxs(Fragment, {
262
+ children: [dialog.visible && (typeof children === 'function' ? children(dialog) : children), jsx(StyledContainer, {
263
+ children: isClosable && jsx(Button, {
264
+ "data-testid": dataTestId ? `${dataTestId}-close-button` : undefined,
265
+ onClick: onClose || onCloseCallBack,
266
+ variant: "ghost",
267
+ size: "small",
268
+ icon: "close",
269
+ sentiment: "neutral",
270
+ "aria-label": "close"
271
+ })
272
+ })]
273
+ })
274
+ })
275
+ })]
276
+ });
277
+ });
278
+
279
+ export { MODAL_ANIMATION, MODAL_PLACEMENT, MODAL_WIDTH, Modal };
@@ -0,0 +1,33 @@
1
+ import { Icon } from '../Icon/index.js';
2
+ import { Stack } from '../Stack/index.js';
3
+ import { Text } from '../Text/index.js';
4
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
5
+
6
+ const Notice = _ref => {
7
+ let {
8
+ children,
9
+ className,
10
+ 'data-testid': dataTestId
11
+ } = _ref;
12
+ return jsxs(Stack, {
13
+ direction: "row",
14
+ alignItems: "center",
15
+ gap: 1,
16
+ "data-testid": dataTestId,
17
+ className: className,
18
+ children: [jsx(Icon, {
19
+ name: "information-outline",
20
+ size: 20,
21
+ color: "neutral",
22
+ prominence: "weak"
23
+ }), typeof children === 'string' ? jsx(Text, {
24
+ as: "p",
25
+ variant: "caption",
26
+ color: "neutral",
27
+ prominence: "weak",
28
+ children: children
29
+ }) : children]
30
+ });
31
+ };
32
+
33
+ export { Notice };
@@ -0,0 +1,6 @@
1
+ const bounded = (value, min, max) => Math.max(min, Math.min(value, max));
2
+ const roundStep = (value, step, direction) => direction === -1 ? Math.floor(value / step) * step : Math.ceil(value / step) * step;
3
+ const getMinusRoundedValue = (currentValue, step) => currentValue % step === 0 ? roundStep(currentValue - step, step, -1) : roundStep(currentValue, step, -1);
4
+ const getPlusRoundedValue = (currentValue, step) => currentValue % step === 0 ? roundStep(currentValue + step, step, 1) : roundStep(currentValue, step, 1);
5
+
6
+ export { bounded, getMinusRoundedValue, getPlusRoundedValue, roundStep };