@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/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
|
@@ -100,7 +100,7 @@ const {
|
|
|
100
100
|
withProvider,
|
|
101
101
|
withContext
|
|
102
102
|
} = createStyleContext(switchRecipe);
|
|
103
|
-
|
|
103
|
+
const InternalSwitchRoot = withProvider(Switch.Root, "root");
|
|
104
104
|
export const SwitchRoot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
105
105
|
var _field$invalid;
|
|
106
106
|
const field = useFormControl(props);
|
|
@@ -112,18 +112,22 @@ export const SwitchRoot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
112
112
|
});
|
|
113
113
|
export const SwitchControl = withContext(Switch.Control, "control");
|
|
114
114
|
export const SwitchThumb = withContext(Switch.Thumb, "thumb");
|
|
115
|
-
|
|
115
|
+
const InternalSwitchLabel = withContext(Switch.Label, "label");
|
|
116
116
|
export const SwitchLabel = _ref => {
|
|
117
117
|
let {
|
|
118
118
|
textStyle = "label.medium",
|
|
119
|
+
children,
|
|
119
120
|
...props
|
|
120
121
|
} = _ref;
|
|
121
122
|
return /*#__PURE__*/_jsx(InternalSwitchLabel, {
|
|
122
123
|
asChild: true,
|
|
123
124
|
children: /*#__PURE__*/_jsx(Text, {
|
|
124
|
-
|
|
125
|
+
asChild: true,
|
|
125
126
|
textStyle: textStyle,
|
|
126
|
-
...props
|
|
127
|
+
...props,
|
|
128
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
129
|
+
children: children
|
|
130
|
+
})
|
|
127
131
|
})
|
|
128
132
|
});
|
|
129
133
|
};
|
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
|
});
|
package/es/Tabs.js
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
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 { Tabs } from "@ark-ui/react";
|
|
10
|
+
import { cx, sva } from "@ndla/styled-system/css";
|
|
11
|
+
import { createStyleContext } from "./createStyleContext";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const tabsRecipe = sva({
|
|
14
|
+
// TODO: Defining the slots manually fixes an issue with variants not generating properly.
|
|
15
|
+
// Come back to this once ark releases a new version.
|
|
16
|
+
slots: ["root", "list", "trigger", "content", "indicator"],
|
|
17
|
+
base: {
|
|
18
|
+
root: {
|
|
19
|
+
position: "relative",
|
|
20
|
+
display: "flex",
|
|
21
|
+
width: "100%",
|
|
22
|
+
_horizontal: {
|
|
23
|
+
flexDirection: "column"
|
|
24
|
+
},
|
|
25
|
+
_vertical: {
|
|
26
|
+
flexDirection: "row"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
list: {
|
|
30
|
+
position: "relative",
|
|
31
|
+
display: "flex",
|
|
32
|
+
flexShrink: "0",
|
|
33
|
+
overflow: "auto",
|
|
34
|
+
_horizontal: {
|
|
35
|
+
flexDirection: "row"
|
|
36
|
+
},
|
|
37
|
+
_vertical: {
|
|
38
|
+
flexDirection: "column"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
trigger: {
|
|
42
|
+
display: "inline-flex",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
justifyContent: "center",
|
|
45
|
+
flexShrink: "0",
|
|
46
|
+
cursor: "pointer",
|
|
47
|
+
textStyle: "label.small",
|
|
48
|
+
fontWeight: "bold",
|
|
49
|
+
transitionDuration: "normal",
|
|
50
|
+
transitionProperty: "color, background, border-color",
|
|
51
|
+
transitionTimingFunction: "default",
|
|
52
|
+
whiteSpace: "nowrap",
|
|
53
|
+
paddingInline: "small",
|
|
54
|
+
paddingBlock: "3xsmall",
|
|
55
|
+
zIndex: "1",
|
|
56
|
+
_hover: {
|
|
57
|
+
color: "text.action"
|
|
58
|
+
},
|
|
59
|
+
_selected: {
|
|
60
|
+
color: "text.strong"
|
|
61
|
+
},
|
|
62
|
+
_disabled: {
|
|
63
|
+
color: "text.subtle",
|
|
64
|
+
cursor: "not-allowed",
|
|
65
|
+
_hover: {
|
|
66
|
+
color: "text.subtle"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
content: {
|
|
71
|
+
display: "flex",
|
|
72
|
+
flexDirection: "column",
|
|
73
|
+
alignItems: "flex-start",
|
|
74
|
+
gap: "xsmall"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
defaultVariants: {
|
|
78
|
+
variant: "line"
|
|
79
|
+
},
|
|
80
|
+
variants: {
|
|
81
|
+
variant: {
|
|
82
|
+
line: {
|
|
83
|
+
trigger: {
|
|
84
|
+
borderColor: "stroke.default",
|
|
85
|
+
_hover: {
|
|
86
|
+
borderColor: "stroke.hover",
|
|
87
|
+
_focusVisible: {
|
|
88
|
+
borderColor: "stroke.default"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
_horizontal: {
|
|
92
|
+
borderBottom: "1px solid"
|
|
93
|
+
},
|
|
94
|
+
_disabled: {
|
|
95
|
+
borderColor: "stroke.default",
|
|
96
|
+
_hover: {
|
|
97
|
+
borderColor: "stroke.default"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
_vertical: {
|
|
101
|
+
borderLeft: "1px solid",
|
|
102
|
+
justifyContent: "flex-start"
|
|
103
|
+
},
|
|
104
|
+
_focusVisible: {
|
|
105
|
+
outline: "none",
|
|
106
|
+
borderRadius: "unset"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
indicator: {
|
|
110
|
+
background: "transparent",
|
|
111
|
+
outline: "4px solid",
|
|
112
|
+
outlineColor: "stroke.default",
|
|
113
|
+
pointerEvents: "none",
|
|
114
|
+
outlineOffset: "-4px",
|
|
115
|
+
_peerFocusVisible: {
|
|
116
|
+
height: "var(--height)",
|
|
117
|
+
width: "var(--width)",
|
|
118
|
+
_horizontal: {
|
|
119
|
+
borderTopRadius: "xsmall"
|
|
120
|
+
},
|
|
121
|
+
_vertical: {
|
|
122
|
+
borderRightRadius: "xsmall"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
_horizontal: {
|
|
126
|
+
bottom: "0",
|
|
127
|
+
height: "2",
|
|
128
|
+
width: "var(--width)"
|
|
129
|
+
},
|
|
130
|
+
_vertical: {
|
|
131
|
+
height: "var(--height)",
|
|
132
|
+
left: "0",
|
|
133
|
+
width: "2"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
content: {
|
|
137
|
+
zIndex: "1",
|
|
138
|
+
_horizontal: {
|
|
139
|
+
paddingBlockStart: "xsmall"
|
|
140
|
+
},
|
|
141
|
+
_vertical: {
|
|
142
|
+
paddingInlineStart: "xsmall"
|
|
143
|
+
},
|
|
144
|
+
_focusVisible: {
|
|
145
|
+
outline: "none",
|
|
146
|
+
boxShadow: "0 0 0 3px var(--shadow-color)",
|
|
147
|
+
boxShadowColor: "stroke.default"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
outline: {
|
|
152
|
+
list: {
|
|
153
|
+
_horizontal: {
|
|
154
|
+
marginBlockEnd: "-1px"
|
|
155
|
+
},
|
|
156
|
+
_vertical: {
|
|
157
|
+
marginInlineEnd: "-1px"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
trigger: {
|
|
161
|
+
borderColor: "transparent",
|
|
162
|
+
borderWidth: "1px",
|
|
163
|
+
_horizontal: {
|
|
164
|
+
borderTopRadius: "xsmall"
|
|
165
|
+
},
|
|
166
|
+
_vertical: {
|
|
167
|
+
borderTopLeftRadius: "xsmall",
|
|
168
|
+
borderBottomLeftRadius: "xsmall"
|
|
169
|
+
},
|
|
170
|
+
_selected: {
|
|
171
|
+
background: "surface.default",
|
|
172
|
+
borderColor: "stroke.subtle",
|
|
173
|
+
_horizontal: {
|
|
174
|
+
borderBottomColor: "transparent"
|
|
175
|
+
},
|
|
176
|
+
_vertical: {
|
|
177
|
+
borderRightColor: "transparent"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
_focusVisible: {
|
|
181
|
+
outline: "3px solid",
|
|
182
|
+
outlineOffset: "-3px",
|
|
183
|
+
outlineColor: "stroke.default"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
content: {
|
|
187
|
+
borderWidth: "1px",
|
|
188
|
+
borderColor: "stroke.subtle",
|
|
189
|
+
background: "surface.default",
|
|
190
|
+
width: "100%",
|
|
191
|
+
padding: "xsmall",
|
|
192
|
+
_focusVisible: {
|
|
193
|
+
outline: "3px solid",
|
|
194
|
+
outlineOffset: "-3px",
|
|
195
|
+
outlineColor: "stroke.default"
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
const {
|
|
203
|
+
withProvider,
|
|
204
|
+
withContext
|
|
205
|
+
} = createStyleContext(tabsRecipe);
|
|
206
|
+
const InternalTabsRoot = withProvider(Tabs.Root, "root");
|
|
207
|
+
export const TabsRoot = _ref => {
|
|
208
|
+
let {
|
|
209
|
+
lazyMount = true,
|
|
210
|
+
unmountOnExit = true,
|
|
211
|
+
...props
|
|
212
|
+
} = _ref;
|
|
213
|
+
return /*#__PURE__*/_jsx(InternalTabsRoot, {
|
|
214
|
+
lazyMount: lazyMount,
|
|
215
|
+
unmountOnExit: unmountOnExit,
|
|
216
|
+
...props
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
export const TabsContent = withContext(Tabs.Content, "content");
|
|
220
|
+
export const TabsIndicator = withContext(Tabs.Indicator, "indicator");
|
|
221
|
+
export const TabsList = withContext(Tabs.List, "list");
|
|
222
|
+
const InternalTabsTrigger = withContext(Tabs.Trigger, "trigger");
|
|
223
|
+
export const TabsTrigger = _ref2 => {
|
|
224
|
+
let {
|
|
225
|
+
className,
|
|
226
|
+
...props
|
|
227
|
+
} = _ref2;
|
|
228
|
+
return /*#__PURE__*/_jsx(InternalTabsTrigger, {
|
|
229
|
+
className: cx("peer", className),
|
|
230
|
+
...props
|
|
231
|
+
});
|
|
232
|
+
};
|
package/es/Text.js
CHANGED
|
@@ -6,49 +6,50 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { forwardRef } from "react";
|
|
10
|
+
import { ark } from "@ark-ui/react";
|
|
11
|
+
import { css } from "@ndla/styled-system/css";
|
|
12
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
10
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const StyledP = styled(ark.p);
|
|
15
|
+
export const Text = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
16
|
+
let {
|
|
17
|
+
textStyle = "body.medium",
|
|
15
18
|
fontWeight,
|
|
16
19
|
color,
|
|
17
|
-
textStyle = "body.medium",
|
|
18
20
|
srOnly,
|
|
21
|
+
css: cssProp,
|
|
19
22
|
...rest
|
|
20
|
-
} =
|
|
21
|
-
return /*#__PURE__*/_jsx(
|
|
22
|
-
|
|
23
|
+
} = _ref;
|
|
24
|
+
return /*#__PURE__*/_jsx(StyledP, {
|
|
25
|
+
css: css.raw({
|
|
23
26
|
textStyle,
|
|
24
27
|
fontWeight,
|
|
25
28
|
color,
|
|
26
|
-
srOnly
|
|
27
|
-
}
|
|
29
|
+
srOnly
|
|
30
|
+
}, cssProp),
|
|
31
|
+
ref: ref,
|
|
28
32
|
...rest
|
|
29
33
|
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
});
|
|
35
|
+
const StyledH1 = styled(ark.h1);
|
|
36
|
+
export const Heading = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
37
|
+
let {
|
|
34
38
|
textStyle = "heading.medium",
|
|
39
|
+
fontWeight,
|
|
40
|
+
color,
|
|
41
|
+
srOnly,
|
|
42
|
+
css: cssProp,
|
|
35
43
|
...rest
|
|
36
|
-
} =
|
|
37
|
-
return /*#__PURE__*/_jsx(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
as = "p",
|
|
46
|
-
textStyle = "body.medium",
|
|
47
|
-
...rest
|
|
48
|
-
} = props;
|
|
49
|
-
return /*#__PURE__*/_jsx(BaseText, {
|
|
50
|
-
as: as,
|
|
51
|
-
textStyle: textStyle,
|
|
44
|
+
} = _ref2;
|
|
45
|
+
return /*#__PURE__*/_jsx(StyledH1, {
|
|
46
|
+
css: css.raw({
|
|
47
|
+
textStyle,
|
|
48
|
+
fontWeight,
|
|
49
|
+
color,
|
|
50
|
+
srOnly
|
|
51
|
+
}, cssProp),
|
|
52
|
+
ref: ref,
|
|
52
53
|
...rest
|
|
53
54
|
});
|
|
54
|
-
};
|
|
55
|
+
});
|
package/es/Toast.js
CHANGED
|
@@ -48,35 +48,43 @@ const {
|
|
|
48
48
|
export const ToastRoot = withProvider(Toast.Root, "root");
|
|
49
49
|
export const ToastActionTrigger = withContext(Toast.ActionTrigger, "actionTrigger");
|
|
50
50
|
export const ToastCloseTrigger = withContext(Toast.CloseTrigger, "closeTrigger");
|
|
51
|
-
|
|
51
|
+
const InternalToastDescription = withContext(Toast.Description, "description");
|
|
52
52
|
export const ToastDescription = _ref => {
|
|
53
53
|
let {
|
|
54
54
|
textStyle = "label.medium",
|
|
55
|
+
children,
|
|
55
56
|
...props
|
|
56
57
|
} = _ref;
|
|
57
58
|
return /*#__PURE__*/_jsx(InternalToastDescription, {
|
|
58
59
|
asChild: true,
|
|
59
60
|
children: /*#__PURE__*/_jsx(Text, {
|
|
60
|
-
|
|
61
|
+
asChild: true,
|
|
61
62
|
textStyle: textStyle,
|
|
62
|
-
...props
|
|
63
|
+
...props,
|
|
64
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
65
|
+
children: children
|
|
66
|
+
})
|
|
63
67
|
})
|
|
64
68
|
});
|
|
65
69
|
};
|
|
66
|
-
|
|
70
|
+
const InternalToastTitle = withContext(Toast.Title, "title");
|
|
67
71
|
export const ToastTitle = _ref2 => {
|
|
68
72
|
let {
|
|
69
73
|
textStyle = "label.medium",
|
|
70
74
|
fontWeight = "semibold",
|
|
75
|
+
children,
|
|
71
76
|
...props
|
|
72
77
|
} = _ref2;
|
|
73
78
|
return /*#__PURE__*/_jsx(InternalToastTitle, {
|
|
74
79
|
asChild: true,
|
|
75
80
|
children: /*#__PURE__*/_jsx(Text, {
|
|
76
|
-
|
|
81
|
+
asChild: true,
|
|
77
82
|
fontWeight: fontWeight,
|
|
78
83
|
textStyle: textStyle,
|
|
79
|
-
...props
|
|
84
|
+
...props,
|
|
85
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
86
|
+
children: children
|
|
87
|
+
})
|
|
80
88
|
})
|
|
81
89
|
});
|
|
82
90
|
};
|
package/es/createStyleContext.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { createContext, forwardRef, useContext } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { css } from "@ndla/styled-system/css";
|
|
11
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
/**
|
|
@@ -18,7 +18,7 @@ export const createStyleContext = recipe => {
|
|
|
18
18
|
const withRootProvider = Component => {
|
|
19
19
|
const StyledComponent = props => {
|
|
20
20
|
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
21
|
-
const slotStyles = recipe(variantProps);
|
|
21
|
+
const slotStyles = recipe.raw(variantProps);
|
|
22
22
|
return /*#__PURE__*/_jsx(StyleContext.Provider, {
|
|
23
23
|
value: slotStyles,
|
|
24
24
|
children: /*#__PURE__*/_jsx(Component, {
|
|
@@ -30,27 +30,35 @@ export const createStyleContext = recipe => {
|
|
|
30
30
|
};
|
|
31
31
|
const withProvider = (Component, slot) => {
|
|
32
32
|
const StyledComponent = styled(Component);
|
|
33
|
-
return /*#__PURE__*/forwardRef((
|
|
33
|
+
return /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
34
|
+
let {
|
|
35
|
+
css: cssProp,
|
|
36
|
+
...props
|
|
37
|
+
} = _ref;
|
|
34
38
|
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
35
|
-
const slotStyles = recipe(variantProps);
|
|
39
|
+
const slotStyles = recipe.raw(variantProps);
|
|
36
40
|
return /*#__PURE__*/_jsx(StyleContext.Provider, {
|
|
37
41
|
value: slotStyles,
|
|
38
42
|
children: /*#__PURE__*/_jsx(StyledComponent, {
|
|
39
43
|
...otherProps,
|
|
40
44
|
ref: ref,
|
|
41
|
-
|
|
45
|
+
css: css.raw(slotStyles === null || slotStyles === void 0 ? void 0 : slotStyles[slot], cssProp)
|
|
42
46
|
})
|
|
43
47
|
});
|
|
44
48
|
});
|
|
45
49
|
};
|
|
46
50
|
const withContext = (Component, slot) => {
|
|
47
51
|
const StyledComponent = styled(Component);
|
|
48
|
-
return /*#__PURE__*/forwardRef((
|
|
52
|
+
return /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
53
|
+
let {
|
|
54
|
+
css: cssProp,
|
|
55
|
+
...props
|
|
56
|
+
} = _ref2;
|
|
49
57
|
const slotStyles = useContext(StyleContext);
|
|
50
58
|
return /*#__PURE__*/_jsx(StyledComponent, {
|
|
51
59
|
...props,
|
|
52
60
|
ref: ref,
|
|
53
|
-
|
|
61
|
+
css: css.raw(slotStyles === null || slotStyles === void 0 ? void 0 : slotStyles[slot], cssProp)
|
|
54
62
|
});
|
|
55
63
|
});
|
|
56
64
|
};
|
package/lib/Accordion.d.ts
CHANGED
|
@@ -5,13 +5,20 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import type { Assign } from "@ark-ui/react";
|
|
9
8
|
import { Accordion } from "@ark-ui/react";
|
|
10
|
-
import {
|
|
11
|
-
export interface AccordionRootProps extends
|
|
9
|
+
import { JsxStyleProps } from "@ndla/styled-system/types";
|
|
10
|
+
export interface AccordionRootProps extends JsxStyleProps, Accordion.RootProps {
|
|
12
11
|
}
|
|
13
12
|
export declare const AccordionRoot: import("react").ForwardRefExoticComponent<AccordionRootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
-
export declare const AccordionItemContent: import("react").ForwardRefExoticComponent<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export declare const
|
|
13
|
+
export declare const AccordionItemContent: import("react").ForwardRefExoticComponent<{
|
|
14
|
+
forwardCssProp?: boolean | undefined;
|
|
15
|
+
} & import("@ndla/styled-system/types").WithCss & Accordion.ItemContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export declare const AccordionItemIndicator: import("react").ForwardRefExoticComponent<{
|
|
17
|
+
forwardCssProp?: boolean | undefined;
|
|
18
|
+
} & import("@ndla/styled-system/types").WithCss & Accordion.ItemIndicatorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export declare const AccordionItem: import("react").ForwardRefExoticComponent<{
|
|
20
|
+
forwardCssProp?: boolean | undefined;
|
|
21
|
+
} & import("@ndla/styled-system/types").WithCss & Accordion.ItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
22
|
+
export declare const AccordionItemTrigger: import("react").ForwardRefExoticComponent<{
|
|
23
|
+
forwardCssProp?: boolean | undefined;
|
|
24
|
+
} & import("@ndla/styled-system/types").WithCss & Accordion.ItemTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
package/lib/ArticleLists.d.ts
CHANGED
|
@@ -5,16 +5,14 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
9
|
-
import { StyledVariantProps } from "@ndla/styled-system/types";
|
|
10
|
-
|
|
8
|
+
import { HTMLArkProps } from "@ark-ui/react";
|
|
9
|
+
import { JsxStyleProps, StyledVariantProps } from "@ndla/styled-system/types";
|
|
10
|
+
export type OrderedListVariantProps = StyledVariantProps<typeof OrderedList>;
|
|
11
|
+
export type OrderedListProps = HTMLArkProps<"ol"> & JsxStyleProps & OrderedListVariantProps;
|
|
12
|
+
export declare const OrderedList: import("@ndla/styled-system/jsx").StyledComponent<"ol", {
|
|
11
13
|
variant?: "numbers" | "letters" | undefined;
|
|
12
14
|
}>;
|
|
13
|
-
export type
|
|
14
|
-
export
|
|
15
|
-
export declare const
|
|
16
|
-
export type
|
|
17
|
-
export declare const UnOrderedList: ({ ...props }: UnOrderedListProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
18
|
-
export type DefinitionListProps = ComponentPropsWithoutRef<"dl">;
|
|
19
|
-
export declare const DefinitionList: ({ ...props }: DefinitionListProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
20
|
-
export {};
|
|
15
|
+
export type UnOrderedListProps = HTMLArkProps<"ul"> & JsxStyleProps;
|
|
16
|
+
export declare const UnOrderedList: import("@ndla/styled-system/jsx").StyledComponent<"ul", {}>;
|
|
17
|
+
export declare const DefinitionList: import("@ndla/styled-system/jsx").StyledComponent<"dl", {}>;
|
|
18
|
+
export type DefinitionListProps = HTMLArkProps<"dl"> & JsxStyleProps;
|
package/lib/ArticleLists.js
CHANGED
|
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.UnOrderedList = exports.OrderedList = exports.DefinitionList = void 0;
|
|
7
|
-
var
|
|
8
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
var _jsx = require("@ndla/styled-system/jsx");
|
|
9
8
|
/**
|
|
10
9
|
* Copyright (c) 2024-present, NDLA.
|
|
11
10
|
*
|
|
@@ -14,7 +13,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
14
13
|
*
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
|
-
const
|
|
16
|
+
const OrderedList = exports.OrderedList = (0, _jsx.styled)("ol", {
|
|
18
17
|
base: {
|
|
19
18
|
listStyle: "revert",
|
|
20
19
|
listStylePosition: "inside",
|
|
@@ -60,19 +59,7 @@ const StyledOrderedList = (0, _jsx2.styled)("ol", {
|
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
});
|
|
63
|
-
const
|
|
64
|
-
let {
|
|
65
|
-
variant = "numbers",
|
|
66
|
-
...props
|
|
67
|
-
} = _ref;
|
|
68
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledOrderedList, {
|
|
69
|
-
variant: variant,
|
|
70
|
-
"data-variant": variant,
|
|
71
|
-
...props
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
exports.OrderedList = OrderedList;
|
|
75
|
-
const StyledUnOrderedList = (0, _jsx2.styled)("ul", {
|
|
62
|
+
const UnOrderedList = exports.UnOrderedList = (0, _jsx.styled)("ul", {
|
|
76
63
|
base: {
|
|
77
64
|
listStyle: "revert",
|
|
78
65
|
listStylePosition: "inside",
|
|
@@ -85,16 +72,7 @@ const StyledUnOrderedList = (0, _jsx2.styled)("ul", {
|
|
|
85
72
|
}
|
|
86
73
|
}
|
|
87
74
|
});
|
|
88
|
-
const
|
|
89
|
-
let {
|
|
90
|
-
...props
|
|
91
|
-
} = _ref2;
|
|
92
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledUnOrderedList, {
|
|
93
|
-
...props
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
exports.UnOrderedList = UnOrderedList;
|
|
97
|
-
const StyledDefinitionList = (0, _jsx2.styled)("dl", {
|
|
75
|
+
const DefinitionList = exports.DefinitionList = (0, _jsx.styled)("dl", {
|
|
98
76
|
base: {
|
|
99
77
|
"& dt": {
|
|
100
78
|
fontWeight: "bold"
|
|
@@ -103,13 +81,4 @@ const StyledDefinitionList = (0, _jsx2.styled)("dl", {
|
|
|
103
81
|
marginInlineStart: "medium"
|
|
104
82
|
}
|
|
105
83
|
}
|
|
106
|
-
});
|
|
107
|
-
const DefinitionList = _ref3 => {
|
|
108
|
-
let {
|
|
109
|
-
...props
|
|
110
|
-
} = _ref3;
|
|
111
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledDefinitionList, {
|
|
112
|
-
...props
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
exports.DefinitionList = DefinitionList;
|
|
84
|
+
});
|
package/lib/Badge.d.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { HTMLArkProps } from "@ark-ui/react";
|
|
9
9
|
import { RecipeVariantProps } from "@ndla/styled-system/css";
|
|
10
|
+
import { JsxStyleProps } from "@ndla/styled-system/types";
|
|
10
11
|
declare const badgeRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
|
|
11
12
|
colorTheme: {
|
|
12
13
|
brand1: {
|
|
@@ -14,7 +15,7 @@ declare const badgeRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
|
|
|
14
15
|
borderColor: "surface.brand.1.strong";
|
|
15
16
|
};
|
|
16
17
|
brand2: {
|
|
17
|
-
backgroundColor: "surface.brand.2.
|
|
18
|
+
backgroundColor: "surface.brand.2.moderate";
|
|
18
19
|
borderColor: "surface.brand.2.strong";
|
|
19
20
|
};
|
|
20
21
|
brand3: {
|
|
@@ -28,6 +29,10 @@ declare const badgeRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
|
|
|
28
29
|
};
|
|
29
30
|
}>;
|
|
30
31
|
export type BadgeVariantProps = RecipeVariantProps<typeof badgeRecipe>;
|
|
31
|
-
export type BadgeProps =
|
|
32
|
-
export declare const Badge:
|
|
32
|
+
export type BadgeProps = HTMLArkProps<"div"> & JsxStyleProps & BadgeVariantProps;
|
|
33
|
+
export declare const Badge: import("@ndla/styled-system/jsx").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
34
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
35
|
+
} & import("@ark-ui/react").PolymorphicProps>, {
|
|
36
|
+
colorTheme?: "neutral" | "brand1" | "brand2" | "brand3" | undefined;
|
|
37
|
+
}>;
|
|
33
38
|
export {};
|