@ctlyst.id/internal-ui 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/field/components/field.d.ts +2 -0
- package/dist/components/form/components/input-element.d.ts +2 -0
- package/dist/components/form/index.d.ts +1 -0
- package/dist/internal-ui.cjs.development.js +22 -9
- package/dist/internal-ui.cjs.development.js.map +1 -1
- package/dist/internal-ui.cjs.production.min.js +5 -5
- package/dist/internal-ui.cjs.production.min.js.map +1 -1
- package/dist/internal-ui.esm.js +11 -10
- package/dist/internal-ui.esm.js.map +1 -1
- package/package.json +2 -2
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { FormControlProps } from '@chakra-ui/react';
|
1
2
|
import type { FC, PropsWithChildren, ReactNode } from 'react';
|
2
3
|
export interface Props {
|
3
4
|
label?: string | ReactNode;
|
@@ -7,6 +8,7 @@ export interface Props {
|
|
7
8
|
leftHelperText?: string | ReactNode;
|
8
9
|
rightHelperText?: string | ReactNode;
|
9
10
|
isRequired?: boolean;
|
11
|
+
boxProps?: FormControlProps;
|
10
12
|
}
|
11
13
|
export declare type FieldProps<T = unknown> = Props & T;
|
12
14
|
declare const Field: FC<PropsWithChildren<Props>>;
|
@@ -229,7 +229,6 @@ CheckboxComponent.defaultProps = {
|
|
229
229
|
errorText: ''
|
230
230
|
};
|
231
231
|
|
232
|
-
/* eslint-disable no-nested-ternary */
|
233
232
|
const Field = props => {
|
234
233
|
const {
|
235
234
|
label,
|
@@ -239,7 +238,8 @@ const Field = props => {
|
|
239
238
|
rightHelperText,
|
240
239
|
isRequired,
|
241
240
|
children,
|
242
|
-
isSuccess
|
241
|
+
isSuccess,
|
242
|
+
boxProps = {}
|
243
243
|
} = props;
|
244
244
|
const getHelperColor = () => {
|
245
245
|
if (isError) return 'danger.500';
|
@@ -252,9 +252,9 @@ const Field = props => {
|
|
252
252
|
};
|
253
253
|
const helperColor = getHelperColor();
|
254
254
|
const justifyHelper = getJustifyContentHelper();
|
255
|
-
return /*#__PURE__*/React__default.createElement(react.FormControl, {
|
255
|
+
return /*#__PURE__*/React__default.createElement(react.FormControl, Object.assign({
|
256
256
|
isInvalid: isError
|
257
|
-
}, label && (typeof label === 'string' ? /*#__PURE__*/React__default.createElement(react.FormLabel, {
|
257
|
+
}, boxProps), label && (typeof label === 'string' ? /*#__PURE__*/React__default.createElement(react.FormLabel, {
|
258
258
|
mb: 1,
|
259
259
|
fontSize: "text.sm",
|
260
260
|
requiredIndicator: undefined
|
@@ -267,19 +267,19 @@ const Field = props => {
|
|
267
267
|
display: "flex",
|
268
268
|
width: "full",
|
269
269
|
justifyContent: justifyHelper
|
270
|
-
}, !isError ? leftHelperText && /*#__PURE__*/React__default.createElement(react.FormHelperText, {
|
270
|
+
}, !isError ? leftHelperText && (typeof leftHelperText === 'string' ? /*#__PURE__*/React__default.createElement(react.FormHelperText, {
|
271
271
|
fontSize: "text.xs",
|
272
272
|
color: helperColor,
|
273
273
|
mt: 1
|
274
|
-
}, leftHelperText) : typeof errorMessage === 'string' ? /*#__PURE__*/React__default.createElement(react.FormErrorMessage, {
|
274
|
+
}, leftHelperText) : leftHelperText) : typeof errorMessage === 'string' ? /*#__PURE__*/React__default.createElement(react.FormErrorMessage, {
|
275
275
|
fontSize: "text.xs",
|
276
276
|
color: "danger.500",
|
277
277
|
mt: 1
|
278
|
-
}, errorMessage) : errorMessage, rightHelperText && /*#__PURE__*/React__default.createElement(react.FormHelperText, {
|
278
|
+
}, errorMessage) : errorMessage, rightHelperText && (typeof rightHelperText === 'string' ? /*#__PURE__*/React__default.createElement(react.FormHelperText, {
|
279
279
|
fontSize: "text.xs",
|
280
280
|
color: helperColor,
|
281
281
|
mt: 1
|
282
|
-
}, rightHelperText)));
|
282
|
+
}, rightHelperText) : rightHelperText)));
|
283
283
|
};
|
284
284
|
Field.defaultProps = {
|
285
285
|
label: '',
|
@@ -288,7 +288,8 @@ Field.defaultProps = {
|
|
288
288
|
errorMessage: undefined,
|
289
289
|
leftHelperText: undefined,
|
290
290
|
rightHelperText: undefined,
|
291
|
-
isRequired: false
|
291
|
+
isRequired: false,
|
292
|
+
boxProps: {}
|
292
293
|
};
|
293
294
|
|
294
295
|
function CheckboxGroupComponent(props) {
|
@@ -4383,6 +4384,18 @@ Object.defineProperty(exports, 'DrawerOverlay', {
|
|
4383
4384
|
return react.ModalOverlay;
|
4384
4385
|
}
|
4385
4386
|
});
|
4387
|
+
Object.defineProperty(exports, 'InputElementLeft', {
|
4388
|
+
enumerable: true,
|
4389
|
+
get: function () {
|
4390
|
+
return react.InputLeftElement;
|
4391
|
+
}
|
4392
|
+
});
|
4393
|
+
Object.defineProperty(exports, 'InputElementRight', {
|
4394
|
+
enumerable: true,
|
4395
|
+
get: function () {
|
4396
|
+
return react.InputRightElement;
|
4397
|
+
}
|
4398
|
+
});
|
4386
4399
|
Object.defineProperty(exports, 'Modal', {
|
4387
4400
|
enumerable: true,
|
4388
4401
|
get: function () {
|