@marigold/components 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActionGroup/ActionGroup.d.ts +9 -0
- package/dist/ActionGroup/index.d.ts +1 -0
- package/dist/Alert/Alert.d.ts +20 -2
- package/dist/Badge/Badge.d.ts +8 -0
- package/dist/Badge/index.d.ts +1 -0
- package/dist/Box/Box.d.ts +47 -0
- package/dist/Box/index.d.ts +1 -0
- package/dist/Button/Button.d.ts +4 -3
- package/dist/Card/Card.d.ts +9 -0
- package/dist/Card/index.d.ts +1 -0
- package/dist/Checkbox/Checkbox.d.ts +14 -2
- package/dist/Checkbox/CheckboxIcons.d.ts +9 -0
- package/dist/Column/Column.d.ts +8 -0
- package/dist/Column/index.d.ts +1 -0
- package/dist/Columns/Columns.d.ts +10 -0
- package/dist/Columns/index.d.ts +1 -0
- package/dist/Container/Container.d.ts +6 -0
- package/dist/Container/index.d.ts +1 -0
- package/dist/Dialog/Dialog.d.ts +14 -0
- package/dist/Dialog/ModalDialog.d.ts +5 -0
- package/dist/Dialog/index.d.ts +1 -0
- package/dist/Divider/Divider.d.ts +7 -0
- package/dist/Divider/index.d.ts +1 -0
- package/dist/Field/Field.d.ts +11 -0
- package/dist/Field/index.d.ts +1 -0
- package/dist/Heading/Heading.d.ts +7 -5
- package/dist/Hidden/Hidden.d.ts +5 -0
- package/dist/Hidden/index.d.ts +1 -0
- package/dist/Image/Image.d.ts +7 -0
- package/dist/Image/index.d.ts +1 -0
- package/dist/Input/Input.d.ts +6 -0
- package/dist/Input/index.d.ts +1 -0
- package/dist/Label/Label.d.ts +8 -5
- package/dist/Link/Link.d.ts +7 -3
- package/dist/Menu/Menu.d.ts +12 -0
- package/dist/Menu/index.d.ts +1 -0
- package/dist/MenuItem/MenuItem.d.ts +7 -0
- package/dist/MenuItem/index.d.ts +1 -0
- package/dist/Message/Message.d.ts +7 -0
- package/dist/Message/index.d.ts +1 -0
- package/dist/Provider/MarigoldProvider.d.ts +3 -0
- package/dist/Provider/index.d.ts +3 -0
- package/dist/Radio/Radio.d.ts +14 -2
- package/dist/Radio/RadioIcons.d.ts +9 -0
- package/dist/Select/ListBox.d.ts +8 -0
- package/dist/Select/ListBoxSection.d.ts +8 -0
- package/dist/Select/Option.d.ts +8 -0
- package/dist/Select/Popover.d.ts +9 -0
- package/dist/Select/Select.d.ts +13 -3
- package/dist/Slider/Slider.d.ts +6 -3
- package/dist/Stack/Stack.d.ts +7 -0
- package/dist/Stack/index.d.ts +1 -0
- package/dist/Text/Text.d.ts +12 -3
- package/dist/Textarea/Textarea.d.ts +11 -3
- package/dist/ValidationMessage/ValidationMessage.d.ts +6 -0
- package/dist/ValidationMessage/index.d.ts +1 -0
- package/dist/components.cjs.development.js +1308 -195
- package/dist/components.cjs.development.js.map +1 -1
- package/dist/components.cjs.production.min.js +1 -1
- package/dist/components.cjs.production.min.js.map +1 -1
- package/dist/components.esm.js +1267 -185
- package/dist/components.esm.js.map +1 -1
- package/dist/index.d.ts +21 -4
- package/dist/theme.d.ts +24 -4
- package/package.json +24 -4
- package/src/ActionGroup/ActionGroup.stories.mdx +62 -0
- package/src/ActionGroup/ActionGroup.test.tsx +83 -0
- package/src/ActionGroup/ActionGroup.tsx +43 -0
- package/src/ActionGroup/index.ts +1 -0
- package/src/Alert/Alert.stories.mdx +30 -42
- package/src/Alert/Alert.test.tsx +37 -22
- package/src/Alert/Alert.tsx +31 -21
- package/src/Badge/Badge.stories.mdx +57 -0
- package/src/Badge/Badge.test.tsx +61 -0
- package/src/Badge/Badge.tsx +25 -0
- package/src/Badge/index.ts +1 -0
- package/src/Box/Box.stories.mdx +334 -0
- package/src/Box/Box.test.tsx +133 -0
- package/src/Box/Box.tsx +165 -0
- package/src/Box/index.ts +1 -0
- package/src/Button/Button.stories.mdx +58 -134
- package/src/Button/Button.test.tsx +65 -23
- package/src/Button/Button.tsx +48 -14
- package/src/Card/Card.stories.mdx +49 -0
- package/src/Card/Card.test.tsx +66 -0
- package/src/Card/Card.tsx +36 -0
- package/src/Card/index.ts +1 -0
- package/src/Checkbox/Checkbox.stories.mdx +79 -101
- package/src/Checkbox/Checkbox.test.tsx +73 -32
- package/src/Checkbox/Checkbox.tsx +114 -35
- package/src/Checkbox/CheckboxIcons.tsx +49 -0
- package/src/Column/Column.stories.mdx +49 -0
- package/src/Column/Column.test.tsx +32 -0
- package/src/Column/Column.tsx +27 -0
- package/src/Column/index.ts +1 -0
- package/src/Columns/Columns.stories.mdx +65 -0
- package/src/Columns/Columns.test.tsx +102 -0
- package/src/Columns/Columns.tsx +69 -0
- package/src/Columns/index.ts +1 -0
- package/src/Container/Container.stories.mdx +19 -0
- package/src/Container/Container.test.tsx +26 -0
- package/src/Container/Container.tsx +13 -0
- package/src/Container/index.ts +1 -0
- package/src/Dialog/Dialog.stories.mdx +73 -0
- package/src/Dialog/Dialog.test.tsx +87 -0
- package/src/Dialog/Dialog.tsx +84 -0
- package/src/Dialog/ModalDialog.tsx +47 -0
- package/src/Dialog/index.ts +1 -0
- package/src/Divider/Divider.stories.mdx +37 -0
- package/src/Divider/Divider.test.tsx +63 -0
- package/src/Divider/Divider.tsx +13 -0
- package/src/Divider/index.ts +1 -0
- package/src/Field/Field.stories.mdx +97 -0
- package/src/Field/Field.test.tsx +80 -0
- package/src/Field/Field.tsx +54 -0
- package/src/Field/index.ts +1 -0
- package/src/Heading/Heading.stories.mdx +36 -76
- package/src/Heading/Heading.test.tsx +31 -17
- package/src/Heading/Heading.tsx +15 -12
- package/src/Hidden/Hidden.stories.mdx +39 -0
- package/src/Hidden/Hidden.test.tsx +24 -0
- package/src/Hidden/Hidden.tsx +16 -0
- package/src/Hidden/index.ts +1 -0
- package/src/Image/Image.stories.mdx +36 -0
- package/src/Image/Image.test.tsx +70 -0
- package/src/Image/Image.tsx +13 -0
- package/src/Image/index.ts +1 -0
- package/src/Input/Input.stories.mdx +61 -0
- package/src/Input/Input.test.tsx +70 -0
- package/src/Input/Input.tsx +13 -0
- package/src/Input/index.ts +1 -0
- package/src/Label/Label.stories.mdx +50 -34
- package/src/Label/Label.test.tsx +45 -16
- package/src/Label/Label.tsx +26 -17
- package/src/Link/Link.stories.mdx +40 -31
- package/src/Link/Link.test.tsx +53 -28
- package/src/Link/Link.tsx +32 -14
- package/src/Menu/Menu.stories.mdx +81 -0
- package/src/Menu/Menu.test.tsx +79 -0
- package/src/Menu/Menu.tsx +41 -0
- package/src/Menu/index.ts +1 -0
- package/src/MenuItem/MenuItem.stories.mdx +37 -0
- package/src/MenuItem/MenuItem.test.tsx +63 -0
- package/src/MenuItem/MenuItem.tsx +23 -0
- package/src/MenuItem/index.ts +1 -0
- package/src/Message/Message.stories.mdx +44 -0
- package/src/Message/Message.test.tsx +87 -0
- package/src/Message/Message.tsx +43 -0
- package/src/Message/index.ts +1 -0
- package/src/Provider/MarigoldProvider.test.tsx +126 -0
- package/src/Provider/MarigoldProvider.tsx +29 -0
- package/src/Provider/index.ts +3 -0
- package/src/Radio/Radio.stories.mdx +80 -83
- package/src/Radio/Radio.test.tsx +63 -22
- package/src/Radio/Radio.tsx +110 -35
- package/src/Radio/RadioIcons.tsx +39 -0
- package/src/Select/ListBox.tsx +39 -0
- package/src/Select/ListBoxSection.tsx +40 -0
- package/src/Select/Option.tsx +48 -0
- package/src/Select/Popover.tsx +50 -0
- package/src/Select/Select.stories.mdx +72 -37
- package/src/Select/Select.test.tsx +271 -28
- package/src/Select/Select.tsx +158 -23
- package/src/Slider/Slider.stories.mdx +26 -54
- package/src/Slider/Slider.test.tsx +13 -13
- package/src/Slider/Slider.tsx +20 -18
- package/src/Stack/Stack.stories.mdx +51 -0
- package/src/Stack/Stack.test.tsx +129 -0
- package/src/Stack/Stack.tsx +39 -0
- package/src/Stack/index.ts +1 -0
- package/src/Text/Text.stories.mdx +53 -47
- package/src/Text/Text.test.tsx +55 -15
- package/src/Text/Text.tsx +44 -10
- package/src/Textarea/Textarea.stories.mdx +68 -21
- package/src/Textarea/Textarea.test.tsx +47 -16
- package/src/Textarea/Textarea.tsx +46 -14
- package/src/ValidationMessage/ValidationMessage.stories.mdx +36 -0
- package/src/ValidationMessage/ValidationMessage.test.tsx +63 -0
- package/src/ValidationMessage/ValidationMessage.tsx +28 -0
- package/src/ValidationMessage/index.ts +1 -0
- package/src/index.ts +22 -4
- package/src/theme.ts +24 -4
- package/dist/Svg/Svg.d.ts +0 -5
- package/dist/Svg/index.d.ts +0 -1
- package/dist/TextInput/TextInput.d.ts +0 -3
- package/dist/TextInput/index.d.ts +0 -1
- package/src/Svg/Svg.stories.mdx +0 -47
- package/src/Svg/Svg.test.tsx +0 -58
- package/src/Svg/Svg.tsx +0 -25
- package/src/Svg/index.ts +0 -1
- package/src/TextInput/TextInput.stories.mdx +0 -37
- package/src/TextInput/TextInput.test.tsx +0 -71
- package/src/TextInput/TextInput.tsx +0 -21
- package/src/TextInput/index.ts +0 -1
package/dist/components.esm.js
CHANGED
|
@@ -1,7 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import React, { forwardRef, Children, useRef, useState, useEffect } from 'react';
|
|
2
|
+
import flattenChildren from 'react-keyed-flatten-children';
|
|
3
|
+
import { Element, useStyles, ThemeProvider } from '@marigold/system';
|
|
4
|
+
export { ThemeProvider, useTheme } from '@marigold/system';
|
|
5
|
+
import { Check, Notification, Exclamation, SVG, Required, Close, Info, ArrowUp, ArrowDown } from '@marigold/icons';
|
|
6
|
+
import { useButton } from '@react-aria/button';
|
|
7
|
+
import { useOverlayTriggerState } from '@react-stately/overlays';
|
|
8
|
+
import { useOverlay, usePreventScroll, useModal, OverlayContainer, OverlayProvider, DismissButton, useOverlayTrigger, useOverlayPosition } from '@react-aria/overlays';
|
|
9
|
+
import { useDialog } from '@react-aria/dialog';
|
|
10
|
+
import { FocusScope, useFocusRing } from '@react-aria/focus';
|
|
11
|
+
import { useLink } from '@react-aria/link';
|
|
12
|
+
export { SSRProvider } from '@react-aria/ssr';
|
|
13
|
+
import { useSelectState } from '@react-stately/select';
|
|
14
|
+
import { mergeProps } from '@react-aria/utils';
|
|
15
|
+
import { useSelect, HiddenSelect } from '@react-aria/select';
|
|
16
|
+
import { useOption, useListBoxSection, useListBox } from '@react-aria/listbox';
|
|
17
|
+
export { Item, Section } from '@react-stately/collections';
|
|
18
|
+
|
|
19
|
+
function _extends() {
|
|
20
|
+
_extends = Object.assign || function (target) {
|
|
21
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
22
|
+
var source = arguments[i];
|
|
23
|
+
|
|
24
|
+
for (var key in source) {
|
|
25
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
26
|
+
target[key] = source[key];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return _extends.apply(this, arguments);
|
|
35
|
+
}
|
|
5
36
|
|
|
6
37
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
7
38
|
if (source == null) return {};
|
|
@@ -18,37 +49,406 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
18
49
|
return target;
|
|
19
50
|
}
|
|
20
51
|
|
|
21
|
-
|
|
52
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
53
|
+
if (!o) return;
|
|
54
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
55
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
56
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
57
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
58
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function _arrayLikeToArray(arr, len) {
|
|
62
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
63
|
+
|
|
64
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
65
|
+
|
|
66
|
+
return arr2;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
70
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
71
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
72
|
+
|
|
73
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
74
|
+
if (it) o = it;
|
|
75
|
+
var i = 0;
|
|
76
|
+
return function () {
|
|
77
|
+
if (i >= o.length) return {
|
|
78
|
+
done: true
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
done: false,
|
|
82
|
+
value: o[i++]
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var _excluded = ["variant", "as", "css", "children", "className", "display", "height", "width", "minWidth", "maxWidth", "position", "top", "bottom", "right", "left", "zIndex", "p", "px", "py", "pt", "pb", "pl", "pr", "m", "mx", "my", "mt", "mb", "ml", "mr", "flexDirection", "flexWrap", "flexShrink", "flexGrow", "alignItems", "justifyContent", "bg", "border", "borderRadius", "boxShadow", "opacity", "overflow", "transition"];
|
|
91
|
+
var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
92
|
+
var variant = _ref.variant,
|
|
93
|
+
_ref$as = _ref.as,
|
|
94
|
+
as = _ref$as === void 0 ? 'div' : _ref$as,
|
|
95
|
+
css = _ref.css,
|
|
96
|
+
children = _ref.children,
|
|
97
|
+
className = _ref.className,
|
|
98
|
+
display = _ref.display,
|
|
99
|
+
height = _ref.height,
|
|
100
|
+
width = _ref.width,
|
|
101
|
+
minWidth = _ref.minWidth,
|
|
102
|
+
maxWidth = _ref.maxWidth,
|
|
103
|
+
position = _ref.position,
|
|
104
|
+
top = _ref.top,
|
|
105
|
+
bottom = _ref.bottom,
|
|
106
|
+
right = _ref.right,
|
|
107
|
+
left = _ref.left,
|
|
108
|
+
zIndex = _ref.zIndex,
|
|
109
|
+
p = _ref.p,
|
|
110
|
+
px = _ref.px,
|
|
111
|
+
py = _ref.py,
|
|
112
|
+
pt = _ref.pt,
|
|
113
|
+
pb = _ref.pb,
|
|
114
|
+
pl = _ref.pl,
|
|
115
|
+
pr = _ref.pr,
|
|
116
|
+
m = _ref.m,
|
|
117
|
+
mx = _ref.mx,
|
|
118
|
+
my = _ref.my,
|
|
119
|
+
mt = _ref.mt,
|
|
120
|
+
mb = _ref.mb,
|
|
121
|
+
ml = _ref.ml,
|
|
122
|
+
mr = _ref.mr,
|
|
123
|
+
flexDirection = _ref.flexDirection,
|
|
124
|
+
flexWrap = _ref.flexWrap,
|
|
125
|
+
flexShrink = _ref.flexShrink,
|
|
126
|
+
flexGrow = _ref.flexGrow,
|
|
127
|
+
alignItems = _ref.alignItems,
|
|
128
|
+
justifyContent = _ref.justifyContent,
|
|
129
|
+
bg = _ref.bg,
|
|
130
|
+
border = _ref.border,
|
|
131
|
+
borderRadius = _ref.borderRadius,
|
|
132
|
+
boxShadow = _ref.boxShadow,
|
|
133
|
+
opacity = _ref.opacity,
|
|
134
|
+
overflow = _ref.overflow,
|
|
135
|
+
transition = _ref.transition,
|
|
136
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
137
|
+
|
|
138
|
+
return React.createElement(Element, Object.assign({
|
|
139
|
+
as: as,
|
|
140
|
+
ref: ref,
|
|
141
|
+
variant: variant,
|
|
142
|
+
css: _extends({}, {
|
|
143
|
+
display: display,
|
|
144
|
+
height: height,
|
|
145
|
+
width: width,
|
|
146
|
+
minWidth: minWidth,
|
|
147
|
+
maxWidth: maxWidth,
|
|
148
|
+
position: position,
|
|
149
|
+
top: top,
|
|
150
|
+
bottom: bottom,
|
|
151
|
+
right: right,
|
|
152
|
+
left: left,
|
|
153
|
+
zIndex: zIndex,
|
|
154
|
+
p: p,
|
|
155
|
+
px: px,
|
|
156
|
+
py: py,
|
|
157
|
+
pt: pt,
|
|
158
|
+
pb: pb,
|
|
159
|
+
pl: pl,
|
|
160
|
+
pr: pr,
|
|
161
|
+
m: m,
|
|
162
|
+
mx: mx,
|
|
163
|
+
my: my,
|
|
164
|
+
mt: mt,
|
|
165
|
+
mb: mb,
|
|
166
|
+
ml: ml,
|
|
167
|
+
mr: mr,
|
|
168
|
+
flexDirection: flexDirection,
|
|
169
|
+
flexWrap: flexWrap,
|
|
170
|
+
flexShrink: flexShrink,
|
|
171
|
+
flexGrow: flexGrow,
|
|
172
|
+
alignItems: alignItems,
|
|
173
|
+
justifyContent: justifyContent,
|
|
174
|
+
bg: bg,
|
|
175
|
+
border: border,
|
|
176
|
+
borderRadius: borderRadius,
|
|
177
|
+
boxShadow: boxShadow,
|
|
178
|
+
opacity: opacity,
|
|
179
|
+
overflow: overflow,
|
|
180
|
+
transition: transition
|
|
181
|
+
}, css),
|
|
182
|
+
className: className
|
|
183
|
+
}, props), children);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
var _excluded$1 = ["variant", "space", "verticalAlignment", "children", "className"];
|
|
187
|
+
var ActionGroup = function ActionGroup(_ref) {
|
|
22
188
|
var _ref$variant = _ref.variant,
|
|
23
|
-
variant = _ref$variant === void 0 ? '
|
|
189
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
190
|
+
_ref$space = _ref.space,
|
|
191
|
+
space = _ref$space === void 0 ? 'none' : _ref$space,
|
|
192
|
+
_ref$verticalAlignmen = _ref.verticalAlignment,
|
|
193
|
+
verticalAlignment = _ref$verticalAlignmen === void 0 ? false : _ref$verticalAlignmen,
|
|
24
194
|
children = _ref.children,
|
|
25
|
-
|
|
195
|
+
className = _ref.className,
|
|
196
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
26
197
|
|
|
198
|
+
var childStyle = verticalAlignment ? {
|
|
199
|
+
marginBottom: space
|
|
200
|
+
} : {
|
|
201
|
+
marginRight: space
|
|
202
|
+
};
|
|
27
203
|
return React.createElement(Box, Object.assign({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
204
|
+
variant: "actionGroup." + variant,
|
|
205
|
+
className: className
|
|
206
|
+
}, props), Children.map(flattenChildren(children), function (child, i) {
|
|
207
|
+
return child !== null && child !== undefined && React.createElement(Box, {
|
|
208
|
+
as: verticalAlignment ? 'div' : 'span',
|
|
209
|
+
css: i < Children.count(children) - 1 ? childStyle : undefined
|
|
210
|
+
}, child);
|
|
211
|
+
}));
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
var _excluded$2 = ["variant", "children"];
|
|
215
|
+
var ICON_MAP = {
|
|
216
|
+
success: Check,
|
|
217
|
+
warning: Notification,
|
|
218
|
+
error: Exclamation
|
|
219
|
+
};
|
|
220
|
+
var Alert = function Alert(_ref) {
|
|
221
|
+
var _ref$variant = _ref.variant,
|
|
222
|
+
variant = _ref$variant === void 0 ? 'success' : _ref$variant,
|
|
223
|
+
children = _ref.children,
|
|
224
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
225
|
+
|
|
226
|
+
var Icon = ICON_MAP[variant];
|
|
227
|
+
return React.createElement(Box, Object.assign({}, props, {
|
|
228
|
+
display: "flex",
|
|
229
|
+
variant: "alerts." + variant
|
|
230
|
+
}), React.createElement(Box, {
|
|
231
|
+
display: "inline-block",
|
|
232
|
+
alignItems: "center",
|
|
233
|
+
width: "32px",
|
|
234
|
+
height: "32px",
|
|
235
|
+
bg: variant
|
|
236
|
+
}, React.createElement(Box, {
|
|
237
|
+
as: Icon,
|
|
238
|
+
size: 12,
|
|
239
|
+
color: "#fff",
|
|
240
|
+
bg: variant,
|
|
241
|
+
m: 10
|
|
242
|
+
})), React.createElement(Box, {
|
|
243
|
+
mx: "16px"
|
|
244
|
+
}, children));
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
var _excluded$3 = ["variant", "bgColor", "borderColor", "children"];
|
|
248
|
+
var Badge = function Badge(_ref) {
|
|
249
|
+
var _ref$variant = _ref.variant,
|
|
250
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
251
|
+
_ref$bgColor = _ref.bgColor,
|
|
252
|
+
bgColor = _ref$bgColor === void 0 ? 'transparent' : _ref$bgColor,
|
|
253
|
+
_ref$borderColor = _ref.borderColor,
|
|
254
|
+
borderColor = _ref$borderColor === void 0 ? 'transparent' : _ref$borderColor,
|
|
255
|
+
children = _ref.children,
|
|
256
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
257
|
+
|
|
258
|
+
return React.createElement(Box, Object.assign({
|
|
259
|
+
css: {
|
|
260
|
+
bg: bgColor,
|
|
261
|
+
borderColor: borderColor
|
|
262
|
+
},
|
|
263
|
+
variant: "badge." + variant
|
|
264
|
+
}, props), children);
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
var _excluded$4 = ["as", "variant", "size", "disabled", "children", "className"];
|
|
268
|
+
var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
269
|
+
var _ref$as = _ref.as,
|
|
270
|
+
as = _ref$as === void 0 ? 'button' : _ref$as,
|
|
271
|
+
_ref$variant = _ref.variant,
|
|
272
|
+
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
273
|
+
_ref$size = _ref.size,
|
|
274
|
+
size = _ref$size === void 0 ? 'large' : _ref$size,
|
|
275
|
+
disabled = _ref.disabled,
|
|
276
|
+
children = _ref.children,
|
|
277
|
+
className = _ref.className,
|
|
278
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
279
|
+
|
|
280
|
+
var _useButton = useButton(_extends({}, props, {
|
|
281
|
+
elementType: typeof as === 'string' ? as : 'span',
|
|
282
|
+
isDisabled: disabled
|
|
283
|
+
}), ref),
|
|
284
|
+
buttonProps = _useButton.buttonProps;
|
|
285
|
+
|
|
286
|
+
return React.createElement(Box, Object.assign({}, buttonProps, props, {
|
|
287
|
+
as: as,
|
|
288
|
+
variant: ["button." + variant, "button." + size],
|
|
289
|
+
className: className,
|
|
290
|
+
ref: ref
|
|
291
|
+
}), React.createElement(Box, {
|
|
292
|
+
as: "span",
|
|
293
|
+
display: "inline-flex",
|
|
294
|
+
alignItems: "center"
|
|
36
295
|
}, children));
|
|
37
296
|
});
|
|
38
297
|
|
|
39
|
-
var
|
|
298
|
+
var _excluded$5 = ["variant", "title", "width", "className", "children"];
|
|
299
|
+
var Card = function Card(_ref) {
|
|
40
300
|
var _ref$variant = _ref.variant,
|
|
41
|
-
variant = _ref$variant === void 0 ? '
|
|
42
|
-
|
|
301
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
302
|
+
title = _ref.title,
|
|
303
|
+
width = _ref.width,
|
|
304
|
+
className = _ref.className,
|
|
305
|
+
children = _ref.children,
|
|
306
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
43
307
|
|
|
44
|
-
return React.createElement(Box, {
|
|
308
|
+
return React.createElement(Box, Object.assign({}, props, {
|
|
309
|
+
variant: "card." + variant,
|
|
310
|
+
maxWidth: width,
|
|
311
|
+
className: className
|
|
312
|
+
}), title && React.createElement(Box, {
|
|
313
|
+
as: "h2",
|
|
314
|
+
variant: "text.h2",
|
|
315
|
+
pb: "small"
|
|
316
|
+
}, title), children);
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
var _excluded$6 = ["disabled"],
|
|
320
|
+
_excluded2 = ["disabled", "error"];
|
|
321
|
+
var CheckboxChecked = function CheckboxChecked(_ref) {
|
|
322
|
+
var _ref$disabled = _ref.disabled,
|
|
323
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
324
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
325
|
+
|
|
326
|
+
return React.createElement(SVG, Object.assign({
|
|
327
|
+
width: "16",
|
|
328
|
+
height: "32",
|
|
329
|
+
viewBox: "0 0 16 32",
|
|
330
|
+
fill: "none"
|
|
331
|
+
}, props), React.createElement(Box, {
|
|
332
|
+
as: "rect",
|
|
333
|
+
x: "0.5",
|
|
334
|
+
y: "8.5",
|
|
335
|
+
width: "15px",
|
|
336
|
+
height: "15px",
|
|
337
|
+
rx: "1.5",
|
|
338
|
+
variant: disabled ? 'checkbox.checked.disabled' : 'checkbox.checked'
|
|
339
|
+
}), React.createElement(Box, {
|
|
340
|
+
as: "path",
|
|
341
|
+
fillRule: "evenodd",
|
|
342
|
+
clipRule: "evenodd",
|
|
343
|
+
d: "M13.9571 12.8338L12.4085 11.2852L6.08699 17.6007L3.59887 15.1126L2.04163 16.6588L6.08682 20.704L13.9571 12.8338Z",
|
|
344
|
+
variant: "checkbox.checked.icon"
|
|
345
|
+
}));
|
|
346
|
+
};
|
|
347
|
+
var CheckboxUnchecked = function CheckboxUnchecked(_ref2) {
|
|
348
|
+
var _ref2$disabled = _ref2.disabled,
|
|
349
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
350
|
+
_ref2$error = _ref2.error,
|
|
351
|
+
error = _ref2$error === void 0 ? false : _ref2$error,
|
|
352
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
353
|
+
|
|
354
|
+
return React.createElement(SVG, Object.assign({
|
|
355
|
+
width: "16",
|
|
356
|
+
height: "32",
|
|
357
|
+
viewBox: "0 0 16 32",
|
|
358
|
+
fill: "none"
|
|
359
|
+
}, props), React.createElement(Box, {
|
|
360
|
+
as: "rect",
|
|
361
|
+
x: "0.5",
|
|
362
|
+
y: "8.5",
|
|
363
|
+
width: "15px",
|
|
364
|
+
height: "15px",
|
|
365
|
+
rx: "1.5",
|
|
366
|
+
variant: disabled ? 'checkbox.unchecked.disabled' : error ? 'checkbox.unchecked.error' : 'checkbox.unchecked'
|
|
367
|
+
}));
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
var _excluded$7 = ["variant", "required", "children"];
|
|
371
|
+
var Label = function Label(_ref) {
|
|
372
|
+
var _ref$variant = _ref.variant,
|
|
373
|
+
variant = _ref$variant === void 0 ? 'above' : _ref$variant,
|
|
374
|
+
required = _ref.required,
|
|
375
|
+
children = _ref.children,
|
|
376
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
377
|
+
|
|
378
|
+
return required ? React.createElement(Box, {
|
|
379
|
+
as: "span",
|
|
380
|
+
display: "inline-flex",
|
|
381
|
+
alignItems: "center"
|
|
382
|
+
}, React.createElement(Box, Object.assign({}, props, {
|
|
383
|
+
as: "label",
|
|
384
|
+
variant: "label." + variant
|
|
385
|
+
}), children), required && React.createElement(Box, {
|
|
386
|
+
as: Required,
|
|
387
|
+
size: 16,
|
|
45
388
|
css: {
|
|
46
|
-
|
|
389
|
+
color: 'red60'
|
|
47
390
|
}
|
|
391
|
+
})) : React.createElement(Box, Object.assign({}, props, {
|
|
392
|
+
as: "label",
|
|
393
|
+
variant: "label." + variant
|
|
394
|
+
}), children);
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
var _excluded$8 = ["variant", "children", "className"];
|
|
398
|
+
var ValidationMessage = function ValidationMessage(_ref) {
|
|
399
|
+
var _ref$variant = _ref.variant,
|
|
400
|
+
variant = _ref$variant === void 0 ? 'error' : _ref$variant,
|
|
401
|
+
children = _ref.children,
|
|
402
|
+
className = _ref.className,
|
|
403
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
404
|
+
|
|
405
|
+
return React.createElement(Box, Object.assign({
|
|
406
|
+
as: "span",
|
|
407
|
+
display: "flex",
|
|
408
|
+
alignItems: "center",
|
|
409
|
+
variant: "validation." + variant,
|
|
410
|
+
className: className
|
|
411
|
+
}, props), children);
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
var _excluded$9 = ["className", "variant", "error"],
|
|
415
|
+
_excluded2$1 = ["label", "required", "error", "errorMessage"];
|
|
416
|
+
|
|
417
|
+
var CheckboxIcon = function CheckboxIcon(_ref) {
|
|
418
|
+
var variant = _ref.variant,
|
|
419
|
+
checked = _ref.checked,
|
|
420
|
+
disabled = _ref.disabled,
|
|
421
|
+
error = _ref.error;
|
|
422
|
+
|
|
423
|
+
if (checked) {
|
|
424
|
+
return React.createElement(Box, {
|
|
425
|
+
as: CheckboxChecked,
|
|
426
|
+
variant: "checkbox." + variant,
|
|
427
|
+
disabled: disabled
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
return React.createElement(Box, {
|
|
432
|
+
as: CheckboxUnchecked,
|
|
433
|
+
variant: "checkbox." + variant,
|
|
434
|
+
disabled: disabled,
|
|
435
|
+
error: error
|
|
436
|
+
});
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
var CheckboxInput = function CheckboxInput(_ref2) {
|
|
440
|
+
var className = _ref2.className,
|
|
441
|
+
_ref2$variant = _ref2.variant,
|
|
442
|
+
variant = _ref2$variant === void 0 ? 'default' : _ref2$variant,
|
|
443
|
+
error = _ref2.error,
|
|
444
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded$9);
|
|
445
|
+
|
|
446
|
+
return React.createElement(Box, {
|
|
447
|
+
display: "inline-block",
|
|
448
|
+
className: className
|
|
48
449
|
}, React.createElement(Box, Object.assign({
|
|
49
450
|
as: "input",
|
|
50
|
-
type: "checkbox"
|
|
51
|
-
}, props, {
|
|
451
|
+
type: "checkbox",
|
|
52
452
|
css: {
|
|
53
453
|
position: 'absolute',
|
|
54
454
|
opacity: 0,
|
|
@@ -57,79 +457,546 @@ var Checkbox = /*#__PURE__*/system(function (_ref) {
|
|
|
57
457
|
height: 1,
|
|
58
458
|
overflow: 'hidden'
|
|
59
459
|
}
|
|
60
|
-
})), React.createElement(
|
|
61
|
-
|
|
62
|
-
"aria-hidden": "true",
|
|
63
|
-
themeSection: "form",
|
|
460
|
+
}, props)), React.createElement(CheckboxIcon, {
|
|
461
|
+
checked: props.checked,
|
|
64
462
|
variant: variant,
|
|
463
|
+
disabled: props.disabled,
|
|
464
|
+
error: error
|
|
465
|
+
}));
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
var Checkbox = function Checkbox(_ref3) {
|
|
469
|
+
var label = _ref3.label,
|
|
470
|
+
required = _ref3.required,
|
|
471
|
+
error = _ref3.error,
|
|
472
|
+
errorMessage = _ref3.errorMessage,
|
|
473
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded2$1);
|
|
474
|
+
|
|
475
|
+
if (label) {
|
|
476
|
+
return React.createElement(React.Fragment, null, React.createElement(Label, {
|
|
477
|
+
htmlFor: props.id,
|
|
478
|
+
required: required,
|
|
479
|
+
variant: props.disabled ? 'disabled' : 'inline'
|
|
480
|
+
}, React.createElement(Box, Object.assign({
|
|
481
|
+
as: CheckboxInput,
|
|
482
|
+
pr: "8px",
|
|
483
|
+
error: error
|
|
484
|
+
}, props)), label), error && errorMessage && React.createElement(ValidationMessage, null, React.createElement(Exclamation, {
|
|
485
|
+
size: 16
|
|
486
|
+
}), errorMessage));
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return React.createElement(CheckboxInput, Object.assign({}, props));
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
var _excluded$a = ["width", "children"];
|
|
493
|
+
|
|
494
|
+
var transform = function transform(width) {
|
|
495
|
+
if (Array.isArray(width)) {
|
|
496
|
+
return width.map(function (v) {
|
|
497
|
+
return v / 12 * 100 + "%";
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
return width / 12 * 100 + "%";
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
var Column = function Column(_ref) {
|
|
505
|
+
var _ref$width = _ref.width,
|
|
506
|
+
width = _ref$width === void 0 ? 12 : _ref$width,
|
|
507
|
+
children = _ref.children,
|
|
508
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
509
|
+
|
|
510
|
+
return React.createElement(Box, Object.assign({}, props, {
|
|
511
|
+
width: transform(width)
|
|
512
|
+
}), children);
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
var _excluded$b = ["space", "horizontalAlign", "verticalAlign", "className", "children"];
|
|
516
|
+
var Columns = function Columns(_ref) {
|
|
517
|
+
var _ref$space = _ref.space,
|
|
518
|
+
space = _ref$space === void 0 ? 0 : _ref$space,
|
|
519
|
+
_ref$horizontalAlign = _ref.horizontalAlign,
|
|
520
|
+
horizontalAlign = _ref$horizontalAlign === void 0 ? 'left' : _ref$horizontalAlign,
|
|
521
|
+
_ref$verticalAlign = _ref.verticalAlign,
|
|
522
|
+
verticalAlign = _ref$verticalAlign === void 0 ? 'top' : _ref$verticalAlign,
|
|
523
|
+
className = _ref.className,
|
|
524
|
+
children = _ref.children,
|
|
525
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
526
|
+
|
|
527
|
+
var columnItems = flattenChildren(children);
|
|
528
|
+
var childClassNames = useStyles({
|
|
65
529
|
css: {
|
|
66
|
-
|
|
67
|
-
verticalAlign: 'middle',
|
|
68
|
-
':hover': {
|
|
69
|
-
cursor: 'pointer'
|
|
70
|
-
},
|
|
71
|
-
'input:disabled ~ &': {
|
|
72
|
-
color: 'muted',
|
|
73
|
-
cursor: 'not-allowed'
|
|
74
|
-
}
|
|
530
|
+
p: space / 2 + "px"
|
|
75
531
|
}
|
|
76
|
-
})
|
|
77
|
-
|
|
532
|
+
}); // horizontal Alignment
|
|
533
|
+
|
|
534
|
+
var justify = 'flex-start';
|
|
535
|
+
|
|
536
|
+
if (horizontalAlign === 'right') {
|
|
537
|
+
justify = 'flex-end';
|
|
538
|
+
} else if (horizontalAlign === 'center') {
|
|
539
|
+
justify = 'center';
|
|
540
|
+
} // vertical Alignment
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
var alignItems = 'flex-start';
|
|
544
|
+
|
|
545
|
+
if (verticalAlign === 'bottom') {
|
|
546
|
+
alignItems = 'flex-end';
|
|
547
|
+
} else if (verticalAlign === 'center') {
|
|
548
|
+
alignItems = 'center';
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
return React.createElement(Box, {
|
|
552
|
+
p: space + "px",
|
|
553
|
+
display: "flex",
|
|
554
|
+
className: className
|
|
555
|
+
}, React.createElement(Box, Object.assign({
|
|
556
|
+
width: "calc(100% + " + space + "px)",
|
|
557
|
+
m: -space / 2 + "px",
|
|
558
|
+
display: "flex",
|
|
559
|
+
flexWrap: "wrap",
|
|
560
|
+
alignItems: alignItems,
|
|
561
|
+
justifyContent: justify
|
|
562
|
+
}, props), Children.map(columnItems, function (child) {
|
|
563
|
+
return React.cloneElement(child, {
|
|
564
|
+
className: childClassNames
|
|
565
|
+
}, React.createElement(Box, {
|
|
566
|
+
className: child && child.props.className
|
|
567
|
+
}, child.props.children));
|
|
568
|
+
})));
|
|
569
|
+
};
|
|
78
570
|
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
571
|
+
var _excluded$c = ["as", "variant", "children"];
|
|
572
|
+
var Heading = function Heading(_ref) {
|
|
573
|
+
var _ref$as = _ref.as,
|
|
574
|
+
as = _ref$as === void 0 ? 'h2' : _ref$as,
|
|
575
|
+
_ref$variant = _ref.variant,
|
|
576
|
+
variant = _ref$variant === void 0 ? 'h2' : _ref$variant,
|
|
82
577
|
children = _ref.children,
|
|
83
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
578
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
579
|
+
|
|
580
|
+
return React.createElement(Box, Object.assign({}, props, {
|
|
581
|
+
as: as,
|
|
582
|
+
variant: "text." + variant
|
|
583
|
+
}), children);
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
var _excluded$d = ["children"];
|
|
587
|
+
var ModalDialog = function ModalDialog(_ref) {
|
|
588
|
+
var children = _ref.children,
|
|
589
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
|
590
|
+
|
|
591
|
+
// Handle interacting outside the dialog and pressing
|
|
592
|
+
// the Escape key to close the modal.
|
|
593
|
+
var ref = React.useRef();
|
|
594
|
+
|
|
595
|
+
var _useOverlay = useOverlay(props, ref),
|
|
596
|
+
overlayProps = _useOverlay.overlayProps,
|
|
597
|
+
underlayProps = _useOverlay.underlayProps; // Prevent scrolling while the modal is open, and hide content
|
|
598
|
+
// outside the modal from screen readers.
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
usePreventScroll();
|
|
602
|
+
|
|
603
|
+
var _useModal = useModal(),
|
|
604
|
+
modalProps = _useModal.modalProps;
|
|
605
|
+
|
|
606
|
+
var _useDialog = useDialog(props, ref),
|
|
607
|
+
dialogProps = _useDialog.dialogProps;
|
|
84
608
|
|
|
85
609
|
return React.createElement(Box, Object.assign({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
610
|
+
variant: "dialog.modalWrapper"
|
|
611
|
+
}, underlayProps), React.createElement(FocusScope, {
|
|
612
|
+
contain: true,
|
|
613
|
+
restoreFocus: true,
|
|
614
|
+
autoFocus: true
|
|
615
|
+
}, React.createElement(Box, Object.assign({}, overlayProps, dialogProps, modalProps, {
|
|
616
|
+
ref: ref,
|
|
617
|
+
variant: "dialog.modalBody"
|
|
618
|
+
}), children)));
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
var _excluded$e = ["children", "title", "className", "isOpen", "close"];
|
|
622
|
+
var Dialog = function Dialog(_ref) {
|
|
623
|
+
var children = _ref.children,
|
|
624
|
+
title = _ref.title,
|
|
625
|
+
className = _ref.className,
|
|
626
|
+
isOpen = _ref.isOpen,
|
|
627
|
+
close = _ref.close,
|
|
628
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
|
629
|
+
|
|
630
|
+
var closeButtonRef = React.useRef(); // useButton ensures that focus management is handled correctly,
|
|
631
|
+
// across all browsers. Focus is restored to the button once the
|
|
632
|
+
// dialog closes.
|
|
633
|
+
|
|
634
|
+
var _useButton = useButton({
|
|
635
|
+
onPress: function onPress() {
|
|
636
|
+
return close();
|
|
637
|
+
}
|
|
638
|
+
}, closeButtonRef),
|
|
639
|
+
closeButtonProps = _useButton.buttonProps;
|
|
640
|
+
|
|
641
|
+
return React.createElement(OverlayContainer, null, React.createElement(ModalDialog, {
|
|
642
|
+
isOpen: isOpen,
|
|
643
|
+
onClose: close,
|
|
644
|
+
isDismissable: true
|
|
645
|
+
}, React.createElement(Box, Object.assign({
|
|
646
|
+
variant: "dialog.wrapper",
|
|
647
|
+
className: className
|
|
648
|
+
}, props), React.createElement(Box, {
|
|
649
|
+
variant: "dialog.body"
|
|
650
|
+
}, title && React.createElement(Heading, {
|
|
651
|
+
as: "h4",
|
|
652
|
+
variant: "h4"
|
|
653
|
+
}, title), children), React.createElement(Box, {
|
|
654
|
+
variant: "dialog.onClose"
|
|
655
|
+
}, React.createElement(Button, Object.assign({
|
|
656
|
+
variant: "close",
|
|
657
|
+
size: "xsmall"
|
|
658
|
+
}, closeButtonProps, {
|
|
659
|
+
ref: closeButtonRef
|
|
660
|
+
}), React.createElement(Close, {
|
|
661
|
+
size: 16
|
|
662
|
+
}))))));
|
|
663
|
+
}; // use this hook to get the overlayTriggerState and openButton props for using the dialog component
|
|
664
|
+
|
|
665
|
+
var useDialogButtonProps = function useDialogButtonProps() {
|
|
666
|
+
var state = useOverlayTriggerState({});
|
|
667
|
+
var openButtonRef = React.useRef();
|
|
668
|
+
|
|
669
|
+
var _useButton2 = useButton({
|
|
670
|
+
onPress: function onPress() {
|
|
671
|
+
return state.open();
|
|
672
|
+
}
|
|
673
|
+
}, openButtonRef),
|
|
674
|
+
openButtonProps = _useButton2.buttonProps;
|
|
675
|
+
|
|
676
|
+
return {
|
|
677
|
+
state: state,
|
|
678
|
+
openButtonProps: openButtonProps,
|
|
679
|
+
openButtonRef: openButtonRef
|
|
680
|
+
};
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
var _excluded$f = ["variant"];
|
|
684
|
+
var Divider = function Divider(_ref) {
|
|
685
|
+
var _ref$variant = _ref.variant,
|
|
686
|
+
variant = _ref$variant === void 0 ? 'regular' : _ref$variant,
|
|
687
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
|
|
91
688
|
|
|
92
|
-
|
|
689
|
+
return React.createElement(Box, Object.assign({}, props, {
|
|
690
|
+
as: "hr",
|
|
691
|
+
variant: "divider." + variant
|
|
692
|
+
}));
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
var _excluded$g = ["variant", "type"];
|
|
696
|
+
var Input = function Input(_ref) {
|
|
93
697
|
var _ref$variant = _ref.variant,
|
|
94
|
-
variant = _ref$variant === void 0 ? '
|
|
698
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
699
|
+
_ref$type = _ref.type,
|
|
700
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
701
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$g);
|
|
702
|
+
|
|
703
|
+
return React.createElement(Box, Object.assign({}, props, {
|
|
704
|
+
as: "input",
|
|
705
|
+
type: type,
|
|
706
|
+
variant: "input." + variant
|
|
707
|
+
}));
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
var _excluded$h = ["type", "className", "htmlFor", "label", "required", "error", "errorMessage", "disabled"];
|
|
711
|
+
var Field = function Field(_ref) {
|
|
712
|
+
var _ref$type = _ref.type,
|
|
713
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
714
|
+
className = _ref.className,
|
|
95
715
|
htmlFor = _ref.htmlFor,
|
|
716
|
+
label = _ref.label,
|
|
717
|
+
required = _ref.required,
|
|
718
|
+
error = _ref.error,
|
|
719
|
+
errorMessage = _ref.errorMessage,
|
|
720
|
+
disabled = _ref.disabled,
|
|
721
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$h);
|
|
722
|
+
|
|
723
|
+
return React.createElement(React.Fragment, null, React.createElement(Label, {
|
|
724
|
+
variant: disabled ? 'disabled' : 'above',
|
|
725
|
+
htmlFor: htmlFor,
|
|
726
|
+
required: required
|
|
727
|
+
}, label), React.createElement(Input, Object.assign({}, props, {
|
|
728
|
+
type: type,
|
|
729
|
+
id: htmlFor,
|
|
730
|
+
disabled: disabled,
|
|
731
|
+
variant: error ? 'error' : 'default',
|
|
732
|
+
className: className
|
|
733
|
+
})), error && errorMessage && React.createElement(ValidationMessage, null, React.createElement(Exclamation, {
|
|
734
|
+
size: 16
|
|
735
|
+
}), errorMessage));
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
var _excluded$i = ["show", "children"];
|
|
739
|
+
var Hidden = function Hidden(_ref) {
|
|
740
|
+
var _ref$show = _ref.show,
|
|
741
|
+
show = _ref$show === void 0 ? false : _ref$show,
|
|
96
742
|
children = _ref.children,
|
|
97
|
-
props = _objectWithoutPropertiesLoose(_ref,
|
|
743
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$i);
|
|
98
744
|
|
|
99
|
-
return React.createElement(Box, Object.assign({
|
|
100
|
-
as: "
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}, props), children);
|
|
105
|
-
});
|
|
745
|
+
return React.createElement(Box, Object.assign({}, props, {
|
|
746
|
+
as: "span",
|
|
747
|
+
display: show ? 'display' : 'none'
|
|
748
|
+
}), children);
|
|
749
|
+
};
|
|
106
750
|
|
|
107
|
-
var
|
|
751
|
+
var _excluded$j = ["variant"];
|
|
752
|
+
var Image = function Image(_ref) {
|
|
108
753
|
var _ref$variant = _ref.variant,
|
|
754
|
+
variant = _ref$variant === void 0 ? 'fullWidth' : _ref$variant,
|
|
755
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$j);
|
|
756
|
+
|
|
757
|
+
return React.createElement(Box, Object.assign({}, props, {
|
|
758
|
+
as: "img",
|
|
759
|
+
variant: "images." + variant
|
|
760
|
+
}));
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
var _excluded$k = ["as", "variant", "children", "className", "align", "color", "cursor", "outline", "userSelect"];
|
|
764
|
+
var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
765
|
+
var _ref$as = _ref.as,
|
|
766
|
+
as = _ref$as === void 0 ? 'span' : _ref$as,
|
|
767
|
+
_ref$variant = _ref.variant,
|
|
768
|
+
variant = _ref$variant === void 0 ? 'body' : _ref$variant,
|
|
769
|
+
children = _ref.children,
|
|
770
|
+
className = _ref.className,
|
|
771
|
+
align = _ref.align,
|
|
772
|
+
color = _ref.color,
|
|
773
|
+
cursor = _ref.cursor,
|
|
774
|
+
outline = _ref.outline,
|
|
775
|
+
userSelect = _ref.userSelect,
|
|
776
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$k);
|
|
777
|
+
|
|
778
|
+
return React.createElement(Box, Object.assign({}, props, {
|
|
779
|
+
as: as,
|
|
780
|
+
variant: "text." + variant,
|
|
781
|
+
css: {
|
|
782
|
+
textAlign: align,
|
|
783
|
+
color: color,
|
|
784
|
+
cursor: cursor,
|
|
785
|
+
outline: outline,
|
|
786
|
+
userSelect: userSelect
|
|
787
|
+
},
|
|
788
|
+
className: className,
|
|
789
|
+
ref: ref
|
|
790
|
+
}), children);
|
|
791
|
+
});
|
|
792
|
+
|
|
793
|
+
var _excluded$l = ["as", "variant", "children", "disabled"];
|
|
794
|
+
var Link = function Link(_ref) {
|
|
795
|
+
var _ref$as = _ref.as,
|
|
796
|
+
as = _ref$as === void 0 ? 'a' : _ref$as,
|
|
797
|
+
_ref$variant = _ref.variant,
|
|
109
798
|
variant = _ref$variant === void 0 ? 'link' : _ref$variant,
|
|
110
799
|
children = _ref.children,
|
|
111
|
-
|
|
800
|
+
disabled = _ref.disabled,
|
|
801
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
|
112
802
|
|
|
113
|
-
|
|
114
|
-
|
|
803
|
+
var ref = useRef();
|
|
804
|
+
|
|
805
|
+
var _useLink = useLink(_extends({}, props, {
|
|
806
|
+
elementType: typeof as === 'string' ? as : 'span',
|
|
807
|
+
isDisabled: disabled
|
|
808
|
+
}), ref),
|
|
809
|
+
linkProps = _useLink.linkProps;
|
|
810
|
+
|
|
811
|
+
return React.createElement(Text, Object.assign({}, props, linkProps, {
|
|
812
|
+
as: as,
|
|
115
813
|
variant: variant,
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
}
|
|
814
|
+
ref: ref
|
|
815
|
+
}), children);
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
var _excluded$m = ["variant", "label", "onClick", "show", "children"];
|
|
819
|
+
var Menu = function Menu(_ref) {
|
|
820
|
+
var _ref$variant = _ref.variant,
|
|
821
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
822
|
+
_ref$label = _ref.label,
|
|
823
|
+
label = _ref$label === void 0 ? 'Menu' : _ref$label,
|
|
824
|
+
onClick = _ref.onClick,
|
|
825
|
+
_ref$show = _ref.show,
|
|
826
|
+
show = _ref$show === void 0 ? false : _ref$show,
|
|
827
|
+
children = _ref.children,
|
|
828
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$m);
|
|
119
829
|
|
|
120
|
-
|
|
830
|
+
return React.createElement(Box, Object.assign({
|
|
831
|
+
variant: "menu." + variant
|
|
832
|
+
}, props), React.createElement(Button, {
|
|
833
|
+
onClick: onClick,
|
|
834
|
+
variant: "menu"
|
|
835
|
+
}, label), show ? React.createElement(Box, {
|
|
836
|
+
display: "block",
|
|
837
|
+
position: "absolute",
|
|
838
|
+
minWidth: "120px",
|
|
839
|
+
borderRadius: "2px"
|
|
840
|
+
}, children) : null);
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
var _excluded$n = ["variant", "className", "children"];
|
|
844
|
+
var MenuItem = function MenuItem(_ref) {
|
|
121
845
|
var _ref$variant = _ref.variant,
|
|
122
|
-
variant = _ref$variant === void 0 ? '
|
|
123
|
-
|
|
846
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
847
|
+
className = _ref.className,
|
|
848
|
+
children = _ref.children,
|
|
849
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$n);
|
|
124
850
|
|
|
125
851
|
return React.createElement(Box, {
|
|
852
|
+
variant: "menuItem." + variant,
|
|
853
|
+
className: className
|
|
854
|
+
}, React.createElement(Link, Object.assign({
|
|
855
|
+
variant: "menuItemLink"
|
|
856
|
+
}, props), children));
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
var _excluded$o = ["messageTitle", "variant", "className", "children"];
|
|
860
|
+
var Message = function Message(_ref) {
|
|
861
|
+
var messageTitle = _ref.messageTitle,
|
|
862
|
+
_ref$variant = _ref.variant,
|
|
863
|
+
variant = _ref$variant === void 0 ? 'info' : _ref$variant,
|
|
864
|
+
className = _ref.className,
|
|
865
|
+
children = _ref.children,
|
|
866
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$o);
|
|
867
|
+
|
|
868
|
+
var icon = React.createElement(Info, null);
|
|
869
|
+
|
|
870
|
+
if (variant === 'warning') {
|
|
871
|
+
icon = React.createElement(Notification, null);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
if (variant === 'error') {
|
|
875
|
+
icon = React.createElement(Exclamation, null);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
return React.createElement(Box, Object.assign({
|
|
879
|
+
display: "inline-block",
|
|
880
|
+
variant: "messages." + variant,
|
|
881
|
+
className: className
|
|
882
|
+
}, props), React.createElement(Box, {
|
|
883
|
+
display: "flex",
|
|
884
|
+
alignItems: "center",
|
|
885
|
+
variant: "messages.title"
|
|
886
|
+
}, icon, React.createElement(Heading, {
|
|
887
|
+
as: "h4",
|
|
888
|
+
variant: "h4"
|
|
889
|
+
}, messageTitle)), React.createElement(Box, {
|
|
126
890
|
css: {
|
|
127
|
-
|
|
891
|
+
color: 'black'
|
|
128
892
|
}
|
|
893
|
+
}, children));
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
// import { css } from '@theme-ui/css';
|
|
897
|
+
// const GlobalStyles = () => {
|
|
898
|
+
// const theme = useTheme();
|
|
899
|
+
// const styles = css({
|
|
900
|
+
// body: { variant: 'root.body' },
|
|
901
|
+
// html: { variant: 'root.html' },
|
|
902
|
+
// })(theme);
|
|
903
|
+
// return <Global styles={styles} />;
|
|
904
|
+
// };
|
|
905
|
+
// a merge of the ThemeProvider and the react-aria OverlayProvider
|
|
906
|
+
|
|
907
|
+
var MarigoldProvider = function MarigoldProvider(_ref) {
|
|
908
|
+
var theme = _ref.theme,
|
|
909
|
+
children = _ref.children;
|
|
910
|
+
return React.createElement(ThemeProvider, {
|
|
911
|
+
theme: theme
|
|
912
|
+
}, React.createElement(OverlayProvider, null, children));
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
var _excluded$p = ["disabled"],
|
|
916
|
+
_excluded2$2 = ["disabled", "error"];
|
|
917
|
+
var RadioChecked = function RadioChecked(_ref) {
|
|
918
|
+
var _ref$disabled = _ref.disabled,
|
|
919
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
920
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$p);
|
|
921
|
+
|
|
922
|
+
return React.createElement(SVG, Object.assign({
|
|
923
|
+
width: "16",
|
|
924
|
+
height: "32",
|
|
925
|
+
viewBox: "0 0 16 32",
|
|
926
|
+
fill: "none"
|
|
927
|
+
}, props), React.createElement(Box, {
|
|
928
|
+
as: "circle",
|
|
929
|
+
cx: "8",
|
|
930
|
+
cy: "16",
|
|
931
|
+
r: "7.5",
|
|
932
|
+
variant: disabled ? 'radio.checked.disabled' : 'radio.checked'
|
|
933
|
+
}), React.createElement(Box, {
|
|
934
|
+
as: "circle",
|
|
935
|
+
cx: "8",
|
|
936
|
+
cy: "16",
|
|
937
|
+
r: "3",
|
|
938
|
+
variant: "radio.checked.circle"
|
|
939
|
+
}));
|
|
940
|
+
};
|
|
941
|
+
var RadioUnchecked = function RadioUnchecked(_ref2) {
|
|
942
|
+
var _ref2$disabled = _ref2.disabled,
|
|
943
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
944
|
+
_ref2$error = _ref2.error,
|
|
945
|
+
error = _ref2$error === void 0 ? false : _ref2$error,
|
|
946
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded2$2);
|
|
947
|
+
|
|
948
|
+
return React.createElement(SVG, Object.assign({
|
|
949
|
+
width: "16",
|
|
950
|
+
height: "32",
|
|
951
|
+
viewBox: "0 0 16 32",
|
|
952
|
+
fill: "none"
|
|
953
|
+
}, props), React.createElement(Box, {
|
|
954
|
+
as: "circle",
|
|
955
|
+
cx: "8",
|
|
956
|
+
cy: "16",
|
|
957
|
+
r: "7.5",
|
|
958
|
+
variant: disabled ? 'radio.unchecked.disabled' : error ? 'radio.unchecked.error' : 'radio.unchecked'
|
|
959
|
+
}));
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
var _excluded$q = ["className", "variant", "error"],
|
|
963
|
+
_excluded2$3 = ["label", "required", "error", "errorMessage"];
|
|
964
|
+
|
|
965
|
+
var RadioIcon = function RadioIcon(_ref) {
|
|
966
|
+
var variant = _ref.variant,
|
|
967
|
+
checked = _ref.checked,
|
|
968
|
+
disabled = _ref.disabled,
|
|
969
|
+
error = _ref.error;
|
|
970
|
+
|
|
971
|
+
if (checked) {
|
|
972
|
+
return React.createElement(Box, {
|
|
973
|
+
as: RadioChecked,
|
|
974
|
+
variant: "radio." + variant,
|
|
975
|
+
disabled: disabled
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
return React.createElement(Box, {
|
|
980
|
+
as: RadioUnchecked,
|
|
981
|
+
variant: "radio." + variant,
|
|
982
|
+
disabled: disabled,
|
|
983
|
+
error: error
|
|
984
|
+
});
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
var RadioInput = function RadioInput(_ref2) {
|
|
988
|
+
var className = _ref2.className,
|
|
989
|
+
_ref2$variant = _ref2.variant,
|
|
990
|
+
variant = _ref2$variant === void 0 ? 'default' : _ref2$variant,
|
|
991
|
+
error = _ref2.error,
|
|
992
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded$q);
|
|
993
|
+
|
|
994
|
+
return React.createElement(Box, {
|
|
995
|
+
display: "inline-block",
|
|
996
|
+
className: className
|
|
129
997
|
}, React.createElement(Box, Object.assign({
|
|
130
998
|
as: "input",
|
|
131
|
-
type: "radio"
|
|
132
|
-
}, props, {
|
|
999
|
+
type: "radio",
|
|
133
1000
|
css: {
|
|
134
1001
|
position: 'absolute',
|
|
135
1002
|
opacity: 0,
|
|
@@ -138,155 +1005,370 @@ var Radio = /*#__PURE__*/system(function (_ref) {
|
|
|
138
1005
|
height: 1,
|
|
139
1006
|
overflow: 'hidden'
|
|
140
1007
|
}
|
|
141
|
-
})), React.createElement(
|
|
142
|
-
|
|
143
|
-
"aria-hidden": "true",
|
|
144
|
-
themeSection: "form",
|
|
1008
|
+
}, props)), React.createElement(RadioIcon, {
|
|
1009
|
+
checked: props.checked,
|
|
145
1010
|
variant: variant,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
verticalAlign: 'middle',
|
|
149
|
-
':hover': {
|
|
150
|
-
cursor: 'pointer'
|
|
151
|
-
},
|
|
152
|
-
'input:disabled ~ &': {
|
|
153
|
-
color: 'muted',
|
|
154
|
-
cursor: 'not-allowed'
|
|
155
|
-
}
|
|
156
|
-
}
|
|
1011
|
+
disabled: props.disabled,
|
|
1012
|
+
error: error
|
|
157
1013
|
}));
|
|
158
|
-
}
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
var Radio = function Radio(_ref3) {
|
|
1017
|
+
var label = _ref3.label,
|
|
1018
|
+
required = _ref3.required,
|
|
1019
|
+
error = _ref3.error,
|
|
1020
|
+
errorMessage = _ref3.errorMessage,
|
|
1021
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded2$3);
|
|
159
1022
|
|
|
160
|
-
|
|
1023
|
+
if (label) {
|
|
1024
|
+
return React.createElement(React.Fragment, null, React.createElement(Label, {
|
|
1025
|
+
htmlFor: props.id,
|
|
1026
|
+
required: required,
|
|
1027
|
+
variant: props.disabled ? 'disabled' : 'inline'
|
|
1028
|
+
}, React.createElement(Box, Object.assign({
|
|
1029
|
+
as: RadioInput,
|
|
1030
|
+
pr: "8px",
|
|
1031
|
+
error: error
|
|
1032
|
+
}, props)), label), error && errorMessage && React.createElement(ValidationMessage, null, React.createElement(Exclamation, {
|
|
1033
|
+
size: 16
|
|
1034
|
+
}), errorMessage));
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
return React.createElement(RadioInput, Object.assign({}, props));
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
var _excluded$r = ["variant", "className"];
|
|
1041
|
+
var Slider = function Slider(_ref) {
|
|
161
1042
|
var _ref$variant = _ref.variant,
|
|
162
1043
|
variant = _ref$variant === void 0 ? 'slider' : _ref$variant,
|
|
163
|
-
|
|
1044
|
+
className = _ref.className,
|
|
1045
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$r);
|
|
164
1046
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
type: "range",
|
|
168
|
-
themeSection: "form",
|
|
169
|
-
variant: variant
|
|
170
|
-
}, props, {
|
|
1047
|
+
var classNames = useStyles({
|
|
1048
|
+
variant: "form." + variant,
|
|
171
1049
|
css: {
|
|
172
1050
|
verticalAlign: 'middle'
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
});
|
|
1051
|
+
},
|
|
1052
|
+
className: className
|
|
1053
|
+
});
|
|
1054
|
+
return React.createElement("input", Object.assign({
|
|
1055
|
+
type: "range",
|
|
1056
|
+
className: classNames
|
|
1057
|
+
}, props));
|
|
1058
|
+
};
|
|
176
1059
|
|
|
177
|
-
var
|
|
178
|
-
var
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
props = _objectWithoutPropertiesLoose(_ref, ["variant", "ref"]);
|
|
1060
|
+
var Option = function Option(_ref) {
|
|
1061
|
+
var item = _ref.item,
|
|
1062
|
+
state = _ref.state;
|
|
1063
|
+
var ref = useRef(null);
|
|
182
1064
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
1065
|
+
var _useState = useState(false),
|
|
1066
|
+
disabled = _useState[0],
|
|
1067
|
+
setDisabled = _useState[1];
|
|
1068
|
+
|
|
1069
|
+
var _useOption = useOption({
|
|
1070
|
+
key: item.key
|
|
1071
|
+
}, state, ref),
|
|
1072
|
+
optionProps = _useOption.optionProps,
|
|
1073
|
+
isSelected = _useOption.isSelected;
|
|
1074
|
+
|
|
1075
|
+
useEffect(function () {
|
|
1076
|
+
for (var _iterator = _createForOfIteratorHelperLoose(state.disabledKeys.values()), _step; !(_step = _iterator()).done;) {
|
|
1077
|
+
var key = _step.value;
|
|
1078
|
+
|
|
1079
|
+
if (key === item.key) {
|
|
1080
|
+
setDisabled(true);
|
|
1081
|
+
}
|
|
186
1082
|
}
|
|
187
|
-
},
|
|
188
|
-
|
|
1083
|
+
}, [state.disabledKeys, item.key]);
|
|
1084
|
+
return React.createElement(Box, Object.assign({
|
|
1085
|
+
as: "li"
|
|
1086
|
+
}, optionProps, {
|
|
189
1087
|
ref: ref,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
1088
|
+
variant: isSelected ? 'select.option.selected' : disabled ? 'select.option.disabled' : 'select.option'
|
|
1089
|
+
}), item.rendered);
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
var ListBoxSection = function ListBoxSection(_ref) {
|
|
1093
|
+
var section = _ref.section,
|
|
1094
|
+
state = _ref.state;
|
|
1095
|
+
|
|
1096
|
+
var _useListBoxSection = useListBoxSection({
|
|
1097
|
+
heading: section.rendered,
|
|
1098
|
+
'aria-label': section['aria-label']
|
|
1099
|
+
}),
|
|
1100
|
+
itemProps = _useListBoxSection.itemProps,
|
|
1101
|
+
headingProps = _useListBoxSection.headingProps,
|
|
1102
|
+
groupProps = _useListBoxSection.groupProps;
|
|
1103
|
+
|
|
1104
|
+
return React.createElement(Box, Object.assign({
|
|
1105
|
+
as: "li"
|
|
1106
|
+
}, itemProps, {
|
|
194
1107
|
css: {
|
|
195
|
-
|
|
196
|
-
pointerEvents: 'none'
|
|
1108
|
+
cursor: 'not-allowed'
|
|
197
1109
|
}
|
|
198
|
-
})
|
|
199
|
-
|
|
1110
|
+
}), section.rendered && React.createElement(Box, Object.assign({
|
|
1111
|
+
as: "span"
|
|
1112
|
+
}, headingProps, {
|
|
1113
|
+
variant: 'select.section'
|
|
1114
|
+
}), section.rendered), React.createElement(Box, Object.assign({
|
|
1115
|
+
as: "ul"
|
|
1116
|
+
}, groupProps), [].concat(section.childNodes).map(function (node) {
|
|
1117
|
+
return React.createElement(Option, {
|
|
1118
|
+
key: node.key,
|
|
1119
|
+
item: node,
|
|
1120
|
+
state: state
|
|
1121
|
+
});
|
|
1122
|
+
})));
|
|
1123
|
+
};
|
|
200
1124
|
|
|
201
|
-
var
|
|
202
|
-
var
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
1125
|
+
var ListBox = function ListBox(props) {
|
|
1126
|
+
var ref = useRef(null);
|
|
1127
|
+
var state = props.state,
|
|
1128
|
+
error = props.error;
|
|
1129
|
+
|
|
1130
|
+
var _useListBox = useListBox(props, state, ref),
|
|
1131
|
+
listBoxProps = _useListBox.listBoxProps;
|
|
208
1132
|
|
|
209
1133
|
return React.createElement(Box, Object.assign({
|
|
210
|
-
as: "
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
},
|
|
218
|
-
|
|
1134
|
+
as: "ul",
|
|
1135
|
+
css: {
|
|
1136
|
+
listStyle: 'none'
|
|
1137
|
+
}
|
|
1138
|
+
}, listBoxProps, {
|
|
1139
|
+
variant: error ? 'select.listbox.error' : 'select.listbox',
|
|
1140
|
+
ref: ref
|
|
1141
|
+
}), [].concat(state.collection).map(function (item) {
|
|
1142
|
+
return item.type === 'section' ? React.createElement(ListBoxSection, {
|
|
1143
|
+
key: item.key,
|
|
1144
|
+
section: item,
|
|
1145
|
+
state: state
|
|
1146
|
+
}) : React.createElement(Option, {
|
|
1147
|
+
key: item.key,
|
|
1148
|
+
item: item,
|
|
1149
|
+
state: state
|
|
1150
|
+
});
|
|
1151
|
+
}));
|
|
1152
|
+
};
|
|
219
1153
|
|
|
220
|
-
var
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
1154
|
+
var _excluded$s = ["children", "className", "isOpen", "onClose"];
|
|
1155
|
+
var Popover = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
1156
|
+
var children = _ref.children,
|
|
1157
|
+
className = _ref.className,
|
|
1158
|
+
isOpen = _ref.isOpen,
|
|
1159
|
+
onClose = _ref.onClose,
|
|
1160
|
+
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$s);
|
|
227
1161
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
1162
|
+
// Handle events that should cause the popup to close,
|
|
1163
|
+
var _useOverlay = useOverlay({
|
|
1164
|
+
isOpen: isOpen,
|
|
1165
|
+
onClose: onClose,
|
|
1166
|
+
shouldCloseOnBlur: true,
|
|
1167
|
+
isDismissable: true
|
|
1168
|
+
}, ref),
|
|
1169
|
+
overlayProps = _useOverlay.overlayProps; // Hide content outside the modal from screen readers.
|
|
234
1170
|
|
|
235
|
-
var Textarea = /*#__PURE__*/system(function (_ref) {
|
|
236
|
-
var _ref$variant = _ref.variant,
|
|
237
|
-
variant = _ref$variant === void 0 ? 'textarea' : _ref$variant,
|
|
238
|
-
ref = _ref.ref,
|
|
239
|
-
props = _objectWithoutPropertiesLoose(_ref, ["variant", "ref"]);
|
|
240
1171
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
1172
|
+
var _useModal = useModal(),
|
|
1173
|
+
modalProps = _useModal.modalProps;
|
|
1174
|
+
|
|
1175
|
+
return React.createElement(OverlayContainer, null, React.createElement(FocusScope, {
|
|
1176
|
+
restoreFocus: true
|
|
1177
|
+
}, React.createElement(Box, Object.assign({}, mergeProps(overlayProps, otherProps, modalProps), {
|
|
1178
|
+
className: className,
|
|
245
1179
|
ref: ref
|
|
246
|
-
},
|
|
1180
|
+
}), children, React.createElement(DismissButton, {
|
|
1181
|
+
onDismiss: onClose
|
|
1182
|
+
}))));
|
|
247
1183
|
});
|
|
248
1184
|
|
|
249
|
-
var
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
_ref$
|
|
253
|
-
|
|
254
|
-
|
|
1185
|
+
var _excluded$t = ["placeholder", "disabled", "required", "error", "errorMessage", "width", "className"];
|
|
1186
|
+
var Select = function Select(_ref) {
|
|
1187
|
+
var _ref$placeholder = _ref.placeholder,
|
|
1188
|
+
placeholder = _ref$placeholder === void 0 ? 'Select an option' : _ref$placeholder,
|
|
1189
|
+
disabled = _ref.disabled,
|
|
1190
|
+
required = _ref.required,
|
|
1191
|
+
error = _ref.error,
|
|
1192
|
+
errorMessage = _ref.errorMessage,
|
|
1193
|
+
width = _ref.width,
|
|
1194
|
+
className = _ref.className,
|
|
1195
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$t);
|
|
255
1196
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
1197
|
+
var state = useSelectState(props);
|
|
1198
|
+
var overlayTriggerState = useOverlayTriggerState({});
|
|
1199
|
+
var triggerRef = useRef();
|
|
1200
|
+
var overlayRef = useRef(); // Get props for the overlay
|
|
1201
|
+
|
|
1202
|
+
var _useOverlayTrigger = useOverlayTrigger({
|
|
1203
|
+
type: 'listbox'
|
|
1204
|
+
}, overlayTriggerState, triggerRef),
|
|
1205
|
+
overlayProps = _useOverlayTrigger.overlayProps; // Get popover positioning props relative to the trigger
|
|
1206
|
+
|
|
1207
|
+
|
|
1208
|
+
var _useOverlayPosition = useOverlayPosition({
|
|
1209
|
+
targetRef: triggerRef,
|
|
1210
|
+
overlayRef: overlayRef,
|
|
1211
|
+
placement: 'bottom',
|
|
1212
|
+
shouldFlip: false,
|
|
1213
|
+
isOpen: state.isOpen,
|
|
1214
|
+
onClose: state.close
|
|
1215
|
+
}),
|
|
1216
|
+
positionProps = _useOverlayPosition.overlayProps; // Get props for child elements from useSelect
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
var _useSelect = useSelect(props, state, triggerRef),
|
|
1220
|
+
labelProps = _useSelect.labelProps,
|
|
1221
|
+
triggerProps = _useSelect.triggerProps,
|
|
1222
|
+
valueProps = _useSelect.valueProps,
|
|
1223
|
+
menuProps = _useSelect.menuProps; // Get props for the button based on the trigger props from useSelect
|
|
1224
|
+
|
|
1225
|
+
|
|
1226
|
+
var _useButton = useButton(triggerProps, triggerRef),
|
|
1227
|
+
buttonProps = _useButton.buttonProps;
|
|
1228
|
+
|
|
1229
|
+
var _useFocusRing = useFocusRing(),
|
|
1230
|
+
focusProps = _useFocusRing.focusProps;
|
|
1231
|
+
|
|
1232
|
+
return React.createElement(Box, {
|
|
1233
|
+
position: "relative",
|
|
1234
|
+
display: "inline-block",
|
|
1235
|
+
width: width && width
|
|
1236
|
+
}, props.label && React.createElement(Box, null, React.createElement(Label, Object.assign({}, labelProps, {
|
|
1237
|
+
htmlFor: labelProps.id,
|
|
1238
|
+
variant: disabled ? 'disabled' : 'above'
|
|
1239
|
+
}), required ? React.createElement(Box, {
|
|
1240
|
+
as: "span",
|
|
1241
|
+
display: "inline-flex",
|
|
1242
|
+
alignItems: "center"
|
|
1243
|
+
}, props.label, React.createElement(Box, {
|
|
1244
|
+
as: Required,
|
|
1245
|
+
size: 16,
|
|
1246
|
+
css: {
|
|
1247
|
+
color: 'error'
|
|
1248
|
+
}
|
|
1249
|
+
})) : props.label)), React.createElement(HiddenSelect, {
|
|
1250
|
+
state: state,
|
|
1251
|
+
triggerRef: triggerRef,
|
|
1252
|
+
label: props.label,
|
|
1253
|
+
name: props.name,
|
|
1254
|
+
isDisabled: disabled
|
|
1255
|
+
}), React.createElement(Box, Object.assign({
|
|
1256
|
+
as: "button"
|
|
1257
|
+
}, mergeProps(buttonProps, focusProps), {
|
|
1258
|
+
ref: triggerRef,
|
|
1259
|
+
variant: error && state.isOpen && !disabled ? 'button.select.errorOpened' : error ? 'button.select.error' : state.isOpen && !disabled ? 'button.select.open' : 'button.select',
|
|
1260
|
+
disabled: disabled,
|
|
1261
|
+
className: className
|
|
1262
|
+
}), React.createElement(Box, Object.assign({
|
|
1263
|
+
as: "span"
|
|
1264
|
+
}, valueProps, {
|
|
1265
|
+
variant: disabled ? 'select.disabled' : 'select'
|
|
1266
|
+
}), state.selectedItem ? state.selectedItem.rendered : placeholder), state.isOpen && !disabled ? React.createElement(Box, {
|
|
1267
|
+
as: ArrowUp,
|
|
1268
|
+
size: 16,
|
|
1269
|
+
css: {
|
|
1270
|
+
fill: disabled ? 'disabled' : 'text'
|
|
1271
|
+
}
|
|
1272
|
+
}) : React.createElement(Box, {
|
|
1273
|
+
as: ArrowDown,
|
|
1274
|
+
size: 16,
|
|
262
1275
|
css: {
|
|
263
|
-
|
|
1276
|
+
fill: disabled ? 'disabled' : 'text'
|
|
264
1277
|
}
|
|
1278
|
+
})), state.isOpen && !disabled && React.createElement(Box, Object.assign({
|
|
1279
|
+
as: Popover
|
|
1280
|
+
}, overlayProps, positionProps, {
|
|
1281
|
+
css: {
|
|
1282
|
+
width: width ? width : triggerRef.current && triggerRef.current.offsetWidth + 'px'
|
|
1283
|
+
},
|
|
1284
|
+
ref: overlayRef,
|
|
1285
|
+
isOpen: state.isOpen,
|
|
1286
|
+
onClose: state.close
|
|
1287
|
+
}), React.createElement(ListBox, Object.assign({
|
|
1288
|
+
error: error
|
|
1289
|
+
}, menuProps, {
|
|
1290
|
+
state: state
|
|
1291
|
+
}))), error && errorMessage && React.createElement(Box, {
|
|
1292
|
+
as: "span",
|
|
1293
|
+
display: "inline-flex",
|
|
1294
|
+
alignItems: "center"
|
|
1295
|
+
}, React.createElement(Box, {
|
|
1296
|
+
as: Exclamation,
|
|
1297
|
+
size: 16,
|
|
1298
|
+
css: {
|
|
1299
|
+
color: 'error'
|
|
1300
|
+
}
|
|
1301
|
+
}), React.createElement(ValidationMessage, null, errorMessage)));
|
|
1302
|
+
};
|
|
1303
|
+
|
|
1304
|
+
var _excluded$u = ["space", "align", "children"];
|
|
1305
|
+
var ALIGNMENT = {
|
|
1306
|
+
left: 'flex-start',
|
|
1307
|
+
center: 'center',
|
|
1308
|
+
right: 'flex-end'
|
|
1309
|
+
};
|
|
1310
|
+
var Stack = function Stack(_ref) {
|
|
1311
|
+
var _ref$space = _ref.space,
|
|
1312
|
+
space = _ref$space === void 0 ? 'none' : _ref$space,
|
|
1313
|
+
_ref$align = _ref.align,
|
|
1314
|
+
align = _ref$align === void 0 ? 'left' : _ref$align,
|
|
1315
|
+
children = _ref.children,
|
|
1316
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$u);
|
|
1317
|
+
|
|
1318
|
+
return React.createElement(Box, Object.assign({}, props, {
|
|
1319
|
+
display: "flex",
|
|
1320
|
+
flexDirection: "column",
|
|
1321
|
+
alignItems: ALIGNMENT[align],
|
|
1322
|
+
css: {
|
|
1323
|
+
'> * + *': {
|
|
1324
|
+
pt: space
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
}), Children.map(flattenChildren(children), function (child) {
|
|
1328
|
+
return React.createElement(Box, null, React.cloneElement(child, {}, child.props.children));
|
|
265
1329
|
}));
|
|
266
|
-
}
|
|
1330
|
+
};
|
|
267
1331
|
|
|
268
|
-
var
|
|
1332
|
+
var _excluded$v = ["variant", "htmlFor", "label", "error", "errorMessage", "required", "className", "children"];
|
|
1333
|
+
var Textarea = function Textarea(_ref) {
|
|
269
1334
|
var _ref$variant = _ref.variant,
|
|
270
|
-
variant = _ref$variant === void 0 ? '
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
1335
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
1336
|
+
_ref$htmlFor = _ref.htmlFor,
|
|
1337
|
+
htmlFor = _ref$htmlFor === void 0 ? 'textarea' : _ref$htmlFor,
|
|
1338
|
+
label = _ref.label,
|
|
1339
|
+
error = _ref.error,
|
|
1340
|
+
errorMessage = _ref.errorMessage,
|
|
1341
|
+
required = _ref.required,
|
|
1342
|
+
_ref$className = _ref.className,
|
|
1343
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1344
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$v);
|
|
274
1345
|
|
|
275
|
-
return React.createElement(Box,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
1346
|
+
return React.createElement(Box, null, label && React.createElement(Label, {
|
|
1347
|
+
htmlFor: htmlFor,
|
|
1348
|
+
required: required
|
|
1349
|
+
}, label), React.createElement(Box, Object.assign({
|
|
1350
|
+
as: "textarea"
|
|
280
1351
|
}, props, {
|
|
1352
|
+
display: "block",
|
|
1353
|
+
variant: "textarea." + variant,
|
|
281
1354
|
css: {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
1355
|
+
outlineColor: error && 'error'
|
|
1356
|
+
},
|
|
1357
|
+
className: className
|
|
1358
|
+
})), error && errorMessage && React.createElement(ValidationMessage, null, React.createElement(Exclamation, {
|
|
1359
|
+
size: 16
|
|
1360
|
+
}), errorMessage));
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1363
|
+
var _excluded$w = ["children"];
|
|
1364
|
+
var Container = function Container(_ref) {
|
|
1365
|
+
var children = _ref.children,
|
|
1366
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$w);
|
|
1367
|
+
|
|
1368
|
+
return React.createElement(Box, Object.assign({}, props, {
|
|
1369
|
+
width: "100%"
|
|
288
1370
|
}), children);
|
|
289
|
-
}
|
|
1371
|
+
};
|
|
290
1372
|
|
|
291
|
-
export { Alert, Button, Checkbox, Heading, Label, Link, Radio, Select, Slider,
|
|
1373
|
+
export { ActionGroup, Alert, Badge, Box, Button, Card, Checkbox, Column, Columns, Container, Dialog, Divider, Field, Heading, Hidden, Image, Input, Label, Link, MarigoldProvider, Menu, MenuItem, Message, Radio, Select, Slider, Stack, Text, Textarea, ValidationMessage, useDialogButtonProps };
|
|
292
1374
|
//# sourceMappingURL=components.esm.js.map
|