trotl-filter 1.0.44 → 1.0.45
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/dist/index.cjs.js +159 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +159 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -8651,6 +8651,164 @@ MultiSelect.propTypes = {
|
|
|
8651
8651
|
className: PropTypes.string
|
|
8652
8652
|
};
|
|
8653
8653
|
|
|
8654
|
+
// Simple, dependency-free ColorPicker
|
|
8655
|
+
// Props: value (hex), onChange(hex), disabled, label, presetColors, allowCustom, size
|
|
8656
|
+
function ColorPicker({
|
|
8657
|
+
value = '#1677ff',
|
|
8658
|
+
onChange,
|
|
8659
|
+
disabled = false,
|
|
8660
|
+
label = null,
|
|
8661
|
+
presetColors = ['#1677ff', '#ff4d4f', '#52c41a', '#faad14', '#722ed1', '#13c2c2', '#f5222d'],
|
|
8662
|
+
allowCustom = true,
|
|
8663
|
+
showHexInput = true,
|
|
8664
|
+
size = 'medium',
|
|
8665
|
+
// small | medium | large
|
|
8666
|
+
className = '',
|
|
8667
|
+
style = {}
|
|
8668
|
+
}) {
|
|
8669
|
+
const [open, setOpen] = React.useState(false);
|
|
8670
|
+
const [internal, setInternal] = React.useState(value || '');
|
|
8671
|
+
const ref = React.useRef(null);
|
|
8672
|
+
React.useEffect(() => setInternal(value || ''), [value]);
|
|
8673
|
+
React.useEffect(() => {
|
|
8674
|
+
const onDoc = e => {
|
|
8675
|
+
if (!ref.current) return;
|
|
8676
|
+
if (!ref.current.contains(e.target)) setOpen(false);
|
|
8677
|
+
};
|
|
8678
|
+
window.addEventListener('mousedown', onDoc);
|
|
8679
|
+
return () => window.removeEventListener('mousedown', onDoc);
|
|
8680
|
+
}, []);
|
|
8681
|
+
const apply = hex => {
|
|
8682
|
+
setInternal(hex);
|
|
8683
|
+
onChange?.(hex);
|
|
8684
|
+
};
|
|
8685
|
+
const btnSize = size === 'small' ? 20 : size === 'large' ? 36 : 28;
|
|
8686
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
8687
|
+
ref: ref,
|
|
8688
|
+
className: `color-picker ${className}`,
|
|
8689
|
+
style: {
|
|
8690
|
+
display: 'inline-block',
|
|
8691
|
+
...style
|
|
8692
|
+
}
|
|
8693
|
+
}, label && /*#__PURE__*/React.createElement("div", {
|
|
8694
|
+
style: {
|
|
8695
|
+
marginBottom: 6,
|
|
8696
|
+
fontSize: 13
|
|
8697
|
+
}
|
|
8698
|
+
}, label), /*#__PURE__*/React.createElement("button", {
|
|
8699
|
+
type: "button",
|
|
8700
|
+
onClick: () => !disabled && setOpen(s => !s),
|
|
8701
|
+
disabled: disabled,
|
|
8702
|
+
"aria-label": label || 'Choose color',
|
|
8703
|
+
style: {
|
|
8704
|
+
display: 'inline-flex',
|
|
8705
|
+
alignItems: 'center',
|
|
8706
|
+
gap: 8,
|
|
8707
|
+
padding: '6px 8px',
|
|
8708
|
+
borderRadius: 6,
|
|
8709
|
+
border: '1px solid #d9d9d9',
|
|
8710
|
+
background: '#fff',
|
|
8711
|
+
cursor: disabled ? 'not-allowed' : 'pointer'
|
|
8712
|
+
}
|
|
8713
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
8714
|
+
style: {
|
|
8715
|
+
width: btnSize,
|
|
8716
|
+
height: btnSize,
|
|
8717
|
+
borderRadius: 4,
|
|
8718
|
+
background: internal || '#fff',
|
|
8719
|
+
border: '1px solid #ccc'
|
|
8720
|
+
}
|
|
8721
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
8722
|
+
style: {
|
|
8723
|
+
fontSize: 13,
|
|
8724
|
+
color: disabled ? '#9ca3af' : '#000'
|
|
8725
|
+
}
|
|
8726
|
+
}, internal || '—')), open && /*#__PURE__*/React.createElement("div", {
|
|
8727
|
+
style: {
|
|
8728
|
+
position: 'absolute',
|
|
8729
|
+
zIndex: 60,
|
|
8730
|
+
marginTop: 8,
|
|
8731
|
+
background: '#fff',
|
|
8732
|
+
border: '1px solid #e8e8e8',
|
|
8733
|
+
boxShadow: '0 6px 18px rgba(0,0,0,0.08)',
|
|
8734
|
+
borderRadius: 6,
|
|
8735
|
+
padding: 12,
|
|
8736
|
+
minWidth: 220
|
|
8737
|
+
}
|
|
8738
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
8739
|
+
style: {
|
|
8740
|
+
display: 'flex',
|
|
8741
|
+
gap: 8,
|
|
8742
|
+
flexWrap: 'wrap'
|
|
8743
|
+
}
|
|
8744
|
+
}, presetColors.map(c => /*#__PURE__*/React.createElement("button", {
|
|
8745
|
+
key: c,
|
|
8746
|
+
onClick: () => apply(c),
|
|
8747
|
+
"aria-label": c,
|
|
8748
|
+
style: {
|
|
8749
|
+
width: 28,
|
|
8750
|
+
height: 28,
|
|
8751
|
+
borderRadius: 4,
|
|
8752
|
+
background: c,
|
|
8753
|
+
border: c.toLowerCase() === (internal || '').toLowerCase() ? '2px solid #00000033' : '1px solid #eee',
|
|
8754
|
+
cursor: 'pointer'
|
|
8755
|
+
}
|
|
8756
|
+
})), allowCustom && /*#__PURE__*/React.createElement("input", {
|
|
8757
|
+
type: "color",
|
|
8758
|
+
value: internal || '#000000',
|
|
8759
|
+
onChange: e => apply(e.target.value),
|
|
8760
|
+
style: {
|
|
8761
|
+
width: 36,
|
|
8762
|
+
height: 36,
|
|
8763
|
+
padding: 0,
|
|
8764
|
+
border: 'none',
|
|
8765
|
+
background: 'transparent',
|
|
8766
|
+
cursor: 'pointer'
|
|
8767
|
+
},
|
|
8768
|
+
title: "Custom color"
|
|
8769
|
+
})), showHexInput && /*#__PURE__*/React.createElement("div", {
|
|
8770
|
+
style: {
|
|
8771
|
+
marginTop: 8,
|
|
8772
|
+
display: 'flex',
|
|
8773
|
+
gap: 8,
|
|
8774
|
+
alignItems: 'center'
|
|
8775
|
+
}
|
|
8776
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
8777
|
+
value: internal || '',
|
|
8778
|
+
onChange: e => setInternal(e.target.value),
|
|
8779
|
+
onBlur: e => {
|
|
8780
|
+
const v = e.target.value.trim();
|
|
8781
|
+
if (/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(v)) apply(v);else setInternal(value || '');
|
|
8782
|
+
},
|
|
8783
|
+
placeholder: "#rrggbb",
|
|
8784
|
+
disabled: disabled,
|
|
8785
|
+
style: {
|
|
8786
|
+
padding: '6px 8px',
|
|
8787
|
+
borderRadius: 4,
|
|
8788
|
+
border: '1px solid #e5e7eb',
|
|
8789
|
+
width: 120
|
|
8790
|
+
}
|
|
8791
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
8792
|
+
onClick: () => {
|
|
8793
|
+
if (/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(internal)) apply(internal);
|
|
8794
|
+
},
|
|
8795
|
+
disabled: disabled,
|
|
8796
|
+
className: "basic-btn"
|
|
8797
|
+
}, "Apply"))));
|
|
8798
|
+
}
|
|
8799
|
+
ColorPicker.propTypes = {
|
|
8800
|
+
value: PropTypes.string,
|
|
8801
|
+
onChange: PropTypes.func,
|
|
8802
|
+
disabled: PropTypes.bool,
|
|
8803
|
+
label: PropTypes.string,
|
|
8804
|
+
presetColors: PropTypes.array,
|
|
8805
|
+
allowCustom: PropTypes.bool,
|
|
8806
|
+
showHexInput: PropTypes.bool,
|
|
8807
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
8808
|
+
className: PropTypes.string,
|
|
8809
|
+
style: PropTypes.object
|
|
8810
|
+
};
|
|
8811
|
+
|
|
8654
8812
|
// import "src/style/DebounceSelect.css";
|
|
8655
8813
|
|
|
8656
8814
|
const DebounceSelect = ({
|
|
@@ -11444,6 +11602,7 @@ Upload.propTypes = {
|
|
|
11444
11602
|
|
|
11445
11603
|
exports.Button = Button;
|
|
11446
11604
|
exports.CalendarRangePicker = CalendarRangePicker;
|
|
11605
|
+
exports.ColorPicker = ColorPicker;
|
|
11447
11606
|
exports.DateTimeInput = DateTimeInput;
|
|
11448
11607
|
exports.DebounceSelect = DebounceSelect;
|
|
11449
11608
|
exports.IconInput = IconInput;
|