armtek-uikit-react 1.0.143 → 1.0.144

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.
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"armtek-uikit-react","version":"1.0.143","description":"Armtek UIKit for React","repository":{"type":"git","url":"ssh://git@gl.corp:10022/int/uikit/uikit_react.git"},"author":"","license":"ISC","dependencies":{"build":"^0.1.4","clsx":"^2.0.0","rc-slider":"^10.2.1","react":"*","react-datepicker":"^4.16.0","react-dom":"*","react-transition-group":"^4.4.5"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
1
+ {"name":"armtek-uikit-react","version":"1.0.144","description":"Armtek UIKit for React","repository":{"type":"git","url":"ssh://git@gl.corp:10022/int/uikit/uikit_react.git"},"author":"","license":"ISC","dependencies":{"build":"^0.1.4","clsx":"^2.0.0","rc-slider":"^10.2.1","react":"*","react-datepicker":"^4.16.0","react-dom":"*","react-transition-group":"^4.4.5"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
@@ -14,6 +14,7 @@ type SelectBaseProps = {
14
14
  onSubmit?: () => void;
15
15
  defaultQuery?: string;
16
16
  query?: string;
17
+ optionControls?: boolean;
17
18
  };
18
19
  type MultipleType<M extends boolean = false> = {
19
20
  multiple?: M;
@@ -29,7 +30,7 @@ export type SelectChangeEvent<Value = string> = (Event & {
29
30
  name: string;
30
31
  };
31
32
  });
32
- type SelectOptionsType<T extends boolean> = {
33
+ export type SelectOptionsType<T extends boolean> = {
33
34
  options: OptionType[];
34
35
  value?: T extends true ? string[] : string;
35
36
  inline?: boolean;
@@ -40,6 +41,8 @@ type SelectOptionsType<T extends boolean> = {
40
41
  onClear?: (e: MouseEvent) => void;
41
42
  onSubmit?: () => void;
42
43
  disabled?: boolean;
44
+ optionControls?: boolean;
43
45
  };
46
+ export declare const SelectOptions: import("react").ForwardRefExoticComponent<SelectOptionsType<boolean> & import("react").RefAttributes<unknown>>;
44
47
  declare const _default: <M extends boolean = false>(props: SelectBaseProps & MultipleType<M> & Omit<TextFieldProps, keyof SelectBaseProps | keyof MultipleType<M_1>> & import("react").RefAttributes<HTMLInputElement>) => import("react").ReactNode;
45
48
  export default _default;
@@ -27,6 +27,7 @@ function Select(props, ref) {
27
27
  inline,
28
28
  multiple = false,
29
29
  value,
30
+ optionControls,
30
31
  defaultValue,
31
32
  onChange,
32
33
  search,
@@ -103,13 +104,13 @@ function Select(props, ref) {
103
104
  const handleResetAll = clear ? e => {
104
105
  e.preventDefault();
105
106
  if (props.disabled) return;
106
- setSelected(multiple ? '' : []);
107
+ setSelected(multiple ? [] : '');
107
108
  if (onChange) {
108
109
  Object.defineProperty(e, 'target', {
109
110
  writable: false,
110
111
  value: {
111
112
  name: props.name,
112
- value: multiple ? '' : []
113
+ value: multiple ? [] : ''
113
114
  }
114
115
  });
115
116
  onChange(e);
@@ -129,10 +130,11 @@ function Select(props, ref) {
129
130
  function handleClose() {
130
131
  if (onClose) onClose();else setActive(false);
131
132
  }
133
+ let displayClear = clear && (multiple ? realValue && realValue.length > 0 : !!realValue);
132
134
  let selectEndAdornment = /*#__PURE__*/_jsxs(_Fragment, {
133
135
  children: [/*#__PURE__*/_jsx(Adornment, {
134
136
  children: endAdornment
135
- }), clear && realValue && /*#__PURE__*/_jsx(Adornment, {
137
+ }), displayClear && /*#__PURE__*/_jsx(Adornment, {
136
138
  children: /*#__PURE__*/_jsx(ButtonIcon, {
137
139
  size: 'small',
138
140
  onClick: handleResetAll,
@@ -225,7 +227,7 @@ function Select(props, ref) {
225
227
  })
226
228
  });
227
229
  }
228
- const SelectOptions = /*#__PURE__*/forwardRef((props, ref) => {
230
+ export const SelectOptions = /*#__PURE__*/forwardRef((props, ref) => {
229
231
  let {
230
232
  options,
231
233
  value,
@@ -234,8 +236,10 @@ const SelectOptions = /*#__PURE__*/forwardRef((props, ref) => {
234
236
  onClick,
235
237
  listStyle,
236
238
  disabled,
239
+ optionControls,
237
240
  ...callbacks
238
241
  } = props;
242
+ if (multiple && optionControls === undefined) optionControls = true;
239
243
  return /*#__PURE__*/_jsx(_Fragment, {
240
244
  children: /*#__PURE__*/_jsxs("div", {
241
245
  ref: ref,
@@ -253,7 +257,7 @@ const SelectOptions = /*#__PURE__*/forwardRef((props, ref) => {
253
257
  onClick: e => onClick(e, item),
254
258
  children: item.text
255
259
  }, index);
256
- }), listStyle === 'checkbox' && !!multiple && /*#__PURE__*/_jsx("div", {
260
+ }), !!optionControls && !!multiple && /*#__PURE__*/_jsx("div", {
257
261
  className: 'arm-selectSummary__wrapper',
258
262
  children: /*#__PURE__*/_jsx(SelectSummary, {
259
263
  options: options,