@edvisor/product-language 0.7.1 → 0.7.3

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/index.js CHANGED
@@ -6578,7 +6578,17 @@ class ControlsSlot$1 extends Slot {}
6578
6578
  const InputFrame = /*#__PURE__*/styled.label.withConfig({
6579
6579
  displayName: "input-field__InputFrame",
6580
6580
  componentId: "sc-1yq0rb7-5"
6581
- })(["width:100%;padding:", " ", " ", " ", ";flex-direction:column;display:flex;"], Padding.xs, Padding.none, Padding.none, Padding.none);
6581
+ })(["width:100%;padding:", " ", " ", " ", ";display:flex;flex-direction:", ";", ""], Padding.xs, Padding.none, Padding.none, Padding.none, ({
6582
+ label,
6583
+ labelPosition
6584
+ }) => isDefined(label) && !isEmpty(label) && labelPosition === "side"
6585
+ /* labelPositionType.SIDE */
6586
+ ? 'row' : 'column', ({
6587
+ label,
6588
+ labelPosition
6589
+ }) => isDefined(label) && !isEmpty(label) && labelPosition === "side"
6590
+ /* labelPositionType.SIDE */
6591
+ && css(["width:fit-content;white-space:pre;"]));
6582
6592
  const ControlsFrame = /*#__PURE__*/styled(Flex).withConfig({
6583
6593
  displayName: "input-field__ControlsFrame",
6584
6594
  componentId: "sc-1yq0rb7-6"
@@ -6586,7 +6596,11 @@ const ControlsFrame = /*#__PURE__*/styled(Flex).withConfig({
6586
6596
  const InputLabel = /*#__PURE__*/styled(Label$1).withConfig({
6587
6597
  displayName: "input-field__InputLabel",
6588
6598
  componentId: "sc-1yq0rb7-7"
6589
- })(["margin-bottom:", ";"], Margin.xxs);
6599
+ })(["margin-bottom:", ";", ""], Margin.xxs, ({
6600
+ labelPosition
6601
+ }) => labelPosition === "side"
6602
+ /* labelPositionType.SIDE */
6603
+ && css(["padding-right:", ";"], Padding.xs));
6590
6604
  const InputField$1 = forwardRef((props, ref) => {
6591
6605
  const {
6592
6606
  children,
@@ -6594,9 +6608,12 @@ const InputField$1 = forwardRef((props, ref) => {
6594
6608
  suffix,
6595
6609
  label,
6596
6610
  className,
6597
- style
6611
+ style,
6612
+ labelPosition = "top"
6613
+ /* labelPositionType.TOP */
6614
+
6598
6615
  } = props,
6599
- inputProps = __rest(props, ["children", "prefix", "suffix", "label", "className", "style"]);
6616
+ inputProps = __rest(props, ["children", "prefix", "suffix", "label", "className", "style", "labelPosition"]);
6600
6617
 
6601
6618
  const icon = getSlot(IconSlot, children);
6602
6619
  const controls = getSlot(ControlsSlot$1, children);
@@ -6606,11 +6623,15 @@ const InputField$1 = forwardRef((props, ref) => {
6606
6623
  className: className,
6607
6624
  style: style
6608
6625
  }, {
6609
- children: [jsxs(InputFrame, {
6626
+ children: [jsxs(InputFrame, Object.assign({
6627
+ label: label,
6628
+ labelPosition: labelPosition
6629
+ }, {
6610
6630
  children: [jsx(If, Object.assign({
6611
6631
  is: label
6612
6632
  }, {
6613
6633
  children: jsxs(InputLabel, Object.assign({
6634
+ labelPosition: labelPosition,
6614
6635
  subtle: true,
6615
6636
  subdued: true
6616
6637
  }, {
@@ -6639,7 +6660,7 @@ const InputField$1 = forwardRef((props, ref) => {
6639
6660
  }))
6640
6661
  }))]
6641
6662
  })]
6642
- }), jsx(If, Object.assign({
6663
+ })), jsx(If, Object.assign({
6643
6664
  is: icon
6644
6665
  }, {
6645
6666
  children: jsx(ControlsFrame, Object.assign({
@@ -8700,7 +8721,7 @@ const Button = props => {
8700
8721
  const ValueContainer = /*#__PURE__*/styled(SpaceBetween).withConfig({
8701
8722
  displayName: "value__ValueContainer",
8702
8723
  componentId: "sc-1aps7dx-0"
8703
- })(["pointer-events:", ";padding:", " ", " ", " ", ";background:", ";cursor:default;border:1px solid ", ";z-index:0;border-radius:6px;outline-offset:-2px;", " ", " ", ""], props => is(props.disabled) ? 'none' : 'auto', Padding.xs, Padding.none, Padding.none, Padding.none, props => is(props.invalid) ? Surface.Critical.Subdued : Surface.Default.Default, props => is(props.invalid) ? Borders.Critical.Default : Borders.Default.Default, props => is(props.hasLabel) && css(["& div:first-of-type{align-self:flex-start;}"]), props => is(props.menuIsOpen) && css(["outline:2px solid ", ";"], Focused.Default), props => !is(props.disabled) && !is(props.invalid) && `
8724
+ })(["pointer-events:", ";padding:", " ", ";background:", ";cursor:default;border:1px solid ", ";border-radius:6px;outline-offset:-2px;", " ", ""], props => is(props.disabled) ? 'none' : 'auto', Padding.xs, Padding.none, props => is(props.invalid) ? Surface.Critical.Subdued : Surface.Default.Default, props => is(props.invalid) ? Borders.Critical.Default : Borders.Default.Default, props => is(props.menuIsOpen) && css(["outline:2px solid ", ";"], Focused.Default), props => !is(props.disabled) && !is(props.invalid) && `
8704
8725
 
8705
8726
  &:focus {
8706
8727
  outline: 2px solid ${Focused.Default}
@@ -8713,7 +8734,7 @@ const ValueContainer = /*#__PURE__*/styled(SpaceBetween).withConfig({
8713
8734
  const ValueWrapper$1 = /*#__PURE__*/styled(Flex).withConfig({
8714
8735
  displayName: "value__ValueWrapper",
8715
8736
  componentId: "sc-1aps7dx-1"
8716
- })(["width:100%;padding-bottom:", ";display:", ";"], Padding.xs, ({
8737
+ })(["width:100%;display:", ";"], ({
8717
8738
  label,
8718
8739
  labelPosition
8719
8740
  }) => isDefined(label) && !isEmpty(label) && labelPosition === "top"
@@ -8722,7 +8743,15 @@ const ValueWrapper$1 = /*#__PURE__*/styled(Flex).withConfig({
8722
8743
  const ValueLabel = /*#__PURE__*/styled(Label$1).withConfig({
8723
8744
  displayName: "value__ValueLabel",
8724
8745
  componentId: "sc-1aps7dx-2"
8725
- })(["padding-left:", ";margin-bottom:", ";width:fit-content;white-space:pre;", ""], Padding.xs, Margin.xxs, ({
8746
+ })(["padding-left:", ";margin-bottom:", ";display:flex;align-self:", ";width:fit-content;white-space:pre;", ""], Padding.xs, ({
8747
+ labelPosition
8748
+ }) => labelPosition === "top"
8749
+ /* labelPositionType.TOP */
8750
+ ? Margin.xxs : Margin.none, ({
8751
+ labelPosition
8752
+ }) => labelPosition === "top"
8753
+ /* labelPositionType.TOP */
8754
+ ? 'flex-start' : 'center', ({
8726
8755
  labelPosition
8727
8756
  }) => labelPosition === "top"
8728
8757
  /* labelPositionType.TOP */
@@ -8734,7 +8763,7 @@ const ValueLeft = /*#__PURE__*/styled(Flex).withConfig({
8734
8763
  const ValueRight = /*#__PURE__*/styled(Flex).withConfig({
8735
8764
  displayName: "value__ValueRight",
8736
8765
  componentId: "sc-1aps7dx-4"
8737
- })(["padding-right:", ";pointer-events:none;"], Padding.xxs);
8766
+ })(["padding-right:", ";cursor:pointer;"], Padding.xxs);
8738
8767
  const Placeholder = /*#__PURE__*/styled(Label$1).withConfig({
8739
8768
  displayName: "value__Placeholder",
8740
8769
  componentId: "sc-1aps7dx-5"
@@ -8858,22 +8887,22 @@ const Value = props => {
8858
8887
  }
8859
8888
  };
8860
8889
 
8861
- const onClear = e => {
8862
- e.stopPropagation();
8890
+ const onClear = event => {
8891
+ event.stopPropagation();
8863
8892
  props.onClear();
8864
8893
  };
8865
8894
 
8866
- const onSearch = e => {
8895
+ const onSearch = event => {
8867
8896
  if (is(props.searchable)) {
8868
- props.onSearch(e.currentTarget.innerText.trim());
8897
+ props.onSearch(event.currentTarget.innerText.trim());
8869
8898
  } else {
8870
- e.preventDefault();
8899
+ event.preventDefault();
8871
8900
  }
8872
8901
  };
8873
8902
 
8874
- const onKeyDown = e => {
8875
- if (!is(searchable) && e.key !== keys.TAB || e.key === keys.ENTER || e.key === keys.ARROW_UP || e.key === keys.ARROW_DOWN) {
8876
- e.preventDefault();
8903
+ const onKeyDown = event => {
8904
+ if (!is(searchable) && event.key !== keys.TAB || event.key === keys.ENTER || event.key === keys.ARROW_UP || event.key === keys.ARROW_DOWN) {
8905
+ event.preventDefault();
8877
8906
  }
8878
8907
  };
8879
8908
 
@@ -9039,7 +9068,9 @@ const SelectImpl = (props, selectRef) => {
9039
9068
 
9040
9069
  function addDocumentListener() {
9041
9070
  removeDocumentListener();
9042
- document === null || document === void 0 ? void 0 : document.addEventListener('click', onDocumentClick);
9071
+ document === null || document === void 0 ? void 0 : document.addEventListener('click', onDocumentClick, {
9072
+ capture: true
9073
+ });
9043
9074
  }
9044
9075
 
9045
9076
  function onOptionSelect(selectValue, option) {
@@ -9052,7 +9083,9 @@ const SelectImpl = (props, selectRef) => {
9052
9083
  }
9053
9084
 
9054
9085
  function removeDocumentListener() {
9055
- document === null || document === void 0 ? void 0 : document.removeEventListener('click', onDocumentClick);
9086
+ document === null || document === void 0 ? void 0 : document.removeEventListener('click', onDocumentClick, {
9087
+ capture: true
9088
+ });
9056
9089
  }
9057
9090
 
9058
9091
  function onKeyDown({
@@ -9989,7 +10022,7 @@ const FieldContainer = /*#__PURE__*/styled.div.withConfig({
9989
10022
  const HandleContainer = /*#__PURE__*/styled.div.withConfig({
9990
10023
  displayName: "handle__HandleContainer",
9991
10024
  componentId: "sc-1ylwh31-0"
9992
- })(["background-color:", ";margin-left:-6px;margin-top:-6px;width:", "px;height:", "px;border:0;border-radius:50%;white-space:nowrap;position:absolute;cursor:pointer;left:", ";"], Actions.Primary.Default, ({
10025
+ })(["background-color:", ";margin-left:-6px;margin-top:-6px;width:", "px;height:", "px;border:0;border-radius:50%;white-space:nowrap;position:absolute;z-index:2;cursor:pointer;left:", ";"], Actions.Primary.Default, ({
9993
10026
  thumbHeight
9994
10027
  }) => thumbHeight, ({
9995
10028
  thumbHeight
@@ -10050,7 +10083,7 @@ const RailComponent = /*#__PURE__*/memo(props => {
10050
10083
  const Track = /*#__PURE__*/styled.div.withConfig({
10051
10084
  displayName: "track__Track",
10052
10085
  componentId: "sc-20rwgc-0"
10053
- })(["background-color:", ";height:", "px;position:absolute;pointer-events:none;left:", ";width:", ";"], Actions.Primary.Default, ({
10086
+ })(["background-color:", ";height:", "px;position:absolute;z-index:1;pointer-events:none;left:", ";width:", ";"], Actions.Primary.Default, ({
10054
10087
  trackHeight
10055
10088
  }) => trackHeight, ({
10056
10089
  left
@@ -10112,13 +10145,20 @@ const SliderComponent = props => {
10112
10145
  onChange,
10113
10146
  onUpdate
10114
10147
  } = props;
10148
+
10149
+ const handleOnChange = newValues => {
10150
+ if (values.some((val, index) => val !== newValues[index])) {
10151
+ onChange(newValues);
10152
+ }
10153
+ };
10154
+
10115
10155
  return jsxs(Slider$1, Object.assign({
10116
10156
  mode: mode,
10117
10157
  step: 1,
10118
10158
  domain: domain,
10119
10159
  values: values,
10120
10160
  rootStyle: sliderStyle,
10121
- onChange: onChange,
10161
+ onChange: handleOnChange,
10122
10162
  onUpdate: newValues => {
10123
10163
  onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newValues);
10124
10164
  }
@@ -10212,23 +10252,43 @@ const SliderInputs = props => {
10212
10252
  const handleOnBlur = (e, valueType) => {
10213
10253
  const intValue = +e.target.value;
10214
10254
  const newValue = getNewValue(intValue, valueType, props);
10255
+ mayCallOnChange(newValue, valueType);
10215
10256
 
10216
10257
  if (type === SliderType.SLIDER) {
10217
- onChange([newValue]);
10218
10258
  setMaxValue(newValue);
10219
10259
  return;
10220
10260
  }
10221
10261
 
10222
10262
  if (valueType === ValueType.MIN) {
10223
- onChange([newValue, stateMaxValue]);
10224
10263
  setMinValue(newValue);
10225
10264
  return;
10226
10265
  }
10227
10266
 
10228
- onChange([stateMinValue, newValue]);
10229
10267
  setMaxValue(newValue);
10230
10268
  };
10231
10269
 
10270
+ const mayCallOnChange = (newValue, valueType) => {
10271
+ if (type === SliderType.SLIDER) {
10272
+ if (newValue !== maxValue) {
10273
+ onChange([newValue]);
10274
+ }
10275
+
10276
+ return;
10277
+ }
10278
+
10279
+ if (valueType === ValueType.MIN) {
10280
+ if (newValue !== minValue) {
10281
+ onChange([newValue, stateMaxValue]);
10282
+ }
10283
+
10284
+ return;
10285
+ }
10286
+
10287
+ if (newValue !== maxValue) {
10288
+ onChange([stateMinValue, newValue]);
10289
+ }
10290
+ };
10291
+
10232
10292
  return type === SliderType.RANGE_SLIDER ? jsxs(Fragment$1, {
10233
10293
  children: [jsx(FieldContainer, Object.assign({
10234
10294
  margin: 'right'
@@ -16,6 +16,7 @@ interface IInputFieldProps extends InputHTMLAttributes<HTMLInputElement> {
16
16
  prefix?: string;
17
17
  suffix?: string;
18
18
  label?: string;
19
+ labelPosition?: string;
19
20
  }
20
21
  export declare const InputField: import("react").ForwardRefExoticComponent<IInputFieldProps & import("react").RefAttributes<HTMLInputElement>> & {
21
22
  Icon: typeof IconSlot;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edvisor/product-language",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "license": "MIT",
5
5
  "description": "Edvisor.io product-language components",
6
6
  "repository": "https://github.com/edvisor-io/front-end/",