nebula-galaxy
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -13,3 +13,3 @@ import type { ButtonHTMLAttributes } from 'react'; | ||
*/ | ||
export declare const Button: ({ variant, size, leftIcon, rightIcon, loading, className, children, ...rest }: ButtonProps) => import("react/jsx-runtime").JSX.Element; | ||
export declare const Button: ({ variant, size, leftIcon, rightIcon, loading, className, children, type, ...rest }: ButtonProps) => import("react/jsx-runtime").JSX.Element; | ||
export default Button; |
@@ -32,7 +32,7 @@ var __assign = (this && this.__assign) || function () { | ||
var _b; | ||
var _c = _a.variant, variant = _c === void 0 ? 'Primary' : _c, _d = _a.size, size = _d === void 0 ? 'MD' : _d, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, loading = _a.loading, className = _a.className, children = _a.children, rest = __rest(_a, ["variant", "size", "leftIcon", "rightIcon", "loading", "className", "children"]); | ||
var _c = _a.variant, variant = _c === void 0 ? 'Primary' : _c, _d = _a.size, size = _d === void 0 ? 'MD' : _d, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, loading = _a.loading, className = _a.className, children = _a.children, _e = _a.type, type = _e === void 0 ? 'button' : _e, rest = __rest(_a, ["variant", "size", "leftIcon", "rightIcon", "loading", "className", "children", "type"]); | ||
return (_jsx("button", __assign({ className: cn(className, styles.button, styles["button".concat(variant)], styles["button".concat(size)], (_b = {}, | ||
_b[styles.buttonLoading] = loading, | ||
_b)) }, rest, { children: loading ? (_jsx("figure", __assign({ className: styles.buttonLoader }, { children: _jsx(Icon, { name: "Loader" }) }))) : (_jsxs(_Fragment, { children: [!!leftIcon && (_jsx("figure", __assign({ className: styles.buttonLeftIcon }, { children: _jsx(Icon, { name: leftIcon }) }))), _jsx("span", __assign({ className: styles.buttonText }, { children: children })), !!rightIcon && (_jsx("figure", __assign({ className: styles.buttonRightIcon }, { children: _jsx(Icon, { name: rightIcon }) })))] })) }))); | ||
_b)), type: type }, rest, { children: loading ? (_jsx("figure", __assign({ className: styles.buttonLoader }, { children: _jsx(Icon, { name: "Loader" }) }))) : (_jsxs(_Fragment, { children: [!!leftIcon && (_jsx("figure", __assign({ className: styles.buttonLeftIcon }, { children: _jsx(Icon, { name: leftIcon }) }))), _jsx("span", __assign({ className: styles.buttonText }, { children: children })), !!rightIcon && (_jsx("figure", __assign({ className: styles.buttonRightIcon }, { children: _jsx(Icon, { name: rightIcon }) })))] })) }))); | ||
}; | ||
export default Button; |
@@ -23,3 +23,3 @@ var __assign = (this && this.__assign) || function () { | ||
var DropdownMenu = function (props) { | ||
var className = props.className, options = props.options, groupedOptions = props.groupedOptions, stateValue = props.value, onChange = props.onChange, actions = props.actions, isMultiSelect = props.isMultiSelect, isSearchable = props.isSearchable; | ||
var name = props.name, className = props.className, options = props.options, groupedOptions = props.groupedOptions, stateValue = props.value, onChange = props.onChange, actions = props.actions, isMultiSelect = props.isMultiSelect, isSearchable = props.isSearchable; | ||
var searchRef = useRef(null); | ||
@@ -34,3 +34,3 @@ var selectAll = function (_a) { | ||
: []; | ||
onChange === null || onChange === void 0 ? void 0 : onChange({ target: { value: newValue } }); | ||
onChange === null || onChange === void 0 ? void 0 : onChange({ target: { name: name, value: newValue } }); | ||
}; | ||
@@ -37,0 +37,0 @@ useEffect(function () { |
@@ -44,3 +44,3 @@ var __assign = (this && this.__assign) || function () { | ||
var _a; | ||
var className = props.className, value = props.value, _b = props.variant, variant = _b === void 0 ? 'Filled' : _b, label = props.label, placeholder = props.placeholder, options = props.options, icon = props.icon, footnote = props.footnote, onChange = props.onChange, isMultiSelect = props.isMultiSelect, isSearchable = props.isSearchable, hasError = props.hasError, disabled = props.disabled, required = props.required, otherProps = __rest(props, ["className", "value", "variant", "label", "placeholder", "options", "icon", "footnote", "onChange", "isMultiSelect", "isSearchable", "hasError", "disabled", "required"]); | ||
var className = props.className, name = props.name, value = props.value, _b = props.variant, variant = _b === void 0 ? 'Filled' : _b, label = props.label, placeholder = props.placeholder, options = props.options, icon = props.icon, footnote = props.footnote, onChange = props.onChange, isMultiSelect = props.isMultiSelect, isSearchable = props.isSearchable, hasError = props.hasError, disabled = props.disabled, required = props.required, otherProps = __rest(props, ["className", "name", "value", "variant", "label", "placeholder", "options", "icon", "footnote", "onChange", "isMultiSelect", "isSearchable", "hasError", "disabled", "required"]); | ||
var _c = useState(value), stateValue = _c[0], setStateValue = _c[1]; | ||
@@ -77,3 +77,3 @@ var _d = useState(''), searchValue = _d[0], setSearchValue = _d[1]; | ||
setSearchValue(''); | ||
onChange === null || onChange === void 0 ? void 0 : onChange({ target: { value: newValue } }, !!checked); | ||
onChange === null || onChange === void 0 ? void 0 : onChange({ target: { name: name, value: newValue } }, !!checked); | ||
}; | ||
@@ -85,3 +85,3 @@ var handleSearch = function (_a) { | ||
setStateValue(''); | ||
onChange === null || onChange === void 0 ? void 0 : onChange({ target: { value: '' } }, !!required); | ||
onChange === null || onChange === void 0 ? void 0 : onChange({ target: { name: name, value: '' } }, !!required); | ||
} | ||
@@ -106,7 +106,7 @@ setSearchValue(value); | ||
_a[styles.selectDisabled] = disabled, | ||
_a)), ref: selectRef, "aria-label": "select" }, { children: [!!label && _jsx("label", __assign({ className: styles.selectLabel }, { children: label })), _jsxs("button", __assign({ className: styles.selectDisplay, onClick: function () { return setIsOpen(!isOpen); }, disabled: disabled }, { children: [_jsxs("div", __assign({ className: styles.selectInputContainer }, { children: [icon && (_jsx("div", __assign({ className: styles.selectAddon }, { children: _jsx(Icon, { name: icon }) }))), isSearchable ? (_jsx("input", { className: styles.selectInput, value: isOpen ? searchValue : getDisplay(), disabled: disabled, placeholder: placeholder || '', onChange: handleSearch, onClick: function (e) { | ||
_a)), ref: selectRef, "aria-label": "select" }, { children: [!!label && _jsx("label", __assign({ className: styles.selectLabel }, { children: label })), _jsxs("button", __assign({ className: styles.selectDisplay, onClick: function () { return setIsOpen(!isOpen); }, disabled: disabled, type: "button" }, { children: [_jsxs("div", __assign({ className: styles.selectInputContainer }, { children: [icon && (_jsx("div", __assign({ className: styles.selectAddon }, { children: _jsx(Icon, { name: icon }) }))), isSearchable ? (_jsx("input", { className: styles.selectInput, value: isOpen ? searchValue : getDisplay(), disabled: disabled, placeholder: placeholder || '', onChange: handleSearch, onClick: function (e) { | ||
isOpen && e.stopPropagation(); | ||
} })) : (_jsx("span", __assign({ className: cn('p5', styles["".concat(hasValue | ||
? 'selectDisplayText' | ||
: 'selectDisplayPlaceholder')]) }, { children: hasValue ? getDisplay() : placeholder })))] })), _jsx("div", __assign({ className: styles.selectAddon }, { children: _jsx(Icon, { name: "ChevronDown" }) }))] })), isOpen && (_jsx(DropdownMenu, __assign({ className: styles.selectDropdown, onChange: handleOnChange, value: stateValue, options: isSearchable | ||
: 'selectDisplayPlaceholder')]) }, { children: hasValue ? getDisplay() : placeholder })))] })), _jsx("div", __assign({ className: styles.selectAddon }, { children: _jsx(Icon, { name: "ChevronDown" }) }))] })), isOpen && (_jsx(DropdownMenu, __assign({ name: name, className: styles.selectDropdown, onChange: handleOnChange, value: stateValue, options: isSearchable | ||
? options === null || options === void 0 ? void 0 : options.filter(function (_a) { | ||
@@ -113,0 +113,0 @@ var label = _a.label, value = _a.value; |
@@ -26,3 +26,3 @@ import type { ReactNode } from 'react'; | ||
target: { | ||
name?: string; | ||
name: string; | ||
value?: SelectValue; | ||
@@ -29,0 +29,0 @@ checked?: boolean; |
{ | ||
"name": "nebula-galaxy", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
369926