@holmdigital/components 1.1.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/README.md +46 -0
- package/dist/Button/Button.js +117 -0
- package/dist/Button/Button.mjs +6 -0
- package/dist/Checkbox/Checkbox.js +82 -0
- package/dist/Checkbox/Checkbox.mjs +6 -0
- package/dist/Dialog/Dialog.js +129 -0
- package/dist/Dialog/Dialog.mjs +6 -0
- package/dist/FormField/FormField.js +110 -0
- package/dist/FormField/FormField.mjs +6 -0
- package/dist/Heading/Heading.js +48 -0
- package/dist/Heading/Heading.mjs +6 -0
- package/dist/Modal/Modal.js +146 -0
- package/dist/Modal/Modal.mjs +7 -0
- package/dist/NavigationMenu/NavigationMenu.js +141 -0
- package/dist/NavigationMenu/NavigationMenu.mjs +6 -0
- package/dist/RadioGroup/RadioGroup.js +103 -0
- package/dist/RadioGroup/RadioGroup.mjs +6 -0
- package/dist/Select/Select.js +157 -0
- package/dist/Select/Select.mjs +12 -0
- package/dist/SkipLink/SkipLink.js +59 -0
- package/dist/SkipLink/SkipLink.mjs +6 -0
- package/dist/Switch/Switch.js +82 -0
- package/dist/Switch/Switch.mjs +6 -0
- package/dist/Toast/Toast.js +123 -0
- package/dist/Toast/Toast.mjs +8 -0
- package/dist/Tooltip/Tooltip.js +121 -0
- package/dist/Tooltip/Tooltip.mjs +12 -0
- package/dist/chunk-2MJRKHPL.mjs +98 -0
- package/dist/chunk-5RKBS475.mjs +58 -0
- package/dist/chunk-C5M6C7KT.mjs +84 -0
- package/dist/chunk-GK4BYT56.mjs +117 -0
- package/dist/chunk-HALLFO25.mjs +22 -0
- package/dist/chunk-LZ42XDDI.mjs +105 -0
- package/dist/chunk-MKKQLWGK.mjs +35 -0
- package/dist/chunk-NDYRGXQ6.mjs +93 -0
- package/dist/chunk-NOE5QKC2.mjs +58 -0
- package/dist/chunk-PLT5CAFO.mjs +86 -0
- package/dist/chunk-V2JYAFB7.mjs +130 -0
- package/dist/chunk-W4ZHBRFT.mjs +14 -0
- package/dist/chunk-YMSNGQN6.mjs +79 -0
- package/dist/index.js +1256 -0
- package/dist/index.mjs +308 -0
- package/package.json +113 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// src/RadioGroup/RadioGroup.tsx
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var RadioGroup = forwardRef(
|
|
5
|
+
({ name, options, value, onChange, orientation = "vertical", className = "", label }, ref) => {
|
|
6
|
+
return /* @__PURE__ */ jsxs(
|
|
7
|
+
"div",
|
|
8
|
+
{
|
|
9
|
+
ref,
|
|
10
|
+
className: `${className}`,
|
|
11
|
+
role: "radiogroup",
|
|
12
|
+
"aria-labelledby": label ? `${name}-label` : void 0,
|
|
13
|
+
children: [
|
|
14
|
+
label && /* @__PURE__ */ jsx("div", { id: `${name}-label`, className: "text-sm font-medium text-slate-900 mb-2", children: label }),
|
|
15
|
+
/* @__PURE__ */ jsx("div", { className: `flex ${orientation === "vertical" ? "flex-col space-y-3" : "flex-row space-x-6"}`, children: options.map((option) => {
|
|
16
|
+
const optionId = `${name}-${option.value}`;
|
|
17
|
+
const isChecked = value === option.value;
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
19
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex items-center justify-center", children: [
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
"input",
|
|
22
|
+
{
|
|
23
|
+
id: optionId,
|
|
24
|
+
name,
|
|
25
|
+
type: "radio",
|
|
26
|
+
value: option.value,
|
|
27
|
+
checked: isChecked,
|
|
28
|
+
disabled: option.disabled,
|
|
29
|
+
onChange: (e) => {
|
|
30
|
+
if (e.target.checked) {
|
|
31
|
+
onChange?.(option.value);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
className: "peer sr-only"
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: `
|
|
41
|
+
h-5 w-5 rounded-full border border-slate-300 bg-white shadow-sm transition-all
|
|
42
|
+
peer-focus:ring-2 peer-focus:ring-primary-500 peer-focus:ring-offset-2
|
|
43
|
+
peer-checked:border-primary-600 peer-checked:bg-white
|
|
44
|
+
peer-disabled:cursor-not-allowed peer-disabled:opacity-50
|
|
45
|
+
hover:border-primary-400
|
|
46
|
+
`,
|
|
47
|
+
"aria-hidden": "true"
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
className: `
|
|
54
|
+
absolute h-2.5 w-2.5 rounded-full bg-primary-600 transition-transform duration-200 scale-0
|
|
55
|
+
${isChecked ? "scale-100" : ""}
|
|
56
|
+
`
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
"label",
|
|
62
|
+
{
|
|
63
|
+
htmlFor: optionId,
|
|
64
|
+
className: `ml-3 text-sm font-medium ${option.disabled ? "text-slate-400" : "text-slate-700"} cursor-pointer select-none`,
|
|
65
|
+
children: option.label
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] }, option.value);
|
|
69
|
+
}) })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
RadioGroup.displayName = "RadioGroup";
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
RadioGroup
|
|
79
|
+
};
|