@ctlyst.id/internal-ui 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/form/__stories__/input.stories.d.ts +1 -0
- package/dist/components/form/components/input-field.d.ts +0 -2
- package/dist/components/form/index.d.ts +1 -0
- package/dist/internal-ui.cjs.development.js +44 -45
- package/dist/internal-ui.cjs.development.js.map +1 -1
- package/dist/internal-ui.cjs.production.min.js +8 -8
- package/dist/internal-ui.cjs.production.min.js.map +1 -1
- package/dist/internal-ui.esm.js +44 -47
- package/dist/internal-ui.esm.js.map +1 -1
- package/package.json +2 -2
@@ -11,4 +11,5 @@ export declare const Default: () => JSX.Element;
|
|
11
11
|
export declare const Variant: () => JSX.Element;
|
12
12
|
export declare const PasswordField: () => JSX.Element;
|
13
13
|
export declare const WithClear: () => JSX.Element;
|
14
|
+
export declare const WithElement: () => JSX.Element;
|
14
15
|
export declare const WithAddOn: () => JSX.Element;
|
@@ -5,8 +5,6 @@ import type { FieldProps } from '../../field/components/field';
|
|
5
5
|
export interface InputFieldProps extends ChakraInputProps, FieldProps {
|
6
6
|
addOnLeft?: ReactNode;
|
7
7
|
addOnRight?: ReactNode;
|
8
|
-
elementLeft?: ReactNode;
|
9
|
-
elementRight?: ReactNode;
|
10
8
|
withClear?: boolean;
|
11
9
|
isLoading?: boolean;
|
12
10
|
onClear?: () => void;
|
@@ -480,6 +480,41 @@ DataTable.defaultProps = {
|
|
480
480
|
sortingState: []
|
481
481
|
};
|
482
482
|
|
483
|
+
const getProperties = props => {
|
484
|
+
const {
|
485
|
+
isError,
|
486
|
+
isDisabled,
|
487
|
+
isSuccess
|
488
|
+
} = props;
|
489
|
+
let outlineColor = 'neutral.400';
|
490
|
+
let focusColor = 'primary.500';
|
491
|
+
if (isError || isDisabled || isSuccess) {
|
492
|
+
if (isError) outlineColor = 'danger.500';else if (isSuccess) outlineColor = 'success.500';
|
493
|
+
focusColor = outlineColor;
|
494
|
+
}
|
495
|
+
return {
|
496
|
+
outlineColor,
|
497
|
+
focusColor
|
498
|
+
};
|
499
|
+
};
|
500
|
+
const getWrapperStyle = props => {
|
501
|
+
const {
|
502
|
+
outlineColor,
|
503
|
+
focusColor
|
504
|
+
} = getProperties(props);
|
505
|
+
const style = {
|
506
|
+
border: '1px solid',
|
507
|
+
borderColor: outlineColor,
|
508
|
+
borderRadius: 'md',
|
509
|
+
transition: 'all 0.15s',
|
510
|
+
boxShadow: 'none',
|
511
|
+
_focusWithin: {
|
512
|
+
borderColor: focusColor
|
513
|
+
}
|
514
|
+
};
|
515
|
+
return react.defineStyle(style);
|
516
|
+
};
|
517
|
+
|
483
518
|
const Styles = () => {
|
484
519
|
const {
|
485
520
|
colorMode
|
@@ -1351,6 +1386,7 @@ const Datepicker = ({
|
|
1351
1386
|
var _props$dateFormat;
|
1352
1387
|
const selected = value ? new Date(value) : undefined;
|
1353
1388
|
const dateFormat = ((_props$dateFormat = props.dateFormat) !== null && _props$dateFormat !== void 0 ? _props$dateFormat : withTime) ? 'yyyy-MM-dd HH:mm' : 'yyyy-MM-dd';
|
1389
|
+
const wrapperStyle = getWrapperStyle({});
|
1354
1390
|
const getTimeProps = () => {
|
1355
1391
|
if (!withTime) return {};
|
1356
1392
|
return {
|
@@ -1363,9 +1399,9 @@ const Datepicker = ({
|
|
1363
1399
|
id: id,
|
1364
1400
|
name: name,
|
1365
1401
|
selected: selected,
|
1366
|
-
customInput: /*#__PURE__*/React__default.createElement(react.Input, {
|
1402
|
+
customInput: /*#__PURE__*/React__default.createElement(react.Input, Object.assign({
|
1367
1403
|
autoComplete: "off"
|
1368
|
-
}),
|
1404
|
+
}, wrapperStyle)),
|
1369
1405
|
dateFormat: dateFormat,
|
1370
1406
|
showPopperArrow: false,
|
1371
1407
|
calendarClassName: classnames({
|
@@ -1914,45 +1950,10 @@ MultiDatePickerMonth.defaultProps = {
|
|
1914
1950
|
isError: false
|
1915
1951
|
};
|
1916
1952
|
|
1917
|
-
const getProperties = props => {
|
1918
|
-
const {
|
1919
|
-
isError,
|
1920
|
-
isDisabled,
|
1921
|
-
isSuccess
|
1922
|
-
} = props;
|
1923
|
-
let outlineColor = 'neutral.400';
|
1924
|
-
let focusColor = 'primary.500';
|
1925
|
-
if (isError || isDisabled || isSuccess) {
|
1926
|
-
if (isError) outlineColor = 'danger.500';else if (isSuccess) outlineColor = 'success.500';
|
1927
|
-
focusColor = outlineColor;
|
1928
|
-
}
|
1929
|
-
return {
|
1930
|
-
outlineColor,
|
1931
|
-
focusColor
|
1932
|
-
};
|
1933
|
-
};
|
1934
|
-
const getWrapperStyle = props => {
|
1935
|
-
const {
|
1936
|
-
outlineColor,
|
1937
|
-
focusColor
|
1938
|
-
} = getProperties(props);
|
1939
|
-
const style = {
|
1940
|
-
border: '1px solid',
|
1941
|
-
borderColor: outlineColor,
|
1942
|
-
borderRadius: 'md',
|
1943
|
-
transition: 'all 0.15s',
|
1944
|
-
boxShadow: 'none',
|
1945
|
-
_focusWithin: {
|
1946
|
-
borderColor: focusColor
|
1947
|
-
}
|
1948
|
-
};
|
1949
|
-
return react.defineStyle(style);
|
1950
|
-
};
|
1951
|
-
|
1952
1953
|
const InputAddonLeft = ({
|
1953
1954
|
children
|
1954
1955
|
}) => {
|
1955
|
-
return /*#__PURE__*/React__default.createElement(react.
|
1956
|
+
return /*#__PURE__*/React__default.createElement(react.InputLeftAddon, {
|
1956
1957
|
borderLeftRadius: "md",
|
1957
1958
|
backgroundColor: "neutral.200",
|
1958
1959
|
px: 3,
|
@@ -1962,7 +1963,7 @@ const InputAddonLeft = ({
|
|
1962
1963
|
const InputAddonRight = ({
|
1963
1964
|
children
|
1964
1965
|
}) => {
|
1965
|
-
return /*#__PURE__*/React__default.createElement(react.
|
1966
|
+
return /*#__PURE__*/React__default.createElement(react.InputRightAddon, {
|
1966
1967
|
borderRightRadius: "md",
|
1967
1968
|
backgroundColor: "neutral.200",
|
1968
1969
|
px: 3,
|
@@ -1976,8 +1977,6 @@ const InputField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
1976
1977
|
type,
|
1977
1978
|
addOnLeft,
|
1978
1979
|
addOnRight,
|
1979
|
-
elementLeft,
|
1980
|
-
elementRight,
|
1981
1980
|
size,
|
1982
1981
|
isRequired,
|
1983
1982
|
label,
|
@@ -2021,7 +2020,7 @@ const InputField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
2021
2020
|
borderRadius: "md",
|
2022
2021
|
backgroundColor: isDisabled ? 'neutral.300' : 'white.high',
|
2023
2022
|
cursor: isDisabled ? 'not-allowed' : 'default'
|
2024
|
-
}, addOnLeft
|
2023
|
+
}, addOnLeft, /*#__PURE__*/React__default.createElement(react.Input, Object.assign({
|
2025
2024
|
ref: ref,
|
2026
2025
|
type: inputType,
|
2027
2026
|
value: value,
|
@@ -2068,13 +2067,11 @@ const InputField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
2068
2067
|
color: iconColor
|
2069
2068
|
})), isLoading && /*#__PURE__*/React__default.createElement(Loader, {
|
2070
2069
|
size: "sm"
|
2071
|
-
})),
|
2070
|
+
})), addOnRight)));
|
2072
2071
|
});
|
2073
2072
|
InputField.defaultProps = {
|
2074
2073
|
addOnLeft: undefined,
|
2075
2074
|
addOnRight: undefined,
|
2076
|
-
elementLeft: undefined,
|
2077
|
-
elementRight: undefined,
|
2078
2075
|
withClear: undefined,
|
2079
2076
|
isLoading: undefined,
|
2080
2077
|
onClear: undefined
|
@@ -4551,6 +4548,8 @@ exports.Field = Field;
|
|
4551
4548
|
exports.Flex = react.Flex;
|
4552
4549
|
exports.Grid = react.Grid;
|
4553
4550
|
exports.Header = Header;
|
4551
|
+
exports.InputAddonLeft = InputAddonLeft;
|
4552
|
+
exports.InputAddonRight = InputAddonRight;
|
4554
4553
|
exports.InputField = InputField;
|
4555
4554
|
exports.Loader = Loader;
|
4556
4555
|
exports.MainMenu = Navigation;
|