@ndla/primitives 0.0.2 → 0.0.4
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 +95 -25
- package/dist/styles.css +340 -50
- package/es/ArticleLists.js +4 -32
- package/es/Badge.js +4 -16
- package/es/BlockQuote.js +5 -17
- package/es/Button.js +40 -33
- package/es/Checkbox.js +160 -51
- package/es/Dialog.js +6 -7
- package/es/ExpandableBox.js +4 -17
- package/es/Field.js +17 -0
- package/es/FieldErrorMessage.js +12 -16
- package/es/FieldHelper.js +9 -12
- package/es/FramedContent.js +3 -15
- package/es/Icon.js +9 -6
- package/es/Input.js +25 -23
- package/es/Label.js +15 -39
- package/es/Menu.js +32 -6
- package/es/MessageBox.js +3 -15
- package/es/NdlaLogo.js +6 -5
- package/es/RadioGroup.js +7 -11
- package/es/Skeleton.js +2 -8
- package/es/Spinner.js +3 -15
- package/es/Switch.js +8 -15
- package/es/Table.js +2 -5
- package/es/Tabs.js +231 -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 +9 -3
- package/lib/BlockQuote.js +5 -18
- package/lib/Button.d.ts +24 -11
- package/lib/Button.js +39 -32
- package/lib/Checkbox.d.ts +172 -5
- package/lib/Checkbox.js +165 -56
- 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/Field.d.ts +9 -0
- package/lib/Field.js +23 -0
- package/lib/FieldErrorMessage.d.ts +3 -3
- package/lib/FieldErrorMessage.js +11 -15
- package/lib/FieldHelper.d.ts +3 -3
- package/lib/FieldHelper.js +8 -11
- 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 +25 -23
- package/lib/Label.d.ts +13 -7
- package/lib/Label.js +15 -39
- 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 +7 -11
- 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 +13 -20
- package/lib/Table.d.ts +6 -3
- package/lib/Table.js +4 -8
- package/lib/Tabs.d.ts +145 -0
- package/lib/Tabs.js +239 -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/FormControl.js +0 -163
- package/lib/FormControl.d.ts +0 -65
- package/lib/FormControl.js +0 -173
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,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { createContext, forwardRef, useCallback, useContext, useEffect, useRef } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { Field, 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
|
-
import { useFormControl } from "./FormControl";
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
const InputContext = /*#__PURE__*/createContext(undefined);
|
|
16
16
|
const inputCss = css.raw({
|
|
@@ -51,7 +51,7 @@ const inputCss = css.raw({
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
const StyledInputContainer = styled(
|
|
54
|
+
const StyledInputContainer = styled(ark.div, {
|
|
55
55
|
base: {
|
|
56
56
|
width: "100%",
|
|
57
57
|
display: "flex",
|
|
@@ -65,13 +65,13 @@ const StyledInputContainer = styled("div", {
|
|
|
65
65
|
export const InputContainer = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
66
66
|
let {
|
|
67
67
|
children,
|
|
68
|
-
|
|
68
|
+
css: cssProp,
|
|
69
69
|
...rest
|
|
70
70
|
} = _ref;
|
|
71
71
|
return /*#__PURE__*/_jsx(InputContext.Provider, {
|
|
72
72
|
value: {},
|
|
73
73
|
children: /*#__PURE__*/_jsx(StyledInputContainer, {
|
|
74
|
-
|
|
74
|
+
css: css.raw(inputCss, cssProp),
|
|
75
75
|
...rest,
|
|
76
76
|
ref: ref,
|
|
77
77
|
children: children
|
|
@@ -102,28 +102,30 @@ const baseTextAreaCss = css.raw({
|
|
|
102
102
|
resize: "none",
|
|
103
103
|
overflowY: "hidden"
|
|
104
104
|
});
|
|
105
|
+
const StyledInput = styled(ark.input);
|
|
105
106
|
export const Input = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
106
107
|
let {
|
|
107
|
-
|
|
108
|
+
css: cssProp,
|
|
108
109
|
...props
|
|
109
110
|
} = _ref2;
|
|
110
111
|
const context = useContext(InputContext);
|
|
111
|
-
return /*#__PURE__*/_jsx(
|
|
112
|
-
|
|
112
|
+
return /*#__PURE__*/_jsx(StyledInput, {
|
|
113
|
+
css: css.raw(baseInputCss, context ? undefined : inputCss, cssProp),
|
|
113
114
|
ref: ref,
|
|
114
115
|
...props
|
|
115
116
|
});
|
|
116
117
|
});
|
|
117
|
-
export const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
...
|
|
118
|
+
export const FieldInput = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/_jsx(Field.Input, {
|
|
119
|
+
asChild: true,
|
|
120
|
+
children: /*#__PURE__*/_jsx(Input, {
|
|
121
|
+
...props,
|
|
121
122
|
ref: ref
|
|
122
|
-
})
|
|
123
|
-
});
|
|
123
|
+
})
|
|
124
|
+
}));
|
|
125
|
+
const StyledTextArea = styled(ark.textarea);
|
|
124
126
|
export const TextArea = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
125
127
|
let {
|
|
126
|
-
|
|
128
|
+
css: cssProp,
|
|
127
129
|
...props
|
|
128
130
|
} = _ref3;
|
|
129
131
|
const context = useContext(InputContext);
|
|
@@ -144,16 +146,16 @@ export const TextArea = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
144
146
|
window.removeEventListener("resize", resize);
|
|
145
147
|
};
|
|
146
148
|
}, [resize]);
|
|
147
|
-
return /*#__PURE__*/_jsx(
|
|
148
|
-
|
|
149
|
+
return /*#__PURE__*/_jsx(StyledTextArea, {
|
|
150
|
+
css: css.raw(baseInputCss, context ? undefined : inputCss, baseTextAreaCss, cssProp),
|
|
149
151
|
ref: composeRefs(ref, localRef),
|
|
150
152
|
...props
|
|
151
153
|
});
|
|
152
154
|
});
|
|
153
|
-
export const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
...
|
|
155
|
+
export const FieldTextArea = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/_jsx(Field.Textarea, {
|
|
156
|
+
asChild: true,
|
|
157
|
+
children: /*#__PURE__*/_jsx(TextArea, {
|
|
158
|
+
...props,
|
|
157
159
|
ref: ref
|
|
158
|
-
})
|
|
159
|
-
});
|
|
160
|
+
})
|
|
161
|
+
}));
|
package/es/Label.js
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { Field, ark } from "@ark-ui/react";
|
|
11
|
+
import { css } from "@ndla/styled-system/css";
|
|
11
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
|
-
import { useFormControlContext } from "./FormControl";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
const StyledLegend = styled(
|
|
14
|
+
const StyledLegend = styled(ark.legend, {
|
|
15
15
|
base: {
|
|
16
16
|
float: "none",
|
|
17
17
|
width: "inherit",
|
|
@@ -24,39 +24,21 @@ export const Legend = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
24
24
|
let {
|
|
25
25
|
textStyle = "label.medium",
|
|
26
26
|
fontWeight = "bold",
|
|
27
|
-
|
|
27
|
+
css: cssProp,
|
|
28
28
|
srOnly,
|
|
29
29
|
...rest
|
|
30
30
|
} = _ref;
|
|
31
31
|
return /*#__PURE__*/_jsx(StyledLegend, {
|
|
32
|
-
|
|
32
|
+
css: css.raw({
|
|
33
33
|
textStyle,
|
|
34
34
|
fontWeight,
|
|
35
35
|
srOnly
|
|
36
|
-
}
|
|
36
|
+
}, cssProp),
|
|
37
37
|
...rest,
|
|
38
38
|
ref: ref
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
|
-
|
|
42
|
-
var _control$getLabelProp;
|
|
43
|
-
const control = useFormControlContext();
|
|
44
|
-
// Legend does not use htmlFor (for), so we remove it.
|
|
45
|
-
const {
|
|
46
|
-
id: _,
|
|
47
|
-
htmlFor: __,
|
|
48
|
-
...fieldProps
|
|
49
|
-
} = (_control$getLabelProp = control === null || control === void 0 ? void 0 : control.getLabelProps(props, ref)) !== null && _control$getLabelProp !== void 0 ? _control$getLabelProp : {
|
|
50
|
-
ref,
|
|
51
|
-
...props
|
|
52
|
-
};
|
|
53
|
-
return /*#__PURE__*/_jsx(Legend, {
|
|
54
|
-
...props,
|
|
55
|
-
...fieldProps,
|
|
56
|
-
ref: ref
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
const StyledLabel = styled("label", {
|
|
41
|
+
const StyledLabel = styled(ark.label, {
|
|
60
42
|
base: {
|
|
61
43
|
display: "inline-block",
|
|
62
44
|
_disabled: {
|
|
@@ -68,33 +50,27 @@ export const Label = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
68
50
|
let {
|
|
69
51
|
textStyle = "label.medium",
|
|
70
52
|
fontWeight = "bold",
|
|
71
|
-
|
|
53
|
+
css: cssProp,
|
|
72
54
|
srOnly,
|
|
73
55
|
...rest
|
|
74
56
|
} = _ref2;
|
|
75
57
|
return /*#__PURE__*/_jsx(StyledLabel, {
|
|
76
|
-
|
|
58
|
+
css: css.raw({
|
|
77
59
|
textStyle,
|
|
78
60
|
fontWeight,
|
|
79
61
|
srOnly
|
|
80
|
-
}
|
|
62
|
+
}, cssProp),
|
|
81
63
|
...rest,
|
|
82
64
|
ref: ref
|
|
83
65
|
});
|
|
84
66
|
});
|
|
85
|
-
export const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const fieldProps = (_control$getLabelProp2 = control === null || control === void 0 ? void 0 : control.getLabelProps(props, ref)) !== null && _control$getLabelProp2 !== void 0 ? _control$getLabelProp2 : {
|
|
89
|
-
ref,
|
|
90
|
-
...props
|
|
91
|
-
};
|
|
92
|
-
return /*#__PURE__*/_jsx(Label, {
|
|
67
|
+
export const FieldLabel = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/_jsx(Field.Label, {
|
|
68
|
+
asChild: true,
|
|
69
|
+
children: /*#__PURE__*/_jsx(Label, {
|
|
93
70
|
...props,
|
|
94
|
-
...fieldProps,
|
|
95
71
|
ref: ref
|
|
96
|
-
})
|
|
97
|
-
});
|
|
72
|
+
})
|
|
73
|
+
}));
|
|
98
74
|
export const Fieldset = styled("fieldset", {
|
|
99
75
|
base: {
|
|
100
76
|
border: "none",
|
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
|
@@ -11,7 +11,6 @@ import { radioGroupAnatomy } from "@ark-ui/anatomy";
|
|
|
11
11
|
import { RadioGroup } from "@ark-ui/react";
|
|
12
12
|
import { sva } from "@ndla/styled-system/css";
|
|
13
13
|
import { createStyleContext } from "./createStyleContext";
|
|
14
|
-
import { useFormControl } from "./FormControl";
|
|
15
14
|
import { Label } from "./Label";
|
|
16
15
|
import { Text } from "./Text";
|
|
17
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -92,14 +91,7 @@ const {
|
|
|
92
91
|
withProvider,
|
|
93
92
|
withContext
|
|
94
93
|
} = createStyleContext(radioGroupRecipe);
|
|
95
|
-
const
|
|
96
|
-
export const RadioGroupRoot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
97
|
-
const field = useFormControl(props);
|
|
98
|
-
return /*#__PURE__*/_jsx(InternalRadioGroupRoot, {
|
|
99
|
-
...field,
|
|
100
|
-
ref: ref
|
|
101
|
-
});
|
|
102
|
-
});
|
|
94
|
+
export const RadioGroupRoot = withProvider(RadioGroup.Root, "root");
|
|
103
95
|
export const RadioGroupIndicator = withContext(RadioGroup.Indicator, "indicator");
|
|
104
96
|
export const RadioGroupItemControl = withContext(RadioGroup.ItemControl, "itemControl");
|
|
105
97
|
export const RadioGroupItem = withContext(RadioGroup.Item, "item");
|
|
@@ -107,14 +99,18 @@ const InternalRadioGroupItemText = withContext(RadioGroup.ItemText, "itemText");
|
|
|
107
99
|
export const RadioGroupItemText = _ref => {
|
|
108
100
|
let {
|
|
109
101
|
textStyle = "label.medium",
|
|
102
|
+
children,
|
|
110
103
|
...props
|
|
111
104
|
} = _ref;
|
|
112
105
|
return /*#__PURE__*/_jsx(InternalRadioGroupItemText, {
|
|
113
106
|
asChild: true,
|
|
114
107
|
children: /*#__PURE__*/_jsx(Text, {
|
|
115
|
-
|
|
108
|
+
asChild: true,
|
|
116
109
|
textStyle: textStyle,
|
|
117
|
-
...props
|
|
110
|
+
...props,
|
|
111
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
112
|
+
children: children
|
|
113
|
+
})
|
|
118
114
|
})
|
|
119
115
|
});
|
|
120
116
|
};
|
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
|
+
});
|
package/es/Spinner.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
|
export const spinnerRecipe = cva({
|
|
13
13
|
base: {
|
|
14
14
|
borderRadius: "full",
|
|
@@ -39,16 +39,4 @@ export const spinnerRecipe = cva({
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
export const Spinner =
|
|
43
|
-
let {
|
|
44
|
-
size,
|
|
45
|
-
className,
|
|
46
|
-
...props
|
|
47
|
-
} = _ref;
|
|
48
|
-
return /*#__PURE__*/_jsx(styled.div, {
|
|
49
|
-
className: cx(spinnerRecipe({
|
|
50
|
-
size
|
|
51
|
-
}), className),
|
|
52
|
-
...props
|
|
53
|
-
});
|
|
54
|
-
};
|
|
42
|
+
export const Spinner = styled(ark.div, spinnerRecipe);
|
package/es/Switch.js
CHANGED
|
@@ -6,12 +6,10 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { forwardRef } from "react";
|
|
10
9
|
import { switchAnatomy } from "@ark-ui/anatomy";
|
|
11
10
|
import { Switch } from "@ark-ui/react";
|
|
12
11
|
import { sva } from "@ndla/styled-system/css";
|
|
13
12
|
import { createStyleContext } from "./createStyleContext";
|
|
14
|
-
import { useFormControl } from "./FormControl";
|
|
15
13
|
import { Text } from "./Text";
|
|
16
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
15
|
const switchRecipe = sva({
|
|
@@ -100,30 +98,25 @@ const {
|
|
|
100
98
|
withProvider,
|
|
101
99
|
withContext
|
|
102
100
|
} = createStyleContext(switchRecipe);
|
|
103
|
-
export const
|
|
104
|
-
export const SwitchRoot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
105
|
-
var _field$invalid;
|
|
106
|
-
const field = useFormControl(props);
|
|
107
|
-
return /*#__PURE__*/_jsx(InternalSwitchRoot, {
|
|
108
|
-
invalid: (_field$invalid = field.invalid) !== null && _field$invalid !== void 0 ? _field$invalid : !!field["aria-invalid"],
|
|
109
|
-
...field,
|
|
110
|
-
ref: ref
|
|
111
|
-
});
|
|
112
|
-
});
|
|
101
|
+
export const SwitchRoot = withProvider(Switch.Root, "root");
|
|
113
102
|
export const SwitchControl = withContext(Switch.Control, "control");
|
|
114
103
|
export const SwitchThumb = withContext(Switch.Thumb, "thumb");
|
|
115
|
-
|
|
104
|
+
const InternalSwitchLabel = withContext(Switch.Label, "label");
|
|
116
105
|
export const SwitchLabel = _ref => {
|
|
117
106
|
let {
|
|
118
107
|
textStyle = "label.medium",
|
|
108
|
+
children,
|
|
119
109
|
...props
|
|
120
110
|
} = _ref;
|
|
121
111
|
return /*#__PURE__*/_jsx(InternalSwitchLabel, {
|
|
122
112
|
asChild: true,
|
|
123
113
|
children: /*#__PURE__*/_jsx(Text, {
|
|
124
|
-
|
|
114
|
+
asChild: true,
|
|
125
115
|
textStyle: textStyle,
|
|
126
|
-
...props
|
|
116
|
+
...props,
|
|
117
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
118
|
+
children: children
|
|
119
|
+
})
|
|
127
120
|
})
|
|
128
121
|
});
|
|
129
122
|
};
|
package/es/Table.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 StyledTable = styled("table", {
|
|
11
|
+
export const Table = styled(ark.table, {
|
|
12
12
|
base: {
|
|
13
13
|
display: "block",
|
|
14
14
|
overflowX: "auto",
|
|
@@ -69,7 +69,4 @@ const StyledTable = styled("table", {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
});
|
|
73
|
-
export const Table = props => /*#__PURE__*/_jsx(StyledTable, {
|
|
74
|
-
...props
|
|
75
72
|
});
|