@ndla/primitives 0.0.9 → 0.0.11
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 +71 -9
- package/dist/styles.css +277 -32
- package/es/Button.js +4 -0
- package/es/Combobox.js +226 -0
- package/es/Figure.js +75 -0
- package/es/Select.js +197 -0
- package/es/TagsInput.js +121 -0
- package/es/index.js +4 -0
- package/es/storybookHelpers/data.js +212 -0
- package/lib/Button.js +4 -0
- package/lib/Combobox.d.ts +59 -0
- package/lib/Combobox.js +236 -0
- package/lib/Dialog.d.ts +1 -1
- package/lib/Figure.d.ts +11 -0
- package/lib/Figure.js +81 -0
- package/lib/Select.d.ts +51 -0
- package/lib/Select.js +204 -0
- package/lib/TagsInput.d.ts +41 -0
- package/lib/TagsInput.js +127 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +232 -0
- package/lib/storybookHelpers/data.d.ts +23 -0
- package/lib/storybookHelpers/data.js +218 -0
- package/package.json +3 -3
package/es/Combobox.js
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
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 { Combobox, comboboxAnatomy } from "@ark-ui/react";
|
|
10
|
+
import { sva } from "@ndla/styled-system/css";
|
|
11
|
+
import { createStyleContext } from "./createStyleContext";
|
|
12
|
+
import { Label } from "./Label";
|
|
13
|
+
import { Text } from "./Text";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
const comboboxRecipe = sva({
|
|
16
|
+
slots: comboboxAnatomy.keys(),
|
|
17
|
+
base: {
|
|
18
|
+
root: {
|
|
19
|
+
display: "flex",
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
gap: "3xsmall"
|
|
22
|
+
},
|
|
23
|
+
control: {
|
|
24
|
+
display: "flex",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
gap: "4xsmall"
|
|
27
|
+
},
|
|
28
|
+
content: {
|
|
29
|
+
display: "flex",
|
|
30
|
+
gap: "4xsmall",
|
|
31
|
+
flexDirection: "column",
|
|
32
|
+
zIndex: "dropdown",
|
|
33
|
+
background: "surface.default",
|
|
34
|
+
borderRadius: "xsmall",
|
|
35
|
+
boxShadow: "large",
|
|
36
|
+
padding: "xsmall",
|
|
37
|
+
overflowY: "auto",
|
|
38
|
+
maxHeight: "surface.xsmall",
|
|
39
|
+
_open: {
|
|
40
|
+
animation: "fade-shift-in 0.25s ease-out"
|
|
41
|
+
},
|
|
42
|
+
_closed: {
|
|
43
|
+
animation: "fade-shift-out 0.25s ease-out"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
item: {
|
|
47
|
+
display: "flex",
|
|
48
|
+
justifyContent: "space-between",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
cursor: "pointer",
|
|
51
|
+
borderRadius: "xsmall",
|
|
52
|
+
transitionDuration: "fast",
|
|
53
|
+
transitionProperty: "background, color, border-color",
|
|
54
|
+
transitionTimingFunction: "default",
|
|
55
|
+
background: "surface.default",
|
|
56
|
+
_disabled: {
|
|
57
|
+
cursor: "not-allowed",
|
|
58
|
+
background: "surface.disabled",
|
|
59
|
+
color: "text.disabled",
|
|
60
|
+
_hover: {
|
|
61
|
+
background: "surface.disabled",
|
|
62
|
+
color: "text.disabled"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
_hover: {
|
|
66
|
+
background: "surface.hover"
|
|
67
|
+
},
|
|
68
|
+
_highlighted: {
|
|
69
|
+
background: "surface.hover"
|
|
70
|
+
},
|
|
71
|
+
_checked: {
|
|
72
|
+
background: "surface.selected",
|
|
73
|
+
_highlighted: {
|
|
74
|
+
background: "surface.hover"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
trigger: {
|
|
79
|
+
"& svg": {
|
|
80
|
+
color: "icon.default",
|
|
81
|
+
transformOrigin: "center",
|
|
82
|
+
transitionDuration: "normal",
|
|
83
|
+
transitionProperty: "transform",
|
|
84
|
+
transitionTimingFunction: "default"
|
|
85
|
+
},
|
|
86
|
+
_open: {
|
|
87
|
+
"& svg": {
|
|
88
|
+
transform: "rotate(180deg)"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
itemIndicator: {
|
|
93
|
+
color: "stroke.default"
|
|
94
|
+
},
|
|
95
|
+
itemText: {
|
|
96
|
+
_checked: {
|
|
97
|
+
textDecoration: "underline"
|
|
98
|
+
},
|
|
99
|
+
_highlighted: {
|
|
100
|
+
textDecoration: "underline"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
itemGroup: {
|
|
104
|
+
display: "flex",
|
|
105
|
+
flexDirection: "column",
|
|
106
|
+
gap: "4xsmall"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
defaultVariants: {
|
|
110
|
+
variant: "simple"
|
|
111
|
+
},
|
|
112
|
+
variants: {
|
|
113
|
+
variant: {
|
|
114
|
+
simple: {
|
|
115
|
+
item: {
|
|
116
|
+
padding: "xsmall"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
bordered: {
|
|
120
|
+
item: {
|
|
121
|
+
paddingInline: "small",
|
|
122
|
+
paddingBlock: "xsmall",
|
|
123
|
+
border: "1px solid",
|
|
124
|
+
borderColor: "stroke.subtle",
|
|
125
|
+
_hover: {
|
|
126
|
+
borderColor: "stroke.hover",
|
|
127
|
+
background: "surface.default"
|
|
128
|
+
},
|
|
129
|
+
_highlighted: {
|
|
130
|
+
borderColor: "stroke.default"
|
|
131
|
+
},
|
|
132
|
+
_checked: {
|
|
133
|
+
borderColor: "stroke.default"
|
|
134
|
+
},
|
|
135
|
+
_disabled: {
|
|
136
|
+
borderColor: "stroke.disabled",
|
|
137
|
+
_hover: {
|
|
138
|
+
borderColor: "stroke.disabled"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
const {
|
|
147
|
+
withProvider,
|
|
148
|
+
withContext
|
|
149
|
+
} = createStyleContext(comboboxRecipe);
|
|
150
|
+
const InternalComboboxRoot = withProvider(Combobox.Root, "root");
|
|
151
|
+
export const ComboboxRoot = _ref => {
|
|
152
|
+
let {
|
|
153
|
+
...props
|
|
154
|
+
} = _ref;
|
|
155
|
+
return (
|
|
156
|
+
/*#__PURE__*/
|
|
157
|
+
//@ts-expect-error - withProvider swallows the generic that Combobox.Root expects.
|
|
158
|
+
_jsx(InternalComboboxRoot, {
|
|
159
|
+
...props
|
|
160
|
+
})
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
export const ComboboxClearTrigger = withContext(Combobox.ClearTrigger, "clearTrigger");
|
|
164
|
+
export const ComboboxContent = withContext(Combobox.Content, "content");
|
|
165
|
+
export const ComboboxControl = withContext(Combobox.Control, "control");
|
|
166
|
+
export const ComboboxInput = withContext(Combobox.Input, "input");
|
|
167
|
+
const InternalComboboxItemGroupLabel = withContext(Combobox.ItemGroupLabel, "itemGroupLabel");
|
|
168
|
+
export const ComboboxItemGroupLabel = _ref2 => {
|
|
169
|
+
let {
|
|
170
|
+
children,
|
|
171
|
+
textStyle = "label.small",
|
|
172
|
+
fontWeight = "bold",
|
|
173
|
+
...props
|
|
174
|
+
} = _ref2;
|
|
175
|
+
return /*#__PURE__*/_jsx(InternalComboboxItemGroupLabel, {
|
|
176
|
+
forwardCssProp: true,
|
|
177
|
+
asChild: true,
|
|
178
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
179
|
+
asChild: true,
|
|
180
|
+
forwardCssProp: true,
|
|
181
|
+
textStyle: textStyle,
|
|
182
|
+
fontWeight: fontWeight,
|
|
183
|
+
...props,
|
|
184
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
185
|
+
children: children
|
|
186
|
+
})
|
|
187
|
+
})
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
export const ComboboxItemGroup = withContext(Combobox.ItemGroup, "itemGroup");
|
|
191
|
+
export const ComboboxItemIndicator = withContext(Combobox.ItemIndicator, "itemIndicator");
|
|
192
|
+
export const ComboboxItem = withContext(Combobox.Item, "item");
|
|
193
|
+
const InternalComboboxItemText = withContext(Combobox.ItemText, "itemText");
|
|
194
|
+
export const ComboboxItemText = _ref3 => {
|
|
195
|
+
let {
|
|
196
|
+
textStyle = "label.medium",
|
|
197
|
+
fontWeight = "bold",
|
|
198
|
+
...props
|
|
199
|
+
} = _ref3;
|
|
200
|
+
return /*#__PURE__*/_jsx(InternalComboboxItemText, {
|
|
201
|
+
forwardCssProp: true,
|
|
202
|
+
asChild: true,
|
|
203
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
204
|
+
...props
|
|
205
|
+
})
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
const InternalComboboxLabel = withContext(Combobox.Label, "label");
|
|
209
|
+
export const ComboboxLabel = _ref4 => {
|
|
210
|
+
let {
|
|
211
|
+
textStyle = "label.medium",
|
|
212
|
+
fontWeight = "bold",
|
|
213
|
+
...props
|
|
214
|
+
} = _ref4;
|
|
215
|
+
return /*#__PURE__*/_jsx(InternalComboboxLabel, {
|
|
216
|
+
forwardCssProp: true,
|
|
217
|
+
asChild: true,
|
|
218
|
+
children: /*#__PURE__*/_jsx(Label, {
|
|
219
|
+
textStyle: textStyle,
|
|
220
|
+
fontWeight: fontWeight,
|
|
221
|
+
...props
|
|
222
|
+
})
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
export const ComboboxPositioner = withContext(Combobox.Positioner, "positioner");
|
|
226
|
+
export const ComboboxTrigger = withContext(Combobox.Trigger, "trigger");
|
package/es/Figure.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
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 { styled } from "@ndla/styled-system/jsx";
|
|
10
|
+
export const Figure = styled("figure", {
|
|
11
|
+
base: {
|
|
12
|
+
position: "relative",
|
|
13
|
+
transitionDuration: "normal",
|
|
14
|
+
transitionProperty: "transform, width, height",
|
|
15
|
+
transitionTimingFunction: "default"
|
|
16
|
+
},
|
|
17
|
+
variants: {
|
|
18
|
+
size: {
|
|
19
|
+
full: {
|
|
20
|
+
width: "100%"
|
|
21
|
+
},
|
|
22
|
+
medium: {
|
|
23
|
+
tablet: {
|
|
24
|
+
width: "50%"
|
|
25
|
+
},
|
|
26
|
+
desktop: {
|
|
27
|
+
width: "65%"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
small: {
|
|
31
|
+
tablet: {
|
|
32
|
+
width: "35%"
|
|
33
|
+
},
|
|
34
|
+
desktop: {
|
|
35
|
+
width: "50%"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
xsmall: {
|
|
39
|
+
tablet: {
|
|
40
|
+
width: "25%"
|
|
41
|
+
},
|
|
42
|
+
desktop: {
|
|
43
|
+
width: "35%"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
float: {
|
|
48
|
+
left: {
|
|
49
|
+
tablet: {
|
|
50
|
+
float: "left",
|
|
51
|
+
clear: "left",
|
|
52
|
+
paddingInlineEnd: "medium"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
right: {
|
|
56
|
+
tablet: {
|
|
57
|
+
float: "right",
|
|
58
|
+
clear: "right",
|
|
59
|
+
paddingInlineStart: "medium"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
defaultVariants: {
|
|
65
|
+
size: "full"
|
|
66
|
+
},
|
|
67
|
+
compoundVariants: [{
|
|
68
|
+
float: ["left", "right"],
|
|
69
|
+
css: {
|
|
70
|
+
zIndex: "base",
|
|
71
|
+
left: "auto",
|
|
72
|
+
marginBlock: "xsmall"
|
|
73
|
+
}
|
|
74
|
+
}]
|
|
75
|
+
});
|
package/es/Select.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
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 { forwardRef } from "react";
|
|
10
|
+
import { Select, selectAnatomy } from "@ark-ui/react";
|
|
11
|
+
import { sva } from "@ndla/styled-system/css";
|
|
12
|
+
import { createStyleContext } from "./createStyleContext";
|
|
13
|
+
import { Label } from "./Label";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
const selectRecipe = sva({
|
|
16
|
+
slots: selectAnatomy.keys(),
|
|
17
|
+
base: {
|
|
18
|
+
root: {
|
|
19
|
+
display: "flex",
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
gap: "3xsmall"
|
|
22
|
+
},
|
|
23
|
+
control: {
|
|
24
|
+
display: "flex",
|
|
25
|
+
gap: "4xsmall",
|
|
26
|
+
alignItems: "center"
|
|
27
|
+
},
|
|
28
|
+
content: {
|
|
29
|
+
display: "flex",
|
|
30
|
+
gap: "4xsmall",
|
|
31
|
+
flexDirection: "column",
|
|
32
|
+
zIndex: "dropdown",
|
|
33
|
+
background: "surface.default",
|
|
34
|
+
borderRadius: "xsmall",
|
|
35
|
+
boxShadow: "large",
|
|
36
|
+
padding: "xsmall",
|
|
37
|
+
overflowY: "auto",
|
|
38
|
+
maxHeight: "surface.xsmall",
|
|
39
|
+
_focusVisible: {
|
|
40
|
+
outlineOffset: "-1"
|
|
41
|
+
},
|
|
42
|
+
_open: {
|
|
43
|
+
animation: "fade-shift-in 0.25s ease-out"
|
|
44
|
+
},
|
|
45
|
+
_closed: {
|
|
46
|
+
animation: "fade-shift-out 0.25s ease-out"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
item: {
|
|
50
|
+
display: "flex",
|
|
51
|
+
alignItems: "center",
|
|
52
|
+
justifyContent: "space-between",
|
|
53
|
+
padding: "xsmall",
|
|
54
|
+
background: "surface.default",
|
|
55
|
+
borderRadius: "xsmall",
|
|
56
|
+
cursor: "pointer",
|
|
57
|
+
transitionDuration: "fast",
|
|
58
|
+
transitionProperty: "background, color",
|
|
59
|
+
transitionTimingFunction: "default",
|
|
60
|
+
_hover: {
|
|
61
|
+
background: "surface.hover"
|
|
62
|
+
},
|
|
63
|
+
_selected: {
|
|
64
|
+
background: "surface.selected",
|
|
65
|
+
_hover: {
|
|
66
|
+
background: "surface.hover"
|
|
67
|
+
},
|
|
68
|
+
_highlighted: {
|
|
69
|
+
background: "surface.hover"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
_highlighted: {
|
|
73
|
+
background: "surface.hover",
|
|
74
|
+
_hover: {
|
|
75
|
+
background: "surface.hover"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
_disabled: {
|
|
79
|
+
cursor: "not-allowed",
|
|
80
|
+
color: "text.disabled",
|
|
81
|
+
background: "surface.disabled",
|
|
82
|
+
_highlighted: {
|
|
83
|
+
color: "text.disabled",
|
|
84
|
+
background: "surface.disabled"
|
|
85
|
+
},
|
|
86
|
+
_selected: {
|
|
87
|
+
color: "text.disabled",
|
|
88
|
+
background: "surface.disabled"
|
|
89
|
+
},
|
|
90
|
+
_hover: {
|
|
91
|
+
color: "text.disabled",
|
|
92
|
+
background: "surface.disabled"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
indicator: {
|
|
97
|
+
color: "icon.default",
|
|
98
|
+
transformOrigin: "center",
|
|
99
|
+
transitionDuration: "normal",
|
|
100
|
+
transitionProperty: "transform",
|
|
101
|
+
transitionTimingFunction: "default",
|
|
102
|
+
_open: {
|
|
103
|
+
transform: "rotate(180deg)"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
itemIndicator: {
|
|
107
|
+
color: "stroke.default"
|
|
108
|
+
},
|
|
109
|
+
itemText: {
|
|
110
|
+
_checked: {
|
|
111
|
+
textDecoration: "underline"
|
|
112
|
+
},
|
|
113
|
+
_highlighted: {
|
|
114
|
+
textDecoration: "underline"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
trigger: {
|
|
118
|
+
justifyContent: "space-between",
|
|
119
|
+
width: "surface.small",
|
|
120
|
+
_ariaInvalid: {
|
|
121
|
+
boxShadowColor: "stroke.error"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
itemGroup: {
|
|
125
|
+
display: "flex",
|
|
126
|
+
flexDirection: "column",
|
|
127
|
+
gap: "4xsmall"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
const {
|
|
132
|
+
withProvider,
|
|
133
|
+
withContext
|
|
134
|
+
} = createStyleContext(selectRecipe);
|
|
135
|
+
const InternalSelectRoot = withProvider(Select.Root, "root");
|
|
136
|
+
export const SelectRoot = _ref => {
|
|
137
|
+
let {
|
|
138
|
+
lazyMount = true,
|
|
139
|
+
unmountOnExit = true,
|
|
140
|
+
...props
|
|
141
|
+
} = _ref;
|
|
142
|
+
return (
|
|
143
|
+
/*#__PURE__*/
|
|
144
|
+
//@ts-expect-error -- T does not necessarily match Select.CollectionItem. However, we prefer to use T over Select.CollectionItem to get the correct type during use.
|
|
145
|
+
_jsx(InternalSelectRoot, {
|
|
146
|
+
lazyMount: lazyMount,
|
|
147
|
+
unmountOnExit: unmountOnExit,
|
|
148
|
+
...props
|
|
149
|
+
})
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
export const SelectClearTrigger = withContext(Select.ClearTrigger, "clearTrigger");
|
|
153
|
+
export const SelectContent = withContext(Select.Content, "content");
|
|
154
|
+
export const SelectControl = withContext(Select.Control, "control");
|
|
155
|
+
export const SelectIndicator = withContext(Select.Indicator, "indicator");
|
|
156
|
+
export const SelectItemGroupLabel = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
157
|
+
let {
|
|
158
|
+
children,
|
|
159
|
+
...props
|
|
160
|
+
} = _ref2;
|
|
161
|
+
return /*#__PURE__*/_jsx(InternalSelectItemGroupLabel, {
|
|
162
|
+
asChild: true,
|
|
163
|
+
forwardCssProp: true,
|
|
164
|
+
ref: ref,
|
|
165
|
+
...props,
|
|
166
|
+
children: /*#__PURE__*/_jsx(Label, {
|
|
167
|
+
asChild: true,
|
|
168
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
169
|
+
children: children
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
const InternalSelectItemGroupLabel = withContext(Select.ItemGroupLabel, "itemGroupLabel");
|
|
175
|
+
export const SelectItemGroup = withContext(Select.ItemGroup, "itemGroup");
|
|
176
|
+
export const SelectItemIndicator = withContext(Select.ItemIndicator, "itemIndicator");
|
|
177
|
+
export const SelectItem = withContext(Select.Item, "item");
|
|
178
|
+
export const SelectItemText = withContext(Select.ItemText, "itemText");
|
|
179
|
+
const InternalSelectLabel = withContext(Select.Label, "label");
|
|
180
|
+
export const SelectLabel = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
181
|
+
let {
|
|
182
|
+
children,
|
|
183
|
+
...props
|
|
184
|
+
} = _ref3;
|
|
185
|
+
return /*#__PURE__*/_jsx(InternalSelectLabel, {
|
|
186
|
+
asChild: true,
|
|
187
|
+
forwardCssProp: true,
|
|
188
|
+
ref: ref,
|
|
189
|
+
...props,
|
|
190
|
+
children: /*#__PURE__*/_jsx(Label, {
|
|
191
|
+
children: children
|
|
192
|
+
})
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
export const SelectPositioner = withContext(Select.Positioner, "positioner");
|
|
196
|
+
export const SelectTrigger = withContext(Select.Trigger, "trigger");
|
|
197
|
+
export const SelectValueText = withContext(Select.ValueText, "valueText");
|
package/es/TagsInput.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
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 { forwardRef } from "react";
|
|
10
|
+
import { TagsInput, tagsInputAnatomy } from "@ark-ui/react";
|
|
11
|
+
import { sva } from "@ndla/styled-system/css";
|
|
12
|
+
import { createStyleContext } from "./createStyleContext";
|
|
13
|
+
import { Label } from "./Label";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
const tagsInputRecipe = sva({
|
|
16
|
+
slots: tagsInputAnatomy.keys(),
|
|
17
|
+
base: {
|
|
18
|
+
root: {
|
|
19
|
+
display: "flex",
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
gap: "xxsmall",
|
|
22
|
+
width: "full"
|
|
23
|
+
},
|
|
24
|
+
control: {
|
|
25
|
+
display: "inline-flex",
|
|
26
|
+
gap: "xxsmall",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
flexWrap: "wrap"
|
|
29
|
+
},
|
|
30
|
+
item: {
|
|
31
|
+
paddingBlock: "3xsmall"
|
|
32
|
+
},
|
|
33
|
+
itemPreview: {
|
|
34
|
+
display: "flex",
|
|
35
|
+
gap: "1",
|
|
36
|
+
paddingBlock: "4xsmall",
|
|
37
|
+
paddingInlineEnd: "3xsmall",
|
|
38
|
+
paddingInlineStart: "xsmall",
|
|
39
|
+
cursor: "initial",
|
|
40
|
+
borderRadius: "large",
|
|
41
|
+
outline: "1px solid",
|
|
42
|
+
outlineColor: "transparent",
|
|
43
|
+
backgroundColor: "surface.actionSubtle.selected",
|
|
44
|
+
color: "text.onAction",
|
|
45
|
+
transitionDuration: "normal",
|
|
46
|
+
transitionProperty: "background, outline-color, color",
|
|
47
|
+
transitionTimingFunction: "default",
|
|
48
|
+
textStyle: "label.medium",
|
|
49
|
+
_hover: {
|
|
50
|
+
backgroundColor: "surface.actionSubtle.hover",
|
|
51
|
+
outlineColor: "stroke.hover",
|
|
52
|
+
color: "text.default",
|
|
53
|
+
"& svg": {
|
|
54
|
+
color: "stroke.hover"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
_highlighted: {
|
|
58
|
+
backgroundColor: "surface.actionSubtle.hover",
|
|
59
|
+
outlineWidth: "3px",
|
|
60
|
+
outlineOffset: "-1px",
|
|
61
|
+
outlineColor: "stroke.hover",
|
|
62
|
+
color: "text.default",
|
|
63
|
+
"& svg": {
|
|
64
|
+
color: "stroke.hover"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
input: {
|
|
69
|
+
flex: "1"
|
|
70
|
+
},
|
|
71
|
+
itemDeleteTrigger: {
|
|
72
|
+
paddingBottom: "1",
|
|
73
|
+
cursor: "pointer",
|
|
74
|
+
"& span": {
|
|
75
|
+
display: "inline-block"
|
|
76
|
+
},
|
|
77
|
+
"& svg": {
|
|
78
|
+
marginInline: "0",
|
|
79
|
+
marginBlock: "0",
|
|
80
|
+
width: "medium",
|
|
81
|
+
height: "medium"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
itemText: {
|
|
85
|
+
paddingBottom: "1"
|
|
86
|
+
},
|
|
87
|
+
itemInput: {
|
|
88
|
+
outline: "none",
|
|
89
|
+
background: "transparent"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const {
|
|
94
|
+
withProvider,
|
|
95
|
+
withContext
|
|
96
|
+
} = createStyleContext(tagsInputRecipe);
|
|
97
|
+
export const TagsInputRoot = withProvider(TagsInput.Root, "root");
|
|
98
|
+
export const TagsInputClearTrigger = withContext(TagsInput.ClearTrigger, "clearTrigger");
|
|
99
|
+
export const TagsInputControl = withContext(TagsInput.Control, "control");
|
|
100
|
+
export const TagsInputInput = withContext(TagsInput.Input, "input");
|
|
101
|
+
export const TagsInputItemDeleteTrigger = withContext(TagsInput.ItemDeleteTrigger, "itemDeleteTrigger");
|
|
102
|
+
export const TagsInputItemInput = withContext(TagsInput.ItemInput, "itemInput");
|
|
103
|
+
export const TagsInputItemPreview = withContext(TagsInput.ItemPreview, "itemPreview");
|
|
104
|
+
export const TagsInputItem = withContext(TagsInput.Item, "item");
|
|
105
|
+
export const TagsInputItemText = withContext(TagsInput.ItemText, "itemText");
|
|
106
|
+
const InternalTagsInputLabel = withContext(TagsInput.Label, "label");
|
|
107
|
+
export const TagsInputLabel = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
108
|
+
let {
|
|
109
|
+
children,
|
|
110
|
+
...props
|
|
111
|
+
} = _ref;
|
|
112
|
+
return /*#__PURE__*/_jsx(InternalTagsInputLabel, {
|
|
113
|
+
asChild: true,
|
|
114
|
+
forwardCssProp: true,
|
|
115
|
+
ref: ref,
|
|
116
|
+
...props,
|
|
117
|
+
children: /*#__PURE__*/_jsx(Label, {
|
|
118
|
+
children: children
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
});
|
package/es/index.js
CHANGED
|
@@ -12,11 +12,13 @@ export { Badge } from "./Badge";
|
|
|
12
12
|
export { BlockQuote } from "./BlockQuote";
|
|
13
13
|
export { Button, IconButton } from "./Button";
|
|
14
14
|
export { CheckboxRoot, CheckboxIndicator, CheckboxLabel, CheckboxControl, CheckboxGroup, CheckboxHiddenInput } from "./Checkbox";
|
|
15
|
+
export { ComboboxRoot, ComboboxClearTrigger, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItemGroupLabel, ComboboxItemGroup, ComboboxItemIndicator, ComboboxItem, ComboboxItemText, ComboboxLabel, ComboboxPositioner, ComboboxTrigger } from "./Combobox";
|
|
15
16
|
export { DialogRoot, DialogBackdrop, DialogStandaloneContent, DialogPositioner, DialogContent, DialogDescription, DialogTitle, DialogTrigger, DialogCloseTrigger, DialogHeader, DialogBody } from "./Dialog";
|
|
16
17
|
export { ExpandableBox, ExpandableBoxSummary } from "./ExpandableBox";
|
|
17
18
|
export { FieldRoot } from "./Field";
|
|
18
19
|
export { FieldErrorMessage } from "./FieldErrorMessage";
|
|
19
20
|
export { FieldHelper } from "./FieldHelper";
|
|
21
|
+
export { Figure } from "./Figure";
|
|
20
22
|
export { FramedContent } from "./FramedContent";
|
|
21
23
|
export { Input, FieldInput, InputContainer, TextArea, FieldTextArea } from "./Input";
|
|
22
24
|
export { Label, FieldLabel } from "./Label";
|
|
@@ -26,11 +28,13 @@ export { NdlaLogoEn, NdlaLogoNb, NdlaLogoText } from "./NdlaLogo";
|
|
|
26
28
|
export { PaginationRoot, PaginationItem, PaginationEllipsis, PaginationPrevTrigger, PaginationNextTrigger } from "./Pagination";
|
|
27
29
|
export { PopoverRoot, PopoverAnchor, PopoverArrowStandalone, PopoverArrow, PopoverArrowTip, PopoverCloseTrigger, PopoverContentStandalone, PopoverContent, PopoverDescription, PopoverIndicator, PopoverPositioner, PopoverTitle, PopoverTrigger } from "./Popover";
|
|
28
30
|
export { RadioGroupRoot, RadioGroupIndicator, RadioGroupItemControl, RadioGroupItem, RadioGroupItemText, RadioGroupLabel, RadioGroupItemHiddenInput } from "./RadioGroup";
|
|
31
|
+
export { SelectRoot, SelectClearTrigger, SelectContent, SelectControl, SelectIndicator, SelectItemGroupLabel, SelectItemGroup, SelectItemIndicator, SelectItem, SelectItemText, SelectLabel, SelectPositioner, SelectTrigger, SelectValueText } from "./Select";
|
|
29
32
|
export { Skeleton } from "./Skeleton";
|
|
30
33
|
export { SliderRoot, SliderControl, SliderTrack, SliderRange, SliderThumb, SliderLabel, SliderHiddenInput } from "./Slider";
|
|
31
34
|
export { Spinner } from "./Spinner";
|
|
32
35
|
export { SwitchRoot, SwitchControl, SwitchThumb, SwitchLabel, SwitchHiddenInput } from "./Switch";
|
|
33
36
|
export { Table } from "./Table";
|
|
37
|
+
export { TagsInputRoot, TagsInputClearTrigger, TagsInputControl, TagsInputInput, TagsInputItemDeleteTrigger, TagsInputItemInput, TagsInputItemPreview, TagsInputItem, TagsInputItemText, TagsInputLabel } from "./TagsInput";
|
|
34
38
|
export { TabsRoot, TabsContent, TabsIndicator, TabsList, TabsTrigger } from "./Tabs";
|
|
35
39
|
export { Text, Heading } from "./Text";
|
|
36
40
|
export { ToastRoot, ToastActionTrigger, ToastCloseTrigger, ToastDescription, ToastTitle } from "./Toast";
|