@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.
@@ -1202,8 +1202,6 @@ const DatePickerMonth = ({
1202
1202
  onChange,
1203
1203
  min,
1204
1204
  max,
1205
- widthEmpty,
1206
- widthFilled,
1207
1205
  ...props
1208
1206
  }) => {
1209
1207
  const [date, setDate] = React__default.useState(null);
@@ -1216,11 +1214,14 @@ const DatePickerMonth = ({
1216
1214
  display: none;
1217
1215
  -webkit-appearance: none;
1218
1216
  }
1217
+ input[value=''] {
1218
+ width: 58px;
1219
+ }
1219
1220
  `
1220
1221
  }, /*#__PURE__*/React__default.createElement(Input$1, {
1221
1222
  "data-test-id": props['data-test-id'],
1222
1223
  type: "date",
1223
- width: date ? widthFilled : widthEmpty,
1224
+ width: date ? '51px' : '58px',
1224
1225
  onChange: e => {
1225
1226
  onChange(e.target.value);
1226
1227
  setDate(e.target.value);
@@ -1245,9 +1246,7 @@ const DatePickerMonth = ({
1245
1246
  }));
1246
1247
  };
1247
1248
  DatePickerMonth.defaultProps = {
1248
- 'data-test-id': '',
1249
- widthEmpty: '58px',
1250
- widthFilled: '51px'
1249
+ 'data-test-id': ''
1251
1250
  };
1252
1251
 
1253
1252
  const transparent = 'transparent';
@@ -1657,9 +1656,7 @@ const MultiDatePickerMonth = ({
1657
1656
  onChange,
1658
1657
  isError = false,
1659
1658
  min = '2020-01-01',
1660
- max = '2020-12-31',
1661
- widthEmpty,
1662
- widthFilled
1659
+ max = '2020-12-31'
1663
1660
  }) => {
1664
1661
  const [date, setDate] = React__default.useState([null, null]);
1665
1662
  return /*#__PURE__*/React__default.createElement(MultiDateWrapper, {
@@ -1671,9 +1668,7 @@ const MultiDatePickerMonth = ({
1671
1668
  setDate([val, date[1]]);
1672
1669
  },
1673
1670
  min: min,
1674
- max: max,
1675
- widthEmpty: widthEmpty,
1676
- widthFilled: widthFilled
1671
+ max: max
1677
1672
  }), /*#__PURE__*/React__default.createElement(Box, null, "-"), /*#__PURE__*/React__default.createElement(DatePickerMonth, {
1678
1673
  "data-test-id": "CT_DatePickerMonth_EndDate",
1679
1674
  onChange: val => {
@@ -1681,17 +1676,13 @@ const MultiDatePickerMonth = ({
1681
1676
  setDate([date[0], val]);
1682
1677
  },
1683
1678
  min: min,
1684
- max: max,
1685
- widthEmpty: widthEmpty,
1686
- widthFilled: widthFilled
1679
+ max: max
1687
1680
  }));
1688
1681
  };
1689
1682
  MultiDatePickerMonth.defaultProps = {
1690
1683
  min: '2020-01-01',
1691
1684
  max: '2020-12-31',
1692
- isError: false,
1693
- widthEmpty: '58px',
1694
- widthFilled: '51px'
1685
+ isError: false
1695
1686
  };
1696
1687
 
1697
1688
  /* eslint-disable no-nested-ternary */
@@ -2369,23 +2360,45 @@ PaginationFilter.defaultProps = {
2369
2360
  label: undefined
2370
2361
  };
2371
2362
 
2363
+ const SelectWrapper = ({
2364
+ children,
2365
+ isError = false
2366
+ }) => {
2367
+ return /*#__PURE__*/React__default.createElement(Box, {
2368
+ css: css`
2369
+ .react-select__control {
2370
+ border-color: ${isError ? colors.danger['500'] : colors.neutral['500']} !important;
2371
+ }
2372
+
2373
+ .react-select__control:hover {
2374
+ border-color: ${isError ? colors.danger['500'] : colors.primary['500']} !important;
2375
+ }
2376
+ `
2377
+ }, children);
2378
+ };
2379
+ SelectWrapper.defaultProps = {
2380
+ isError: false
2381
+ };
2382
+
2372
2383
  const styleMd = textStyles.text.sm;
2373
2384
  const selectStyle = {
2374
2385
  fontSize: styleMd.fontSize,
2375
2386
  lineHeight: styleMd.lineHeight,
2376
2387
  letterSpacing: 0
2377
2388
  };
2378
- function selectStyles(colorMode) {
2389
+ function selectStyles(colorMode, _isError) {
2379
2390
  return {
2380
- control: base => colorMode === 'dark' ? {
2391
+ control: (base, state) => colorMode === 'dark' ? {
2381
2392
  ...base,
2382
2393
  ...selectStyle,
2383
2394
  background: 'transparent',
2384
2395
  color: colors.primary['300'],
2385
- borderColor: colors.secondary['500']
2396
+ borderColor: colors.secondary['500'],
2397
+ boxShadow: state.isFocused ? 'none' : `inherit`
2386
2398
  } : {
2387
2399
  ...base,
2388
- ...selectStyle
2400
+ ...selectStyle,
2401
+ boxShadow: state.isFocused ? 'none' : colors.neutral['500']
2389
2402
  },
2390
2403
  option: (base, {
2391
2404
  isSelected
@@ -2455,68 +2468,88 @@ const themeSelect = theme => {
2455
2468
  };
2456
2469
  };
2457
2470
 
2471
+ /* eslint-disable react/require-default-props */
2458
2472
  function Select({
2459
2473
  styles,
2474
+ isError = false,
2460
2475
  ...rest
2461
2476
  }) {
2462
2477
  const {
2463
2478
  colorMode
2464
2479
  } = useColorMode();
2465
- return /*#__PURE__*/React__default.createElement(ReactSelect, Object.assign({}, rest, {
2480
+ return /*#__PURE__*/React__default.createElement(SelectWrapper, {
2481
+ isError: isError
2482
+ }, /*#__PURE__*/React__default.createElement(ReactSelect, Object.assign({
2483
+ classNamePrefix: "react-select"
2484
+ }, rest, {
2466
2485
  styles: {
2467
- ...selectStyles(colorMode),
2468
- ...styles
2486
+ ...selectStyles(colorMode)
2469
2487
  },
2470
2488
  theme: themeSelect
2471
- }));
2489
+ })));
2472
2490
  }
2473
2491
 
2474
2492
  function SelectAsync({
2475
2493
  styles,
2494
+ isError = false,
2476
2495
  ...rest
2477
2496
  }) {
2478
2497
  const {
2479
2498
  colorMode
2480
2499
  } = useColorMode();
2481
- return /*#__PURE__*/React__default.createElement(AsyncPaginate, Object.assign({}, rest, {
2500
+ return /*#__PURE__*/React__default.createElement(SelectWrapper, {
2501
+ isError: isError
2502
+ }, /*#__PURE__*/React__default.createElement(AsyncPaginate, Object.assign({
2503
+ classNamePrefix: "react-select"
2504
+ }, rest, {
2482
2505
  styles: {
2483
2506
  ...selectStyles(colorMode),
2484
2507
  ...styles
2485
2508
  },
2486
2509
  theme: themeSelect
2487
- }));
2510
+ })));
2488
2511
  }
2489
2512
 
2490
2513
  function SelectAsyncCreatable({
2491
2514
  styles,
2515
+ isError = false,
2492
2516
  ...rest
2493
2517
  }) {
2494
2518
  const {
2495
2519
  colorMode
2496
2520
  } = useColorMode();
2497
- return /*#__PURE__*/React__default.createElement(ReactSelectAsyncCreatable, Object.assign({}, rest, {
2521
+ return /*#__PURE__*/React__default.createElement(SelectWrapper, {
2522
+ isError: isError
2523
+ }, /*#__PURE__*/React__default.createElement(ReactSelectAsyncCreatable, Object.assign({
2524
+ classNamePrefix: "react-select"
2525
+ }, rest, {
2498
2526
  styles: {
2499
2527
  ...selectStyles(colorMode),
2500
2528
  ...styles
2501
2529
  },
2502
2530
  theme: themeSelect
2503
- }));
2531
+ })));
2504
2532
  }
2505
2533
 
2506
2534
  function SelectCreatable({
2507
2535
  styles,
2536
+ isError = false,
2508
2537
  ...rest
2509
2538
  }) {
2510
2539
  const {
2511
2540
  colorMode
2512
2541
  } = useColorMode();
2513
- return /*#__PURE__*/React__default.createElement(ReactSelectCreatable, Object.assign({}, rest, {
2542
+ return /*#__PURE__*/React__default.createElement(SelectWrapper, {
2543
+ isError: isError
2544
+ }, /*#__PURE__*/React__default.createElement(ReactSelectCreatable, Object.assign({
2545
+ classNamePrefix: "react-select"
2546
+ }, rest, {
2514
2547
  styles: {
2515
2548
  ...selectStyles(colorMode),
2516
2549
  ...styles
2517
2550
  },
2518
2551
  theme: themeSelect
2519
- }));
2552
+ })));
2520
2553
  }
2521
2554
 
2522
2555
  const Tab = /*#__PURE__*/forwardRef$1((props, ref) => {