@ndla/primitives 0.0.16 → 0.0.18
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 +18 -14
- package/dist/styles.css +333 -315
- package/es/Accordion.js +58 -30
- package/es/Button.js +3 -2
- package/es/Card/Card.js +77 -0
- package/es/Checkbox.js +12 -4
- package/es/Combobox.js +30 -10
- package/es/Dialog.js +9 -3
- package/es/Figure.js +21 -4
- package/es/Image.js +92 -0
- package/es/Input.js +1 -1
- package/es/Menu.js +21 -7
- package/es/Pagination.js +15 -5
- package/es/Popover.js +30 -10
- package/es/RadioGroup.js +12 -4
- package/es/Select.js +36 -12
- package/es/Slider.js +15 -5
- package/es/Switch.js +9 -3
- package/es/Tabs.js +15 -5
- package/es/TagsInput.js +27 -9
- package/es/Toast.js +9 -3
- package/es/Tooltip.js +15 -5
- package/es/createStyleContext.js +6 -12
- package/es/index.js +3 -1
- package/lib/Accordion.d.ts +41 -2
- package/lib/Accordion.js +58 -30
- package/lib/Badge.d.ts +1 -0
- package/lib/Button.d.ts +2 -2
- package/lib/Button.js +3 -2
- package/lib/Card/Card.d.ts +19 -0
- package/lib/Card/Card.js +83 -0
- package/lib/Checkbox.js +12 -4
- package/lib/Combobox.d.ts +45 -13
- package/lib/Combobox.js +30 -10
- package/lib/Dialog.js +9 -3
- package/lib/Figure.d.ts +3 -3
- package/lib/Figure.js +21 -4
- package/lib/Image.d.ts +49 -0
- package/lib/Image.js +100 -0
- package/lib/Input.js +1 -1
- package/lib/Menu.js +21 -7
- package/lib/Pagination.d.ts +6 -2
- package/lib/Pagination.js +15 -5
- package/lib/Popover.js +30 -10
- package/lib/RadioGroup.js +12 -4
- package/lib/Select.js +36 -12
- package/lib/Slider.js +15 -5
- package/lib/Switch.js +9 -3
- package/lib/Tabs.d.ts +4 -1
- package/lib/Tabs.js +15 -5
- package/lib/TagsInput.d.ts +15 -2
- package/lib/TagsInput.js +27 -9
- package/lib/Toast.js +9 -3
- package/lib/Tooltip.js +15 -5
- package/lib/createStyleContext.d.ts +5 -2
- package/lib/createStyleContext.js +6 -12
- package/lib/index.d.ts +8 -4
- package/lib/index.js +74 -0
- package/package.json +5 -5
package/lib/Checkbox.js
CHANGED
|
@@ -215,8 +215,12 @@ const {
|
|
|
215
215
|
withProvider,
|
|
216
216
|
withContext
|
|
217
217
|
} = (0, _createStyleContext.createStyleContext)(checkboxRecipe);
|
|
218
|
-
const CheckboxRoot = exports.CheckboxRoot = withProvider(_react.Checkbox.Root, "root"
|
|
219
|
-
|
|
218
|
+
const CheckboxRoot = exports.CheckboxRoot = withProvider(_react.Checkbox.Root, "root", {
|
|
219
|
+
baseComponent: true
|
|
220
|
+
});
|
|
221
|
+
const CheckboxIndicator = exports.CheckboxIndicator = withContext(_react.Checkbox.Indicator, "indicator", {
|
|
222
|
+
baseComponent: true
|
|
223
|
+
});
|
|
220
224
|
const InternalCheckboxLabel = withContext(_react.Checkbox.Label, "label");
|
|
221
225
|
const CheckboxLabel = _ref => {
|
|
222
226
|
let {
|
|
@@ -234,6 +238,10 @@ const CheckboxLabel = _ref => {
|
|
|
234
238
|
});
|
|
235
239
|
};
|
|
236
240
|
exports.CheckboxLabel = CheckboxLabel;
|
|
237
|
-
const CheckboxControl = exports.CheckboxControl = withContext(_react.Checkbox.Control, "control"
|
|
238
|
-
|
|
241
|
+
const CheckboxControl = exports.CheckboxControl = withContext(_react.Checkbox.Control, "control", {
|
|
242
|
+
baseComponent: true
|
|
243
|
+
});
|
|
244
|
+
const CheckboxGroup = exports.CheckboxGroup = withProvider(_react.Checkbox.Group, "group", {
|
|
245
|
+
baseComponent: true
|
|
246
|
+
});
|
|
239
247
|
const CheckboxHiddenInput = exports.CheckboxHiddenInput = _react.Checkbox.HiddenInput;
|
package/lib/Combobox.d.ts
CHANGED
|
@@ -42,18 +42,50 @@ declare const comboboxRecipe: import("@ndla/styled-system/types").SlotRecipeRunt
|
|
|
42
42
|
};
|
|
43
43
|
}>;
|
|
44
44
|
export type ComboboxVariantProps = RecipeVariantProps<typeof comboboxRecipe>;
|
|
45
|
-
export type ComboboxRootProps<T extends Combobox.CollectionItem> = Combobox.RootProps<T> & ComboboxVariantProps
|
|
45
|
+
export type ComboboxRootProps<T extends Combobox.CollectionItem> = Combobox.RootProps<T> & ComboboxVariantProps & JsxStyleProps & {
|
|
46
|
+
translations: Combobox.RootProps<T>["translations"];
|
|
47
|
+
};
|
|
46
48
|
export declare const ComboboxRoot: <T extends Combobox.CollectionItem>({ ...props }: ComboboxRootProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
-
export
|
|
48
|
-
export declare const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
export
|
|
52
|
-
export declare const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export
|
|
56
|
-
export declare const
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
export type ComboboxClearTriggerProps = Combobox.ClearTriggerProps & JsxStyleProps;
|
|
50
|
+
export declare const ComboboxClearTrigger: import("react").ForwardRefExoticComponent<Combobox.ClearTriggerProps & {
|
|
51
|
+
consumeCss?: boolean | undefined;
|
|
52
|
+
} & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLButtonElement>>;
|
|
53
|
+
export type ComboboxContentProps = Combobox.ContentProps & JsxStyleProps;
|
|
54
|
+
export declare const ComboboxContent: import("react").ForwardRefExoticComponent<Combobox.ContentProps & {
|
|
55
|
+
consumeCss?: boolean | undefined;
|
|
56
|
+
} & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
|
|
57
|
+
export type ComboboxControlProps = Combobox.ControlProps & JsxStyleProps;
|
|
58
|
+
export declare const ComboboxControl: import("react").ForwardRefExoticComponent<Combobox.ControlProps & {
|
|
59
|
+
consumeCss?: boolean | undefined;
|
|
60
|
+
} & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
|
|
61
|
+
export type ComboboxInputProps = Combobox.InputProps & JsxStyleProps;
|
|
62
|
+
export declare const ComboboxInput: import("react").ForwardRefExoticComponent<Combobox.InputProps & {
|
|
63
|
+
consumeCss?: boolean | undefined;
|
|
64
|
+
} & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLInputElement>>;
|
|
65
|
+
export type ComboboxItemGroupLabelProps = Combobox.ItemGroupLabelProps & TextProps & JsxStyleProps;
|
|
66
|
+
export declare const ComboboxItemGroupLabel: ({ children, textStyle, fontWeight, ...props }: ComboboxItemGroupLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
67
|
+
export type ComboboxItemGroupProps = Combobox.ItemGroupProps & JsxStyleProps;
|
|
68
|
+
export declare const ComboboxItemGroup: import("react").ForwardRefExoticComponent<Combobox.ItemGroupProps & {
|
|
69
|
+
consumeCss?: boolean | undefined;
|
|
70
|
+
} & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
|
|
71
|
+
export type ComboboxItemIndicatorProps = Combobox.ItemIndicatorProps & JsxStyleProps;
|
|
72
|
+
export declare const ComboboxItemIndicator: import("react").ForwardRefExoticComponent<Combobox.ItemIndicatorProps & {
|
|
73
|
+
consumeCss?: boolean | undefined;
|
|
74
|
+
} & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
|
|
75
|
+
export type ComboboxItemProps = Combobox.ItemProps & JsxStyleProps;
|
|
76
|
+
export declare const ComboboxItem: import("react").ForwardRefExoticComponent<Combobox.ItemProps & {
|
|
77
|
+
consumeCss?: boolean | undefined;
|
|
78
|
+
} & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
|
|
79
|
+
export type ComboboxItemTextProps = Combobox.ItemTextProps & TextProps & JsxStyleProps;
|
|
80
|
+
export declare const ComboboxItemText: ({ textStyle, fontWeight, children, ...props }: ComboboxItemTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
export type ComboboxLabelProps = Combobox.LabelProps & TextProps & JsxStyleProps;
|
|
82
|
+
export declare const ComboboxLabel: ({ textStyle, fontWeight, ...props }: ComboboxLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
export type ComboboxPositionerProps = Combobox.PositionerProps & JsxStyleProps;
|
|
84
|
+
export declare const ComboboxPositioner: import("react").ForwardRefExoticComponent<Combobox.PositionerProps & {
|
|
85
|
+
consumeCss?: boolean | undefined;
|
|
86
|
+
} & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
|
|
87
|
+
export type ComboboxTriggerProps = Combobox.TriggerProps & JsxStyleProps;
|
|
88
|
+
export declare const ComboboxTrigger: import("react").ForwardRefExoticComponent<Combobox.TriggerProps & {
|
|
89
|
+
consumeCss?: boolean | undefined;
|
|
90
|
+
} & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLButtonElement>>;
|
|
59
91
|
export {};
|
package/lib/Combobox.js
CHANGED
|
@@ -153,7 +153,9 @@ const {
|
|
|
153
153
|
withProvider,
|
|
154
154
|
withContext
|
|
155
155
|
} = (0, _createStyleContext.createStyleContext)(comboboxRecipe);
|
|
156
|
-
const InternalComboboxRoot = withProvider(_react.Combobox.Root, "root"
|
|
156
|
+
const InternalComboboxRoot = withProvider(_react.Combobox.Root, "root", {
|
|
157
|
+
baseComponent: true
|
|
158
|
+
});
|
|
157
159
|
const ComboboxRoot = _ref => {
|
|
158
160
|
let {
|
|
159
161
|
...props
|
|
@@ -167,10 +169,18 @@ const ComboboxRoot = _ref => {
|
|
|
167
169
|
);
|
|
168
170
|
};
|
|
169
171
|
exports.ComboboxRoot = ComboboxRoot;
|
|
170
|
-
const ComboboxClearTrigger = exports.ComboboxClearTrigger = withContext(_react.Combobox.ClearTrigger, "clearTrigger"
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const
|
|
172
|
+
const ComboboxClearTrigger = exports.ComboboxClearTrigger = withContext(_react.Combobox.ClearTrigger, "clearTrigger", {
|
|
173
|
+
baseComponent: true
|
|
174
|
+
});
|
|
175
|
+
const ComboboxContent = exports.ComboboxContent = withContext(_react.Combobox.Content, "content", {
|
|
176
|
+
baseComponent: true
|
|
177
|
+
});
|
|
178
|
+
const ComboboxControl = exports.ComboboxControl = withContext(_react.Combobox.Control, "control", {
|
|
179
|
+
baseComponent: true
|
|
180
|
+
});
|
|
181
|
+
const ComboboxInput = exports.ComboboxInput = withContext(_react.Combobox.Input, "input", {
|
|
182
|
+
baseComponent: true
|
|
183
|
+
});
|
|
174
184
|
const InternalComboboxItemGroupLabel = withContext(_react.Combobox.ItemGroupLabel, "itemGroupLabel");
|
|
175
185
|
const ComboboxItemGroupLabel = _ref2 => {
|
|
176
186
|
let {
|
|
@@ -194,9 +204,15 @@ const ComboboxItemGroupLabel = _ref2 => {
|
|
|
194
204
|
});
|
|
195
205
|
};
|
|
196
206
|
exports.ComboboxItemGroupLabel = ComboboxItemGroupLabel;
|
|
197
|
-
const ComboboxItemGroup = exports.ComboboxItemGroup = withContext(_react.Combobox.ItemGroup, "itemGroup"
|
|
198
|
-
|
|
199
|
-
|
|
207
|
+
const ComboboxItemGroup = exports.ComboboxItemGroup = withContext(_react.Combobox.ItemGroup, "itemGroup", {
|
|
208
|
+
baseComponent: true
|
|
209
|
+
});
|
|
210
|
+
const ComboboxItemIndicator = exports.ComboboxItemIndicator = withContext(_react.Combobox.ItemIndicator, "itemIndicator", {
|
|
211
|
+
baseComponent: true
|
|
212
|
+
});
|
|
213
|
+
const ComboboxItem = exports.ComboboxItem = withContext(_react.Combobox.Item, "item", {
|
|
214
|
+
baseComponent: true
|
|
215
|
+
});
|
|
200
216
|
const InternalComboboxItemText = withContext(_react.Combobox.ItemText, "itemText");
|
|
201
217
|
const ComboboxItemText = _ref3 => {
|
|
202
218
|
let {
|
|
@@ -235,5 +251,9 @@ const ComboboxLabel = _ref4 => {
|
|
|
235
251
|
});
|
|
236
252
|
};
|
|
237
253
|
exports.ComboboxLabel = ComboboxLabel;
|
|
238
|
-
const ComboboxPositioner = exports.ComboboxPositioner = withContext(_react.Combobox.Positioner, "positioner"
|
|
239
|
-
|
|
254
|
+
const ComboboxPositioner = exports.ComboboxPositioner = withContext(_react.Combobox.Positioner, "positioner", {
|
|
255
|
+
baseComponent: true
|
|
256
|
+
});
|
|
257
|
+
const ComboboxTrigger = exports.ComboboxTrigger = withContext(_react.Combobox.Trigger, "trigger", {
|
|
258
|
+
baseComponent: true
|
|
259
|
+
});
|
package/lib/Dialog.js
CHANGED
|
@@ -272,9 +272,15 @@ const DialogRoot = _ref => {
|
|
|
272
272
|
});
|
|
273
273
|
};
|
|
274
274
|
exports.DialogRoot = DialogRoot;
|
|
275
|
-
const DialogBackdrop = exports.DialogBackdrop = withContext(_react2.Dialog.Backdrop, "backdrop"
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
const DialogBackdrop = exports.DialogBackdrop = withContext(_react2.Dialog.Backdrop, "backdrop", {
|
|
276
|
+
baseComponent: true
|
|
277
|
+
});
|
|
278
|
+
const DialogStandaloneContent = exports.DialogStandaloneContent = withContext(_react2.Dialog.Content, "content", {
|
|
279
|
+
baseComponent: true
|
|
280
|
+
});
|
|
281
|
+
const DialogPositioner = exports.DialogPositioner = withContext(_react2.Dialog.Positioner, "positioner", {
|
|
282
|
+
baseComponent: true
|
|
283
|
+
});
|
|
278
284
|
const DialogContent = exports.DialogContent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
279
285
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DialogBackdrop, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(DialogPositioner, {
|
|
280
286
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DialogStandaloneContent, {
|
package/lib/Figure.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
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
|
+
import { JsxStyleProps, RecipeVariant } from "@ndla/styled-system/types";
|
|
11
11
|
declare const figureRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
|
|
12
12
|
size: {
|
|
13
13
|
full: {
|
|
@@ -43,19 +43,19 @@ declare const figureRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<
|
|
|
43
43
|
tablet: {
|
|
44
44
|
float: "left";
|
|
45
45
|
clear: "left";
|
|
46
|
-
paddingInlineEnd: "medium";
|
|
47
46
|
};
|
|
48
47
|
};
|
|
49
48
|
right: {
|
|
50
49
|
tablet: {
|
|
51
50
|
float: "right";
|
|
52
51
|
clear: "right";
|
|
53
|
-
paddingInlineStart: "medium";
|
|
54
52
|
};
|
|
55
53
|
};
|
|
56
54
|
};
|
|
57
55
|
}>;
|
|
58
56
|
export type FigureVariantProps = RecipeVariantProps<typeof figureRecipe>;
|
|
57
|
+
export type FigureSize = RecipeVariant<typeof figureRecipe>["size"];
|
|
58
|
+
export type FigureFloat = RecipeVariant<typeof figureRecipe>["float"];
|
|
59
59
|
export type FigureProps = HTMLArkProps<"figure"> & JsxStyleProps & FigureVariantProps;
|
|
60
60
|
export declare const Figure: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
|
|
61
61
|
consumeCss?: boolean | undefined;
|
package/lib/Figure.js
CHANGED
|
@@ -58,15 +58,13 @@ const figureRecipe = (0, _css.cva)({
|
|
|
58
58
|
left: {
|
|
59
59
|
tablet: {
|
|
60
60
|
float: "left",
|
|
61
|
-
clear: "left"
|
|
62
|
-
paddingInlineEnd: "medium"
|
|
61
|
+
clear: "left"
|
|
63
62
|
}
|
|
64
63
|
},
|
|
65
64
|
right: {
|
|
66
65
|
tablet: {
|
|
67
66
|
float: "right",
|
|
68
|
-
clear: "right"
|
|
69
|
-
paddingInlineStart: "medium"
|
|
67
|
+
clear: "right"
|
|
70
68
|
}
|
|
71
69
|
}
|
|
72
70
|
}
|
|
@@ -81,6 +79,25 @@ const figureRecipe = (0, _css.cva)({
|
|
|
81
79
|
left: "auto",
|
|
82
80
|
marginBlock: "xsmall"
|
|
83
81
|
}
|
|
82
|
+
}, {
|
|
83
|
+
float: "left",
|
|
84
|
+
size: ["medium", "small", "xsmall"],
|
|
85
|
+
css: {
|
|
86
|
+
paddingInlineEnd: "medium"
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
float: "right",
|
|
90
|
+
size: ["medium", "small", "xsmall"],
|
|
91
|
+
css: {
|
|
92
|
+
paddingInlineStart: "medium"
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
float: ["left", "right"],
|
|
96
|
+
size: ["full"],
|
|
97
|
+
css: {
|
|
98
|
+
paddingInlineStart: "0",
|
|
99
|
+
paddingInlineEnd: "0"
|
|
100
|
+
}
|
|
84
101
|
}]
|
|
85
102
|
});
|
|
86
103
|
const StyledFigure = (0, _jsx2.styled)(_react2.ark.figure, {}, {
|
package/lib/Image.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
import { ComponentPropsWithRef } from "react";
|
|
9
|
+
import { JsxStyleProps } from "@ndla/styled-system/types";
|
|
10
|
+
export interface ImageCrop {
|
|
11
|
+
startX: number;
|
|
12
|
+
startY: number;
|
|
13
|
+
endX: number;
|
|
14
|
+
endY: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ImageFocalPoint {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const makeSrcQueryString: (width: number | undefined, crop?: ImageCrop, focalPoint?: ImageFocalPoint) => string;
|
|
21
|
+
export declare const getSrcSet: (src: string, crop: ImageCrop | undefined, focalPoint: ImageFocalPoint | undefined) => string;
|
|
22
|
+
export interface PictureProps extends JsxStyleProps, ComponentPropsWithRef<"picture"> {
|
|
23
|
+
src: string;
|
|
24
|
+
sizes?: string;
|
|
25
|
+
contentType?: string;
|
|
26
|
+
srcSet?: string;
|
|
27
|
+
crop?: ImageCrop;
|
|
28
|
+
focalPoint?: ImageFocalPoint;
|
|
29
|
+
}
|
|
30
|
+
export declare const Picture: import("react").ForwardRefExoticComponent<Omit<PictureProps, "ref"> & import("react").RefAttributes<HTMLPictureElement>>;
|
|
31
|
+
export interface ImgProps extends JsxStyleProps, ComponentPropsWithRef<"img"> {
|
|
32
|
+
alt: string;
|
|
33
|
+
src: string;
|
|
34
|
+
fallbackWidth?: number;
|
|
35
|
+
contentType?: string;
|
|
36
|
+
crop?: ImageCrop;
|
|
37
|
+
focalPoint?: ImageFocalPoint;
|
|
38
|
+
}
|
|
39
|
+
export declare const Img: import("react").ForwardRefExoticComponent<Omit<ImgProps, "ref"> & import("react").RefAttributes<HTMLImageElement>>;
|
|
40
|
+
export interface ImageProps extends JsxStyleProps, ComponentPropsWithRef<"img"> {
|
|
41
|
+
alt: string;
|
|
42
|
+
src: string;
|
|
43
|
+
sizes?: string;
|
|
44
|
+
fallbackWidth?: number;
|
|
45
|
+
contentType?: string;
|
|
46
|
+
crop?: ImageCrop;
|
|
47
|
+
focalPoint?: ImageFocalPoint;
|
|
48
|
+
}
|
|
49
|
+
export declare const Image: import("react").ForwardRefExoticComponent<Omit<ImageProps, "ref"> & import("react").RefAttributes<HTMLImageElement>>;
|
package/lib/Image.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.makeSrcQueryString = exports.getSrcSet = exports.Picture = exports.Img = exports.Image = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
/**
|
|
11
|
+
* Copyright (c) 2024-present, NDLA.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const makeSrcQueryString = (width, crop, focalPoint) => {
|
|
19
|
+
const widthParams = width && `width=${width}`;
|
|
20
|
+
const cropParams = crop && `cropStartX=${crop.startX}&cropEndX=${crop.endX}&cropStartY=${crop.startY}&cropEndY=${crop.endY}`;
|
|
21
|
+
const focalPointParams = focalPoint && `focalX=${focalPoint.x}&focalY=${focalPoint.y}`;
|
|
22
|
+
const params = [widthParams, cropParams, focalPointParams].filter(p => p).join("&");
|
|
23
|
+
return params;
|
|
24
|
+
};
|
|
25
|
+
exports.makeSrcQueryString = makeSrcQueryString;
|
|
26
|
+
const getSrcSet = (src, crop, focalPoint) => {
|
|
27
|
+
const widths = [2720, 2080, 1760, 1440, 1120, 1000, 960, 800, 640, 480, 320, 240, 180];
|
|
28
|
+
return widths.map(width => `${src}?${makeSrcQueryString(width, crop, focalPoint)} ${width}w`).join(", ");
|
|
29
|
+
};
|
|
30
|
+
exports.getSrcSet = getSrcSet;
|
|
31
|
+
const FALLBACK_WIDTH = 1024;
|
|
32
|
+
const FALLBACK_SIZES = "(min-width: 1024px) 1024px, 100vw";
|
|
33
|
+
const Picture = exports.Picture = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
34
|
+
let {
|
|
35
|
+
children,
|
|
36
|
+
srcSet: srcSetProp,
|
|
37
|
+
crop,
|
|
38
|
+
focalPoint,
|
|
39
|
+
src,
|
|
40
|
+
contentType,
|
|
41
|
+
sizes = FALLBACK_SIZES,
|
|
42
|
+
...props
|
|
43
|
+
} = _ref;
|
|
44
|
+
const srcSet = srcSetProp ?? getSrcSet(src, crop, focalPoint);
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsx2.styled.picture, {
|
|
46
|
+
...props,
|
|
47
|
+
ref: ref,
|
|
48
|
+
children: [contentType !== "image/gif" && /*#__PURE__*/(0, _jsxRuntime.jsx)("source", {
|
|
49
|
+
type: contentType,
|
|
50
|
+
srcSet: srcSet,
|
|
51
|
+
sizes: sizes
|
|
52
|
+
}), children]
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
const Img = exports.Img = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
56
|
+
let {
|
|
57
|
+
fallbackWidth = FALLBACK_WIDTH,
|
|
58
|
+
crop,
|
|
59
|
+
focalPoint,
|
|
60
|
+
contentType,
|
|
61
|
+
src,
|
|
62
|
+
alt,
|
|
63
|
+
...props
|
|
64
|
+
} = _ref2;
|
|
65
|
+
const queryString = makeSrcQueryString(fallbackWidth, crop, focalPoint);
|
|
66
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsx2.styled.img, {
|
|
67
|
+
alt: alt,
|
|
68
|
+
src: contentType === "image/gif" ? src : `${src}?${queryString}`,
|
|
69
|
+
...props,
|
|
70
|
+
ref: ref
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
const Image = exports.Image = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
74
|
+
let {
|
|
75
|
+
children,
|
|
76
|
+
srcSet: srcSetProp,
|
|
77
|
+
crop,
|
|
78
|
+
focalPoint,
|
|
79
|
+
src,
|
|
80
|
+
contentType,
|
|
81
|
+
fallbackWidth = FALLBACK_WIDTH,
|
|
82
|
+
sizes = FALLBACK_SIZES,
|
|
83
|
+
alt,
|
|
84
|
+
...props
|
|
85
|
+
} = _ref3;
|
|
86
|
+
const srcSet = srcSetProp ?? getSrcSet(src, crop, focalPoint);
|
|
87
|
+
const queryString = makeSrcQueryString(fallbackWidth, crop, focalPoint);
|
|
88
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("picture", {
|
|
89
|
+
children: [contentType !== "image/gif" && /*#__PURE__*/(0, _jsxRuntime.jsx)("source", {
|
|
90
|
+
type: contentType,
|
|
91
|
+
srcSet: srcSet,
|
|
92
|
+
sizes: sizes
|
|
93
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsx2.styled.img, {
|
|
94
|
+
alt: alt,
|
|
95
|
+
src: contentType === "image/gif" ? src : `${src}?${queryString}`,
|
|
96
|
+
...props,
|
|
97
|
+
ref: ref
|
|
98
|
+
})]
|
|
99
|
+
});
|
|
100
|
+
});
|
package/lib/Input.js
CHANGED
|
@@ -147,7 +147,7 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((_ref3,
|
|
|
147
147
|
const resize = (0, _react.useCallback)(() => {
|
|
148
148
|
if (!localRef.current) return;
|
|
149
149
|
localRef.current.style.height = "0";
|
|
150
|
-
localRef.current.style.height =
|
|
150
|
+
localRef.current.style.height = `${localRef.current.scrollHeight + 3}px`;
|
|
151
151
|
}, []);
|
|
152
152
|
(0, _react.useEffect)(() => {
|
|
153
153
|
window.addEventListener("input", resize);
|
package/lib/Menu.js
CHANGED
|
@@ -148,7 +148,9 @@ const MenuRoot = _ref => {
|
|
|
148
148
|
});
|
|
149
149
|
};
|
|
150
150
|
exports.MenuRoot = MenuRoot;
|
|
151
|
-
const MenuContent = exports.MenuContent = withContext(_react2.Menu.Content, "content"
|
|
151
|
+
const MenuContent = exports.MenuContent = withContext(_react2.Menu.Content, "content", {
|
|
152
|
+
baseComponent: true
|
|
153
|
+
});
|
|
152
154
|
const InternalMenuItemGroupLabel = withContext(_react2.Menu.ItemGroupLabel, "itemGroupLabel");
|
|
153
155
|
const MenuItemGroupLabel = _ref2 => {
|
|
154
156
|
let {
|
|
@@ -168,8 +170,12 @@ const MenuItemGroupLabel = _ref2 => {
|
|
|
168
170
|
});
|
|
169
171
|
};
|
|
170
172
|
exports.MenuItemGroupLabel = MenuItemGroupLabel;
|
|
171
|
-
const MenuItemGroup = exports.MenuItemGroup = withContext(_react2.Menu.ItemGroup, "itemGroup"
|
|
172
|
-
|
|
173
|
+
const MenuItemGroup = exports.MenuItemGroup = withContext(_react2.Menu.ItemGroup, "itemGroup", {
|
|
174
|
+
baseComponent: true
|
|
175
|
+
});
|
|
176
|
+
const InternalMenuItem = withContext(_react2.Menu.Item, "item", {
|
|
177
|
+
baseComponent: true
|
|
178
|
+
});
|
|
173
179
|
const MenuItem = exports.MenuItem = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
174
180
|
let {
|
|
175
181
|
css: cssProp = {},
|
|
@@ -184,8 +190,12 @@ const MenuItem = exports.MenuItem = /*#__PURE__*/(0, _react.forwardRef)((_ref3,
|
|
|
184
190
|
ref: ref
|
|
185
191
|
});
|
|
186
192
|
});
|
|
187
|
-
const MenuPositioner = exports.MenuPositioner = withContext(_react2.Menu.Positioner, "positioner"
|
|
188
|
-
|
|
193
|
+
const MenuPositioner = exports.MenuPositioner = withContext(_react2.Menu.Positioner, "positioner", {
|
|
194
|
+
baseComponent: true
|
|
195
|
+
});
|
|
196
|
+
const InternalMenuTriggerItem = withContext(_react2.Menu.TriggerItem, "triggerItem", {
|
|
197
|
+
baseComponent: true
|
|
198
|
+
});
|
|
189
199
|
const MenuTriggerItem = exports.MenuTriggerItem = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
190
200
|
let {
|
|
191
201
|
css: cssProp = {},
|
|
@@ -200,5 +210,9 @@ const MenuTriggerItem = exports.MenuTriggerItem = /*#__PURE__*/(0, _react.forwar
|
|
|
200
210
|
ref: ref
|
|
201
211
|
});
|
|
202
212
|
});
|
|
203
|
-
const MenuTrigger = exports.MenuTrigger = withContext(_react2.Menu.Trigger, "trigger"
|
|
204
|
-
|
|
213
|
+
const MenuTrigger = exports.MenuTrigger = withContext(_react2.Menu.Trigger, "trigger", {
|
|
214
|
+
baseComponent: true
|
|
215
|
+
});
|
|
216
|
+
const MenuSeparator = exports.MenuSeparator = withContext(_react2.Menu.Separator, "separator", {
|
|
217
|
+
baseComponent: true
|
|
218
|
+
});
|
package/lib/Pagination.d.ts
CHANGED
|
@@ -7,10 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Pagination } from "@ark-ui/react";
|
|
9
9
|
import { JsxStyleProps } from "@ndla/styled-system/types";
|
|
10
|
-
|
|
10
|
+
interface RootProps extends Pagination.RootProps {
|
|
11
|
+
translations: Pagination.RootProps["translations"];
|
|
12
|
+
}
|
|
13
|
+
export type PaginationRootProps = JsxStyleProps & RootProps;
|
|
11
14
|
export declare const PaginationRoot: import("react").ForwardRefExoticComponent<{
|
|
12
15
|
consumeCss?: boolean | undefined;
|
|
13
|
-
} & import("@ndla/styled-system/types").WithCss &
|
|
16
|
+
} & import("@ndla/styled-system/types").WithCss & RootProps & import("react").RefAttributes<HTMLElement>>;
|
|
14
17
|
export declare const PaginationItem: import("react").ForwardRefExoticComponent<{
|
|
15
18
|
consumeCss?: boolean | undefined;
|
|
16
19
|
} & import("@ndla/styled-system/types").WithCss & Pagination.ItemProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -23,3 +26,4 @@ export declare const PaginationPrevTrigger: import("react").ForwardRefExoticComp
|
|
|
23
26
|
export declare const PaginationNextTrigger: import("react").ForwardRefExoticComponent<{
|
|
24
27
|
consumeCss?: boolean | undefined;
|
|
25
28
|
} & import("@ndla/styled-system/types").WithCss & Pagination.NextTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
29
|
+
export {};
|
package/lib/Pagination.js
CHANGED
|
@@ -35,8 +35,18 @@ const {
|
|
|
35
35
|
withProvider,
|
|
36
36
|
withContext
|
|
37
37
|
} = (0, _createStyleContext.createStyleContext)(paginationRecipe);
|
|
38
|
-
const PaginationRoot = exports.PaginationRoot = withProvider(_react.Pagination.Root, "root"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
38
|
+
const PaginationRoot = exports.PaginationRoot = withProvider(_react.Pagination.Root, "root", {
|
|
39
|
+
baseComponent: true
|
|
40
|
+
});
|
|
41
|
+
const PaginationItem = exports.PaginationItem = withContext(_react.Pagination.Item, "item", {
|
|
42
|
+
baseComponent: true
|
|
43
|
+
});
|
|
44
|
+
const PaginationEllipsis = exports.PaginationEllipsis = withContext(_react.Pagination.Ellipsis, "ellipsis", {
|
|
45
|
+
baseComponent: true
|
|
46
|
+
});
|
|
47
|
+
const PaginationPrevTrigger = exports.PaginationPrevTrigger = withContext(_react.Pagination.PrevTrigger, "prevTrigger", {
|
|
48
|
+
baseComponent: true
|
|
49
|
+
});
|
|
50
|
+
const PaginationNextTrigger = exports.PaginationNextTrigger = withContext(_react.Pagination.NextTrigger, "nextTrigger", {
|
|
51
|
+
baseComponent: true
|
|
52
|
+
});
|
package/lib/Popover.js
CHANGED
|
@@ -62,25 +62,45 @@ const PopoverRoot = _ref => {
|
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
64
|
exports.PopoverRoot = PopoverRoot;
|
|
65
|
-
const PopoverAnchor = exports.PopoverAnchor = withContext(_react.Popover.Anchor, "anchor"
|
|
66
|
-
|
|
65
|
+
const PopoverAnchor = exports.PopoverAnchor = withContext(_react.Popover.Anchor, "anchor", {
|
|
66
|
+
baseComponent: true
|
|
67
|
+
});
|
|
68
|
+
const PopoverArrowStandalone = exports.PopoverArrowStandalone = withContext(_react.Popover.Arrow, "arrow", {
|
|
69
|
+
baseComponent: true
|
|
70
|
+
});
|
|
67
71
|
const PopoverArrow = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(PopoverArrowStandalone, {
|
|
68
72
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PopoverArrowTip, {
|
|
69
73
|
...props
|
|
70
74
|
})
|
|
71
75
|
});
|
|
72
76
|
exports.PopoverArrow = PopoverArrow;
|
|
73
|
-
const PopoverArrowTip = exports.PopoverArrowTip = withContext(_react.Popover.ArrowTip, "arrowTip"
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
const PopoverArrowTip = exports.PopoverArrowTip = withContext(_react.Popover.ArrowTip, "arrowTip", {
|
|
78
|
+
baseComponent: true
|
|
79
|
+
});
|
|
80
|
+
const PopoverCloseTrigger = exports.PopoverCloseTrigger = withContext(_react.Popover.CloseTrigger, "closeTrigger", {
|
|
81
|
+
baseComponent: true
|
|
82
|
+
});
|
|
83
|
+
const PopoverContentStandalone = exports.PopoverContentStandalone = withContext(_react.Popover.Content, "content", {
|
|
84
|
+
baseComponent: true
|
|
85
|
+
});
|
|
76
86
|
const PopoverContent = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(PopoverPositioner, {
|
|
77
87
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PopoverContentStandalone, {
|
|
78
88
|
...props
|
|
79
89
|
})
|
|
80
90
|
});
|
|
81
91
|
exports.PopoverContent = PopoverContent;
|
|
82
|
-
const PopoverDescription = exports.PopoverDescription = withContext(_react.Popover.Description, "description"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
92
|
+
const PopoverDescription = exports.PopoverDescription = withContext(_react.Popover.Description, "description", {
|
|
93
|
+
baseComponent: true
|
|
94
|
+
});
|
|
95
|
+
const PopoverIndicator = exports.PopoverIndicator = withContext(_react.Popover.Indicator, "indicator", {
|
|
96
|
+
baseComponent: true
|
|
97
|
+
});
|
|
98
|
+
const PopoverPositioner = exports.PopoverPositioner = withContext(_react.Popover.Positioner, "positioner", {
|
|
99
|
+
baseComponent: true
|
|
100
|
+
});
|
|
101
|
+
const PopoverTitle = exports.PopoverTitle = withContext(_react.Popover.Title, "title", {
|
|
102
|
+
baseComponent: true
|
|
103
|
+
});
|
|
104
|
+
const PopoverTrigger = exports.PopoverTrigger = withContext(_react.Popover.Trigger, "trigger", {
|
|
105
|
+
baseComponent: true
|
|
106
|
+
});
|
package/lib/RadioGroup.js
CHANGED
|
@@ -96,10 +96,18 @@ const {
|
|
|
96
96
|
withProvider,
|
|
97
97
|
withContext
|
|
98
98
|
} = (0, _createStyleContext.createStyleContext)(radioGroupRecipe);
|
|
99
|
-
const RadioGroupRoot = exports.RadioGroupRoot = withProvider(_react2.RadioGroup.Root, "root"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const
|
|
99
|
+
const RadioGroupRoot = exports.RadioGroupRoot = withProvider(_react2.RadioGroup.Root, "root", {
|
|
100
|
+
baseComponent: true
|
|
101
|
+
});
|
|
102
|
+
const RadioGroupIndicator = exports.RadioGroupIndicator = withContext(_react2.RadioGroup.Indicator, "indicator", {
|
|
103
|
+
baseComponent: true
|
|
104
|
+
});
|
|
105
|
+
const RadioGroupItemControl = exports.RadioGroupItemControl = withContext(_react2.RadioGroup.ItemControl, "itemControl", {
|
|
106
|
+
baseComponent: true
|
|
107
|
+
});
|
|
108
|
+
const RadioGroupItem = exports.RadioGroupItem = withContext(_react2.RadioGroup.Item, "item", {
|
|
109
|
+
baseComponent: true
|
|
110
|
+
});
|
|
103
111
|
const InternalRadioGroupItemText = withContext(_react2.RadioGroup.ItemText, "itemText");
|
|
104
112
|
const RadioGroupItemText = _ref => {
|
|
105
113
|
let {
|