@ndla/primitives 0.0.16 → 0.0.18
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/panda.buildinfo.json +18 -14
- package/dist/styles.css +333 -315
- package/es/Accordion.js +58 -30
- package/es/Button.js +3 -2
- package/es/Card/Card.js +77 -0
- package/es/Checkbox.js +12 -4
- package/es/Combobox.js +30 -10
- package/es/Dialog.js +9 -3
- package/es/Figure.js +21 -4
- package/es/Image.js +92 -0
- package/es/Input.js +1 -1
- package/es/Menu.js +21 -7
- package/es/Pagination.js +15 -5
- package/es/Popover.js +30 -10
- package/es/RadioGroup.js +12 -4
- package/es/Select.js +36 -12
- package/es/Slider.js +15 -5
- package/es/Switch.js +9 -3
- package/es/Tabs.js +15 -5
- package/es/TagsInput.js +27 -9
- package/es/Toast.js +9 -3
- package/es/Tooltip.js +15 -5
- package/es/createStyleContext.js +6 -12
- package/es/index.js +3 -1
- package/lib/Accordion.d.ts +41 -2
- package/lib/Accordion.js +58 -30
- package/lib/Badge.d.ts +1 -0
- package/lib/Button.d.ts +2 -2
- package/lib/Button.js +3 -2
- package/lib/Card/Card.d.ts +19 -0
- package/lib/Card/Card.js +83 -0
- package/lib/Checkbox.js +12 -4
- package/lib/Combobox.d.ts +45 -13
- package/lib/Combobox.js +30 -10
- package/lib/Dialog.js +9 -3
- package/lib/Figure.d.ts +3 -3
- package/lib/Figure.js +21 -4
- package/lib/Image.d.ts +49 -0
- package/lib/Image.js +100 -0
- package/lib/Input.js +1 -1
- package/lib/Menu.js +21 -7
- package/lib/Pagination.d.ts +6 -2
- package/lib/Pagination.js +15 -5
- package/lib/Popover.js +30 -10
- package/lib/RadioGroup.js +12 -4
- package/lib/Select.js +36 -12
- package/lib/Slider.js +15 -5
- package/lib/Switch.js +9 -3
- package/lib/Tabs.d.ts +4 -1
- package/lib/Tabs.js +15 -5
- package/lib/TagsInput.d.ts +15 -2
- package/lib/TagsInput.js +27 -9
- package/lib/Toast.js +9 -3
- package/lib/Tooltip.js +15 -5
- package/lib/createStyleContext.d.ts +5 -2
- package/lib/createStyleContext.js +6 -12
- package/lib/index.d.ts +8 -4
- package/lib/index.js +74 -0
- package/package.json +5 -5
package/es/Accordion.js
CHANGED
|
@@ -23,21 +23,15 @@ const accordionRecipe = sva({
|
|
|
23
23
|
justifyContent: "space-between",
|
|
24
24
|
background: "surface.default",
|
|
25
25
|
cursor: "pointer",
|
|
26
|
-
paddingInline: "medium",
|
|
27
|
-
paddingBlock: "medium",
|
|
28
|
-
boxShadowColor: "stroke.subtle",
|
|
29
|
-
boxShadow: "inset 0 0 0 1px var(--shadow-color)",
|
|
30
|
-
borderRadius: "xsmall",
|
|
31
26
|
transitionDuration: "fast",
|
|
32
27
|
transitionTimingFunction: "default",
|
|
33
28
|
transitionProperty: "background, border-color, border, border-radius",
|
|
34
|
-
width: "100%",
|
|
35
29
|
_closed: {
|
|
36
30
|
transitionProperty: "background, border-color, border, border-radius"
|
|
37
31
|
},
|
|
38
32
|
_disabled: {
|
|
39
33
|
cursor: "not-allowed",
|
|
40
|
-
background: "surface
|
|
34
|
+
background: "surface.disabled.subtle",
|
|
41
35
|
boxShadowColor: "stroke.disabled",
|
|
42
36
|
color: "text.disabled",
|
|
43
37
|
_hover: {
|
|
@@ -45,20 +39,6 @@ const accordionRecipe = sva({
|
|
|
45
39
|
boxShadowColor: "stroke.disabled",
|
|
46
40
|
color: "text.disabled"
|
|
47
41
|
}
|
|
48
|
-
},
|
|
49
|
-
_hover: {
|
|
50
|
-
background: "surface.actionSubtle.hover",
|
|
51
|
-
boxShadowColor: "stroke.hover"
|
|
52
|
-
},
|
|
53
|
-
_open: {
|
|
54
|
-
backgroundColor: "surface.actionSubtle.active",
|
|
55
|
-
boxShadowColor: "stroke.default",
|
|
56
|
-
borderBottomRadius: "sharp"
|
|
57
|
-
},
|
|
58
|
-
_focusVisible: {
|
|
59
|
-
outline: "none",
|
|
60
|
-
boxShadowColor: "stroke.default",
|
|
61
|
-
boxShadow: "inset 0 0 0 2px var(--shadow-color)"
|
|
62
42
|
}
|
|
63
43
|
},
|
|
64
44
|
itemIndicator: {
|
|
@@ -73,21 +53,59 @@ const accordionRecipe = sva({
|
|
|
73
53
|
},
|
|
74
54
|
itemContent: {
|
|
75
55
|
overflow: "hidden",
|
|
56
|
+
// TODO: Is this needed?
|
|
76
57
|
transitionProperty: "padding-bottom",
|
|
77
58
|
transitionDuration: "normal",
|
|
78
59
|
transitionTimingFunction: "default",
|
|
79
60
|
paddingBlock: "xsmall",
|
|
80
61
|
paddingInline: "small",
|
|
81
|
-
borderBottomRadius: "xsmall",
|
|
82
|
-
borderWidth: "0 1px 1px",
|
|
83
|
-
borderStyle: "solid",
|
|
84
|
-
borderColor: "stroke.default",
|
|
85
62
|
_open: {
|
|
86
63
|
animation: "collapse-in"
|
|
87
64
|
},
|
|
88
65
|
_closed: {
|
|
89
66
|
animation: "collapse-out"
|
|
90
67
|
}
|
|
68
|
+
},
|
|
69
|
+
item: {
|
|
70
|
+
width: "100%"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
defaultVariants: {
|
|
74
|
+
variant: "bordered"
|
|
75
|
+
},
|
|
76
|
+
variants: {
|
|
77
|
+
variant: {
|
|
78
|
+
clean: {},
|
|
79
|
+
bordered: {
|
|
80
|
+
itemTrigger: {
|
|
81
|
+
paddingInline: "medium",
|
|
82
|
+
paddingBlock: "medium",
|
|
83
|
+
width: "100%",
|
|
84
|
+
borderRadius: "xsmall",
|
|
85
|
+
boxShadowColor: "stroke.subtle",
|
|
86
|
+
boxShadow: "inset 0 0 0 1px var(--shadow-color)",
|
|
87
|
+
_hover: {
|
|
88
|
+
background: "surface.actionSubtle.hover",
|
|
89
|
+
boxShadowColor: "stroke.hover"
|
|
90
|
+
},
|
|
91
|
+
_open: {
|
|
92
|
+
backgroundColor: "surface.actionSubtle.active",
|
|
93
|
+
boxShadowColor: "stroke.default",
|
|
94
|
+
borderBottomRadius: "sharp"
|
|
95
|
+
},
|
|
96
|
+
_focusVisible: {
|
|
97
|
+
outline: "none",
|
|
98
|
+
boxShadowColor: "stroke.default",
|
|
99
|
+
boxShadow: "inset 0 0 0 2px var(--shadow-color)"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
itemContent: {
|
|
103
|
+
borderBottomRadius: "xsmall",
|
|
104
|
+
borderWidth: "0 1px 1px",
|
|
105
|
+
borderStyle: "solid",
|
|
106
|
+
borderColor: "stroke.default"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
91
109
|
}
|
|
92
110
|
}
|
|
93
111
|
});
|
|
@@ -95,8 +113,18 @@ const {
|
|
|
95
113
|
withProvider,
|
|
96
114
|
withContext
|
|
97
115
|
} = createStyleContext(accordionRecipe);
|
|
98
|
-
export const AccordionRoot = withProvider(Accordion.Root, "root"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
export const
|
|
102
|
-
|
|
116
|
+
export const AccordionRoot = withProvider(Accordion.Root, "root", {
|
|
117
|
+
baseComponent: true
|
|
118
|
+
});
|
|
119
|
+
export const AccordionItemContent = withContext(Accordion.ItemContent, "itemContent", {
|
|
120
|
+
baseComponent: true
|
|
121
|
+
});
|
|
122
|
+
export const AccordionItemIndicator = withContext(Accordion.ItemIndicator, "itemIndicator", {
|
|
123
|
+
baseComponent: true
|
|
124
|
+
});
|
|
125
|
+
export const AccordionItem = withContext(Accordion.Item, "item", {
|
|
126
|
+
baseComponent: true
|
|
127
|
+
});
|
|
128
|
+
export const AccordionItemTrigger = withContext(Accordion.ItemTrigger, "itemTrigger", {
|
|
129
|
+
baseComponent: true
|
|
130
|
+
});
|
package/es/Button.js
CHANGED
|
@@ -11,6 +11,7 @@ import { ark } from "@ark-ui/react";
|
|
|
11
11
|
import { css, cva } from "@ndla/styled-system/css";
|
|
12
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
// TODO: Consider if any of the backgrounds should actually be transparent
|
|
14
15
|
export const buttonBaseRecipe = cva({
|
|
15
16
|
base: {
|
|
16
17
|
display: "inline-flex",
|
|
@@ -67,7 +68,7 @@ export const buttonBaseRecipe = cva({
|
|
|
67
68
|
},
|
|
68
69
|
secondary: {
|
|
69
70
|
color: "text.strong",
|
|
70
|
-
background: "
|
|
71
|
+
background: "surface.default",
|
|
71
72
|
boxShadow: "inset 0 0 0 1px var(--shadow-color)",
|
|
72
73
|
_hover: {
|
|
73
74
|
background: "surface.actionSubtle.hover"
|
|
@@ -152,7 +153,7 @@ export const buttonRecipe = cva({
|
|
|
152
153
|
variants: {
|
|
153
154
|
size: {
|
|
154
155
|
default: {
|
|
155
|
-
paddingInline: "
|
|
156
|
+
paddingInline: "xsmall",
|
|
156
157
|
paddingBlock: "xxsmall",
|
|
157
158
|
minHeight: "24"
|
|
158
159
|
},
|
package/es/Card/Card.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { forwardRef } from "react";
|
|
10
|
+
import { ark } from "@ark-ui/react";
|
|
11
|
+
import { sva } from "@ndla/styled-system/css";
|
|
12
|
+
import { createStyleContext } from "../createStyleContext";
|
|
13
|
+
import { Image } from "../Image";
|
|
14
|
+
import { Heading } from "../Text";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
const cardRecipe = sva({
|
|
17
|
+
slots: ["root", "title", "content", "image"],
|
|
18
|
+
base: {
|
|
19
|
+
root: {
|
|
20
|
+
position: "relative",
|
|
21
|
+
border: "1px solid",
|
|
22
|
+
borderRadius: "xsmall",
|
|
23
|
+
borderColor: "stroke.subtle",
|
|
24
|
+
transitionDuration: "fast",
|
|
25
|
+
transitionProperty: "background, color",
|
|
26
|
+
transitionTimingFunction: "default",
|
|
27
|
+
background: "surface.default",
|
|
28
|
+
_hover: {
|
|
29
|
+
background: "surface.actionSubtle.hover",
|
|
30
|
+
borderColor: "stroke.hover"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
content: {
|
|
34
|
+
display: "flex",
|
|
35
|
+
flexDirection: "column",
|
|
36
|
+
gap: "xsmall",
|
|
37
|
+
paddingBlock: "xsmall",
|
|
38
|
+
paddingInline: "medium"
|
|
39
|
+
},
|
|
40
|
+
title: {
|
|
41
|
+
textDecoration: "underline",
|
|
42
|
+
_hover: {
|
|
43
|
+
textDecoration: "none"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
image: {
|
|
47
|
+
height: "200px",
|
|
48
|
+
objectFit: "cover",
|
|
49
|
+
width: "100%"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const {
|
|
54
|
+
withProvider,
|
|
55
|
+
withContext
|
|
56
|
+
} = createStyleContext(cardRecipe);
|
|
57
|
+
export const CardRoot = withProvider(ark.article, "root", {
|
|
58
|
+
baseComponent: true
|
|
59
|
+
});
|
|
60
|
+
const InternalCardHeading = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
61
|
+
let {
|
|
62
|
+
textStyle = "label.large",
|
|
63
|
+
fontWeight = "bold",
|
|
64
|
+
...props
|
|
65
|
+
} = _ref;
|
|
66
|
+
return /*#__PURE__*/_jsx(Heading, {
|
|
67
|
+
textStyle: textStyle,
|
|
68
|
+
fontWeight: fontWeight,
|
|
69
|
+
...props,
|
|
70
|
+
ref: ref
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
export const CardHeading = withContext(InternalCardHeading, "title");
|
|
74
|
+
export const CardContent = withContext(ark.div, "content", {
|
|
75
|
+
baseComponent: true
|
|
76
|
+
});
|
|
77
|
+
export const CardImage = withContext(Image, "image");
|
package/es/Checkbox.js
CHANGED
|
@@ -209,8 +209,12 @@ const {
|
|
|
209
209
|
withProvider,
|
|
210
210
|
withContext
|
|
211
211
|
} = createStyleContext(checkboxRecipe);
|
|
212
|
-
export const CheckboxRoot = withProvider(Checkbox.Root, "root"
|
|
213
|
-
|
|
212
|
+
export const CheckboxRoot = withProvider(Checkbox.Root, "root", {
|
|
213
|
+
baseComponent: true
|
|
214
|
+
});
|
|
215
|
+
export const CheckboxIndicator = withContext(Checkbox.Indicator, "indicator", {
|
|
216
|
+
baseComponent: true
|
|
217
|
+
});
|
|
214
218
|
const InternalCheckboxLabel = withContext(Checkbox.Label, "label");
|
|
215
219
|
export const CheckboxLabel = _ref => {
|
|
216
220
|
let {
|
|
@@ -227,6 +231,10 @@ export const CheckboxLabel = _ref => {
|
|
|
227
231
|
})
|
|
228
232
|
});
|
|
229
233
|
};
|
|
230
|
-
export const CheckboxControl = withContext(Checkbox.Control, "control"
|
|
231
|
-
|
|
234
|
+
export const CheckboxControl = withContext(Checkbox.Control, "control", {
|
|
235
|
+
baseComponent: true
|
|
236
|
+
});
|
|
237
|
+
export const CheckboxGroup = withProvider(Checkbox.Group, "group", {
|
|
238
|
+
baseComponent: true
|
|
239
|
+
});
|
|
232
240
|
export const CheckboxHiddenInput = Checkbox.HiddenInput;
|
package/es/Combobox.js
CHANGED
|
@@ -147,7 +147,9 @@ const {
|
|
|
147
147
|
withProvider,
|
|
148
148
|
withContext
|
|
149
149
|
} = createStyleContext(comboboxRecipe);
|
|
150
|
-
const InternalComboboxRoot = withProvider(Combobox.Root, "root"
|
|
150
|
+
const InternalComboboxRoot = withProvider(Combobox.Root, "root", {
|
|
151
|
+
baseComponent: true
|
|
152
|
+
});
|
|
151
153
|
export const ComboboxRoot = _ref => {
|
|
152
154
|
let {
|
|
153
155
|
...props
|
|
@@ -160,10 +162,18 @@ export const ComboboxRoot = _ref => {
|
|
|
160
162
|
})
|
|
161
163
|
);
|
|
162
164
|
};
|
|
163
|
-
export const ComboboxClearTrigger = withContext(Combobox.ClearTrigger, "clearTrigger"
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
export const
|
|
165
|
+
export const ComboboxClearTrigger = withContext(Combobox.ClearTrigger, "clearTrigger", {
|
|
166
|
+
baseComponent: true
|
|
167
|
+
});
|
|
168
|
+
export const ComboboxContent = withContext(Combobox.Content, "content", {
|
|
169
|
+
baseComponent: true
|
|
170
|
+
});
|
|
171
|
+
export const ComboboxControl = withContext(Combobox.Control, "control", {
|
|
172
|
+
baseComponent: true
|
|
173
|
+
});
|
|
174
|
+
export const ComboboxInput = withContext(Combobox.Input, "input", {
|
|
175
|
+
baseComponent: true
|
|
176
|
+
});
|
|
167
177
|
const InternalComboboxItemGroupLabel = withContext(Combobox.ItemGroupLabel, "itemGroupLabel");
|
|
168
178
|
export const ComboboxItemGroupLabel = _ref2 => {
|
|
169
179
|
let {
|
|
@@ -186,9 +196,15 @@ export const ComboboxItemGroupLabel = _ref2 => {
|
|
|
186
196
|
})
|
|
187
197
|
});
|
|
188
198
|
};
|
|
189
|
-
export const ComboboxItemGroup = withContext(Combobox.ItemGroup, "itemGroup"
|
|
190
|
-
|
|
191
|
-
|
|
199
|
+
export const ComboboxItemGroup = withContext(Combobox.ItemGroup, "itemGroup", {
|
|
200
|
+
baseComponent: true
|
|
201
|
+
});
|
|
202
|
+
export const ComboboxItemIndicator = withContext(Combobox.ItemIndicator, "itemIndicator", {
|
|
203
|
+
baseComponent: true
|
|
204
|
+
});
|
|
205
|
+
export const ComboboxItem = withContext(Combobox.Item, "item", {
|
|
206
|
+
baseComponent: true
|
|
207
|
+
});
|
|
192
208
|
const InternalComboboxItemText = withContext(Combobox.ItemText, "itemText");
|
|
193
209
|
export const ComboboxItemText = _ref3 => {
|
|
194
210
|
let {
|
|
@@ -225,5 +241,9 @@ export const ComboboxLabel = _ref4 => {
|
|
|
225
241
|
})
|
|
226
242
|
});
|
|
227
243
|
};
|
|
228
|
-
export const ComboboxPositioner = withContext(Combobox.Positioner, "positioner"
|
|
229
|
-
|
|
244
|
+
export const ComboboxPositioner = withContext(Combobox.Positioner, "positioner", {
|
|
245
|
+
baseComponent: true
|
|
246
|
+
});
|
|
247
|
+
export const ComboboxTrigger = withContext(Combobox.Trigger, "trigger", {
|
|
248
|
+
baseComponent: true
|
|
249
|
+
});
|
package/es/Dialog.js
CHANGED
|
@@ -265,9 +265,15 @@ export const DialogRoot = _ref => {
|
|
|
265
265
|
...props
|
|
266
266
|
});
|
|
267
267
|
};
|
|
268
|
-
export const DialogBackdrop = withContext(Dialog.Backdrop, "backdrop"
|
|
269
|
-
|
|
270
|
-
|
|
268
|
+
export const DialogBackdrop = withContext(Dialog.Backdrop, "backdrop", {
|
|
269
|
+
baseComponent: true
|
|
270
|
+
});
|
|
271
|
+
export const DialogStandaloneContent = withContext(Dialog.Content, "content", {
|
|
272
|
+
baseComponent: true
|
|
273
|
+
});
|
|
274
|
+
export const DialogPositioner = withContext(Dialog.Positioner, "positioner", {
|
|
275
|
+
baseComponent: true
|
|
276
|
+
});
|
|
271
277
|
export const DialogContent = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/_jsxs(_Fragment, {
|
|
272
278
|
children: [/*#__PURE__*/_jsx(DialogBackdrop, {}), /*#__PURE__*/_jsx(DialogPositioner, {
|
|
273
279
|
children: /*#__PURE__*/_jsx(DialogStandaloneContent, {
|
package/es/Figure.js
CHANGED
|
@@ -52,15 +52,13 @@ const figureRecipe = cva({
|
|
|
52
52
|
left: {
|
|
53
53
|
tablet: {
|
|
54
54
|
float: "left",
|
|
55
|
-
clear: "left"
|
|
56
|
-
paddingInlineEnd: "medium"
|
|
55
|
+
clear: "left"
|
|
57
56
|
}
|
|
58
57
|
},
|
|
59
58
|
right: {
|
|
60
59
|
tablet: {
|
|
61
60
|
float: "right",
|
|
62
|
-
clear: "right"
|
|
63
|
-
paddingInlineStart: "medium"
|
|
61
|
+
clear: "right"
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
64
|
}
|
|
@@ -75,6 +73,25 @@ const figureRecipe = cva({
|
|
|
75
73
|
left: "auto",
|
|
76
74
|
marginBlock: "xsmall"
|
|
77
75
|
}
|
|
76
|
+
}, {
|
|
77
|
+
float: "left",
|
|
78
|
+
size: ["medium", "small", "xsmall"],
|
|
79
|
+
css: {
|
|
80
|
+
paddingInlineEnd: "medium"
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
float: "right",
|
|
84
|
+
size: ["medium", "small", "xsmall"],
|
|
85
|
+
css: {
|
|
86
|
+
paddingInlineStart: "medium"
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
float: ["left", "right"],
|
|
90
|
+
size: ["full"],
|
|
91
|
+
css: {
|
|
92
|
+
paddingInlineStart: "0",
|
|
93
|
+
paddingInlineEnd: "0"
|
|
94
|
+
}
|
|
78
95
|
}]
|
|
79
96
|
});
|
|
80
97
|
const StyledFigure = styled(ark.figure, {}, {
|
package/es/Image.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { forwardRef } from "react";
|
|
10
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
export const makeSrcQueryString = (width, crop, focalPoint) => {
|
|
13
|
+
const widthParams = width && `width=${width}`;
|
|
14
|
+
const cropParams = crop && `cropStartX=${crop.startX}&cropEndX=${crop.endX}&cropStartY=${crop.startY}&cropEndY=${crop.endY}`;
|
|
15
|
+
const focalPointParams = focalPoint && `focalX=${focalPoint.x}&focalY=${focalPoint.y}`;
|
|
16
|
+
const params = [widthParams, cropParams, focalPointParams].filter(p => p).join("&");
|
|
17
|
+
return params;
|
|
18
|
+
};
|
|
19
|
+
export const getSrcSet = (src, crop, focalPoint) => {
|
|
20
|
+
const widths = [2720, 2080, 1760, 1440, 1120, 1000, 960, 800, 640, 480, 320, 240, 180];
|
|
21
|
+
return widths.map(width => `${src}?${makeSrcQueryString(width, crop, focalPoint)} ${width}w`).join(", ");
|
|
22
|
+
};
|
|
23
|
+
const FALLBACK_WIDTH = 1024;
|
|
24
|
+
const FALLBACK_SIZES = "(min-width: 1024px) 1024px, 100vw";
|
|
25
|
+
export const Picture = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
26
|
+
let {
|
|
27
|
+
children,
|
|
28
|
+
srcSet: srcSetProp,
|
|
29
|
+
crop,
|
|
30
|
+
focalPoint,
|
|
31
|
+
src,
|
|
32
|
+
contentType,
|
|
33
|
+
sizes = FALLBACK_SIZES,
|
|
34
|
+
...props
|
|
35
|
+
} = _ref;
|
|
36
|
+
const srcSet = srcSetProp ?? getSrcSet(src, crop, focalPoint);
|
|
37
|
+
return /*#__PURE__*/_jsxs(styled.picture, {
|
|
38
|
+
...props,
|
|
39
|
+
ref: ref,
|
|
40
|
+
children: [contentType !== "image/gif" && /*#__PURE__*/_jsx("source", {
|
|
41
|
+
type: contentType,
|
|
42
|
+
srcSet: srcSet,
|
|
43
|
+
sizes: sizes
|
|
44
|
+
}), children]
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
export const Img = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
48
|
+
let {
|
|
49
|
+
fallbackWidth = FALLBACK_WIDTH,
|
|
50
|
+
crop,
|
|
51
|
+
focalPoint,
|
|
52
|
+
contentType,
|
|
53
|
+
src,
|
|
54
|
+
alt,
|
|
55
|
+
...props
|
|
56
|
+
} = _ref2;
|
|
57
|
+
const queryString = makeSrcQueryString(fallbackWidth, crop, focalPoint);
|
|
58
|
+
return /*#__PURE__*/_jsx(styled.img, {
|
|
59
|
+
alt: alt,
|
|
60
|
+
src: contentType === "image/gif" ? src : `${src}?${queryString}`,
|
|
61
|
+
...props,
|
|
62
|
+
ref: ref
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
export const Image = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
66
|
+
let {
|
|
67
|
+
children,
|
|
68
|
+
srcSet: srcSetProp,
|
|
69
|
+
crop,
|
|
70
|
+
focalPoint,
|
|
71
|
+
src,
|
|
72
|
+
contentType,
|
|
73
|
+
fallbackWidth = FALLBACK_WIDTH,
|
|
74
|
+
sizes = FALLBACK_SIZES,
|
|
75
|
+
alt,
|
|
76
|
+
...props
|
|
77
|
+
} = _ref3;
|
|
78
|
+
const srcSet = srcSetProp ?? getSrcSet(src, crop, focalPoint);
|
|
79
|
+
const queryString = makeSrcQueryString(fallbackWidth, crop, focalPoint);
|
|
80
|
+
return /*#__PURE__*/_jsxs("picture", {
|
|
81
|
+
children: [contentType !== "image/gif" && /*#__PURE__*/_jsx("source", {
|
|
82
|
+
type: contentType,
|
|
83
|
+
srcSet: srcSet,
|
|
84
|
+
sizes: sizes
|
|
85
|
+
}), /*#__PURE__*/_jsx(styled.img, {
|
|
86
|
+
alt: alt,
|
|
87
|
+
src: contentType === "image/gif" ? src : `${src}?${queryString}`,
|
|
88
|
+
...props,
|
|
89
|
+
ref: ref
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
92
|
+
});
|
package/es/Input.js
CHANGED
|
@@ -141,7 +141,7 @@ export const TextArea = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
141
141
|
const resize = useCallback(() => {
|
|
142
142
|
if (!localRef.current) return;
|
|
143
143
|
localRef.current.style.height = "0";
|
|
144
|
-
localRef.current.style.height =
|
|
144
|
+
localRef.current.style.height = `${localRef.current.scrollHeight + 3}px`;
|
|
145
145
|
}, []);
|
|
146
146
|
useEffect(() => {
|
|
147
147
|
window.addEventListener("input", resize);
|
package/es/Menu.js
CHANGED
|
@@ -141,7 +141,9 @@ export const MenuRoot = _ref => {
|
|
|
141
141
|
...props
|
|
142
142
|
});
|
|
143
143
|
};
|
|
144
|
-
export const MenuContent = withContext(Menu.Content, "content"
|
|
144
|
+
export const MenuContent = withContext(Menu.Content, "content", {
|
|
145
|
+
baseComponent: true
|
|
146
|
+
});
|
|
145
147
|
const InternalMenuItemGroupLabel = withContext(Menu.ItemGroupLabel, "itemGroupLabel");
|
|
146
148
|
export const MenuItemGroupLabel = _ref2 => {
|
|
147
149
|
let {
|
|
@@ -160,8 +162,12 @@ export const MenuItemGroupLabel = _ref2 => {
|
|
|
160
162
|
})
|
|
161
163
|
});
|
|
162
164
|
};
|
|
163
|
-
export const MenuItemGroup = withContext(Menu.ItemGroup, "itemGroup"
|
|
164
|
-
|
|
165
|
+
export const MenuItemGroup = withContext(Menu.ItemGroup, "itemGroup", {
|
|
166
|
+
baseComponent: true
|
|
167
|
+
});
|
|
168
|
+
const InternalMenuItem = withContext(Menu.Item, "item", {
|
|
169
|
+
baseComponent: true
|
|
170
|
+
});
|
|
165
171
|
export const MenuItem = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
166
172
|
let {
|
|
167
173
|
css: cssProp = {},
|
|
@@ -176,8 +182,12 @@ export const MenuItem = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
176
182
|
ref: ref
|
|
177
183
|
});
|
|
178
184
|
});
|
|
179
|
-
export const MenuPositioner = withContext(Menu.Positioner, "positioner"
|
|
180
|
-
|
|
185
|
+
export const MenuPositioner = withContext(Menu.Positioner, "positioner", {
|
|
186
|
+
baseComponent: true
|
|
187
|
+
});
|
|
188
|
+
const InternalMenuTriggerItem = withContext(Menu.TriggerItem, "triggerItem", {
|
|
189
|
+
baseComponent: true
|
|
190
|
+
});
|
|
181
191
|
export const MenuTriggerItem = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
182
192
|
let {
|
|
183
193
|
css: cssProp = {},
|
|
@@ -192,5 +202,9 @@ export const MenuTriggerItem = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
|
192
202
|
ref: ref
|
|
193
203
|
});
|
|
194
204
|
});
|
|
195
|
-
export const MenuTrigger = withContext(Menu.Trigger, "trigger"
|
|
196
|
-
|
|
205
|
+
export const MenuTrigger = withContext(Menu.Trigger, "trigger", {
|
|
206
|
+
baseComponent: true
|
|
207
|
+
});
|
|
208
|
+
export const MenuSeparator = withContext(Menu.Separator, "separator", {
|
|
209
|
+
baseComponent: true
|
|
210
|
+
});
|
package/es/Pagination.js
CHANGED
|
@@ -29,8 +29,18 @@ const {
|
|
|
29
29
|
withProvider,
|
|
30
30
|
withContext
|
|
31
31
|
} = createStyleContext(paginationRecipe);
|
|
32
|
-
export const PaginationRoot = withProvider(Pagination.Root, "root"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export const
|
|
36
|
-
|
|
32
|
+
export const PaginationRoot = withProvider(Pagination.Root, "root", {
|
|
33
|
+
baseComponent: true
|
|
34
|
+
});
|
|
35
|
+
export const PaginationItem = withContext(Pagination.Item, "item", {
|
|
36
|
+
baseComponent: true
|
|
37
|
+
});
|
|
38
|
+
export const PaginationEllipsis = withContext(Pagination.Ellipsis, "ellipsis", {
|
|
39
|
+
baseComponent: true
|
|
40
|
+
});
|
|
41
|
+
export const PaginationPrevTrigger = withContext(Pagination.PrevTrigger, "prevTrigger", {
|
|
42
|
+
baseComponent: true
|
|
43
|
+
});
|
|
44
|
+
export const PaginationNextTrigger = withContext(Pagination.NextTrigger, "nextTrigger", {
|
|
45
|
+
baseComponent: true
|
|
46
|
+
});
|
package/es/Popover.js
CHANGED
|
@@ -55,23 +55,43 @@ export const PopoverRoot = _ref => {
|
|
|
55
55
|
...props
|
|
56
56
|
});
|
|
57
57
|
};
|
|
58
|
-
export const PopoverAnchor = withContext(Popover.Anchor, "anchor"
|
|
59
|
-
|
|
58
|
+
export const PopoverAnchor = withContext(Popover.Anchor, "anchor", {
|
|
59
|
+
baseComponent: true
|
|
60
|
+
});
|
|
61
|
+
export const PopoverArrowStandalone = withContext(Popover.Arrow, "arrow", {
|
|
62
|
+
baseComponent: true
|
|
63
|
+
});
|
|
60
64
|
export const PopoverArrow = props => /*#__PURE__*/_jsx(PopoverArrowStandalone, {
|
|
61
65
|
children: /*#__PURE__*/_jsx(PopoverArrowTip, {
|
|
62
66
|
...props
|
|
63
67
|
})
|
|
64
68
|
});
|
|
65
|
-
export const PopoverArrowTip = withContext(Popover.ArrowTip, "arrowTip"
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
export const PopoverArrowTip = withContext(Popover.ArrowTip, "arrowTip", {
|
|
70
|
+
baseComponent: true
|
|
71
|
+
});
|
|
72
|
+
export const PopoverCloseTrigger = withContext(Popover.CloseTrigger, "closeTrigger", {
|
|
73
|
+
baseComponent: true
|
|
74
|
+
});
|
|
75
|
+
export const PopoverContentStandalone = withContext(Popover.Content, "content", {
|
|
76
|
+
baseComponent: true
|
|
77
|
+
});
|
|
68
78
|
export const PopoverContent = props => /*#__PURE__*/_jsx(PopoverPositioner, {
|
|
69
79
|
children: /*#__PURE__*/_jsx(PopoverContentStandalone, {
|
|
70
80
|
...props
|
|
71
81
|
})
|
|
72
82
|
});
|
|
73
|
-
export const PopoverDescription = withContext(Popover.Description, "description"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
export const
|
|
77
|
-
|
|
83
|
+
export const PopoverDescription = withContext(Popover.Description, "description", {
|
|
84
|
+
baseComponent: true
|
|
85
|
+
});
|
|
86
|
+
export const PopoverIndicator = withContext(Popover.Indicator, "indicator", {
|
|
87
|
+
baseComponent: true
|
|
88
|
+
});
|
|
89
|
+
export const PopoverPositioner = withContext(Popover.Positioner, "positioner", {
|
|
90
|
+
baseComponent: true
|
|
91
|
+
});
|
|
92
|
+
export const PopoverTitle = withContext(Popover.Title, "title", {
|
|
93
|
+
baseComponent: true
|
|
94
|
+
});
|
|
95
|
+
export const PopoverTrigger = withContext(Popover.Trigger, "trigger", {
|
|
96
|
+
baseComponent: true
|
|
97
|
+
});
|
package/es/RadioGroup.js
CHANGED
|
@@ -90,10 +90,18 @@ const {
|
|
|
90
90
|
withProvider,
|
|
91
91
|
withContext
|
|
92
92
|
} = createStyleContext(radioGroupRecipe);
|
|
93
|
-
export const RadioGroupRoot = withProvider(RadioGroup.Root, "root"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
export const
|
|
93
|
+
export const RadioGroupRoot = withProvider(RadioGroup.Root, "root", {
|
|
94
|
+
baseComponent: true
|
|
95
|
+
});
|
|
96
|
+
export const RadioGroupIndicator = withContext(RadioGroup.Indicator, "indicator", {
|
|
97
|
+
baseComponent: true
|
|
98
|
+
});
|
|
99
|
+
export const RadioGroupItemControl = withContext(RadioGroup.ItemControl, "itemControl", {
|
|
100
|
+
baseComponent: true
|
|
101
|
+
});
|
|
102
|
+
export const RadioGroupItem = withContext(RadioGroup.Item, "item", {
|
|
103
|
+
baseComponent: true
|
|
104
|
+
});
|
|
97
105
|
const InternalRadioGroupItemText = withContext(RadioGroup.ItemText, "itemText");
|
|
98
106
|
export const RadioGroupItemText = _ref => {
|
|
99
107
|
let {
|