@edux-design/forms 0.0.9 → 0.0.11
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/README.md +1 -0
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +28 -5
- package/dist/index.mjs +28 -5
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -82,6 +82,7 @@ Every `Field` instance mounts a internal context. `Label`, `Input`, `Textarea`,
|
|
|
82
82
|
- Provides layout (`flex`, `gap-8`) and context wiring.
|
|
83
83
|
- Accepts any children; typically wraps `Label`, a control (`Input`, `Textarea`, `Radio`), and optional `Field.Feedback`.
|
|
84
84
|
- Set `orientation="horizontal"` when you need inline layouts (e.g., Switch + label) without affecting other form groups.
|
|
85
|
+
- Use `justify="between"` with `orientation="horizontal"` to align left labels and right controls across a column.
|
|
85
86
|
- Re-exports `Field.Feedback` for ergonomic composition.
|
|
86
87
|
|
|
87
88
|
### `<Label>`
|
package/dist/index.d.mts
CHANGED
|
@@ -20,6 +20,7 @@ declare function Label({ children, hint, description, ...props }: {
|
|
|
20
20
|
* clearable?: boolean,
|
|
21
21
|
* startIcon?: React.ReactNode,
|
|
22
22
|
* endIcon?: React.ReactNode|string,
|
|
23
|
+
* size?: "default"|"small",
|
|
23
24
|
* value?: any,
|
|
24
25
|
* onChange?: (e: React.ChangeEvent<HTMLInputElement> | { target: { value: string } }) => void,
|
|
25
26
|
* }} InputProps
|
|
@@ -48,6 +49,7 @@ type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
|
48
49
|
clearable?: boolean;
|
|
49
50
|
startIcon?: React.ReactNode;
|
|
50
51
|
endIcon?: React.ReactNode | string;
|
|
52
|
+
size?: "default" | "small";
|
|
51
53
|
value?: any;
|
|
52
54
|
onChange?: (e: React.ChangeEvent<HTMLInputElement> | {
|
|
53
55
|
target: {
|
|
@@ -177,7 +179,10 @@ type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
|
177
179
|
* @returns {React.ReactElement}
|
|
178
180
|
*/
|
|
179
181
|
declare function Feedback({ id, tone, children, className, ...rest }: FeedbackProps): React.ReactElement;
|
|
180
|
-
declare function Field({ children, orientation, className, }: FieldProps
|
|
182
|
+
declare function Field({ children, orientation, justify, className, }: FieldProps & {
|
|
183
|
+
orientation?: "vertical" | "horizontal";
|
|
184
|
+
justify?: "start" | "between";
|
|
185
|
+
}): React.ReactElement;
|
|
181
186
|
declare namespace Field {
|
|
182
187
|
export { Feedback };
|
|
183
188
|
}
|
|
@@ -241,6 +246,7 @@ declare const Option: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
|
|
|
241
246
|
* @property {string} [contentClassName] - optional class for the popover content
|
|
242
247
|
* @property {string} [listClassName] - optional class for the list element
|
|
243
248
|
* @property {string} [optionClassName] - optional class for each option
|
|
249
|
+
* @property {"default"|"small"} [size="default"] - size variant for the combobox input
|
|
244
250
|
*/
|
|
245
251
|
declare const ComboboxRoot: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
|
|
246
252
|
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ declare function Label({ children, hint, description, ...props }: {
|
|
|
20
20
|
* clearable?: boolean,
|
|
21
21
|
* startIcon?: React.ReactNode,
|
|
22
22
|
* endIcon?: React.ReactNode|string,
|
|
23
|
+
* size?: "default"|"small",
|
|
23
24
|
* value?: any,
|
|
24
25
|
* onChange?: (e: React.ChangeEvent<HTMLInputElement> | { target: { value: string } }) => void,
|
|
25
26
|
* }} InputProps
|
|
@@ -48,6 +49,7 @@ type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
|
48
49
|
clearable?: boolean;
|
|
49
50
|
startIcon?: React.ReactNode;
|
|
50
51
|
endIcon?: React.ReactNode | string;
|
|
52
|
+
size?: "default" | "small";
|
|
51
53
|
value?: any;
|
|
52
54
|
onChange?: (e: React.ChangeEvent<HTMLInputElement> | {
|
|
53
55
|
target: {
|
|
@@ -177,7 +179,10 @@ type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
|
177
179
|
* @returns {React.ReactElement}
|
|
178
180
|
*/
|
|
179
181
|
declare function Feedback({ id, tone, children, className, ...rest }: FeedbackProps): React.ReactElement;
|
|
180
|
-
declare function Field({ children, orientation, className, }: FieldProps
|
|
182
|
+
declare function Field({ children, orientation, justify, className, }: FieldProps & {
|
|
183
|
+
orientation?: "vertical" | "horizontal";
|
|
184
|
+
justify?: "start" | "between";
|
|
185
|
+
}): React.ReactElement;
|
|
181
186
|
declare namespace Field {
|
|
182
187
|
export { Feedback };
|
|
183
188
|
}
|
|
@@ -241,6 +246,7 @@ declare const Option: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
|
|
|
241
246
|
* @property {string} [contentClassName] - optional class for the popover content
|
|
242
247
|
* @property {string} [listClassName] - optional class for the list element
|
|
243
248
|
* @property {string} [optionClassName] - optional class for each option
|
|
249
|
+
* @property {"default"|"small"} [size="default"] - size variant for the combobox input
|
|
244
250
|
*/
|
|
245
251
|
declare const ComboboxRoot: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
|
|
246
252
|
|
package/dist/index.js
CHANGED
|
@@ -147,14 +147,19 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
147
147
|
validation,
|
|
148
148
|
variant = "primary",
|
|
149
149
|
clearable = false,
|
|
150
|
+
size = "default",
|
|
150
151
|
startIcon,
|
|
151
152
|
endIcon,
|
|
152
153
|
...props
|
|
153
154
|
}, ref) => {
|
|
154
155
|
const { labelHTMLForId } = useFieldContext();
|
|
155
156
|
const hasValue = Boolean(props.value);
|
|
156
|
-
const defaults = "
|
|
157
|
-
const fonts = "font-normal text-base";
|
|
157
|
+
const defaults = "bg-white w-full border-2 rounded-md border-border-base focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out pl-5";
|
|
158
|
+
const fonts = size === "small" ? "font-normal text-sm" : "font-normal text-base";
|
|
159
|
+
const sizes = {
|
|
160
|
+
default: "h-[44px]",
|
|
161
|
+
small: "h-[36px]"
|
|
162
|
+
};
|
|
158
163
|
const variants = {
|
|
159
164
|
primary: "hover:border-2 hover:border-border-primary-base focus:border-2 focus:border-border-primary-base focus-within:border-2 focus-within:border-border-primary-base",
|
|
160
165
|
error: "border-border-danger-base bg-bg-danger-subtle",
|
|
@@ -165,6 +170,7 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
165
170
|
const INPUT_STYLES = (0, import_utils.cx)(
|
|
166
171
|
defaults,
|
|
167
172
|
fonts,
|
|
173
|
+
sizes[size],
|
|
168
174
|
variants[variant],
|
|
169
175
|
startIcon && "pl-10",
|
|
170
176
|
clearable && endIcon && "pr-10",
|
|
@@ -231,9 +237,12 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
|
231
237
|
var Field = ({
|
|
232
238
|
children,
|
|
233
239
|
orientation = "vertical",
|
|
240
|
+
justify = "start",
|
|
234
241
|
className
|
|
235
242
|
}) => {
|
|
236
|
-
const
|
|
243
|
+
const isHorizontal = orientation === "horizontal";
|
|
244
|
+
const horizontalClasses = justify === "between" ? "flex-row items-center justify-between gap-0" : "flex-row items-center gap-6";
|
|
245
|
+
const orientationClasses = isHorizontal ? horizontalClasses : "flex-col items-start gap-8";
|
|
237
246
|
const FIELD_GROUP_WRAPPER_STYLES = (0, import_utils2.cx)(
|
|
238
247
|
"flex relative",
|
|
239
248
|
orientationClasses,
|
|
@@ -875,6 +884,7 @@ var ComboboxRoot = (0, import_react10.forwardRef)(
|
|
|
875
884
|
contentClassName,
|
|
876
885
|
listClassName,
|
|
877
886
|
optionClassName,
|
|
887
|
+
size = "default",
|
|
878
888
|
...inputProps
|
|
879
889
|
}, ref) => {
|
|
880
890
|
const {
|
|
@@ -1143,6 +1153,16 @@ var ComboboxRoot = (0, import_react10.forwardRef)(
|
|
|
1143
1153
|
setOpen(true);
|
|
1144
1154
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
1145
1155
|
};
|
|
1156
|
+
const sizeStyles = {
|
|
1157
|
+
default: {
|
|
1158
|
+
container: "min-h-[44px] px-4 py-2",
|
|
1159
|
+
input: "text-base py-1"
|
|
1160
|
+
},
|
|
1161
|
+
small: {
|
|
1162
|
+
container: "min-h-[36px] px-3 py-1",
|
|
1163
|
+
input: "text-sm py-0.5"
|
|
1164
|
+
}
|
|
1165
|
+
};
|
|
1146
1166
|
const selectedChips = isMultiSelectEnabled && multiSelectedOptions.length > 0 ? multiSelectedOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1147
1167
|
import_chips.Chip,
|
|
1148
1168
|
{
|
|
@@ -1168,7 +1188,8 @@ var ComboboxRoot = (0, import_react10.forwardRef)(
|
|
|
1168
1188
|
"div",
|
|
1169
1189
|
{
|
|
1170
1190
|
className: (0, import_utils7.cx)(
|
|
1171
|
-
"w-full
|
|
1191
|
+
"w-full border-2 rounded-md bg-white flex items-center gap-3 cursor-text",
|
|
1192
|
+
sizeStyles[size].container,
|
|
1172
1193
|
"border-border-base hover:border-border-primary-base focus-within:border-border-primary-base focus-within:shadow-focus",
|
|
1173
1194
|
disabled && "bg-bg-inactive text-fg-inactive cursor-not-allowed border-border-subtle"
|
|
1174
1195
|
),
|
|
@@ -1181,7 +1202,8 @@ var ComboboxRoot = (0, import_react10.forwardRef)(
|
|
|
1181
1202
|
{
|
|
1182
1203
|
ref: mergedRef,
|
|
1183
1204
|
className: (0, import_utils7.cx)(
|
|
1184
|
-
"flex-1 basis-[140px] min-w-[120px] border-none bg-transparent outline-none
|
|
1205
|
+
"flex-1 basis-[140px] min-w-[120px] border-none bg-transparent outline-none leading-tight pl-5",
|
|
1206
|
+
sizeStyles[size].input,
|
|
1185
1207
|
disabled && "cursor-not-allowed text-fg-inactive"
|
|
1186
1208
|
),
|
|
1187
1209
|
value: inputDisplayValue,
|
|
@@ -1227,6 +1249,7 @@ var ComboboxRoot = (0, import_react10.forwardRef)(
|
|
|
1227
1249
|
value: inputDisplayValue,
|
|
1228
1250
|
disabled,
|
|
1229
1251
|
readOnly: selectOnly,
|
|
1252
|
+
size,
|
|
1230
1253
|
autoComplete: "off",
|
|
1231
1254
|
onChange: handleInputChange,
|
|
1232
1255
|
onFocus: handleFocus,
|
package/dist/index.mjs
CHANGED
|
@@ -109,14 +109,19 @@ var Input = forwardRef(
|
|
|
109
109
|
validation,
|
|
110
110
|
variant = "primary",
|
|
111
111
|
clearable = false,
|
|
112
|
+
size = "default",
|
|
112
113
|
startIcon,
|
|
113
114
|
endIcon,
|
|
114
115
|
...props
|
|
115
116
|
}, ref) => {
|
|
116
117
|
const { labelHTMLForId } = useFieldContext();
|
|
117
118
|
const hasValue = Boolean(props.value);
|
|
118
|
-
const defaults = "
|
|
119
|
-
const fonts = "font-normal text-base";
|
|
119
|
+
const defaults = "bg-white w-full border-2 rounded-md border-border-base focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out pl-5";
|
|
120
|
+
const fonts = size === "small" ? "font-normal text-sm" : "font-normal text-base";
|
|
121
|
+
const sizes = {
|
|
122
|
+
default: "h-[44px]",
|
|
123
|
+
small: "h-[36px]"
|
|
124
|
+
};
|
|
120
125
|
const variants = {
|
|
121
126
|
primary: "hover:border-2 hover:border-border-primary-base focus:border-2 focus:border-border-primary-base focus-within:border-2 focus-within:border-border-primary-base",
|
|
122
127
|
error: "border-border-danger-base bg-bg-danger-subtle",
|
|
@@ -127,6 +132,7 @@ var Input = forwardRef(
|
|
|
127
132
|
const INPUT_STYLES = cx(
|
|
128
133
|
defaults,
|
|
129
134
|
fonts,
|
|
135
|
+
sizes[size],
|
|
130
136
|
variants[variant],
|
|
131
137
|
startIcon && "pl-10",
|
|
132
138
|
clearable && endIcon && "pr-10",
|
|
@@ -193,9 +199,12 @@ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
|
193
199
|
var Field = ({
|
|
194
200
|
children,
|
|
195
201
|
orientation = "vertical",
|
|
202
|
+
justify = "start",
|
|
196
203
|
className
|
|
197
204
|
}) => {
|
|
198
|
-
const
|
|
205
|
+
const isHorizontal = orientation === "horizontal";
|
|
206
|
+
const horizontalClasses = justify === "between" ? "flex-row items-center justify-between gap-0" : "flex-row items-center gap-6";
|
|
207
|
+
const orientationClasses = isHorizontal ? horizontalClasses : "flex-col items-start gap-8";
|
|
199
208
|
const FIELD_GROUP_WRAPPER_STYLES = cx2(
|
|
200
209
|
"flex relative",
|
|
201
210
|
orientationClasses,
|
|
@@ -846,6 +855,7 @@ var ComboboxRoot = forwardRef6(
|
|
|
846
855
|
contentClassName,
|
|
847
856
|
listClassName,
|
|
848
857
|
optionClassName,
|
|
858
|
+
size = "default",
|
|
849
859
|
...inputProps
|
|
850
860
|
}, ref) => {
|
|
851
861
|
const {
|
|
@@ -1114,6 +1124,16 @@ var ComboboxRoot = forwardRef6(
|
|
|
1114
1124
|
setOpen(true);
|
|
1115
1125
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
1116
1126
|
};
|
|
1127
|
+
const sizeStyles = {
|
|
1128
|
+
default: {
|
|
1129
|
+
container: "min-h-[44px] px-4 py-2",
|
|
1130
|
+
input: "text-base py-1"
|
|
1131
|
+
},
|
|
1132
|
+
small: {
|
|
1133
|
+
container: "min-h-[36px] px-3 py-1",
|
|
1134
|
+
input: "text-sm py-0.5"
|
|
1135
|
+
}
|
|
1136
|
+
};
|
|
1117
1137
|
const selectedChips = isMultiSelectEnabled && multiSelectedOptions.length > 0 ? multiSelectedOptions.map((option) => /* @__PURE__ */ jsx9(
|
|
1118
1138
|
Chip,
|
|
1119
1139
|
{
|
|
@@ -1139,7 +1159,8 @@ var ComboboxRoot = forwardRef6(
|
|
|
1139
1159
|
"div",
|
|
1140
1160
|
{
|
|
1141
1161
|
className: cx7(
|
|
1142
|
-
"w-full
|
|
1162
|
+
"w-full border-2 rounded-md bg-white flex items-center gap-3 cursor-text",
|
|
1163
|
+
sizeStyles[size].container,
|
|
1143
1164
|
"border-border-base hover:border-border-primary-base focus-within:border-border-primary-base focus-within:shadow-focus",
|
|
1144
1165
|
disabled && "bg-bg-inactive text-fg-inactive cursor-not-allowed border-border-subtle"
|
|
1145
1166
|
),
|
|
@@ -1152,7 +1173,8 @@ var ComboboxRoot = forwardRef6(
|
|
|
1152
1173
|
{
|
|
1153
1174
|
ref: mergedRef,
|
|
1154
1175
|
className: cx7(
|
|
1155
|
-
"flex-1 basis-[140px] min-w-[120px] border-none bg-transparent outline-none
|
|
1176
|
+
"flex-1 basis-[140px] min-w-[120px] border-none bg-transparent outline-none leading-tight pl-5",
|
|
1177
|
+
sizeStyles[size].input,
|
|
1156
1178
|
disabled && "cursor-not-allowed text-fg-inactive"
|
|
1157
1179
|
),
|
|
1158
1180
|
value: inputDisplayValue,
|
|
@@ -1198,6 +1220,7 @@ var ComboboxRoot = forwardRef6(
|
|
|
1198
1220
|
value: inputDisplayValue,
|
|
1199
1221
|
disabled,
|
|
1200
1222
|
readOnly: selectOnly,
|
|
1223
|
+
size,
|
|
1201
1224
|
autoComplete: "off",
|
|
1202
1225
|
onChange: handleInputChange,
|
|
1203
1226
|
onFocus: handleFocus,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edux-design/forms",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"**/*.css"
|
|
6
6
|
],
|
|
@@ -32,14 +32,13 @@
|
|
|
32
32
|
"@tailwindcss/cli": "^4.1.12",
|
|
33
33
|
"@tailwindcss/postcss": "^4.1.12"
|
|
34
34
|
},
|
|
35
|
-
"dependencies": {
|
|
35
|
+
"dependencies": {},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"react": "^19.1.0",
|
|
38
|
+
"react-dom": "^19.1.0",
|
|
36
39
|
"@edux-design/utils": "*",
|
|
37
40
|
"@edux-design/icons": "*",
|
|
38
41
|
"@edux-design/popovers": "*",
|
|
39
42
|
"@edux-design/chips": "*"
|
|
40
|
-
},
|
|
41
|
-
"peerDependencies": {
|
|
42
|
-
"react": "^19.1.0",
|
|
43
|
-
"react-dom": "^19.1.0"
|
|
44
43
|
}
|
|
45
44
|
}
|