@teach-in/react 1.2.0 → 1.3.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.
Files changed (113) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +9 -9
  3. package/dist/chunk-3YOW5DEZ.mjs +45 -0
  4. package/dist/{chunk-QCLLPJMB.mjs → chunk-544SDU73.mjs} +2 -2
  5. package/dist/{chunk-2CEZXLZR.mjs → chunk-AFVGHUW2.mjs} +1 -1
  6. package/dist/{chunk-IU2JYI7W.mjs → chunk-CETCW7DS.mjs} +1 -1
  7. package/dist/{chunk-5FFWQB7D.mjs → chunk-JDFRAN4S.mjs} +2 -12
  8. package/dist/{chunk-KTWHCUYV.mjs → chunk-KTUGFQWJ.mjs} +1 -1
  9. package/dist/{chunk-46SKVFMZ.mjs → chunk-LJIVY6GU.mjs} +1 -1
  10. package/dist/{chunk-CKJ5U5Q4.mjs → chunk-NLHQDWUK.mjs} +1 -1
  11. package/dist/{chunk-R46SWVWL.mjs → chunk-R7LDL5CU.mjs} +1 -1
  12. package/dist/chunk-V2G5QHZZ.mjs +14 -0
  13. package/dist/{chunk-2ASQXBDD.mjs → chunk-WFNNN6WU.mjs} +1 -1
  14. package/dist/index.js +230 -575
  15. package/dist/index.mjs +125 -141
  16. package/dist/ui/data/index.mjs +8 -8
  17. package/dist/ui/feedback/index.mjs +14 -14
  18. package/dist/ui/form/index.js +106 -447
  19. package/dist/ui/form/index.mjs +21 -31
  20. package/dist/ui/form/rhf/fields/autocomplete-field.mjs +14 -20
  21. package/dist/ui/form/rhf/fields/checkbox-field.mjs +14 -20
  22. package/dist/ui/form/rhf/fields/date-picker-field.mjs +14 -20
  23. package/dist/ui/form/rhf/fields/email-field.js +10 -147
  24. package/dist/ui/form/rhf/fields/email-field.mjs +15 -21
  25. package/dist/ui/form/rhf/fields/index.d.ts +0 -1
  26. package/dist/ui/form/rhf/fields/index.js +102 -443
  27. package/dist/ui/form/rhf/fields/index.mjs +21 -31
  28. package/dist/ui/form/rhf/fields/input-field.js +6 -153
  29. package/dist/ui/form/rhf/fields/input-field.mjs +15 -21
  30. package/dist/ui/form/rhf/fields/radio-field.mjs +14 -20
  31. package/dist/ui/form/rhf/fields/select-field.js +26 -136
  32. package/dist/ui/form/rhf/fields/select-field.mjs +15 -21
  33. package/dist/ui/form/rhf/fields/switch-field.mjs +14 -20
  34. package/dist/ui/form/rhf/fields/text-field.js +10 -147
  35. package/dist/ui/form/rhf/fields/text-field.mjs +15 -21
  36. package/dist/ui/form/rhf/fields/textarea-field.mjs +14 -20
  37. package/dist/ui/form/rhf/index.js +102 -443
  38. package/dist/ui/form/rhf/index.mjs +21 -31
  39. package/dist/ui/format/index.mjs +3 -3
  40. package/dist/ui/index.js +230 -575
  41. package/dist/ui/index.mjs +125 -141
  42. package/dist/ui/inputs/checkbox/index.mjs +3 -3
  43. package/dist/ui/inputs/email/email.js +7 -144
  44. package/dist/ui/inputs/email/email.mjs +2 -4
  45. package/dist/ui/inputs/email/index.js +7 -144
  46. package/dist/ui/inputs/email/index.mjs +2 -4
  47. package/dist/ui/inputs/index.d.ts +0 -2
  48. package/dist/ui/inputs/index.js +56 -363
  49. package/dist/ui/inputs/index.mjs +25 -37
  50. package/dist/ui/inputs/input/index.js +3 -140
  51. package/dist/ui/inputs/input/index.mjs +1 -3
  52. package/dist/ui/inputs/input/input.d.ts +0 -1
  53. package/dist/ui/inputs/input/input.js +3 -140
  54. package/dist/ui/inputs/input/input.mjs +1 -3
  55. package/dist/ui/inputs/select/index.js +22 -132
  56. package/dist/ui/inputs/select/index.mjs +1 -3
  57. package/dist/ui/inputs/select/select.d.ts +0 -4
  58. package/dist/ui/inputs/select/select.js +22 -132
  59. package/dist/ui/inputs/select/select.mjs +1 -3
  60. package/dist/ui/inputs/text/index.js +7 -144
  61. package/dist/ui/inputs/text/index.mjs +2 -4
  62. package/dist/ui/inputs/text/text.js +7 -144
  63. package/dist/ui/inputs/text/text.mjs +2 -4
  64. package/dist/ui/layout/container/container.mjs +64 -71
  65. package/dist/ui/layout/container/index.mjs +64 -71
  66. package/dist/ui/layout/index.mjs +69 -76
  67. package/dist/ui/layout/page/index.mjs +3 -3
  68. package/dist/ui/layout/page/page-loading.mjs +3 -3
  69. package/dist/ui/layout/page/section-loading.mjs +3 -3
  70. package/dist/ui/navigation/index.mjs +5 -5
  71. package/dist/ui/overlays/index.mjs +4 -4
  72. package/dist/ui/provider/index.mjs +3 -3
  73. package/dist/ui/provider/ui-provider.mjs +3 -3
  74. package/dist/ui/theme/colors/common.mjs +3 -3
  75. package/dist/ui/theme/colors/index.mjs +6 -6
  76. package/dist/ui/theme/colors/semantic.mjs +4 -4
  77. package/dist/ui/theme/colors.mjs +6 -6
  78. package/dist/ui/theme/index.mjs +6 -6
  79. package/dist/ui/theme/theme.mjs +6 -6
  80. package/package.json +1 -1
  81. package/dist/chunk-2UHA3DYG.mjs +0 -62
  82. package/dist/chunk-C2VWADF5.mjs +0 -34
  83. package/dist/chunk-CUEG2BFV.mjs +0 -34
  84. package/dist/chunk-MCQGBAUS.mjs +0 -73
  85. package/dist/chunk-NSU66J5E.mjs +0 -59
  86. package/dist/chunk-SEJXJZSK.mjs +0 -64
  87. package/dist/chunk-TUIN5YJW.mjs +0 -33
  88. package/dist/chunk-UQAG7TKJ.mjs +0 -1
  89. package/dist/chunk-VXYV37IM.mjs +0 -74
  90. package/dist/ui/form/rhf/fields/search-field.d.ts +0 -10
  91. package/dist/ui/form/rhf/fields/search-field.js +0 -296
  92. package/dist/ui/form/rhf/fields/search-field.mjs +0 -37
  93. package/dist/ui/inputs/clear-button.d.ts +0 -5
  94. package/dist/ui/inputs/clear-button.js +0 -67
  95. package/dist/ui/inputs/clear-button.mjs +0 -8
  96. package/dist/ui/inputs/input/use-input.d.ts +0 -19
  97. package/dist/ui/inputs/input/use-input.js +0 -82
  98. package/dist/ui/inputs/input/use-input.mjs +0 -7
  99. package/dist/ui/inputs/search/index.d.ts +0 -1
  100. package/dist/ui/inputs/search/index.js +0 -270
  101. package/dist/ui/inputs/search/index.mjs +0 -13
  102. package/dist/ui/inputs/search/search.d.ts +0 -7
  103. package/dist/ui/inputs/search/search.js +0 -268
  104. package/dist/ui/inputs/search/search.mjs +0 -12
  105. package/dist/ui/inputs/search/use-search.d.ts +0 -12
  106. package/dist/ui/inputs/search/use-search.js +0 -57
  107. package/dist/ui/inputs/search/use-search.mjs +0 -7
  108. package/dist/ui/inputs/select/use-select.d.ts +0 -17
  109. package/dist/ui/inputs/select/use-select.js +0 -85
  110. package/dist/ui/inputs/select/use-select.mjs +0 -7
  111. package/dist/{chunk-IXPMUODA.mjs → chunk-5WDV3PDI.mjs} +6 -6
  112. /package/dist/{chunk-5RNCFTW5.mjs → chunk-CZEO3U25.mjs} +0 -0
  113. /package/dist/{chunk-PTCNYQVY.mjs → chunk-Q6JSJOU4.mjs} +0 -0
