pixel-react 1.13.63 → 1.13.64

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 (33) hide show
  1. package/lib/_virtual/index10.js +2 -2
  2. package/lib/_virtual/index9.js +2 -2
  3. package/lib/components/CreateVariable/CreateVariableSlider.js +18 -2
  4. package/lib/components/CreateVariable/CreateVariableSlider.js.map +1 -1
  5. package/lib/components/MediaPreview/MediaPreview.js +43 -12
  6. package/lib/components/MediaPreview/MediaPreview.js.map +1 -1
  7. package/lib/components/PhoneInput/PhoneInput.js +21 -6
  8. package/lib/components/PhoneInput/PhoneInput.js.map +1 -1
  9. package/lib/components/PhoneInput/types.d.ts +6 -0
  10. package/lib/components/Select/Select.js +1 -1
  11. package/lib/components/Select/Select.js.map +1 -1
  12. package/lib/components/variableSuggestionInputDropDown/VariableSuggestionInputDropDown.js +28 -21
  13. package/lib/components/variableSuggestionInputDropDown/VariableSuggestionInputDropDown.js.map +1 -1
  14. package/lib/components/variableSuggestionInputDropDown/types.d.ts +4 -0
  15. package/lib/hooks/useConditionalLock.d.ts +2 -0
  16. package/lib/hooks/useConditionalLock.js +19 -0
  17. package/lib/hooks/useConditionalLock.js.map +1 -0
  18. package/lib/index.cjs +124 -40
  19. package/lib/index.cjs.map +1 -1
  20. package/lib/index.d.ts +7 -1
  21. package/lib/index.js +1 -0
  22. package/lib/index.js.map +1 -1
  23. package/lib/node_modules/js-beautify/js/src/css/options.js +1 -1
  24. package/lib/node_modules/js-beautify/js/src/html/beautifier.js +1 -1
  25. package/lib/node_modules/js-beautify/js/src/html/index.js +1 -1
  26. package/lib/node_modules/js-beautify/js/src/html/options.js +1 -1
  27. package/lib/node_modules/js-beautify/js/src/javascript/beautifier.js +1 -1
  28. package/lib/node_modules/js-beautify/js/src/javascript/index.js +1 -1
  29. package/lib/node_modules/js-beautify/js/src/javascript/options.js +1 -1
  30. package/lib/styles.css +1 -1
  31. package/lib/styles.css.map +1 -1
  32. package/lib/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +1 -1
package/lib/index.cjs CHANGED
@@ -4441,7 +4441,7 @@ const Select$1 = ({
4441
4441
  'ff-select-labels__active': searchedText
4442
4442
  }),
4443
4443
  fontSize: searchedText || showDropdownOptions ? 10 : 12,
4444
- lineHeight: searchedText || showDropdownOptions ? '10px' : '12px',
4444
+ lineHeight: searchedText || showDropdownOptions && '12px',
4445
4445
  required: required,
