@ctlyst.id/internal-ui 1.0.4-canary.4 → 1.0.4-canary.6
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 +65 -32
- 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 +65 -32
- 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,45 @@ 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['500']} !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) {
|
2385
2396
|
return {
|
2386
|
-
control: base => colorMode === 'dark' ? {
|
2397
|
+
control: (base, state) => colorMode === 'dark' ? {
|
2387
2398
|
...base,
|
2388
2399
|
...selectStyle,
|
2389
2400
|
background: 'transparent',
|
2390
2401
|
color: colors.primary['300'],
|
2391
|
-
borderColor: colors.secondary['500']
|
2402
|
+
borderColor: colors.secondary['500'],
|
2403
|
+
boxShadow: state.isFocused ? 'none' : `inherit`
|
2392
2404
|
} : {
|
2393
2405
|
...base,
|
2394
|
-
...selectStyle
|
2406
|
+
...selectStyle,
|
2407
|
+
boxShadow: state.isFocused ? 'none' : colors.neutral['500']
|
2395
2408
|
},
|
2396
2409
|
option: (base, {
|
2397
2410
|
isSelected
|
@@ -2461,68 +2474,88 @@ const themeSelect = theme => {
|
|
2461
2474
|
};
|
2462
2475
|
};
|
2463
2476
|
|
2477
|
+
/* eslint-disable react/require-default-props */
|
2464
2478
|
function Select({
|
2465
2479
|
styles,
|
2480
|
+
isError = false,
|
2466
2481
|
...rest
|
2467
2482
|
}) {
|
2468
2483
|
const {
|
2469
2484
|
colorMode
|
2470
2485
|
} = system.useColorMode();
|
2471
|
-
return /*#__PURE__*/React__default.createElement(
|
2486
|
+
return /*#__PURE__*/React__default.createElement(SelectWrapper, {
|
2487
|
+
isError: isError
|
2488
|
+
}, /*#__PURE__*/React__default.createElement(ReactSelect, Object.assign({
|
2489
|
+
classNamePrefix: "react-select"
|
2490
|
+
}, rest, {
|
2472
2491
|
styles: {
|
2473
|
-
...selectStyles(colorMode)
|
2474
|
-
...styles
|
2492
|
+
...selectStyles(colorMode)
|
2475
2493
|
},
|
2476
2494
|
theme: themeSelect
|
2477
|
-
}));
|
2495
|
+
})));
|
2478
2496
|
}
|
2479
2497
|
|
2480
2498
|
function SelectAsync({
|
2481
2499
|
styles,
|
2500
|
+
isError = false,
|
2482
2501
|
...rest
|
2483
2502
|
}) {
|
2484
2503
|
const {
|
2485
2504
|
colorMode
|
2486
2505
|
} = system.useColorMode();
|
2487
|
-
return /*#__PURE__*/React__default.createElement(
|
2506
|
+
return /*#__PURE__*/React__default.createElement(SelectWrapper, {
|
2507
|
+
isError: isError
|
2508
|
+
}, /*#__PURE__*/React__default.createElement(reactSelectAsyncPaginate.AsyncPaginate, Object.assign({
|
2509
|
+
classNamePrefix: "react-select"
|
2510
|
+
}, rest, {
|
2488
2511
|
styles: {
|
2489
2512
|
...selectStyles(colorMode),
|
2490
2513
|
...styles
|
2491
2514
|
},
|
2492
2515
|
theme: themeSelect
|
2493
|
-
}));
|
2516
|
+
})));
|
2494
2517
|
}
|
2495
2518
|
|
2496
2519
|
function SelectAsyncCreatable({
|
2497
2520
|
styles,
|
2521
|
+
isError = false,
|
2498
2522
|
...rest
|
2499
2523
|
}) {
|
2500
2524
|
const {
|
2501
2525
|
colorMode
|
2502
2526
|
} = system.useColorMode();
|
2503
|
-
return /*#__PURE__*/React__default.createElement(
|
2527
|
+
return /*#__PURE__*/React__default.createElement(SelectWrapper, {
|
2528
|
+
isError: isError
|
2529
|
+
}, /*#__PURE__*/React__default.createElement(ReactSelectAsyncCreatable, Object.assign({
|
2530
|
+
classNamePrefix: "react-select"
|
2531
|
+
}, rest, {
|
2504
2532
|
styles: {
|
2505
2533
|
...selectStyles(colorMode),
|
2506
2534
|
...styles
|
2507
2535
|
},
|
2508
2536
|
theme: themeSelect
|
2509
|
-
}));
|
2537
|
+
})));
|
2510
2538
|
}
|
2511
2539
|
|
2512
2540
|
function SelectCreatable({
|
2513
2541
|
styles,
|
2542
|
+
isError = false,
|
2514
2543
|
...rest
|
2515
2544
|
}) {
|
2516
2545
|
const {
|
2517
2546
|
colorMode
|
2518
2547
|
} = system.useColorMode();
|
2519
|
-
return /*#__PURE__*/React__default.createElement(
|
2548
|
+
return /*#__PURE__*/React__default.createElement(SelectWrapper, {
|
2549
|
+
isError: isError
|
2550
|
+
}, /*#__PURE__*/React__default.createElement(ReactSelectCreatable, Object.assign({
|
2551
|
+
classNamePrefix: "react-select"
|
2552
|
+
}, rest, {
|
2520
2553
|
styles: {
|
2521
2554
|
...selectStyles(colorMode),
|
2522
2555
|
...styles
|
2523
2556
|
},
|
2524
2557
|
theme: themeSelect
|
2525
|
-
}));
|
2558
|
+
})));
|
2526
2559
|
}
|
2527
2560
|
|
2528
2561
|
const Tab = /*#__PURE__*/react.forwardRef((props, ref) => {
|