@7shifts/sous-chef 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { SelectOption, SelectOptions } from '../../forms/SelectField/types';
3
+ declare type Props<T> = {
4
+ name: string;
5
+ value?: SelectOption<T>;
6
+ placeholder?: string;
7
+ options: SelectOptions<T>;
8
+ onChange?: (e: SelectOption<T>) => void;
9
+ onBlur?: (e: SelectOption<T>) => void;
10
+ disabled?: boolean;
11
+ /** Use a prefix for things like icons or symbols (“$”, “¥”, “£”). */
12
+ prefix: React.ReactNode;
13
+ };
14
+ /** Toolbar component to make a possible selection from predefined options. */
15
+ declare const ToolbarSelect: <T extends unknown>({ name, value, options, onChange, onBlur, placeholder, disabled, prefix, }: Props<T>) => JSX.Element;
16
+ export default ToolbarSelect;
@@ -0,0 +1,5 @@
1
+ declare type GetSelectStylesControls = {
2
+ wrapToNextLine?: boolean;
3
+ };
4
+ export declare const getSelectStyles: ({ wrapToNextLine }: GetSelectStylesControls) => Object;
5
+ export {};
@@ -1,8 +1,7 @@
1
1
  declare type GetSelectStylesControls = {
2
2
  isInvalid: boolean;
3
- hasPrefix?: boolean;
4
3
  asToolbarFilter?: boolean;
5
4
  wrapToNextLine?: boolean;
6
5
  };
7
- export declare const getSelectStyles: ({ isInvalid, hasPrefix, asToolbarFilter, wrapToNextLine }: GetSelectStylesControls) => Object;
6
+ export declare const getSelectStyles: ({ isInvalid, asToolbarFilter, wrapToNextLine }: GetSelectStylesControls) => Object;
8
7
  export {};
@@ -23,5 +23,5 @@ declare type Props = {
23
23
  suffix?: React.ReactNode;
24
24
  value?: string;
25
25
  };
26
- declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
27
- export default _default;
26
+ declare const TextField: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
27
+ export default TextField;
package/dist/index.css CHANGED
@@ -1151,6 +1151,7 @@ Please ask a designer if you have questions about which colours to use.
1151
1151
  }
1152
1152
  ._20YOA:disabled {
1153
1153
  background-color: #f8f8f8;
1154
+ color: #929292;
1154
1155
  }
1155
1156
 
1156
1157
  ._3kUSh {
@@ -1161,6 +1162,7 @@ Please ask a designer if you have questions about which colours to use.
1161
1162
  border-left: 0 !important;
1162
1163
  border-top-left-radius: 0 !important;
1163
1164
  border-bottom-left-radius: 0 !important;
1165
+ color: #929292;
1164
1166
  }
1165
1167
 
