@rikstv/shared-components 0.8.1 → 1.1.79
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/README.md +21 -2
- package/dist/{accordion → components/accordion}/Accordion.d.ts +1 -2
- package/dist/components/accordion/Accordion.js +34 -0
- package/dist/{accordion → components/accordion}/accordion.scss +58 -39
- package/dist/components/breadcrumb/Breadcrumb.d.ts +13 -0
- package/dist/components/breadcrumb/Breadcrumb.js +39 -0
- package/dist/components/breadcrumb/breadcrumb.scss +75 -0
- package/dist/components/button/ArrowButton.d.ts +12 -0
- package/dist/components/button/ArrowButton.js +44 -0
- package/dist/components/button/BaseButton.d.ts +18 -0
- package/dist/components/button/BaseButton.js +42 -0
- package/dist/components/button/BaseDecoratedButton.d.ts +11 -0
- package/dist/components/button/BaseDecoratedButton.js +32 -0
- package/dist/components/button/BaseLinkButton.d.ts +20 -0
- package/dist/components/button/BaseLinkButton.js +44 -0
- package/dist/{button → components/button}/Button.d.ts +2 -0
- package/dist/components/button/Button.js +29 -0
- package/dist/components/button/DecoratedButton.d.ts +7 -0
- package/dist/components/button/DecoratedButton.js +23 -0
- package/dist/{button → components/button}/IconButton.d.ts +2 -3
- package/dist/components/button/IconButton.js +24 -0
- package/dist/components/button/LinkButton.d.ts +5 -0
- package/dist/components/button/LinkButton.js +10 -0
- package/dist/components/button/arrow-button.scss +37 -0
- package/dist/{button → components/button}/button-shared.scss +14 -3
- package/dist/components/button/button.scss +93 -0
- package/dist/{button → components/button}/icon-button.scss +0 -0
- package/dist/components/button/link-button.scss +6 -0
- package/dist/components/checkbox/Checkbox.d.ts +9 -0
- package/dist/components/checkbox/Checkbox.js +40 -0
- package/dist/components/checkbox/checkbox.scss +116 -0
- package/dist/{core → components/core}/Core.d.ts +0 -0
- package/dist/{core → components/core}/Core.js +0 -0
- package/dist/{core → components/core}/LightMode.d.ts +0 -0
- package/dist/components/core/LightMode.js +14 -0
- package/dist/{core → components/core}/RiksTV.d.ts +0 -0
- package/dist/components/core/RiksTV.js +116 -0
- package/dist/{core → components/core}/Strim.d.ts +0 -0
- package/dist/components/core/Strim.js +10 -0
- package/dist/components/core/core.scss +102 -0
- package/dist/components/core/docs/Spacing.scss +12 -0
- package/dist/components/core/docs/componets/ColorSwatch/ColorSwatch.scss +66 -0
- package/dist/components/core/docs/componets/ColorSwatch/ColorSwatchBtn.scss +19 -0
- package/dist/components/core/docs/componets/ExampleGrid/ExampleGrid.scss +12 -0
- package/dist/components/core/docs/componets/SpacingBlock/SpacingBlock.scss +6 -0
- package/dist/components/core/docs/hooks/animated.scss +12 -0
- package/dist/components/core/docs/hooks/clickOutside.scss +11 -0
- package/dist/components/core/docs/hooks/intersection.scss +14 -0
- package/dist/components/core/hooks/useAnimatedHeight.d.ts +19 -0
- package/dist/components/core/hooks/useBrowserPreferences.d.ts +5 -0
- package/dist/components/core/hooks/useClickOutsideListener.d.ts +8 -0
- package/dist/components/core/hooks/useIntersectionObserver.d.ts +2 -0
- package/dist/components/core/hooks/useMutationObserver.d.ts +2 -0
- package/dist/components/core/mixin/breakpoints.scss +44 -0
- package/dist/{core → components/core}/mixin/fluid.scss +0 -0
- package/dist/{core → components/core}/mixin/focus.scss +0 -0
- package/dist/{core → components/core}/mixin/navigation.scss +0 -0
- package/dist/{core → components/core}/mixin/rem.scss +0 -0
- package/dist/components/core/rikstvColors.scss +71 -0
- package/dist/components/core/rtv.scss +75 -0
- package/dist/components/core/spacing/Gutter.d.ts +2 -0
- package/dist/components/core/spacing/GutterPadding.d.ts +2 -0
- package/dist/components/core/strimColors.scss +48 -0
- package/dist/components/core/strm.scss +79 -0
- package/dist/{core → components/core}/utils/detectUserInputMethod.d.ts +0 -0
- package/dist/components/icons/Arrow.d.ts +2 -0
- package/dist/components/icons/Arrow.js +12 -0
- package/dist/{icons → components/icons}/Chevron.d.ts +0 -0
- package/dist/{icons → components/icons}/Chevron.js +0 -0
- package/dist/{icons → components/icons}/heartToggle.scss +12 -6
- package/dist/components/index.d.ts +31 -0
- package/dist/components/list/CheckmarkListItem.d.ts +8 -0
- package/dist/components/list/CheckmarkListItem.js +32 -0
- package/dist/components/list/CheckmarkListItem.scss +41 -0
- package/dist/components/list/CrossmarkListItem.d.ts +8 -0
- package/dist/components/list/CrossmarkListItem.js +23 -0
- package/dist/components/list/CrossmarkListItem.scss +42 -0
- package/dist/components/list/List.d.ts +8 -0
- package/dist/components/list/List.js +28 -0
- package/dist/components/list/List.scss +15 -0
- package/dist/components/list/ListItem.d.ts +8 -0
- package/dist/components/list/ListItem.js +19 -0
- package/dist/components/list/ListItem.scss +25 -0
- package/dist/components/list/OrderedListItem.d.ts +7 -0
- package/dist/components/list/OrderedListItem.js +15 -0
- package/dist/components/list/OrderedListItem.scss +21 -0
- package/dist/components/list/internal/getMarkColor.d.ts +3 -0
- package/dist/components/loader/Loader.d.ts +7 -0
- package/dist/components/loader/Loader.js +31 -0
- package/dist/components/loader/Loader.scss +148 -0
- package/dist/components/loader/RawLoader.d.ts +10 -0
- package/dist/components/loader/RawLoader.js +30 -0
- package/dist/components/panel/Info.d.ts +2 -0
- package/dist/components/panel/Info.js +25 -0
- package/dist/components/panel/Panel.d.ts +15 -0
- package/dist/components/panel/Panel.js +55 -0
- package/dist/components/panel/Success.d.ts +2 -0
- package/dist/components/panel/Success.js +80 -0
- package/dist/components/panel/Warning.d.ts +2 -0
- package/dist/components/panel/Warning.js +14 -0
- package/dist/components/panel/panel.scss +95 -0
- package/dist/components/progress/CircularProgress.d.ts +11 -0
- package/dist/components/progress/CircularProgress.js +87 -0
- package/dist/components/progress/Progress.d.ts +11 -0
- package/dist/components/progress/Progress.js +42 -0
- package/dist/components/progress/Progress.scss +76 -0
- package/dist/components/progress/circularProgress.scss +70 -0
- package/dist/components/spacing/Gutter.js +13 -0
- package/dist/components/spacing/GutterPadding.js +13 -0
- package/dist/{textfield → components/textfield}/TextField.d.ts +6 -5
- package/dist/components/textfield/TextField.js +57 -0
- package/dist/components/textfield/textfield.scss +178 -0
- package/dist/{toggle → components/toggle}/FieldSet.d.ts +0 -0
- package/dist/components/toggle/FieldSet.js +29 -0
- package/dist/{toggle → components/toggle}/RadioContext.d.ts +0 -0
- package/dist/{toggle → components/toggle}/RadioToggle.d.ts +0 -0
- package/dist/components/toggle/RadioToggle.js +30 -0
- package/dist/{toggle → components/toggle}/radioToggle.scss +2 -1
- package/dist/{toggleButton → components/toggleButton}/ToggleButton.d.ts +1 -0
- package/dist/components/toggleButton/ToggleButton.js +70 -0
- package/dist/{toggleButton → components/toggleButton}/toggleButton.scss +16 -8
- package/dist/components/toggleLinkButton/ToggleLinkButton.d.ts +10 -0
- package/dist/components/toggleLinkButton/ToggleLinkButton.js +60 -0
- package/dist/components/toggleLinkButton/toggleLinkButton.scss +54 -0
- package/dist/{typography → components/typography}/Typography.d.ts +3 -1
- package/dist/components/typography/Typography.js +67 -0
- package/dist/{typography → components/typography}/typography.scss +30 -1
- package/dist/shared-components.es.js +210 -15
- package/dist/style.css +1 -1
- package/dist/{core/utils → utils}/generateId.d.ts +0 -0
- package/package.json +12 -17
- package/dist/accordion/Accordion.js +0 -73
- package/dist/button/BaseButton.d.ts +0 -15
- package/dist/button/BaseButton.js +0 -80
- package/dist/button/Button.js +0 -40
- package/dist/button/IconButton.js +0 -40
- package/dist/button/button.scss +0 -46
- package/dist/core/LightMode.js +0 -50
- package/dist/core/RiksTV.js +0 -115
- package/dist/core/Strim.js +0 -10
- package/dist/core/core.scss +0 -29
- package/dist/core/rtv.scss +0 -58
- package/dist/core/strm.scss +0 -62
- package/dist/index.d.ts +0 -11
- package/dist/textfield/TextField.js +0 -87
- package/dist/textfield/textfield.scss +0 -101
- package/dist/toggle/FieldSet.js +0 -66
- package/dist/toggle/RadioToggle.js +0 -65
- package/dist/toggleButton/ToggleButton.js +0 -106
- package/dist/toggleButton/internal/generateId.d.ts +0 -1
- package/dist/typography/Typography.js +0 -95
package/dist/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { RiksTVProvider } from "./core/RiksTV";
|
|
2
|
-
export { StrimProvider } from "./core/Strim";
|
|
3
|
-
export { LightMode } from "./core/LightMode";
|
|
4
|
-
export { Accordion } from "./accordion/Accordion";
|
|
5
|
-
export { PrimaryButton, SecondaryButton, TertiaryButton } from "./button/Button";
|
|
6
|
-
export { PrimaryIconButton, SecondaryIconButton, TertiaryIconButton } from "./button/IconButton";
|
|
7
|
-
export { ToggleButton } from "./toggleButton/ToggleButton";
|
|
8
|
-
export { RadioToggleInput } from "./toggle/RadioToggle";
|
|
9
|
-
export { FieldSet } from "./toggle/FieldSet";
|
|
10
|
-
export { TextField } from "./textfield/TextField";
|
|
11
|
-
export { DisplayTitle, H1, H2, H3, H4, Body, Bold, SubBody, Tag, Meta } from "./typography/Typography";
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
var __objRest = (source, exclude) => {
|
|
18
|
-
var target = {};
|
|
19
|
-
for (var prop in source)
|
|
20
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
-
target[prop] = source[prop];
|
|
22
|
-
if (source != null && __getOwnPropSymbols)
|
|
23
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
};
|
|
29
|
-
import { forwardRef } from "react";
|
|
30
|
-
import { S as SubBody } from "../typography/Typography.js";
|
|
31
|
-
import { a as jsxs, j as jsx } from "../core/RiksTV.js";
|
|
32
|
-
const generateId = (id) => {
|
|
33
|
-
if (id) {
|
|
34
|
-
return id;
|
|
35
|
-
}
|
|
36
|
-
return `${new Date().valueOf()}`;
|
|
37
|
-
};
|
|
38
|
-
var textfield = "";
|
|
39
|
-
const TextField = forwardRef((_a, ref) => {
|
|
40
|
-
var _b = _a, {
|
|
41
|
-
className = "",
|
|
42
|
-
id,
|
|
43
|
-
labelClass = "",
|
|
44
|
-
type = "text",
|
|
45
|
-
fullWidth = false,
|
|
46
|
-
lightBackground = false,
|
|
47
|
-
label,
|
|
48
|
-
error
|
|
49
|
-
} = _b, props = __objRest(_b, [
|
|
50
|
-
"className",
|
|
51
|
-
"id",
|
|
52
|
-
"labelClass",
|
|
53
|
-
"type",
|
|
54
|
-
"fullWidth",
|
|
55
|
-
"lightBackground",
|
|
56
|
-
"label",
|
|
57
|
-
"error"
|
|
58
|
-
]);
|
|
59
|
-
const errorTextId = generateId();
|
|
60
|
-
const generatedId = generateId(id);
|
|
61
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
62
|
-
className: `rds-form-group ${className}`,
|
|
63
|
-
children: [/* @__PURE__ */ jsx("input", __spreadValues({
|
|
64
|
-
ref,
|
|
65
|
-
id: generatedId,
|
|
66
|
-
className: `
|
|
67
|
-
rds-textfield
|
|
68
|
-
rds-textfield--input ${error ? "rds-textfield--input--error" : ""} ${fullWidth ? "rds-textfield--input--full-width" : ""} ${lightBackground ? "rds-light" : ""}
|
|
69
|
-
`,
|
|
70
|
-
type,
|
|
71
|
-
placeholder: label,
|
|
72
|
-
"aria-describedby": error ? errorTextId : void 0
|
|
73
|
-
}, props)), error && /* @__PURE__ */ jsx(SubBody, {
|
|
74
|
-
id: errorTextId,
|
|
75
|
-
className: "rds-textfield--error-text",
|
|
76
|
-
children: error
|
|
77
|
-
}), /* @__PURE__ */ jsx("label", {
|
|
78
|
-
htmlFor: generatedId,
|
|
79
|
-
className: `rds-textfield rds-textfield--label ${labelClass} ${lightBackground ? "rds-light" : ""}`,
|
|
80
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
81
|
-
children: label
|
|
82
|
-
})
|
|
83
|
-
})]
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
TextField.displayName = "TextField";
|
|
87
|
-
export { TextField as T };
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
@use "../typography/typography.scss";
|
|
2
|
-
@use "../core/mixin/focus" as mix;
|
|
3
|
-
@use "../core/mixin/rem";
|
|
4
|
-
|
|
5
|
-
.rds-form-group {
|
|
6
|
-
--input-color: var(--rds-foreground-primary);
|
|
7
|
-
--input-label-color: var(--rds-foreground-secondary);
|
|
8
|
-
--input-border-color: var(--rds-foreground-primary);
|
|
9
|
-
--input-error-color: var(--rds-feedback-error);
|
|
10
|
-
--input-bg: var(--rds-background-primary);
|
|
11
|
-
|
|
12
|
-
.rds-textfield {
|
|
13
|
-
&--input {
|
|
14
|
-
border: 1px solid var(--input-border-color);
|
|
15
|
-
background-color: var(--input-border-bg);
|
|
16
|
-
color: var(--input-color);
|
|
17
|
-
border-radius: 2px;
|
|
18
|
-
|
|
19
|
-
height: 3rem;
|
|
20
|
-
width: 100%;
|
|
21
|
-
max-width: 500px;
|
|
22
|
-
padding: 0 var(--rds-spacing--8);
|
|
23
|
-
|
|
24
|
-
&--full-width {
|
|
25
|
-
max-width: unset;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&::placeholder {
|
|
29
|
-
opacity: 0;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&::-webkit-search-cancel-button {
|
|
33
|
-
-webkit-appearance: none;
|
|
34
|
-
display: none;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&:-webkit-autofill {
|
|
38
|
-
box-shadow: 0 0 0 30px var(--rds-background-primary) inset;
|
|
39
|
-
-webkit-box-shadow: 0 0 0 30px var(--rds-background-primary) inset;
|
|
40
|
-
-webkit-text-fill-color: var(--rds-foreground-primary);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&--label {
|
|
45
|
-
cursor: text;
|
|
46
|
-
background-color: var(--input-bg);
|
|
47
|
-
position: absolute;
|
|
48
|
-
padding: 0 8px;
|
|
49
|
-
top: 50%;
|
|
50
|
-
left: var(--rds-spacing--4);
|
|
51
|
-
transform: translateY(-50%);
|
|
52
|
-
transition: 0.2s ease-in-out;
|
|
53
|
-
transition-property: top, font-size;
|
|
54
|
-
|
|
55
|
-
span {
|
|
56
|
-
@extend .rds-bold;
|
|
57
|
-
font-size: rem.convert(18px);
|
|
58
|
-
color: var(--input-label-color);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
&--error-text {
|
|
63
|
-
color: var(--input-error-color);
|
|
64
|
-
margin-top: 0.5rem;
|
|
65
|
-
margin-bottom: 0.5rem;
|
|
66
|
-
position: absolute;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
@include mix.with-keyboard-focus;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.rds-form-group {
|
|
74
|
-
position: relative;
|
|
75
|
-
|
|
76
|
-
&:focus-within {
|
|
77
|
-
.rds-textfield--label {
|
|
78
|
-
top: 0;
|
|
79
|
-
font-size: 1rem;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
input:not(:placeholder-shown) + label {
|
|
84
|
-
top: 0;
|
|
85
|
-
font-size: 1rem;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.rds-light {
|
|
90
|
-
.rds-textfield,
|
|
91
|
-
&.rds-textfield {
|
|
92
|
-
--input-color: var(--rds-button-primary-fg);
|
|
93
|
-
--input-border-color: var(--rds-button-primary-fg);
|
|
94
|
-
--input-bg: var(--surface-background);
|
|
95
|
-
&--label {
|
|
96
|
-
span {
|
|
97
|
-
--input-label-color: var(--rds-background-primary);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
package/dist/toggle/FieldSet.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
import { forwardRef } from "react";
|
|
33
|
-
import { R as RadioContext } from "./RadioToggle.js";
|
|
34
|
-
import { j as jsx, a as jsxs } from "../core/RiksTV.js";
|
|
35
|
-
const FieldSet = forwardRef((_a, ref) => {
|
|
36
|
-
var _b = _a, {
|
|
37
|
-
legend,
|
|
38
|
-
children,
|
|
39
|
-
name,
|
|
40
|
-
className = "",
|
|
41
|
-
showLegend = false
|
|
42
|
-
} = _b, rest = __objRest(_b, [
|
|
43
|
-
"legend",
|
|
44
|
-
"children",
|
|
45
|
-
"name",
|
|
46
|
-
"className",
|
|
47
|
-
"showLegend"
|
|
48
|
-
]);
|
|
49
|
-
return /* @__PURE__ */ jsx(RadioContext.Provider, {
|
|
50
|
-
value: {
|
|
51
|
-
radioName: name
|
|
52
|
-
},
|
|
53
|
-
children: /* @__PURE__ */ jsxs("fieldset", __spreadProps(__spreadValues({
|
|
54
|
-
"data-testid": "fieldset"
|
|
55
|
-
}, rest), {
|
|
56
|
-
className: `rds-field-set ${className}`,
|
|
57
|
-
ref,
|
|
58
|
-
children: [/* @__PURE__ */ jsx("legend", {
|
|
59
|
-
className: `rds-field-set__legend ${showLegend ? "" : "sr-only"}`,
|
|
60
|
-
children: legend
|
|
61
|
-
}), children]
|
|
62
|
-
}))
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
FieldSet.displayName = "FieldSet";
|
|
66
|
-
export { FieldSet as F };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
import { createContext, forwardRef, useContext } from "react";
|
|
33
|
-
import "../button/Button.js";
|
|
34
|
-
import { a as jsxs, j as jsx } from "../core/RiksTV.js";
|
|
35
|
-
const RadioContext = createContext({ radioName: "" });
|
|
36
|
-
var radioToggle = "";
|
|
37
|
-
const RadioToggleInput = forwardRef((_a, ref) => {
|
|
38
|
-
var _b = _a, {
|
|
39
|
-
label,
|
|
40
|
-
name,
|
|
41
|
-
className = ""
|
|
42
|
-
} = _b, rest = __objRest(_b, [
|
|
43
|
-
"label",
|
|
44
|
-
"name",
|
|
45
|
-
"className"
|
|
46
|
-
]);
|
|
47
|
-
const {
|
|
48
|
-
radioName
|
|
49
|
-
} = useContext(RadioContext);
|
|
50
|
-
return /* @__PURE__ */ jsxs("label", {
|
|
51
|
-
className: `rds-radio-toggle ${className}`,
|
|
52
|
-
children: [/* @__PURE__ */ jsx("input", __spreadProps(__spreadValues({
|
|
53
|
-
className: "rds-radio-toggle__input"
|
|
54
|
-
}, rest), {
|
|
55
|
-
ref,
|
|
56
|
-
type: "radio",
|
|
57
|
-
name: radioName || name
|
|
58
|
-
})), /* @__PURE__ */ jsx("span", {
|
|
59
|
-
className: "rds-radio-toggle__label",
|
|
60
|
-
children: label
|
|
61
|
-
})]
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
RadioToggleInput.displayName = "RadioToggleInput";
|
|
65
|
-
export { RadioContext as R, RadioToggleInput as a };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
var __objRest = (source, exclude) => {
|
|
18
|
-
var target = {};
|
|
19
|
-
for (var prop in source)
|
|
20
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
-
target[prop] = source[prop];
|
|
22
|
-
if (source != null && __getOwnPropSymbols)
|
|
23
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
};
|
|
29
|
-
import { forwardRef, useRef, useState } from "react";
|
|
30
|
-
import { a as jsxs, j as jsx } from "../core/RiksTV.js";
|
|
31
|
-
const generateId = (id) => {
|
|
32
|
-
if (id) {
|
|
33
|
-
return id;
|
|
34
|
-
}
|
|
35
|
-
return `${new Date().valueOf()}`;
|
|
36
|
-
};
|
|
37
|
-
var toggleButton = "";
|
|
38
|
-
const ToggleButton = forwardRef((_a, ref) => {
|
|
39
|
-
var _b = _a, {
|
|
40
|
-
defaultChecked,
|
|
41
|
-
showLabel = true,
|
|
42
|
-
icons,
|
|
43
|
-
iconClass = "",
|
|
44
|
-
children,
|
|
45
|
-
onChange,
|
|
46
|
-
id,
|
|
47
|
-
className = ""
|
|
48
|
-
} = _b, rest = __objRest(_b, [
|
|
49
|
-
"defaultChecked",
|
|
50
|
-
"showLabel",
|
|
51
|
-
"icons",
|
|
52
|
-
"iconClass",
|
|
53
|
-
"children",
|
|
54
|
-
"onChange",
|
|
55
|
-
"id",
|
|
56
|
-
"className"
|
|
57
|
-
]);
|
|
58
|
-
const internalRef = useRef(null);
|
|
59
|
-
const [internalId] = useState(generateId(id));
|
|
60
|
-
const [isChecked, setIsChecked] = useState(!!defaultChecked);
|
|
61
|
-
const CheckedIcon = icons && "checkedIcon" in icons ? icons.checkedIcon : null;
|
|
62
|
-
const UncheckedIcon = icons && "uncheckedIcon" in icons ? icons.uncheckedIcon : null;
|
|
63
|
-
const ToggleIcon = icons && "toggleIcon" in icons ? icons.toggleIcon : null;
|
|
64
|
-
const inputRef = ref || internalRef;
|
|
65
|
-
const handleChange = (e) => {
|
|
66
|
-
var _a2;
|
|
67
|
-
if (typeof onChange === "function") {
|
|
68
|
-
onChange(e);
|
|
69
|
-
}
|
|
70
|
-
if (typeof inputRef !== "function") {
|
|
71
|
-
setIsChecked(!!((_a2 = inputRef.current) == null ? void 0 : _a2.checked));
|
|
72
|
-
} else {
|
|
73
|
-
setIsChecked(!isChecked);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
77
|
-
className,
|
|
78
|
-
children: [/* @__PURE__ */ jsx("input", __spreadValues({
|
|
79
|
-
id: internalId,
|
|
80
|
-
ref: inputRef,
|
|
81
|
-
type: "checkbox",
|
|
82
|
-
className: "rds-toggle-button__input",
|
|
83
|
-
onChange: handleChange,
|
|
84
|
-
defaultChecked
|
|
85
|
-
}, rest)), /* @__PURE__ */ jsx("label", {
|
|
86
|
-
"data-testid": "toggle-button__label",
|
|
87
|
-
className: `rds-toggle-button ${showLabel ? "" : "rds-toggle-button--round"}`,
|
|
88
|
-
htmlFor: internalId,
|
|
89
|
-
children: /* @__PURE__ */ jsxs("span", {
|
|
90
|
-
className: "rds-toggle-button__content",
|
|
91
|
-
children: [icons && /* @__PURE__ */ jsxs("span", {
|
|
92
|
-
className: `rds-toggle-button__rounded ${iconClass}`,
|
|
93
|
-
children: [ToggleIcon && /* @__PURE__ */ jsx(ToggleIcon, {
|
|
94
|
-
checked: isChecked
|
|
95
|
-
}), CheckedIcon && isChecked && /* @__PURE__ */ jsx(CheckedIcon, {}), UncheckedIcon && !isChecked && /* @__PURE__ */ jsx(UncheckedIcon, {})]
|
|
96
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
97
|
-
"data-testid": "toggle-button__label__text",
|
|
98
|
-
className: showLabel ? "" : "sr-only",
|
|
99
|
-
children
|
|
100
|
-
})]
|
|
101
|
-
})
|
|
102
|
-
})]
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
ToggleButton.displayName = "ToggleButton";
|
|
106
|
-
export { ToggleButton as T };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const generateId: (id: string | undefined) => string;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
import { forwardRef } from "react";
|
|
33
|
-
import { j as jsx } from "../core/RiksTV.js";
|
|
34
|
-
var typography = "";
|
|
35
|
-
const typographyFactory = (factoryProps) => forwardRef((_a, ref) => {
|
|
36
|
-
var _b = _a, {
|
|
37
|
-
children,
|
|
38
|
-
lookLike = factoryProps.lookLike,
|
|
39
|
-
className = "",
|
|
40
|
-
lightBackground = false
|
|
41
|
-
} = _b, props = __objRest(_b, [
|
|
42
|
-
"children",
|
|
43
|
-
"lookLike",
|
|
44
|
-
"className",
|
|
45
|
-
"lightBackground"
|
|
46
|
-
]);
|
|
47
|
-
const C = factoryProps.semanticElement;
|
|
48
|
-
return /* @__PURE__ */ jsx(C, __spreadProps(__spreadValues({
|
|
49
|
-
className: `rds-${lookLike} ${lightBackground ? `rds-${lookLike}--light` : ""} ${className}`
|
|
50
|
-
}, props), {
|
|
51
|
-
ref,
|
|
52
|
-
children
|
|
53
|
-
}));
|
|
54
|
-
});
|
|
55
|
-
const DisplayTitle = typographyFactory({
|
|
56
|
-
semanticElement: "h1",
|
|
57
|
-
lookLike: "display-title"
|
|
58
|
-
});
|
|
59
|
-
const H1 = typographyFactory({
|
|
60
|
-
semanticElement: "h1",
|
|
61
|
-
lookLike: "title-1"
|
|
62
|
-
});
|
|
63
|
-
const H2 = typographyFactory({
|
|
64
|
-
semanticElement: "h2",
|
|
65
|
-
lookLike: "title-2"
|
|
66
|
-
});
|
|
67
|
-
const H3 = typographyFactory({
|
|
68
|
-
semanticElement: "h3",
|
|
69
|
-
lookLike: "title-3"
|
|
70
|
-
});
|
|
71
|
-
const H4 = typographyFactory({
|
|
72
|
-
semanticElement: "h4",
|
|
73
|
-
lookLike: "title-4"
|
|
74
|
-
});
|
|
75
|
-
const Body = typographyFactory({
|
|
76
|
-
semanticElement: "p",
|
|
77
|
-
lookLike: "body"
|
|
78
|
-
});
|
|
79
|
-
const SubBody = typographyFactory({
|
|
80
|
-
semanticElement: "p",
|
|
81
|
-
lookLike: "sub-body"
|
|
82
|
-
});
|
|
83
|
-
const Tag = typographyFactory({
|
|
84
|
-
semanticElement: "span",
|
|
85
|
-
lookLike: "tag"
|
|
86
|
-
});
|
|
87
|
-
const Bold = typographyFactory({
|
|
88
|
-
semanticElement: "strong",
|
|
89
|
-
lookLike: "bold"
|
|
90
|
-
});
|
|
91
|
-
const Meta = typographyFactory({
|
|
92
|
-
semanticElement: "span",
|
|
93
|
-
lookLike: "meta"
|
|
94
|
-
});
|
|
95
|
-
export { Body as B, DisplayTitle as D, H1 as H, Meta as M, SubBody as S, Tag as T, H2 as a, H3 as b, H4 as c, Bold as d };
|