@ndla/primitives 1.0.62-alpha.0 → 1.0.64-alpha.0
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/es/Button.js +17 -6
- package/es/RadioGroup.js +4 -3
- package/es/Table.js +7 -2
- package/lib/Button.js +16 -5
- package/lib/Layout/PageContent.d.ts +1 -3
- package/lib/RadioGroup.js +4 -3
- package/lib/Skeleton.d.ts +1 -3
- package/lib/Table.d.ts +1 -3
- package/lib/Table.js +7 -2
- package/package.json +3 -3
package/es/Button.js
CHANGED
|
@@ -11,7 +11,7 @@ import { ark } from "@ark-ui/react";
|
|
|
11
11
|
import { css, cva } from "@ndla/styled-system/css";
|
|
12
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
13
13
|
import { Spinner } from "./Spinner";
|
|
14
|
-
import {
|
|
14
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
export const buttonBaseRecipe = cva({
|
|
16
16
|
base: {
|
|
17
17
|
display: "inline-flex",
|
|
@@ -260,15 +260,26 @@ export const BaseButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
260
260
|
const ariaDisabled = loading ? {
|
|
261
261
|
"aria-disabled": true
|
|
262
262
|
} : {};
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
263
|
+
|
|
264
|
+
// The conditions within this component are a bit complex, but unfortunately necessary.
|
|
265
|
+
// Google Translate and React do not play well together. If we use a fragment for the loading content, React will crash.
|
|
266
|
+
// This is supposed to be the inline equivalent of:
|
|
267
|
+
//
|
|
268
|
+
// const loadingContent = replaceContent ? (
|
|
269
|
+
// loadingContentProp
|
|
270
|
+
// ) : (
|
|
271
|
+
// <>
|
|
272
|
+
// {loadingContentProp}
|
|
273
|
+
// {children}
|
|
274
|
+
// </>
|
|
275
|
+
// );
|
|
276
|
+
|
|
277
|
+
return /*#__PURE__*/_jsxs(StyledButton, {
|
|
267
278
|
onClick: loading ? undefined : onClick,
|
|
268
279
|
...ariaDisabled,
|
|
269
280
|
...props,
|
|
270
281
|
ref: ref,
|
|
271
|
-
children: loading
|
|
282
|
+
children: [!!loading && loadingContentProp, (!loading || !!loading && !replaceContent) && children]
|
|
272
283
|
});
|
|
273
284
|
});
|
|
274
285
|
export const Button = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
package/es/RadioGroup.js
CHANGED
|
@@ -10,7 +10,6 @@ import { forwardRef } from "react";
|
|
|
10
10
|
import { RadioGroup, radioGroupAnatomy } from "@ark-ui/react";
|
|
11
11
|
import { sva } from "@ndla/styled-system/css";
|
|
12
12
|
import { createStyleContext } from "./createStyleContext";
|
|
13
|
-
import { Label } from "./Label";
|
|
14
13
|
import { Text } from "./Text";
|
|
15
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
15
|
const radioGroupRecipe = sva({
|
|
@@ -131,15 +130,17 @@ export const InternalRadioGroupLabel = withContext(RadioGroup.Label, "label");
|
|
|
131
130
|
export const RadioGroupLabel = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
132
131
|
let {
|
|
133
132
|
textStyle = "label.large",
|
|
133
|
+
fontWeight = "bold",
|
|
134
134
|
children,
|
|
135
135
|
...props
|
|
136
136
|
} = _ref2;
|
|
137
137
|
return /*#__PURE__*/_jsx(InternalRadioGroupLabel, {
|
|
138
|
-
ref: ref,
|
|
139
138
|
...props,
|
|
140
139
|
asChild: true,
|
|
141
|
-
|
|
140
|
+
ref: ref,
|
|
141
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
142
142
|
textStyle: textStyle,
|
|
143
|
+
fontWeight: fontWeight,
|
|
143
144
|
children: children
|
|
144
145
|
})
|
|
145
146
|
});
|
package/es/Table.js
CHANGED
|
@@ -70,6 +70,11 @@ export const Table = styled(ark.table, {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
},
|
|
74
|
-
|
|
73
|
+
},
|
|
74
|
+
// TODO: Chrome doesn't support automatically making overflowed elements tabbable yet. Revisit this in a year or two
|
|
75
|
+
{
|
|
76
|
+
baseComponent: true,
|
|
77
|
+
defaultProps: {
|
|
78
|
+
tabIndex: 0
|
|
79
|
+
}
|
|
75
80
|
});
|
package/lib/Button.js
CHANGED
|
@@ -266,15 +266,26 @@ const BaseButton = exports.BaseButton = /*#__PURE__*/(0, _react.forwardRef)((_re
|
|
|
266
266
|
const ariaDisabled = loading ? {
|
|
267
267
|
"aria-disabled": true
|
|
268
268
|
} : {};
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
|
|
270
|
+
// The conditions within this component are a bit complex, but unfortunately necessary.
|
|
271
|
+
// Google Translate and React do not play well together. If we use a fragment for the loading content, React will crash.
|
|
272
|
+
// This is supposed to be the inline equivalent of:
|
|
273
|
+
//
|
|
274
|
+
// const loadingContent = replaceContent ? (
|
|
275
|
+
// loadingContentProp
|
|
276
|
+
// ) : (
|
|
277
|
+
// <>
|
|
278
|
+
// {loadingContentProp}
|
|
279
|
+
// {children}
|
|
280
|
+
// </>
|
|
281
|
+
// );
|
|
282
|
+
|
|
283
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledButton, {
|
|
273
284
|
onClick: loading ? undefined : onClick,
|
|
274
285
|
...ariaDisabled,
|
|
275
286
|
...props,
|
|
276
287
|
ref: ref,
|
|
277
|
-
children: loading
|
|
288
|
+
children: [!!loading && loadingContentProp, (!loading || !!loading && !replaceContent) && children]
|
|
278
289
|
});
|
|
279
290
|
});
|
|
280
291
|
const Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
@@ -52,7 +52,5 @@ export declare const PageContent: import("react").ForwardRefExoticComponent<Omit
|
|
|
52
52
|
} & {
|
|
53
53
|
consumeCss?: boolean;
|
|
54
54
|
} & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
|
|
55
|
-
export declare const BleedPageContent: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<
|
|
56
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
57
|
-
} & import("@ark-ui/react").PolymorphicProps>, {}>;
|
|
55
|
+
export declare const BleedPageContent: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react").PolymorphicProps>, {}>;
|
|
58
56
|
export {};
|
package/lib/RadioGroup.js
CHANGED
|
@@ -8,7 +8,6 @@ var _react = require("react");
|
|
|
8
8
|
var _react2 = require("@ark-ui/react");
|
|
9
9
|
var _css = require("@ndla/styled-system/css");
|
|
10
10
|
var _createStyleContext = require("./createStyleContext");
|
|
11
|
-
var _Label = require("./Label");
|
|
12
11
|
var _Text = require("./Text");
|
|
13
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
13
|
/**
|
|
@@ -138,15 +137,17 @@ const InternalRadioGroupLabel = exports.InternalRadioGroupLabel = withContext(_r
|
|
|
138
137
|
const RadioGroupLabel = exports.RadioGroupLabel = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
139
138
|
let {
|
|
140
139
|
textStyle = "label.large",
|
|
140
|
+
fontWeight = "bold",
|
|
141
141
|
children,
|
|
142
142
|
...props
|
|
143
143
|
} = _ref2;
|
|
144
144
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalRadioGroupLabel, {
|
|
145
|
-
ref: ref,
|
|
146
145
|
...props,
|
|
147
146
|
asChild: true,
|
|
148
|
-
|
|
147
|
+
ref: ref,
|
|
148
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
|
|
149
149
|
textStyle: textStyle,
|
|
150
|
+
fontWeight: fontWeight,
|
|
150
151
|
children: children
|
|
151
152
|
})
|
|
152
153
|
});
|
package/lib/Skeleton.d.ts
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type HTMLArkProps } from "@ark-ui/react";
|
|
9
9
|
import type { JsxStyleProps } from "@ndla/styled-system/types";
|
|
10
|
-
export declare const Skeleton: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<
|
|
11
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
12
|
-
} & import("@ark-ui/react").PolymorphicProps>, {}>;
|
|
10
|
+
export declare const Skeleton: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react").PolymorphicProps>, {}>;
|
|
13
11
|
export interface SkeletonProps extends HTMLArkProps<"div">, JsxStyleProps {
|
|
14
12
|
}
|
package/lib/Table.d.ts
CHANGED
|
@@ -8,6 +8,4 @@
|
|
|
8
8
|
import { type HTMLArkProps } from "@ark-ui/react";
|
|
9
9
|
import type { JsxStyleProps } from "@ndla/styled-system/types";
|
|
10
10
|
export type TableProps = HTMLArkProps<"table"> & JsxStyleProps;
|
|
11
|
-
export declare const Table: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<
|
|
12
|
-
ref?: ((instance: HTMLTableElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLTableElement> | null | undefined;
|
|
13
|
-
} & import("@ark-ui/react").PolymorphicProps>, {}>;
|
|
11
|
+
export declare const Table: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLTableElement> & import("react").TableHTMLAttributes<HTMLTableElement> & import("@ark-ui/react").PolymorphicProps>, {}>;
|
package/lib/Table.js
CHANGED
|
@@ -76,6 +76,11 @@ const Table = exports.Table = (0, _jsx.styled)(_react.ark.table, {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
},
|
|
80
|
-
|
|
79
|
+
},
|
|
80
|
+
// TODO: Chrome doesn't support automatically making overflowed elements tabbable yet. Revisit this in a year or two
|
|
81
|
+
{
|
|
82
|
+
baseComponent: true,
|
|
83
|
+
defaultProps: {
|
|
84
|
+
tabIndex: 0
|
|
85
|
+
}
|
|
81
86
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/primitives",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.64-alpha.0",
|
|
4
4
|
"description": "Primitive components for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@ark-ui/react": "^4.1.2",
|
|
32
32
|
"@ndla/styled-system": "^0.0.29",
|
|
33
|
-
"@ndla/util": "^5.0.
|
|
33
|
+
"@ndla/util": "^5.0.5-alpha.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@ndla/preset-panda": "^0.0.48",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "a00bd799b55932a421bed0cf2ce8f364fbc7aefa"
|
|
47
47
|
}
|