@@ -36,149 +36,12 @@ __export(input_exports, {
36
36
  module.exports = __toCommonJS(input_exports);
37
37
 
38
38
  // src/ui/inputs/input/input.tsx
39
- var import_react3 = __toESM(require("react"));
40
- var import_input = require("@heroui/input");
41
- var import_tailwind_variants = require("tailwind-variants");
42
-
43
- // src/ui/inputs/clear-button.tsx
44
39
  var import_react = __toESM(require("react"));
45
- var import_button = require("@heroui/button");
46
- var import_lucide_react = require("lucide-react");
40
+ var import_input = require("@heroui/input");
47
41
  var import_jsx_runtime = require("react/jsx-runtime");
48
- var ClearButton = import_react.default.forwardRef(
49
- ({ onClear }, ref) => {
50
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
51
- import_button.Button,
52
- {
53
- ref,
54
- isIconOnly: true,
55
- "aria-label": "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
56
- as: "span",
57
- className: "opacity-0 transition-opacity group-hover:opacity-100",
58
- color: "default",
59
- radius: "full",
60
- size: "sm",
61
- tabIndex: 0,
62
- variant: "light",
63
- onPress: onClear,
64
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XIcon, { className: "size-4 text-default-500" })
65
- }
66
- );
67
- }
68
- );
69
- ClearButton.displayName = "TeachInUI.ClearButton";
70
-
71
- // src/ui/inputs/input/use-input.ts
72
- var import_react2 = require("react");
73
- function useInput({
74
- value,
75
- defaultValue,
76
- onValueChange,
77
- onClear,
78
- isReadOnly,
79
- isClearable = true,
80
- ref
81
- }) {
82
- const inputRef = (0, import_react2.useRef)(null);
83
- const [internalValue, setInternalValue] = (0, import_react2.useState)(defaultValue != null ? defaultValue : "");
84
- const isControlled = value !== void 0;
85
- const currentValue = isControlled ? value : internalValue;
86
- const hasValue = String(currentValue).length > 0;
87
- const handleValueChange = (0, import_react2.useCallback)(
88
- (newValue) => {
89
- if (!isControlled) {
90
- setInternalValue(newValue);
91
- }
92
- onValueChange == null ? void 0 : onValueChange(newValue);
93
- },
94
- [isControlled, onValueChange]
95
- );
96
- const handleClear = (0, import_react2.useCallback)(() => {
97
- var _a;
98
- onClear == null ? void 0 : onClear();
99
- handleValueChange("");
100
- (_a = inputRef.current) == null ? void 0 : _a.focus();
101
- }, [onClear, handleValueChange]);
102
- const mergedRef = (0, import_react2.useCallback)(
103
- (node) => {
104
- inputRef.current = node;
105
- if (typeof ref === "function") {
106
- ref(node);
107
- } else if (ref) {
108
- ref.current = node;
109
- }
110
- },
111
- [ref]
112
- );
113
- const showClearButton = hasValue && !isReadOnly && isClearable;
114
- return {
115
- inputRef,
116
- currentValue,
117
- hasValue,
118
- handleValueChange,
119
- handleClear,
120
- mergedRef,
121
- showClearButton
122
- };
123
- }
124
-
125
- // src/ui/inputs/input/input.tsx
126
- var import_jsx_runtime2 = require("react/jsx-runtime");
127
- var inputWrapperVariants = (0, import_tailwind_variants.tv)({
128
- variants: {
129
- variant: {
130
- flat: "",
131
- underlined: "",
132
- bordered: "border-1",
133
- faded: "border-1"
134
- }
135
- }
42
+ var Input = import_react.default.forwardRef(({ ...props }, ref) => {
43
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { ref, ...props });
136
44
  });
137
- var Input = import_react3.default.forwardRef(
138
- ({
139
- value,
140
- defaultValue,
141
- onClear,
142
- onValueChange,
143
- variant,
144
- classNames,
145
- endContent,
146
- isReadOnly,
147
- isClearable,
148
- ...props
149
- }, ref) => {
150
- const { currentValue, handleValueChange, handleClear, mergedRef, showClearButton } = useInput({
151
- value,
152
- defaultValue,
153
- onValueChange,
154
- onClear,
155
- isReadOnly,
156
- isClearable,
157
- ref
158
- });
159
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
160
- import_input.Input,
161
- {
162
- ref: mergedRef,
163
- classNames: {
164
- ...classNames,
165
- inputWrapper: inputWrapperVariants({ variant }),
166
- innerWrapper: "group"
167
- },
168
- defaultValue,
169
- endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-1", children: [
170
- endContent,
171
- showClearButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ClearButton, { onClear: handleClear })
172
- ] }),
173
- isReadOnly,
174
- value: currentValue,
175
- variant,
176
- onValueChange: handleValueChange,
177
- ...props
178
- }
179
- );
180
- }
181
- );
182
45
  Input.displayName = "TeachInUI.Input";
