@sikka/hawa 0.30.12-next → 0.30.13-next
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/{Radio-MHGhfbpA.d.ts → Radio-uPqJwFGq.d.ts} +2 -2
- package/dist/{Radio-ZM5l4CwH.d.mts → Radio-zXrZBXwJ.d.mts} +2 -2
- package/dist/blocks/feedback/index.js +179 -177
- package/dist/blocks/feedback/index.mjs +1 -1
- package/dist/blocks/index.d.mts +1 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/index.js +179 -177
- package/dist/blocks/index.mjs +1 -1
- package/dist/blocks/pricing/index.js +179 -177
- package/dist/blocks/pricing/index.mjs +1 -1
- package/dist/{chunk-3GZMGTI5.mjs → chunk-MPRDKNFN.mjs} +180 -178
- package/dist/chunk-WQK2TN4F.mjs +215 -0
- package/dist/elements/index.d.mts +2 -2
- package/dist/elements/index.d.ts +2 -2
- package/dist/elements/index.js +179 -177
- package/dist/elements/index.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +179 -177
- package/dist/index.mjs +180 -178
- package/dist/interfaceSettings/index.js +179 -177
- package/dist/interfaceSettings/index.js.map +1 -1
- package/dist/interfaceSettings/index.mjs +180 -178
- package/dist/interfaceSettings/index.mjs.map +1 -1
- package/dist/radio/index.d.mts +2 -2
- package/dist/radio/index.d.ts +2 -2
- package/dist/radio/index.js +179 -177
- package/dist/radio/index.js.map +1 -1
- package/dist/radio/index.mjs +180 -178
- package/dist/radio/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-U42KD2OQ.mjs +0 -213
package/dist/chunk-U42KD2OQ.mjs
DELETED
@@ -1,213 +0,0 @@
|
|
1
|
-
"use client";
|
2
|
-
import {
|
3
|
-
Label,
|
4
|
-
cn
|
5
|
-
} from "./chunk-ZGNBKYX7.mjs";
|
6
|
-
|
7
|
-
// elements/radio/Radio.tsx
|
8
|
-
import React, { useState, useRef, useEffect } from "react";
|
9
|
-
var Radio = ({
|
10
|
-
design = "default",
|
11
|
-
width = "default",
|
12
|
-
size = "default",
|
13
|
-
orientation = "horizontal",
|
14
|
-
name,
|
15
|
-
labelProps,
|
16
|
-
tabsContainerClassName,
|
17
|
-
forceHideHelperText = false,
|
18
|
-
onChange,
|
19
|
-
...props
|
20
|
-
}) => {
|
21
|
-
var _a, _b, _c;
|
22
|
-
const [selectedOption, setSelectedOption] = useState(
|
23
|
-
props.defaultValue || props.value
|
24
|
-
);
|
25
|
-
let activeTabStyle = "hawa-inline-block hawa-w-full hawa-text-primary-foreground hawa-bg-primary hawa-active dark:hawa-bg-primary";
|
26
|
-
let inactiveTabStyle = `hawa-inline-block hawa-w-full hawa-transition-all hawa-bg-primary-foreground dark:hover:hawa-text-white
|
27
|
-
${props.disabled ? "" : "hover:hawa-bg-muted"}`;
|
28
|
-
let orientationStyle = {
|
29
|
-
horizontal: "hawa-flex hawa-flex-row",
|
30
|
-
vertical: "hawa-flex hawa-flex-col"
|
31
|
-
};
|
32
|
-
let tabSizeStyle = {
|
33
|
-
default: "hawa-py-2 hawa-px-4 hawa-text-sm",
|
34
|
-
lg: "hawa-py-2 hawa-px-4",
|
35
|
-
sm: "hawa-p-1.5 hawa-text-xs",
|
36
|
-
xs: "hawa-p-1 hawa-text-[10px]"
|
37
|
-
};
|
38
|
-
let widthStyle = {
|
39
|
-
none: "",
|
40
|
-
default: "hawa-max-w-fit",
|
41
|
-
full: "hawa-w-full"
|
42
|
-
};
|
43
|
-
const [parentDirection, setParentDirection] = React.useState(
|
44
|
-
null
|
45
|
-
);
|
46
|
-
const parentRef = useRef(null);
|
47
|
-
useEffect(() => {
|
48
|
-
var _a2;
|
49
|
-
const parentNode = (_a2 = parentRef.current) == null ? void 0 : _a2.parentNode;
|
50
|
-
if (parentNode) {
|
51
|
-
const dir = window.getComputedStyle(parentNode).direction;
|
52
|
-
setParentDirection(dir);
|
53
|
-
}
|
54
|
-
});
|
55
|
-
const handleChange = (opt) => {
|
56
|
-
setSelectedOption(opt.value);
|
57
|
-
if (onChange) {
|
58
|
-
onChange(opt.value);
|
59
|
-
} else {
|
60
|
-
console.log("onChange was not provided");
|
61
|
-
}
|
62
|
-
};
|
63
|
-
switch (design) {
|
64
|
-
case "tabs":
|
65
|
-
return /* @__PURE__ */ React.createElement("div", { className: "hawa-gap-2 hawa-flex hawa-flex-col" }, props.label && /* @__PURE__ */ React.createElement(Label, { ...labelProps }, props.label), /* @__PURE__ */ React.createElement(
|
66
|
-
"ul",
|
67
|
-
{
|
68
|
-
ref: parentRef,
|
69
|
-
className: cn(
|
70
|
-
props.options && ((_a = props.options) == null ? void 0 : _a.length) > 2 ? "hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap" : "",
|
71
|
-
"hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium",
|
72
|
-
orientationStyle[orientation],
|
73
|
-
widthStyle[width],
|
74
|
-
tabsContainerClassName
|
75
|
-
)
|
76
|
-
},
|
77
|
-
(_b = props.options) == null ? void 0 : _b.map((opt, o) => /* @__PURE__ */ React.createElement(
|
78
|
-
"li",
|
79
|
-
{
|
80
|
-
"aria-current": "page",
|
81
|
-
onClick: () => {
|
82
|
-
if (props.disabled)
|
83
|
-
return;
|
84
|
-
handleChange(opt);
|
85
|
-
},
|
86
|
-
className: cn(
|
87
|
-
"hawa-w-full hawa-last hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2 ",
|
88
|
-
!props.disabled && "hawa-cursor-pointer",
|
89
|
-
orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
|
90
|
-
orientation === "horizontal" && parentDirection === "rtl" && "hawa-rounded-none first:hawa-rounded-r last:hawa-rounded-l",
|
91
|
-
orientation === "vertical" && "hawa-rounded-none first:hawa-rounded-t last:hawa-rounded-b",
|
92
|
-
tabSizeStyle[size],
|
93
|
-
selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
|
94
|
-
),
|
95
|
-
key: o
|
96
|
-
},
|
97
|
-
opt.icon && opt.icon,
|
98
|
-
opt.label
|
99
|
-
))
|
100
|
-
), !forceHideHelperText && /* @__PURE__ */ React.createElement(
|
101
|
-
"p",
|
102
|
-
{
|
103
|
-
className: cn(
|
104
|
-
"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all",
|
105
|
-
props.helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0"
|
106
|
-
)
|
107
|
-
},
|
108
|
-
props.helperText
|
109
|
-
));
|
110
|
-
case "bordered":
|
111
|
-
return /* @__PURE__ */ React.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ React.createElement("div", { key: i, className: "hawa-w-full hawa-rounded hawa-border" }, /* @__PURE__ */ React.createElement(
|
112
|
-
"div",
|
113
|
-
{
|
114
|
-
className: cn(
|
115
|
-
"radio-item radio-item-bordered hawa-flex hawa-items-center hawa-transition-all",
|
116
|
-
props.direction === "rtl" ? "margin-left right-19px" : "margin-right left-23px"
|
117
|
-
),
|
118
|
-
key: i + 1
|
119
|
-
},
|
120
|
-
/* @__PURE__ */ React.createElement(
|
121
|
-
"input",
|
122
|
-
{
|
123
|
-
disabled: opt.disabled,
|
124
|
-
id: opt.value.toString(),
|
125
|
-
type: "radio",
|
126
|
-
value: opt.value,
|
127
|
-
name,
|
128
|
-
onChange: () => handleChange(opt)
|
129
|
-
}
|
130
|
-
),
|
131
|
-
/* @__PURE__ */ React.createElement(
|
132
|
-
"label",
|
133
|
-
{
|
134
|
-
htmlFor: opt.value.toString(),
|
135
|
-
className: cn(
|
136
|
-
"hawa-ml-2 hawa-w-full hawa-select-none hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium hawa-text-black dark:hawa-text-white",
|
137
|
-
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
|
138
|
-
)
|
139
|
-
},
|
140
|
-
opt.label
|
141
|
-
)
|
142
|
-
))));
|
143
|
-
case "cards":
|
144
|
-
return /* @__PURE__ */ React.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ React.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ React.createElement(
|
145
|
-
"input",
|
146
|
-
{
|
147
|
-
type: "radio",
|
148
|
-
id: opt.value.toString(),
|
149
|
-
name,
|
150
|
-
value: opt.value.toString(),
|
151
|
-
className: "hawa-peer hawa-hidden",
|
152
|
-
required: true,
|
153
|
-
disabled: opt.disabled
|
154
|
-
}
|
155
|
-
), /* @__PURE__ */ React.createElement(
|
156
|
-
"label",
|
157
|
-
{
|
158
|
-
htmlFor: opt.value.toString(),
|
159
|
-
className: cn(
|
160
|
-
"hawa-inline-flex hawa-h-full hawa-w-full hawa-items-center hawa-justify-between hawa-rounded-lg hawa-border hawa-border-gray-200 hawa-bg-white hawa-p-5 hawa-text-gray-500 peer-checked:hawa-border-primary peer-checked:hawa-text-primary dark:hawa-border-gray-700 dark:hawa-bg-gray-800 dark:hawa-text-gray-400 dark:peer-checked:hawa-text-primary",
|
161
|
-
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hover:hawa-bg-gray-100 hover:hawa-text-gray-600 dark:hover:hawa-bg-gray-700 dark:hover:hawa-text-gray-300"
|
162
|
-
)
|
163
|
-
},
|
164
|
-
/* @__PURE__ */ React.createElement("div", { className: "hawa-block hawa-h-full hawa-w-full" }, /* @__PURE__ */ React.createElement("div", { className: "hawa-w-full hawa-text-lg hawa-font-semibold" }, opt.label), /* @__PURE__ */ React.createElement("div", { className: "hawa-w-full" }, opt.sublabel))
|
165
|
-
))));
|
166
|
-
default:
|
167
|
-
return /* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, props.label && /* @__PURE__ */ React.createElement(Label, { ...labelProps }, props.label), /* @__PURE__ */ React.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-2") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ React.createElement(
|
168
|
-
"div",
|
169
|
-
{
|
170
|
-
className: cn(
|
171
|
-
"radio-item radio-item-default hawa-flex hawa-items-center hawa-transition-all",
|
172
|
-
props.direction === "rtl" ? "margin-left right-3px" : "margin-right left-3px"
|
173
|
-
),
|
174
|
-
key: i + 1
|
175
|
-
},
|
176
|
-
/* @__PURE__ */ React.createElement(
|
177
|
-
"input",
|
178
|
-
{
|
179
|
-
disabled: opt.disabled,
|
180
|
-
id: opt.value.toString(),
|
181
|
-
type: "radio",
|
182
|
-
value: opt.value,
|
183
|
-
name,
|
184
|
-
onChange: () => handleChange(opt)
|
185
|
-
}
|
186
|
-
),
|
187
|
-
/* @__PURE__ */ React.createElement(
|
188
|
-
"label",
|
189
|
-
{
|
190
|
-
htmlFor: opt.value.toString(),
|
191
|
-
className: cn(
|
192
|
-
"hawa-text-sm hawa-font-medium dark:hawa-text-white",
|
193
|
-
opt.disabled ? "hawa-text-gray-400" : "hawa-cursor-pointer hawa-text-gray-900"
|
194
|
-
)
|
195
|
-
},
|
196
|
-
opt.label
|
197
|
-
)
|
198
|
-
))), /* @__PURE__ */ React.createElement(
|
199
|
-
"p",
|
200
|
-
{
|
201
|
-
className: cn(
|
202
|
-
"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all",
|
203
|
-
props.helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0"
|
204
|
-
)
|
205
|
-
},
|
206
|
-
props.helperText
|
207
|
-
));
|
208
|
-
}
|
209
|
-
};
|
210
|
-
|
211
|
-
export {
|
212
|
-
Radio
|
213
|
-
};
|