@teach-in/react 1.5.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.
Files changed (92) hide show
  1. package/dist/{chunk-2UHA3DYG.mjs → chunk-6BWSC6ZH.mjs} +3 -10
  2. package/dist/chunk-7WIZONLU.mjs +81 -0
  3. package/dist/chunk-ALGSVEUS.mjs +1 -0
  4. package/dist/chunk-BHOCYKBI.mjs +81 -0
  5. package/dist/{chunk-VXYV37IM.mjs → chunk-C5FQB2UN.mjs} +16 -8
  6. package/dist/{chunk-CKJ5U5Q4.mjs → chunk-DEKPRZIQ.mjs} +1 -1
  7. package/dist/chunk-GEPCSZCU.mjs +71 -0
  8. package/dist/chunk-VDPROXMN.mjs +57 -0
  9. package/dist/{chunk-R46SWVWL.mjs → chunk-ZK6VZMUJ.mjs} +1 -1
  10. package/dist/index.js +487 -248
  11. package/dist/index.mjs +189 -181
  12. package/dist/ui/data/index.js +56 -7
  13. package/dist/ui/data/index.mjs +10 -8
  14. package/dist/ui/data/user/index.js +51 -2
  15. package/dist/ui/data/user/index.mjs +3 -1
  16. package/dist/ui/data/user/user.d.ts +24 -2
  17. package/dist/ui/data/user/user.js +52 -2
  18. package/dist/ui/data/user/user.mjs +4 -1
  19. package/dist/ui/feedback/index.mjs +12 -12
  20. package/dist/ui/feedback/progress/index.mjs +3 -3
  21. package/dist/ui/form/index.js +76 -18
  22. package/dist/ui/form/index.mjs +24 -19
  23. package/dist/ui/form/rhf/fields/autocomplete-field.mjs +19 -14
  24. package/dist/ui/form/rhf/fields/checkbox-field.mjs +19 -14
  25. package/dist/ui/form/rhf/fields/date-picker-field.mjs +19 -14
  26. package/dist/ui/form/rhf/fields/email-field.js +58 -3
  27. package/dist/ui/form/rhf/fields/email-field.mjs +20 -15
  28. package/dist/ui/form/rhf/fields/index.js +76 -18
  29. package/dist/ui/form/rhf/fields/index.mjs +21 -16
  30. package/dist/ui/form/rhf/fields/input-field.mjs +19 -14
  31. package/dist/ui/form/rhf/fields/radio-field.mjs +19 -14
  32. package/dist/ui/form/rhf/fields/search-field.mjs +19 -14
  33. package/dist/ui/form/rhf/fields/select-field.js +18 -15
  34. package/dist/ui/form/rhf/fields/select-field.mjs +20 -15
  35. package/dist/ui/form/rhf/fields/switch-field.mjs +19 -14
  36. package/dist/ui/form/rhf/fields/text-field.mjs +19 -14
  37. package/dist/ui/form/rhf/fields/textarea-field.mjs +19 -14
  38. package/dist/ui/form/rhf/index.js +76 -18
  39. package/dist/ui/form/rhf/index.mjs +21 -16
  40. package/dist/ui/format/index.mjs +6 -6
  41. package/dist/ui/index.js +487 -248
  42. package/dist/ui/index.mjs +189 -181
  43. package/dist/ui/inputs/checkbox/index.mjs +3 -3
  44. package/dist/ui/inputs/email/email.js +58 -3
  45. package/dist/ui/inputs/email/email.mjs +1 -1
  46. package/dist/ui/inputs/email/index.js +58 -3
  47. package/dist/ui/inputs/email/index.mjs +1 -1
  48. package/dist/ui/inputs/index.d.ts +1 -0
  49. package/dist/ui/inputs/index.js +273 -67
  50. package/dist/ui/inputs/index.mjs +36 -26
  51. package/dist/ui/inputs/number/index.d.ts +1 -0
  52. package/dist/ui/inputs/number/index.js +218 -0
  53. package/dist/ui/inputs/number/index.mjs +12 -0
  54. package/dist/ui/inputs/number/number.d.ts +12 -0
  55. package/dist/ui/inputs/number/number.js +219 -0
  56. package/dist/ui/inputs/number/number.mjs +13 -0
  57. package/dist/ui/inputs/number/use-number.d.ts +20 -0
  58. package/dist/ui/inputs/number/use-number.js +104 -0
  59. package/dist/ui/inputs/number/use-number.mjs +7 -0
  60. package/dist/ui/inputs/radio/index.mjs +3 -3
  61. package/dist/ui/inputs/select/index.d.ts +1 -1
  62. package/dist/ui/inputs/select/index.js +23 -17
  63. package/dist/ui/inputs/select/index.mjs +8 -4
  64. package/dist/ui/inputs/select/select.d.ts +11 -22
  65. package/dist/ui/inputs/select/select.js +23 -17
  66. package/dist/ui/inputs/select/select.mjs +8 -4
  67. package/dist/ui/inputs/select/use-select.d.ts +0 -1
  68. package/dist/ui/inputs/select/use-select.js +2 -9
  69. package/dist/ui/inputs/select/use-select.mjs +1 -1
  70. package/dist/ui/inputs/switch/index.mjs +3 -3
  71. package/dist/ui/layout/container/container.mjs +88 -85
  72. package/dist/ui/layout/container/index.mjs +88 -85
  73. package/dist/ui/layout/index.js +7 -7
  74. package/dist/ui/layout/index.mjs +95 -92
  75. package/dist/ui/layout/page/index.mjs +6 -6
  76. package/dist/ui/layout/page/page-loading.mjs +5 -5
  77. package/dist/ui/layout/page/section-loading.mjs +5 -5
  78. package/dist/ui/navigation/index.mjs +5 -5
  79. package/dist/ui/overlays/index.mjs +4 -4
  80. package/dist/ui/provider/index.mjs +5 -5
  81. package/dist/ui/provider/ui-provider.mjs +5 -5
  82. package/dist/ui/surface/index.mjs +1 -1
  83. package/dist/ui/theme/colors/index.mjs +1 -1
  84. package/dist/ui/theme/colors.mjs +1 -1
  85. package/dist/ui/theme/index.mjs +1 -1
  86. package/dist/ui/theme/theme.d.ts +2 -1
  87. package/dist/ui/theme/theme.mjs +1 -1
  88. package/package.json +13 -9
  89. package/LICENSE +0 -21
  90. package/dist/chunk-46SKVFMZ.mjs +0 -16
  91. package/dist/chunk-XHCXM5MU.mjs +0 -14
  92. /package/dist/{chunk-UQAG7TKJ.mjs → chunk-37MCHF7U.mjs} +0 -0