4446
4446
  style: {
4447
4447
  maxWidth: `calc(${selectWidth} - 40px)`
@@ -42832,6 +42832,7 @@ const VariableSuggestionInputDropDown = /*#__PURE__*/React.forwardRef(({
42832
42832
  symbol = '$',
42833
42833
  type = 'text',
42834
42834
  clearIcon = true,
42835
+ inputTitle = '',
42835
42836
  ...props
42836
42837
  }, ref) => {
42837
42838
  const [showDropdown, setShowDropdown] = React.useState(false);
@@ -42988,28 +42989,34 @@ const VariableSuggestionInputDropDown = /*#__PURE__*/React.forwardRef(({
42988
42989
  children: [jsxRuntime.jsxs("div", {
42989
42990
  className: "ff-add-variable-input",
42990
42991
  ref: containerRef,
42991
- children: [jsxRuntime.jsx(Input$1, {
42992
- ...props,
42993
- name: "add_variable",
42994
- ref: inputRef,
42995
- type: type,
42996
- value: value,
42997
- onChange: onChange,
42998
- onPaste: () => {
42999
- setShowCreateVariableIcon(true);
42992
+ children: [jsxRuntime.jsx(Tooltip, {
42993
+ title: inputTitle,
42994
+ style: {
42995
+ width: '100%'
43000
42996
  },
43001
- variant: "primary",
43002
- label: label,
43003
- placeholder: placeholder,
43004
- onClick: handleClick,
43005
- onKeyUp: handleKeyUp,
43006
- onFocus: () => setIsFocused(true),
43007
- onBlur: e => handleBlur(e),
43008
- autoComplete: autoComplete,
43009
- helperText: helperText,
43010
- error: error,
43011
- required: required,
43012
- ...formProps
42997
+ children: jsxRuntime.jsx(Input$1, {
42998
+ ...props,
42999
+ name: "add_variable",
43000
+ ref: inputRef,
43001
+ type: type,
43002
+ value: value,
43003
+ onChange: onChange,
43004
+ onPaste: () => {
43005
+ setShowCreateVariableIcon(true);
43006
+ },
43007
+ variant: "primary",
43008
+ label: label,
43009
+ placeholder: placeholder,
43010
+ onClick: handleClick,
43011
+ onKeyUp: handleKeyUp,
43012
+ onFocus: () => setIsFocused(true),
43013
+ onBlur: e => handleBlur(e),
43014
+ autoComplete: autoComplete,
43015
+ helperText: helperText,
43016
+ error: error,
43017
+ required: required,
43018
+ ...formProps
43019
+ })
43013
43020
  }), !checkEmpty(value) && !isOnlyHash && jsxRuntime.jsxs("div", {
43014
43021
  className: "ff-variable-icon-container",
43015
43022
  children: [clearIcon && jsxRuntime.jsx(Tooltip, {
@@ -43078,6 +43085,18 @@ const CreateVariableSlider = ({
43078
43085
  const [helperText, setHelperText] = React.useState('');
43079
43086
  const [hashInputValue, setHashInputValue] = React.useState();
43080
43087
  const [isSubmitting, setIsSubmitting] = React.useState(false);
43088
+ const [initialValues, setInitialValues] = React.useState({
43089
+ name: '',
43090
+ value: ''
43091
+ });
43092
+ React.useEffect(() => {
43093
+ if (isOpen && mode === 'edit') {
43094
+ setInitialValues({
43095
+ name: variableName,
43096
+ value: variableValue
43097
+ });
43098
+ }
43099
+ }, []);
43081
43100
  const getVariableNameError = value => {
43082
43101
  if (!value || value.length === 0) {
43083
43102
  return 'Variable Name is required';
@@ -43115,6 +43134,10 @@ const CreateVariableSlider = ({
43115
43134
  const isValid = isNonEmpty && matchesPattern && noWhitespaceEdges && lengthValid;
43116
43135
  return isValid;
43117
43136
  }
43137
+ const hasChanges = React.useMemo(() => {
43138
+ if (mode !== 'edit') return true;
43139
+ return variableName !== initialValues.name || variableValue !== initialValues.value;
43140
+ }, [mode, variableName, variableValue, initialValues]);
43118
43141
  const FooterContent = () => {
43119
43142
  return jsxRuntime.jsxs("div", {
43120
43143
  className: "ff-create-slider-footer",
@@ -43132,7 +43155,7 @@ const CreateVariableSlider = ({
43132
43155
  handleSubmit();
43133
43156
  }
43134
43157
  },
43135
- disabled: !isVariableNameValid(variableName) || isSubmitting
43158
+ disabled: !isVariableNameValid(variableName) || isSubmitting || mode === 'edit' && !hasChanges
43136
43159
  })]
43137
43160
  });
43138
43161
  };
@@ -43559,6 +43582,7 @@ const MediaPreview = ({
43559
43582
  isDisabled = false
43560
43583
  }) => {
43561
43584
  const [isModalOpen, setIsModalOpen] = React.useState(false);
43585
+ const videoRef = React.useRef(null);
43562
43586
  const handleExpand = () => {
43563
43587
  setIsModalOpen(true);
43564
43588
  onExpandClick && onExpandClick(fileId);
@@ -43575,6 +43599,20 @@ const MediaPreview = ({
43575
43599
  setIsModalOpen(true);
43576
43600
  }
43577
43601
  }, [previewOnly]);
43602
+ React.useEffect(() => {
43603
+ if (isModalOpen) {
43604
+ setTimeout(() => {
43605
+ if (videoRef.current) {
43606
+ const playPromise = videoRef.current.play();
43607
+ if (playPromise !== undefined) {
43608
+ playPromise.catch(error => {
43609
+ console.error('Autoplay failed:', error);
43610
+ });
43611
+ }
43612
+ }
43613
+ }, 300);
43614
+ }
43615
+ }, [isModalOpen]);
43578
43616
  return jsxRuntime.jsxs("div", {
43579
43617
  children: [!previewOnly && (isMediaIcon ? jsxRuntime.jsx(Icon, {
43580
43618
  name: iconName,
@@ -43603,16 +43641,30 @@ const MediaPreview = ({
43603
43641
  className: "media-wrapper",
43604
43642
  children: [jsxRuntime.jsxs("div", {
43605
43643
  className: "ff-expand-icons",
43606
- children: [jsxRuntime.jsx(Icon, {
43607
- name: "download_file_icon",
43608
- onClick: handleDownload,
43609
- color: "var(--icons-default-color)",
43610
- className: "header-icons"
43611
- }), jsxRuntime.jsx(Icon, {
43612
- name: "close",
43613
- onClick: handleClose,
43614
- color: "var(--icons-default-color)",
43615
- className: "header-icons"
43644
+ children: [jsxRuntime.jsx(Tooltip, {
43645
+ title: "Download File",
43646
+ children: jsxRuntime.jsx(Icon, {
43647
+ name: "download_file_icon",
43648
+ onClick: handleDownload,
43649
+ color: "var(--icons-default-color)",
43650
+ className: "header-icons"
43651
+ })
43652
+ }), jsxRuntime.jsx(Tooltip, {
43653
+ title: "Expand",
43654
+ children: jsxRuntime.jsx(Icon, {
43655
+ name: "expand",
43656
+ onClick: handleExpand,
43657
+ color: "var(--icons-default-color)",
43658
+ className: "header-icons"
43659
+ })
43660
+ }), jsxRuntime.jsx(Tooltip, {
43661
+ title: "close",
43662
+ children: jsxRuntime.jsx(Icon, {
43663
+ name: "close",
43664
+ onClick: handleClose,
43665
+ color: "var(--icons-default-color)",
43666
+ className: "header-icons"
43667
+ })
43616
43668
  })]
43617
43669
  }), mediaType === 'image' && jsxRuntime.jsx("img", {
43618
43670
  src: MediaSrc,
@@ -43623,7 +43675,8 @@ const MediaPreview = ({
43623
43675
  src: MediaSrc,
43624
43676
  controls: true,
43625
43677
  controlsList: "nodownload",
43626
- className: "ff-video-preview"
43678
+ className: "ff-video-preview",
43679
+ ref: videoRef
43627
43680
  })]
43628
43681
  })
43629
43682
  })]
@@ -59392,6 +59445,21 @@ const Comments = ({
59392
59445
  });
59393
59446
  };
59394
59447
 
59448
+ function useConditionalLock(fn, unlockCondition) {
59449
+ const isLocked = React.useRef(false);
59450
+ React.useEffect(() => {
59451
+ if (unlockCondition) {
59452
+ isLocked.current = false;
59453
+ }
59454
+ }, [unlockCondition]);
59455
+ return React.useCallback((...args) => {
59456
+ if (!isLocked.current) {
59457
+ fn(...args);
59458
+ isLocked.current = true;
59459
+ }
59460
+ }, [fn]);
59461
+ }
59462
+
59395
59463
  const PopUpModal = ({
59396
59464
  isOpen,
59397
59465
  onClose,
@@ -72428,6 +72496,7 @@ const PhoneInputField = ({
72428
72496
  const [phone, setPhone] = React.useState(initialValue);
72429
72497
  const [isFocused, setIsFocused] = React.useState(false);
72430
72498
  const [isValid, setIsValid] = React.useState(initialIsValid);
72499
+ const [selectedCountry, setSelectedCountry] = React.useState(country);
72431
72500
  React.useEffect(() => {
72432
72501
  if (initialValue) {
72433
72502
  let formattedPhone = initialValue;
@@ -72437,12 +72506,25 @@ const PhoneInputField = ({
72437
72506
  setPhone(formattedPhone);
72438
72507
  }
72439
72508
  }, [initialValue]);
72440
- const handlePhoneChange = phone => {
72509
+ const handlePhoneChange = (phone, countryData) => {
72510
+ const newCountryCode = countryData?.countryCode?.toLowerCase();
72441
72511
  const cleanedPhone = phone.replace(/[^0-9+]/g, '');
72442
- setPhone(cleanedPhone);
72443
- onChange(cleanedPhone);
72444
- const isPhoneValid = isValidPhoneNumber(cleanedPhone);
72445
- setIsValid(isPhoneValid);
72512
+ if (selectedCountry?.toLowerCase() !== newCountryCode) {
72513
+ setPhone(countryData?.dialCode);
72514
+ onChange(countryData?.dialCode);
72515
+ setSelectedCountry(newCountryCode);
72516
+ setIsValid(true);
72517
+ return;
72518
+ }
72519
+ let formattedPhone = cleanedPhone;
72520
+ if (!formattedPhone.startsWith('+')) {
72521
+ formattedPhone = `+${formattedPhone}`;
72522
+ }
72523
+ setPhone(formattedPhone);
72524
+ onChange(formattedPhone);
72525
+ const isPhoneValid = isValidPhoneNumber(formattedPhone);
72526
+ const isOnlyCountryCode = phone && phone.replace(/[^\d]/g, '').length <= 3;
72527
+ setIsValid(isPhoneValid || isOnlyCountryCode);
72446
72528
  };
72447
72529
  const handleFocus = event => {
72448
72530
  setIsFocused(true);
@@ -72451,8 +72533,9 @@ const PhoneInputField = ({
72451
72533
  const handleBlur = event => {
72452
72534
  setIsFocused(false);
72453
72535
  if (onBlur) onBlur(event);
72536
+ const isOnlyCountryCode = phone && phone.replace(/[^\d]/g, '').length <= 3;
72454
72537
  const isPhoneValid = isValidPhoneNumber(phone);
72455
- setIsValid(isPhoneValid);
72538
+ setIsValid(isPhoneValid || isOnlyCountryCode);
72456
72539
  };
72457
72540
  return jsxRuntime.jsxs("div", {
72458
72541
  id: id,
@@ -110260,6 +110343,7 @@ exports.truncateText = truncateText;
110260
110343
  exports.updateTreeState = updateTreeState;
110261
110344
  exports.useBeforeUnload = useBeforeUnload;
110262
110345
  exports.useClickOutside = useClickOutside;
110346
+ exports.useConditionalLock = useConditionalLock;
110263
110347
  exports.useFileDropzone = useFileDropzone;
110264
110348
  exports.useKeyboardActions = useKeyboardActions;
110265
110349
  exports.useTheme = useTheme;