@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/Badge.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 badgeRecipe = cva({
|
|
13
13
|
base: {
|
|
14
14
|
paddingInline: "xsmall",
|
|
@@ -26,7 +26,7 @@ const badgeRecipe = cva({
|
|
|
26
26
|
borderColor: "surface.brand.1.strong"
|
|
27
27
|
},
|
|
28
28
|
brand2: {
|
|
29
|
-
backgroundColor: "surface.brand.2.
|
|
29
|
+
backgroundColor: "surface.brand.2.moderate",
|
|
30
30
|
borderColor: "surface.brand.2.strong"
|
|
31
31
|
},
|
|
32
32
|
brand3: {
|
|
@@ -40,16 +40,4 @@ const badgeRecipe = cva({
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
export const Badge =
|
|
44
|
-
let {
|
|
45
|
-
colorTheme,
|
|
46
|
-
className,
|
|
47
|
-
...rest
|
|
48
|
-
} = _ref;
|
|
49
|
-
return /*#__PURE__*/_jsx(styled.div, {
|
|
50
|
-
className: cx(badgeRecipe({
|
|
51
|
-
colorTheme
|
|
52
|
-
}), className),
|
|
53
|
-
...rest
|
|
54
|
-
});
|
|
55
|
-
};
|
|
43
|
+
export const Badge = styled(ark.div, badgeRecipe);
|
package/es/BlockQuote.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 blockQuoteRecipe = cva({
|
|
13
13
|
base: {
|
|
14
14
|
borderInlineStart: "4px solid",
|
|
@@ -17,8 +17,8 @@ const blockQuoteRecipe = cva({
|
|
|
17
17
|
variants: {
|
|
18
18
|
variant: {
|
|
19
19
|
neutral: {
|
|
20
|
-
borderColor: "stroke.subtle"
|
|
21
|
-
|
|
20
|
+
borderColor: "stroke.subtle",
|
|
21
|
+
background: "surface.default"
|
|
22
22
|
},
|
|
23
23
|
brand1: {
|
|
24
24
|
background: "surface.brand.1.subtle",
|
|
@@ -34,16 +34,4 @@ const blockQuoteRecipe = cva({
|
|
|
34
34
|
variant: "neutral"
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
export const BlockQuote =
|
|
38
|
-
let {
|
|
39
|
-
className,
|
|
40
|
-
variant,
|
|
41
|
-
...rest
|
|
42
|
-
} = _ref;
|
|
43
|
-
return /*#__PURE__*/_jsx(styled.blockquote, {
|
|
44
|
-
className: cx(blockQuoteRecipe({
|
|
45
|
-
variant
|
|
46
|
-
}), className),
|
|
47
|
-
...rest
|
|
48
|
-
});
|
|
49
|
-
};
|
|
37
|
+
export const BlockQuote = styled(ark.blockquote, blockQuoteRecipe);
|
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/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/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/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,38 +7,34 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { Field } 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
|
|
14
|
+
const StyledErrorText = styled(Field.ErrorText, {
|
|
15
15
|
base: {
|
|
16
16
|
color: "text.error",
|
|
17
|
-
whiteSpace: "pre-line"
|
|
17
|
+
whiteSpace: "pre-line",
|
|
18
|
+
justifyContent: "center"
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
21
|
export const FieldErrorMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
21
|
-
var _field$getErrorMessag;
|
|
22
22
|
let {
|
|
23
23
|
textStyle = "label.small",
|
|
24
24
|
fontWeight,
|
|
25
|
+
css: cssProp,
|
|
25
26
|
color,
|
|
26
27
|
srOnly,
|
|
27
|
-
className,
|
|
28
28
|
...props
|
|
29
29
|
} = _ref;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return /*#__PURE__*/_jsx(StyledErrorMessage, {
|
|
33
|
-
...((_field$getErrorMessag = field === null || field === void 0 ? void 0 : field.getErrorMessageProps(props, ref)) !== null && _field$getErrorMessag !== void 0 ? _field$getErrorMessag : {
|
|
34
|
-
ref,
|
|
35
|
-
...props
|
|
36
|
-
}),
|
|
37
|
-
className: cx(css({
|
|
30
|
+
return /*#__PURE__*/_jsx(StyledErrorText, {
|
|
31
|
+
css: css.raw({
|
|
38
32
|
textStyle,
|
|
39
33
|
fontWeight,
|
|
40
34
|
color,
|
|
41
|
-
srOnly
|
|
42
|
-
}
|
|
35
|
+
srOnly
|
|
36
|
+
}, cssProp),
|
|
37
|
+
...props,
|
|
38
|
+
ref: ref
|
|
43
39
|
});
|
|
44
40
|
});
|
package/es/FieldHelper.js
CHANGED
|
@@ -7,31 +7,28 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { Field } 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 StyledFieldHelper = styled(Field.HelperText);
|
|
14
15
|
export const FieldHelper = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
15
|
-
var _field$getHelpTextPro;
|
|
16
16
|
let {
|
|
17
17
|
textStyle = "label.small",
|
|
18
18
|
fontWeight,
|
|
19
19
|
color,
|
|
20
20
|
srOnly,
|
|
21
|
-
|
|
21
|
+
css: cssProp,
|
|
22
22
|
...props
|
|
23
23
|
} = _ref;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
...((_field$getHelpTextPro = field === null || field === void 0 ? void 0 : field.getHelpTextProps(props, ref)) !== null && _field$getHelpTextPro !== void 0 ? _field$getHelpTextPro : {
|
|
27
|
-
ref,
|
|
28
|
-
...props
|
|
29
|
-
}),
|
|
30
|
-
className: cx(css({
|
|
24
|
+
return /*#__PURE__*/_jsx(StyledFieldHelper, {
|
|
25
|
+
css: css.raw({
|
|
31
26
|
textStyle,
|
|
32
27
|
fontWeight,
|
|
33
28
|
color,
|
|
34
29
|
srOnly
|
|
35
|
-
}
|
|
30
|
+
}, cssProp),
|
|
31
|
+
...props,
|
|
32
|
+
ref: ref
|
|
36
33
|
});
|
|
37
34
|
});
|
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);
|