@scaleflex/ui-tw 0.0.68 → 0.0.71

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.
@@ -1,4 +1,4 @@
1
1
  import type { ColorPickerProps } from '@scaleflex/ui-tw/color-picker/color-picker.types';
2
2
  import React from 'react';
3
- declare function ColorPicker({ value, placeholder, onChange, onCancel, onSelect, className, children, presetColors, displayAsInput, }: ColorPickerProps): React.JSX.Element;
3
+ declare function ColorPicker({ title, value, placeholder, onChange, onCancel, onSelect, inputTriggerProps, className, inputClassName, cancelLabel, selectLabel, children, presetColors, displayAsInput, }: ColorPickerProps): React.JSX.Element;
4
4
  export { ColorPicker };
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
4
  import { Button } from '@scaleflex/ui-tw/button';
@@ -10,12 +11,17 @@ import { PaletteIcon } from 'lucide-react';
10
11
  import React, { useState } from 'react';
11
12
  import { HexColorInput, HexColorPicker } from 'react-colorful';
12
13
  function ColorPicker(_ref) {
13
- var value = _ref.value,
14
+ var title = _ref.title,
15
+ value = _ref.value,
14
16
  placeholder = _ref.placeholder,
15
17
  _onChange = _ref.onChange,
16
18
  onCancel = _ref.onCancel,
17
19
  onSelect = _ref.onSelect,
20
+ inputTriggerProps = _ref.inputTriggerProps,
18
21
  className = _ref.className,
22
+ inputClassName = _ref.inputClassName,
23
+ cancelLabel = _ref.cancelLabel,
24
+ selectLabel = _ref.selectLabel,
19
25
  children = _ref.children,
20
26
  presetColors = _ref.presetColors,
21
27
  _ref$displayAsInput = _ref.displayAsInput,
@@ -46,15 +52,15 @@ function ColorPicker(_ref) {
46
52
  "aria-label": "Open color picker"
47
53
  })), /*#__PURE__*/React.createElement("span", {
48
54
  className: "text-muted-foreground absolute left-11 h-10 leading-10"
49
- }, "#"), /*#__PURE__*/React.createElement(HexColorInput, {
55
+ }, "#"), /*#__PURE__*/React.createElement(HexColorInput, _extends({}, inputTriggerProps, {
50
56
  color: value,
51
57
  onChange: function onChange(color) {
52
58
  setTempValue(color);
53
59
  onSelect === null || onSelect === void 0 || onSelect(color);
54
60
  },
55
61
  placeholder: placeholder || 'Enter hex color',
56
- className: cn.apply(void 0, ['w-full bg-transparent font-mono outline-none', 'flex items-center gap-2'].concat(_toConsumableArray(getBaseInputClasses()), [readOnlyClassNames, selectionHighlightClassNames, inputVariants(), 'pl-14', className]))
57
- })) : /*#__PURE__*/React.createElement(DialogTrigger, {
62
+ className: cn.apply(void 0, ['w-full bg-transparent font-mono outline-none', 'flex items-center gap-2'].concat(_toConsumableArray(getBaseInputClasses()), [readOnlyClassNames, selectionHighlightClassNames, inputVariants(), 'pl-14', inputClassName]))
63
+ }))) : /*#__PURE__*/React.createElement(DialogTrigger, {
58
64
  asChild: true
59
65
  }, /*#__PURE__*/React.createElement("button", {
60
66
  type: "button",
@@ -65,7 +71,7 @@ function ColorPicker(_ref) {
65
71
  "aria-label": "Open color picker"
66
72
  })), /*#__PURE__*/React.createElement(DialogFormContent, {
67
73
  className: cn('w-[316px]', className)
68
- }, /*#__PURE__*/React.createElement(DialogFormHeader, null, /*#__PURE__*/React.createElement(DialogFormIcon, null, /*#__PURE__*/React.createElement(PaletteIcon, null)), /*#__PURE__*/React.createElement(DialogFormTitle, null, "Pick color")), /*#__PURE__*/React.createElement(DialogFormBody, {
74
+ }, /*#__PURE__*/React.createElement(DialogFormHeader, null, /*#__PURE__*/React.createElement(DialogFormIcon, null, /*#__PURE__*/React.createElement(PaletteIcon, null)), /*#__PURE__*/React.createElement(DialogFormTitle, null, title || 'Pick color')), /*#__PURE__*/React.createElement(DialogFormBody, {
69
75
  className: "space-y-4"
70
76
  }, /*#__PURE__*/React.createElement(HexColorPicker, {
71
77
  color: tempValue,
@@ -95,11 +101,11 @@ function ColorPicker(_ref) {
95
101
  variant: "outline",
96
102
  className: "flex-1",
97
103
  onClick: handleCancel
98
- }, "Cancel")), /*#__PURE__*/React.createElement(DialogTrigger, {
104
+ }, cancelLabel || 'Cancel')), /*#__PURE__*/React.createElement(DialogTrigger, {
99
105
  asChild: true
100
106
  }, /*#__PURE__*/React.createElement(Button, {
101
107
  className: "flex-1",
102
108
  onClick: handleSelect
103
- }, "Select")))));
109
+ }, selectLabel || 'Select')))));
104
110
  }
105
111
  export { ColorPicker };
@@ -1,10 +1,15 @@
1
- import type { ReactElement, ReactNode } from 'react';
1
+ import type { InputHTMLAttributes, ReactElement, ReactNode } from 'react';
2
2
  export type ColorPickerProps = {
3
3
  value: string;
4
4
  onSelect: (value: string) => void;
5
5
  onChange?: (value: string) => void;
6
6
  onCancel?: () => void;
7
+ inputTriggerProps?: InputHTMLAttributes<HTMLInputElement>;
7
8
  className?: string;
9
+ title?: string | ReactElement;
10
+ cancelLabel?: string | ReactElement;
11
+ selectLabel?: string | ReactElement;
12
+ inputClassName?: string;
8
13
  children?: ReactNode;
9
14
  placeholder?: ReactElement | string;
10
15
  presetColors?: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleflex/ui-tw",
3
- "version": "0.0.68",
3
+ "version": "0.0.71",
4
4
  "author": "scaleflex",
5
5
  "repository": "github:scaleflex/ui",
6
6
  "homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
@@ -23,7 +23,7 @@
23
23
  "@radix-ui/react-slot": "^1.1.2",
24
24
  "@radix-ui/react-switch": "^1.0.1",
25
25
  "@radix-ui/react-tooltip": "^1.2.6",
26
- "@scaleflex/icons-tw": "^0.0.68",
26
+ "@scaleflex/icons-tw": "^0.0.71",
27
27
  "@tanstack/react-table": "^8.21.3",
28
28
  "@types/lodash.merge": "^4.6.9",
29
29
  "class-variance-authority": "^0.7.1",