@ctlyst.id/internal-ui 1.0.4-canary.4 → 1.0.4-canary.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/datepicker/components/datepicker-month/datepicker-month.d.ts +0 -2
- package/dist/components/datepicker/components/datepicker-month/multi-datepicker-month.d.ts +0 -2
- package/dist/components/select/components/select-async-creatable.d.ts +3 -2
- package/dist/components/select/components/select-async.d.ts +3 -2
- package/dist/components/select/components/select-creatable.d.ts +3 -2
- package/dist/components/select/components/select-wrapper.d.ts +6 -0
- package/dist/components/select/components/select.d.ts +3 -2
- package/dist/components/select/components/types/select.types.d.ts +3 -0
- package/dist/components/select/components/utils.d.ts +1 -1
- package/dist/internal-ui.cjs.development.js +69 -35
- package/dist/internal-ui.cjs.development.js.map +1 -1
- package/dist/internal-ui.cjs.production.min.js +17 -6
- package/dist/internal-ui.cjs.production.min.js.map +1 -1
- package/dist/internal-ui.esm.js +69 -35
- package/dist/internal-ui.esm.js.map +1 -1
- package/package.json +2 -2
@@ -4,8 +4,6 @@ export interface MultiDatePickerMonthProps {
|
|
4
4
|
min?: string;
|
5
5
|
max?: string;
|
6
6
|
isError?: boolean;
|
7
|
-
widthEmpty?: string | number;
|
8
|
-
widthFilled?: string | number;
|
9
7
|
}
|
10
8
|
declare const MultiDatePickerMonth: FC<MultiDatePickerMonthProps>;
|
11
9
|
export default MultiDatePickerMonth;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { GroupBase } from 'react-select';
|
2
2
|
import type { AsyncCreatableProps } from 'react-select/async-creatable';
|
3
|
-
|
4
|
-
export
|
3
|
+
import type { ExtendedSelectProps } from './types/select.types';
|
4
|
+
export declare type SelectAsyncCreatableProps<Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>> = AsyncCreatableProps<Option, IsMulti, Group> & ExtendedSelectProps;
|
5
|
+
export default function SelectAsyncCreatable<Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ styles, isError, ...rest }: SelectAsyncCreatableProps<Option, IsMulti, Group>): JSX.Element;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { GroupBase } from 'react-select';
|
2
2
|
import type { AsyncPaginateProps } from 'react-select-async-paginate';
|
3
|
-
|
4
|
-
declare
|
3
|
+
import type { ExtendedSelectProps } from './types/select.types';
|
4
|
+
export declare type SelectAsyncProps<OptionType = unknown, Group extends GroupBase<OptionType> = GroupBase<OptionType>, Additional = unknown, IsMulti extends boolean = false> = AsyncPaginateProps<OptionType, Group, Additional, IsMulti> & ExtendedSelectProps;
|
5
|
+
declare function SelectAsync<OptionType, Group extends GroupBase<OptionType>, Additional, IsMulti extends boolean = false>({ styles, isError, ...rest }: SelectAsyncProps<OptionType, Group, Additional, IsMulti>): JSX.Element;
|
5
6
|
export default SelectAsync;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { GroupBase } from 'react-select';
|
2
2
|
import type { CreatableProps } from 'react-select/creatable';
|
3
|
-
|
4
|
-
export
|
3
|
+
import type { ExtendedSelectProps } from './types/select.types';
|
4
|
+
export declare type SelectCreatableProps<Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>> = CreatableProps<Option, IsMulti, Group> & ExtendedSelectProps;
|
5
|
+
export default function SelectCreatable<Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ styles, isError, ...rest }: SelectCreatableProps<Option, IsMulti, Group>): JSX.Element;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { GroupBase, Props as ReactSelectProps } from 'react-select';
|
2
|
-
|
3
|
-
declare
|
2
|
+
import type { ExtendedSelectProps } from './types/select.types';
|
3
|
+
export declare type SelectProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> = ReactSelectProps<Option, IsMulti, Group> & ExtendedSelectProps;
|
4
|
+
declare function Select<OptionType, Group extends GroupBase<OptionType>, IsMulti extends boolean = false>({ styles, isError, ...rest }: SelectProps<OptionType, IsMulti, Group>): JSX.Element;
|
4
5
|
export default Select;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { ColorMode } from '@chakra-ui/system';
|
2
2
|
import type { GroupBase, StylesConfig, Theme } from 'react-select';
|
3
|
-
export declare function selectStyles<OptionType = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<OptionType> = GroupBase<OptionType>>(colorMode
|
3
|
+
export declare function selectStyles<OptionType = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<OptionType> = GroupBase<OptionType>>(colorMode: ColorMode, isError: boolean): StylesConfig<OptionType, IsMulti, Group> | undefined;
|
4
4
|
export declare const themeSelect: (theme: Theme) => {
|
5
5
|
colors: {
|
6
6
|
primary: string;
|
@@ -1208,8 +1208,6 @@ const DatePickerMonth = ({
|
|
1208
1208
|
onChange,
|
1209
1209
|
min,
|
1210
1210
|
max,
|
1211
|
-
widthEmpty,
|
1212
|
-
widthFilled,
|
1213
1211
|
...props
|
1214
1212
|
}) => {
|
1215
1213
|
const [date, setDate] = React__default.useState(null);
|
@@ -1222,11 +1220,14 @@ const DatePickerMonth = ({
|
|
1222
1220
|
display: none;
|
1223
1221
|
-webkit-appearance: none;
|
1224
1222
|
}
|
1223
|
+
input[value=''] {
|
1224
|
+
width: 58px;
|
1225
|
+
}
|
1225
1226
|
`
|
1226
1227
|
}, /*#__PURE__*/React__default.createElement(react.Input, {
|
1227
1228
|
"data-test-id": props['data-test-id'],
|
1228
1229
|
type: "date",
|
1229
|
-
width: date ?
|
1230
|
+
width: date ? '51px' : '58px',
|
1230
1231
|
onChange: e => {
|
1231
1232
|
onChange(e.target.value);
|
1232
1233
|
setDate(e.target.value);
|
@@ -1251,9 +1252,7 @@ const DatePickerMonth = ({
|
|
1251
1252
|
}));
|
1252
1253
|
};
|
1253
1254
|
DatePickerMonth.defaultProps = {
|
1254
|
-
'data-test-id': ''
|
1255
|
-
widthEmpty: '58px',
|
1256
|
-
widthFilled: '51px'
|
1255
|
+
'data-test-id': ''
|
1257
1256
|
};
|
1258
1257
|
|
1259
1258
|
const transparent = 'transparent';
|
@@ -1663,9 +1662,7 @@ const MultiDatePickerMonth = ({
|
|
1663
1662
|
onChange,
|
1664
1663
|
isError = false,
|
1665
1664
|
min = '2020-01-01',
|
1666
|
-
max = '2020-12-31'
|
1667
|
-
widthEmpty,
|
1668
|
-
widthFilled
|
1665
|
+
max = '2020-12-31'
|
1669
1666
|
}) => {
|
1670
1667
|
const [date, setDate] = React__default.useState([null, null]);
|
1671
1668
|
return /*#__PURE__*/React__default.createElement(MultiDateWrapper, {
|
@@ -1677,9 +1674,7 @@ const MultiDatePickerMonth = ({
|
|
1677
1674
|
setDate([val, date[1]]);
|
1678
1675
|
},
|
1679
1676
|
min: min,
|
1680
|
-
max: max
|
1681
|
-
widthEmpty: widthEmpty,
|
1682
|
-
widthFilled: widthFilled
|
1677
|
+
max: max
|
1683
1678
|
}), /*#__PURE__*/React__default.createElement(react.Box, null, "-"), /*#__PURE__*/React__default.createElement(DatePickerMonth, {
|
1684
1679
|
"data-test-id": "CT_DatePickerMonth_EndDate",
|
1685
1680
|
onChange: val => {
|
@@ -1687,17 +1682,13 @@ const MultiDatePickerMonth = ({
|
|
1687
1682
|
setDate([date[0], val]);
|
1688
1683
|
},
|
1689
1684
|
min: min,
|
1690
|
-
max: max
|
1691
|
-
widthEmpty: widthEmpty,
|
1692
|
-
widthFilled: widthFilled
|
1685
|
+
max: max
|
1693
1686
|
}));
|
1694
1687
|
};
|
1695
1688
|
MultiDatePickerMonth.defaultProps = {
|
1696
1689
|
min: '2020-01-01',
|
1697
1690
|
max: '2020-12-31',
|
1698
|
-
isError: false
|
1699
|
-
widthEmpty: '58px',
|
1700
|
-
widthFilled: '51px'
|
1691
|
+
isError: false
|
1701
1692
|
};
|
1702
1693
|
|
1703
1694
|
/* eslint-disable no-nested-ternary */
|
@@ -2375,23 +2366,46 @@ PaginationFilter.defaultProps = {
|
|
2375
2366
|
label: undefined
|
2376
2367
|
};
|
2377
2368
|
|
2369
|
+
const SelectWrapper = ({
|
2370
|
+
children,
|
2371
|
+
isError = false
|
2372
|
+
}) => {
|
2373
|
+
return /*#__PURE__*/React__default.createElement(react.Box, {
|
2374
|
+
css: react$1.css`
|
2375
|
+
.react-select__control {
|
2376
|
+
border-color: ${isError ? colors.danger['500'] : colors.neutral['400']} !important;
|
2377
|
+
}
|
2378
|
+
|
2379
|
+
.react-select__control:hover {
|
2380
|
+
border-color: ${isError ? colors.danger['500'] : colors.primary['500']} !important;
|
2381
|
+
}
|
2382
|
+
`
|
2383
|
+
}, children);
|
2384
|
+
};
|
2385
|
+
SelectWrapper.defaultProps = {
|
2386
|
+
isError: false
|
2387
|
+
};
|
2388
|
+
|
2378
2389
|
const styleMd = textStyles.text.sm;
|
2379
2390
|
const selectStyle = {
|
2380
2391
|
fontSize: styleMd.fontSize,
|
2381
2392
|
lineHeight: styleMd.lineHeight,
|
2382
2393
|
letterSpacing: 0
|
2383
2394
|
};
|
2384
|
-
function selectStyles(colorMode) {
|
2395
|
+
function selectStyles(colorMode, isError) {
|
2396
|
+
const boxShadowStyle = isError ? `0 0 0 1px ${colors.danger['500']}` : `0 0 0 1px ${colors.primary['500']}`;
|
2385
2397
|
return {
|
2386
|
-
control: base => colorMode === 'dark' ? {
|
2398
|
+
control: (base, state) => colorMode === 'dark' ? {
|
2387
2399
|
...base,
|
2388
2400
|
...selectStyle,
|
2389
2401
|
background: 'transparent',
|
2390
2402
|
color: colors.primary['300'],
|
2391
|
-
borderColor: colors.secondary['500']
|
2403
|
+
borderColor: colors.secondary['500'],
|
2404
|
+
boxShadow: state.isFocused ? boxShadowStyle : `inherit`
|
2392
2405
|
} : {
|
2393
2406
|
...base,
|
2394
|
-
...selectStyle
|
2407
|
+
...selectStyle,
|
2408
|
+
boxShadow: state.isFocused ? boxShadowStyle : colors.neutral['500']
|
2395
2409
|
},
|
2396
2410
|
option: (base, {
|
2397
2411
|
isSelected
|
@@ -2461,68 +2475,88 @@ const themeSelect = theme => {
|
|
2461
2475
|
};
|
2462
2476
|
};
|
2463
2477
|
|
2478
|
+
/* eslint-disable react/require-default-props */
|
2464
2479
|
function Select({
|
2465
2480
|
styles,
|
2481
|
+
isError = false,
|
2466
2482
|
...rest
|
2467
2483
|
}) {
|
2468
2484
|
const {
|
2469
2485
|
colorMode
|
2470
2486
|
} = system.useColorMode();
|
2471
|
-
return /*#__PURE__*/React__default.createElement(
|
2487
|
+
return /*#__PURE__*/React__default.createElement(SelectWrapper, {
|
2488
|
+
isError: isError
|
2489
|
+
}, /*#__PURE__*/React__default.createElement(ReactSelect, Object.assign({
|
2490
|
+
classNamePrefix: "react-select"
|
2491
|
+
}, rest, {
|
2472
2492
|
styles: {
|
2473
|
-
...selectStyles(colorMode)
|
2474
|
-
...styles
|
2493
|
+
...selectStyles(colorMode, isError)
|
2475
2494
|
},
|
2476
2495
|
theme: themeSelect
|
2477
|
-
}));
|
2496
|
+
})));
|
2478
2497
|
}
|
2479
2498
|
|
2480
2499
|
function SelectAsync({
|
2481
2500
|
styles,
|
2501
|
+
isError = false,
|
2482
2502
|
...rest
|
2483
2503
|
}) {
|
2484
2504
|
const {
|
2485
2505
|
colorMode
|
2486
2506
|
} = system.useColorMode();
|
2487
|
-
return /*#__PURE__*/React__default.createElement(
|
2507
|
+
return /*#__PURE__*/React__default.createElement(SelectWrapper, {
|
2508
|
+
isError: isError
|
2509
|
+
}, /*#__PURE__*/React__default.createElement(reactSelectAsyncPaginate.AsyncPaginate, Object.assign({
|
2510
|
+
classNamePrefix: "react-select"
|
2511
|
+
}, rest, {
|
2488
2512
|
styles: {
|
2489
|
-
...selectStyles(colorMode),
|
2513
|
+
...selectStyles(colorMode, isError),
|
2490
2514
|
...styles
|
2491
2515
|
},
|
2492
2516
|
theme: themeSelect
|
2493
|
-
}));
|
2517
|
+
})));
|
2494
2518
|
}
|
2495
2519
|
|
2496
2520
|
function SelectAsyncCreatable({
|
2497
2521
|
styles,
|
2522
|
+
isError = false,
|
2498
2523
|
...rest
|
2499
2524
|
}) {
|
2500
2525
|
const {
|
2501
2526
|
colorMode
|
2502
2527
|
} = system.useColorMode();
|
2503
|
-
return /*#__PURE__*/React__default.createElement(
|
2528
|
+
return /*#__PURE__*/React__default.createElement(SelectWrapper, {
|
2529
|
+
isError: isError
|
2530
|
+
}, /*#__PURE__*/React__default.createElement(ReactSelectAsyncCreatable, Object.assign({
|
2531
|
+
classNamePrefix: "react-select"
|
2532
|
+
}, rest, {
|
2504
2533
|
styles: {
|
2505
|
-
...selectStyles(colorMode),
|
2534
|
+
...selectStyles(colorMode, isError),
|
2506
2535
|
...styles
|
2507
2536
|
},
|
2508
2537
|
theme: themeSelect
|
2509
|
-
}));
|
2538
|
+
})));
|
2510
2539
|
}
|
2511
2540
|
|
2512
2541
|
function SelectCreatable({
|
2513
2542
|
styles,
|
2543
|
+
isError = false,
|
2514
2544
|
...rest
|
2515
2545
|
}) {
|
2516
2546
|
const {
|
2517
2547
|
colorMode
|
2518
2548
|
} = system.useColorMode();
|
2519
|
-
return /*#__PURE__*/React__default.createElement(
|
2549
|
+
return /*#__PURE__*/React__default.createElement(SelectWrapper, {
|
2550
|
+
isError: isError
|
2551
|
+
}, /*#__PURE__*/React__default.createElement(ReactSelectCreatable, Object.assign({
|
2552
|
+
classNamePrefix: "react-select"
|
2553
|
+
}, rest, {
|
2520
2554
|
styles: {
|
2521
|
-
...selectStyles(colorMode),
|
2555
|
+
...selectStyles(colorMode, isError),
|
2522
2556
|
...styles
|
2523
2557
|
},
|
2524
2558
|
theme: themeSelect
|
2525
|
-
}));
|
2559
|
+
})));
|
2526
2560
|
}
|
2527
2561
|
|
2528
2562
|
const Tab = /*#__PURE__*/react.forwardRef((props, ref) => {
|