183
46
  // Annotate the CommonJS export names for ESM import in node:
184
47
  0 && (module.exports = {
@@ -2,9 +2,7 @@
2
2
  import "../../../chunk-ZRHEFEFS.mjs";
3
3
  import {
4
4
  Input
5
- } from "../../../chunk-MCQGBAUS.mjs";
6
- import "../../../chunk-NSU66J5E.mjs";
7
- import "../../../chunk-TUIN5YJW.mjs";
5
+ } from "../../../chunk-V2G5QHZZ.mjs";
8
6
  export {
9
7
  Input
10
8
  };
@@ -1,6 +1,5 @@
1
1
  import type { InputProps as HeroUIInputProps } from "@heroui/input";
2
2
  import React from "react";
3
3
  export interface InputProps extends HeroUIInputProps {
4
- onClear?: () => void;
5
4
  }
6
5
  export declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -34,149 +34,12 @@ __export(input_exports, {
34
34
  Input: () => Input
35
35
  });
36
36
  module.exports = __toCommonJS(input_exports);
37
- var import_react3 = __toESM(require("react"));
38
- var import_input = require("@heroui/input");
39
- var import_tailwind_variants = require("tailwind-variants");
40
-
41
- // src/ui/inputs/clear-button.tsx
42
37
  var import_react = __toESM(require("react"));
43
- var import_button = require("@heroui/button");
44
- var import_lucide_react = require("lucide-react");
38
+ var import_input = require("@heroui/input");
45
39
  var import_jsx_runtime = require("react/jsx-runtime");
46
- var ClearButton = import_react.default.forwardRef(
47
- ({ onClear }, ref) => {
48
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
49
- import_button.Button,
50
- {
51
- ref,
52
- isIconOnly: true,
53
- "aria-label": "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
54
- as: "span",
55
- className: "opacity-0 transition-opacity group-hover:opacity-100",
56
- color: "default",
57
- radius: "full",
58
- size: "sm",
59
- tabIndex: 0,
60
- variant: "light",
61
- onPress: onClear,
62
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XIcon, { className: "size-4 text-default-500" })
63
- }
64
- );
65
- }
66
- );
67
- ClearButton.displayName = "TeachInUI.ClearButton";
68
-
69
- // src/ui/inputs/input/use-input.ts
70
- var import_react2 = require("react");
71
- function useInput({
72
- value,
73
- defaultValue,
74
- onValueChange,
75
- onClear,
76
- isReadOnly,
77
- isClearable = true,
78
- ref
79
- }) {
80
- const inputRef = (0, import_react2.useRef)(null);
81
- const [internalValue, setInternalValue] = (0, import_react2.useState)(defaultValue != null ? defaultValue : "");
82
- const isControlled = value !== void 0;
83
- const currentValue = isControlled ? value : internalValue;
84
- const hasValue = String(currentValue).length > 0;
85
- const handleValueChange = (0, import_react2.useCallback)(
86
- (newValue) => {
87
- if (!isControlled) {
88
- setInternalValue(newValue);
89
- }
90
- onValueChange == null ? void 0 : onValueChange(newValue);
91
- },
92
- [isControlled, onValueChange]
93
- );
94
- const handleClear = (0, import_react2.useCallback)(() => {
95
- var _a;
96
- onClear == null ? void 0 : onClear();
97
- handleValueChange("");
98
- (_a = inputRef.current) == null ? void 0 : _a.focus();
99
- }, [onClear, handleValueChange]);
100
- const mergedRef = (0, import_react2.useCallback)(
101
- (node) => {
102
- inputRef.current = node;
103
- if (typeof ref === "function") {
104
- ref(node);
105
- } else if (ref) {
106
- ref.current = node;
107
- }
108
- },
109
- [ref]
110
- );
111
- const showClearButton = hasValue && !isReadOnly && isClearable;
112
- return {
113
- inputRef,
114
- currentValue,
115
- hasValue,
116
- handleValueChange,
117
- handleClear,
118
- mergedRef,
119
- showClearButton
120
- };
121
- }
122
-
123
- // src/ui/inputs/input/input.tsx
124
- var import_jsx_runtime2 = require("react/jsx-runtime");
125
- var inputWrapperVariants = (0, import_tailwind_variants.tv)({
126
- variants: {
127
- variant: {
128
- flat: "",
129
- underlined: "",
130
- bordered: "border-1",
131
- faded: "border-1"
132
- }
133
- }
40
+ var Input = import_react.default.forwardRef(({ ...props }, ref) => {
41
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { ref, ...props });
134
42
  });
135
- var Input = import_react3.default.forwardRef(
136
- ({
137
- value,
138
- defaultValue,
139
- onClear,
140
- onValueChange,
141
- variant,
142
- classNames,
143
- endContent,
144
- isReadOnly,
145
- isClearable,
146
- ...props
147
- }, ref) => {
148
- const { currentValue, handleValueChange, handleClear, mergedRef, showClearButton } = useInput({
149
- value,
150
- defaultValue,
151
- onValueChange,
152
- onClear,
153
- isReadOnly,
154
- isClearable,
155
- ref
156
- });
157
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
158
- import_input.Input,
159
- {
160
- ref: mergedRef,
161
- classNames: {
162
- ...classNames,
163
- inputWrapper: inputWrapperVariants({ variant }),
164
- innerWrapper: "group"
165
- },
166
- defaultValue,
167
- endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-1", children: [
168
- endContent,
169
- showClearButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ClearButton, { onClear: handleClear })
170
- ] }),
171
- isReadOnly,
172
- value: currentValue,
173
- variant,
174
- onValueChange: handleValueChange,
175
- ...props
176
- }
177
- );
178
- }
179
- );
180
43
  Input.displayName = "TeachInUI.Input";
