@edvisor/product-language 0.7.1 → 0.7.2

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.
Files changed (2) hide show
  1. package/index.js +33 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -9989,7 +9989,7 @@ const FieldContainer = /*#__PURE__*/styled.div.withConfig({
9989
9989
  const HandleContainer = /*#__PURE__*/styled.div.withConfig({
9990
9990
  displayName: "handle__HandleContainer",
9991
9991
  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, ({
9992
+ })(["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
9993
  thumbHeight
9994
9994
  }) => thumbHeight, ({
9995
9995
  thumbHeight
@@ -10050,7 +10050,7 @@ const RailComponent = /*#__PURE__*/memo(props => {
10050
10050
  const Track = /*#__PURE__*/styled.div.withConfig({
10051
10051
  displayName: "track__Track",
10052
10052
  componentId: "sc-20rwgc-0"
10053
- })(["background-color:", ";height:", "px;position:absolute;pointer-events:none;left:", ";width:", ";"], Actions.Primary.Default, ({
10053
+ })(["background-color:", ";height:", "px;position:absolute;z-index:1;pointer-events:none;left:", ";width:", ";"], Actions.Primary.Default, ({
10054
10054
  trackHeight
10055
10055
  }) => trackHeight, ({
10056
10056
  left
@@ -10112,13 +10112,20 @@ const SliderComponent = props => {
10112
10112
  onChange,
10113
10113
  onUpdate
10114
10114
  } = props;
10115
+
10116
+ const handleOnChange = newValues => {
10117
+ if (values.some((val, index) => val !== newValues[index])) {
10118
+ onChange(newValues);
10119
+ }
10120
+ };
10121
+
10115
10122
  return jsxs(Slider$1, Object.assign({
10116
10123
  mode: mode,
10117
10124
  step: 1,
10118
10125
  domain: domain,
10119
10126
  values: values,
10120
10127
  rootStyle: sliderStyle,
10121
- onChange: onChange,
10128
+ onChange: handleOnChange,
10122
10129
  onUpdate: newValues => {
10123
10130
  onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newValues);
10124
10131
  }
@@ -10212,23 +10219,43 @@ const SliderInputs = props => {
10212
10219
  const handleOnBlur = (e, valueType) => {
10213
10220
  const intValue = +e.target.value;
10214
10221
  const newValue = getNewValue(intValue, valueType, props);
10222
+ mayCallOnChange(newValue, valueType);
10215
10223
 
10216
10224
  if (type === SliderType.SLIDER) {
10217
- onChange([newValue]);
10218
10225
  setMaxValue(newValue);
10219
10226
  return;
10220
10227
  }
10221
10228
 
10222
10229
  if (valueType === ValueType.MIN) {
10223
- onChange([newValue, stateMaxValue]);
10224
10230
  setMinValue(newValue);
10225
10231
  return;
10226
10232
  }
10227
10233
 
10228
- onChange([stateMinValue, newValue]);
10229
10234
  setMaxValue(newValue);
10230
10235
  };
10231
10236
 
10237
+ const mayCallOnChange = (newValue, valueType) => {
10238
+ if (type === SliderType.SLIDER) {
10239
+ if (newValue !== maxValue) {
10240
+ onChange([newValue]);
10241
+ }
10242
+
10243
+ return;
10244
+ }
10245
+
10246
+ if (valueType === ValueType.MIN) {
10247
+ if (newValue !== minValue) {
10248
+ onChange([newValue, stateMaxValue]);
10249
+ }
10250
+
10251
+ return;
10252
+ }
10253
+
10254
+ if (newValue !== maxValue) {
10255
+ onChange([stateMinValue, newValue]);
10256
+ }
10257
+ };
10258
+
10232
10259
  return type === SliderType.RANGE_SLIDER ? jsxs(Fragment$1, {
10233
10260
  children: [jsx(FieldContainer, Object.assign({
10234
10261
  margin: 'right'
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.2",
4
4
  "license": "MIT",
5
5
  "description": "Edvisor.io product-language components",
6
6
  "repository": "https://github.com/edvisor-io/front-end/",