@ndla/primitives 0.0.2 → 0.0.3
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 +61 -14
- package/dist/styles.css +226 -26
- package/es/ArticleLists.js +4 -32
- package/es/Badge.js +4 -16
- package/es/BlockQuote.js +3 -15
- package/es/Button.js +40 -33
- package/es/Dialog.js +6 -7
- package/es/ExpandableBox.js +4 -17
- package/es/FieldErrorMessage.js +9 -7
- package/es/FieldHelper.js +7 -5
- package/es/FormControl.js +2 -1
- package/es/FramedContent.js +3 -15
- package/es/Icon.js +9 -6
- package/es/Input.js +13 -10
- package/es/Label.js +10 -9
- package/es/Menu.js +32 -6
- package/es/MessageBox.js +3 -15
- package/es/NdlaLogo.js +6 -5
- package/es/RadioGroup.js +6 -2
- package/es/Skeleton.js +2 -8
- package/es/Spinner.js +3 -15
- package/es/Switch.js +8 -4
- package/es/Table.js +2 -5
- package/es/Tabs.js +232 -0
- package/es/Text.js +33 -32
- package/es/Toast.js +14 -6
- package/es/createStyleContext.js +15 -7
- package/lib/Accordion.d.ts +14 -7
- package/lib/ArticleLists.d.ts +9 -11
- package/lib/ArticleLists.js +5 -36
- package/lib/Badge.d.ts +9 -4
- package/lib/Badge.js +4 -17
- package/lib/BlockQuote.d.ts +8 -3
- package/lib/BlockQuote.js +3 -16
- package/lib/Button.d.ts +24 -11
- package/lib/Button.js +39 -32
- package/lib/Checkbox.d.ts +12 -5
- package/lib/Dialog.d.ts +18 -10
- package/lib/Dialog.js +6 -7
- package/lib/ExpandableBox.d.ts +8 -5
- package/lib/ExpandableBox.js +5 -20
- package/lib/FieldErrorMessage.d.ts +3 -3
- package/lib/FieldErrorMessage.js +8 -6
- package/lib/FieldHelper.d.ts +3 -3
- package/lib/FieldHelper.js +6 -4
- package/lib/FormControl.d.ts +4 -2
- package/lib/FormControl.js +2 -1
- package/lib/FramedContent.d.ts +8 -4
- package/lib/FramedContent.js +3 -16
- package/lib/Icon.d.ts +3 -2
- package/lib/Icon.js +8 -5
- package/lib/Input.d.ts +12 -11
- package/lib/Input.js +12 -9
- package/lib/Label.d.ts +16 -7
- package/lib/Label.js +9 -8
- package/lib/Menu.d.ts +66 -13
- package/lib/Menu.js +41 -15
- package/lib/MessageBox.d.ts +8 -4
- package/lib/MessageBox.js +3 -16
- package/lib/NdlaLogo.d.ts +5 -4
- package/lib/NdlaLogo.js +5 -4
- package/lib/Pagination.d.ts +17 -6
- package/lib/Popover.d.ts +34 -13
- package/lib/RadioGroup.d.ts +18 -7
- package/lib/RadioGroup.js +6 -2
- package/lib/Skeleton.d.ts +5 -2
- package/lib/Skeleton.js +3 -10
- package/lib/Slider.d.ts +18 -7
- package/lib/Spinner.d.ts +8 -3
- package/lib/Spinner.js +3 -16
- package/lib/Switch.d.ts +12 -7
- package/lib/Switch.js +9 -5
- package/lib/Table.d.ts +6 -3
- package/lib/Table.js +4 -8
- package/lib/Tabs.d.ts +145 -0
- package/lib/Tabs.js +240 -0
- package/lib/Text.d.ts +6 -9
- package/lib/Text.js +32 -33
- package/lib/Toast.d.ts +10 -7
- package/lib/Toast.js +15 -7
- package/lib/Tooltip.d.ts +19 -7
- package/lib/createStyleContext.d.ts +5 -3
- package/lib/createStyleContext.js +14 -6
- package/package.json +5 -5
package/es/Button.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { ark } from "@ark-ui/react";
|
|
11
|
+
import { css, cva } from "@ndla/styled-system/css";
|
|
11
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
export const buttonBaseRecipe = cva({
|
|
@@ -160,53 +161,59 @@ export const buttonRecipe = cva({
|
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
});
|
|
164
|
+
export const iconButtonRecipe = cva({
|
|
165
|
+
base: {
|
|
166
|
+
lineHeight: "1",
|
|
167
|
+
minHeight: "unset",
|
|
168
|
+
height: "fit-content",
|
|
169
|
+
"& svg": {
|
|
170
|
+
marginInline: "0",
|
|
171
|
+
marginBlock: "0",
|
|
172
|
+
width: "medium",
|
|
173
|
+
height: "medium"
|
|
174
|
+
},
|
|
175
|
+
paddingInline: "xsmall",
|
|
176
|
+
paddingBlock: "xsmall"
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
const StyledButton = styled(ark.button, {}, {
|
|
180
|
+
defaultProps: {
|
|
181
|
+
type: "button"
|
|
182
|
+
}
|
|
183
|
+
});
|
|
163
184
|
export const Button = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
164
185
|
let {
|
|
165
|
-
type,
|
|
166
|
-
size,
|
|
167
|
-
className,
|
|
168
186
|
variant,
|
|
169
|
-
|
|
187
|
+
size,
|
|
188
|
+
css: cssProp,
|
|
189
|
+
...props
|
|
170
190
|
} = _ref;
|
|
171
|
-
return /*#__PURE__*/_jsx(
|
|
172
|
-
|
|
173
|
-
|
|
191
|
+
return /*#__PURE__*/_jsx(StyledButton, {
|
|
192
|
+
...props,
|
|
193
|
+
css: css.raw(buttonBaseRecipe.raw({
|
|
174
194
|
variant
|
|
175
195
|
}), buttonRecipe.raw({
|
|
176
196
|
size
|
|
177
|
-
})
|
|
178
|
-
...rest,
|
|
197
|
+
}), cssProp),
|
|
179
198
|
ref: ref
|
|
180
199
|
});
|
|
181
200
|
});
|
|
201
|
+
const StyledIconButton = styled(ark.button, {}, {
|
|
202
|
+
defaultProps: {
|
|
203
|
+
type: "button"
|
|
204
|
+
}
|
|
205
|
+
});
|
|
182
206
|
export const IconButton = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
183
207
|
let {
|
|
184
|
-
type,
|
|
185
|
-
className,
|
|
186
208
|
variant,
|
|
187
|
-
|
|
209
|
+
css: cssProp,
|
|
210
|
+
...props
|
|
188
211
|
} = _ref2;
|
|
189
|
-
return /*#__PURE__*/_jsx(
|
|
190
|
-
|
|
191
|
-
|
|
212
|
+
return /*#__PURE__*/_jsx(StyledIconButton, {
|
|
213
|
+
...props,
|
|
214
|
+
css: css.raw(buttonBaseRecipe.raw({
|
|
192
215
|
variant
|
|
193
|
-
}), iconButtonRecipe.raw()
|
|
194
|
-
...rest,
|
|
216
|
+
}), iconButtonRecipe.raw(), cssProp),
|
|
195
217
|
ref: ref
|
|
196
218
|
});
|
|
197
|
-
});
|
|
198
|
-
export const iconButtonRecipe = cva({
|
|
199
|
-
base: {
|
|
200
|
-
lineHeight: "1",
|
|
201
|
-
minHeight: "unset",
|
|
202
|
-
height: "fit-content",
|
|
203
|
-
"& svg": {
|
|
204
|
-
marginInline: "0",
|
|
205
|
-
marginBlock: "0",
|
|
206
|
-
width: "medium",
|
|
207
|
-
height: "medium"
|
|
208
|
-
},
|
|
209
|
-
paddingInline: "xsmall",
|
|
210
|
-
paddingBlock: "xsmall"
|
|
211
|
-
}
|
|
212
219
|
});
|
package/es/Dialog.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
|
+
import { dialogAnatomy } from "@ark-ui/anatomy";
|
|
10
11
|
import { Dialog } from "@ark-ui/react";
|
|
11
12
|
import { sva } from "@ndla/styled-system/css";
|
|
12
13
|
import { styled } from "@ndla/styled-system/jsx";
|
|
@@ -14,9 +15,7 @@ import { createStyleContext } from "./createStyleContext";
|
|
|
14
15
|
import { Heading, Text } from "./Text";
|
|
15
16
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const dialogRecipe = sva({
|
|
17
|
-
|
|
18
|
-
slots: ["positioner", "backdrop", "content"],
|
|
19
|
-
className: "dialog",
|
|
18
|
+
slots: dialogAnatomy.keys(),
|
|
20
19
|
base: {
|
|
21
20
|
backdrop: {
|
|
22
21
|
position: "fixed",
|
|
@@ -278,29 +277,29 @@ export const DialogContent = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__
|
|
|
278
277
|
})
|
|
279
278
|
})]
|
|
280
279
|
}));
|
|
280
|
+
const InternalDialogDescription = withContext(Dialog.Description, "description");
|
|
281
281
|
export const DialogDescription = _ref2 => {
|
|
282
282
|
let {
|
|
283
283
|
textStyle = "body.large",
|
|
284
284
|
...rest
|
|
285
285
|
} = _ref2;
|
|
286
|
-
return /*#__PURE__*/_jsx(
|
|
286
|
+
return /*#__PURE__*/_jsx(InternalDialogDescription, {
|
|
287
287
|
asChild: true,
|
|
288
288
|
children: /*#__PURE__*/_jsx(Text, {
|
|
289
|
-
as: "p",
|
|
290
289
|
textStyle: textStyle,
|
|
291
290
|
...rest
|
|
292
291
|
})
|
|
293
292
|
});
|
|
294
293
|
};
|
|
294
|
+
const InternalDialogTitle = withContext(Dialog.Title, "title");
|
|
295
295
|
export const DialogTitle = _ref3 => {
|
|
296
296
|
let {
|
|
297
297
|
textStyle = "title.medium",
|
|
298
298
|
...rest
|
|
299
299
|
} = _ref3;
|
|
300
|
-
return /*#__PURE__*/_jsx(
|
|
300
|
+
return /*#__PURE__*/_jsx(InternalDialogTitle, {
|
|
301
301
|
asChild: true,
|
|
302
302
|
children: /*#__PURE__*/_jsx(Heading, {
|
|
303
|
-
as: "h1",
|
|
304
303
|
textStyle: textStyle,
|
|
305
304
|
...rest
|
|
306
305
|
})
|
package/es/ExpandableBox.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { ark } from "@ark-ui/react";
|
|
9
10
|
import { styled } from "@ndla/styled-system/jsx";
|
|
10
|
-
|
|
11
|
-
const StyledExpandableBox = styled("details", {
|
|
11
|
+
export const ExpandableBox = styled("details", {
|
|
12
12
|
base: {
|
|
13
13
|
transitionDuration: "fast",
|
|
14
14
|
width: "100%",
|
|
@@ -25,10 +25,7 @@ const StyledExpandableBox = styled("details", {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
export const
|
|
29
|
-
...props
|
|
30
|
-
});
|
|
31
|
-
const StyledExpandableBoxSummary = styled("summary", {
|
|
28
|
+
export const ExpandableBoxSummary = styled(ark.summary, {
|
|
32
29
|
base: {
|
|
33
30
|
cursor: "pointer",
|
|
34
31
|
margin: "-medium",
|
|
@@ -42,14 +39,4 @@ const StyledExpandableBoxSummary = styled("summary", {
|
|
|
42
39
|
textStyle: "label.large!"
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
|
-
});
|
|
46
|
-
export const ExpandableBoxSummary = _ref => {
|
|
47
|
-
let {
|
|
48
|
-
children,
|
|
49
|
-
...rest
|
|
50
|
-
} = _ref;
|
|
51
|
-
return /*#__PURE__*/_jsx(StyledExpandableBoxSummary, {
|
|
52
|
-
...rest,
|
|
53
|
-
children: children
|
|
54
|
-
});
|
|
55
|
-
};
|
|
42
|
+
});
|
package/es/FieldErrorMessage.js
CHANGED
|
@@ -7,14 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { ark } from "@ark-ui/react";
|
|
11
|
+
import { css } from "@ndla/styled-system/css";
|
|
11
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
13
|
import { useFormControlContext } from "./FormControl";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
const StyledErrorMessage = styled(
|
|
15
|
+
const StyledErrorMessage = styled(ark.div, {
|
|
15
16
|
base: {
|
|
16
17
|
color: "text.error",
|
|
17
|
-
whiteSpace: "pre-line"
|
|
18
|
+
whiteSpace: "pre-line",
|
|
19
|
+
justifyContent: "center"
|
|
18
20
|
}
|
|
19
21
|
});
|
|
20
22
|
export const FieldErrorMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
@@ -22,9 +24,9 @@ export const FieldErrorMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
22
24
|
let {
|
|
23
25
|
textStyle = "label.small",
|
|
24
26
|
fontWeight,
|
|
27
|
+
css: cssProp,
|
|
25
28
|
color,
|
|
26
29
|
srOnly,
|
|
27
|
-
className,
|
|
28
30
|
...props
|
|
29
31
|
} = _ref;
|
|
30
32
|
const field = useFormControlContext();
|
|
@@ -34,11 +36,11 @@ export const FieldErrorMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
34
36
|
ref,
|
|
35
37
|
...props
|
|
36
38
|
}),
|
|
37
|
-
|
|
39
|
+
css: css.raw({
|
|
38
40
|
textStyle,
|
|
39
41
|
fontWeight,
|
|
40
42
|
color,
|
|
41
|
-
srOnly
|
|
42
|
-
}
|
|
43
|
+
srOnly
|
|
44
|
+
}, cssProp)
|
|
43
45
|
});
|
|
44
46
|
});
|
package/es/FieldHelper.js
CHANGED
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { ark } from "@ark-ui/react";
|
|
11
|
+
import { css } from "@ndla/styled-system/css";
|
|
11
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
13
|
import { useFormControlContext } from "./FormControl";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
const StyledDiv = styled(ark.div);
|
|
14
16
|
export const FieldHelper = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
15
17
|
var _field$getHelpTextPro;
|
|
16
18
|
let {
|
|
@@ -18,20 +20,20 @@ export const FieldHelper = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
18
20
|
fontWeight,
|
|
19
21
|
color,
|
|
20
22
|
srOnly,
|
|
21
|
-
|
|
23
|
+
css: cssProp,
|
|
22
24
|
...props
|
|
23
25
|
} = _ref;
|
|
24
26
|
const field = useFormControlContext();
|
|
25
|
-
return /*#__PURE__*/_jsx(
|
|
27
|
+
return /*#__PURE__*/_jsx(StyledDiv, {
|
|
26
28
|
...((_field$getHelpTextPro = field === null || field === void 0 ? void 0 : field.getHelpTextProps(props, ref)) !== null && _field$getHelpTextPro !== void 0 ? _field$getHelpTextPro : {
|
|
27
29
|
ref,
|
|
28
30
|
...props
|
|
29
31
|
}),
|
|
30
|
-
|
|
32
|
+
css: css.raw({
|
|
31
33
|
textStyle,
|
|
32
34
|
fontWeight,
|
|
33
35
|
color,
|
|
34
36
|
srOnly
|
|
35
|
-
}
|
|
37
|
+
}, cssProp)
|
|
36
38
|
});
|
|
37
39
|
});
|
package/es/FormControl.js
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { createContext, useCallback, useContext, useState } from "react";
|
|
10
|
+
import { ark } from "@ark-ui/react";
|
|
10
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
11
12
|
import { composeRefs } from "@ndla/util";
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
const StyledFormControl = styled(
|
|
14
|
+
const StyledFormControl = styled(ark.div, {
|
|
14
15
|
base: {
|
|
15
16
|
display: "flex",
|
|
16
17
|
flexDirection: "column",
|
package/es/FramedContent.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { ark } from "@ark-ui/react";
|
|
10
|
+
import { cva } from "@ndla/styled-system/css";
|
|
10
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
const framedContentRecipe = cva({
|
|
13
13
|
base: {
|
|
14
14
|
padding: "medium",
|
|
@@ -39,16 +39,4 @@ const framedContentRecipe = cva({
|
|
|
39
39
|
colorTheme: "neutral"
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
export const FramedContent =
|
|
43
|
-
let {
|
|
44
|
-
className,
|
|
45
|
-
colorTheme,
|
|
46
|
-
...rest
|
|
47
|
-
} = _ref;
|
|
48
|
-
return /*#__PURE__*/_jsx(styled.div, {
|
|
49
|
-
className: cx(framedContentRecipe({
|
|
50
|
-
colorTheme
|
|
51
|
-
}), className),
|
|
52
|
-
...rest
|
|
53
|
-
});
|
|
54
|
-
};
|
|
42
|
+
export const FramedContent = styled(ark.div, framedContentRecipe);
|
package/es/Icon.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { cva,
|
|
9
|
+
import { cva, css } from "@ndla/styled-system/css";
|
|
10
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
10
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
export const iconRecipe = cva({
|
|
12
13
|
base: {
|
|
@@ -40,6 +41,8 @@ export const iconRecipe = cva({
|
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
});
|
|
44
|
+
const StyledSvg = styled("svg");
|
|
45
|
+
|
|
43
46
|
// TODO: Move this component over to ndla/icons
|
|
44
47
|
export const Icon = _ref => {
|
|
45
48
|
let {
|
|
@@ -50,18 +53,18 @@ export const Icon = _ref => {
|
|
|
50
53
|
description,
|
|
51
54
|
width,
|
|
52
55
|
height,
|
|
53
|
-
|
|
56
|
+
css: cssProp,
|
|
54
57
|
"aria-hidden": ariaHidden = true,
|
|
55
58
|
...props
|
|
56
59
|
} = _ref;
|
|
57
|
-
return /*#__PURE__*/_jsxs(
|
|
60
|
+
return /*#__PURE__*/_jsxs(StyledSvg, {
|
|
58
61
|
"data-icon": "",
|
|
59
62
|
"aria-hidden": ariaHidden,
|
|
60
63
|
preserveAspectRatio: "xMidYMid meet",
|
|
61
|
-
|
|
62
|
-
className: cx(iconRecipe({
|
|
64
|
+
css: css.raw(iconRecipe.raw({
|
|
63
65
|
size
|
|
64
|
-
}),
|
|
66
|
+
}), cssProp),
|
|
67
|
+
...props,
|
|
65
68
|
children: [title && /*#__PURE__*/_jsx("title", {
|
|
66
69
|
children: title
|
|
67
70
|
}), description && /*#__PURE__*/_jsx("desc", {
|
package/es/Input.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { createContext, forwardRef, useCallback, useContext, useEffect, useRef } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { ark } from "@ark-ui/react";
|
|
11
|
+
import { css } from "@ndla/styled-system/css";
|
|
11
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
13
|
import { composeRefs } from "@ndla/util";
|
|
13
14
|
import { useFormControl } from "./FormControl";
|
|
@@ -51,7 +52,7 @@ const inputCss = css.raw({
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
|
-
const StyledInputContainer = styled(
|
|
55
|
+
const StyledInputContainer = styled(ark.div, {
|
|
55
56
|
base: {
|
|
56
57
|
width: "100%",
|
|
57
58
|
display: "flex",
|
|
@@ -65,13 +66,13 @@ const StyledInputContainer = styled("div", {
|
|
|
65
66
|
export const InputContainer = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
66
67
|
let {
|
|
67
68
|
children,
|
|
68
|
-
|
|
69
|
+
css: cssProp,
|
|
69
70
|
...rest
|
|
70
71
|
} = _ref;
|
|
71
72
|
return /*#__PURE__*/_jsx(InputContext.Provider, {
|
|
72
73
|
value: {},
|
|
73
74
|
children: /*#__PURE__*/_jsx(StyledInputContainer, {
|
|
74
|
-
|
|
75
|
+
css: css.raw(inputCss, cssProp),
|
|
75
76
|
...rest,
|
|
76
77
|
ref: ref,
|
|
77
78
|
children: children
|
|
@@ -102,14 +103,15 @@ const baseTextAreaCss = css.raw({
|
|
|
102
103
|
resize: "none",
|
|
103
104
|
overflowY: "hidden"
|
|
104
105
|
});
|
|
106
|
+
const StyledInput = styled(ark.input);
|
|
105
107
|
export const Input = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
106
108
|
let {
|
|
107
|
-
|
|
109
|
+
css: cssProp,
|
|
108
110
|
...props
|
|
109
111
|
} = _ref2;
|
|
110
112
|
const context = useContext(InputContext);
|
|
111
|
-
return /*#__PURE__*/_jsx(
|
|
112
|
-
|
|
113
|
+
return /*#__PURE__*/_jsx(StyledInput, {
|
|
114
|
+
css: css.raw(baseInputCss, context ? undefined : inputCss, cssProp),
|
|
113
115
|
ref: ref,
|
|
114
116
|
...props
|
|
115
117
|
});
|
|
@@ -121,9 +123,10 @@ export const FormInput = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
121
123
|
ref: ref
|
|
122
124
|
});
|
|
123
125
|
});
|
|
126
|
+
const StyledTextArea = styled(ark.textarea);
|
|
124
127
|
export const TextArea = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
125
128
|
let {
|
|
126
|
-
|
|
129
|
+
css: cssProp,
|
|
127
130
|
...props
|
|
128
131
|
} = _ref3;
|
|
129
132
|
const context = useContext(InputContext);
|
|
@@ -144,8 +147,8 @@ export const TextArea = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
144
147
|
window.removeEventListener("resize", resize);
|
|
145
148
|
};
|
|
146
149
|
}, [resize]);
|
|
147
|
-
return /*#__PURE__*/_jsx(
|
|
148
|
-
|
|
150
|
+
return /*#__PURE__*/_jsx(StyledTextArea, {
|
|
151
|
+
css: css.raw(baseInputCss, context ? undefined : inputCss, baseTextAreaCss, cssProp),
|
|
149
152
|
ref: composeRefs(ref, localRef),
|
|
150
153
|
...props
|
|
151
154
|
});
|
package/es/Label.js
CHANGED
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { ark } from "@ark-ui/react";
|
|
11
|
+
import { css } from "@ndla/styled-system/css";
|
|
11
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
13
|
import { useFormControlContext } from "./FormControl";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
const StyledLegend = styled(
|
|
15
|
+
const StyledLegend = styled(ark.legend, {
|
|
15
16
|
base: {
|
|
16
17
|
float: "none",
|
|
17
18
|
width: "inherit",
|
|
@@ -24,16 +25,16 @@ export const Legend = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
24
25
|
let {
|
|
25
26
|
textStyle = "label.medium",
|
|
26
27
|
fontWeight = "bold",
|
|
27
|
-
|
|
28
|
+
css: cssProp,
|
|
28
29
|
srOnly,
|
|
29
30
|
...rest
|
|
30
31
|
} = _ref;
|
|
31
32
|
return /*#__PURE__*/_jsx(StyledLegend, {
|
|
32
|
-
|
|
33
|
+
css: css.raw({
|
|
33
34
|
textStyle,
|
|
34
35
|
fontWeight,
|
|
35
36
|
srOnly
|
|
36
|
-
}
|
|
37
|
+
}, cssProp),
|
|
37
38
|
...rest,
|
|
38
39
|
ref: ref
|
|
39
40
|
});
|
|
@@ -56,7 +57,7 @@ export const FormLegend = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
56
57
|
ref: ref
|
|
57
58
|
});
|
|
58
59
|
});
|
|
59
|
-
const StyledLabel = styled(
|
|
60
|
+
const StyledLabel = styled(ark.label, {
|
|
60
61
|
base: {
|
|
61
62
|
display: "inline-block",
|
|
62
63
|
_disabled: {
|
|
@@ -68,16 +69,16 @@ export const Label = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
68
69
|
let {
|
|
69
70
|
textStyle = "label.medium",
|
|
70
71
|
fontWeight = "bold",
|
|
71
|
-
|
|
72
|
+
css: cssProp,
|
|
72
73
|
srOnly,
|
|
73
74
|
...rest
|
|
74
75
|
} = _ref2;
|
|
75
76
|
return /*#__PURE__*/_jsx(StyledLabel, {
|
|
76
|
-
|
|
77
|
+
css: css.raw({
|
|
77
78
|
textStyle,
|
|
78
79
|
fontWeight,
|
|
79
80
|
srOnly
|
|
80
|
-
}
|
|
81
|
+
}, cssProp),
|
|
81
82
|
...rest,
|
|
82
83
|
ref: ref
|
|
83
84
|
});
|
package/es/Menu.js
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { forwardRef } from "react";
|
|
9
10
|
import { menuAnatomy } from "@ark-ui/anatomy";
|
|
10
11
|
import { Menu } from "@ark-ui/react";
|
|
11
|
-
import { cva, sva } from "@ndla/styled-system/css";
|
|
12
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
12
|
+
import { css, cva, sva } from "@ndla/styled-system/css";
|
|
13
13
|
import { createStyleContext } from "./createStyleContext";
|
|
14
14
|
import { Text } from "./Text";
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
const itemStyle = {
|
|
16
|
+
const itemStyle = css.raw({
|
|
17
17
|
display: "flex",
|
|
18
18
|
alignItems: "center",
|
|
19
19
|
borderRadius: "xsmall",
|
|
@@ -47,7 +47,7 @@ const itemStyle = {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
};
|
|
50
|
+
});
|
|
51
51
|
const itemCva = cva({
|
|
52
52
|
defaultVariants: {
|
|
53
53
|
variant: "action"
|
|
@@ -163,9 +163,35 @@ export const MenuItemGroupLabel = _ref2 => {
|
|
|
163
163
|
};
|
|
164
164
|
export const MenuItemGroup = withContext(Menu.ItemGroup, "itemGroup");
|
|
165
165
|
const InternalMenuItem = withContext(Menu.Item, "item");
|
|
166
|
-
export const MenuItem =
|
|
166
|
+
export const MenuItem = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
167
|
+
let {
|
|
168
|
+
css: cssProp = {},
|
|
169
|
+
variant,
|
|
170
|
+
...props
|
|
171
|
+
} = _ref3;
|
|
172
|
+
return /*#__PURE__*/_jsx(InternalMenuItem, {
|
|
173
|
+
css: [itemCva.raw({
|
|
174
|
+
variant
|
|
175
|
+
}), ...(Array.isArray(cssProp) ? cssProp : [cssProp])],
|
|
176
|
+
...props,
|
|
177
|
+
ref: ref
|
|
178
|
+
});
|
|
179
|
+
});
|
|
167
180
|
export const MenuPositioner = withContext(Menu.Positioner, "positioner");
|
|
168
181
|
const InternalMenuTriggerItem = withContext(Menu.TriggerItem, "triggerItem");
|
|
169
|
-
export const MenuTriggerItem =
|
|
182
|
+
export const MenuTriggerItem = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
183
|
+
let {
|
|
184
|
+
css: cssProp = {},
|
|
185
|
+
variant,
|
|
186
|
+
...props
|
|
187
|
+
} = _ref4;
|
|
188
|
+
return /*#__PURE__*/_jsx(InternalMenuTriggerItem, {
|
|
189
|
+
css: [itemCva.raw({
|
|
190
|
+
variant
|
|
191
|
+
}), ...(Array.isArray(cssProp) ? cssProp : [cssProp])],
|
|
192
|
+
...props,
|
|
193
|
+
ref: ref
|
|
194
|
+
});
|
|
195
|
+
});
|
|
170
196
|
export const MenuTrigger = withContext(Menu.Trigger, "trigger");
|
|
171
197
|
export const MenuSeparator = withContext(Menu.Separator, "separator");
|
package/es/MessageBox.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { ark } from "@ark-ui/react";
|
|
10
|
+
import { cva } from "@ndla/styled-system/css";
|
|
10
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
const messageBoxRecipe = cva({
|
|
13
13
|
base: {
|
|
14
14
|
display: "flex",
|
|
@@ -42,16 +42,4 @@ const messageBoxRecipe = cva({
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
export const MessageBox =
|
|
46
|
-
let {
|
|
47
|
-
className,
|
|
48
|
-
variant,
|
|
49
|
-
...rest
|
|
50
|
-
} = _ref;
|
|
51
|
-
return /*#__PURE__*/_jsx(styled.div, {
|
|
52
|
-
className: cx(messageBoxRecipe({
|
|
53
|
-
variant
|
|
54
|
-
}), className),
|
|
55
|
-
...rest
|
|
56
|
-
});
|
|
57
|
-
};
|
|
45
|
+
export const MessageBox = styled(ark.div, messageBoxRecipe);
|
package/es/NdlaLogo.js
CHANGED
|
@@ -6,19 +6,20 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { css
|
|
9
|
+
import { css } from "@ndla/styled-system/css";
|
|
10
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
10
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
const BaseSvg = _ref => {
|
|
12
13
|
let {
|
|
13
14
|
color = "primary",
|
|
14
|
-
|
|
15
|
+
css: cssProp,
|
|
15
16
|
...props
|
|
16
17
|
} = _ref;
|
|
17
|
-
return /*#__PURE__*/_jsx(
|
|
18
|
+
return /*#__PURE__*/_jsx(styled.svg, {
|
|
18
19
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19
|
-
|
|
20
|
+
css: css.raw({
|
|
20
21
|
color
|
|
21
|
-
}
|
|
22
|
+
}, cssProp),
|
|
22
23
|
...props
|
|
23
24
|
});
|
|
24
25
|
};
|
package/es/RadioGroup.js
CHANGED
|
@@ -107,14 +107,18 @@ const InternalRadioGroupItemText = withContext(RadioGroup.ItemText, "itemText");
|
|
|
107
107
|
export const RadioGroupItemText = _ref => {
|
|
108
108
|
let {
|
|
109
109
|
textStyle = "label.medium",
|
|
110
|
+
children,
|
|
110
111
|
...props
|
|
111
112
|
} = _ref;
|
|
112
113
|
return /*#__PURE__*/_jsx(InternalRadioGroupItemText, {
|
|
113
114
|
asChild: true,
|
|
114
115
|
children: /*#__PURE__*/_jsx(Text, {
|
|
115
|
-
|
|
116
|
+
asChild: true,
|
|
116
117
|
textStyle: textStyle,
|
|
117
|
-
...props
|
|
118
|
+
...props,
|
|
119
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
120
|
+
children: children
|
|
121
|
+
})
|
|
118
122
|
})
|
|
119
123
|
});
|
|
120
124
|
};
|
package/es/Skeleton.js
CHANGED
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { ark } from "@ark-ui/react";
|
|
10
10
|
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
|
|
12
|
-
const StyledDiv = styled(ark.div, {
|
|
11
|
+
export const Skeleton = styled(ark.div, {
|
|
13
12
|
base: {
|
|
14
13
|
animation: "skeleton-pulse",
|
|
15
14
|
backgroundColor: "surface.disabled",
|
|
@@ -23,9 +22,4 @@ const StyledDiv = styled(ark.div, {
|
|
|
23
22
|
visibility: "hidden"
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
|
-
});
|
|
27
|
-
export const Skeleton = props => {
|
|
28
|
-
return /*#__PURE__*/_jsx(StyledDiv, {
|
|
29
|
-
...props
|
|
30
|
-
});
|
|
31
|
-
};
|
|
25
|
+
});
|