@scaleflex/ui-tw 0.0.38 → 0.0.39
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/date-picker/date-picker.component.d.ts +1 -1
- package/date-picker/date-picker.component.js +3 -2
- package/date-picker/date-picker.types.d.ts +1 -0
- package/form/components/form-password-field.component.js +2 -2
- package/input/index.d.ts +0 -1
- package/input/index.js +1 -2
- package/package.json +2 -2
- package/password/index.d.ts +1 -0
- package/password/index.js +1 -0
- package/password/password.component.d.ts +3 -0
- package/{input/components/password-input.component.js → password/password.component.js} +2 -2
- package/search/index.d.ts +1 -0
- package/search/index.js +1 -0
- package/search/search.component.d.ts +3 -0
- package/search/search.component.js +70 -0
- package/search/search.constants.d.ts +24 -0
- package/search/search.constants.js +15 -0
- package/select/components/selector.d.ts +1 -1
- package/select/components/selector.js +9 -5
- package/select/select.types.d.ts +4 -2
- package/input/components/password-input.component.d.ts +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DatePickerProps } from './date-picker.types';
|
|
3
|
-
declare function DatePicker({ minDate, maxDate, readOnly, defaultDate, size, invalidDateText, disabled, onChange, ...rest }: DatePickerProps): React.JSX.Element;
|
|
3
|
+
declare function DatePicker({ minDate, maxDate, readOnly, defaultDate, size, invalidDateText, disabled, onChange, popoverClassName, ...rest }: DatePickerProps): React.JSX.Element;
|
|
4
4
|
export { DatePicker };
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["minDate", "maxDate", "readOnly", "defaultDate", "size", "invalidDateText", "disabled", "onChange"];
|
|
5
|
+
var _excluded = ["minDate", "maxDate", "readOnly", "defaultDate", "size", "invalidDateText", "disabled", "onChange", "popoverClassName"];
|
|
6
6
|
import { Button } from '@scaleflex/ui-tw/button';
|
|
7
7
|
import { Calendar } from '@scaleflex/ui-tw/calendar';
|
|
8
8
|
import { Input } from '@scaleflex/ui-tw/input';
|
|
@@ -27,6 +27,7 @@ function DatePicker(_ref) {
|
|
|
27
27
|
invalidDateText = _ref.invalidDateText,
|
|
28
28
|
disabled = _ref.disabled,
|
|
29
29
|
onChange = _ref.onChange,
|
|
30
|
+
popoverClassName = _ref.popoverClassName,
|
|
30
31
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
32
|
var _useState = useState(false),
|
|
32
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -108,7 +109,7 @@ function DatePicker(_ref) {
|
|
|
108
109
|
}), /*#__PURE__*/React.createElement("span", {
|
|
109
110
|
className: "sr-only"
|
|
110
111
|
}, "Select date"))), /*#__PURE__*/React.createElement(PopoverContent, {
|
|
111
|
-
className:
|
|
112
|
+
className: cn('w-auto overflow-hidden p-0', popoverClassName),
|
|
112
113
|
align: "end",
|
|
113
114
|
alignOffset: -8,
|
|
114
115
|
sideOffset: 10
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["inputProps"];
|
|
4
|
-
import {
|
|
4
|
+
import { Password } from '@scaleflex/ui-tw/password';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { FormFieldGroup } from './form-field-group.component';
|
|
7
7
|
function FormPasswordField(_ref) {
|
|
8
8
|
var inputProps = _ref.inputProps,
|
|
9
9
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
10
10
|
return /*#__PURE__*/React.createElement(FormFieldGroup, rest, function (field, args) {
|
|
11
|
-
return /*#__PURE__*/React.createElement(
|
|
11
|
+
return /*#__PURE__*/React.createElement(Password, _extends({
|
|
12
12
|
placeholder: inputProps === null || inputProps === void 0 ? void 0 : inputProps.placeholder
|
|
13
13
|
}, args, inputProps, field));
|
|
14
14
|
});
|
package/input/index.d.ts
CHANGED
package/input/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/ui-tw",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"author": "scaleflex",
|
|
5
5
|
"repository": "github:scaleflex/ui",
|
|
6
6
|
"homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@radix-ui/react-slot": "^1.1.2",
|
|
23
23
|
"@radix-ui/react-switch": "^1.0.1",
|
|
24
24
|
"@radix-ui/react-tooltip": "^1.2.6",
|
|
25
|
-
"@scaleflex/icons-tw": "^0.0.
|
|
25
|
+
"@scaleflex/icons-tw": "^0.0.39",
|
|
26
26
|
"@types/lodash.merge": "^4.6.9",
|
|
27
27
|
"class-variance-authority": "^0.7.1",
|
|
28
28
|
"cmdk": "^1.1.1",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Password } from './password.component';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Password } from './password.component';
|
|
@@ -4,10 +4,10 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
4
4
|
var _excluded = ["className", "size", "disabled", "readOnly"];
|
|
5
5
|
import EyeClosed from '@scaleflex/icons-tw/eye-closed';
|
|
6
6
|
import EyeOpen from '@scaleflex/icons-tw/eye-open';
|
|
7
|
+
import { Input } from '@scaleflex/ui-tw/input';
|
|
7
8
|
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
8
9
|
import React, { useState } from 'react';
|
|
9
|
-
|
|
10
|
-
export function PasswordInput(_ref) {
|
|
10
|
+
export function Password(_ref) {
|
|
11
11
|
var className = _ref.className,
|
|
12
12
|
size = _ref.size,
|
|
13
13
|
disabled = _ref.disabled,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Search } from './search.component';
|
package/search/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Search } from './search.component';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["className", "size", "disabled", "readOnly"];
|
|
6
|
+
import { buttonVariants } from '@scaleflex/ui-tw/button';
|
|
7
|
+
import { ButtonVariant, buttonBaseClassNames } from '@scaleflex/ui-tw/button/button.constants';
|
|
8
|
+
import { Input } from '@scaleflex/ui-tw/input';
|
|
9
|
+
import { crossSizeOptions, iconSizeOptions, searchPaddingMap } from '@scaleflex/ui-tw/search/search.constants';
|
|
10
|
+
import { focusRingClassNames } from '@scaleflex/ui-tw/styles/shared-classes';
|
|
11
|
+
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
12
|
+
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
13
|
+
import { Search as SearchIcon, XIcon } from 'lucide-react';
|
|
14
|
+
import React, { useState } from 'react';
|
|
15
|
+
export function Search(_ref) {
|
|
16
|
+
var _rest$value$toString, _rest$value;
|
|
17
|
+
var className = _ref.className,
|
|
18
|
+
_ref$size = _ref.size,
|
|
19
|
+
size = _ref$size === void 0 ? FormSize.Md : _ref$size,
|
|
20
|
+
disabled = _ref.disabled,
|
|
21
|
+
readOnly = _ref.readOnly,
|
|
22
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
var padding = searchPaddingMap[size];
|
|
24
|
+
var iconSize = iconSizeOptions[size];
|
|
25
|
+
var crossSize = crossSizeOptions[size];
|
|
26
|
+
var _useState = useState((_rest$value$toString = (_rest$value = rest.value) === null || _rest$value === void 0 ? void 0 : _rest$value.toString()) !== null && _rest$value$toString !== void 0 ? _rest$value$toString : ''),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
value = _useState2[0],
|
|
29
|
+
setValue = _useState2[1];
|
|
30
|
+
var handleClear = function handleClear() {
|
|
31
|
+
var _rest$onChange;
|
|
32
|
+
var syntheticEvent = {
|
|
33
|
+
target: {
|
|
34
|
+
value: ''
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
setValue('');
|
|
38
|
+
(_rest$onChange = rest.onChange) === null || _rest$onChange === void 0 || _rest$onChange.call(rest, syntheticEvent);
|
|
39
|
+
};
|
|
40
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: "relative w-full"
|
|
42
|
+
}, /*#__PURE__*/React.createElement(SearchIcon, {
|
|
43
|
+
className: cn('text-muted-foreground pointer-events-none absolute top-1/2 -translate-y-1/2', iconSize, padding.icon)
|
|
44
|
+
}), /*#__PURE__*/React.createElement(Input, _extends({
|
|
45
|
+
value: value,
|
|
46
|
+
onChange: function onChange(e) {
|
|
47
|
+
var _rest$onChange2;
|
|
48
|
+
setValue(e.target.value);
|
|
49
|
+
(_rest$onChange2 = rest.onChange) === null || _rest$onChange2 === void 0 || _rest$onChange2.call(rest, e);
|
|
50
|
+
},
|
|
51
|
+
type: "search",
|
|
52
|
+
size: size,
|
|
53
|
+
disabled: disabled,
|
|
54
|
+
readOnly: readOnly,
|
|
55
|
+
className: cn('[&::-webkit-search-cancel-button]:hidden [&::-webkit-search-cancel-button]:appearance-none', padding.input, className)
|
|
56
|
+
}, rest)), value && !readOnly && !disabled && /*#__PURE__*/React.createElement("button", {
|
|
57
|
+
role: "button",
|
|
58
|
+
tabIndex: 0,
|
|
59
|
+
onClick: handleClear,
|
|
60
|
+
"data-clear-icon": "true",
|
|
61
|
+
"aria-label": "Clear",
|
|
62
|
+
className: cn.apply(void 0, _toConsumableArray(buttonBaseClassNames).concat([focusRingClassNames, buttonVariants({
|
|
63
|
+
size: crossSize,
|
|
64
|
+
variant: ButtonVariant.GhostSecondary
|
|
65
|
+
}), 'absolute top-1/2 right-2 -translate-y-1/2']))
|
|
66
|
+
}, /*#__PURE__*/React.createElement(XIcon, {
|
|
67
|
+
"data-clear-icon": true,
|
|
68
|
+
className: cn('shrink-0 hover:opacity-80')
|
|
69
|
+
})));
|
|
70
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const searchPaddingMap: {
|
|
2
|
+
readonly sm: {
|
|
3
|
+
readonly icon: "left-2.5";
|
|
4
|
+
readonly input: "pl-7 pr-9";
|
|
5
|
+
};
|
|
6
|
+
readonly md: {
|
|
7
|
+
readonly icon: "left-3.5";
|
|
8
|
+
readonly input: "pl-9 pr-11";
|
|
9
|
+
};
|
|
10
|
+
readonly lg: {
|
|
11
|
+
readonly icon: "left-3.5";
|
|
12
|
+
readonly input: "pl-10 pr-12";
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const iconSizeOptions: {
|
|
16
|
+
readonly sm: "size-3";
|
|
17
|
+
readonly md: "size-4";
|
|
18
|
+
readonly lg: "size-4.5";
|
|
19
|
+
};
|
|
20
|
+
export declare const crossSizeOptions: {
|
|
21
|
+
readonly sm: "icon-xs";
|
|
22
|
+
readonly md: "icon-sm";
|
|
23
|
+
readonly lg: "icon-md";
|
|
24
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { ButtonSize } from '@scaleflex/ui-tw/button';
|
|
3
|
+
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
4
|
+
export var searchPaddingMap = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, {
|
|
5
|
+
icon: 'left-2.5',
|
|
6
|
+
input: 'pl-7 pr-9'
|
|
7
|
+
}), FormSize.Md, {
|
|
8
|
+
icon: 'left-3.5',
|
|
9
|
+
input: 'pl-9 pr-11'
|
|
10
|
+
}), FormSize.Lg, {
|
|
11
|
+
icon: 'left-3.5',
|
|
12
|
+
input: 'pl-10 pr-12'
|
|
13
|
+
});
|
|
14
|
+
export var iconSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'size-3'), FormSize.Md, 'size-4'), FormSize.Lg, 'size-4.5');
|
|
15
|
+
export var crossSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, ButtonSize.IconXs), FormSize.Md, ButtonSize.IconSm), FormSize.Lg, ButtonSize.IconMd);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SelectorProps } from '../select.types';
|
|
3
|
-
export declare function Selector({ value, onChange, placeholder, disabled, readOnly, size, className, icon, options, showGroupSeparator, formItemId, popoverClassName, ...rest }: SelectorProps): React.JSX.Element;
|
|
3
|
+
export declare function Selector({ value, onChange, placeholder, disabled, readOnly, size, className, icon, options, showGroupSeparator, formItemId, popoverClassName, defaultOpen, triggerProps, ...rest }: SelectorProps): React.JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
var _excluded = ["value", "onChange", "placeholder", "disabled", "readOnly", "size", "className", "icon", "options", "showGroupSeparator", "formItemId", "popoverClassName"];
|
|
3
|
+
var _excluded = ["value", "onChange", "placeholder", "disabled", "readOnly", "size", "className", "icon", "options", "showGroupSeparator", "formItemId", "popoverClassName", "defaultOpen", "triggerProps"];
|
|
3
4
|
import { isOptionGroup } from '@scaleflex/ui-tw/form';
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue } from '../';
|
|
@@ -17,19 +18,22 @@ export function Selector(_ref) {
|
|
|
17
18
|
showGroupSeparator = _ref.showGroupSeparator,
|
|
18
19
|
formItemId = _ref.formItemId,
|
|
19
20
|
popoverClassName = _ref.popoverClassName,
|
|
21
|
+
defaultOpen = _ref.defaultOpen,
|
|
22
|
+
triggerProps = _ref.triggerProps,
|
|
20
23
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
-
return /*#__PURE__*/React.createElement(Select, {
|
|
24
|
+
return /*#__PURE__*/React.createElement(Select, _extends({
|
|
22
25
|
value: value,
|
|
23
26
|
onValueChange: readOnly ? undefined : onChange,
|
|
24
|
-
disabled: disabled || readOnly
|
|
25
|
-
|
|
27
|
+
disabled: disabled || readOnly,
|
|
28
|
+
defaultOpen: defaultOpen
|
|
29
|
+
}, rest), /*#__PURE__*/React.createElement(SelectTrigger, _extends({
|
|
26
30
|
id: formItemId,
|
|
27
31
|
"aria-invalid": rest['aria-invalid'],
|
|
28
32
|
size: size,
|
|
29
33
|
readOnly: readOnly,
|
|
30
34
|
className: className,
|
|
31
35
|
icon: icon
|
|
32
|
-
}, /*#__PURE__*/React.createElement(SelectValue, {
|
|
36
|
+
}, triggerProps), /*#__PURE__*/React.createElement(SelectValue, {
|
|
33
37
|
placeholder: placeholder
|
|
34
38
|
})), /*#__PURE__*/React.createElement(SelectContent, {
|
|
35
39
|
className: popoverClassName
|
package/select/select.types.d.ts
CHANGED
|
@@ -21,7 +21,8 @@ export interface SelectLabelProps extends ComponentProps<typeof SelectPrimitive.
|
|
|
21
21
|
}
|
|
22
22
|
export interface SelectIconProps extends ComponentProps<'span'>, Pick<SelectTriggerProps, 'size' | 'icon'> {
|
|
23
23
|
}
|
|
24
|
-
export interface SelectorProps {
|
|
24
|
+
export interface SelectorProps extends SelectProps {
|
|
25
|
+
options: SelectOption[];
|
|
25
26
|
value?: string;
|
|
26
27
|
onChange?: (value: string) => void;
|
|
27
28
|
placeholder?: string;
|
|
@@ -30,9 +31,10 @@ export interface SelectorProps {
|
|
|
30
31
|
size?: FormSizeType;
|
|
31
32
|
className?: string;
|
|
32
33
|
icon?: ReactElement;
|
|
33
|
-
|
|
34
|
+
defaultOpen?: boolean;
|
|
34
35
|
showGroupSeparator?: boolean;
|
|
35
36
|
formItemId?: string;
|
|
36
37
|
popoverClassName?: string;
|
|
37
38
|
'aria-invalid'?: boolean;
|
|
39
|
+
triggerProps?: Omit<ComponentProps<typeof SelectPrimitive.Trigger>, 'aria-invalid'>;
|
|
38
40
|
}
|