@scaleflex/ui-tw 0.0.94 → 0.0.96

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.
@@ -13,10 +13,10 @@ export declare const buttonSizeOptions: {
13
13
  readonly sm: "h-8 px-3 py-2 text-sm";
14
14
  readonly md: "h-10 px-4 py-2.5 text-base";
15
15
  readonly lg: "h-12 px-6 py-3.5 text-lg";
16
- readonly "icon-xs": "size-6 p-1.5 [&_svg:not([class*='size-'])]:size-3";
17
- readonly "icon-sm": "size-8 p-2 [&_svg:not([class*='size-'])]:size-3.5";
18
- readonly "icon-md": "size-10 p-2.5 [&_svg:not([class*='size-'])]:size-4";
19
- readonly "icon-lg": "size-12 p-3.5 [&_svg:not([class*='size-'])]:size-4.5";
16
+ readonly "icon-xs": "size-6 p-1.5 [&_svg:not([class*='size-'])]:size-4";
17
+ readonly "icon-sm": "size-8 p-2 [&_svg:not([class*='size-'])]:size-4.5";
18
+ readonly "icon-md": "size-10 p-2.5 [&_svg:not([class*='size-'])]:size-5";
19
+ readonly "icon-lg": "size-12 p-3.5 [&_svg:not([class*='size-'])]:size-5.5";
20
20
  };
21
21
  export declare const buttonEndIconSizes: {
22
22
  readonly xs: "ml-1.5 size-3";
@@ -9,7 +9,7 @@ export var ButtonSize = {
9
9
  IconMd: 'icon-md',
10
10
  IconLg: 'icon-lg'
11
11
  };
12
- export var buttonSizeOptions = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'h-6 px-2.5 py-1.5 text-xs'), ButtonSize.Sm, 'h-8 px-3 py-2 text-sm'), ButtonSize.Md, 'h-10 px-4 py-2.5 text-base'), ButtonSize.Lg, 'h-12 px-6 py-3.5 text-lg'), ButtonSize.IconXs, "size-6 p-1.5 [&_svg:not([class*='size-'])]:size-3"), ButtonSize.IconSm, "size-8 p-2 [&_svg:not([class*='size-'])]:size-3.5"), ButtonSize.IconMd, "size-10 p-2.5 [&_svg:not([class*='size-'])]:size-4"), ButtonSize.IconLg, "size-12 p-3.5 [&_svg:not([class*='size-'])]:size-4.5");
12
+ export var buttonSizeOptions = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'h-6 px-2.5 py-1.5 text-xs'), ButtonSize.Sm, 'h-8 px-3 py-2 text-sm'), ButtonSize.Md, 'h-10 px-4 py-2.5 text-base'), ButtonSize.Lg, 'h-12 px-6 py-3.5 text-lg'), ButtonSize.IconXs, "size-6 p-1.5 [&_svg:not([class*='size-'])]:size-4"), ButtonSize.IconSm, "size-8 p-2 [&_svg:not([class*='size-'])]:size-4.5"), ButtonSize.IconMd, "size-10 p-2.5 [&_svg:not([class*='size-'])]:size-5"), ButtonSize.IconLg, "size-12 p-3.5 [&_svg:not([class*='size-'])]:size-5.5");
13
13
  export var buttonEndIconSizes = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'ml-1.5 size-3'), ButtonSize.Sm, 'ml-1.5 size-3.5'), ButtonSize.Md, 'ml-2 size-4'), ButtonSize.Lg, 'ml-2 size-4.5'), ButtonSize.IconXs, 'ml-1.5 size-3'), ButtonSize.IconSm, 'ml-1.5 size-3.5'), ButtonSize.IconMd, 'ml-2 size-4'), ButtonSize.IconLg, 'ml-2 size-4.5');
14
14
  export var buttonStartIconSizes = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'mr-1.5 size-3'), ButtonSize.Sm, 'mr-1.5 size-3.5'), ButtonSize.Md, 'mr-2 size-4'), ButtonSize.Lg, 'mr-2 size-4.5'), ButtonSize.IconXs, 'mr-1.5 size-3'), ButtonSize.IconSm, 'mr-1.5 size-3.5'), ButtonSize.IconMd, 'mr-2 size-4'), ButtonSize.IconLg, 'mr-2 size-4.5');
