pixel-react 1.15.2 → 1.15.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.
@@ -148,6 +148,29 @@ export interface VariableSuggestionInputDropDownProps {
148
148
  */
149
149
  inputTitle?: string;
150
150
  helperTextWidth?: number | string;
151
+ iconProps?: {
152
+ /**
153
+ * Flag to determine if icon should be shown
154
+ */
155
+ isShowIcon?: boolean;
156
+ /**
157
+ * Function triggered when icon is clicked
158
+ */
159
+ onIconClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
160
+ /**
161
+ * Name of the icon to display
162
+ */
163
+ iconName?: string;
164
+ /**
165
+ * Tooltip title shown when hovering over icon
166
+ */
167
+ iconToolTipTitle?: string;
168
+ /**
169
+ * Flag to disable the icon
170
+ */
171
+ isIconDisable?: boolean;
172
+ iconColor?: string;
173
+ };
151
174
  }
152
175
  export interface OptionsDropdownProps {
153
176
  /**
package/lib/index.cjs CHANGED
@@ -3434,7 +3434,7 @@ const Checkbox = ({
3434
3434
  color: "var(--primary-icon-color)",
3435
3435
  className: "ff-tick-icon"
3436
3436
  })
3437
- }), jsxRuntime.jsx(Typography, {
3437
+ }), label && jsxRuntime.jsx(Typography, {
3438
3438
  as: "span",
3439
3439
  fontSize: labelFontSize,
3440
3440
  children: label
@@ -4757,7 +4757,7 @@ const Input$1 = /*#__PURE__*/React.forwardRef(({
4757
4757
  },
4758
4758
  ...props
4759
4759
  }, ref) => {
4760
- const isValueFilled = !checkEmpty(value) || type === 'password' && value?.length > 0;
4760
+ const isValueFilled = !checkEmpty(value) || type === 'password' && value?.length > 0 || value !== '';
4761
4761
  const isTypeNumber = type === 'number';
4762
4762
  const numericMin = minValue !== undefined ? parseInt(minValue, 10) || 0 : 0;
4763
4763
  const numericMax = maxValue !== undefined ? parseInt(maxValue, 10) || Infinity : Infinity;
@@ -8122,7 +8122,7 @@ const MenuOption = ({
8122
8122
  options = [],
8123
8123
  onClick = () => {},
8124
8124
  onOptionClick = () => {},
8125
- iconButtonSize = 20,
8125
+ iconButtonSize = 24,
8126
8126
  iconButtonBorderRadius = 7,
8127
8127
  iconSize = 16,
8128
8128
  variant = 'light',
@@ -13290,7 +13290,7 @@ const Table$1 = ({
13290
13290
  left: isFrozen ? getColumnLeftPosition(index, columns, freezeColumns) : 'auto',
13291
13291
  zIndex: isFrozen ? 999 : 'auto',
13292
13292
  width: column.width ? `${column.width}px` : 'auto',
13293
- padding: '7px 8px',
13293
+ padding: '8px 8px',
13294
13294
  boxSizing: 'border-box',
13295
13295
  // Remove right padding from frozen columns to prevent overlap
13296
13296
  paddingRight: isFrozen ? 0 : '8px'
@@ -50288,6 +50288,14 @@ const VariableSuggestionInputDropDown = /*#__PURE__*/React.forwardRef(({
50288
50288
  inputTitle = '',
50289
50289
  onBlur,
50290
50290
  helperTextWidth,
50291
+ iconProps = {
50292
+ isShowIcon: false,
50293
+ iconName: '',
50294
+ iconToolTipTitle: '',
50295
+ isIconDisable: false,
50296
+ iconColor: '',
50297
+ onIconClick: () => {}
50298
+ },
50291
50299
  ...props
50292
50300
  }, ref) => {
50293
50301
  const [showDropdown, setShowDropdown] = React.useState(false);
@@ -50300,6 +50308,7 @@ const VariableSuggestionInputDropDown = /*#__PURE__*/React.forwardRef(({
50300
50308
  const inputRef = React.useRef(null);
50301
50309
  const containerRef = React.useRef(null);
50302
50310
  const [dropdownWidthPx, setDropdownWidthPx] = React.useState('auto');
50311
+ const showIcon = iconProps?.isShowIcon;
50303
50312
  React.useEffect(() => {
50304
50313
  const inputContainer = containerRef.current?.querySelector('.ff-input-container');
50305
50314
  if (!inputContainer) return;
@@ -50461,7 +50470,9 @@ const VariableSuggestionInputDropDown = /*#__PURE__*/React.forwardRef(({
50461
50470
  name: "add_variable",
50462
50471
  ref: inputRef,
50463
50472
  type: type,
50464
- className: "ff-variable-input-container",
50473
+ className: classNames('ff-variable-input-container', {
50474
+ 'ff-variable-input-container--show-icon': showIcon
50475
+ }),
50465
50476
  value: value,
50466
50477
  onChange: onChange,
50467
50478
  onPaste: () => {
@@ -50494,7 +50505,9 @@ const VariableSuggestionInputDropDown = /*#__PURE__*/React.forwardRef(({
50494
50505
  })
50495
50506
  })]
50496
50507
  }), !checkEmpty(value) && !isOnlyHash && jsxRuntime.jsx("div", {
50497
- className: "ff-cancel-icon-container",
50508
+ className: classNames('ff-cancel-icon-container', {
50509
+ 'ff-cancel-icon-container--show-icon': showIcon
50510
+ }),
50498
50511
  children: clearIcon && jsxRuntime.jsx(Tooltip, {
50499
50512
  title: "Cancel",
50500
50513
  style: {
@@ -50508,6 +50521,25 @@ const VariableSuggestionInputDropDown = /*#__PURE__*/React.forwardRef(({
50508
50521
  hoverEffect: true
50509
50522
  })
50510
50523
  })
50524
+ }), showIcon && jsxRuntime.jsx("div", {
50525
+ className: "ff-info-icon-container",
50526
+ children: jsxRuntime.jsx(Tooltip, {
50527
+ title: showIcon && !iconProps?.isIconDisable ? iconProps?.iconToolTipTitle : '',
50528
+ children: jsxRuntime.jsx(Icon, {
50529
+ name: iconProps?.iconName || '',
50530
+ hoverEffect: false,
50531
+ height: 16,
50532
+ width: 16,
50533
+ color: iconProps?.iconColor || 'var(--text-area-default-color)',
50534
+ onClick: e => {
50535
+ if (iconProps?.onIconClick) {
50536
+ iconProps?.onIconClick(e);
50537
+ }
50538
+ },
50539
+ disabled: iconProps?.isIconDisable,
50540
+ cursorType: "pointer"
50541
+ })
50542
+ })
50511
50543
  })]
50512
50544
  }), result?.showDropdown && isFocused && jsxRuntime.jsx(VariableDropdown, {
50513
50545
  position: "absolute",
@@ -52530,19 +52562,24 @@ const MediaViewerModal = ({
52530
52562
  showControlExpand = false
52531
52563
  }) => {
52532
52564
  const videoRef = React.useRef(null);
52565
+ const sliderRef = React.useRef(null);
52533
52566
  const [currentTime, setCurrentTime] = React.useState(0);
52534
52567
  const [duration, setDuration] = React.useState(0);
52535
52568
  const [isFullscreen] = React.useState(false);
52569
+ const [isDragging, setIsDragging] = React.useState(false);
52570
+ const [progress, setProgress] = React.useState(0);
52536
52571
  React.useEffect(() => {
52537
52572
  if (mediaType === 'video' && videoRef.current && !children) {
52538
52573
  isPlaying ? videoRef.current.play() : videoRef.current.pause();
52539
52574
  }
52540
52575
  }, [isPlaying, mediaType, children]);
52541
52576
  const handleTimeUpdate = React.useCallback(() => {
52542
- if (videoRef.current) {
52577
+ if (videoRef.current && !isDragging) {
52578
+ const current = videoRef.current.currentTime / videoRef.current.duration * 100;
52579
+ setProgress(current || 0);
52543
52580
  setCurrentTime(videoRef.current.currentTime);
52544
52581
  }
52545
- }, []);
52582
+ }, [isDragging]);
52546
52583
  const handleLoadedMetadata = React.useCallback(() => {
52547
52584
  if (videoRef.current) {
52548
52585
  setDuration(videoRef.current.duration);
@@ -52550,27 +52587,61 @@ const MediaViewerModal = ({
52550
52587
  }, []);
52551
52588
  const handleVideoEnd = React.useCallback(() => {
52552
52589
  setCurrentTime(0);
52590
+ setProgress(0);
52553
52591
  onTogglePlay?.();
52554
52592
  }, [onTogglePlay]);
52555
- const formatTime = time => {
52593
+ const formatTime = React.useCallback(time => {
52556
52594
  const minutes = Math.floor(time / 60);
52557
52595
  const seconds = Math.floor(time % 60).toString().padStart(2, '0');
52558
52596
  return `${minutes}:${seconds}`;
52559
- };
52560
- const handleSliderChange = React.useCallback(newTime => {
52597
+ }, []);
52598
+ const handleSeek = React.useCallback(newProgress => {
52561
52599
  if (videoRef.current) {
52562
- videoRef.current.currentTime = newTime;
52563
- setCurrentTime(newTime);
52600
+ const seekTo = newProgress / 100 * videoRef.current.duration;
52601
+ videoRef.current.currentTime = seekTo;
52602
+ setProgress(newProgress);
52603
+ setCurrentTime(seekTo);
52564
52604
  }
52565
52605
  }, []);
52566
52606
  const handleSliderClick = React.useCallback(e => {
52567
- const rect = e.currentTarget.getBoundingClientRect();
52607
+ if (isDragging || !sliderRef.current) return;
52608
+ const rect = sliderRef.current.getBoundingClientRect();
52609
+ const clickX = e.clientX - rect.left;
52610
+ const width = rect.width;
52611
+ const newProgress = Math.max(0, Math.min(100, clickX / width * 100));
52612
+ handleSeek(newProgress);
52613
+ }, [handleSeek, isDragging]);
52614
+ const handleMouseDown = React.useCallback(e => {
52615
+ if (!sliderRef.current) return;
52616
+ setIsDragging(true);
52617
+ const rect = sliderRef.current.getBoundingClientRect();
52568
52618
  const clickX = e.clientX - rect.left;
52569
52619
  const width = rect.width;
52570
- const newTime = clickX / width * duration;
52571
- handleSliderChange(newTime);
52572
- }, [duration, handleSliderChange]);
52573
- const progressPercentage = duration ? currentTime / duration * 100 : 0;
52620
+ const newProgress = Math.max(0, Math.min(100, clickX / width * 100));
52621
+ handleSeek(newProgress);
52622
+ }, [handleSeek]);
52623
+ const handleMouseMove = React.useCallback(e => {
52624
+ if (!isDragging || !sliderRef.current || !videoRef.current) return;
52625
+ const rect = sliderRef.current.getBoundingClientRect();
52626
+ const moveX = e.clientX - rect.left;
52627
+ const width = rect.width;
52628
+ const newProgress = Math.max(0, Math.min(100, moveX / width * 100));
52629
+ handleSeek(newProgress);
52630
+ }, [isDragging, handleSeek]);
52631
+ const handleMouseUp = React.useCallback(() => {
52632
+ setIsDragging(false);
52633
+ }, []);
52634
+ React.useEffect(() => {
52635
+ if (isDragging) {
52636
+ document.addEventListener('mousemove', handleMouseMove);
52637
+ document.addEventListener('mouseup', handleMouseUp);
52638
+ return () => {
52639
+ document.removeEventListener('mousemove', handleMouseMove);
52640
+ document.removeEventListener('mouseup', handleMouseUp);
52641
+ };
52642
+ }
52643
+ return undefined;
52644
+ }, [isDragging, handleMouseMove, handleMouseUp]);
52574
52645
  if (!isOpen) return null;
52575
52646
  return jsxRuntime.jsx(OverviewModal, {
52576
52647
  isOpen: isOpen,
@@ -52654,23 +52725,16 @@ const MediaViewerModal = ({
52654
52725
  children: [jsxRuntime.jsx("span", {
52655
52726
  className: "ff-current-time",
52656
52727
  children: formatTime(currentTime)
52657
- }), jsxRuntime.jsx("div", {
52658
- className: "ff-custom-slider",
52728
+ }), jsxRuntime.jsx("input", {
52729
+ type: "range",
52730
+ className: "ff-seek-bar",
52731
+ min: 0,
52732
+ max: 100,
52733
+ value: progress,
52734
+ onChange: e => handleSeek(parseFloat(e.target.value)),
52659
52735
  onClick: handleSliderClick,
52660
- children: jsxRuntime.jsxs("div", {
52661
- className: "ff-slider-track",
52662
- children: [jsxRuntime.jsx("div", {
52663
- className: "ff-slider-progress",
52664
- style: {
52665
- width: `${progressPercentage}%`
52666
- }
52667
- }), jsxRuntime.jsx("div", {
52668
- className: "ff-slider-thumb",
52669
- style: {
52670
- left: `${progressPercentage}%`
52671
- }
52672
- })]
52673
- })
52736
+ onMouseDown: handleMouseDown,
52737
+ ref: sliderRef
52674
52738
  }), jsxRuntime.jsx("span", {
52675
52739
  className: "ff-total-time",
52676
52740
  children: formatTime(duration)