@saas-ui/forms 2.3.12 → 2.4.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/CHANGELOG.md +13 -0
- package/dist/index.d.ts +22 -6
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -14
- package/dist/index.mjs.map +1 -1
- package/dist/yup/index.d.ts +9 -1
- package/dist/zod/index.d.ts +9 -1
- package/package.json +2 -2
- package/src/auto-form.tsx +6 -3
- package/src/default-fields.tsx +3 -0
- package/src/field-resolver.ts +26 -7
- package/src/number-input/number-input.stories.tsx +37 -16
- package/src/number-input/number-input.tsx +29 -5
package/dist/index.mjs
CHANGED
@@ -61,11 +61,11 @@ import React5 from "react";
|
|
61
61
|
// src/default-fields.tsx
|
62
62
|
import {
|
63
63
|
forwardRef as forwardRef8,
|
64
|
-
Input as
|
64
|
+
Input as Input3,
|
65
65
|
Textarea,
|
66
66
|
Checkbox,
|
67
67
|
Switch,
|
68
|
-
InputGroup as
|
68
|
+
InputGroup as InputGroup3,
|
69
69
|
PinInputField,
|
70
70
|
HStack,
|
71
71
|
PinInput
|
@@ -78,45 +78,55 @@ import {
|
|
78
78
|
NumberInputField,
|
79
79
|
NumberInputStepper,
|
80
80
|
NumberIncrementStepper,
|
81
|
-
NumberDecrementStepper
|
81
|
+
NumberDecrementStepper,
|
82
|
+
InputGroup
|
82
83
|
} from "@chakra-ui/react";
|
83
84
|
import { ChevronDownIcon, ChevronUpIcon } from "@saas-ui/core";
|
84
85
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
86
|
+
var Input = forwardRef((props, ref) => /* @__PURE__ */ jsx3(NumberInputField, { ref, ...props }));
|
87
|
+
Input.displayName = "NumberInputField";
|
88
|
+
Input.id = "Input";
|
85
89
|
var NumberInput = forwardRef((props, ref) => {
|
86
90
|
const {
|
87
91
|
hideStepper = false,
|
88
92
|
incrementIcon = /* @__PURE__ */ jsx3(ChevronUpIcon, {}),
|
89
93
|
decrementIcon = /* @__PURE__ */ jsx3(ChevronDownIcon, {}),
|
94
|
+
leftAddon,
|
95
|
+
rightAddon,
|
90
96
|
placeholder,
|
91
97
|
fieldProps: _fieldProps,
|
92
98
|
...rest
|
93
99
|
} = props;
|
94
100
|
const fieldProps = { placeholder, ..._fieldProps };
|
95
101
|
return /* @__PURE__ */ jsxs2(ChakraNumberInput, { ...rest, ref, children: [
|
96
|
-
/* @__PURE__ */
|
97
|
-
|
102
|
+
/* @__PURE__ */ jsxs2(InputGroup, { children: [
|
103
|
+
leftAddon,
|
104
|
+
/* @__PURE__ */ jsx3(Input, { ...fieldProps }),
|
105
|
+
rightAddon
|
106
|
+
] }),
|
107
|
+
!hideStepper && !rightAddon ? /* @__PURE__ */ jsxs2(NumberInputStepper, { children: [
|
98
108
|
/* @__PURE__ */ jsx3(NumberIncrementStepper, { children: incrementIcon }),
|
99
109
|
/* @__PURE__ */ jsx3(NumberDecrementStepper, { children: decrementIcon })
|
100
|
-
] })
|
110
|
+
] }) : null
|
101
111
|
] });
|
102
112
|
});
|
103
113
|
NumberInput.displayName = "NumberInput";
|
104
114
|
|
105
115
|
// src/password-input/password-input.tsx
|
106
116
|
import { useState } from "react";
|
107
|
-
import { forwardRef as forwardRef3, InputGroup, Input } from "@chakra-ui/react";
|
117
|
+
import { forwardRef as forwardRef3, InputGroup as InputGroup2, Input as Input2 } from "@chakra-ui/react";
|
108
118
|
import { ViewIcon, ViewOffIcon } from "@saas-ui/core/icons";
|
109
119
|
|
110
120
|
// src/input-right-button/input-right-button.tsx
|
111
121
|
import {
|
112
122
|
Button,
|
113
123
|
forwardRef as forwardRef2,
|
114
|
-
InputRightElement
|
124
|
+
InputRightElement as InputRightElement2
|
115
125
|
} from "@chakra-ui/react";
|
116
126
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
117
127
|
var InputRightButton = forwardRef2(
|
118
128
|
(props, ref) => {
|
119
|
-
return /* @__PURE__ */ jsx4(
|
129
|
+
return /* @__PURE__ */ jsx4(InputRightElement2, { w: "auto", px: "1", py: "1", alignItems: "stretch", children: /* @__PURE__ */ jsx4(Button, { ref, height: "auto", ...props }) });
|
120
130
|
}
|
121
131
|
);
|
122
132
|
InputRightButton.id = "InputRightElement";
|
@@ -151,10 +161,10 @@ var PasswordInput = forwardRef3(
|
|
151
161
|
size,
|
152
162
|
variant
|
153
163
|
};
|
154
|
-
return /* @__PURE__ */ jsxs3(
|
164
|
+
return /* @__PURE__ */ jsxs3(InputGroup2, { ...groupProps, children: [
|
155
165
|
leftAddon,
|
156
166
|
/* @__PURE__ */ jsx5(
|
157
|
-
|
167
|
+
Input2,
|
158
168
|
{
|
159
169
|
...inputProps,
|
160
170
|
ref,
|
@@ -610,9 +620,9 @@ var createField = (component, options) => {
|
|
610
620
|
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
611
621
|
var InputField = createField(
|
612
622
|
forwardRef8(({ type = "text", leftAddon, rightAddon, size, ...rest }, ref) => {
|
613
|
-
const input = /* @__PURE__ */ jsx11(
|
623
|
+
const input = /* @__PURE__ */ jsx11(Input3, { type, size, ...rest, ref });
|
614
624
|
if (leftAddon || rightAddon) {
|
615
|
-
return /* @__PURE__ */ jsxs6(
|
625
|
+
return /* @__PURE__ */ jsxs6(InputGroup3, { size, children: [
|
616
626
|
leftAddon,
|
617
627
|
input,
|
618
628
|
rightAddon
|
@@ -1313,7 +1323,8 @@ NextButton.displayName = "NextButton";
|
|
1313
1323
|
|
1314
1324
|
// src/field-resolver.ts
|
1315
1325
|
import { get as get2 } from "@chakra-ui/utils";
|
1316
|
-
var mapFields = (schema) => schema && Object.entries(schema).map(([name,
|
1326
|
+
var mapFields = (schema) => schema && Object.entries(schema).map(([name, props]) => {
|
1327
|
+
const { items, label, title, ...field } = props;
|
1317
1328
|
return {
|
1318
1329
|
...field,
|
1319
1330
|
name,
|