15
15
  export var ButtonVariant = {
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
4
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
5
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
@@ -11,6 +12,7 @@ var _excluded = ["className", "classNames", "showOutsideDays", "captionLayout",
11
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
14
  import { Button, buttonVariants } from '@scaleflex/ui-tw/button';
15
+ import { buttonBaseClassNames } from '@scaleflex/ui-tw/button/button.constants';
14
16
  import { cn } from '@scaleflex/ui-tw/utils/cn';
15
17
  import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
16
18
  import React from 'react';
@@ -50,12 +52,12 @@ function Calendar(_ref) {
50
52
  months: cn('flex gap-4 flex-col md:flex-row relative', defaultClassNames.months),
51
53
  month: cn('flex flex-col w-full gap-4', defaultClassNames.month),
52
54
  nav: cn('flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between', defaultClassNames.nav),
53
- button_previous: cn(buttonVariants({
55
+ button_previous: cn.apply(void 0, [buttonVariants({
54
56
  variant: buttonVariant
55
- }), 'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none', defaultClassNames.button_previous),
56
- button_next: cn(buttonVariants({
57
+ }), 'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none', defaultClassNames.button_previous].concat(_toConsumableArray(buttonBaseClassNames))),
58
+ button_next: cn.apply(void 0, [buttonVariants({
57
59
  variant: buttonVariant
58
- }), 'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none', defaultClassNames.button_next),
60
+ }), 'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none', defaultClassNames.button_next].concat(_toConsumableArray(buttonBaseClassNames))),
59
61
  month_caption: cn('flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)', defaultClassNames.month_caption),
60
62
  dropdowns: cn('w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5', defaultClassNames.dropdowns),
61
63
  dropdown_root: cn('relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md', defaultClassNames.dropdown_root),
@@ -36,7 +36,7 @@ function ColorPalette(_ref) {
36
36
  key: color,
37
37
  value: color,
38
38
  "data-slot": "color-palette-item",
39
- className: cn('border-border inline-block rounded-lg border-1 p-0.5 hover:opacity-80', focusRingClassNames, colorBoxVariants({
39
+ className: cn('border-border hover:border-secondary-foreground/50 inline-block rounded-lg border-1 p-0.5 hover:opacity-80', focusRingClassNames, colorBoxVariants({
40
40
  size: size
41
41
  }), colorBoxClassName, value === color && 'border-primary'),
42
42
  "aria-label": "Color ".concat(color)
@@ -153,8 +153,13 @@ export function ComboboxUsers(_ref) {
153
153
  })) : /*#__PURE__*/React.createElement(ChevronsUpDownIcon, {
154
154
  className: cn('text-muted-foreground/70 my-auto ml-auto shrink-0', iconSizeInTriggerOptions[size])
155
155
  }))), /*#__PURE__*/React.createElement(PopoverContent, _extends({
156
- className: cn('p-0', popoverClassName)
157
- }, popoverContentProps), /*#__PURE__*/React.createElement(Command, null, /*#__PURE__*/React.createElement(CommandInput, {
156
+ className: cn('w-[var(--radix-popover-trigger-width)] max-w-[var(--radix-popover-trigger-width)] min-w-0 p-0', popoverClassName),
157
+ align: "start"
158
+ }, popoverContentProps), /*#__PURE__*/React.createElement(Command, {
159
+ filter: function filter(value, search) {
160
+ return value.includes(search.trim().toLowerCase()) ? 1 : 0;
161
+ }
162
+ }, /*#__PURE__*/React.createElement(CommandInput, {
158
163
  size: size,
159
164
  placeholder: searchPlaceholder
160
165
  }), /*#__PURE__*/React.createElement(CommandList, null, /*#__PURE__*/React.createElement(CommandEmpty, null, "No results found."), options === null || options === void 0 ? void 0 : options.map(function (option, groupIndex) {
@@ -246,17 +246,18 @@ function CommandUserItem(_ref10) {
246
246
  }, /*#__PURE__*/React.createElement("div", {
247
247
  className: "shrink-0"
248
248
  }, profileUrl ? /*#__PURE__*/React.createElement("img", {
249
- className: "size-10 rounded-full",
249
+ className: "size-8 rounded-full",
250
250
  src: profileUrl,
251
251
  alt: "profile image"
252
252
  }) : /*#__PURE__*/React.createElement(UserCircle2Icon, {
253
- className: "size-10"
253
+ strokeWidth: "1",
254
+ className: "size-8"
254
255
  })), /*#__PURE__*/React.createElement("div", {
255
256
  className: "max-w-10/12"
256
257
  }, /*#__PURE__*/React.createElement("div", {
257
- className: cn('w-full overflow-hidden text-ellipsis whitespace-nowrap', textClassName)
258
+ className: cn('w-full overflow-hidden text-sm text-ellipsis whitespace-nowrap', textClassName)
258
259
  }, name), /*#__PURE__*/React.createElement("div", {
259
- className: cn('text-secondary-foreground w-full overflow-hidden text-ellipsis whitespace-nowrap', textClassName)
260
+ className: cn('text-secondary-foreground w-full overflow-hidden text-xs text-ellipsis whitespace-nowrap', textClassName)
260
261
  }, email))), /*#__PURE__*/React.createElement("span", {
261
262
  className: "absolute right-2 flex size-3.5 items-center justify-center"
262
263
  }, /*#__PURE__*/React.createElement(CheckIcon, {
@@ -3,5 +3,5 @@ import type { InputProps } from './input.types';
3
3
  declare const inputVariants: (props?: ({
4
4
  size?: "sm" | "md" | "lg" | null | undefined;
5
5
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
6
- declare function Input({ className, type, size, disabled, readOnly, ...props }: InputProps): React.JSX.Element;
6
+ declare function Input({ className, type, size, disabled, readOnly, icon: Icon, ...props }: InputProps): React.JSX.Element;
7
7
  export { Input, inputVariants };
@@ -1,13 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["className", "type", "size", "disabled", "readOnly"];
4
+ var _excluded = ["className", "type", "size", "disabled", "readOnly", "icon"];
5
5
  import { getBaseInputClasses, readOnlyClassNames, selectionHighlightClassNames } from '@scaleflex/ui-tw/styles/shared-classes';
6
6
  import { FormSize } from '@scaleflex/ui-tw/types/form-size';
7
7
  import { cn } from '@scaleflex/ui-tw/utils/cn';
8
8
  import { cva } from 'class-variance-authority';
9
9
  import React from 'react';
10
- import { InputType, inputSizeOptions } from './input.constants';
10
+ import { InputType, inputIconSizeOptions, inputSizeOptions, inputWithIconSizeOptions } from './input.constants';
11
11
  var inputVariants = cva('', {
12
12
  variants: {
13
13
  size: inputSizeOptions
@@ -16,6 +16,22 @@ var inputVariants = cva('', {
16
16
  size: FormSize.Md
17
17
  }
18
18
  });
19
+ var inputIconSizeVariants = cva('', {
20
+ variants: {
21
+ size: inputIconSizeOptions
22
+ },
23
+ defaultVariants: {
24
+ size: FormSize.Md
25
+ }
26
+ });
27
+ var inputWithIconVariants = cva('', {
28
+ variants: {
29
+ size: inputWithIconSizeOptions
30
+ },
31
+ defaultVariants: {
32
+ size: FormSize.Md
33
+ }
34
+ });
19
35
  function Input(_ref) {
20
36
  var className = _ref.className,
21
37
  _ref$type = _ref.type,
@@ -26,8 +42,9 @@ function Input(_ref) {
26
42
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
27
43
  _ref$readOnly = _ref.readOnly,
28
44
  readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
45
+ Icon = _ref.icon,
29
46
  props = _objectWithoutProperties(_ref, _excluded);
30
- return /*#__PURE__*/React.createElement("input", _extends({
47
+ var inputElement = /*#__PURE__*/React.createElement("input", _extends({
31
48
  type: type,
32
49
  "data-slot": "input",
33
50
  disabled: disabled,
@@ -35,7 +52,19 @@ function Input(_ref) {
35
52
  className: cn.apply(void 0, ['flex w-full min-w-0'].concat(_toConsumableArray(getBaseInputClasses()), [readOnlyClassNames, selectionHighlightClassNames, inputVariants({
36
53
  size: size,
37
54
  className: className
55
+ }), Icon && inputWithIconVariants({
56
+ size: size
38
57
  })]))
39
58
  }, props));
59
+ if (!Icon) {
60
+ return inputElement;
61
+ }
62
+ return /*#__PURE__*/React.createElement("div", {
63
+ className: cn('relative', className)
64
+ }, inputElement, /*#__PURE__*/React.createElement(Icon, {
65
+ className: cn(inputIconSizeVariants({
66
+ size: size
67
+ }), 'text-muted-foreground absolute top-1/2 -translate-y-1/2 transform', disabled && 'opacity-50')
68
+ }));
40
69
  }
41
70
  export { Input, inputVariants };
@@ -13,3 +13,13 @@ export declare const InputType: {
13
13
  readonly Email: "email";
14
14
  readonly Number: "number";
15
15
  };
16
+ export declare const inputIconSizeOptions: {
17
+ sm: string;
18
+ md: string;
19
+ lg: string;
20
+ };
21
+ export declare const inputWithIconSizeOptions: {
22
+ sm: string;
23
+ md: string;
24
+ lg: string;
25
+ };
@@ -6,4 +6,6 @@ export var InputType = {
6
6
  Text: 'text',
7
7
  Email: 'email',
8
8
  Number: 'number'
9
- };
9
+ };
10
+ export var inputIconSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'right-2 size-3'), FormSize.Md, 'right-3 size-4'), FormSize.Lg, 'right-4 size-5');
11
+ export var inputWithIconSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'pr-6'), FormSize.Md, 'pr-8'), FormSize.Lg, 'pr-10');
@@ -1,6 +1,8 @@
1
1
  import { FormSizeType } from '@scaleflex/ui-tw/types/form-size';
2
+ import type { LucideIcon } from 'lucide-react';
2
3
  import type { ComponentProps } from 'react';
3
4
  export interface InputProps extends Omit<ComponentProps<'input'>, 'size'> {
4
5
  size?: FormSizeType;
5
6
  'aria-invalid'?: boolean;
7
+ icon?: LucideIcon;
6
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleflex/ui-tw",
3
- "version": "0.0.94",
3
+ "version": "0.0.96",
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.94",
26
+ "@scaleflex/icons-tw": "^0.0.96",
27
27
  "@tanstack/react-table": "^8.21.3",
28
28
  "@types/lodash.merge": "^4.6.9",
29
29
  "class-variance-authority": "^0.7.1",