@ndla/primitives 0.0.1

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.
Files changed (97) hide show
  1. package/LICENSE +674 -0
  2. package/dist/panda.buildinfo.json +426 -0
  3. package/dist/styles.css +1738 -0
  4. package/es/Accordion.js +103 -0
  5. package/es/ArticleLists.js +106 -0
  6. package/es/Badge.js +55 -0
  7. package/es/BlockQuote.js +49 -0
  8. package/es/Button.js +211 -0
  9. package/es/Checkbox.js +118 -0
  10. package/es/Dialog.js +329 -0
  11. package/es/ExpandableBox.js +55 -0
  12. package/es/FieldErrorMessage.js +44 -0
  13. package/es/FieldHelper.js +37 -0
  14. package/es/FormControl.js +163 -0
  15. package/es/FramedContent.js +54 -0
  16. package/es/Icon.js +71 -0
  17. package/es/Input.js +159 -0
  18. package/es/Label.js +104 -0
  19. package/es/Menu.js +171 -0
  20. package/es/MessageBox.js +57 -0
  21. package/es/NdlaLogo.js +284 -0
  22. package/es/Pagination.js +37 -0
  23. package/es/Popover.js +78 -0
  24. package/es/RadioGroup.js +136 -0
  25. package/es/Skeleton.js +31 -0
  26. package/es/Slider.js +102 -0
  27. package/es/Spinner.js +54 -0
  28. package/es/Switch.js +130 -0
  29. package/es/Table.js +75 -0
  30. package/es/Text.js +54 -0
  31. package/es/Toast.js +82 -0
  32. package/es/Tooltip.js +59 -0
  33. package/es/createStyleContext.js +62 -0
  34. package/es/index.js +19 -0
  35. package/lib/Accordion.d.ts +17 -0
  36. package/lib/Accordion.js +109 -0
  37. package/lib/ArticleLists.d.ts +20 -0
  38. package/lib/ArticleLists.js +115 -0
  39. package/lib/Badge.d.ts +33 -0
  40. package/lib/Badge.js +62 -0
  41. package/lib/BlockQuote.d.ts +28 -0
  42. package/lib/BlockQuote.js +56 -0
  43. package/lib/Button.d.ts +131 -0
  44. package/lib/Button.js +217 -0
  45. package/lib/Checkbox.d.ts +15 -0
  46. package/lib/Checkbox.js +125 -0
  47. package/lib/Dialog.d.ts +107 -0
  48. package/lib/Dialog.js +338 -0
  49. package/lib/ExpandableBox.d.ts +12 -0
  50. package/lib/ExpandableBox.js +63 -0
  51. package/lib/FieldErrorMessage.d.ts +11 -0
  52. package/lib/FieldErrorMessage.js +50 -0
  53. package/lib/FieldHelper.d.ts +11 -0
  54. package/lib/FieldHelper.js +43 -0
  55. package/lib/FormControl.d.ts +65 -0
  56. package/lib/FormControl.js +173 -0
  57. package/lib/FramedContent.d.ts +32 -0
  58. package/lib/FramedContent.js +61 -0
  59. package/lib/Icon.d.ts +37 -0
  60. package/lib/Icon.js +78 -0
  61. package/lib/Input.d.ts +20 -0
  62. package/lib/Input.js +165 -0
  63. package/lib/Label.d.ts +16 -0
  64. package/lib/Label.js +110 -0
  65. package/lib/Menu.d.ts +25 -0
  66. package/lib/Menu.js +179 -0
  67. package/lib/MessageBox.d.ts +33 -0
  68. package/lib/MessageBox.js +64 -0
  69. package/lib/NdlaLogo.d.ts +15 -0
  70. package/lib/NdlaLogo.js +293 -0
  71. package/lib/Pagination.d.ts +14 -0
  72. package/lib/Pagination.js +43 -0
  73. package/lib/Popover.d.ts +22 -0
  74. package/lib/Popover.js +87 -0
  75. package/lib/RadioGroup.d.ts +19 -0
  76. package/lib/RadioGroup.js +143 -0
  77. package/lib/Skeleton.d.ts +11 -0
  78. package/lib/Skeleton.js +38 -0
  79. package/lib/Slider.d.ts +17 -0
  80. package/lib/Slider.js +109 -0
  81. package/lib/Spinner.d.ts +26 -0
  82. package/lib/Spinner.js +61 -0
  83. package/lib/Switch.d.ts +21 -0
  84. package/lib/Switch.js +137 -0
  85. package/lib/Table.d.ts +10 -0
  86. package/lib/Table.js +82 -0
  87. package/lib/Text.d.ts +24 -0
  88. package/lib/Text.js +62 -0
  89. package/lib/Toast.d.ts +18 -0
  90. package/lib/Toast.js +90 -0
  91. package/lib/Tooltip.d.ts +16 -0
  92. package/lib/Tooltip.js +65 -0
  93. package/lib/createStyleContext.d.ts +27 -0
  94. package/lib/createStyleContext.js +69 -0
  95. package/lib/index.d.ts +28 -0
  96. package/lib/index.js +130 -0
  97. package/package.json +48 -0