1166
1168
  ._QXJOD {
@@ -1306,7 +1308,7 @@ input:checked ~ ._1i2AX {
1306
1308
  input:disabled + ._1i2AX {
1307
1309
  background-color: #f8f8f8;
1308
1310
  border-color: #f8f8f8;
1309
- color: #c1c1c1;
1311
+ color: #929292;
1310
1312
  }
1311
1313
  input:disabled:checked + ._1i2AX {
1312
1314
  background-color: #e16840;
@@ -1457,6 +1459,7 @@ Please ask a designer if you have questions about which colours to use.
1457
1459
  }
1458
1460
  ._18Rzv:disabled {
1459
1461
  background-color: #f8f8f8;
1462
+ color: #929292;
1460
1463
  }
1461
1464
 
1462
1465
  ._3eD7t {
@@ -1467,6 +1470,7 @@ Please ask a designer if you have questions about which colours to use.
1467
1470
  border-left: 0 !important;
1468
1471
  border-top-left-radius: 0 !important;
1469
1472
  border-bottom-left-radius: 0 !important;
1473
+ color: #929292;
1470
1474
  }
1471
1475
 
1472
1476
  ._-MgeO {
@@ -1542,6 +1546,7 @@ Please ask a designer if you have questions about which colours to use.
1542
1546
  }
1543
1547
  ._1btTx:disabled, ._1Sc9D:disabled {
1544
1548
  background-color: #f8f8f8;
1549
+ color: #929292;
1545
1550
  }
1546
1551
 
1547
1552
  ._2feYp, ._2SNat {
@@ -1552,6 +1557,7 @@ Please ask a designer if you have questions about which colours to use.
1552
1557
  border-left: 0 !important;
1553
1558
  border-top-left-radius: 0 !important;
1554
1559
  border-bottom-left-radius: 0 !important;
1560
+ color: #929292;
1555
1561
  }
1556
1562
 
1557
1563
  ._27J43, ._3eTNi {
@@ -2032,6 +2038,7 @@ Please ask a designer if you have questions about which colours to use.
2032
2038
  }
2033
2039
  ._25rf7:disabled, ._3qVhi input:disabled, ._3qVhi:disabled {
2034
2040
  background-color: #f8f8f8;
2041
+ color: #929292;
2035
2042
  }
2036
2043
 
2037
2044
  ._2M9Ud {
@@ -2042,6 +2049,7 @@ Please ask a designer if you have questions about which colours to use.
2042
2049
  border-left: 0 !important;
2043
2050
  border-top-left-radius: 0 !important;
2044
2051
  border-bottom-left-radius: 0 !important;
2052
+ color: #929292;
2045
2053
  }
2046
2054
 
2047
2055
  ._foqL0 {
@@ -2059,6 +2067,9 @@ Please ask a designer if you have questions about which colours to use.
2059
2067
  ._3df9R {
2060
2068
  border-color: #e76767 !important;
2061
2069
  }
2070
+ ._2Nkht {
2071
+ background-color: #f8f8f8;
2072
+ }
2062
2073
  ._3qVhi input {
2063
2074
  border: none;
2064
2075
  min-width: 20px;
package/dist/index.js CHANGED
@@ -2908,7 +2908,6 @@ var GREY200 = '#e0e0e0';
2908
2908
  var GREY300 = '#c1c1c1';
2909
2909
  var GREY400 = '#929292';
2910
2910
  var GREY500 = '#555555';
2911
- var GREY600 = '#464646';
2912
2911
 
2913
2912
  var SORT_ORDER = {
2914
2913
  ASC: 'asc',
@@ -3593,10 +3592,11 @@ var Field = function Field(_ref) {
3593
3592
  caption = _ref.caption,
3594
3593
  error = _ref.error,
3595
3594
  children = _ref.children;
3595
+ var shouldRenderLabel = label || typeof label === 'string';
3596
3596
  return React__default.createElement(Stack, {
3597
3597
  space: 8,
3598
3598
  flexItems: true
3599
- }, label !== undefined && React__default.createElement(Label, {
3599
+ }, shouldRenderLabel && React__default.createElement(Label, {
3600
3600
  htmlFor: id
3601
3601
  }, label), children, caption && React__default.createElement(Caption, {
3602
3602
  fieldId: id
@@ -3910,7 +3910,7 @@ var TextAreaField = function TextAreaField(_ref) {
3910
3910
 
3911
3911
  var styles$j = {"text-field":"_20YOA","text-field--invalid":"_3kUSh","text-field--prefixed":"_3IU3Q","text-field--suffixed":"_QXJOD"};
3912
3912
 
3913
- var TextField = function TextField(_ref, ref) {
3913
+ var TextFieldElement = function TextFieldElement(_ref, ref) {
3914
3914
  var _classnames;
3915
3915
 
3916
3916
  var autoComplete = _ref.autoComplete,
@@ -3976,7 +3976,7 @@ var TextField = function TextField(_ref, ref) {
3976
3976
  })));
3977
3977
  };
3978
3978
 
3979
- var TextField$1 = React.forwardRef(TextField);
3979
+ var TextField = React.forwardRef(TextFieldElement);
3980
3980
 
3981
3981
  var useCheckBoxFieldControllers = function useCheckBoxFieldControllers(_ref) {
3982
3982
  var name = _ref.name,
@@ -4467,8 +4467,6 @@ var PasswordField = function PasswordField(_ref) {
4467
4467
 
4468
4468
  var getSelectStyles = function getSelectStyles(_ref) {
4469
4469
  var isInvalid = _ref.isInvalid,
4470
- _ref$hasPrefix = _ref.hasPrefix,
4471
- hasPrefix = _ref$hasPrefix === void 0 ? false : _ref$hasPrefix,
4472
4470
  _ref$asToolbarFilter = _ref.asToolbarFilter,
4473
4471
  asToolbarFilter = _ref$asToolbarFilter === void 0 ? false : _ref$asToolbarFilter,
4474
4472
  _ref$wrapToNextLine = _ref.wrapToNextLine,
@@ -4480,23 +4478,24 @@ var getSelectStyles = function getSelectStyles(_ref) {
4480
4478
  flexWrap: wrapToNextLine ? 'wrap' : 'nowrap'
4481
4479
  });
4482
4480
  },
4483
- container: function container(base) {
4481
+ container: function container(base, state) {
4484
4482
  return Object.assign({}, base, {
4485
4483
  flex: '1',
4486
4484
  fontFamily: FONT_FAMILY,
4487
- minWidth: '64px'
4485
+ minWidth: '64px',
4486
+ backgroundColor: state.isDisabled && !asToolbarFilter ? GREY100 : WHITE,
4487
+ position: 'initial'
4488
4488
  });
4489
4489
  },
4490
4490
  control: function control(base, state) {
4491
4491
  return Object.assign({}, base, {
4492
4492
  borderColor: state.isFocused ? EGGPLANT400 : borderColor,
4493
- color: state.isDisabled ? GREY200 : GREY500,
4493
+ color: state.isDisabled ? GREY400 : GREY500,
4494
4494
  boxShadow: state.isFocused ? "0 0 8px " + EGGPLANT300 : 'none',
4495
4495
  '&:hover': 'none',
4496
- backgroundColor: state.isDisabled ? GREY100 : state.isFocused ? WHITE : WHITE,
4496
+ background: 'none',
4497
4497
  fontSize: '14px',
4498
4498
  cursor: 'pointer',
4499
- background: hasPrefix && 'transparent',
4500
4499
  border: asToolbarFilter && 'none'
4501
4500
  });
4502
4501
  },
@@ -4505,9 +4504,9 @@ var getSelectStyles = function getSelectStyles(_ref) {
4505
4504
  display: 'none'
4506
4505
  };
4507
4506
  },
4508
- placeholder: function placeholder(base) {
4507
+ placeholder: function placeholder(base, state) {
4509
4508
  return _extends({}, base, {
4510
- color: GREY300,
4509
+ color: state.isDisabled && asToolbarFilter ? GREY300 : GREY400,
4511
4510
  marginRight: 0,
4512
4511
  position: 'static',
4513
4512
  transform: 'initial',
@@ -4526,7 +4525,7 @@ var getSelectStyles = function getSelectStyles(_ref) {
4526
4525
  },
4527
4526
  singleValue: function singleValue(base, state) {
4528
4527
  return Object.assign({}, base, {
4529
- color: state.isDisabled ? GREY300 : null,
4528
+ color: state.isDisabled ? GREY400 : null,
4530
4529
  marginRight: 0,
4531
4530
  position: 'static',
4532
4531
  transform: 'initial',
@@ -4537,14 +4536,14 @@ var getSelectStyles = function getSelectStyles(_ref) {
4537
4536
  },
4538
4537
  dropdownIndicator: function dropdownIndicator(base, state) {
4539
4538
  return Object.assign({}, base, {
4540
- color: state.isDisabled ? GREY200 : GREY400,
4539
+ color: state.isDisabled ? GREY300 : GREY400,
4541
4540
  padding: '8px'
4542
4541
  });
4543
4542
  },
4544
4543
  option: function option(base, state) {
4545
4544
  return Object.assign({}, base, {
4546
4545
  backgroundColor: state.isDisabled ? null : state.isSelected ? EGGPLANT200 : state.isFocused ? GREY100 : WHITE,
4547
- color: state.isDisabled ? GREY300 : state.isSelected ? EGGPLANT700 : GREY500,
4546
+ color: state.isDisabled ? GREY400 : state.isSelected ? EGGPLANT700 : GREY500,
4548
4547
  cursor: 'pointer',
4549
4548
  fontFamily: FONT_FAMILY,
4550
4549
  fontSize: '14px'
@@ -4559,14 +4558,15 @@ var getSelectStyles = function getSelectStyles(_ref) {
4559
4558
  return Object.assign({}, base, {
4560
4559
  ':hover': {
4561
4560
  backgroundColor: 'none',
4562
- color: GREY600
4561
+ color: GREY500
4563
4562
  }
4564
4563
  });
4565
4564
  },
4566
4565
  clearIndicator: function clearIndicator(base) {
4567
4566
  return Object.assign({}, base, {
4567
+ color: GREY400,
4568
4568
  ':hover': {
4569
- color: GREY600
4569
+ color: GREY500
4570
4570
  }
4571
4571
  });
4572
4572
  },
@@ -4780,7 +4780,6 @@ var SelectField = function SelectField(_ref) {
4780
4780
  placeholder: placeholder,
4781
4781
  styles: getSelectStyles({
4782
4782
  isInvalid: hasError,
4783
- hasPrefix: !!prefix,
4784
4783
  asToolbarFilter: asToolbarFilter
4785
4784
  }),
4786
4785
  menuPortalTarget: document.body,
@@ -5042,7 +5041,7 @@ var useRangeFieldControllers = function useRangeFieldControllers(_ref) {
5042
5041
  return initialControllers;
5043
5042
  };
5044
5043
 
5045
- var styles$s = {"container":"_1Ini2","wrapper":"_21VnL","interactionDisabled":"_wJ6Cb","DayPicker-Day":"_1c48y","navBar":"_3KwsN","todayButton":"_10CBO","navButtonInteractionDisabled":"_dHL-D","navButtonPrev":"_6kNi3","navButtonNext":"_13W_e","months":"_1FeSY","month":"_wU6A4","caption":"_AMbAo","weekdays":"_1LEst","weekdaysRow":"_2XECo","weekday":"_1C5ry","body":"_11F-Y","week":"_3MAFk","day":"_mG73F","disabled":"_2pgnH","selected":"_MtLaz","outside":"_CRqyX","footer":"_2KG9-","today":"_2JA2y","overlayWrapper":"_1JWbc","overlay":"_2tL6g","weekNumber":"_3u72O","text-field":"_25rf7","date-range-field":"_3qVhi","text-field--invalid":"_2M9Ud","text-field--prefixed":"_3TUb2","text-field--suffixed":"_foqL0","date-range-field--invalid":"_3df9R"};
5044
+ var styles$s = {"container":"_1Ini2","wrapper":"_21VnL","interactionDisabled":"_wJ6Cb","DayPicker-Day":"_1c48y","navBar":"_3KwsN","todayButton":"_10CBO","navButtonInteractionDisabled":"_dHL-D","navButtonPrev":"_6kNi3","navButtonNext":"_13W_e","months":"_1FeSY","month":"_wU6A4","caption":"_AMbAo","weekdays":"_1LEst","weekdaysRow":"_2XECo","weekday":"_1C5ry","body":"_11F-Y","week":"_3MAFk","day":"_mG73F","disabled":"_2pgnH","selected":"_MtLaz","outside":"_CRqyX","footer":"_2KG9-","today":"_2JA2y","overlayWrapper":"_1JWbc","overlay":"_2tL6g","weekNumber":"_3u72O","text-field":"_25rf7","date-range-field":"_3qVhi","text-field--invalid":"_2M9Ud","text-field--prefixed":"_3TUb2","text-field--suffixed":"_foqL0","date-range-field--invalid":"_3df9R","date-range-field--disabled":"_2Nkht"};
5046
5045
 
5047
5046
  var FromDate = function FromDate(_ref) {
5048
5047
  var name = _ref.name,
@@ -5173,7 +5172,7 @@ var ToDate = function ToDate(_ref, ref) {
5173
5172
  var ToDate$1 = React.forwardRef(ToDate);
5174
5173
 
5175
5174
  var DateRangeField = function DateRangeField(_ref) {
5176
- var _classnames;
5175
+ var _classnames, _classnames2;
5177
5176
 
5178
5177
  var name = _ref.name,
5179
5178
  inputId = _ref.id,
@@ -5212,7 +5211,7 @@ var DateRangeField = function DateRangeField(_ref) {
5212
5211
  start = _controllers$value.start,
5213
5212
  end = _controllers$value.end;
5214
5213
  return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement("div", {
5215
- className: classnames(styles$s['date-range-field'], (_classnames = {}, _classnames[styles$s['date-range-field--invalid']] = hasError, _classnames))
5214
+ className: classnames(styles$s['date-range-field'], (_classnames = {}, _classnames[styles$s['date-range-field--invalid']] = hasError, _classnames), (_classnames2 = {}, _classnames2[styles$s['date-range-field--disabled']] = disabled, _classnames2))
5216
5215
  }, React__default.createElement(IconCalendarAlt, {
5217
5216
  size: "medium",
5218
5217
  color: GREY400
@@ -5852,7 +5851,7 @@ exports.SelectField = SelectField;
5852
5851
  exports.Spinner = Spinner;
5853
5852
  exports.Stack = Stack;
5854
5853
  exports.TextAreaField = TextAreaField;
5855
- exports.TextField = TextField$1;
5854
+ exports.TextField = TextField;
5856
5855
  exports.Toggle = Toggle;
5857
5856
  exports.Tooltip = Tooltip$1;
5858
5857
  exports.WeekField = WeekField;