@ndla/primitives 0.0.3 → 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 +49 -26
- package/dist/styles.css +170 -80
- package/es/BlockQuote.js +2 -2
- package/es/Checkbox.js +160 -51
- package/es/Field.js +17 -0
- package/es/FieldErrorMessage.js +6 -12
- package/es/FieldHelper.js +6 -11
- package/es/Input.js +13 -14
- package/es/Label.js +6 -31
- package/es/RadioGroup.js +1 -9
- package/es/Switch.js +1 -12
- package/es/Tabs.js +2 -3
- package/lib/BlockQuote.d.ts +1 -0
- package/lib/BlockQuote.js +2 -2
- package/lib/Checkbox.d.ts +162 -2
- package/lib/Checkbox.js +165 -56
- package/lib/Field.d.ts +9 -0
- package/lib/Field.js +23 -0
- package/lib/FieldErrorMessage.js +5 -11
- package/lib/FieldHelper.js +5 -10
- package/lib/Input.d.ts +2 -2
- package/lib/Input.js +13 -14
- package/lib/Label.d.ts +1 -4
- package/lib/Label.js +6 -31
- package/lib/RadioGroup.js +1 -9
- package/lib/Switch.js +6 -17
- package/lib/Tabs.js +2 -3
- package/package.json +3 -3
- package/es/FormControl.js +0 -164
- package/lib/FormControl.d.ts +0 -67
- package/lib/FormControl.js +0 -174
package/es/Checkbox.js
CHANGED
|
@@ -6,12 +6,10 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { forwardRef } from "react";
|
|
10
9
|
import { checkboxAnatomy } from "@ark-ui/anatomy";
|
|
11
10
|
import { Checkbox } 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 checkboxRecipe = sva({
|
|
@@ -22,19 +20,12 @@ const checkboxRecipe = sva({
|
|
|
22
20
|
display: "flex",
|
|
23
21
|
alignItems: "center",
|
|
24
22
|
cursor: "pointer",
|
|
25
|
-
gap: "xxsmall",
|
|
26
23
|
_disabled: {
|
|
27
24
|
color: "text.disabled",
|
|
28
|
-
cursor: "not-allowed"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
_focus: {
|
|
34
|
-
outline: "2px solid",
|
|
35
|
-
outlineOffset: "4xsmall",
|
|
36
|
-
outlineColor: "stroke.default",
|
|
37
|
-
borderRadius: "xsmall"
|
|
25
|
+
cursor: "not-allowed",
|
|
26
|
+
_hover: {
|
|
27
|
+
color: "text.disabled"
|
|
28
|
+
}
|
|
38
29
|
}
|
|
39
30
|
},
|
|
40
31
|
control: {
|
|
@@ -44,39 +35,167 @@ const checkboxRecipe = sva({
|
|
|
44
35
|
cursor: "pointer",
|
|
45
36
|
width: "medium",
|
|
46
37
|
height: "medium",
|
|
47
|
-
background: "surface.default",
|
|
48
|
-
borderRadius: "xsmall",
|
|
49
|
-
border: "2px solid",
|
|
50
|
-
borderColor: "stroke.subtle",
|
|
51
38
|
color: "text.strong",
|
|
52
39
|
transitionDuration: "normal",
|
|
53
40
|
transitionProperty: "border-color, background, box-shadow, color",
|
|
54
|
-
transitionTimingFunction: "default"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
transitionTimingFunction: "default"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
variant: "checkbox"
|
|
46
|
+
},
|
|
47
|
+
variants: {
|
|
48
|
+
variant: {
|
|
49
|
+
checkbox: {
|
|
50
|
+
root: {
|
|
51
|
+
gap: "xxsmall",
|
|
52
|
+
_hover: {
|
|
53
|
+
color: "text.action"
|
|
54
|
+
},
|
|
55
|
+
_focus: {
|
|
56
|
+
outline: "2px solid",
|
|
57
|
+
outlineOffset: "4xsmall",
|
|
58
|
+
outlineColor: "stroke.default",
|
|
59
|
+
borderRadius: "xsmall"
|
|
60
|
+
}
|
|
69
61
|
},
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
control: {
|
|
63
|
+
border: "2px solid",
|
|
64
|
+
borderColor: "stroke.subtle",
|
|
65
|
+
borderRadius: "xsmall",
|
|
66
|
+
background: "surface.default",
|
|
67
|
+
_hover: {
|
|
68
|
+
boxShadow: "0 0 0 4px var(--shadow-color)",
|
|
69
|
+
boxShadowColor: "surface.actionSubtle.hover.strong"
|
|
70
|
+
},
|
|
71
|
+
_checked: {
|
|
72
|
+
backgroundColor: "surface.action",
|
|
73
|
+
borderColor: "surface.action",
|
|
74
|
+
color: "icon.onAction"
|
|
75
|
+
},
|
|
76
|
+
_disabled: {
|
|
77
|
+
borderColor: "stroke.disabled",
|
|
78
|
+
_hover: {
|
|
79
|
+
borderColor: "stroke.disabled",
|
|
80
|
+
boxShadow: "none"
|
|
81
|
+
},
|
|
82
|
+
_checked: {
|
|
83
|
+
background: "surface.disabled"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
_invalid: {
|
|
87
|
+
borderColor: "stroke.error",
|
|
88
|
+
_checked: {
|
|
89
|
+
color: "stroke.error",
|
|
90
|
+
borderColor: "stroke.error",
|
|
91
|
+
backgroundColor: "surface.default"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
72
94
|
}
|
|
73
95
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
color: "
|
|
78
|
-
|
|
79
|
-
|
|
96
|
+
chip: {
|
|
97
|
+
root: {
|
|
98
|
+
width: "fit-content",
|
|
99
|
+
color: "text.default",
|
|
100
|
+
gap: "4xsmall",
|
|
101
|
+
background: "surface.actionSubtle",
|
|
102
|
+
border: "1px solid",
|
|
103
|
+
borderColor: "stroke.subtle",
|
|
104
|
+
outlineColor: "stroke.subtle",
|
|
105
|
+
paddingInline: "xsmall",
|
|
106
|
+
paddingBlock: "4xsmall",
|
|
107
|
+
borderRadius: "large",
|
|
108
|
+
minHeight: "large",
|
|
109
|
+
transitionDuration: "normal",
|
|
110
|
+
transitionProperty: "border-color, background, box-shadow, color",
|
|
111
|
+
transitionTimingFunction: "default",
|
|
112
|
+
_disabled: {
|
|
113
|
+
color: "text.disabled",
|
|
114
|
+
borderColor: "stroke.disabled",
|
|
115
|
+
background: "surface.disabled",
|
|
116
|
+
_hover: {
|
|
117
|
+
color: "text.disabled",
|
|
118
|
+
borderColor: "stroke.disabled",
|
|
119
|
+
background: "surface.disabled"
|
|
120
|
+
},
|
|
121
|
+
_checked: {
|
|
122
|
+
color: "text.disabled",
|
|
123
|
+
borderColor: "stroke.disabled",
|
|
124
|
+
background: "surface.disabled",
|
|
125
|
+
_hover: {
|
|
126
|
+
color: "text.disabled",
|
|
127
|
+
borderColor: "stroke.disabled",
|
|
128
|
+
background: "surface.disabled"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
_hover: {
|
|
133
|
+
background: "surface.actionSubtle.hover",
|
|
134
|
+
borderColor: "stroke.hover",
|
|
135
|
+
outlineColor: "stroke.hover",
|
|
136
|
+
_invalid: {
|
|
137
|
+
backgroundColor: "surface.dangerSubtle"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
_checked: {
|
|
141
|
+
color: "text.onAction",
|
|
142
|
+
background: "surface.actionSubtle.selected",
|
|
143
|
+
borderColor: "surface.actionSubtle.selected",
|
|
144
|
+
outlineColor: "icon.onAction",
|
|
145
|
+
_focus: {
|
|
146
|
+
outlineOffset: "-4px"
|
|
147
|
+
},
|
|
148
|
+
_hover: {
|
|
149
|
+
outlineOffset: "-2px",
|
|
150
|
+
background: "surface.actionSubtle.hover",
|
|
151
|
+
color: "text.default",
|
|
152
|
+
borderColor: "stroke.hover",
|
|
153
|
+
outlineColor: "stroke.hover"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
_invalid: {
|
|
157
|
+
borderColor: "stroke.error",
|
|
158
|
+
outlineColor: "stroke.error",
|
|
159
|
+
background: "surface.dangerSubtle",
|
|
160
|
+
outlineOffset: "-2px",
|
|
161
|
+
_checked: {
|
|
162
|
+
color: "text.default",
|
|
163
|
+
borderColor: "stroke.error",
|
|
164
|
+
outlineColor: "stroke.error",
|
|
165
|
+
background: "surface.dangerSubtle",
|
|
166
|
+
outlineOffset: "-2px",
|
|
167
|
+
_hover: {
|
|
168
|
+
borderColor: "stroke.hover",
|
|
169
|
+
outlineColor: "stroke.hover"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
_focus: {
|
|
174
|
+
outlineStyle: "solid",
|
|
175
|
+
outlineWidth: "2px",
|
|
176
|
+
outlineOffset: "-2px"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
control: {
|
|
180
|
+
display: "none",
|
|
181
|
+
_checked: {
|
|
182
|
+
display: "flex",
|
|
183
|
+
color: "text.onAction",
|
|
184
|
+
_hover: {
|
|
185
|
+
color: "stroke.hover"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
_disabled: {
|
|
189
|
+
color: "stroke.disabled",
|
|
190
|
+
_hover: {
|
|
191
|
+
color: "stroke.disabled"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
_invalid: {
|
|
195
|
+
_checked: {
|
|
196
|
+
color: "stroke.error"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
80
199
|
}
|
|
81
200
|
}
|
|
82
201
|
}
|
|
@@ -86,17 +205,7 @@ const {
|
|
|
86
205
|
withProvider,
|
|
87
206
|
withContext
|
|
88
207
|
} = createStyleContext(checkboxRecipe);
|
|
89
|
-
const
|
|
90
|
-
export const CheckboxRoot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
91
|
-
var _field$invalid;
|
|
92
|
-
const field = useFormControl(props);
|
|
93
|
-
return /*#__PURE__*/_jsx(InternalCheckboxRoot, {
|
|
94
|
-
...field,
|
|
95
|
-
invalid: (_field$invalid = field.invalid) !== null && _field$invalid !== void 0 ? _field$invalid : !!field["aria-invalid"],
|
|
96
|
-
ref: ref,
|
|
97
|
-
"aria-invalid": undefined
|
|
98
|
-
});
|
|
99
|
-
});
|
|
208
|
+
export const CheckboxRoot = withProvider(Checkbox.Root, "root");
|
|
100
209
|
export const CheckboxIndicator = withContext(Checkbox.Indicator, "indicator");
|
|
101
210
|
const InternalCheckboxLabel = withContext(Checkbox.Label, "label");
|
|
102
211
|
export const CheckboxLabel = _ref => {
|
package/es/Field.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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 { Field } from "@ark-ui/react";
|
|
10
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
+
export const FieldRoot = styled(Field.Root, {
|
|
12
|
+
base: {
|
|
13
|
+
display: "flex",
|
|
14
|
+
flexDirection: "column",
|
|
15
|
+
gap: "3xsmall"
|
|
16
|
+
}
|
|
17
|
+
});
|
package/es/FieldErrorMessage.js
CHANGED
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { Field } from "@ark-ui/react";
|
|
11
11
|
import { css } from "@ndla/styled-system/css";
|
|
12
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
13
|
-
import { useFormControlContext } from "./FormControl";
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
const
|
|
14
|
+
const StyledErrorText = styled(Field.ErrorText, {
|
|
16
15
|
base: {
|
|
17
16
|
color: "text.error",
|
|
18
17
|
whiteSpace: "pre-line",
|
|
@@ -20,7 +19,6 @@ const StyledErrorMessage = styled(ark.div, {
|
|
|
20
19
|
}
|
|
21
20
|
});
|
|
22
21
|
export const FieldErrorMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
23
|
-
var _field$getErrorMessag;
|
|
24
22
|
let {
|
|
25
23
|
textStyle = "label.small",
|
|
26
24
|
fontWeight,
|
|
@@ -29,18 +27,14 @@ export const FieldErrorMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
29
27
|
srOnly,
|
|
30
28
|
...props
|
|
31
29
|
} = _ref;
|
|
32
|
-
|
|
33
|
-
if (field && !field.isInvalid) return null;
|
|
34
|
-
return /*#__PURE__*/_jsx(StyledErrorMessage, {
|
|
35
|
-
...((_field$getErrorMessag = field === null || field === void 0 ? void 0 : field.getErrorMessageProps(props, ref)) !== null && _field$getErrorMessag !== void 0 ? _field$getErrorMessag : {
|
|
36
|
-
ref,
|
|
37
|
-
...props
|
|
38
|
-
}),
|
|
30
|
+
return /*#__PURE__*/_jsx(StyledErrorText, {
|
|
39
31
|
css: css.raw({
|
|
40
32
|
textStyle,
|
|
41
33
|
fontWeight,
|
|
42
34
|
color,
|
|
43
35
|
srOnly
|
|
44
|
-
}, cssProp)
|
|
36
|
+
}, cssProp),
|
|
37
|
+
...props,
|
|
38
|
+
ref: ref
|
|
45
39
|
});
|
|
46
40
|
});
|
package/es/FieldHelper.js
CHANGED
|
@@ -7,14 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { Field } from "@ark-ui/react";
|
|
11
11
|
import { css } from "@ndla/styled-system/css";
|
|
12
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
13
|
-
import { useFormControlContext } from "./FormControl";
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
const
|
|
14
|
+
const StyledFieldHelper = styled(Field.HelperText);
|
|
16
15
|
export const FieldHelper = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
17
|
-
var _field$getHelpTextPro;
|
|
18
16
|
let {
|
|
19
17
|
textStyle = "label.small",
|
|
20
18
|
fontWeight,
|
|
@@ -23,17 +21,14 @@ export const FieldHelper = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
23
21
|
css: cssProp,
|
|
24
22
|
...props
|
|
25
23
|
} = _ref;
|
|
26
|
-
|
|
27
|
-
return /*#__PURE__*/_jsx(StyledDiv, {
|
|
28
|
-
...((_field$getHelpTextPro = field === null || field === void 0 ? void 0 : field.getHelpTextProps(props, ref)) !== null && _field$getHelpTextPro !== void 0 ? _field$getHelpTextPro : {
|
|
29
|
-
ref,
|
|
30
|
-
...props
|
|
31
|
-
}),
|
|
24
|
+
return /*#__PURE__*/_jsx(StyledFieldHelper, {
|
|
32
25
|
css: css.raw({
|
|
33
26
|
textStyle,
|
|
34
27
|
fontWeight,
|
|
35
28
|
color,
|
|
36
29
|
srOnly
|
|
37
|
-
}, cssProp)
|
|
30
|
+
}, cssProp),
|
|
31
|
+
...props,
|
|
32
|
+
ref: ref
|
|
38
33
|
});
|
|
39
34
|
});
|
package/es/Input.js
CHANGED
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { createContext, forwardRef, useCallback, useContext, useEffect, useRef } from "react";
|
|
10
|
-
import { ark } from "@ark-ui/react";
|
|
10
|
+
import { Field, ark } from "@ark-ui/react";
|
|
11
11
|
import { css } from "@ndla/styled-system/css";
|
|
12
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
13
13
|
import { composeRefs } from "@ndla/util";
|
|
14
|
-
import { useFormControl } from "./FormControl";
|
|
15
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
15
|
const InputContext = /*#__PURE__*/createContext(undefined);
|
|
17
16
|
const inputCss = css.raw({
|
|
@@ -116,13 +115,13 @@ export const Input = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
116
115
|
...props
|
|
117
116
|
});
|
|
118
117
|
});
|
|
119
|
-
export const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
...
|
|
118
|
+
export const FieldInput = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/_jsx(Field.Input, {
|
|
119
|
+
asChild: true,
|
|
120
|
+
children: /*#__PURE__*/_jsx(Input, {
|
|
121
|
+
...props,
|
|
123
122
|
ref: ref
|
|
124
|
-
})
|
|
125
|
-
});
|
|
123
|
+
})
|
|
124
|
+
}));
|
|
126
125
|
const StyledTextArea = styled(ark.textarea);
|
|
127
126
|
export const TextArea = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
128
127
|
let {
|
|
@@ -153,10 +152,10 @@ export const TextArea = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
153
152
|
...props
|
|
154
153
|
});
|
|
155
154
|
});
|
|
156
|
-
export const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
...
|
|
155
|
+
export const FieldTextArea = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/_jsx(Field.Textarea, {
|
|
156
|
+
asChild: true,
|
|
157
|
+
children: /*#__PURE__*/_jsx(TextArea, {
|
|
158
|
+
...props,
|
|
160
159
|
ref: ref
|
|
161
|
-
})
|
|
162
|
-
});
|
|
160
|
+
})
|
|
161
|
+
}));
|
package/es/Label.js
CHANGED
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
|
-
import { ark } from "@ark-ui/react";
|
|
10
|
+
import { Field, ark } from "@ark-ui/react";
|
|
11
11
|
import { css } from "@ndla/styled-system/css";
|
|
12
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
13
|
-
import { useFormControlContext } from "./FormControl";
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
const StyledLegend = styled(ark.legend, {
|
|
16
15
|
base: {
|
|
@@ -39,24 +38,6 @@ export const Legend = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
39
38
|
ref: ref
|
|
40
39
|
});
|
|
41
40
|
});
|
|
42
|
-
export const FormLegend = /*#__PURE__*/forwardRef((props, ref) => {
|
|
43
|
-
var _control$getLabelProp;
|
|
44
|
-
const control = useFormControlContext();
|
|
45
|
-
// Legend does not use htmlFor (for), so we remove it.
|
|
46
|
-
const {
|
|
47
|
-
id: _,
|
|
48
|
-
htmlFor: __,
|
|
49
|
-
...fieldProps
|
|
50
|
-
} = (_control$getLabelProp = control === null || control === void 0 ? void 0 : control.getLabelProps(props, ref)) !== null && _control$getLabelProp !== void 0 ? _control$getLabelProp : {
|
|
51
|
-
ref,
|
|
52
|
-
...props
|
|
53
|
-
};
|
|
54
|
-
return /*#__PURE__*/_jsx(Legend, {
|
|
55
|
-
...props,
|
|
56
|
-
...fieldProps,
|
|
57
|
-
ref: ref
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
41
|
const StyledLabel = styled(ark.label, {
|
|
61
42
|
base: {
|
|
62
43
|
display: "inline-block",
|
|
@@ -83,19 +64,13 @@ export const Label = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
83
64
|
ref: ref
|
|
84
65
|
});
|
|
85
66
|
});
|
|
86
|
-
export const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const fieldProps = (_control$getLabelProp2 = control === null || control === void 0 ? void 0 : control.getLabelProps(props, ref)) !== null && _control$getLabelProp2 !== void 0 ? _control$getLabelProp2 : {
|
|
90
|
-
ref,
|
|
91
|
-
...props
|
|
92
|
-
};
|
|
93
|
-
return /*#__PURE__*/_jsx(Label, {
|
|
67
|
+
export const FieldLabel = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/_jsx(Field.Label, {
|
|
68
|
+
asChild: true,
|
|
69
|
+
children: /*#__PURE__*/_jsx(Label, {
|
|
94
70
|
...props,
|
|
95
|
-
...fieldProps,
|
|
96
71
|
ref: ref
|
|
97
|
-
})
|
|
98
|
-
});
|
|
72
|
+
})
|
|
73
|
+
}));
|
|
99
74
|
export const Fieldset = styled("fieldset", {
|
|
100
75
|
base: {
|
|
101
76
|
border: "none",
|
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");
|
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,16 +98,7 @@ const {
|
|
|
100
98
|
withProvider,
|
|
101
99
|
withContext
|
|
102
100
|
} = createStyleContext(switchRecipe);
|
|
103
|
-
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");
|
package/es/Tabs.js
CHANGED
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { tabsAnatomy } from "@ark-ui/anatomy";
|
|
9
10
|
import { Tabs } from "@ark-ui/react";
|
|
10
11
|
import { cx, sva } from "@ndla/styled-system/css";
|
|
11
12
|
import { createStyleContext } from "./createStyleContext";
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
const tabsRecipe = sva({
|
|
14
|
-
|
|
15
|
-
// Come back to this once ark releases a new version.
|
|
16
|
-
slots: ["root", "list", "trigger", "content", "indicator"],
|
|
15
|
+
slots: tabsAnatomy.keys(),
|
|
17
16
|
base: {
|
|
18
17
|
root: {
|
|
19
18
|
position: "relative",
|
package/lib/BlockQuote.d.ts
CHANGED
package/lib/BlockQuote.js
CHANGED
|
@@ -23,8 +23,8 @@ const blockQuoteRecipe = (0, _css.cva)({
|
|
|
23
23
|
variants: {
|
|
24
24
|
variant: {
|
|
25
25
|
neutral: {
|
|
26
|
-
borderColor: "stroke.subtle"
|
|
27
|
-
|
|
26
|
+
borderColor: "stroke.subtle",
|
|
27
|
+
background: "surface.default"
|
|
28
28
|
},
|
|
29
29
|
brand1: {
|
|
30
30
|
background: "surface.brand.1.subtle",
|