@teach-in/react 1.4.0 → 1.6.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/dist/{chunk-2UHA3DYG.mjs → chunk-6BWSC6ZH.mjs} +3 -10
- package/dist/chunk-7WIZONLU.mjs +81 -0
- package/dist/chunk-ALGSVEUS.mjs +1 -0
- package/dist/chunk-BHOCYKBI.mjs +81 -0
- package/dist/{chunk-VXYV37IM.mjs → chunk-C5FQB2UN.mjs} +16 -8
- package/dist/{chunk-CKJ5U5Q4.mjs → chunk-DEKPRZIQ.mjs} +1 -1
- package/dist/chunk-GEPCSZCU.mjs +71 -0
- package/dist/chunk-GTE5VEBV.mjs +68 -0
- package/dist/{chunk-UFYLYN5Z.mjs → chunk-QFWSQOF6.mjs} +20 -2
- package/dist/chunk-VDPROXMN.mjs +57 -0
- package/dist/{chunk-J3OZNLTZ.mjs → chunk-WG4IPOHE.mjs} +5 -5
- package/dist/{chunk-R46SWVWL.mjs → chunk-ZK6VZMUJ.mjs} +1 -1
- package/dist/index.js +536 -253
- package/dist/index.mjs +140 -132
- package/dist/ui/data/index.js +56 -7
- package/dist/ui/data/index.mjs +12 -10
- package/dist/ui/data/user/index.js +51 -2
- package/dist/ui/data/user/index.mjs +3 -1
- package/dist/ui/data/user/user.d.ts +24 -2
- package/dist/ui/data/user/user.js +52 -2
- package/dist/ui/data/user/user.mjs +4 -1
- package/dist/ui/feedback/index.mjs +7 -7
- package/dist/ui/form/index.js +76 -18
- package/dist/ui/form/index.mjs +25 -20
- package/dist/ui/form/rhf/fields/autocomplete-field.mjs +20 -15
- package/dist/ui/form/rhf/fields/checkbox-field.mjs +20 -15
- package/dist/ui/form/rhf/fields/date-picker-field.mjs +20 -15
- package/dist/ui/form/rhf/fields/email-field.js +58 -3
- package/dist/ui/form/rhf/fields/email-field.mjs +21 -16
- package/dist/ui/form/rhf/fields/index.js +76 -18
- package/dist/ui/form/rhf/fields/index.mjs +22 -17
- package/dist/ui/form/rhf/fields/input-field.mjs +20 -15
- package/dist/ui/form/rhf/fields/radio-field.mjs +20 -15
- package/dist/ui/form/rhf/fields/search-field.mjs +20 -15
- package/dist/ui/form/rhf/fields/select-field.js +18 -15
- package/dist/ui/form/rhf/fields/select-field.mjs +21 -16
- package/dist/ui/form/rhf/fields/switch-field.mjs +20 -15
- package/dist/ui/form/rhf/fields/text-field.mjs +20 -15
- package/dist/ui/form/rhf/fields/textarea-field.mjs +20 -15
- package/dist/ui/form/rhf/index.js +76 -18
- package/dist/ui/form/rhf/index.mjs +22 -17
- package/dist/ui/format/index.mjs +12 -12
- package/dist/ui/index.js +536 -253
- package/dist/ui/index.mjs +140 -132
- package/dist/ui/inputs/checkbox/index.mjs +3 -3
- package/dist/ui/inputs/email/email.js +58 -3
- package/dist/ui/inputs/email/email.mjs +1 -1
- package/dist/ui/inputs/email/index.js +58 -3
- package/dist/ui/inputs/email/index.mjs +1 -1
- package/dist/ui/inputs/index.d.ts +1 -0
- package/dist/ui/inputs/index.js +305 -69
- package/dist/ui/inputs/index.mjs +35 -25
- package/dist/ui/inputs/number/index.d.ts +1 -0
- package/dist/ui/inputs/number/index.js +218 -0
- package/dist/ui/inputs/number/index.mjs +12 -0
- package/dist/ui/inputs/number/number.d.ts +12 -0
- package/dist/ui/inputs/number/number.js +219 -0
- package/dist/ui/inputs/number/number.mjs +13 -0
- package/dist/ui/inputs/number/use-number.d.ts +20 -0
- package/dist/ui/inputs/number/use-number.js +104 -0
- package/dist/ui/inputs/number/use-number.mjs +7 -0
- package/dist/ui/inputs/select/index.d.ts +1 -1
- package/dist/ui/inputs/select/index.js +23 -17
- package/dist/ui/inputs/select/index.mjs +8 -4
- package/dist/ui/inputs/select/select.d.ts +11 -22
- package/dist/ui/inputs/select/select.js +23 -17
- package/dist/ui/inputs/select/select.mjs +8 -4
- package/dist/ui/inputs/select/use-select.d.ts +0 -1
- package/dist/ui/inputs/select/use-select.js +2 -9
- package/dist/ui/inputs/select/use-select.mjs +1 -1
- package/dist/ui/inputs/switch/favorite-switch.d.ts +23 -2
- package/dist/ui/inputs/switch/favorite-switch.js +34 -4
- package/dist/ui/inputs/switch/favorite-switch.mjs +1 -1
- package/dist/ui/inputs/switch/index.js +34 -4
- package/dist/ui/inputs/switch/index.mjs +1 -1
- package/dist/ui/layout/container/container.mjs +67 -64
- package/dist/ui/layout/container/index.mjs +67 -64
- package/dist/ui/layout/index.js +7 -7
- package/dist/ui/layout/index.mjs +71 -68
- package/dist/ui/layout/page/index.mjs +4 -4
- package/dist/ui/layout/page/page-loading.mjs +4 -4
- package/dist/ui/layout/page/section-loading.mjs +4 -4
- package/dist/ui/navigation/index.mjs +5 -5
- package/dist/ui/overlays/index.mjs +4 -4
- package/dist/ui/provider/index.mjs +4 -4
- package/dist/ui/provider/ui-provider.mjs +4 -4
- package/dist/ui/surface/bento/bento.d.ts +2 -2
- package/dist/ui/surface/bento/bento.js +5 -5
- package/dist/ui/surface/bento/bento.mjs +1 -1
- package/dist/ui/surface/bento/index.js +5 -5
- package/dist/ui/surface/bento/index.mjs +1 -1
- package/dist/ui/surface/card/card.d.ts +2427 -5
- package/dist/ui/surface/card/card.js +29 -2
- package/dist/ui/surface/card/card.mjs +5 -1
- package/dist/ui/surface/card/index.js +29 -2
- package/dist/ui/surface/card/index.mjs +5 -1
- package/dist/ui/surface/index.js +34 -7
- package/dist/ui/surface/index.mjs +9 -5
- package/dist/ui/theme/colors/index.mjs +1 -1
- package/dist/ui/theme/colors.mjs +1 -1
- package/dist/ui/theme/index.mjs +1 -1
- package/dist/ui/theme/theme.d.ts +2 -1
- package/dist/ui/theme/theme.mjs +1 -1
- package/package.json +13 -9
- package/LICENSE +0 -21
- package/dist/chunk-46SKVFMZ.mjs +0 -16
- package/dist/chunk-E5QSNLSR.mjs +0 -38
- package/dist/chunk-XHCXM5MU.mjs +0 -14
- /package/dist/{chunk-UQAG7TKJ.mjs → chunk-37MCHF7U.mjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/ui/inputs/select/use-select.ts
|
|
4
|
-
import { useCallback, useMemo
|
|
4
|
+
import { useCallback, useMemo } from "react";
|
|
5
5
|
function useSelect({
|
|
6
6
|
value,
|
|
7
7
|
onChange,
|
|
@@ -10,24 +10,17 @@ function useSelect({
|
|
|
10
10
|
isClearable = true
|
|
11
11
|
}) {
|
|
12
12
|
const isMultiple = selectionMode === "multiple";
|
|
13
|
-
const [
|
|
14
|
-
isMultiple ? [] : null
|
|
15
|
-
);
|
|
16
|
-
const isControlled = value !== void 0;
|
|
17
|
-
const currentValue = isControlled ? value : internalValue;
|
|
13
|
+
const currentValue = value != null ? value : isMultiple ? [] : null;
|
|
18
14
|
const hasValue = currentValue != null && (Array.isArray(currentValue) ? currentValue.length > 0 : currentValue !== "");
|
|
19
15
|
const handleChange = useCallback(
|
|
20
16
|
(newValue) => {
|
|
21
|
-
if (!isControlled) {
|
|
22
|
-
setInternalValue(newValue);
|
|
23
|
-
}
|
|
24
17
|
if (isMultiple) {
|
|
25
18
|
onChange == null ? void 0 : onChange(newValue);
|
|
26
19
|
} else {
|
|
27
20
|
onChange == null ? void 0 : onChange(newValue);
|
|
28
21
|
}
|
|
29
22
|
},
|
|
30
|
-
[
|
|
23
|
+
[onChange, isMultiple]
|
|
31
24
|
);
|
|
32
25
|
const handleClear = useCallback(() => {
|
|
33
26
|
onClear == null ? void 0 : onClear();
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/ui/inputs/number/use-number.ts
|
|
4
|
+
import { NumberParser } from "@internationalized/number";
|
|
5
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
6
|
+
function normalizeNumberValue(value) {
|
|
7
|
+
if (value == null || Number.isNaN(value)) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
function useNumber({
|
|
13
|
+
locale,
|
|
14
|
+
value,
|
|
15
|
+
onChange,
|
|
16
|
+
onValueChange,
|
|
17
|
+
onClear,
|
|
18
|
+
isReadOnly,
|
|
19
|
+
isClearable = true,
|
|
20
|
+
ref
|
|
21
|
+
}) {
|
|
22
|
+
const inputRef = useRef(null);
|
|
23
|
+
const currentValue = normalizeNumberValue(value);
|
|
24
|
+
const hasValue = currentValue !== null;
|
|
25
|
+
const currentLocale = locale != null ? locale : Intl.NumberFormat().resolvedOptions().locale;
|
|
26
|
+
const numberParser = useMemo(() => new NumberParser(currentLocale), [currentLocale]);
|
|
27
|
+
const emitValueChange = useCallback(
|
|
28
|
+
(newValue) => {
|
|
29
|
+
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
30
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
31
|
+
},
|
|
32
|
+
[onChange, onValueChange]
|
|
33
|
+
);
|
|
34
|
+
const handleValueChange = useCallback(
|
|
35
|
+
(incomingValue) => {
|
|
36
|
+
let newValue = null;
|
|
37
|
+
if (incomingValue === null) {
|
|
38
|
+
newValue = null;
|
|
39
|
+
} else if (typeof incomingValue === "number") {
|
|
40
|
+
newValue = Number.isNaN(incomingValue) ? null : incomingValue;
|
|
41
|
+
} else {
|
|
42
|
+
const rawValue = incomingValue.target.value;
|
|
43
|
+
newValue = rawValue === "" ? null : numberParser.parse(rawValue);
|
|
44
|
+
newValue = Number.isNaN(newValue) ? null : newValue;
|
|
45
|
+
}
|
|
46
|
+
emitValueChange(newValue);
|
|
47
|
+
},
|
|
48
|
+
[emitValueChange, numberParser]
|
|
49
|
+
);
|
|
50
|
+
const handleClear = useCallback(() => {
|
|
51
|
+
var _a;
|
|
52
|
+
onClear == null ? void 0 : onClear();
|
|
53
|
+
emitValueChange(null);
|
|
54
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
55
|
+
}, [emitValueChange, onClear]);
|
|
56
|
+
const mergedRef = useCallback(
|
|
57
|
+
(node) => {
|
|
58
|
+
inputRef.current = node;
|
|
59
|
+
if (typeof ref === "function") {
|
|
60
|
+
ref(node);
|
|
61
|
+
} else if (ref) {
|
|
62
|
+
ref.current = node;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
[ref]
|
|
66
|
+
);
|
|
67
|
+
const showClearButton = hasValue && !isReadOnly && isClearable;
|
|
68
|
+
return {
|
|
69
|
+
inputRef,
|
|
70
|
+
currentValue,
|
|
71
|
+
hasValue,
|
|
72
|
+
handleValueChange,
|
|
73
|
+
handleClear,
|
|
74
|
+
mergedRef,
|
|
75
|
+
showClearButton
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
useNumber
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useNumber
|
|
4
|
+
} from "./chunk-7WIZONLU.mjs";
|
|
5
|
+
import {
|
|
6
|
+
ClearButton
|
|
7
|
+
} from "./chunk-TUIN5YJW.mjs";
|
|
8
|
+
import {
|
|
9
|
+
cn
|
|
10
|
+
} from "./chunk-LOMRTWX5.mjs";
|
|
11
|
+
|
|
12
|
+
// src/ui/inputs/number/number.tsx
|
|
13
|
+
import React from "react";
|
|
14
|
+
import { NumberInput as HeroUINumberInput } from "@heroui/number-input";
|
|
15
|
+
import { tv } from "tailwind-variants";
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
var inputWrapperVariants = tv({
|
|
18
|
+
variants: {
|
|
19
|
+
variant: {
|
|
20
|
+
flat: "",
|
|
21
|
+
underlined: "",
|
|
22
|
+
bordered: "border-1",
|
|
23
|
+
faded: "border-1"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
var Number = React.forwardRef(
|
|
28
|
+
({
|
|
29
|
+
locale,
|
|
30
|
+
value,
|
|
31
|
+
onChange,
|
|
32
|
+
onValueChange,
|
|
33
|
+
onClear,
|
|
34
|
+
variant,
|
|
35
|
+
classNames,
|
|
36
|
+
endContent,
|
|
37
|
+
isReadOnly,
|
|
38
|
+
isClearable,
|
|
39
|
+
...props
|
|
40
|
+
}, ref) => {
|
|
41
|
+
const { currentValue, handleValueChange, handleClear, mergedRef, showClearButton } = useNumber({
|
|
42
|
+
locale,
|
|
43
|
+
value,
|
|
44
|
+
onChange,
|
|
45
|
+
onValueChange,
|
|
46
|
+
onClear,
|
|
47
|
+
isReadOnly,
|
|
48
|
+
isClearable,
|
|
49
|
+
ref
|
|
50
|
+
});
|
|
51
|
+
const normalizedValue = currentValue === null ? globalThis.Number.NaN : currentValue;
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
53
|
+
HeroUINumberInput,
|
|
54
|
+
{
|
|
55
|
+
ref: mergedRef,
|
|
56
|
+
classNames: {
|
|
57
|
+
...classNames,
|
|
58
|
+
inputWrapper: cn(inputWrapperVariants({ variant }), classNames == null ? void 0 : classNames.inputWrapper),
|
|
59
|
+
innerWrapper: cn("group", classNames == null ? void 0 : classNames.innerWrapper)
|
|
60
|
+
},
|
|
61
|
+
endContent: (endContent || showClearButton) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
62
|
+
endContent,
|
|
63
|
+
showClearButton && /* @__PURE__ */ jsx(ClearButton, { onClear: handleClear })
|
|
64
|
+
] }),
|
|
65
|
+
inputMode: "decimal",
|
|
66
|
+
isReadOnly,
|
|
67
|
+
value: normalizedValue,
|
|
68
|
+
variant,
|
|
69
|
+
onChange: handleValueChange,
|
|
70
|
+
...props
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
Number.displayName = "TeachInUI.Number";
|
|
76
|
+
var NumberInput = Number;
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
Number,
|
|
80
|
+
NumberInput
|
|
81
|
+
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
useSelect
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6BWSC6ZH.mjs";
|
|
5
5
|
import {
|
|
6
6
|
ClearButton
|
|
7
7
|
} from "./chunk-TUIN5YJW.mjs";
|
|
8
|
+
import {
|
|
9
|
+
cn
|
|
10
|
+
} from "./chunk-LOMRTWX5.mjs";
|
|
8
11
|
|
|
9
12
|
// src/ui/inputs/select/select.tsx
|
|
10
13
|
import React from "react";
|
|
@@ -24,9 +27,11 @@ var selectWrapperVariants = tv({
|
|
|
24
27
|
var Select = React.forwardRef(
|
|
25
28
|
({
|
|
26
29
|
value,
|
|
27
|
-
defaultSelectedKeys,
|
|
28
30
|
items,
|
|
31
|
+
children,
|
|
32
|
+
selectedKeys: selectedKeysProp,
|
|
29
33
|
onChange,
|
|
34
|
+
onSelectionChange,
|
|
30
35
|
selectionMode,
|
|
31
36
|
onClear,
|
|
32
37
|
variant,
|
|
@@ -35,6 +40,8 @@ var Select = React.forwardRef(
|
|
|
35
40
|
isClearable,
|
|
36
41
|
...props
|
|
37
42
|
}, ref) => {
|
|
43
|
+
const usesExternalSelectionControl = selectedKeysProp !== void 0 || onSelectionChange !== void 0;
|
|
44
|
+
const selectChildren = children != null ? children : (item) => /* @__PURE__ */ jsx(HeroUISelectItem, { children: item.label }, item.key);
|
|
38
45
|
const { selectedKeys, handleSelectionChange, handleClear, showClearButton } = useSelect({
|
|
39
46
|
value,
|
|
40
47
|
onChange,
|
|
@@ -48,27 +55,28 @@ var Select = React.forwardRef(
|
|
|
48
55
|
ref,
|
|
49
56
|
classNames: {
|
|
50
57
|
...classNames,
|
|
51
|
-
trigger: selectWrapperVariants({ variant }),
|
|
58
|
+
trigger: cn(selectWrapperVariants({ variant }), classNames == null ? void 0 : classNames.trigger),
|
|
52
59
|
innerWrapper: "group"
|
|
53
60
|
},
|
|
54
|
-
defaultSelectedKeys,
|
|
55
61
|
endContent: (endContent || showClearButton) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
56
62
|
endContent,
|
|
57
63
|
showClearButton && /* @__PURE__ */ jsx(ClearButton, { onClear: handleClear })
|
|
58
64
|
] }),
|
|
59
65
|
items,
|
|
60
|
-
selectedKeys,
|
|
66
|
+
selectedKeys: usesExternalSelectionControl ? selectedKeysProp : selectedKeys,
|
|
61
67
|
selectionMode,
|
|
62
68
|
variant,
|
|
63
|
-
onSelectionChange: handleSelectionChange,
|
|
69
|
+
onSelectionChange: usesExternalSelectionControl ? onSelectionChange : handleSelectionChange,
|
|
64
70
|
...props,
|
|
65
|
-
children:
|
|
71
|
+
children: selectChildren
|
|
66
72
|
}
|
|
67
73
|
);
|
|
68
74
|
}
|
|
69
75
|
);
|
|
70
76
|
Select.displayName = "TeachInUI.Select";
|
|
77
|
+
var SelectItem = HeroUISelectItem;
|
|
71
78
|
|
|
72
79
|
export {
|
|
73
|
-
Select
|
|
80
|
+
Select,
|
|
81
|
+
SelectItem
|
|
74
82
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Input
|
|
4
|
+
} from "./chunk-MCQGBAUS.mjs";
|
|
5
|
+
|
|
6
|
+
// src/ui/inputs/email/email.tsx
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var EMAIL_REGEX = /^(?!\.)(?!.*\.\.)[A-Za-zА-Яа-яЁё0-9._+%-]+(?<!\.)@(?:(?:[A-Za-zА-Яа-яЁё0-9](?:[A-Za-zА-Яа-яЁё0-9-]*[A-Za-zА-Яа-яЁё0-9])?)\.)+[A-Za-zА-Яа-яЁё]{2,}$/u;
|
|
10
|
+
var DEFAULT_ERROR_MESSAGE = "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 email";
|
|
11
|
+
var defaultValidateEmail = (value) => {
|
|
12
|
+
if (!value) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
return EMAIL_REGEX.test(value) ? true : DEFAULT_ERROR_MESSAGE;
|
|
16
|
+
};
|
|
17
|
+
function getValidationMessage(result) {
|
|
18
|
+
if (typeof result === "string") {
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(result)) {
|
|
22
|
+
return result.join(" ");
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
var Email = React.forwardRef(
|
|
27
|
+
({
|
|
28
|
+
defaultValue,
|
|
29
|
+
errorMessage,
|
|
30
|
+
isInvalid,
|
|
31
|
+
onValueChange,
|
|
32
|
+
validate = defaultValidateEmail,
|
|
33
|
+
value,
|
|
34
|
+
...props
|
|
35
|
+
}, ref) => {
|
|
36
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue != null ? defaultValue : "");
|
|
37
|
+
const isControlled = value !== void 0;
|
|
38
|
+
const currentValue = isControlled ? value : internalValue;
|
|
39
|
+
const handleValueChange = React.useCallback(
|
|
40
|
+
(nextValue) => {
|
|
41
|
+
if (!isControlled) {
|
|
42
|
+
setInternalValue(nextValue);
|
|
43
|
+
}
|
|
44
|
+
onValueChange == null ? void 0 : onValueChange(nextValue);
|
|
45
|
+
},
|
|
46
|
+
[isControlled, onValueChange]
|
|
47
|
+
);
|
|
48
|
+
const validationMessage = getValidationMessage(validate(currentValue != null ? currentValue : ""));
|
|
49
|
+
const resolvedErrorMessage = errorMessage != null ? errorMessage : validationMessage;
|
|
50
|
+
const resolvedIsInvalid = isInvalid != null ? isInvalid : Boolean(validationMessage);
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
Input,
|
|
53
|
+
{
|
|
54
|
+
ref,
|
|
55
|
+
autoComplete: "email",
|
|
56
|
+
errorMessage: resolvedErrorMessage,
|
|
57
|
+
isInvalid: resolvedIsInvalid,
|
|
58
|
+
type: "email",
|
|
59
|
+
validate,
|
|
60
|
+
value: currentValue,
|
|
61
|
+
onValueChange: handleValueChange,
|
|
62
|
+
...props
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
Email.displayName = "TeachInUI.Email";
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
Email
|
|
71
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/ui/inputs/switch/favorite-switch.tsx
|
|
4
|
+
import { useSwitch } from "@heroui/switch";
|
|
5
|
+
import { BookmarkIcon } from "lucide-react";
|
|
6
|
+
import { tv } from "tailwind-variants";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
var bookmarkVariants = tv({
|
|
9
|
+
base: "stroke-default-400 group-hover:fill-primary-100 group-hover:stroke-default-400",
|
|
10
|
+
variants: {
|
|
11
|
+
size: {
|
|
12
|
+
sm: "size-6",
|
|
13
|
+
md: "size-8",
|
|
14
|
+
lg: "size-10"
|
|
15
|
+
},
|
|
16
|
+
isSelected: {
|
|
17
|
+
true: "stroke-primary fill-primary-100"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
size: "md"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var wrapperVariants = tv({
|
|
25
|
+
base: "flex cursor-pointer items-center justify-center rounded-sm bg-transparent!",
|
|
26
|
+
variants: {
|
|
27
|
+
size: {
|
|
28
|
+
sm: "h-8 w-8",
|
|
29
|
+
md: "h-10 w-10",
|
|
30
|
+
lg: "h-12 w-12"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: {
|
|
34
|
+
size: "md"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
function FavoriteSwitch({ isSelected, onValueChange, size }) {
|
|
38
|
+
const { Component, slots, getBaseProps, getInputProps, getWrapperProps } = useSwitch({
|
|
39
|
+
isSelected,
|
|
40
|
+
onValueChange
|
|
41
|
+
});
|
|
42
|
+
return /* @__PURE__ */ jsxs(Component, { ...getBaseProps(), children: [
|
|
43
|
+
/* @__PURE__ */ jsx("div", { className: "sr-only", children: /* @__PURE__ */ jsx("input", { ...getInputProps() }) }),
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
...getWrapperProps(),
|
|
48
|
+
className: slots.wrapper({
|
|
49
|
+
class: wrapperVariants({ size })
|
|
50
|
+
}),
|
|
51
|
+
children: /* @__PURE__ */ jsx(
|
|
52
|
+
BookmarkIcon,
|
|
53
|
+
{
|
|
54
|
+
absoluteStrokeWidth: true,
|
|
55
|
+
className: bookmarkVariants({ isSelected, size }),
|
|
56
|
+
strokeLinecap: "round",
|
|
57
|
+
strokeLinejoin: "round",
|
|
58
|
+
strokeWidth: 1.5
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
FavoriteSwitch
|
|
68
|
+
};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cn
|
|
4
|
+
} from "./chunk-LOMRTWX5.mjs";
|
|
5
|
+
import {
|
|
6
|
+
extendVariants
|
|
7
|
+
} from "./chunk-7BTEKEON.mjs";
|
|
2
8
|
|
|
3
9
|
// src/ui/surface/card/card.tsx
|
|
4
10
|
import React from "react";
|
|
@@ -9,8 +15,20 @@ import {
|
|
|
9
15
|
CardFooter as HeroUICardFooter
|
|
10
16
|
} from "@heroui/card";
|
|
11
17
|
import { jsx } from "react/jsx-runtime";
|
|
12
|
-
var
|
|
13
|
-
|
|
18
|
+
var CardBase = extendVariants(HeroUICard, {
|
|
19
|
+
variants: {
|
|
20
|
+
radius: {
|
|
21
|
+
sm: { base: "rounded-lg" },
|
|
22
|
+
md: { base: "rounded-2xl" },
|
|
23
|
+
lg: { base: "rounded-3xl" }
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
shadow: "none"
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var Root = React.forwardRef(({ children, className, ...props }, ref) => {
|
|
31
|
+
return /* @__PURE__ */ jsx(CardBase, { ref, className: cn("bg-default-100", className), ...props, children });
|
|
14
32
|
});
|
|
15
33
|
Root.displayName = "TeachInUI.Card.Root";
|
|
16
34
|
var Header = React.forwardRef(({ children, ...props }, ref) => {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cn
|
|
4
|
+
} from "./chunk-LOMRTWX5.mjs";
|
|
5
|
+
|
|
6
|
+
// src/ui/data/user/user.tsx
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { User as HeroUIUser } from "@heroui/user";
|
|
9
|
+
import { Image } from "@heroui/image";
|
|
10
|
+
import { tv } from "tailwind-variants";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
function getNameInitials(fullName) {
|
|
13
|
+
const normalizedFullName = fullName.trim();
|
|
14
|
+
const parts = normalizedFullName.split(" ").filter((part) => part.length > 0);
|
|
15
|
+
if (parts.length >= 2) {
|
|
16
|
+
return parts[0][0].toUpperCase() + parts[1][0].toUpperCase();
|
|
17
|
+
}
|
|
18
|
+
return normalizedFullName.slice(0, 2).toUpperCase();
|
|
19
|
+
}
|
|
20
|
+
var userVariants = tv({
|
|
21
|
+
base: "flex items-start gap-2 hyphens-auto",
|
|
22
|
+
variants: {
|
|
23
|
+
direction: {
|
|
24
|
+
row: "flex-row",
|
|
25
|
+
column: "flex-col items-center"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
direction: "row"
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var User = React.forwardRef(
|
|
33
|
+
({ name, avatarProps, className, direction = "row", ...props }, ref) => {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
HeroUIUser,
|
|
37
|
+
{
|
|
38
|
+
ref,
|
|
39
|
+
avatarProps: {
|
|
40
|
+
...avatarProps,
|
|
41
|
+
className: cn("shrink-0", avatarProps == null ? void 0 : avatarProps.className),
|
|
42
|
+
name: (_a = avatarProps == null ? void 0 : avatarProps.name) != null ? _a : getNameInitials(name),
|
|
43
|
+
ImgComponent: Image,
|
|
44
|
+
showFallback: (_b = avatarProps == null ? void 0 : avatarProps.showFallback) != null ? _b : true
|
|
45
|
+
},
|
|
46
|
+
className: userVariants({ direction, className }),
|
|
47
|
+
name,
|
|
48
|
+
...props
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
User.displayName = "TeachInUI.User";
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
User
|
|
57
|
+
};
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
import { tv } from "tailwind-variants";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
var bento = tv({
|
|
7
|
-
base: "
|
|
7
|
+
base: "p-8 transition-colors",
|
|
8
8
|
variants: {
|
|
9
9
|
color: {
|
|
10
|
-
default: "bg-
|
|
10
|
+
default: "bg-content1 text-foreground",
|
|
11
11
|
primary: "bg-primary-50 text-primary-700",
|
|
12
12
|
secondary: "bg-secondary-50 text-secondary-700",
|
|
13
13
|
success: "bg-success-50 text-success-700",
|
|
@@ -16,9 +16,9 @@ var bento = tv({
|
|
|
16
16
|
},
|
|
17
17
|
radius: {
|
|
18
18
|
none: "rounded-none",
|
|
19
|
-
sm: "rounded-
|
|
20
|
-
md: "rounded-
|
|
21
|
-
lg: "rounded-
|
|
19
|
+
sm: "rounded-lg",
|
|
20
|
+
md: "rounded-2xl",
|
|
21
|
+
lg: "rounded-3xl",
|
|
22
22
|
full: "rounded-full"
|
|
23
23
|
},
|
|
24
24
|
shadow: {
|