@sikka/hawa 0.30.12-next → 0.30.14-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/{DropdownMenu-o2-hzTmS.d.mts → DropdownMenu-arqV1gRt.d.mts} +1 -1
- package/dist/{DropdownMenu-q6HfeO08.d.ts → DropdownMenu-sSnQc6fT.d.ts} +1 -1
- package/dist/{Radio-ZM5l4CwH.d.mts → Radio-9MkZay6D.d.mts} +3 -3
- package/dist/{Radio-MHGhfbpA.d.ts → Radio-bhKmANMf.d.ts} +3 -3
- package/dist/appLayout/index.js +6 -2
- package/dist/appLayout/index.js.map +1 -1
- package/dist/appLayout/index.mjs +6 -2
- package/dist/appLayout/index.mjs.map +1 -1
- package/dist/appTopbar/index.js +3 -5
- package/dist/appTopbar/index.js.map +1 -1
- package/dist/appTopbar/index.mjs +3 -5
- package/dist/appTopbar/index.mjs.map +1 -1
- package/dist/blocks/auth/index.js +1 -1
- package/dist/blocks/auth/index.mjs +2 -2
- package/dist/blocks/feedback/index.js +179 -177
- package/dist/blocks/feedback/index.mjs +2 -2
- package/dist/blocks/index.d.mts +2 -2
- package/dist/blocks/index.d.ts +2 -2
- package/dist/blocks/index.js +181 -179
- package/dist/blocks/index.mjs +3 -3
- package/dist/blocks/misc/index.js +1 -1
- package/dist/blocks/misc/index.mjs +2 -2
- package/dist/blocks/pricing/index.js +179 -177
- package/dist/blocks/pricing/index.mjs +1 -1
- package/dist/{chunk-3GZMGTI5.mjs → chunk-OUAQNQWP.mjs} +180 -178
- package/dist/chunk-R52CZJK3.mjs +215 -0
- package/dist/dataTable/index.js.map +1 -1
- package/dist/dataTable/index.mjs.map +1 -1
- package/dist/dropdownMenu/index.d.mts +1 -1
- package/dist/dropdownMenu/index.d.ts +1 -1
- package/dist/dropdownMenu/index.js.map +1 -1
- package/dist/dropdownMenu/index.mjs.map +1 -1
- package/dist/elements/index.d.mts +3 -3
- package/dist/elements/index.d.ts +3 -3
- package/dist/elements/index.js +179 -177
- package/dist/elements/index.mjs +1 -1
- package/dist/index.css +9 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +188 -182
- package/dist/index.mjs +189 -183
- 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/layout/index.d.mts +1 -1
- package/dist/layout/index.d.ts +1 -1
- package/dist/layout/index.js +7 -3
- package/dist/layout/index.mjs +7 -3
- package/dist/phoneInput/index.js.map +1 -1
- package/dist/phoneInput/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/dist/select/index.d.mts +1 -1
- package/dist/select/index.d.ts +1 -1
- package/dist/select/index.js +3 -1
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs +3 -1
- package/dist/select/index.mjs.map +1 -1
- package/dist/splitButton/index.js.map +1 -1
- package/dist/splitButton/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-U42KD2OQ.mjs +0 -213
- /package/dist/{chunk-M3IRSZWA.mjs → chunk-ER7YWU7Z.mjs} +0 -0
@@ -11,7 +11,7 @@ function cn(...inputs) {
|
|
11
11
|
}
|
12
12
|
|
13
13
|
// elements/radio/Radio.tsx
|
14
|
-
import React3, { useState, useRef, useEffect } from "react";
|
14
|
+
import React3, { useState, useRef, useEffect, forwardRef as forwardRef2 } from "react";
|
15
15
|
|
16
16
|
// elements/label/Label.tsx
|
17
17
|
import * as React2 from "react";
|
@@ -130,207 +130,209 @@ var Label = React2.forwardRef(({ className, hint, hintSide, required, children,
|
|
130
130
|
Label.displayName = "Label";
|
131
131
|
|
132
132
|
// elements/radio/Radio.tsx
|
133
|
-
var Radio = (
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
133
|
+
var Radio = forwardRef2(
|
134
|
+
({
|
135
|
+
design = "default",
|
136
|
+
width = "default",
|
137
|
+
size = "default",
|
138
|
+
orientation = "horizontal",
|
139
|
+
name,
|
140
|
+
labelProps,
|
141
|
+
tabsContainerClassName,
|
142
|
+
forceHideHelperText = false,
|
143
|
+
onChange,
|
144
|
+
...props
|
145
|
+
}, ref) => {
|
146
|
+
var _a, _b, _c;
|
147
|
+
const [selectedOption, setSelectedOption] = useState(
|
148
|
+
props.defaultValue || props.value
|
149
|
+
);
|
150
|
+
let activeTabStyle = "hawa-inline-block hawa-w-full hawa-text-primary-foreground hawa-bg-primary hawa-active dark:hawa-bg-primary";
|
151
|
+
let inactiveTabStyle = `hawa-inline-block hawa-w-full hawa-transition-all hawa-bg-primary-foreground dark:hover:hawa-text-white
|
151
152
|
${props.disabled ? "" : "hover:hawa-bg-muted"}`;
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
{
|
192
|
-
ref: parentRef,
|
193
|
-
className: cn(
|
194
|
-
props.options && ((_a = props.options) == null ? void 0 : _a.length) > 2 ? "hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap" : "",
|
195
|
-
"hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium",
|
196
|
-
orientationStyle[orientation],
|
197
|
-
widthStyle[width],
|
198
|
-
tabsContainerClassName
|
199
|
-
)
|
200
|
-
},
|
201
|
-
(_b = props.options) == null ? void 0 : _b.map((opt, o) => /* @__PURE__ */ React3.createElement(
|
202
|
-
"li",
|
153
|
+
let orientationStyle = {
|
154
|
+
horizontal: "hawa-flex hawa-flex-row",
|
155
|
+
vertical: "hawa-flex hawa-flex-col"
|
156
|
+
};
|
157
|
+
let tabSizeStyle = {
|
158
|
+
default: "hawa-py-2 hawa-px-4 hawa-text-sm",
|
159
|
+
lg: "hawa-py-2 hawa-px-4",
|
160
|
+
sm: "hawa-p-1.5 hawa-text-xs",
|
161
|
+
xs: "hawa-p-1 hawa-text-[10px]"
|
162
|
+
};
|
163
|
+
let widthStyle = {
|
164
|
+
none: "",
|
165
|
+
default: "hawa-max-w-fit",
|
166
|
+
full: "hawa-w-full"
|
167
|
+
};
|
168
|
+
const [parentDirection, setParentDirection] = React3.useState(
|
169
|
+
null
|
170
|
+
);
|
171
|
+
const parentRef = useRef(null);
|
172
|
+
useEffect(() => {
|
173
|
+
var _a2;
|
174
|
+
const parentNode = (_a2 = parentRef.current) == null ? void 0 : _a2.parentNode;
|
175
|
+
if (parentNode) {
|
176
|
+
const dir = window.getComputedStyle(parentNode).direction;
|
177
|
+
setParentDirection(dir);
|
178
|
+
}
|
179
|
+
});
|
180
|
+
const handleChange = (opt) => {
|
181
|
+
setSelectedOption(opt.value);
|
182
|
+
if (onChange) {
|
183
|
+
onChange(opt.value);
|
184
|
+
} else {
|
185
|
+
console.log("onChange was not provided");
|
186
|
+
}
|
187
|
+
};
|
188
|
+
switch (design) {
|
189
|
+
case "tabs":
|
190
|
+
return /* @__PURE__ */ React3.createElement("div", { className: "hawa-gap-2 hawa-flex hawa-flex-col" }, props.label && /* @__PURE__ */ React3.createElement(Label, { ...labelProps }, props.label), /* @__PURE__ */ React3.createElement(
|
191
|
+
"ul",
|
203
192
|
{
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
193
|
+
ref: parentRef,
|
194
|
+
className: cn(
|
195
|
+
props.options && ((_a = props.options) == null ? void 0 : _a.length) > 2 ? "hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap" : "",
|
196
|
+
"hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium",
|
197
|
+
orientationStyle[orientation],
|
198
|
+
widthStyle[width],
|
199
|
+
tabsContainerClassName
|
200
|
+
)
|
201
|
+
},
|
202
|
+
(_b = props.options) == null ? void 0 : _b.map((opt, o) => /* @__PURE__ */ React3.createElement(
|
203
|
+
"li",
|
204
|
+
{
|
205
|
+
"aria-current": "page",
|
206
|
+
onClick: () => {
|
207
|
+
if (props.disabled)
|
208
|
+
return;
|
209
|
+
handleChange(opt);
|
210
|
+
},
|
211
|
+
className: cn(
|
212
|
+
"hawa-w-full hawa-last hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2 ",
|
213
|
+
!props.disabled && "hawa-cursor-pointer",
|
214
|
+
orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
|
215
|
+
orientation === "horizontal" && parentDirection === "rtl" && "hawa-rounded-none first:hawa-rounded-r last:hawa-rounded-l",
|
216
|
+
orientation === "vertical" && "hawa-rounded-none first:hawa-rounded-t last:hawa-rounded-b",
|
217
|
+
tabSizeStyle[size],
|
218
|
+
selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
|
219
|
+
),
|
220
|
+
key: o
|
209
221
|
},
|
222
|
+
opt.icon && opt.icon,
|
223
|
+
opt.label
|
224
|
+
))
|
225
|
+
), !forceHideHelperText && /* @__PURE__ */ React3.createElement(
|
226
|
+
"p",
|
227
|
+
{
|
228
|
+
className: cn(
|
229
|
+
"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all",
|
230
|
+
props.helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0"
|
231
|
+
)
|
232
|
+
},
|
233
|
+
props.helperText
|
234
|
+
));
|
235
|
+
case "bordered":
|
236
|
+
return /* @__PURE__ */ React3.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ React3.createElement("div", { key: i, className: "hawa-w-full hawa-rounded hawa-border" }, /* @__PURE__ */ React3.createElement(
|
237
|
+
"div",
|
238
|
+
{
|
210
239
|
className: cn(
|
211
|
-
"
|
212
|
-
|
213
|
-
orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
|
214
|
-
orientation === "horizontal" && parentDirection === "rtl" && "hawa-rounded-none first:hawa-rounded-r last:hawa-rounded-l",
|
215
|
-
orientation === "vertical" && "hawa-rounded-none first:hawa-rounded-t last:hawa-rounded-b",
|
216
|
-
tabSizeStyle[size],
|
217
|
-
selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
|
240
|
+
"radio-item radio-item-bordered hawa-flex hawa-items-center hawa-transition-all",
|
241
|
+
props.direction === "rtl" ? "margin-left right-19px" : "margin-right left-23px"
|
218
242
|
),
|
219
|
-
key:
|
243
|
+
key: i + 1
|
220
244
|
},
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
},
|
232
|
-
props.helperText
|
233
|
-
));
|
234
|
-
case "bordered":
|
235
|
-
return /* @__PURE__ */ React3.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ React3.createElement("div", { key: i, className: "hawa-w-full hawa-rounded hawa-border" }, /* @__PURE__ */ React3.createElement(
|
236
|
-
"div",
|
237
|
-
{
|
238
|
-
className: cn(
|
239
|
-
"radio-item radio-item-bordered hawa-flex hawa-items-center hawa-transition-all",
|
240
|
-
props.direction === "rtl" ? "margin-left right-19px" : "margin-right left-23px"
|
245
|
+
/* @__PURE__ */ React3.createElement(
|
246
|
+
"input",
|
247
|
+
{
|
248
|
+
disabled: opt.disabled,
|
249
|
+
id: opt.value.toString(),
|
250
|
+
type: "radio",
|
251
|
+
value: opt.value,
|
252
|
+
name,
|
253
|
+
onChange: () => handleChange(opt)
|
254
|
+
}
|
241
255
|
),
|
242
|
-
|
243
|
-
|
244
|
-
|
256
|
+
/* @__PURE__ */ React3.createElement(
|
257
|
+
"label",
|
258
|
+
{
|
259
|
+
htmlFor: opt.value.toString(),
|
260
|
+
className: cn(
|
261
|
+
"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",
|
262
|
+
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
|
263
|
+
)
|
264
|
+
},
|
265
|
+
opt.label
|
266
|
+
)
|
267
|
+
))));
|
268
|
+
case "cards":
|
269
|
+
return /* @__PURE__ */ React3.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ React3.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ React3.createElement(
|
245
270
|
"input",
|
246
271
|
{
|
247
|
-
disabled: opt.disabled,
|
248
|
-
id: opt.value.toString(),
|
249
272
|
type: "radio",
|
250
|
-
|
273
|
+
id: opt.value.toString(),
|
251
274
|
name,
|
252
|
-
|
275
|
+
value: opt.value.toString(),
|
276
|
+
className: "hawa-peer hawa-hidden",
|
277
|
+
required: true,
|
278
|
+
disabled: opt.disabled
|
253
279
|
}
|
254
|
-
),
|
255
|
-
/* @__PURE__ */ React3.createElement(
|
280
|
+
), /* @__PURE__ */ React3.createElement(
|
256
281
|
"label",
|
257
282
|
{
|
258
283
|
htmlFor: opt.value.toString(),
|
259
284
|
className: cn(
|
260
|
-
"hawa-
|
261
|
-
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-
|
285
|
+
"hawa-inline-flex hawa-h-full hawa-w-full hawa-transition-all hawa-items-center hawa-justify-between hawa-rounded-lg hawa-border hawa-border-gray-200 hawa-bg-background 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-foreground/5 dark:hawa-text-gray-400 dark:peer-checked:hawa-text-primary",
|
286
|
+
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hover:hawa-bg-foreground/10 hover:hawa-text-gray-600 dark:hover:hawa-bg-foreground/20 dark:hover:hawa-text-gray-300"
|
262
287
|
)
|
263
288
|
},
|
264
|
-
opt.label
|
265
|
-
)
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
"input",
|
270
|
-
{
|
271
|
-
type: "radio",
|
272
|
-
id: opt.value.toString(),
|
273
|
-
name,
|
274
|
-
value: opt.value.toString(),
|
275
|
-
className: "hawa-peer hawa-hidden",
|
276
|
-
required: true,
|
277
|
-
disabled: opt.disabled
|
278
|
-
}
|
279
|
-
), /* @__PURE__ */ React3.createElement(
|
280
|
-
"label",
|
281
|
-
{
|
282
|
-
htmlFor: opt.value.toString(),
|
283
|
-
className: cn(
|
284
|
-
"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",
|
285
|
-
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"
|
286
|
-
)
|
287
|
-
},
|
288
|
-
/* @__PURE__ */ React3.createElement("div", { className: "hawa-block hawa-h-full hawa-w-full" }, /* @__PURE__ */ React3.createElement("div", { className: "hawa-w-full hawa-text-lg hawa-font-semibold" }, opt.label), /* @__PURE__ */ React3.createElement("div", { className: "hawa-w-full" }, opt.sublabel))
|
289
|
-
))));
|
290
|
-
default:
|
291
|
-
return /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, props.label && /* @__PURE__ */ React3.createElement(Label, { ...labelProps }, props.label), /* @__PURE__ */ React3.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-2") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ React3.createElement(
|
292
|
-
"div",
|
293
|
-
{
|
294
|
-
className: cn(
|
295
|
-
"radio-item radio-item-default hawa-flex hawa-items-center hawa-transition-all",
|
296
|
-
props.direction === "rtl" ? "margin-left right-3px" : "margin-right left-3px"
|
297
|
-
),
|
298
|
-
key: i + 1
|
299
|
-
},
|
300
|
-
/* @__PURE__ */ React3.createElement(
|
301
|
-
"input",
|
289
|
+
/* @__PURE__ */ React3.createElement("div", { className: "hawa-block hawa-h-full hawa-w-full" }, /* @__PURE__ */ React3.createElement("div", { className: "hawa-w-full hawa-text-lg hawa-font-semibold" }, opt.label), /* @__PURE__ */ React3.createElement("div", { className: "hawa-w-full" }, opt.sublabel))
|
290
|
+
))));
|
291
|
+
default:
|
292
|
+
return /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, props.label && /* @__PURE__ */ React3.createElement(Label, { ...labelProps }, props.label), /* @__PURE__ */ React3.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-2") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ React3.createElement(
|
293
|
+
"div",
|
302
294
|
{
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
295
|
+
className: cn(
|
296
|
+
"radio-item radio-item-default hawa-flex hawa-items-center hawa-transition-all",
|
297
|
+
props.direction === "rtl" ? "margin-left right-3px" : "margin-right left-3px"
|
298
|
+
),
|
299
|
+
key: i + 1
|
300
|
+
},
|
301
|
+
/* @__PURE__ */ React3.createElement(
|
302
|
+
"input",
|
303
|
+
{
|
304
|
+
disabled: opt.disabled,
|
305
|
+
id: opt.value.toString(),
|
306
|
+
type: "radio",
|
307
|
+
value: opt.value,
|
308
|
+
name,
|
309
|
+
onChange: () => handleChange(opt)
|
310
|
+
}
|
311
|
+
),
|
312
|
+
/* @__PURE__ */ React3.createElement(
|
313
|
+
"label",
|
314
|
+
{
|
315
|
+
htmlFor: opt.value.toString(),
|
316
|
+
className: cn(
|
317
|
+
"hawa-text-sm hawa-font-medium dark:hawa-text-white",
|
318
|
+
opt.disabled ? "hawa-text-gray-400" : "hawa-cursor-pointer hawa-text-gray-900"
|
319
|
+
)
|
320
|
+
},
|
321
|
+
opt.label
|
322
|
+
)
|
323
|
+
))), /* @__PURE__ */ React3.createElement(
|
324
|
+
"p",
|
313
325
|
{
|
314
|
-
htmlFor: opt.value.toString(),
|
315
326
|
className: cn(
|
316
|
-
"hawa-text-
|
317
|
-
|
327
|
+
"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all",
|
328
|
+
props.helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0"
|
318
329
|
)
|
319
330
|
},
|
320
|
-
|
321
|
-
)
|
322
|
-
|
323
|
-
"p",
|
324
|
-
{
|
325
|
-
className: cn(
|
326
|
-
"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all",
|
327
|
-
props.helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0"
|
328
|
-
)
|
329
|
-
},
|
330
|
-
props.helperText
|
331
|
-
));
|
331
|
+
props.helperText
|
332
|
+
));
|
333
|
+
}
|
332
334
|
}
|
333
|
-
|
335
|
+
);
|
334
336
|
|
335
337
|
// elements/interfaceSettings/InterfaceSettings.tsx
|
336
338
|
var InterfaceSettings = ({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../elements/interfaceSettings/InterfaceSettings.tsx","../../util/index.ts","../../elements/radio/Radio.tsx","../../elements/label/Label.tsx","../../elements/tooltip/Tooltip.tsx"],"sourcesContent":["import React, { FC, useState } from \"react\";\n\nimport { cn } from \"@util/index\";\n\nimport { OrientationType } from \"@_types/commonTypes\";\n\nimport { Radio } from \"../radio/Radio\";\n\ntype TypographyTypes = {\n /** Function to handle language change. */\n handleLanguage?: (e: any) => void;\n /** Current selected language. */\n currentLanguage?: string;\n /** Function to handle theme color mode change. */\n handleColorMode?: (e: any) => void;\n /** Current selected theme color mode. */\n currentColorMode?: \"light\" | \"dark\";\n orientation?: OrientationType;\n width?: \"default\" | \"full\";\n};\nexport const InterfaceSettings: FC<TypographyTypes> = ({\n orientation = \"horizontal\",\n width = \"default\",\n handleColorMode,\n handleLanguage,\n ...props\n}) => {\n const [color, setColor] = useState(props.currentColorMode);\n const [language, setLanguage] = useState(props.currentLanguage);\n let orientationStyle = {\n horizontal: \"hawa-flex hawa-flex-row hawa-justify-between\",\n vertical: \"hawa-flex hawa-flex-col hawa-items-center hawa-gap-2\"\n };\n return (\n <div className={cn(orientationStyle[orientation])}>\n <Radio\n name=\"language\"\n width={width}\n defaultValue={language}\n onChange={(e: any) => {\n if (handleLanguage) {\n handleLanguage(e.value);\n }\n setLanguage(e);\n }}\n design=\"tabs\"\n options={[\n { value: \"ar\", label: \"عربي\" },\n { value: \"en\", label: \"English\" }\n ]}\n />\n <Radio\n name=\"theme\"\n width={width}\n defaultValue={color}\n onChange={(e: any) => {\n if (handleColorMode) {\n handleColorMode(e.value);\n }\n setColor(e);\n }}\n design=\"tabs\"\n options={[\n {\n value: \"light\",\n label: (\n <svg\n width=\"15\"\n height=\"15\"\n viewBox=\"0 0 15 15\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"hawa-h-[1.2rem] hawa-w-[1.2rem] hawa-rotate-0 hawa-scale-100 hawa-transition-all dark:hawa--rotate-90\"\n >\n <path\n d=\"M7.5 0C7.77614 0 8 0.223858 8 0.5V2.5C8 2.77614 7.77614 3 7.5 3C7.22386 3 7 2.77614 7 2.5V0.5C7 0.223858 7.22386 0 7.5 0ZM2.1967 2.1967C2.39196 2.00144 2.70854 2.00144 2.90381 2.1967L4.31802 3.61091C4.51328 3.80617 4.51328 4.12276 4.31802 4.31802C4.12276 4.51328 3.80617 4.51328 3.61091 4.31802L2.1967 2.90381C2.00144 2.70854 2.00144 2.39196 2.1967 2.1967ZM0.5 7C0.223858 7 0 7.22386 0 7.5C0 7.77614 0.223858 8 0.5 8H2.5C2.77614 8 3 7.77614 3 7.5C3 7.22386 2.77614 7 2.5 7H0.5ZM2.1967 12.8033C2.00144 12.608 2.00144 12.2915 2.1967 12.0962L3.61091 10.682C3.80617 10.4867 4.12276 10.4867 4.31802 10.682C4.51328 10.8772 4.51328 11.1938 4.31802 11.3891L2.90381 12.8033C2.70854 12.9986 2.39196 12.9986 2.1967 12.8033ZM12.5 7C12.2239 7 12 7.22386 12 7.5C12 7.77614 12.2239 8 12.5 8H14.5C14.7761 8 15 7.77614 15 7.5C15 7.22386 14.7761 7 14.5 7H12.5ZM10.682 4.31802C10.4867 4.12276 10.4867 3.80617 10.682 3.61091L12.0962 2.1967C12.2915 2.00144 12.608 2.00144 12.8033 2.1967C12.9986 2.39196 12.9986 2.70854 12.8033 2.90381L11.3891 4.31802C11.1938 4.51328 10.8772 4.51328 10.682 4.31802ZM8 12.5C8 12.2239 7.77614 12 7.5 12C7.22386 12 7 12.2239 7 12.5V14.5C7 14.7761 7.22386 15 7.5 15C7.77614 15 8 14.7761 8 14.5V12.5ZM10.682 10.682C10.8772 10.4867 11.1938 10.4867 11.3891 10.682L12.8033 12.0962C12.9986 12.2915 12.9986 12.608 12.8033 12.8033C12.608 12.9986 12.2915 12.9986 12.0962 12.8033L10.682 11.3891C10.4867 11.1938 10.4867 10.8772 10.682 10.682ZM5.5 7.5C5.5 6.39543 6.39543 5.5 7.5 5.5C8.60457 5.5 9.5 6.39543 9.5 7.5C9.5 8.60457 8.60457 9.5 7.5 9.5C6.39543 9.5 5.5 8.60457 5.5 7.5ZM7.5 4.5C5.84315 4.5 4.5 5.84315 4.5 7.5C4.5 9.15685 5.84315 10.5 7.5 10.5C9.15685 10.5 10.5 9.15685 10.5 7.5C10.5 5.84315 9.15685 4.5 7.5 4.5Z\"\n fill=\"currentColor\"\n ></path>\n </svg>\n )\n },\n {\n value: \"dark\",\n label: (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n className=\"hawa-h-[1.2rem] hawa-w-[1.2rem] hawa-transition-all dark:hawa-rotate-0 dark:hawa-scale-100\"\n >\n <path d=\"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z\"></path>\n </svg>\n )\n }\n ]}\n />\n </div>\n );\n};\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\ntype Palette = {\n name: string;\n colors: {\n [key: number]: string;\n };\n};\ntype Rgb = {\n r: number;\n g: number;\n b: number;\n};\nfunction hexToRgb(hex: string): Rgb | null {\n const sanitizedHex = hex.replaceAll(\"##\", \"#\");\n const colorParts = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(\n sanitizedHex\n );\n\n if (!colorParts) {\n return null;\n }\n\n const [, r, g, b] = colorParts;\n\n return {\n r: parseInt(r, 16),\n g: parseInt(g, 16),\n b: parseInt(b, 16)\n } as Rgb;\n}\n\nfunction rgbToHex(r: number, g: number, b: number): string {\n const toHex = (c: number) => `0${c.toString(16)}`.slice(-2);\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n}\n\nexport function getTextColor(color: string): \"#FFF\" | \"#333\" {\n const rgbColor = hexToRgb(color);\n\n if (!rgbColor) {\n return \"#333\";\n }\n\n const { r, g, b } = rgbColor;\n const luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n return luma < 120 ? \"#FFF\" : \"#333\";\n}\n\nfunction lighten(hex: string, intensity: number): string {\n const color = hexToRgb(`#${hex}`);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r + (255 - color.r) * intensity);\n const g = Math.round(color.g + (255 - color.g) * intensity);\n const b = Math.round(color.b + (255 - color.b) * intensity);\n\n return rgbToHex(r, g, b);\n}\n\nfunction darken(hex: string, intensity: number): string {\n const color = hexToRgb(hex);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r * intensity);\n const g = Math.round(color.g * intensity);\n const b = Math.round(color.b * intensity);\n\n return rgbToHex(r, g, b);\n}\nconst parseColor = (color: any) => {\n if (color.startsWith(\"#\")) {\n // Convert hex to RGB\n let r = parseInt(color.slice(1, 3), 16);\n let g = parseInt(color.slice(3, 5), 16);\n let b = parseInt(color.slice(5, 7), 16);\n return [r, g, b];\n } else if (color.startsWith(\"rgb\")) {\n // Extract RGB values from rgb() format\n return color.match(/\\d+/g).map(Number);\n }\n // Default to white if format is unrecognized\n return [255, 255, 255];\n};\nexport const calculateLuminance = (color: any) => {\n const [r, g, b] = parseColor(color)?.map((c: any) => {\n c /= 255;\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nfunction getPallette(baseColor: string): Palette {\n const name = baseColor;\n\n const response: Palette = {\n name,\n colors: {\n 500: `#${baseColor}`.replace(\"##\", \"#\")\n }\n };\n\n const intensityMap: {\n [key: number]: number;\n } = {\n 50: 0.95,\n 100: 0.9,\n 200: 0.75,\n 300: 0.6,\n 400: 0.3,\n 600: 0.9,\n 700: 0.75,\n 800: 0.6,\n 900: 0.49\n };\n\n [50, 100, 200, 300, 400].forEach((level) => {\n response.colors[level] = lighten(baseColor, intensityMap[level]);\n });\n [600, 700, 800, 900].forEach((level) => {\n response.colors[level] = darken(baseColor, intensityMap[level]);\n });\n\n return response as Palette;\n}\n\nexport { getPallette };\n\n// const hexToRgb = (hex) => {\n// let d = hex?.split(\"#\")[1];\n// var aRgbHex = d?.match(/.{1,2}/g);\n// var aRgb = [\n// parseInt(aRgbHex[0], 16),\n// parseInt(aRgbHex[1], 16),\n// parseInt(aRgbHex[2], 16)\n// ];\n// return aRgb;\n// };\n// const getTextColor = (backColor) => {\n// let rgbArray = hexToRgb(backColor);\n// if (rgbArray[0] * 0.299 + rgbArray[1] * 0.587 + rgbArray[2] * 0.114 > 186) {\n// return \"#000000\";\n// } else {\n// return \"#ffffff\";\n// }\n// };\n// const replaceAt = function (string, index, replacement) {\n// // if (replacement == \"\" || replacement == \" \") {\n// // return (\n// // string.substring(0, index) +\n// // string.substring(index + replacement.length )\n// // );\n// // }\n// const replaced = string.substring(0, index) + replacement + string.substring(index + 1)\n// return replaced\n// };\n\n// export { hexToRgb, getTextColor, replaceAt };\n","import React, { useState, FC, useRef, useEffect } from \"react\";\n\nimport { cn } from \"@util/index\";\n\nimport { DirectionType, OrientationType } from \"../../types/commonTypes\";\nimport { Label, LabelProps } from \"../label/Label\";\n\nexport type RadioOptionsTypes = {\n value: any;\n label: any;\n disabled?: any;\n sublabel?: any;\n icon?: any;\n};\n\ntype RadioTypes = {\n /** Required to enable selection and differentiate between different Radio instances. */\n name: string;\n disabled?: boolean;\n orientation?: OrientationType;\n design?: \"default\" | \"tabs\" | \"cards\" | \"bordered\";\n width?: \"default\" | \"full\" | \"none\";\n size?: \"default\" | \"lg\" | \"sm\" | \"xs\";\n options: RadioOptionsTypes[];\n onChange?: any;\n defaultValue?: any;\n value?: any;\n direction?: DirectionType;\n helperText?: string;\n labelProps?: LabelProps;\n label?: string;\n tabsContainerClassName?: string;\n forceHideHelperText?: boolean;\n};\n\nexport const Radio: FC<RadioTypes> = ({\n design = \"default\",\n width = \"default\",\n size = \"default\",\n orientation = \"horizontal\",\n name,\n labelProps,\n tabsContainerClassName,\n forceHideHelperText = false,\n onChange,\n ...props\n}) => {\n const [selectedOption, setSelectedOption] = useState(\n props.defaultValue || props.value\n );\n let activeTabStyle =\n \"hawa-inline-block hawa-w-full hawa-text-primary-foreground hawa-bg-primary hawa-active dark:hawa-bg-primary\";\n let inactiveTabStyle = `hawa-inline-block hawa-w-full hawa-transition-all hawa-bg-primary-foreground dark:hover:hawa-text-white\n ${props.disabled ? \"\" : \"hover:hawa-bg-muted\"}`;\n let orientationStyle = {\n horizontal: \"hawa-flex hawa-flex-row\",\n vertical: \"hawa-flex hawa-flex-col\"\n };\n\n let tabSizeStyle = {\n default: \"hawa-py-2 hawa-px-4 hawa-text-sm\",\n lg: \"hawa-py-2 hawa-px-4\",\n sm: \"hawa-p-1.5 hawa-text-xs\",\n xs: \"hawa-p-1 hawa-text-[10px]\"\n };\n let widthStyle = {\n none: \"\",\n default: \"hawa-max-w-fit\",\n full: \"hawa-w-full\"\n };\n const [parentDirection, setParentDirection] = React.useState<string | null>(\n null\n );\n const parentRef = useRef<HTMLUListElement>(null);\n\n useEffect(() => {\n const parentNode = parentRef.current?.parentNode as HTMLElement | null;\n if (parentNode) {\n const dir = window.getComputedStyle(parentNode).direction;\n setParentDirection(dir);\n }\n });\n\n const handleChange = (opt: RadioOptionsTypes) => {\n setSelectedOption(opt.value);\n if (onChange) {\n // use the more generic onChange prop\n onChange(opt.value); // You can pass the entire option or just the value\n } else {\n console.log(\"onChange was not provided\");\n }\n };\n switch (design) {\n case \"tabs\":\n return (\n <div className=\"hawa-gap-2 hawa-flex hawa-flex-col\">\n {props.label && <Label {...labelProps}>{props.label}</Label>}\n\n <ul\n ref={parentRef}\n className={cn(\n props.options && props.options?.length > 2\n ? \"hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap\"\n : \"\",\n \"hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium\",\n orientationStyle[orientation],\n widthStyle[width],\n tabsContainerClassName\n )}\n >\n {props.options?.map((opt: any, o) => (\n <li\n aria-current=\"page\"\n onClick={() => {\n if (props.disabled) return;\n handleChange(opt);\n }}\n className={cn(\n \"hawa-w-full hawa-last hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2 \",\n !props.disabled && \"hawa-cursor-pointer\",\n orientation === \"horizontal\" &&\n parentDirection === \"ltr\" &&\n \"hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r\",\n orientation === \"horizontal\" &&\n parentDirection === \"rtl\" &&\n \"hawa-rounded-none first:hawa-rounded-r last:hawa-rounded-l\",\n orientation === \"vertical\" &&\n \"hawa-rounded-none first:hawa-rounded-t last:hawa-rounded-b\",\n tabSizeStyle[size],\n selectedOption === opt.value\n ? activeTabStyle\n : inactiveTabStyle\n )}\n key={o}\n >\n {opt.icon && opt.icon}\n {opt.label}\n </li>\n ))}\n </ul>\n {!forceHideHelperText && (\n <p\n className={cn(\n \"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all\",\n props.helperText\n ? \"hawa-h-4 hawa-opacity-100\"\n : \"hawa-h-0 hawa-opacity-0\"\n )}\n >\n {props.helperText}\n </p>\n )}\n </div>\n );\n case \"bordered\":\n return (\n <div className={cn(orientationStyle[orientation], \"hawa-gap-4\")}>\n {props.options &&\n props.options.map((opt, i) => (\n <div key={i} className=\"hawa-w-full hawa-rounded hawa-border\">\n <div\n className={cn(\n \"radio-item radio-item-bordered hawa-flex hawa-items-center hawa-transition-all\",\n props.direction === \"rtl\"\n ? \"margin-left right-19px\"\n : \"margin-right left-23px\"\n )}\n key={i + 1}\n >\n <input\n disabled={opt.disabled}\n id={opt.value.toString()}\n type=\"radio\"\n value={opt.value}\n name={name}\n onChange={() => handleChange(opt)}\n />\n <label\n htmlFor={opt.value.toString()}\n className={cn(\n \"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\",\n opt.disabled\n ? \"hawa-opacity-50\"\n : \"hawa-cursor-pointer hawa-text-gray-900\"\n )}\n >\n {opt.label}\n </label>\n </div>\n </div>\n ))}\n </div>\n );\n case \"cards\":\n return (\n <ul className={cn(orientationStyle[orientation], \"hawa-gap-4\")}>\n {props.options?.map((opt: any, o) => (\n <li key={o} onClick={() => handleChange(opt)}>\n <input\n type=\"radio\"\n id={opt.value.toString()}\n name={name}\n value={opt.value.toString()}\n className=\"hawa-peer hawa-hidden\"\n required\n disabled={opt.disabled}\n />\n <label\n htmlFor={opt.value.toString()}\n className={cn(\n \"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\",\n opt.disabled\n ? \"hawa-opacity-50\"\n : \"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\"\n )}\n >\n <div className=\"hawa-block hawa-h-full hawa-w-full\">\n <div className=\"hawa-w-full hawa-text-lg hawa-font-semibold\">\n {opt.label}\n </div>\n <div className=\"hawa-w-full\">{opt.sublabel}</div>\n </div>\n </label>\n </li>\n ))}\n </ul>\n );\n\n default:\n return (\n <div className=\"hawa-flex hawa-flex-col hawa-gap-2\">\n {props.label && <Label {...labelProps}>{props.label}</Label>}\n <div className={cn(orientationStyle[orientation], \"hawa-gap-2\")}>\n {props.options &&\n props.options.map((opt, i) => (\n <div\n className={cn(\n \"radio-item radio-item-default hawa-flex hawa-items-center hawa-transition-all\",\n props.direction === \"rtl\"\n ? \"margin-left right-3px\"\n : \"margin-right left-3px\"\n )}\n key={i + 1}\n >\n <input\n // TODO: spread the usual radio props\n disabled={opt.disabled}\n id={opt.value.toString()}\n type=\"radio\"\n value={opt.value}\n name={name}\n onChange={() => handleChange(opt)}\n />\n <label\n htmlFor={opt.value.toString()}\n className={cn(\n \"hawa-text-sm hawa-font-medium dark:hawa-text-white\",\n opt.disabled\n ? \"hawa-text-gray-400\"\n : \"hawa-cursor-pointer hawa-text-gray-900\"\n )}\n >\n {opt.label}\n </label>\n </div>\n ))}\n </div>\n <p\n className={cn(\n \"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all\",\n props.helperText\n ? \"hawa-h-4 hawa-opacity-100\"\n : \"hawa-h-0 hawa-opacity-0\"\n )}\n >\n {props.helperText}\n </p>\n </div>\n );\n }\n};\n","import * as React from \"react\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nimport { cn } from \"@util/index\";\nimport { Tooltip } from \"../tooltip\";\n\nexport type LabelProps = {\n hint?: React.ReactNode;\n hintSide?: PositionType;\n htmlFor?: string;\n required?: boolean;\n};\n\nconst Label = React.forwardRef<\n HTMLLabelElement,\n React.LabelHTMLAttributes<HTMLLabelElement> & LabelProps\n>(({ className, hint, hintSide, required, children, ...props }, ref) => (\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-1 hawa-transition-all\">\n <label\n ref={ref}\n className={cn(\n \"hawa-text-sm hawa-font-medium hawa-leading-none peer-disabled:hawa-cursor-not-allowed peer-disabled:hawa-opacity-70\",\n className\n )}\n {...props}\n >\n {children}\n {required && <span className=\"hawa-mx-0.5 hawa-text-red-500\">*</span>}\n </label>\n {hint && (\n <Tooltip\n content={hint}\n side={hintSide}\n triggerProps={{\n tabIndex: -1,\n onClick: (event) => event.preventDefault()\n }}\n >\n <div>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"hawa-h-[14px] hawa-w-[14px] hawa-cursor-help\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n </div>\n </Tooltip>\n )}\n </div>\n));\n\nLabel.displayName = \"Label\";\n\nexport { Label };\n","import React from \"react\";\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"@util/index\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & {\n size?: \"default\" | \"small\" | \"large\";\n }\n>(({ className, sideOffset = 4, size = \"default\", ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-text-popover-foreground hawa-shadow-md hawa-animate-in hawa-fade-in-0 hawa-zoom-in-95 data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=closed]:hawa-zoom-out-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2\",\n {\n \"hawa-text-xs\": size === \"small\",\n \"hawa-text-xl\": size === \"large\"\n },\n className\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nconst TooltipArrow = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <TooltipPrimitive.Arrow ref={ref} className={cn(className)} {...props} />\n));\nTooltipArrow.displayName = TooltipPrimitive.Arrow.displayName;\n\ntype TooltipTypes = {\n /** Controls the open state of the tooltip. */\n open?: any;\n /** Specifies the side where the tooltip will appear. */\n side?: PositionType;\n /** Content to be displayed within the tooltip. */\n content?: any;\n /** Elements to which the tooltip is anchored. */\n children?: any;\n /** Sets the default open state of the tooltip. */\n defaultOpen?: any;\n /** Event handler for open state changes. */\n onOpenChange?: any;\n /** Duration of the delay before the tooltip appears. */\n delayDuration?: any;\n /** Size of the tooltip. */\n size?: \"default\" | \"small\" | \"large\";\n /** Disables the tooltip. */\n disabled?: boolean;\n triggerProps?: TooltipPrimitive.TooltipTriggerProps;\n contentProps?: TooltipPrimitive.TooltipContentProps;\n providerProps?: TooltipPrimitive.TooltipProviderProps;\n};\n\nconst Tooltip: React.FunctionComponent<TooltipTypes> = ({\n side,\n size,\n open,\n content,\n children,\n disabled,\n defaultOpen,\n onOpenChange,\n triggerProps,\n contentProps,\n providerProps,\n delayDuration = 300,\n ...props\n}) => {\n return (\n <TooltipPrimitive.TooltipProvider\n delayDuration={delayDuration}\n {...providerProps}\n >\n <TooltipPrimitive.Root\n open={!disabled && open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n {...props}\n >\n <TooltipPrimitive.Trigger {...triggerProps}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipContent\n size={size}\n side={side}\n align=\"center\"\n {...contentProps}\n style={{\n ...contentProps?.style,\n maxWidth: \"var(--radix-tooltip-content-available-width)\",\n maxHeight: \"var(--radix-tooltip-content-available-height)\"\n }}\n >\n {content}\n </TooltipContent>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.TooltipProvider>\n );\n};\n\nexport { Tooltip };\n"],"mappings":";;;AAAA,OAAOA,UAAa,YAAAC,iBAAgB;;;ACApC,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACLA,OAAOC,UAAS,UAAc,QAAQ,iBAAiB;;;ACAvD,YAAY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AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA,cAAc;AAAA,MACd,UAAU,CAAC,MAAW;AACpB,YAAI,iBAAiB;AACnB,0BAAgB,EAAE,KAAK;AAAA,QACzB;AACA,iBAAS,CAAC;AAAA,MACZ;AAAA,MACA,QAAO;AAAA,MACP,SAAS;AAAA,QACP;AAAA,UACE,OAAO;AAAA,UACP,OACE,gBAAAA,OAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAM;AAAA,cACN,QAAO;AAAA,cACP,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,OAAM;AAAA,cACN,WAAU;AAAA;AAAA,YAEV,gBAAAA,OAAA;AAAA,cAAC;AAAA;AAAA,gBACC,GAAE;AAAA,gBACF,MAAK;AAAA;AAAA,YACN;AAAA,UACH;AAAA,QAEJ;AAAA,QACA;AAAA,UACE,OAAO;AAAA,UACP,OACE,gBAAAA,OAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAM;AAAA,cACN,OAAM;AAAA,cACN,QAAO;AAAA,cACP,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,QAAO;AAAA,cACP,WAAU;AAAA;AAAA,YAEV,gBAAAA,OAAA,cAAC,UAAK,GAAE,sCAAqC;AAAA,UAC/C;AAAA,QAEJ;AAAA,MACF;AAAA;AAAA,EACF,CACF;AAEJ;","names":["React","useState","React","React","React","_a","useState","React"]}
|
1
|
+
{"version":3,"sources":["../../elements/interfaceSettings/InterfaceSettings.tsx","../../util/index.ts","../../elements/radio/Radio.tsx","../../elements/label/Label.tsx","../../elements/tooltip/Tooltip.tsx"],"sourcesContent":["import React, { FC, useState } from \"react\";\n\nimport { cn } from \"@util/index\";\n\nimport { OrientationType } from \"@_types/commonTypes\";\n\nimport { Radio } from \"../radio/Radio\";\n\ntype TypographyTypes = {\n /** Function to handle language change. */\n handleLanguage?: (e: any) => void;\n /** Current selected language. */\n currentLanguage?: string;\n /** Function to handle theme color mode change. */\n handleColorMode?: (e: any) => void;\n /** Current selected theme color mode. */\n currentColorMode?: \"light\" | \"dark\";\n orientation?: OrientationType;\n width?: \"default\" | \"full\";\n};\nexport const InterfaceSettings: FC<TypographyTypes> = ({\n orientation = \"horizontal\",\n width = \"default\",\n handleColorMode,\n handleLanguage,\n ...props\n}) => {\n const [color, setColor] = useState(props.currentColorMode);\n const [language, setLanguage] = useState(props.currentLanguage);\n let orientationStyle = {\n horizontal: \"hawa-flex hawa-flex-row hawa-justify-between\",\n vertical: \"hawa-flex hawa-flex-col hawa-items-center hawa-gap-2\"\n };\n return (\n <div className={cn(orientationStyle[orientation])}>\n <Radio\n name=\"language\"\n width={width}\n defaultValue={language}\n onChange={(e: any) => {\n if (handleLanguage) {\n handleLanguage(e.value);\n }\n setLanguage(e);\n }}\n design=\"tabs\"\n options={[\n { value: \"ar\", label: \"عربي\" },\n { value: \"en\", label: \"English\" }\n ]}\n />\n <Radio\n name=\"theme\"\n width={width}\n defaultValue={color}\n onChange={(e: any) => {\n if (handleColorMode) {\n handleColorMode(e.value);\n }\n setColor(e);\n }}\n design=\"tabs\"\n options={[\n {\n value: \"light\",\n label: (\n <svg\n width=\"15\"\n height=\"15\"\n viewBox=\"0 0 15 15\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"hawa-h-[1.2rem] hawa-w-[1.2rem] hawa-rotate-0 hawa-scale-100 hawa-transition-all dark:hawa--rotate-90\"\n >\n <path\n d=\"M7.5 0C7.77614 0 8 0.223858 8 0.5V2.5C8 2.77614 7.77614 3 7.5 3C7.22386 3 7 2.77614 7 2.5V0.5C7 0.223858 7.22386 0 7.5 0ZM2.1967 2.1967C2.39196 2.00144 2.70854 2.00144 2.90381 2.1967L4.31802 3.61091C4.51328 3.80617 4.51328 4.12276 4.31802 4.31802C4.12276 4.51328 3.80617 4.51328 3.61091 4.31802L2.1967 2.90381C2.00144 2.70854 2.00144 2.39196 2.1967 2.1967ZM0.5 7C0.223858 7 0 7.22386 0 7.5C0 7.77614 0.223858 8 0.5 8H2.5C2.77614 8 3 7.77614 3 7.5C3 7.22386 2.77614 7 2.5 7H0.5ZM2.1967 12.8033C2.00144 12.608 2.00144 12.2915 2.1967 12.0962L3.61091 10.682C3.80617 10.4867 4.12276 10.4867 4.31802 10.682C4.51328 10.8772 4.51328 11.1938 4.31802 11.3891L2.90381 12.8033C2.70854 12.9986 2.39196 12.9986 2.1967 12.8033ZM12.5 7C12.2239 7 12 7.22386 12 7.5C12 7.77614 12.2239 8 12.5 8H14.5C14.7761 8 15 7.77614 15 7.5C15 7.22386 14.7761 7 14.5 7H12.5ZM10.682 4.31802C10.4867 4.12276 10.4867 3.80617 10.682 3.61091L12.0962 2.1967C12.2915 2.00144 12.608 2.00144 12.8033 2.1967C12.9986 2.39196 12.9986 2.70854 12.8033 2.90381L11.3891 4.31802C11.1938 4.51328 10.8772 4.51328 10.682 4.31802ZM8 12.5C8 12.2239 7.77614 12 7.5 12C7.22386 12 7 12.2239 7 12.5V14.5C7 14.7761 7.22386 15 7.5 15C7.77614 15 8 14.7761 8 14.5V12.5ZM10.682 10.682C10.8772 10.4867 11.1938 10.4867 11.3891 10.682L12.8033 12.0962C12.9986 12.2915 12.9986 12.608 12.8033 12.8033C12.608 12.9986 12.2915 12.9986 12.0962 12.8033L10.682 11.3891C10.4867 11.1938 10.4867 10.8772 10.682 10.682ZM5.5 7.5C5.5 6.39543 6.39543 5.5 7.5 5.5C8.60457 5.5 9.5 6.39543 9.5 7.5C9.5 8.60457 8.60457 9.5 7.5 9.5C6.39543 9.5 5.5 8.60457 5.5 7.5ZM7.5 4.5C5.84315 4.5 4.5 5.84315 4.5 7.5C4.5 9.15685 5.84315 10.5 7.5 10.5C9.15685 10.5 10.5 9.15685 10.5 7.5C10.5 5.84315 9.15685 4.5 7.5 4.5Z\"\n fill=\"currentColor\"\n ></path>\n </svg>\n )\n },\n {\n value: \"dark\",\n label: (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n className=\"hawa-h-[1.2rem] hawa-w-[1.2rem] hawa-transition-all dark:hawa-rotate-0 dark:hawa-scale-100\"\n >\n <path d=\"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z\"></path>\n </svg>\n )\n }\n ]}\n />\n </div>\n );\n};\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\ntype Palette = {\n name: string;\n colors: {\n [key: number]: string;\n };\n};\ntype Rgb = {\n r: number;\n g: number;\n b: number;\n};\nfunction hexToRgb(hex: string): Rgb | null {\n const sanitizedHex = hex.replaceAll(\"##\", \"#\");\n const colorParts = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(\n sanitizedHex\n );\n\n if (!colorParts) {\n return null;\n }\n\n const [, r, g, b] = colorParts;\n\n return {\n r: parseInt(r, 16),\n g: parseInt(g, 16),\n b: parseInt(b, 16)\n } as Rgb;\n}\n\nfunction rgbToHex(r: number, g: number, b: number): string {\n const toHex = (c: number) => `0${c.toString(16)}`.slice(-2);\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n}\n\nexport function getTextColor(color: string): \"#FFF\" | \"#333\" {\n const rgbColor = hexToRgb(color);\n\n if (!rgbColor) {\n return \"#333\";\n }\n\n const { r, g, b } = rgbColor;\n const luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n return luma < 120 ? \"#FFF\" : \"#333\";\n}\n\nfunction lighten(hex: string, intensity: number): string {\n const color = hexToRgb(`#${hex}`);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r + (255 - color.r) * intensity);\n const g = Math.round(color.g + (255 - color.g) * intensity);\n const b = Math.round(color.b + (255 - color.b) * intensity);\n\n return rgbToHex(r, g, b);\n}\n\nfunction darken(hex: string, intensity: number): string {\n const color = hexToRgb(hex);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r * intensity);\n const g = Math.round(color.g * intensity);\n const b = Math.round(color.b * intensity);\n\n return rgbToHex(r, g, b);\n}\nconst parseColor = (color: any) => {\n if (color.startsWith(\"#\")) {\n // Convert hex to RGB\n let r = parseInt(color.slice(1, 3), 16);\n let g = parseInt(color.slice(3, 5), 16);\n let b = parseInt(color.slice(5, 7), 16);\n return [r, g, b];\n } else if (color.startsWith(\"rgb\")) {\n // Extract RGB values from rgb() format\n return color.match(/\\d+/g).map(Number);\n }\n // Default to white if format is unrecognized\n return [255, 255, 255];\n};\nexport const calculateLuminance = (color: any) => {\n const [r, g, b] = parseColor(color)?.map((c: any) => {\n c /= 255;\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nfunction getPallette(baseColor: string): Palette {\n const name = baseColor;\n\n const response: Palette = {\n name,\n colors: {\n 500: `#${baseColor}`.replace(\"##\", \"#\")\n }\n };\n\n const intensityMap: {\n [key: number]: number;\n } = {\n 50: 0.95,\n 100: 0.9,\n 200: 0.75,\n 300: 0.6,\n 400: 0.3,\n 600: 0.9,\n 700: 0.75,\n 800: 0.6,\n 900: 0.49\n };\n\n [50, 100, 200, 300, 400].forEach((level) => {\n response.colors[level] = lighten(baseColor, intensityMap[level]);\n });\n [600, 700, 800, 900].forEach((level) => {\n response.colors[level] = darken(baseColor, intensityMap[level]);\n });\n\n return response as Palette;\n}\n\nexport { getPallette };\n\n// const hexToRgb = (hex) => {\n// let d = hex?.split(\"#\")[1];\n// var aRgbHex = d?.match(/.{1,2}/g);\n// var aRgb = [\n// parseInt(aRgbHex[0], 16),\n// parseInt(aRgbHex[1], 16),\n// parseInt(aRgbHex[2], 16)\n// ];\n// return aRgb;\n// };\n// const getTextColor = (backColor) => {\n// let rgbArray = hexToRgb(backColor);\n// if (rgbArray[0] * 0.299 + rgbArray[1] * 0.587 + rgbArray[2] * 0.114 > 186) {\n// return \"#000000\";\n// } else {\n// return \"#ffffff\";\n// }\n// };\n// const replaceAt = function (string, index, replacement) {\n// // if (replacement == \"\" || replacement == \" \") {\n// // return (\n// // string.substring(0, index) +\n// // string.substring(index + replacement.length )\n// // );\n// // }\n// const replaced = string.substring(0, index) + replacement + string.substring(index + 1)\n// return replaced\n// };\n\n// export { hexToRgb, getTextColor, replaceAt };\n","import React, { useState, FC, useRef, useEffect, forwardRef } from \"react\";\n\nimport { cn } from \"@util/index\";\n\nimport { DirectionType, OrientationType } from \"../../types/commonTypes\";\nimport { Label, LabelProps } from \"../label/Label\";\n\nexport type RadioOptionsTypes = {\n value: any;\n label: any;\n disabled?: any;\n sublabel?: any;\n icon?: any;\n};\n\ntype RadioTypes = {\n /** Required to enable selection and differentiate between different Radio instances. */\n name: string;\n disabled?: boolean;\n orientation?: OrientationType;\n design?: \"default\" | \"tabs\" | \"cards\" | \"bordered\";\n width?: \"default\" | \"full\" | \"none\";\n size?: \"default\" | \"lg\" | \"sm\" | \"xs\";\n options: RadioOptionsTypes[];\n onChange?: any;\n defaultValue?: any;\n value?: any;\n direction?: DirectionType;\n helperText?: string;\n labelProps?: LabelProps;\n label?: string;\n tabsContainerClassName?: string;\n forceHideHelperText?: boolean;\n};\n\nexport const Radio = forwardRef<HTMLInputElement, RadioTypes>(\n (\n {\n design = \"default\",\n width = \"default\",\n size = \"default\",\n orientation = \"horizontal\",\n name,\n labelProps,\n tabsContainerClassName,\n forceHideHelperText = false,\n onChange,\n ...props\n },\n ref,\n ) => {\n const [selectedOption, setSelectedOption] = useState(\n props.defaultValue || props.value,\n );\n let activeTabStyle =\n \"hawa-inline-block hawa-w-full hawa-text-primary-foreground hawa-bg-primary hawa-active dark:hawa-bg-primary\";\n let inactiveTabStyle = `hawa-inline-block hawa-w-full hawa-transition-all hawa-bg-primary-foreground dark:hover:hawa-text-white\n ${props.disabled ? \"\" : \"hover:hawa-bg-muted\"}`;\n let orientationStyle = {\n horizontal: \"hawa-flex hawa-flex-row\",\n vertical: \"hawa-flex hawa-flex-col\",\n };\n\n let tabSizeStyle = {\n default: \"hawa-py-2 hawa-px-4 hawa-text-sm\",\n lg: \"hawa-py-2 hawa-px-4\",\n sm: \"hawa-p-1.5 hawa-text-xs\",\n xs: \"hawa-p-1 hawa-text-[10px]\",\n };\n let widthStyle = {\n none: \"\",\n default: \"hawa-max-w-fit\",\n full: \"hawa-w-full\",\n };\n const [parentDirection, setParentDirection] = React.useState<string | null>(\n null,\n );\n const parentRef = useRef<HTMLUListElement>(null);\n\n useEffect(() => {\n const parentNode = parentRef.current?.parentNode as HTMLElement | null;\n if (parentNode) {\n const dir = window.getComputedStyle(parentNode).direction;\n setParentDirection(dir);\n }\n });\n\n const handleChange = (opt: RadioOptionsTypes) => {\n setSelectedOption(opt.value);\n if (onChange) {\n // use the more generic onChange prop\n onChange(opt.value); // You can pass the entire option or just the value\n } else {\n console.log(\"onChange was not provided\");\n }\n };\n switch (design) {\n case \"tabs\":\n return (\n <div className=\"hawa-gap-2 hawa-flex hawa-flex-col\">\n {props.label && <Label {...labelProps}>{props.label}</Label>}\n\n <ul\n ref={parentRef}\n className={cn(\n props.options && props.options?.length > 2\n ? \"hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap\"\n : \"\",\n \"hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium\",\n orientationStyle[orientation],\n widthStyle[width],\n tabsContainerClassName,\n )}\n >\n {props.options?.map((opt: any, o) => (\n <li\n aria-current=\"page\"\n onClick={() => {\n if (props.disabled) return;\n handleChange(opt);\n }}\n className={cn(\n \"hawa-w-full hawa-last hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2 \",\n !props.disabled && \"hawa-cursor-pointer\",\n orientation === \"horizontal\" &&\n parentDirection === \"ltr\" &&\n \"hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r\",\n orientation === \"horizontal\" &&\n parentDirection === \"rtl\" &&\n \"hawa-rounded-none first:hawa-rounded-r last:hawa-rounded-l\",\n orientation === \"vertical\" &&\n \"hawa-rounded-none first:hawa-rounded-t last:hawa-rounded-b\",\n tabSizeStyle[size],\n selectedOption === opt.value\n ? activeTabStyle\n : inactiveTabStyle,\n )}\n key={o}\n >\n {opt.icon && opt.icon}\n {opt.label}\n </li>\n ))}\n </ul>\n {!forceHideHelperText && (\n <p\n className={cn(\n \"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all\",\n props.helperText\n ? \"hawa-h-4 hawa-opacity-100\"\n : \"hawa-h-0 hawa-opacity-0\",\n )}\n >\n {props.helperText}\n </p>\n )}\n </div>\n );\n case \"bordered\":\n return (\n <div className={cn(orientationStyle[orientation], \"hawa-gap-4\")}>\n {props.options &&\n props.options.map((opt, i) => (\n <div key={i} className=\"hawa-w-full hawa-rounded hawa-border\">\n <div\n className={cn(\n \"radio-item radio-item-bordered hawa-flex hawa-items-center hawa-transition-all\",\n props.direction === \"rtl\"\n ? \"margin-left right-19px\"\n : \"margin-right left-23px\",\n )}\n key={i + 1}\n >\n <input\n disabled={opt.disabled}\n id={opt.value.toString()}\n type=\"radio\"\n value={opt.value}\n name={name}\n onChange={() => handleChange(opt)}\n />\n <label\n htmlFor={opt.value.toString()}\n className={cn(\n \"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\",\n opt.disabled\n ? \"hawa-opacity-50\"\n : \"hawa-cursor-pointer hawa-text-gray-900\",\n )}\n >\n {opt.label}\n </label>\n </div>\n </div>\n ))}\n </div>\n );\n case \"cards\":\n return (\n <ul className={cn(orientationStyle[orientation], \"hawa-gap-4\")}>\n {props.options?.map((opt: any, o) => (\n <li key={o} onClick={() => handleChange(opt)}>\n <input\n type=\"radio\"\n id={opt.value.toString()}\n name={name}\n value={opt.value.toString()}\n className=\"hawa-peer hawa-hidden\"\n required\n disabled={opt.disabled}\n />\n <label\n htmlFor={opt.value.toString()}\n className={cn(\n \"hawa-inline-flex hawa-h-full hawa-w-full hawa-transition-all hawa-items-center hawa-justify-between hawa-rounded-lg hawa-border hawa-border-gray-200 hawa-bg-background 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-foreground/5 dark:hawa-text-gray-400 dark:peer-checked:hawa-text-primary\",\n opt.disabled\n ? \"hawa-opacity-50\"\n : \"hawa-cursor-pointer hover:hawa-bg-foreground/10 hover:hawa-text-gray-600 dark:hover:hawa-bg-foreground/20 dark:hover:hawa-text-gray-300\",\n )}\n >\n <div className=\"hawa-block hawa-h-full hawa-w-full\">\n <div className=\"hawa-w-full hawa-text-lg hawa-font-semibold\">\n {opt.label}\n </div>\n <div className=\"hawa-w-full\">{opt.sublabel}</div>\n </div>\n </label>\n </li>\n ))}\n </ul>\n );\n\n default:\n return (\n <div className=\"hawa-flex hawa-flex-col hawa-gap-2\">\n {props.label && <Label {...labelProps}>{props.label}</Label>}\n <div className={cn(orientationStyle[orientation], \"hawa-gap-2\")}>\n {props.options &&\n props.options.map((opt, i) => (\n <div\n className={cn(\n \"radio-item radio-item-default hawa-flex hawa-items-center hawa-transition-all\",\n props.direction === \"rtl\"\n ? \"margin-left right-3px\"\n : \"margin-right left-3px\",\n )}\n key={i + 1}\n >\n <input\n // TODO: spread the usual radio props\n disabled={opt.disabled}\n id={opt.value.toString()}\n type=\"radio\"\n value={opt.value}\n name={name}\n onChange={() => handleChange(opt)}\n />\n <label\n htmlFor={opt.value.toString()}\n className={cn(\n \"hawa-text-sm hawa-font-medium dark:hawa-text-white\",\n opt.disabled\n ? \"hawa-text-gray-400\"\n : \"hawa-cursor-pointer hawa-text-gray-900\",\n )}\n >\n {opt.label}\n </label>\n </div>\n ))}\n </div>\n <p\n className={cn(\n \"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all\",\n props.helperText\n ? \"hawa-h-4 hawa-opacity-100\"\n : \"hawa-h-0 hawa-opacity-0\",\n )}\n >\n {props.helperText}\n </p>\n </div>\n );\n }\n },\n);\n","import * as React from \"react\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nimport { cn } from \"@util/index\";\nimport { Tooltip } from \"../tooltip\";\n\nexport type LabelProps = {\n hint?: React.ReactNode;\n hintSide?: PositionType;\n htmlFor?: string;\n required?: boolean;\n};\n\nconst Label = React.forwardRef<\n HTMLLabelElement,\n React.LabelHTMLAttributes<HTMLLabelElement> & LabelProps\n>(({ className, hint, hintSide, required, children, ...props }, ref) => (\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-1 hawa-transition-all\">\n <label\n ref={ref}\n className={cn(\n \"hawa-text-sm hawa-font-medium hawa-leading-none peer-disabled:hawa-cursor-not-allowed peer-disabled:hawa-opacity-70\",\n className\n )}\n {...props}\n >\n {children}\n {required && <span className=\"hawa-mx-0.5 hawa-text-red-500\">*</span>}\n </label>\n {hint && (\n <Tooltip\n content={hint}\n side={hintSide}\n triggerProps={{\n tabIndex: -1,\n onClick: (event) => event.preventDefault()\n }}\n >\n <div>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"hawa-h-[14px] hawa-w-[14px] hawa-cursor-help\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n </div>\n </Tooltip>\n )}\n </div>\n));\n\nLabel.displayName = \"Label\";\n\nexport { Label };\n","import React from \"react\";\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"@util/index\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & {\n size?: \"default\" | \"small\" | \"large\";\n }\n>(({ className, sideOffset = 4, size = \"default\", ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-text-popover-foreground hawa-shadow-md hawa-animate-in hawa-fade-in-0 hawa-zoom-in-95 data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=closed]:hawa-zoom-out-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2\",\n {\n \"hawa-text-xs\": size === \"small\",\n \"hawa-text-xl\": size === \"large\"\n },\n className\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nconst TooltipArrow = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <TooltipPrimitive.Arrow ref={ref} className={cn(className)} {...props} />\n));\nTooltipArrow.displayName = TooltipPrimitive.Arrow.displayName;\n\ntype TooltipTypes = {\n /** Controls the open state of the tooltip. */\n open?: any;\n /** Specifies the side where the tooltip will appear. */\n side?: PositionType;\n /** Content to be displayed within the tooltip. */\n content?: any;\n /** Elements to which the tooltip is anchored. */\n children?: any;\n /** Sets the default open state of the tooltip. */\n defaultOpen?: any;\n /** Event handler for open state changes. */\n onOpenChange?: any;\n /** Duration of the delay before the tooltip appears. */\n delayDuration?: any;\n /** Size of the tooltip. */\n size?: \"default\" | \"small\" | \"large\";\n /** Disables the tooltip. */\n disabled?: boolean;\n triggerProps?: TooltipPrimitive.TooltipTriggerProps;\n contentProps?: TooltipPrimitive.TooltipContentProps;\n providerProps?: TooltipPrimitive.TooltipProviderProps;\n};\n\nconst Tooltip: React.FunctionComponent<TooltipTypes> = ({\n side,\n size,\n open,\n content,\n children,\n disabled,\n defaultOpen,\n onOpenChange,\n triggerProps,\n contentProps,\n providerProps,\n delayDuration = 300,\n ...props\n}) => {\n return (\n <TooltipPrimitive.TooltipProvider\n delayDuration={delayDuration}\n {...providerProps}\n >\n <TooltipPrimitive.Root\n open={!disabled && open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n {...props}\n >\n <TooltipPrimitive.Trigger {...triggerProps}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipContent\n size={size}\n side={side}\n align=\"center\"\n {...contentProps}\n style={{\n ...contentProps?.style,\n maxWidth: \"var(--radix-tooltip-content-available-width)\",\n maxHeight: \"var(--radix-tooltip-content-available-height)\"\n }}\n >\n {content}\n </TooltipContent>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.TooltipProvider>\n );\n};\n\nexport { Tooltip };\n"],"mappings":";;;AAAA,OAAOA,UAAa,YAAAC,iBAAgB;;;ACApC,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACLA,OAAOC,UAAS,UAAc,QAAQ,WAAW,cAAAC,mBAAkB;;;ACAnE,YAAYC,YAAW;;;ACAvB,OAAO,WAAW;AAElB,YAAY,sBAAsB;AAKlC,IAAM,iBAAiB,MAAM,WAK3B,CAAC,EAAE,WAAW,aAAa,GAAG,OAAO,WAAW,GAAG,MAAM,GAAG,QAC5D;AAAA,EAAkB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,QACE,gBAAgB,SAAS;AAAA,QACzB,gBAAgB,SAAS;AAAA,MAC3B;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,CACD;AACD,eAAe,cAA+B,yBAAQ;AAEtD,IAAM,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AAM;AAAA,cACN,WAAU;AAAA;AAAA,YAEV,gBAAAA,OAAA;AAAA,cAAC;AAAA;AAAA,gBACC,GAAE;AAAA,gBACF,MAAK;AAAA;AAAA,YACN;AAAA,UACH;AAAA,QAEJ;AAAA,QACA;AAAA,UACE,OAAO;AAAA,UACP,OACE,gBAAAA,OAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAM;AAAA,cACN,OAAM;AAAA,cACN,QAAO;AAAA,cACP,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,QAAO;AAAA,cACP,WAAU;AAAA;AAAA,YAEV,gBAAAA,OAAA,cAAC,UAAK,GAAE,sCAAqC;AAAA,UAC/C;AAAA,QAEJ;AAAA,MACF;AAAA;AAAA,EACF,CACF;AAEJ;","names":["React","useState","React","forwardRef","React","forwardRef","React","_a","useState","React"]}
|
package/dist/layout/index.d.mts
CHANGED
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
2
2
|
import React__default, { FC } from 'react';
|
3
3
|
import { D as DirectionType } from '../commonTypes-CKtkuNFH.mjs';
|
4
4
|
import { C as ChipColors } from '../Chip-hr2gRBJ-.mjs';
|
5
|
-
import { M as MenuItemType } from '../DropdownMenu-
|
5
|
+
import { M as MenuItemType } from '../DropdownMenu-arqV1gRt.mjs';
|
6
6
|
import * as MenubarPrimitive from '@radix-ui/react-menubar';
|
7
7
|
import '@radix-ui/react-dropdown-menu';
|
8
8
|
|
package/dist/layout/index.d.ts
CHANGED
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
2
2
|
import React__default, { FC } from 'react';
|
3
3
|
import { D as DirectionType } from '../commonTypes-CKtkuNFH.js';
|
4
4
|
import { C as ChipColors } from '../Chip-H5BnuDdx.js';
|
5
|
-
import { M as MenuItemType } from '../DropdownMenu-
|
5
|
+
import { M as MenuItemType } from '../DropdownMenu-sSnQc6fT.js';
|
6
6
|
import * as MenubarPrimitive from '@radix-ui/react-menubar';
|
7
7
|
import '@radix-ui/react-dropdown-menu';
|
8
8
|
|
package/dist/layout/index.js
CHANGED
@@ -1372,7 +1372,11 @@ var AppLayout = ({
|
|
1372
1372
|
let openDrawerWidth = 200;
|
1373
1373
|
let drawerSizeStyle = {
|
1374
1374
|
opened: { sm: "100", md: openDrawerWidth, lg: "250" },
|
1375
|
-
closed: {
|
1375
|
+
closed: {
|
1376
|
+
sm: closeDrawerWidth,
|
1377
|
+
md: closeDrawerWidth,
|
1378
|
+
lg: closeDrawerWidth
|
1379
|
+
}
|
1376
1380
|
};
|
1377
1381
|
const ref = (0, import_react8.useRef)(null);
|
1378
1382
|
const isRTL = direction === "rtl";
|
@@ -1485,7 +1489,7 @@ var AppLayout = ({
|
|
1485
1489
|
sideOffset: 5,
|
1486
1490
|
width: profileMenuWidth,
|
1487
1491
|
direction: isRTL ? "rtl" : "ltr",
|
1488
|
-
items: props.profileMenuItems,
|
1492
|
+
items: props.profileMenuItems || [],
|
1489
1493
|
onItemSelect: (e) => console.log("selecting item ", e),
|
1490
1494
|
trigger: /* @__PURE__ */ import_react8.default.createElement("div", { className: "hawa-relative hawa-h-8 hawa-w-8 hawa-cursor-pointer hawa-overflow-clip hawa-rounded hawa-ring-1 hawa-ring-primary/30 dark:hawa-bg-gray-600" }, props.avatarImage ? /* @__PURE__ */ import_react8.default.createElement("img", { src: props.avatarImage, alt: "User Avatar" }) : /* @__PURE__ */ import_react8.default.createElement(
|
1491
1495
|
"svg",
|
@@ -1785,7 +1789,7 @@ var AppTopbar = ({ ...props }) => {
|
|
1785
1789
|
side: "bottom",
|
1786
1790
|
sideOffset: 5,
|
1787
1791
|
direction: isRTL ? "rtl" : "ltr",
|
1788
|
-
items: props.profileMenuItems,
|
1792
|
+
items: props.profileMenuItems || [],
|
1789
1793
|
onItemSelect: (e) => console.log("selecting item ", e),
|
1790
1794
|
trigger: /* @__PURE__ */ import_react9.default.createElement("div", { className: "hawa-relative hawa-h-8 hawa-w-8 hawa-cursor-pointer hawa-overflow-clip hawa-rounded hawa-ring-1 hawa-ring-primary/30 dark:hawa-bg-gray-600" }, props.avatarImage ? /* @__PURE__ */ import_react9.default.createElement("img", { src: props.avatarImage, alt: "User Avatar" }) : /* @__PURE__ */ import_react9.default.createElement(
|
1791
1795
|
"svg",
|