181
44
  // Annotate the CommonJS export names for ESM import in node:
182
45
  0 && (module.exports = {
@@ -1,9 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Input
4
- } from "../../../chunk-MCQGBAUS.mjs";
5
- import "../../../chunk-NSU66J5E.mjs";
6
- import "../../../chunk-TUIN5YJW.mjs";
4
+ } from "../../../chunk-V2G5QHZZ.mjs";
7
5
  export {
8
6
  Input
9
7
  };
@@ -36,149 +36,39 @@ __export(select_exports, {
36
36
  module.exports = __toCommonJS(select_exports);
37
37
 
38
38
  // src/ui/inputs/select/select.tsx
39
- var import_react3 = __toESM(require("react"));
40
- var import_select = require("@heroui/select");
41
- var import_tailwind_variants = require("tailwind-variants");
42
-
43
- // src/ui/inputs/clear-button.tsx
44
39
  var import_react = __toESM(require("react"));
45
- var import_button = require("@heroui/button");
46
- var import_lucide_react = require("lucide-react");
40
+ var import_select = require("@heroui/select");
47
41
  var import_jsx_runtime = require("react/jsx-runtime");
48
- var ClearButton = import_react.default.forwardRef(
49
- ({ onClear }, ref) => {
50
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
51
- import_button.Button,
52
- {
53
- ref,
54
- isIconOnly: true,
55
- "aria-label": "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
56
- as: "span",
57
- className: "opacity-0 transition-opacity group-hover:opacity-100",
58
- color: "default",
59
- radius: "full",
60
- size: "sm",
61
- tabIndex: 0,
62
- variant: "light",
63
- onPress: onClear,
64
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XIcon, { className: "size-4 text-default-500" })
65
- }
42
+ var Select = import_react.default.forwardRef(
43
+ ({ value, items, onChange, selectionMode, ...props }, ref) => {
44
+ const isMultiple = selectionMode === "multiple";
45
+ const selectedKeys = import_react.default.useMemo(() => {
46
+ if (value == null) return /* @__PURE__ */ new Set();
47
+ return new Set(Array.isArray(value) ? value : [value]);
48
+ }, [value]);
49
+ const handleSelectionChange = import_react.default.useCallback(
50
+ (keys) => {
51
+ var _a;
52
+ if (keys === "all") return;
53
+ const selected = Array.from(keys).filter((key) => typeof key === "string");
54
+ if (isMultiple) {
55
+ onChange == null ? void 0 : onChange(selected);
56
+ } else {
57
+ onChange == null ? void 0 : onChange((_a = selected[0]) != null ? _a : null);
58
+ }
59
+ },
60
+ [onChange, isMultiple]
66
61
  );
67
- }
68
- );
69
- ClearButton.displayName = "TeachInUI.ClearButton";
70
-
71
- // src/ui/inputs/select/use-select.ts
72
- var import_react2 = require("react");
73
- function useSelect({
74
- value,
75
- onChange,
76
- onClear,
77
- selectionMode,
78
- isClearable = true
79
- }) {
80
- const isMultiple = selectionMode === "multiple";
81
- const [internalValue, setInternalValue] = (0, import_react2.useState)(
82
- isMultiple ? [] : null
83
- );
84
- const isControlled = value !== void 0;
85
- const currentValue = isControlled ? value : internalValue;
86
- const hasValue = currentValue != null && (Array.isArray(currentValue) ? currentValue.length > 0 : currentValue !== "");
87
- const handleChange = (0, import_react2.useCallback)(
88
- (newValue) => {
89
- if (!isControlled) {
90
- setInternalValue(newValue);
91
- }
92
- if (isMultiple) {
93
- onChange == null ? void 0 : onChange(newValue);
94
- } else {
95
- onChange == null ? void 0 : onChange(newValue);
96
- }
97
- },
98
- [isControlled, onChange, isMultiple]
99
- );
100
- const handleClear = (0, import_react2.useCallback)(() => {
101
- onClear == null ? void 0 : onClear();
102
- handleChange(isMultiple ? [] : null);
103
- }, [onClear, handleChange, isMultiple]);
104
- const selectedKeys = (0, import_react2.useMemo)(() => {
105
- if (currentValue == null) return /* @__PURE__ */ new Set();
106
- return new Set(Array.isArray(currentValue) ? currentValue : [currentValue]);
107
- }, [currentValue]);
108
- const handleSelectionChange = (0, import_react2.useCallback)(
109
- (keys) => {
110
- var _a;
111
- if (keys === "all") return;
112
- const selected = Array.from(keys).filter((key) => typeof key === "string");
113
- handleChange(isMultiple ? selected : (_a = selected[0]) != null ? _a : null);
114
- },
115
- [handleChange, isMultiple]
116
- );
117
- const showClearButton = hasValue && isClearable;
118
- return {
119
- currentValue,
120
- hasValue,
121
- selectedKeys,
122
- handleSelectionChange,
123
- handleClear,
124
- showClearButton
125
- };
126
- }
127
-
128
- // src/ui/inputs/select/select.tsx
129
- var import_jsx_runtime2 = require("react/jsx-runtime");
130
- var selectWrapperVariants = (0, import_tailwind_variants.tv)({
131
- variants: {
132
- variant: {
133
- flat: "",
134
- underlined: "",
135
- bordered: "border-1",
136
- faded: "border-1"
137
- }
138
- }
139
- });
140
- var Select = import_react3.default.forwardRef(
141
- ({
142
- value,
143
- defaultSelectedKeys,
144
- items,
145
- onChange,
146
- selectionMode,
147
- onClear,
148
- variant,
149
- classNames,
150
- endContent,
151
- isClearable,
152
- ...props
153
- }, ref) => {
154
- const { selectedKeys, handleSelectionChange, handleClear, showClearButton } = useSelect({
155
- value,
156
- onChange,
157
- onClear,
158
- selectionMode,
159
- isClearable
160
- });
161
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
62
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
162
63
  import_select.Select,
163
64
  {
164
65
  ref,
165
- classNames: {
166
- ...classNames,
167
- trigger: selectWrapperVariants({ variant }),
168
- innerWrapper: "group"
169
- },
170
- defaultSelectedKeys,
171
- endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-1", children: [
172
- endContent,
173
- showClearButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ClearButton, { onClear: handleClear })
174
- ] }),
175
66
  items,
176
67
  selectedKeys,
177
68
  selectionMode,
178
- variant,
179
69
  onSelectionChange: handleSelectionChange,
180
70
  ...props,
181
- children: (item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_select.SelectItem, { children: item.label }, item.key)
71
+ children: (item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectItem, { children: item.label }, item.key)
182
72
  }
183
73
  );