@@ -0,0 +1,14 @@
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 { Pagination } from "@ark-ui/react";
9
+ export type PaginationRootProps = Pagination.RootProps;
10
+ export declare const PaginationRoot: import("react").ForwardRefExoticComponent<Pagination.RootProps & import("react").RefAttributes<HTMLElement>>;
11
+ export declare const PaginationItem: import("react").ForwardRefExoticComponent<Pagination.ItemProps & import("react").RefAttributes<HTMLButtonElement>>;
12
+ export declare const PaginationEllipsis: import("react").ForwardRefExoticComponent<Pagination.EllipsisProps & import("react").RefAttributes<HTMLDivElement>>;
13
+ export declare const PaginationPrevTrigger: import("react").ForwardRefExoticComponent<Pagination.PrevTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
14
+ export declare const PaginationNextTrigger: import("react").ForwardRefExoticComponent<Pagination.NextTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PaginationRoot = exports.PaginationPrevTrigger = exports.PaginationNextTrigger = exports.PaginationItem = exports.PaginationEllipsis = void 0;
7
+ var _anatomy = require("@ark-ui/anatomy");
8
+ var _react = require("@ark-ui/react");
9
+ var _css = require("@ndla/styled-system/css");
10
+ var _createStyleContext = require("./createStyleContext");
11
+ /**
12
+ * Copyright (c) 2024-present, NDLA.
13
+ *
14
+ * This source code is licensed under the GPLv3 license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ *
17
+ */
18
+
19
+ const paginationRecipe = (0, _css.sva)({
20
+ slots: _anatomy.paginationAnatomy.keys(),
21
+ base: {
22
+ root: {
23
+ display: "flex",
24
+ gap: "xxsmall"
25
+ },
26
+ item: {
27
+ fontVariantNumeric: "tabular-nums"
28
+ },
29
+ ellipsis: {
30
+ display: "inline-flex",
31
+ alignItems: "center"
32
+ }
33
+ }
34
+ });
35
+ const {
36
+ withProvider,
37
+ withContext
38
+ } = (0, _createStyleContext.createStyleContext)(paginationRecipe);
39
+ const PaginationRoot = exports.PaginationRoot = withProvider(_react.Pagination.Root, "root");
40
+ const PaginationItem = exports.PaginationItem = withContext(_react.Pagination.Item, "item");
41
+ const PaginationEllipsis = exports.PaginationEllipsis = withContext(_react.Pagination.Ellipsis, "ellipsis");
42
+ const PaginationPrevTrigger = exports.PaginationPrevTrigger = withContext(_react.Pagination.PrevTrigger, "prevTrigger");
43
+ const PaginationNextTrigger = exports.PaginationNextTrigger = withContext(_react.Pagination.NextTrigger, "nextTrigger");
@@ -0,0 +1,22 @@
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 { Popover } from "@ark-ui/react";
9
+ export type PopoverRootProps = Popover.RootProps;
10
+ export declare const PopoverRoot: ({ lazyMount, unmountOnExit, ...props }: PopoverRootProps) => import("@emotion/react/jsx-runtime").JSX.Element;
11
+ export declare const PopoverAnchor: import("react").ForwardRefExoticComponent<Popover.AnchorProps & import("react").RefAttributes<HTMLDivElement>>;
12
+ export declare const PopoverArrowStandalone: import("react").ForwardRefExoticComponent<Popover.ArrowProps & import("react").RefAttributes<HTMLDivElement>>;
13
+ export declare const PopoverArrow: (props: Popover.ArrowTipProps) => import("@emotion/react/jsx-runtime").JSX.Element;
14
+ export declare const PopoverArrowTip: import("react").ForwardRefExoticComponent<Popover.ArrowTipProps & import("react").RefAttributes<HTMLDivElement>>;
15
+ export declare const PopoverCloseTrigger: import("react").ForwardRefExoticComponent<Popover.CloseTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
16
+ export declare const PopoverContentStandalone: import("react").ForwardRefExoticComponent<Popover.ContentProps & import("react").RefAttributes<HTMLDivElement>>;
17
+ export declare const PopoverContent: (props: Popover.ContentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
18
+ export declare const PopoverDescription: import("react").ForwardRefExoticComponent<Popover.DescriptionProps & import("react").RefAttributes<HTMLParagraphElement>>;
19
+ export declare const PopoverIndicator: import("react").ForwardRefExoticComponent<Popover.IndicatorProps & import("react").RefAttributes<HTMLDivElement>>;
20
+ export declare const PopoverPositioner: import("react").ForwardRefExoticComponent<Popover.PositionerProps & import("react").RefAttributes<HTMLDivElement>>;
21
+ export declare const PopoverTitle: import("react").ForwardRefExoticComponent<Popover.TitleProps & import("react").RefAttributes<HTMLDivElement>>;
22
+ export declare const PopoverTrigger: import("react").ForwardRefExoticComponent<Popover.TriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
package/lib/Popover.js ADDED
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PopoverTrigger = exports.PopoverTitle = exports.PopoverRoot = exports.PopoverPositioner = exports.PopoverIndicator = exports.PopoverDescription = exports.PopoverContentStandalone = exports.PopoverContent = exports.PopoverCloseTrigger = exports.PopoverArrowTip = exports.PopoverArrowStandalone = exports.PopoverArrow = exports.PopoverAnchor = void 0;
7
+ var _anatomy = require("@ark-ui/anatomy");
8
+ var _react = require("@ark-ui/react");
9
+ var _css = require("@ndla/styled-system/css");
10
+ var _createStyleContext = require("./createStyleContext");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ /**
13
+ * Copyright (c) 2024-present, NDLA.
14
+ *
15
+ * This source code is licensed under the GPLv3 license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ *
18
+ */
19
+
20
+ const popoverRecipe = (0, _css.sva)({
21
+ slots: _anatomy.popoverAnatomy.keys(),
22
+ base: {
23
+ positioner: {
24
+ position: "relative"
25
+ },
26
+ content: {
27
+ display: "flex",
28
+ flexDirection: "column",
29
+ padding: "medium",
30
+ background: "surface.default",
31
+ borderRadius: "xsmall",
32
+ boxShadow: "xlarge",
33
+ zIndex: "popover",
34
+ maxWidth: "var(--available-width)",
35
+ _open: {
36
+ animation: "fade-shift-in 0.2s ease-out"
37
+ },
38
+ _closed: {
39
+ animation: "fade-shift-out 0.2s ease-out"
40
+ }
41
+ },
42
+ arrow: {
43
+ "--arrow-size": "sizes.xxsmall",
44
+ "--arrow-background": "colors.surface.default"
45
+ }
46
+ }
47
+ });
48
+ const {
49
+ withRootProvider,
50
+ withContext
51
+ } = (0, _createStyleContext.createStyleContext)(popoverRecipe);
52
+ const InternalPopoverRoot = withRootProvider(_react.Popover.Root);
53
+ const PopoverRoot = _ref => {
54
+ let {
55
+ lazyMount = true,
56
+ unmountOnExit = true,
57
+ ...props
58
+ } = _ref;
59
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalPopoverRoot, {
60
+ lazyMount: lazyMount,
61
+ unmountOnExit: unmountOnExit,
62
+ ...props
63
+ });
64
+ };
65
+ exports.PopoverRoot = PopoverRoot;
66
+ const PopoverAnchor = exports.PopoverAnchor = withContext(_react.Popover.Anchor, "anchor");
67
+ const PopoverArrowStandalone = exports.PopoverArrowStandalone = withContext(_react.Popover.Arrow, "arrow");
68
+ const PopoverArrow = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(PopoverArrowStandalone, {
69
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PopoverArrowTip, {
70
+ ...props
71
+ })
72
+ });
73
+ exports.PopoverArrow = PopoverArrow;
74
+ const PopoverArrowTip = exports.PopoverArrowTip = withContext(_react.Popover.ArrowTip, "arrowTip");
75
+ const PopoverCloseTrigger = exports.PopoverCloseTrigger = withContext(_react.Popover.CloseTrigger, "closeTrigger");
76
+ const PopoverContentStandalone = exports.PopoverContentStandalone = withContext(_react.Popover.Content, "content");
77
+ const PopoverContent = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(PopoverPositioner, {
78
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PopoverContentStandalone, {
79
+ ...props
80
+ })
81
+ });
82
+ exports.PopoverContent = PopoverContent;
83
+ const PopoverDescription = exports.PopoverDescription = withContext(_react.Popover.Description, "description");
84
+ const PopoverIndicator = exports.PopoverIndicator = withContext(_react.Popover.Indicator, "indicator");
85
+ const PopoverPositioner = exports.PopoverPositioner = withContext(_react.Popover.Positioner, "positioner");
86
+ const PopoverTitle = exports.PopoverTitle = withContext(_react.Popover.Title, "title");
87
+ const PopoverTrigger = exports.PopoverTrigger = withContext(_react.Popover.Trigger, "trigger");
@@ -0,0 +1,19 @@
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 { RadioGroup } from "@ark-ui/react";
9
+ import { TextProps } from "./Text";
10
+ export interface RadioGroupRootProps extends RadioGroup.RootProps {
11
+ }
12
+ export declare const RadioGroupRoot: import("react").ForwardRefExoticComponent<RadioGroupRootProps & import("react").RefAttributes<HTMLDivElement>>;
13
+ export declare const RadioGroupIndicator: import("react").ForwardRefExoticComponent<RadioGroup.IndicatorProps & import("react").RefAttributes<HTMLDivElement>>;
14
+ export declare const RadioGroupItemControl: import("react").ForwardRefExoticComponent<RadioGroup.ItemControlProps & import("react").RefAttributes<HTMLDivElement>>;
15
+ export declare const RadioGroupItem: import("react").ForwardRefExoticComponent<RadioGroup.ItemProps & import("react").RefAttributes<HTMLLabelElement>>;
16
+ export declare const RadioGroupItemText: ({ textStyle, ...props }: RadioGroup.ItemTextProps & TextProps) => import("@emotion/react/jsx-runtime").JSX.Element;
17
+ export declare const InternalRadioGroupLabel: import("react").ForwardRefExoticComponent<RadioGroup.LabelProps & import("react").RefAttributes<HTMLLabelElement>>;
18
+ export declare const RadioGroupLabel: import("react").ForwardRefExoticComponent<RadioGroup.LabelProps & TextProps & import("react").RefAttributes<HTMLLabelElement>>;
19
+ export declare const RadioGroupItemHiddenInput: import("react").ForwardRefExoticComponent<RadioGroup.ItemHiddenInputProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RadioGroupRoot = exports.RadioGroupLabel = exports.RadioGroupItemText = exports.RadioGroupItemHiddenInput = exports.RadioGroupItemControl = exports.RadioGroupItem = exports.RadioGroupIndicator = exports.InternalRadioGroupLabel = void 0;
7
+ var _react = require("react");
8
+ var _anatomy = require("@ark-ui/anatomy");
9
+ var _react2 = require("@ark-ui/react");
10
+ var _css = require("@ndla/styled-system/css");
11
+ var _createStyleContext = require("./createStyleContext");
12
+ var _FormControl = require("./FormControl");
13
+ var _Label = require("./Label");
14
+ var _Text = require("./Text");
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ /**
17
+ * Copyright (c) 2024-present, NDLA.
18
+ *
19
+ * This source code is licensed under the GPLv3 license found in the
20
+ * LICENSE file in the root directory of this source tree.
21
+ *
22
+ */
23
+
24
+ const radioGroupRecipe = (0, _css.sva)({
25
+ slots: _anatomy.radioGroupAnatomy.keys(),
26
+ base: {
27
+ root: {
28
+ display: "flex",
29
+ flexWrap: "wrap",
30
+ position: "relative",
31
+ gap: "small",
32
+ _vertical: {
33
+ flexDirection: "column"
34
+ },
35
+ _horizontal: {
36
+ flexDirection: "row"
37
+ }
38
+ },
39
+ itemControl: {
40
+ background: "surface.default",
41
+ borderColor: "stroke.subtle",
42
+ borderRadius: "full",
43
+ borderWidth: "2px",
44
+ width: "medium",
45
+ height: "medium",
46
+ outlineStyle: "solid",
47
+ outlineWidth: "4px",
48
+ outlineOffset: "-6px",
49
+ outlineColor: "surface.default",
50
+ transitionDuration: "normal",
51
+ transitionProperty: "background, border-color, box-shadow",
52
+ transitionTimingFunction: "default",
53
+ _hover: {
54
+ boxShadow: "0 0 0 4px var(--shadow-color)",
55
+ boxShadowColor: "surface.actionSubtle.hover.strong"
56
+ },
57
+ _checked: {
58
+ background: "stroke.default",
59
+ borderColor: "stroke.default"
60
+ },
61
+ _disabled: {
62
+ borderColor: "stroke.disabled",
63
+ _hover: {
64
+ borderColor: "stroke.disabled",
65
+ boxShadow: "none"
66
+ }
67
+ }
68
+ },
69
+ item: {
70
+ display: "flex",
71
+ alignItems: "center",
72
+ cursor: "pointer",
73
+ gap: "xxsmall",
74
+ _disabled: {
75
+ cursor: "not-allowed"
76
+ },
77
+ "&:has(input:focus-visible)": {
78
+ outline: "2px solid",
79
+ outlineOffset: "4xsmall",
80
+ outlineColor: "stroke.default",
81
+ borderRadius: "xsmall"
82
+ }
83
+ },
84
+ itemText: {
85
+ _hover: {
86
+ color: "text.action"
87
+ },
88
+ _disabled: {
89
+ color: "text.disabled",
90
+ _hover: {
91
+ color: "text.disabled"
92
+ }
93
+ }
94
+ }
95
+ }
96
+ });
97
+ const {
98
+ withProvider,
99
+ withContext
100
+ } = (0, _createStyleContext.createStyleContext)(radioGroupRecipe);
101
+ const InternalRadioGroupRoot = withProvider(_react2.RadioGroup.Root, "root");
102
+ const RadioGroupRoot = exports.RadioGroupRoot = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
103
+ const field = (0, _FormControl.useFormControl)(props);
104
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalRadioGroupRoot, {
105
+ ...field,
106
+ ref: ref
107
+ });
108
+ });
109
+ const RadioGroupIndicator = exports.RadioGroupIndicator = withContext(_react2.RadioGroup.Indicator, "indicator");
110
+ const RadioGroupItemControl = exports.RadioGroupItemControl = withContext(_react2.RadioGroup.ItemControl, "itemControl");
111
+ const RadioGroupItem = exports.RadioGroupItem = withContext(_react2.RadioGroup.Item, "item");
112
+ const InternalRadioGroupItemText = withContext(_react2.RadioGroup.ItemText, "itemText");
113
+ const RadioGroupItemText = _ref => {
114
+ let {
115
+ textStyle = "label.medium",
116
+ ...props
117
+ } = _ref;
118
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalRadioGroupItemText, {
119
+ asChild: true,
120
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
121
+ as: "span",
122
+ textStyle: textStyle,
123
+ ...props
124
+ })
125
+ });
126
+ };
127
+ exports.RadioGroupItemText = RadioGroupItemText;
128
+ const InternalRadioGroupLabel = exports.InternalRadioGroupLabel = withContext(_react2.RadioGroup.Label, "label");
129
+ const RadioGroupLabel = exports.RadioGroupLabel = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
130
+ let {
131
+ textStyle = "label.large",
132
+ ...props
133
+ } = _ref2;
134
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalRadioGroupLabel, {
135
+ ref: ref,
136
+ asChild: true,
137
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Label.Label, {
138
+ textStyle: textStyle,
139
+ ...props
140
+ })
141
+ });
142
+ });
143
+ const RadioGroupItemHiddenInput = exports.RadioGroupItemHiddenInput = _react2.RadioGroup.ItemHiddenInput;
@@ -0,0 +1,11 @@
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 { HTMLArkProps } from "@ark-ui/react";
9
+ export interface SkeletonProps extends HTMLArkProps<"div"> {
10
+ }
11
+ export declare const Skeleton: (props: SkeletonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Skeleton = void 0;
7
+ var _react = require("@ark-ui/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 StyledDiv = (0, _jsx2.styled)(_react.ark.div, {
19
+ base: {
20
+ animation: "skeleton-pulse",
21
+ backgroundColor: "surface.disabled",
22
+ backgroundClip: "padding-box",
23
+ borderRadius: "xsmall",
24
+ color: "transparent",
25
+ cursor: "default",
26
+ pointerEvents: "none",
27
+ userSelect: "none",
28
+ "&::before, &::after, *": {
29
+ visibility: "hidden"
30
+ }
31
+ }
32
+ });
33
+ const Skeleton = props => {
34
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledDiv, {
35
+ ...props
36
+ });
37
+ };
38
+ exports.Skeleton = Skeleton;
@@ -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
+ import { Slider } from "@ark-ui/react";
9
+ import { TextProps } from "./Text";
10
+ export type SliderRootProps = Slider.RootProps;
11
+ export declare const SliderRoot: import("react").ForwardRefExoticComponent<Slider.RootProps & import("react").RefAttributes<HTMLDivElement>>;
12
+ export declare const SliderControl: import("react").ForwardRefExoticComponent<Slider.ControlProps & import("react").RefAttributes<HTMLDivElement>>;
13
+ export declare const SliderTrack: import("react").ForwardRefExoticComponent<Slider.TrackProps & import("react").RefAttributes<HTMLDivElement>>;
14
+ export declare const SliderRange: import("react").ForwardRefExoticComponent<Slider.RangeProps & import("react").RefAttributes<HTMLDivElement>>;
15
+ export declare const SliderThumb: import("react").ForwardRefExoticComponent<Slider.ThumbProps & import("react").RefAttributes<HTMLDivElement>>;
16
+ export declare const SliderLabel: ({ textStyle, ...props }: Slider.LabelProps & TextProps) => import("@emotion/react/jsx-runtime").JSX.Element;
17
+ export declare const SliderHiddenInput: import("react").ForwardRefExoticComponent<Slider.HiddenInputProps & import("react").RefAttributes<HTMLInputElement>>;
package/lib/Slider.js ADDED
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SliderTrack = exports.SliderThumb = exports.SliderRoot = exports.SliderRange = exports.SliderLabel = exports.SliderHiddenInput = exports.SliderControl = void 0;
7
+ var _anatomy = require("@ark-ui/anatomy");
8
+ var _react = require("@ark-ui/react");
9
+ var _css = require("@ndla/styled-system/css");
10
+ var _createStyleContext = require("./createStyleContext");
11
+ var _Label = require("./Label");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ /**
14
+ * Copyright (c) 2024-present, NDLA.
15
+ *
16
+ * This source code is licensed under the GPLv3 license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ *
19
+ */
20
+
21
+ const sliderRecipe = (0, _css.sva)({
22
+ slots: _anatomy.sliderAnatomy.keys(),
23
+ base: {
24
+ root: {
25
+ display: "flex",
26
+ flexDirection: "column",
27
+ gap: "4xsmall",
28
+ width: "100%"
29
+ },
30
+ control: {
31
+ position: "relative",
32
+ display: "flex",
33
+ _vertical: {
34
+ flexDirection: "column"
35
+ },
36
+ alignItems: "center",
37
+ height: "medium"
38
+ },
39
+ track: {
40
+ background: "surface.disabled",
41
+ overflow: "hidden",
42
+ flex: "1",
43
+ _vertical: {
44
+ width: "4xsmall"
45
+ },
46
+ _horizontal: {
47
+ height: "4xsmall"
48
+ }
49
+ },
50
+ range: {
51
+ background: "surface.action",
52
+ _vertical: {
53
+ width: "4xsmall"
54
+ },
55
+ _horizontal: {
56
+ height: "4xsmall"
57
+ }
58
+ },
59
+ thumb: {
60
+ background: "surface.action",
61
+ borderRadius: "full",
62
+ outline: "none",
63
+ zIndex: "1",
64
+ height: "medium",
65
+ width: "medium",
66
+ transitionDuration: "fast",
67
+ transitionTimingFunction: "default",
68
+ transitionProperty: "background",
69
+ _hover: {
70
+ background: "surface.action.hover"
71
+ },
72
+ _active: {
73
+ background: "surface.action.active"
74
+ },
75
+ _focusVisible: {
76
+ border: "2px solid",
77
+ borderColor: "background.default",
78
+ outline: "3px solid",
79
+ outlineColor: "surface.action",
80
+ outlineOffset: "0px"
81
+ }
82
+ }
83
+ }
84
+ });
85
+ const {
86
+ withProvider,
87
+ withContext
88
+ } = (0, _createStyleContext.createStyleContext)(sliderRecipe);
89
+ const SliderRoot = exports.SliderRoot = withProvider(_react.Slider.Root, "root");
90
+ const SliderControl = exports.SliderControl = withContext(_react.Slider.Control, "control");
91
+ const SliderTrack = exports.SliderTrack = withContext(_react.Slider.Track, "track");
92
+ const SliderRange = exports.SliderRange = withContext(_react.Slider.Range, "range");
93
+ const SliderThumb = exports.SliderThumb = withContext(_react.Slider.Thumb, "thumb");
94
+ const InternalSliderLabel = withContext(_react.Slider.Label, "label");
95
+ const SliderLabel = _ref => {
96
+ let {
97
+ textStyle = "label.medium",
98
+ ...props
99
+ } = _ref;
100
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalSliderLabel, {
101
+ asChild: true,
102
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Label.Label, {
103
+ textStyle: textStyle,
104
+ ...props
105
+ })
106
+ });
107
+ };
108
+ exports.SliderLabel = SliderLabel;
109
+ const SliderHiddenInput = exports.SliderHiddenInput = _react.Slider.HiddenInput;
@@ -0,0 +1,26 @@
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 { ComponentPropsWithoutRef } from "react";
9
+ import { RecipeVariantProps } from "@ndla/styled-system/css";
10
+ export declare const spinnerRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
11
+ size: {
12
+ medium: {
13
+ borderWidth: "4px";
14
+ height: "large";
15
+ width: "large";
16
+ };
17
+ large: {
18
+ borderWidth: "8px";
19
+ height: "xxlarge";
20
+ width: "xxlarge";
21
+ };
22
+ };
23
+ }>;
24
+ export type SpinnerVariantProps = RecipeVariantProps<typeof spinnerRecipe>;
25
+ export type SpinnerProps = ComponentPropsWithoutRef<"div"> & SpinnerVariantProps;
26
+ export declare const Spinner: ({ size, className, ...props }: SpinnerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
package/lib/Spinner.js ADDED
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.spinnerRecipe = exports.Spinner = void 0;
7
+ var _css = require("@ndla/styled-system/css");
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 spinnerRecipe = exports.spinnerRecipe = (0, _css.cva)({
19
+ base: {
20
+ borderRadius: "full",
21
+ animation: "spin",
22
+ display: "block",
23
+ borderStyle: "solid",
24
+ borderBlockColor: "background.subtle",
25
+ borderInlineStartColor: "background.subtle",
26
+ borderInlineEndColor: "stroke.default",
27
+ marginBlock: "medium",
28
+ marginInline: "auto"
29
+ },
30
+ defaultVariants: {
31
+ size: "large"
32
+ },
33
+ variants: {
34
+ size: {
35
+ medium: {
36
+ borderWidth: "4px",
37
+ height: "large",
38
+ width: "large"
39
+ },
40
+ large: {
41
+ borderWidth: "8px",
42
+ height: "xxlarge",
43
+ width: "xxlarge"
44
+ }
45
+ }
46
+ }
47
+ });
48
+ const Spinner = _ref => {
49
+ let {
50
+ size,
51
+ className,
52
+ ...props
53
+ } = _ref;
54
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsx2.styled.div, {
55
+ className: (0, _css.cx)(spinnerRecipe({
56
+ size
57
+ }), className),
58
+ ...props
59
+ });
60
+ };
61
+ exports.Spinner = Spinner;
@@ -0,0 +1,21 @@
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 { Switch } from "@ark-ui/react";
9
+ import { RecipeVariantProps } from "@ndla/styled-system/css";
10
+ import { TextProps } from "./Text";
11
+ declare const switchRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"label" | "root" | "control" | "thumb", import("@ndla/styled-system/types").SlotRecipeVariantRecord<"label" | "root" | "control" | "thumb">>;
12
+ export type SwitchVariantProps = RecipeVariantProps<typeof switchRecipe>;
13
+ export type SwitchRootProps = Switch.RootProps & SwitchVariantProps;
14
+ export declare const InternalSwitchRoot: import("react").ForwardRefExoticComponent<Switch.RootProps & {} & import("react").RefAttributes<HTMLLabelElement>>;
15
+ export declare const SwitchRoot: import("react").ForwardRefExoticComponent<Switch.RootProps & {} & import("react").RefAttributes<HTMLLabelElement>>;
16
+ export declare const SwitchControl: import("react").ForwardRefExoticComponent<Switch.ControlProps & import("react").RefAttributes<HTMLSpanElement>>;
17
+ export declare const SwitchThumb: import("react").ForwardRefExoticComponent<Switch.ThumbProps & import("react").RefAttributes<HTMLSpanElement>>;
18
+ export declare const InternalSwitchLabel: import("react").ForwardRefExoticComponent<Switch.LabelProps & import("react").RefAttributes<HTMLSpanElement>>;
19
+ export declare const SwitchLabel: ({ textStyle, ...props }: Switch.LabelProps & TextProps) => import("@emotion/react/jsx-runtime").JSX.Element;
20
+ export declare const SwitchHiddenInput: import("react").ForwardRefExoticComponent<Switch.HiddenInputProps & import("react").RefAttributes<HTMLInputElement>>;
21
+ export {};