@@ -0,0 +1,218 @@
1
+ "use client";
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/ui/inputs/number/index.ts
32
+ var number_exports = {};
33
+ __export(number_exports, {
34
+ Number: () => Number2
35
+ });
36
+ module.exports = __toCommonJS(number_exports);
37
+
38
+ // src/ui/inputs/number/number.tsx
39
+ var import_react3 = __toESM(require("react"));
40
+ var import_number_input = require("@heroui/number-input");
41
+ var import_tailwind_variants = require("tailwind-variants");
42
+
43
+ // src/ui/inputs/clear-button.tsx
44
+ var import_react = __toESM(require("react"));
45
+ var import_button = require("@heroui/button");
46
+ var import_lucide_react = require("lucide-react");
47
+ 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/style/css.ts
72
+ var import_clsx = require("clsx");
73
+ var import_tailwind_merge = require("tailwind-merge");
74
+ function cn(...inputs) {
75
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
76
+ }
77
+
78
+ // src/ui/inputs/number/use-number.ts
79
+ var import_number = require("@internationalized/number");
80
+ var import_react2 = require("react");
81
+ function normalizeNumberValue(value) {
82
+ if (value == null || Number.isNaN(value)) {
83
+ return null;
84
+ }
85
+ return value;
86
+ }
87
+ function useNumber({
88
+ locale,
89
+ value,
90
+ onChange,
91
+ onValueChange,
92
+ onClear,
93
+ isReadOnly,
94
+ isClearable = true,
95
+ ref
96
+ }) {
97
+ const inputRef = (0, import_react2.useRef)(null);
98
+ const currentValue = normalizeNumberValue(value);
99
+ const hasValue = currentValue !== null;
100
+ const currentLocale = locale != null ? locale : Intl.NumberFormat().resolvedOptions().locale;
101
+ const numberParser = (0, import_react2.useMemo)(() => new import_number.NumberParser(currentLocale), [currentLocale]);
102
+ const emitValueChange = (0, import_react2.useCallback)(
103
+ (newValue) => {
104
+ onValueChange == null ? void 0 : onValueChange(newValue);
105
+ onChange == null ? void 0 : onChange(newValue);
106
+ },
107
+ [onChange, onValueChange]
108
+ );
109
+ const handleValueChange = (0, import_react2.useCallback)(
110
+ (incomingValue) => {
111
+ let newValue = null;
112
+ if (incomingValue === null) {
113
+ newValue = null;
114
+ } else if (typeof incomingValue === "number") {
115
+ newValue = Number.isNaN(incomingValue) ? null : incomingValue;
116
+ } else {
117
+ const rawValue = incomingValue.target.value;
118
+ newValue = rawValue === "" ? null : numberParser.parse(rawValue);
119
+ newValue = Number.isNaN(newValue) ? null : newValue;
120
+ }
121
+ emitValueChange(newValue);
122
+ },
123
+ [emitValueChange, numberParser]
124
+ );
125
+ const handleClear = (0, import_react2.useCallback)(() => {
126
+ var _a;
127
+ onClear == null ? void 0 : onClear();
128
+ emitValueChange(null);
129
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
130
+ }, [emitValueChange, onClear]);
131
+ const mergedRef = (0, import_react2.useCallback)(
132
+ (node) => {
133
+ inputRef.current = node;
134
+ if (typeof ref === "function") {
135
+ ref(node);
136
+ } else if (ref) {
137
+ ref.current = node;
138
+ }
139
+ },
140
+ [ref]
141
+ );
142
+ const showClearButton = hasValue && !isReadOnly && isClearable;
143
+ return {
144
+ inputRef,
145
+ currentValue,
146
+ hasValue,
147
+ handleValueChange,
148
+ handleClear,
149
+ mergedRef,
150
+ showClearButton
151
+ };
152
+ }
153
+
154
+ // src/ui/inputs/number/number.tsx
155
+ var import_jsx_runtime2 = require("react/jsx-runtime");
156
+ var inputWrapperVariants = (0, import_tailwind_variants.tv)({
157
+ variants: {
158
+ variant: {
159
+ flat: "",
160
+ underlined: "",
161
+ bordered: "border-1",
162
+ faded: "border-1"
163
+ }
164
+ }
165
+ });
166
+ var Number2 = import_react3.default.forwardRef(
167
+ ({
168
+ locale,
169
+ value,
170
+ onChange,
171
+ onValueChange,
172
+ onClear,
173
+ variant,
174
+ classNames,
175
+ endContent,
176
+ isReadOnly,
177
+ isClearable,
178
+ ...props
179
+ }, ref) => {
180
+ const { currentValue, handleValueChange, handleClear, mergedRef, showClearButton } = useNumber({
181
+ locale,
182
+ value,
183
+ onChange,
184
+ onValueChange,
185
+ onClear,
186
+ isReadOnly,
187
+ isClearable,
188
+ ref
189
+ });
190
+ const normalizedValue = currentValue === null ? globalThis.Number.NaN : currentValue;
191
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
192
+ import_number_input.NumberInput,
193
+ {
194
+ ref: mergedRef,
195
+ classNames: {
196
+ ...classNames,
197
+ inputWrapper: cn(inputWrapperVariants({ variant }), classNames == null ? void 0 : classNames.inputWrapper),
198
+ innerWrapper: cn("group", classNames == null ? void 0 : classNames.innerWrapper)
199
+ },
200
+ endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-1", children: [
201
+ endContent,
202
+ showClearButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ClearButton, { onClear: handleClear })
203
+ ] }),
204
+ inputMode: "decimal",
205
+ isReadOnly,
206
+ value: normalizedValue,
207
+ variant,
208
+ onChange: handleValueChange,
209
+ ...props
210
+ }
211
+ );
212
+ }
213
+ );
214
+ Number2.displayName = "TeachInUI.Number";
215
+ // Annotate the CommonJS export names for ESM import in node:
216
+ 0 && (module.exports = {
217
+ Number
218
+ });
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import "../../../chunk-ALGSVEUS.mjs";
3
+ import {
4
+ Number
5
+ } from "../../../chunk-BHOCYKBI.mjs";
6
+ import "../../../chunk-7WIZONLU.mjs";
7
+ import "../../../chunk-TUIN5YJW.mjs";
8
+ import "../../../chunk-Q6XJI7Q2.mjs";
9
+ import "../../../chunk-LOMRTWX5.mjs";
10
+ export {
11
+ Number
12
+ };
@@ -0,0 +1,12 @@
1
+ import type { NumberInputProps as HeroUINumberInputProps } from "@heroui/number-input";
2
+ import React from "react";
3
+ export interface NumberProps extends Omit<HeroUINumberInputProps, "defaultValue" | "isClearable" | "onChange" | "onClear" | "onValueChange" | "value"> {
4
+ locale?: string;
5
+ value: number | null;
6
+ isClearable?: boolean;
7
+ onChange?: (value: number | null) => void;
8
+ onValueChange?: (value: number | null) => void;
9
+ onClear?: () => void;
10
+ }
11
+ export declare const Number: React.ForwardRefExoticComponent<Omit<NumberProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
12
+ export declare const NumberInput: React.ForwardRefExoticComponent<Omit<NumberProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,219 @@
1
+ "use client";
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/ui/inputs/number/number.tsx
32
+ var number_exports = {};
33
+ __export(number_exports, {
34
+ Number: () => Number2,
35
+ NumberInput: () => NumberInput
36
+ });
37
+ module.exports = __toCommonJS(number_exports);
38
+ var import_react3 = __toESM(require("react"));
39
+ var import_number_input = require("@heroui/number-input");
40
+ var import_tailwind_variants = require("tailwind-variants");
41
+
42
+ // src/ui/inputs/clear-button.tsx
43
+ var import_react = __toESM(require("react"));
44
+ var import_button = require("@heroui/button");
45
+ var import_lucide_react = require("lucide-react");
46
+ var import_jsx_runtime = require("react/jsx-runtime");
47
+ var ClearButton = import_react.default.forwardRef(
48
+ ({ onClear }, ref) => {
49
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
+ import_button.Button,
51
+ {
52
+ ref,
53
+ isIconOnly: true,
54
+ "aria-label": "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
55
+ as: "span",
56
+ className: "opacity-0 transition-opacity group-hover:opacity-100",
57
+ color: "default",
58
+ radius: "full",
59
+ size: "sm",
60
+ tabIndex: 0,
61
+ variant: "light",
62
+ onPress: onClear,
63
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XIcon, { className: "size-4 text-default-500" })
64
+ }
65
+ );
66
+ }
67
+ );
68
+ ClearButton.displayName = "TeachInUI.ClearButton";
69
+
70
+ // src/ui/style/css.ts
71
+ var import_clsx = require("clsx");
72
+ var import_tailwind_merge = require("tailwind-merge");
73
+ function cn(...inputs) {
74
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
75
+ }
76
+
77
+ // src/ui/inputs/number/use-number.ts
78
+ var import_number = require("@internationalized/number");
79
+ var import_react2 = require("react");
80
+ function normalizeNumberValue(value) {
81
+ if (value == null || Number.isNaN(value)) {
82
+ return null;
83
+ }
84
+ return value;
85
+ }
86
+ function useNumber({
87
+ locale,
88
+ value,
89
+ onChange,
90
+ onValueChange,
91
+ onClear,
92
+ isReadOnly,
93
+ isClearable = true,
94
+ ref
95
+ }) {
96
+ const inputRef = (0, import_react2.useRef)(null);
97
+ const currentValue = normalizeNumberValue(value);
98
+ const hasValue = currentValue !== null;
99
+ const currentLocale = locale != null ? locale : Intl.NumberFormat().resolvedOptions().locale;
100
+ const numberParser = (0, import_react2.useMemo)(() => new import_number.NumberParser(currentLocale), [currentLocale]);
101
+ const emitValueChange = (0, import_react2.useCallback)(
102
+ (newValue) => {
103
+ onValueChange == null ? void 0 : onValueChange(newValue);
104
+ onChange == null ? void 0 : onChange(newValue);
105
+ },
106
+ [onChange, onValueChange]
107
+ );
108
+ const handleValueChange = (0, import_react2.useCallback)(
109
+ (incomingValue) => {
110
+ let newValue = null;
111
+ if (incomingValue === null) {
112
+ newValue = null;
113
+ } else if (typeof incomingValue === "number") {
114
+ newValue = Number.isNaN(incomingValue) ? null : incomingValue;
115
+ } else {
116
+ const rawValue = incomingValue.target.value;
117
+ newValue = rawValue === "" ? null : numberParser.parse(rawValue);
118
+ newValue = Number.isNaN(newValue) ? null : newValue;
119
+ }
120
+ emitValueChange(newValue);
121
+ },
122
+ [emitValueChange, numberParser]
123
+ );
124
+ const handleClear = (0, import_react2.useCallback)(() => {
125
+ var _a;
126
+ onClear == null ? void 0 : onClear();
127
+ emitValueChange(null);
128
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
129
+ }, [emitValueChange, onClear]);
130
+ const mergedRef = (0, import_react2.useCallback)(
131
+ (node) => {
132
+ inputRef.current = node;
133
+ if (typeof ref === "function") {
134
+ ref(node);
135
+ } else if (ref) {
136
+ ref.current = node;
137
+ }
138
+ },
139
+ [ref]
140
+ );
141
+ const showClearButton = hasValue && !isReadOnly && isClearable;
142
+ return {
143
+ inputRef,
144
+ currentValue,
145
+ hasValue,
146
+ handleValueChange,
147
+ handleClear,
148
+ mergedRef,
149
+ showClearButton
150
+ };
151
+ }
152
+
153
+ // src/ui/inputs/number/number.tsx
154
+ var import_jsx_runtime2 = require("react/jsx-runtime");
155
+ var inputWrapperVariants = (0, import_tailwind_variants.tv)({
156
+ variants: {
157
+ variant: {
158
+ flat: "",
159
+ underlined: "",
160
+ bordered: "border-1",
161
+ faded: "border-1"
162
+ }
163
+ }
164
+ });
165
+ var Number2 = import_react3.default.forwardRef(
166
+ ({
167
+ locale,
168
+ value,
169
+ onChange,
170
+ onValueChange,
171
+ onClear,
172
+ variant,
173
+ classNames,
174
+ endContent,
175
+ isReadOnly,
176
+ isClearable,
177
+ ...props
178
+ }, ref) => {
179
+ const { currentValue, handleValueChange, handleClear, mergedRef, showClearButton } = useNumber({
180
+ locale,
181
+ value,
182
+ onChange,
183
+ onValueChange,
184
+ onClear,
185
+ isReadOnly,
186
+ isClearable,
187
+ ref
188
+ });
189
+ const normalizedValue = currentValue === null ? globalThis.Number.NaN : currentValue;
190
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
191
+ import_number_input.NumberInput,
192
+ {
193
+ ref: mergedRef,
194
+ classNames: {
195
+ ...classNames,
196
+ inputWrapper: cn(inputWrapperVariants({ variant }), classNames == null ? void 0 : classNames.inputWrapper),
197
+ innerWrapper: cn("group", classNames == null ? void 0 : classNames.innerWrapper)
198
+ },
199
+ endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-1", children: [
200
+ endContent,
201
+ showClearButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ClearButton, { onClear: handleClear })
202
+ ] }),
203
+ inputMode: "decimal",
204
+ isReadOnly,
205
+ value: normalizedValue,
206
+ variant,
207
+ onChange: handleValueChange,
208
+ ...props
209
+ }
210
+ );
211
+ }
212
+ );
213
+ Number2.displayName = "TeachInUI.Number";
214
+ var NumberInput = Number2;
215
+ // Annotate the CommonJS export names for ESM import in node:
216
+ 0 && (module.exports = {
217
+ Number,
218
+ NumberInput
219
+ });
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import {
3
+ Number,
4
+ NumberInput
5
+ } from "../../../chunk-BHOCYKBI.mjs";
6
+ import "../../../chunk-7WIZONLU.mjs";
7
+ import "../../../chunk-TUIN5YJW.mjs";
8
+ import "../../../chunk-Q6XJI7Q2.mjs";
9
+ import "../../../chunk-LOMRTWX5.mjs";
10
+ export {
11
+ Number,
12
+ NumberInput
13
+ };
@@ -0,0 +1,20 @@
1
+ interface UseNumberProps {
2
+ locale?: string;
3
+ value: number | null;
4
+ onChange?: (value: number | null) => void;
5
+ onValueChange?: (value: number | null) => void;
6
+ onClear?: () => void;
7
+ isReadOnly?: boolean;
8
+ isClearable?: boolean;
9
+ ref?: React.Ref<HTMLInputElement>;
10
+ }
11
+ export declare function useNumber({ locale, value, onChange, onValueChange, onClear, isReadOnly, isClearable, ref, }: UseNumberProps): {
12
+ inputRef: import("react").RefObject<HTMLInputElement | null>;
13
+ currentValue: number | null;
14
+ hasValue: boolean;
15
+ handleValueChange: (incomingValue: React.ChangeEvent<HTMLInputElement> | number | null) => void;
16
+ handleClear: () => void;
17
+ mergedRef: (node: HTMLInputElement | null) => void;
18
+ showClearButton: boolean;
19
+ };
20
+ export {};
@@ -0,0 +1,104 @@
1
+ "use client";
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/ui/inputs/number/use-number.ts
22
+ var use_number_exports = {};
23
+ __export(use_number_exports, {
24
+ useNumber: () => useNumber
25
+ });
26
+ module.exports = __toCommonJS(use_number_exports);
27
+ var import_number = require("@internationalized/number");
28
+ var import_react = require("react");
29
+ function normalizeNumberValue(value) {
30
+ if (value == null || Number.isNaN(value)) {
31
+ return null;
32
+ }
33
+ return value;
34
+ }
35
+ function useNumber({
36
+ locale,
37
+ value,
38
+ onChange,
39
+ onValueChange,
40
+ onClear,
41
+ isReadOnly,
42
+ isClearable = true,
43
+ ref
44
+ }) {
45
+ const inputRef = (0, import_react.useRef)(null);
46
+ const currentValue = normalizeNumberValue(value);
47
+ const hasValue = currentValue !== null;
48
+ const currentLocale = locale != null ? locale : Intl.NumberFormat().resolvedOptions().locale;
49
+ const numberParser = (0, import_react.useMemo)(() => new import_number.NumberParser(currentLocale), [currentLocale]);
50
+ const emitValueChange = (0, import_react.useCallback)(
51
+ (newValue) => {
52
+ onValueChange == null ? void 0 : onValueChange(newValue);
53
+ onChange == null ? void 0 : onChange(newValue);
54
+ },
55
+ [onChange, onValueChange]
56
+ );
57
+ const handleValueChange = (0, import_react.useCallback)(
58
+ (incomingValue) => {
59
+ let newValue = null;
60
+ if (incomingValue === null) {
61
+ newValue = null;
62
+ } else if (typeof incomingValue === "number") {
63
+ newValue = Number.isNaN(incomingValue) ? null : incomingValue;
64
+ } else {
65
+ const rawValue = incomingValue.target.value;
66
+ newValue = rawValue === "" ? null : numberParser.parse(rawValue);
67
+ newValue = Number.isNaN(newValue) ? null : newValue;
68
+ }
69
+ emitValueChange(newValue);
70
+ },
71
+ [emitValueChange, numberParser]
72
+ );
73
+ const handleClear = (0, import_react.useCallback)(() => {
74
+ var _a;
75
+ onClear == null ? void 0 : onClear();
76
+ emitValueChange(null);
77
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
78
+ }, [emitValueChange, onClear]);
79
+ const mergedRef = (0, import_react.useCallback)(
80
+ (node) => {
81
+ inputRef.current = node;
82
+ if (typeof ref === "function") {
83
+ ref(node);
84
+ } else if (ref) {
85
+ ref.current = node;
86
+ }
87
+ },
88
+ [ref]
89
+ );
90
+ const showClearButton = hasValue && !isReadOnly && isClearable;
91
+ return {
92
+ inputRef,
93
+ currentValue,
94
+ hasValue,
95
+ handleValueChange,
96
+ handleClear,
97
+ mergedRef,
98
+ showClearButton
99
+ };
100
+ }
101
+ // Annotate the CommonJS export names for ESM import in node:
102
+ 0 && (module.exports = {
103
+ useNumber
104
+ });
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ useNumber
4
+ } from "../../../chunk-7WIZONLU.mjs";
5
+ export {
6
+ useNumber
7
+ };
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import "../../../chunk-RRA7GWP2.mjs";
3
- import {
4
- Radio
5
- } from "../../../chunk-2SNKT7I4.mjs";
6
3
  import {
7
4
  RadioGroup
8
5
  } from "../../../chunk-NOXFF2KJ.mjs";
6
+ import {
7
+ Radio
8
+ } from "../../../chunk-2SNKT7I4.mjs";
9
9
  export {
10
10
  Radio,
11
11
  RadioGroup
@@ -1 +1 @@
1
- export { Select, type SelectProps } from "./select";
1
+ export { Select, SelectItem, type SelectProps } from "./select";