184
74
  }
@@ -2,9 +2,7 @@
2
2
  import "../../../chunk-AQ3ISJKU.mjs";
3
3
  import {
4
4
  Select
5
- } from "../../../chunk-VXYV37IM.mjs";
6
- import "../../../chunk-2UHA3DYG.mjs";
7
- import "../../../chunk-TUIN5YJW.mjs";
5
+ } from "../../../chunk-3YOW5DEZ.mjs";
8
6
  export {
9
7
  Select
10
8
  };
@@ -9,22 +9,18 @@ export type SelectProps = (BaseSelectProps & {
9
9
  selectionMode?: "single";
10
10
  value?: string;
11
11
  onChange?: (value: string | null) => void;
12
- onClear?: () => void;
13
12
  }) | (BaseSelectProps & {
14
13
  selectionMode: "multiple";
15
14
  value?: string[];
16
15
  onChange?: (value: string[]) => void;
17
- onClear?: () => void;
18
16
  });
19
17
  export declare const Select: React.ForwardRefExoticComponent<(Omit<BaseSelectProps & {
20
18
  selectionMode?: "single";
21
19
  value?: string;
22
20
  onChange?: (value: string | null) => void;
23
- onClear?: () => void;
24
21
  }, "ref"> | Omit<BaseSelectProps & {
25
22
  selectionMode: "multiple";
26
23
  value?: string[];
27
24
  onChange?: (value: string[]) => void;
28
- onClear?: () => void;
29
25
  }, "ref">) & React.RefAttributes<HTMLSelectElement>>;
30
26
  export {};