@xanui/ui 1.2.6 → 1.2.7
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/Accordion/index.cjs +5 -5
- package/Accordion/index.cjs.map +1 -1
- package/Accordion/index.d.ts +3 -3
- package/Accordion/index.js +5 -5
- package/Accordion/index.js.map +1 -1
- package/Alert/index.cjs +19 -17
- package/Alert/index.cjs.map +1 -1
- package/Alert/index.d.ts +2 -2
- package/Alert/index.js +19 -17
- package/Alert/index.js.map +1 -1
- package/Autocomplete/index.cjs +2 -2
- package/Autocomplete/index.cjs.map +1 -1
- package/Autocomplete/index.d.ts +7 -7
- package/Autocomplete/index.js +2 -2
- package/Autocomplete/index.js.map +1 -1
- package/Avatar/index.cjs +2 -2
- package/Avatar/index.cjs.map +1 -1
- package/Avatar/index.d.ts +2 -2
- package/Avatar/index.js +2 -2
- package/Avatar/index.js.map +1 -1
- package/AvatarBox/index.cjs +19 -0
- package/AvatarBox/index.cjs.map +1 -0
- package/AvatarBox/index.d.ts +19 -0
- package/AvatarBox/index.js +17 -0
- package/AvatarBox/index.js.map +1 -0
- package/AvatarPicker/index.cjs +80 -0
- package/AvatarPicker/index.cjs.map +1 -0
- package/AvatarPicker/index.d.ts +27 -0
- package/AvatarPicker/index.js +78 -0
- package/AvatarPicker/index.js.map +1 -0
- package/Badge/index.cjs +1 -1
- package/Badge/index.cjs.map +1 -1
- package/Badge/index.d.ts +4 -4
- package/Badge/index.js +1 -1
- package/Badge/index.js.map +1 -1
- package/Box/index.d.ts +2 -2
- package/Button/index.cjs +5 -3
- package/Button/index.cjs.map +1 -1
- package/Button/index.d.ts +2 -2
- package/Button/index.js +5 -3
- package/Button/index.js.map +1 -1
- package/ButtonGroup/index.cjs +3 -2
- package/ButtonGroup/index.cjs.map +1 -1
- package/ButtonGroup/index.d.ts +2 -2
- package/ButtonGroup/index.js +3 -2
- package/ButtonGroup/index.js.map +1 -1
- package/Calendar/index.cjs +10 -10
- package/Calendar/index.cjs.map +1 -1
- package/Calendar/index.js +10 -10
- package/Calendar/index.js.map +1 -1
- package/CalendarInput/index.cjs +1 -1
- package/CalendarInput/index.cjs.map +1 -1
- package/CalendarInput/index.js +1 -1
- package/CalendarInput/index.js.map +1 -1
- package/Carousel/index.cjs +231 -0
- package/Carousel/index.cjs.map +1 -0
- package/Carousel/index.d.ts +28 -0
- package/Carousel/index.js +229 -0
- package/Carousel/index.js.map +1 -0
- package/Checkbox/index.cjs +2 -2
- package/Checkbox/index.cjs.map +1 -1
- package/Checkbox/index.d.ts +2 -2
- package/Checkbox/index.js +2 -2
- package/Checkbox/index.js.map +1 -1
- package/Chip/index.cjs +3 -3
- package/Chip/index.cjs.map +1 -1
- package/Chip/index.d.ts +2 -2
- package/Chip/index.js +3 -3
- package/Chip/index.js.map +1 -1
- package/CircleProgress/index.cjs +10 -10
- package/CircleProgress/index.cjs.map +1 -1
- package/CircleProgress/index.d.ts +2 -2
- package/CircleProgress/index.js +10 -10
- package/CircleProgress/index.js.map +1 -1
- package/ClickOutside/index.cjs +3 -12
- package/ClickOutside/index.cjs.map +1 -1
- package/ClickOutside/index.d.ts +3 -3
- package/ClickOutside/index.js +4 -13
- package/ClickOutside/index.js.map +1 -1
- package/Collaps/index.cjs +5 -5
- package/Collaps/index.cjs.map +1 -1
- package/Collaps/index.d.ts +2 -2
- package/Collaps/index.js +5 -5
- package/Collaps/index.js.map +1 -1
- package/Container/index.d.ts +2 -2
- package/DataFilter/index.d.ts +2 -2
- package/DataFilter/options/DateFilter.cjs +3 -3
- package/DataFilter/options/DateFilter.cjs.map +1 -1
- package/DataFilter/options/DateFilter.js +3 -3
- package/DataFilter/options/DateFilter.js.map +1 -1
- package/DataFilter/options/DateRangeFilter.cjs +2 -2
- package/DataFilter/options/DateRangeFilter.cjs.map +1 -1
- package/DataFilter/options/DateRangeFilter.js +2 -2
- package/DataFilter/options/DateRangeFilter.js.map +1 -1
- package/DataFilter/options/MultiSelectFilter.cjs +3 -3
- package/DataFilter/options/MultiSelectFilter.cjs.map +1 -1
- package/DataFilter/options/MultiSelectFilter.js +3 -3
- package/DataFilter/options/MultiSelectFilter.js.map +1 -1
- package/DataFilter/options/NumberFilter.cjs +2 -2
- package/DataFilter/options/NumberFilter.cjs.map +1 -1
- package/DataFilter/options/NumberFilter.js +2 -2
- package/DataFilter/options/NumberFilter.js.map +1 -1
- package/DataFilter/options/NumberRangeFilter.cjs +2 -2
- package/DataFilter/options/NumberRangeFilter.cjs.map +1 -1
- package/DataFilter/options/NumberRangeFilter.js +2 -2
- package/DataFilter/options/NumberRangeFilter.js.map +1 -1
- package/DataFilter/options/SelectFilter.cjs +3 -3
- package/DataFilter/options/SelectFilter.cjs.map +1 -1
- package/DataFilter/options/SelectFilter.js +3 -3
- package/DataFilter/options/SelectFilter.js.map +1 -1
- package/DataFilter/options/TextFilter.cjs +2 -2
- package/DataFilter/options/TextFilter.cjs.map +1 -1
- package/DataFilter/options/TextFilter.js +2 -2
- package/DataFilter/options/TextFilter.js.map +1 -1
- package/Datatable/FilterBox.cjs +2 -2
- package/Datatable/FilterBox.cjs.map +1 -1
- package/Datatable/FilterBox.js +2 -2
- package/Datatable/FilterBox.js.map +1 -1
- package/Datatable/Row.cjs +2 -2
- package/Datatable/Row.cjs.map +1 -1
- package/Datatable/Row.js +2 -2
- package/Datatable/Row.js.map +1 -1
- package/Datatable/SelectedBox.cjs +2 -2
- package/Datatable/SelectedBox.cjs.map +1 -1
- package/Datatable/SelectedBox.js +2 -2
- package/Datatable/SelectedBox.js.map +1 -1
- package/Datatable/Table.cjs +1 -1
- package/Datatable/Table.cjs.map +1 -1
- package/Datatable/Table.js +1 -1
- package/Datatable/Table.js.map +1 -1
- package/Datatable/TableHead.cjs +3 -3
- package/Datatable/TableHead.cjs.map +1 -1
- package/Datatable/TableHead.js +3 -3
- package/Datatable/TableHead.js.map +1 -1
- package/Datatable/index.cjs +1 -1
- package/Datatable/index.cjs.map +1 -1
- package/Datatable/index.d.ts +2 -2
- package/Datatable/index.js +1 -1
- package/Datatable/index.js.map +1 -1
- package/Divider/index.cjs +3 -3
- package/Divider/index.cjs.map +1 -1
- package/Divider/index.d.ts +2 -2
- package/Divider/index.js +3 -3
- package/Divider/index.js.map +1 -1
- package/Drawer/index.cjs +2 -2
- package/Drawer/index.cjs.map +1 -1
- package/Drawer/index.js +2 -2
- package/Drawer/index.js.map +1 -1
- package/FilePicker/index.cjs +115 -0
- package/FilePicker/index.cjs.map +1 -0
- package/FilePicker/index.d.ts +23 -0
- package/FilePicker/index.js +113 -0
- package/FilePicker/index.js.map +1 -0
- package/Form/index.cjs +1 -1
- package/Form/index.cjs.map +1 -1
- package/Form/index.d.ts +2 -2
- package/Form/index.js +1 -1
- package/Form/index.js.map +1 -1
- package/GalleryPicker/index.cjs +88 -0
- package/GalleryPicker/index.cjs.map +1 -0
- package/GalleryPicker/index.d.ts +26 -0
- package/GalleryPicker/index.js +86 -0
- package/GalleryPicker/index.js.map +1 -0
- package/GridContainer/index.d.ts +2 -2
- package/GridItem/index.d.ts +2 -2
- package/IconButton/index.cjs +6 -3
- package/IconButton/index.cjs.map +1 -1
- package/IconButton/index.d.ts +2 -2
- package/IconButton/index.js +6 -3
- package/IconButton/index.js.map +1 -1
- package/Image/index.cjs +2 -14
- package/Image/index.cjs.map +1 -1
- package/Image/index.d.ts +3 -5
- package/Image/index.js +3 -15
- package/Image/index.js.map +1 -1
- package/Input/index.cjs +10 -10
- package/Input/index.cjs.map +1 -1
- package/Input/index.d.ts +14 -14
- package/Input/index.js +10 -10
- package/Input/index.js.map +1 -1
- package/InputNumber/index.d.ts +2 -2
- package/Label/index.cjs +1 -1
- package/Label/index.cjs.map +1 -1
- package/Label/index.d.ts +2 -2
- package/Label/index.js +1 -1
- package/Label/index.js.map +1 -1
- package/Layer/index.cjs +12 -13
- package/Layer/index.cjs.map +1 -1
- package/Layer/index.d.ts +5 -5
- package/Layer/index.js +13 -14
- package/Layer/index.js.map +1 -1
- package/LineProgress/index.cjs +6 -6
- package/LineProgress/index.cjs.map +1 -1
- package/LineProgress/index.d.ts +2 -2
- package/LineProgress/index.js +6 -6
- package/LineProgress/index.js.map +1 -1
- package/Link/index.cjs +41 -0
- package/Link/index.cjs.map +1 -0
- package/Link/index.d.ts +17 -0
- package/Link/index.js +39 -0
- package/Link/index.js.map +1 -0
- package/List/index.cjs +1 -1
- package/List/index.cjs.map +1 -1
- package/List/index.d.ts +2 -2
- package/List/index.js +1 -1
- package/List/index.js.map +1 -1
- package/ListItem/index.cjs +8 -8
- package/ListItem/index.cjs.map +1 -1
- package/ListItem/index.d.ts +2 -2
- package/ListItem/index.js +8 -8
- package/ListItem/index.js.map +1 -1
- package/LoadingBox/index.cjs +2 -2
- package/LoadingBox/index.cjs.map +1 -1
- package/LoadingBox/index.d.ts +2 -2
- package/LoadingBox/index.js +2 -2
- package/LoadingBox/index.js.map +1 -1
- package/Menu/index.cjs +6 -21
- package/Menu/index.cjs.map +1 -1
- package/Menu/index.d.ts +6 -4
- package/Menu/index.js +6 -21
- package/Menu/index.js.map +1 -1
- package/Modal/index.cjs +5 -5
- package/Modal/index.cjs.map +1 -1
- package/Modal/index.js +5 -5
- package/Modal/index.js.map +1 -1
- package/Option/index.d.ts +2 -2
- package/PasswordInput/index.cjs +21 -0
- package/PasswordInput/index.cjs.map +1 -0
- package/PasswordInput/index.d.ts +11 -0
- package/PasswordInput/index.js +19 -0
- package/PasswordInput/index.js.map +1 -0
- package/Portal/index.d.ts +3 -3
- package/Radio/index.d.ts +2 -2
- package/RangeSlider/index.cjs +158 -0
- package/RangeSlider/index.cjs.map +1 -0
- package/RangeSlider/index.d.ts +24 -0
- package/RangeSlider/index.js +156 -0
- package/RangeSlider/index.js.map +1 -0
- package/Scrollbar/index.cjs +6 -6
- package/Scrollbar/index.cjs.map +1 -1
- package/Scrollbar/index.d.ts +3 -3
- package/Scrollbar/index.js +6 -6
- package/Scrollbar/index.js.map +1 -1
- package/Select/index.cjs +2 -2
- package/Select/index.cjs.map +1 -1
- package/Select/index.d.ts +5 -5
- package/Select/index.js +2 -2
- package/Select/index.js.map +1 -1
- package/Skeleton/index.cjs +7 -5
- package/Skeleton/index.cjs.map +1 -1
- package/Skeleton/index.js +7 -5
- package/Skeleton/index.js.map +1 -1
- package/Stack/index.d.ts +2 -2
- package/Switch/index.cjs +2 -2
- package/Switch/index.cjs.map +1 -1
- package/Switch/index.d.ts +3 -3
- package/Switch/index.js +2 -2
- package/Switch/index.js.map +1 -1
- package/Tab/index.cjs +23 -2
- package/Tab/index.cjs.map +1 -1
- package/Tab/index.d.ts +2 -2
- package/Tab/index.js +25 -4
- package/Tab/index.js.map +1 -1
- package/Table/index.cjs +9 -9
- package/Table/index.cjs.map +1 -1
- package/Table/index.d.ts +2 -2
- package/Table/index.js +9 -9
- package/Table/index.js.map +1 -1
- package/TableBody/index.d.ts +2 -2
- package/TableCell/index.cjs +1 -1
- package/TableCell/index.cjs.map +1 -1
- package/TableCell/index.d.ts +2 -2
- package/TableCell/index.js +1 -1
- package/TableCell/index.js.map +1 -1
- package/TableFooter/index.d.ts +2 -2
- package/TableHead/index.d.ts +2 -2
- package/TablePagination/index.cjs +2 -2
- package/TablePagination/index.cjs.map +1 -1
- package/TablePagination/index.d.ts +2 -2
- package/TablePagination/index.js +2 -2
- package/TablePagination/index.js.map +1 -1
- package/TableRow/index.d.ts +2 -2
- package/Tabs/context.cjs +11 -0
- package/Tabs/context.cjs.map +1 -0
- package/Tabs/context.js +8 -0
- package/Tabs/context.js.map +1 -0
- package/Tabs/index.cjs +83 -168
- package/Tabs/index.cjs.map +1 -1
- package/Tabs/index.d.ts +4 -22
- package/Tabs/index.js +86 -171
- package/Tabs/index.js.map +1 -1
- package/Tabs/types.d.ts +16 -0
- package/Text/index.cjs +1 -1
- package/Text/index.cjs.map +1 -1
- package/Text/index.d.ts +2 -2
- package/Text/index.js +1 -1
- package/Text/index.js.map +1 -1
- package/Toast/index.cjs +15 -16
- package/Toast/index.cjs.map +1 -1
- package/Toast/index.js +16 -17
- package/Toast/index.js.map +1 -1
- package/Tooltip/index.cjs +2 -2
- package/Tooltip/index.cjs.map +1 -1
- package/Tooltip/index.js +2 -2
- package/Tooltip/index.js.map +1 -1
- package/ViewBox/index.d.ts +2 -2
- package/index.cjs +124 -110
- package/index.cjs.map +1 -1
- package/index.d.ts +8 -1
- package/index.js +8 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/readme.md +1 -1
- package/useBlurCss/index.cjs +1 -2
- package/useBlurCss/index.cjs.map +1 -1
- package/useBlurCss/index.js +1 -2
- package/useBlurCss/index.js.map +1 -1
- package/useContextMenu/index.cjs +2 -2
- package/useContextMenu/index.cjs.map +1 -1
- package/useContextMenu/index.d.ts +1 -1
- package/useContextMenu/index.js +2 -2
- package/useContextMenu/index.js.map +1 -1
- package/Paper/index.cjs +0 -16
- package/Paper/index.cjs.map +0 -1
- package/Paper/index.d.ts +0 -8
- package/Paper/index.js +0 -14
- package/Paper/index.js.map +0 -1
package/Input/index.js
CHANGED
|
@@ -34,7 +34,7 @@ const Input = React.forwardRef((_a, ref) => {
|
|
|
34
34
|
startIcon = p.startIcon;
|
|
35
35
|
endIcon = p.endIcon;
|
|
36
36
|
iconPlacement = p.iconPlacement;
|
|
37
|
-
color = (_b = p.color) !== null && _b !== void 0 ? _b : "
|
|
37
|
+
color = (_b = p.color) !== null && _b !== void 0 ? _b : "primary";
|
|
38
38
|
variant = (_c = p.variant) !== null && _c !== void 0 ? _c : "fill";
|
|
39
39
|
helperText = p.helperText;
|
|
40
40
|
size = (_d = p.size) !== null && _d !== void 0 ? _d : 'medium';
|
|
@@ -90,8 +90,8 @@ const Input = React.forwardRef((_a, ref) => {
|
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
const _size = sizes[size];
|
|
93
|
-
let borderColor = _focus ? color : (variant === "fill" ? "transparent" :
|
|
94
|
-
borderColor = error ? "danger.
|
|
93
|
+
let borderColor = _focus ? color : (variant === "fill" ? "transparent" : `${color}.divider`);
|
|
94
|
+
borderColor = error ? "danger.divider" : borderColor;
|
|
95
95
|
let multiprops = {};
|
|
96
96
|
if (multiline) {
|
|
97
97
|
multiprops = {
|
|
@@ -108,9 +108,9 @@ const Input = React.forwardRef((_a, ref) => {
|
|
|
108
108
|
}, children: [!!label && jsx(Label, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.label, { ref: refs === null || refs === void 0 ? void 0 : refs.label, children: label })), jsxs(Tag, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.inputRoot, { ref: refs === null || refs === void 0 ? void 0 : refs.inputRoot, baseClass: 'input-root', sxr: {
|
|
109
109
|
width: "100%",
|
|
110
110
|
overflow: "hidden",
|
|
111
|
-
}, children: [jsxs(Tag, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.rootContainer, { ref: refs === null || refs === void 0 ? void 0 : refs.rootContainer, baseClass: 'input-root-container', sxr: Object.assign(Object.assign(Object.assign(Object.assign({ width: "100%", display: "flex", flexDirection: "row", alignItems: iconPlacement === 'center' ? iconPlacement : `flex-${iconPlacement}`, flexWrap: "nowrap", transitionProperty: "border, box-shadow, background", bgcolor: error ? "danger.
|
|
112
|
-
"-webkit-text-fill-color": "
|
|
113
|
-
"box-shadow": `0 0 0px 1000px ${variant === "fill" ? theme.colors.
|
|
111
|
+
}, children: [jsxs(Tag, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.rootContainer, { ref: refs === null || refs === void 0 ? void 0 : refs.rootContainer, baseClass: 'input-root-container', sxr: Object.assign(Object.assign(Object.assign(Object.assign({ width: "100%", display: "flex", flexDirection: "row", alignItems: iconPlacement === 'center' ? iconPlacement : `flex-${iconPlacement}`, flexWrap: "nowrap", transitionProperty: "border, box-shadow, background", bgcolor: error ? "danger.ghost" : variant === "fill" ? "surface.light" : "transparent", border: variant === "text" ? 0 : "1px solid", borderColor: borderColor, borderRadius: 1, px: 1 }, _size), { height: multiline ? "auto" : _size.height, minHeight: _size.height, "& > input:-webkit-autofill,& > input:-webkit-autofill:hover, & > input:-webkit-autofill:focus,& > input:-webkit-autofill:active": {
|
|
112
|
+
"-webkit-text-fill-color": "surface.contrast",
|
|
113
|
+
"box-shadow": `0 0 0px 1000px ${variant === "fill" ? theme.colors.surface.light : theme.colors.surface.main} inset`,
|
|
114
114
|
transition: "background-color 5000s ease-in-out 0s"
|
|
115
115
|
}, "& textarea": {
|
|
116
116
|
resize: "none"
|
|
@@ -120,7 +120,7 @@ const Input = React.forwardRef((_a, ref) => {
|
|
|
120
120
|
alignItems: 'center',
|
|
121
121
|
justifyContent: "center",
|
|
122
122
|
display: "flex",
|
|
123
|
-
color: error ? "danger.
|
|
123
|
+
color: error ? "danger.main" : "surface.muted",
|
|
124
124
|
flex: "0 0 auto",
|
|
125
125
|
},
|
|
126
126
|
})), (!!endIcon && {
|
|
@@ -129,14 +129,14 @@ const Input = React.forwardRef((_a, ref) => {
|
|
|
129
129
|
alignItems: 'center',
|
|
130
130
|
justifyContent: "center",
|
|
131
131
|
display: 'flex',
|
|
132
|
-
color: error ? "danger.
|
|
132
|
+
color: error ? "danger.main" : "surface.muted",
|
|
133
133
|
flex: "0 0 auto",
|
|
134
134
|
},
|
|
135
135
|
})), disabled: disabled || false, children: [startIcon, jsx(Tag, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.input, { ref: inputMergeRef, baseClass: 'input', component: multiline ? 'textarea' : 'input' }, multiprops, { sxr: {
|
|
136
136
|
border: 0,
|
|
137
137
|
outline: 0,
|
|
138
138
|
bgcolor: "transparent",
|
|
139
|
-
color: error ? "danger.
|
|
139
|
+
color: error ? "danger.main" : "surface.contrast",
|
|
140
140
|
fontSize: _size.fontSize,
|
|
141
141
|
height: multiline ? "auto" : _size.height + "px!important",
|
|
142
142
|
width: "100%",
|
|
@@ -148,7 +148,7 @@ const Input = React.forwardRef((_a, ref) => {
|
|
|
148
148
|
focused !== null && focused !== void 0 ? focused : setFocused(false);
|
|
149
149
|
onBlur && onBlur(e);
|
|
150
150
|
}, onKeyDown: onKeyDown, onKeyUp: onKeyUp, name: name, placeholder: placeholder, type: type, readOnly: readOnly, autoComplete: autoComplete })), endIcon] })), helperText && jsx(Tag, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.helperText, { ref: refs === null || refs === void 0 ? void 0 : refs.helperText, baseClass: "input-helper-text", sxr: {
|
|
151
|
-
color: error ? "danger.
|
|
151
|
+
color: error ? "danger.main" : "surface.contrast",
|
|
152
152
|
fontSize: "small",
|
|
153
153
|
lineHeight: "text",
|
|
154
154
|
fontWeight: 'text',
|
package/Input/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Input/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { ReactElement, useEffect, useMemo, useState } from 'react';\nimport { Tag, TagProps, TagComponentType, UseColorTemplateColor, useBreakpointPropsType, useInterface, useBreakpointProps, useMergeRefs } from '@xanui/core';\nimport Label, { LabelProps } from '../Label';\n\nexport type InputProps<T extends TagComponentType = \"div\"> = Omit<TagProps<T>, \"size\" | \"color\" | \"label\"> & {\n value?: string;\n type?: TagProps<'input'>['type'];\n name?: string;\n placeholder?: string;\n readOnly?: boolean;\n autoFocus?: boolean;\n autoComplete?: string;\n label?: useBreakpointPropsType<string>;\n\n onFocus?: (e: React.FocusEvent<any>) => void;\n onBlur?: (e: React.FocusEvent<any>) => void;\n onChange?: (e: React.ChangeEvent<any>) => void;\n onInput?: (e: React.FormEvent<any>) => void;\n onKeyDown?: (e: React.KeyboardEvent<any>) => void;\n onKeyUp?: (e: React.KeyboardEvent<any>) => void;\n\n rows?: useBreakpointPropsType<number>;\n minRows?: useBreakpointPropsType<number>;\n maxRows?: useBreakpointPropsType<number>;\n fullWidth?: boolean;\n\n startIcon?: useBreakpointPropsType<ReactElement>;\n endIcon?: useBreakpointPropsType<ReactElement>;\n iconPlacement?: useBreakpointPropsType<\"start\" | \"center\" | \"end\">;\n focused?: boolean;\n color?: useBreakpointPropsType<Omit<UseColorTemplateColor, \"default\">>;\n variant?: useBreakpointPropsType<\"fill\" | \"outline\" | \"text\">;\n error?: boolean;\n helperText?: useBreakpointPropsType<string>;\n multiline?: boolean;\n size?: useBreakpointPropsType<\"small\" | \"medium\" | \"large\">;\n\n refs?: {\n inputRoot?: React.Ref<\"div\">;\n label?: React.Ref<\"label\">;\n rootContainer?: React.Ref<\"div\">;\n // startIcon?: React.Ref<ReactElement>;\n // endIcon?: React.Ref<ReactElement>;\n // inputContainer?: React.Ref<\"div\">;\n input?: React.Ref<'input' | 'textarea'>;\n helperText?: React.Ref<\"div\">;\n };\n\n slotProps?: {\n inputRoot?: Omit<TagProps<\"div\">, \"children\">;\n label?: Omit<LabelProps, \"children\">;\n rootContainer?: Omit<TagProps<\"div\">, \"children\">;\n // startIcon?: Omit<TagProps<'div'>, \"children\">;\n // endIcon?: Omit<TagProps<'div'>, \"children\">;\n // inputContainer?: Omit<TagProps<\"div\">, \"children\">;\n helperText?: Omit<TagProps<\"div\">, \"children\">;\n input?: Partial<TagProps<T>>;\n }\n}\n\nconst Input = React.forwardRef(<T extends TagComponentType = \"div\">({ value, refs, ...props }: InputProps<T>, ref?: React.Ref<any>) => {\n let [{\n startIcon,\n endIcon,\n iconPlacement,\n color,\n label,\n name,\n placeholder,\n type,\n readOnly,\n autoFocus,\n autoComplete,\n onFocus,\n onBlur,\n onChange,\n onKeyDown,\n onKeyUp,\n\n focused,\n disabled,\n variant,\n error,\n helperText,\n multiline,\n size,\n rows,\n minRows,\n maxRows,\n fullWidth,\n slotProps,\n\n ...rest\n }, theme] = useInterface<any>(\"Input\", props, {})\n\n const _p: any = {}\n if (startIcon) _p.startIcon = startIcon\n if (endIcon) _p.endIcon = endIcon\n if (iconPlacement) _p.iconPlacement = iconPlacement\n if (color) _p.color = color\n if (variant) _p.variant = variant\n if (helperText) _p.helperText = helperText\n if (size) _p.size = size\n if (rows) _p.rows = rows\n if (minRows) _p.minRows = minRows\n if (maxRows) _p.maxRows = maxRows\n const p: any = useBreakpointProps(_p)\n startIcon = p.startIcon\n endIcon = p.endIcon\n iconPlacement = p.iconPlacement\n color = p.color ?? \"brand\"\n variant = p.variant ?? \"fill\"\n helperText = p.helperText\n size = p.size ?? 'medium'\n rows = p.rows\n minRows = p.minRows\n maxRows = p.maxRows\n\n iconPlacement ??= multiline ? \"end\" : \"center\"\n if (!value) iconPlacement = 'center'\n\n const [_focused, setFocused] = useState(false)\n let _focus = focused || _focused\n const inputRef = React.useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n const inputMergeRef = useMergeRefs(inputRef, refs?.input as any);\n\n useEffect(() => {\n if (autoFocus) {\n setTimeout(() => {\n inputRef.current?.focus()\n }, 100);\n }\n }, [autoFocus])\n\n let _rows = useMemo(() => {\n if (rows) return rows\n if (value && multiline) {\n let lines = (value as string).split(`\\n`).length\n if (minRows && minRows > lines) {\n return minRows\n } else if (maxRows && maxRows < lines) {\n return maxRows\n } else {\n return lines\n }\n }\n }, [value]) || 1\n\n const sizes: any = {\n small: {\n height: 38,\n gap: .5,\n fontSize: 'button',\n },\n medium: {\n height: 46,\n gap: 1,\n fontSize: \"text\"\n },\n large: {\n height: 52,\n gap: 1,\n fontSize: 'big'\n }\n }\n\n const _size = sizes[size]\n let borderColor = _focus ? color : (variant === \"fill\" ? \"transparent\" : \"divider\")\n borderColor = error ? \"danger.primary\" : borderColor\n let multiprops: any = {}\n if (multiline) {\n multiprops = {\n rows: _rows,\n sx: {\n resize: \"none\"\n }\n }\n }\n\n return (\n <Tag\n width={fullWidth ? \"100%\" : \"auto\"}\n {...rest}\n ref={ref}\n baseClass=\"input-wrapper\"\n sxr={{\n display: 'flex',\n flexDirection: 'column',\n gap: .5,\n }}\n >\n {!!label && <Label {...slotProps?.label} ref={refs?.label}>{label}</Label>}\n <Tag\n {...slotProps?.inputRoot}\n ref={refs?.inputRoot}\n baseClass={'input-root'}\n sxr={{\n width: \"100%\",\n overflow: \"hidden\",\n }}\n >\n <Tag\n {...slotProps?.rootContainer}\n ref={refs?.rootContainer}\n baseClass='input-root-container'\n sxr={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n alignItems: iconPlacement === 'center' ? iconPlacement : `flex-${iconPlacement}`,\n flexWrap: \"nowrap\",\n transitionProperty: \"border, box-shadow, background\",\n bgcolor: error ? \"danger.soft.primary\" : variant === \"fill\" ? \"background.secondary\" : \"background.primary\",\n border: variant === \"text\" ? 0 : \"1px solid\",\n borderColor: borderColor,\n borderRadius: 1,\n px: 1,\n // py: .5,\n ..._size,\n height: multiline ? \"auto\" : _size.height,\n minHeight: _size.height,\n \"& > input:-webkit-autofill,& > input:-webkit-autofill:hover, & > input:-webkit-autofill:focus,& > input:-webkit-autofill:active\": {\n \"-webkit-text-fill-color\": \"text.primary\",\n \"box-shadow\": `0 0 0px 1000px ${variant === \"fill\" ? theme.colors.background.secondary : theme.colors.background.primary} inset`,\n transition: \"background-color 5000s ease-in-out 0s\"\n } as any,\n \"& textarea\": {\n resize: \"none\"\n },\n\n ...(!!startIcon && {\n \"& > :first-child:not(.xui-input)\": {\n height: \"100%\",\n alignItems: 'center',\n justifyContent: \"center\",\n display: \"flex\",\n color: error ? \"danger.primary\" : \"text.secondary\",\n flex: \"0 0 auto\",\n },\n }),\n\n ...(!!endIcon && {\n \"& > :last-child:not(.xui-input)\": {\n height: \"100%\",\n alignItems: 'center',\n justifyContent: \"center\",\n display: 'flex',\n color: error ? \"danger.primary\" : \"text.secondary\",\n flex: \"0 0 auto\",\n },\n })\n\n }}\n disabled={disabled || false}\n >\n {startIcon}\n <Tag\n {...slotProps?.input}\n ref={inputMergeRef}\n baseClass='input'\n component={multiline ? 'textarea' : 'input'}\n {...multiprops}\n sxr={{\n border: 0,\n outline: 0,\n bgcolor: \"transparent\",\n color: error ? \"danger.primary\" : \"text.primary\",\n fontSize: _size.fontSize,\n height: multiline ? \"auto\" : _size.height + \"px!important\",\n width: \"100%\",\n maxHeight: 200,\n }}\n value={value}\n onChange={onChange}\n onFocus={(e: any) => {\n focused ?? setFocused(true)\n onFocus && onFocus(e)\n }}\n onBlur={(e: any) => {\n focused ?? setFocused(false)\n onBlur && onBlur(e)\n }}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n name={name}\n placeholder={placeholder}\n type={type}\n readOnly={readOnly}\n autoComplete={autoComplete}\n />\n {endIcon}\n </Tag>\n {helperText && <Tag\n {...slotProps?.helperText}\n ref={refs?.helperText}\n baseClass=\"input-helper-text\"\n sxr={{\n color: error ? \"danger.primary\" : \"text.primary\",\n fontSize: \"small\",\n lineHeight: \"text\",\n fontWeight: 'text',\n pl: .5,\n }}\n >{helperText}</Tag>}\n </Tag>\n </Tag>\n )\n})\n\nexport default Input\n"],"names":[],"mappings":";;;;;;;AA6DA;;;AACI;;AAmCA;AAAe;AACf;AAAa;AACb;AAAmB;AACnB;AAAW;AACX;AAAa;AACb;AAAgB;AAChB;AAAU;AACV;AAAU;AACV;AAAa;AACb;AAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;;;AAGA;;AAEA;;;;;AAKY;;;AAGZ;AAEA;AACI;AAAU;AACV;;AAEI;AACI;;AACG;AACH;;;AAEA;;;AAGZ;AAEA;AACI;AACI;AACA;AACA;AACH;AACD;AACI;AACA;AACA;AACH;AACD;AACI;AACA;AACA;AACH;;AAGL;;;;;AAKI;AACI;AACA;AACI;AACH;;;;AAWG;AACA;AACA;;AASI;AACA;AACH;AAuBW;;AAEA;AACI;AAEJ;AACH;AAGG;AACI;AACA;AACA;AACA;;AAEA;AACH;AACJ;AAGG;AACI;AACA;AACA;AACA;;AAEA;AACH;AACJ;AAaG;AACA;AACA;;;AAGA;AACA;AACA;AACH;;AAKG;AACJ;;AAGI;AACJ;;AAiBA;AACA;AACA;AACA;AACH;AAKrB;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Input/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { ReactElement, useEffect, useMemo, useState } from 'react';\nimport { Tag, TagProps, TagComponentType, UseColorTemplateColor, useBreakpointPropsType, useInterface, useBreakpointProps, useMergeRefs } from '@xanui/core';\nimport Label, { LabelProps } from '../Label';\n\nexport type InputProps<T extends TagComponentType = \"div\"> = Omit<TagProps<T>, \"size\" | \"color\" | \"label\"> & {\n value?: string;\n type?: TagProps<'input'>['type'];\n name?: string;\n placeholder?: string;\n readOnly?: boolean;\n autoFocus?: boolean;\n autoComplete?: string;\n label?: useBreakpointPropsType<string>;\n\n onFocus?: (e: React.FocusEvent<any>) => void;\n onBlur?: (e: React.FocusEvent<any>) => void;\n onChange?: (e: React.ChangeEvent<any>) => void;\n onInput?: (e: React.FormEvent<any>) => void;\n onKeyDown?: (e: React.KeyboardEvent<any>) => void;\n onKeyUp?: (e: React.KeyboardEvent<any>) => void;\n\n rows?: useBreakpointPropsType<number>;\n minRows?: useBreakpointPropsType<number>;\n maxRows?: useBreakpointPropsType<number>;\n fullWidth?: boolean;\n\n startIcon?: useBreakpointPropsType<ReactElement>;\n endIcon?: useBreakpointPropsType<ReactElement>;\n iconPlacement?: useBreakpointPropsType<\"start\" | \"center\" | \"end\">;\n focused?: boolean;\n color?: useBreakpointPropsType<Omit<UseColorTemplateColor, 'surface'>>;\n variant?: useBreakpointPropsType<\"fill\" | \"outline\" | \"text\">;\n error?: boolean;\n helperText?: useBreakpointPropsType<string>;\n multiline?: boolean;\n size?: useBreakpointPropsType<\"small\" | \"medium\" | \"large\">;\n\n refs?: {\n inputRoot?: React.Ref<\"div\">;\n label?: React.Ref<\"label\">;\n rootContainer?: React.Ref<\"div\">;\n // startIcon?: React.Ref<ReactElement>;\n // endIcon?: React.Ref<ReactElement>;\n // inputContainer?: React.Ref<\"div\">;\n input?: React.Ref<'input' | 'textarea'>;\n helperText?: React.Ref<\"div\">;\n };\n\n slotProps?: {\n inputRoot?: Omit<TagProps<\"div\">, \"children\">;\n label?: Omit<LabelProps, \"children\">;\n rootContainer?: Omit<TagProps<\"div\">, \"children\">;\n // startIcon?: Omit<TagProps<'div'>, \"children\">;\n // endIcon?: Omit<TagProps<'div'>, \"children\">;\n // inputContainer?: Omit<TagProps<\"div\">, \"children\">;\n helperText?: Omit<TagProps<\"div\">, \"children\">;\n input?: Partial<TagProps<T>>;\n }\n}\n\nconst Input = React.forwardRef(<T extends TagComponentType = \"div\">({ value, refs, ...props }: InputProps<T>, ref?: React.Ref<any>) => {\n let [{\n startIcon,\n endIcon,\n iconPlacement,\n color,\n label,\n name,\n placeholder,\n type,\n readOnly,\n autoFocus,\n autoComplete,\n onFocus,\n onBlur,\n onChange,\n onKeyDown,\n onKeyUp,\n\n focused,\n disabled,\n variant,\n error,\n helperText,\n multiline,\n size,\n rows,\n minRows,\n maxRows,\n fullWidth,\n slotProps,\n\n ...rest\n }, theme] = useInterface<any>(\"Input\", props, {})\n\n const _p: any = {}\n if (startIcon) _p.startIcon = startIcon\n if (endIcon) _p.endIcon = endIcon\n if (iconPlacement) _p.iconPlacement = iconPlacement\n if (color) _p.color = color\n if (variant) _p.variant = variant\n if (helperText) _p.helperText = helperText\n if (size) _p.size = size\n if (rows) _p.rows = rows\n if (minRows) _p.minRows = minRows\n if (maxRows) _p.maxRows = maxRows\n const p: any = useBreakpointProps(_p)\n startIcon = p.startIcon\n endIcon = p.endIcon\n iconPlacement = p.iconPlacement\n color = p.color ?? \"primary\"\n variant = p.variant ?? \"fill\"\n helperText = p.helperText\n size = p.size ?? 'medium'\n rows = p.rows\n minRows = p.minRows\n maxRows = p.maxRows\n\n iconPlacement ??= multiline ? \"end\" : \"center\"\n if (!value) iconPlacement = 'center'\n\n const [_focused, setFocused] = useState(false)\n let _focus = focused || _focused\n const inputRef = React.useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n const inputMergeRef = useMergeRefs(inputRef, refs?.input as any);\n\n useEffect(() => {\n if (autoFocus) {\n setTimeout(() => {\n inputRef.current?.focus()\n }, 100);\n }\n }, [autoFocus])\n\n let _rows = useMemo(() => {\n if (rows) return rows\n if (value && multiline) {\n let lines = (value as string).split(`\\n`).length\n if (minRows && minRows > lines) {\n return minRows\n } else if (maxRows && maxRows < lines) {\n return maxRows\n } else {\n return lines\n }\n }\n }, [value]) || 1\n\n const sizes: any = {\n small: {\n height: 38,\n gap: .5,\n fontSize: 'button',\n },\n medium: {\n height: 46,\n gap: 1,\n fontSize: \"text\"\n },\n large: {\n height: 52,\n gap: 1,\n fontSize: 'big'\n }\n }\n\n const _size = sizes[size]\n let borderColor = _focus ? color : (variant === \"fill\" ? \"transparent\" : `${color}.divider`)\n borderColor = error ? \"danger.divider\" : borderColor\n let multiprops: any = {}\n if (multiline) {\n multiprops = {\n rows: _rows,\n sx: {\n resize: \"none\"\n }\n }\n }\n\n return (\n <Tag\n width={fullWidth ? \"100%\" : \"auto\"}\n {...rest}\n ref={ref}\n baseClass=\"input-wrapper\"\n sxr={{\n display: 'flex',\n flexDirection: 'column',\n gap: .5,\n }}\n >\n {!!label && <Label {...slotProps?.label} ref={refs?.label}>{label}</Label>}\n <Tag\n {...slotProps?.inputRoot}\n ref={refs?.inputRoot}\n baseClass={'input-root'}\n sxr={{\n width: \"100%\",\n overflow: \"hidden\",\n }}\n >\n <Tag\n {...slotProps?.rootContainer}\n ref={refs?.rootContainer}\n baseClass='input-root-container'\n sxr={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n alignItems: iconPlacement === 'center' ? iconPlacement : `flex-${iconPlacement}`,\n flexWrap: \"nowrap\",\n transitionProperty: \"border, box-shadow, background\",\n bgcolor: error ? \"danger.ghost\" : variant === \"fill\" ? \"surface.light\" : \"transparent\",\n border: variant === \"text\" ? 0 : \"1px solid\",\n borderColor: borderColor,\n borderRadius: 1,\n px: 1,\n // py: .5,\n ..._size,\n height: multiline ? \"auto\" : _size.height,\n minHeight: _size.height,\n \"& > input:-webkit-autofill,& > input:-webkit-autofill:hover, & > input:-webkit-autofill:focus,& > input:-webkit-autofill:active\": {\n \"-webkit-text-fill-color\": \"surface.contrast\",\n \"box-shadow\": `0 0 0px 1000px ${variant === \"fill\" ? theme.colors.surface.light : theme.colors.surface.main} inset`,\n transition: \"background-color 5000s ease-in-out 0s\"\n } as any,\n \"& textarea\": {\n resize: \"none\"\n },\n\n ...(!!startIcon && {\n \"& > :first-child:not(.xui-input)\": {\n height: \"100%\",\n alignItems: 'center',\n justifyContent: \"center\",\n display: \"flex\",\n color: error ? \"danger.main\" : \"surface.muted\",\n flex: \"0 0 auto\",\n },\n }),\n\n ...(!!endIcon && {\n \"& > :last-child:not(.xui-input)\": {\n height: \"100%\",\n alignItems: 'center',\n justifyContent: \"center\",\n display: 'flex',\n color: error ? \"danger.main\" : \"surface.muted\",\n flex: \"0 0 auto\",\n },\n })\n\n }}\n disabled={disabled || false}\n >\n {startIcon}\n <Tag\n {...slotProps?.input}\n ref={inputMergeRef}\n baseClass='input'\n component={multiline ? 'textarea' : 'input'}\n {...multiprops}\n sxr={{\n border: 0,\n outline: 0,\n bgcolor: \"transparent\",\n color: error ? \"danger.main\" : \"surface.contrast\",\n fontSize: _size.fontSize,\n height: multiline ? \"auto\" : _size.height + \"px!important\",\n width: \"100%\",\n maxHeight: 200,\n }}\n value={value}\n onChange={onChange}\n onFocus={(e: any) => {\n focused ?? setFocused(true)\n onFocus && onFocus(e)\n }}\n onBlur={(e: any) => {\n focused ?? setFocused(false)\n onBlur && onBlur(e)\n }}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n name={name}\n placeholder={placeholder}\n type={type}\n readOnly={readOnly}\n autoComplete={autoComplete}\n />\n {endIcon}\n </Tag>\n {helperText && <Tag\n {...slotProps?.helperText}\n ref={refs?.helperText}\n baseClass=\"input-helper-text\"\n sxr={{\n color: error ? \"danger.main\" : \"surface.contrast\",\n fontSize: \"small\",\n lineHeight: \"text\",\n fontWeight: 'text',\n pl: .5,\n }}\n >{helperText}</Tag>}\n </Tag>\n </Tag>\n )\n})\n\nexport default Input\n"],"names":[],"mappings":";;;;;;;AA6DA;;;AACI;;AAmCA;AAAe;AACf;AAAa;AACb;AAAmB;AACnB;AAAW;AACX;AAAa;AACb;AAAgB;AAChB;AAAU;AACV;AAAU;AACV;AAAa;AACb;AAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;;;AAGA;;AAEA;;;;;AAKY;;;AAGZ;AAEA;AACI;AAAU;AACV;;AAEI;AACI;;AACG;AACH;;;AAEA;;;AAGZ;AAEA;AACI;AACI;AACA;AACA;AACH;AACD;AACI;AACA;AACA;AACH;AACD;AACI;AACA;AACA;AACH;;AAGL;;;;;AAKI;AACI;AACA;AACI;AACH;;;;AAWG;AACA;AACA;;AASI;AACA;AACH;AAuBW;;AAEA;AACI;AAEJ;AACH;AAGG;AACI;AACA;AACA;AACA;;AAEA;AACH;AACJ;AAGG;AACI;AACA;AACA;AACA;;AAEA;AACH;AACJ;AAaG;AACA;AACA;;;AAGA;AACA;AACA;AACH;;AAKG;AACJ;;AAGI;AACJ;;AAiBA;AACA;AACA;AACA;AACH;AAKrB;;"}
|
package/InputNumber/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import { InputProps } from '../Input/index.js';
|
|
3
3
|
|
|
4
4
|
type InputNumberProps = Omit<InputProps, "value"> & {
|
|
5
5
|
value?: number | "";
|
|
6
6
|
};
|
|
7
|
-
declare const InputNumber:
|
|
7
|
+
declare const InputNumber: React__default.ForwardRefExoticComponent<Omit<InputNumberProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
8
8
|
|
|
9
9
|
export { InputNumber as default };
|
|
10
10
|
export type { InputNumberProps };
|
package/Label/index.cjs
CHANGED
package/Label/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/Label/index.tsx"],"sourcesContent":["\"use client\"\nimport React from 'react';\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\n\nexport type LabelProps<T extends TagComponentType = \"label\"> = TagProps<T>\n\nconst Label = React.forwardRef(<T extends TagComponentType = \"label\">({ children, ...rest }: LabelProps<T>, ref: React.Ref<any>) => {\n return <Tag\n component='label'\n {...rest}\n sxr={{\n display: \"inline-flex\",\n alignItems: \"center\",\n verticalAlign: \"middle\",\n fontSize: \"text\",\n gap: .4,\n color: \"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Label/index.tsx"],"sourcesContent":["\"use client\"\nimport React from 'react';\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\n\nexport type LabelProps<T extends TagComponentType = \"label\"> = TagProps<T>\n\nconst Label = React.forwardRef(<T extends TagComponentType = \"label\">({ children, ...rest }: LabelProps<T>, ref: React.Ref<any>) => {\n return <Tag\n component='label'\n {...rest}\n sxr={{\n display: \"inline-flex\",\n alignItems: \"center\",\n verticalAlign: \"middle\",\n fontSize: \"text\",\n gap: .4,\n color: \"surface.contrast\",\n userSelect: \"none\",\n cursor: \"pointer\",\n fontWeight: \"500\",\n }}\n baseClass='label'\n ref={ref}\n >{children}</Tag>\n})\n\nexport default Label"],"names":[],"mappings":";;;;;;;;AAMA;AAAsE;;AAK1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKZ;;"}
|
package/Label/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import { TagComponentType, TagProps } from '@xanui/core';
|
|
3
3
|
|
|
4
4
|
type LabelProps<T extends TagComponentType = "label"> = TagProps<T>;
|
|
5
|
-
declare const Label:
|
|
5
|
+
declare const Label: React__default.ForwardRefExoticComponent<Omit<LabelProps<TagComponentType>, "ref"> & React__default.RefAttributes<any>>;
|
|
6
6
|
|
|
7
7
|
export { Label as default };
|
|
8
8
|
export type { LabelProps };
|
package/Label/index.js
CHANGED
package/Label/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Label/index.tsx"],"sourcesContent":["\"use client\"\nimport React from 'react';\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\n\nexport type LabelProps<T extends TagComponentType = \"label\"> = TagProps<T>\n\nconst Label = React.forwardRef(<T extends TagComponentType = \"label\">({ children, ...rest }: LabelProps<T>, ref: React.Ref<any>) => {\n return <Tag\n component='label'\n {...rest}\n sxr={{\n display: \"inline-flex\",\n alignItems: \"center\",\n verticalAlign: \"middle\",\n fontSize: \"text\",\n gap: .4,\n color: \"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Label/index.tsx"],"sourcesContent":["\"use client\"\nimport React from 'react';\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\n\nexport type LabelProps<T extends TagComponentType = \"label\"> = TagProps<T>\n\nconst Label = React.forwardRef(<T extends TagComponentType = \"label\">({ children, ...rest }: LabelProps<T>, ref: React.Ref<any>) => {\n return <Tag\n component='label'\n {...rest}\n sxr={{\n display: \"inline-flex\",\n alignItems: \"center\",\n verticalAlign: \"middle\",\n fontSize: \"text\",\n gap: .4,\n color: \"surface.contrast\",\n userSelect: \"none\",\n cursor: \"pointer\",\n fontWeight: \"500\",\n }}\n baseClass='label'\n ref={ref}\n >{children}</Tag>\n})\n\nexport default Label"],"names":[],"mappings":";;;;;;AAMA;AAAsE;;AAK1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKZ;;"}
|
package/Layer/index.cjs
CHANGED
|
@@ -11,7 +11,7 @@ var index$1 = require('../ClickOutside/index.cjs');
|
|
|
11
11
|
const Layer = (_a) => {
|
|
12
12
|
var _b, _c, _d;
|
|
13
13
|
var { children, open } = _a, props = tslib.__rest(_a, ["children", "open"]);
|
|
14
|
-
let [{ onClickOutside, placement, transition, zIndex, blur, blurMode,
|
|
14
|
+
let [{ onClickOutside, placement, transition, zIndex, blur, blurMode, onEnter, onEntered, onExit, onExited, slotProps }] = core.useInterface("Layer", props, {});
|
|
15
15
|
const _p = {};
|
|
16
16
|
if (blur)
|
|
17
17
|
_p.blur = blur;
|
|
@@ -20,33 +20,32 @@ const Layer = (_a) => {
|
|
|
20
20
|
const p = core.useBreakpointProps(_p);
|
|
21
21
|
blur = p.blur;
|
|
22
22
|
blurMode = p.blurMode;
|
|
23
|
-
const [
|
|
23
|
+
const [exited, setExited] = React.useState(!open);
|
|
24
24
|
placement = placement || "bottom-left";
|
|
25
25
|
const blurCss = blur ? index(blur, blurMode) : {};
|
|
26
26
|
React.useEffect(() => {
|
|
27
|
-
if (
|
|
28
|
-
|
|
27
|
+
if (exited && open) {
|
|
28
|
+
setExited(false);
|
|
29
29
|
}
|
|
30
30
|
}, [open]);
|
|
31
|
-
if (
|
|
32
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
31
|
+
// if (exited) return <></>
|
|
33
32
|
let duration = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition) === null || _b === void 0 ? void 0 : _b.duration) || 300;
|
|
34
33
|
let delay = ((_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition) === null || _c === void 0 ? void 0 : _c.delay) || 0;
|
|
35
|
-
let content = jsxRuntime.jsx(core.Transition, Object.assign({ duration: duration, delay: delay, easing: "standard", variant: transition || "zoomOver" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition, { open: open,
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
let content = jsxRuntime.jsx(core.Transition, Object.assign({ duration: duration, delay: delay, easing: "standard", variant: transition || "zoomOver" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition, { open: open, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExited: () => {
|
|
35
|
+
setExited(true);
|
|
36
|
+
onExited && onExited();
|
|
38
37
|
}, children: children }));
|
|
39
|
-
return (jsxRuntime.jsx(core.Transition, { duration: duration, delay: delay, easing: "smooth", variant: "fade", open: open, children: jsxRuntime.jsx(core.Tag, Object.assign({ baseClass: "layer" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.root, { sxr: Object.assign(Object.assign(Object.assign({}, (_d = slotProps === null || slotProps === void 0 ? void 0 : slotProps.root) === null || _d === void 0 ? void 0 : _d.sx), { position: "fixed", zIndex: 1500 + (zIndex || 0), top: 0, left: 0, bottom: 0, right: 0, width: "100%", height: "100%" }), blurCss), children: onClickOutside ? jsxRuntime.jsx(index$1, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.clickOutside, { onClickOutside: onClickOutside || (() => { }), children: content })) : content })) }));
|
|
38
|
+
return (jsxRuntime.jsx(core.Transition, { duration: duration, delay: delay, easing: "smooth", variant: "fade", open: open, exitOnUnmount: true, initialTransition: false, children: jsxRuntime.jsx(core.Tag, Object.assign({ baseClass: "layer" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.root, { sxr: Object.assign(Object.assign(Object.assign({}, (_d = slotProps === null || slotProps === void 0 ? void 0 : slotProps.root) === null || _d === void 0 ? void 0 : _d.sx), { position: "fixed", zIndex: 1500 + (zIndex || 0), top: 0, left: 0, bottom: 0, right: 0, width: "100%", height: "100%" }), blurCss), children: onClickOutside ? jsxRuntime.jsx(index$1, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.clickOutside, { onClickOutside: onClickOutside || (() => { }), children: content })) : content })) }));
|
|
40
39
|
};
|
|
41
40
|
Layer.open = (Children, props) => {
|
|
42
41
|
const InstanceLayer = (_a) => {
|
|
43
42
|
var { children } = _a, props = tslib.__rest(_a, ["children"]);
|
|
44
43
|
return jsxRuntime.jsx(Layer, Object.assign({}, props, { children: children }));
|
|
45
44
|
};
|
|
46
|
-
const l = core.Renderar.render(InstanceLayer, Object.assign(Object.assign({}, props), { open: true, children: typeof Children === "function" ? jsxRuntime.jsx(Children, { open: () => l.updateProps({ open: true }), close: () => l.updateProps({ open: false }) }) : Children,
|
|
45
|
+
const l = core.Renderar.render(InstanceLayer, Object.assign(Object.assign({}, props), { open: true, children: typeof Children === "function" ? jsxRuntime.jsx(Children, { open: () => l.updateProps({ open: true }), close: () => l.updateProps({ open: false }) }) : Children, onExited: () => {
|
|
47
46
|
core.Renderar.unrender(InstanceLayer);
|
|
48
|
-
if (props === null || props === void 0 ? void 0 : props.
|
|
49
|
-
props.
|
|
47
|
+
if (props === null || props === void 0 ? void 0 : props.onExited) {
|
|
48
|
+
props.onExited();
|
|
50
49
|
}
|
|
51
50
|
} }));
|
|
52
51
|
return {
|
package/Layer/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/Layer/index.tsx"],"sourcesContent":["\"use client\";\nimport { ReactNode, useEffect, useState } from 'react'\nimport { Tag, TagProps, useBreakpointProps, useBreakpointPropsType, useInterface, TransitionProps, Transition } from \"@xanui/core\"\nimport useBlurCss from '../useBlurCss';\nimport { Renderar } from \"@xanui/core\";\nimport ClickOutside, { ClickOutsideProps } from '../ClickOutside';\n\nexport type LayerProps = {\n open: boolean;\n children: ReactNode;\n transition?: TransitionProps['variant'];\n zIndex?: number;\n blur?: useBreakpointPropsType<number>\n blurMode?: useBreakpointPropsType<\"blur\" | \"transparent\">\n onClickOutside?: () => void;\n
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Layer/index.tsx"],"sourcesContent":["\"use client\";\nimport { ReactNode, useEffect, useState } from 'react'\nimport { Tag, TagProps, useBreakpointProps, useBreakpointPropsType, useInterface, TransitionProps, Transition } from \"@xanui/core\"\nimport useBlurCss from '../useBlurCss';\nimport { Renderar } from \"@xanui/core\";\nimport ClickOutside, { ClickOutsideProps } from '../ClickOutside';\n// import Transition from '../Transition';\n\nexport type LayerProps = {\n open: boolean;\n children: ReactNode;\n transition?: TransitionProps['variant'];\n zIndex?: number;\n blur?: useBreakpointPropsType<number>\n blurMode?: useBreakpointPropsType<\"blur\" | \"transparent\">\n onClickOutside?: () => void;\n onEnter?: TransitionProps[\"onEnter\"];\n onEntered?: TransitionProps['onEntered'];\n onExit?: TransitionProps['onExit'];\n onExited?: TransitionProps['onExited'];\n slotProps?: {\n root?: Omit<TagProps<\"div\">, \"children\">;\n transition?: Omit<TransitionProps, \"children\" | \"open\" | \"variant\" | \"onExit\" | \"onExited\" | \"onEnter\" | \"onEntered\">;\n content?: Omit<TagProps<\"div\">, \"children\">;\n clickOutside?: Omit<ClickOutsideProps, \"children\" | \"onClickOutside\">;\n }\n}\n\nexport type ActionLayerFunctionChildreProps = {\n open: Function,\n close: Function\n}\nexport type ActionLayerChildren = ReactNode | ((props: ActionLayerFunctionChildreProps) => ReactNode)\n\nconst Layer = ({ children, open, ...props }: LayerProps) => {\n let [{\n onClickOutside,\n placement,\n transition,\n zIndex,\n blur,\n blurMode,\n onEnter,\n onEntered,\n onExit,\n onExited,\n slotProps\n }] = useInterface<any>(\"Layer\", props, {})\n\n const _p: any = {}\n if (blur) _p.blur = blur\n if (blurMode) _p.blurMode = blurMode\n const p: any = useBreakpointProps(_p)\n\n blur = p.blur\n blurMode = p.blurMode\n\n const [exited, setExited] = useState(!open)\n placement = placement || \"bottom-left\"\n const blurCss = blur ? useBlurCss(blur, blurMode) : {}\n\n useEffect(() => {\n if (exited && open) {\n setExited(false)\n }\n }, [open])\n\n // if (exited) return <></>\n let duration = slotProps?.transition?.duration || 300\n let delay = slotProps?.transition?.delay || 0\n\n let content = <Transition\n duration={duration}\n delay={delay}\n easing=\"standard\"\n variant={transition || \"zoomOver\"}\n {...slotProps?.transition}\n open={open}\n onEnter={onEnter}\n onEntered={onEntered}\n onExit={onExit}\n onExited={() => {\n setExited(true)\n onExited && onExited()\n }}\n >\n {children}\n </Transition>\n\n return (\n <Transition\n duration={duration}\n delay={delay}\n easing=\"smooth\"\n variant={\"fade\"}\n open={open}\n exitOnUnmount\n initialTransition={false}\n >\n <Tag\n baseClass=\"layer\"\n {...slotProps?.root}\n sxr={{\n ...slotProps?.root?.sx,\n position: \"fixed\",\n zIndex: 1500 + (zIndex || 0),\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n width: \"100%\",\n height: \"100%\",\n ...blurCss\n }}\n >\n {\n onClickOutside ? <ClickOutside\n {...slotProps?.clickOutside}\n onClickOutside={onClickOutside || (() => { })}\n >\n {content}\n </ClickOutside> : content\n }\n </Tag>\n </Transition>\n )\n}\n\nLayer.open = (Children: ActionLayerChildren, props?: Partial<Omit<LayerProps, 'children'>>) => {\n const InstanceLayer = ({ children, ...props }: LayerProps) => <Layer {...props} >{children}</Layer>;\n const l = Renderar.render(InstanceLayer as any, {\n ...props,\n open: true,\n children: typeof Children === \"function\" ? <Children\n open={() => l.updateProps({ open: true })}\n close={() => l.updateProps({ open: false })}\n /> : Children,\n onExited: () => {\n Renderar.unrender(InstanceLayer as any)\n if (props?.onExited) {\n props.onExited()\n }\n }\n })\n return {\n open: () => {\n l.updateProps({ open: true })\n },\n close: () => {\n l.updateProps({ open: false })\n },\n }\n}\n\nexport default Layer"],"names":[],"mappings":";;;;;;;;;;AAkCA;;;AACI;;AAeA;AAAU;AACV;AAAc;AACd;AAEA;AACA;;AAGA;AACA;;AAGI;;;AAGJ;;AAGA;AACA;;;;;AAoBA;AAqCJ;AAEA;AACI;AAAuB;AAAuC;;AAC9D;AAQQ;;;;AAIJ;;;;;;;;;AAUR;;"}
|
package/Layer/index.d.ts
CHANGED
|
@@ -11,13 +11,13 @@ type LayerProps = {
|
|
|
11
11
|
blur?: useBreakpointPropsType<number>;
|
|
12
12
|
blurMode?: useBreakpointPropsType<"blur" | "transparent">;
|
|
13
13
|
onClickOutside?: () => void;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
onEnter?: TransitionProps["onEnter"];
|
|
15
|
+
onEntered?: TransitionProps['onEntered'];
|
|
16
|
+
onExit?: TransitionProps['onExit'];
|
|
17
|
+
onExited?: TransitionProps['onExited'];
|
|
18
18
|
slotProps?: {
|
|
19
19
|
root?: Omit<TagProps<"div">, "children">;
|
|
20
|
-
transition?: Omit<TransitionProps, "children" | "open" | "variant" | "
|
|
20
|
+
transition?: Omit<TransitionProps, "children" | "open" | "variant" | "onExit" | "onExited" | "onEnter" | "onEntered">;
|
|
21
21
|
content?: Omit<TagProps<"div">, "children">;
|
|
22
22
|
clickOutside?: Omit<ClickOutsideProps, "children" | "onClickOutside">;
|
|
23
23
|
};
|
package/Layer/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { __rest } from 'tslib';
|
|
3
|
-
import { jsx
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { useState, useEffect } from 'react';
|
|
5
5
|
import { useInterface, useBreakpointProps, Transition, Tag, Renderar } from '@xanui/core';
|
|
6
6
|
import useBlurCss from '../useBlurCss/index.js';
|
|
@@ -9,7 +9,7 @@ import ClickOutside from '../ClickOutside/index.js';
|
|
|
9
9
|
const Layer = (_a) => {
|
|
10
10
|
var _b, _c, _d;
|
|
11
11
|
var { children, open } = _a, props = __rest(_a, ["children", "open"]);
|
|
12
|
-
let [{ onClickOutside, placement, transition, zIndex, blur, blurMode,
|
|
12
|
+
let [{ onClickOutside, placement, transition, zIndex, blur, blurMode, onEnter, onEntered, onExit, onExited, slotProps }] = useInterface("Layer", props, {});
|
|
13
13
|
const _p = {};
|
|
14
14
|
if (blur)
|
|
15
15
|
_p.blur = blur;
|
|
@@ -18,33 +18,32 @@ const Layer = (_a) => {
|
|
|
18
18
|
const p = useBreakpointProps(_p);
|
|
19
19
|
blur = p.blur;
|
|
20
20
|
blurMode = p.blurMode;
|
|
21
|
-
const [
|
|
21
|
+
const [exited, setExited] = useState(!open);
|
|
22
22
|
placement = placement || "bottom-left";
|
|
23
23
|
const blurCss = blur ? useBlurCss(blur, blurMode) : {};
|
|
24
24
|
useEffect(() => {
|
|
25
|
-
if (
|
|
26
|
-
|
|
25
|
+
if (exited && open) {
|
|
26
|
+
setExited(false);
|
|
27
27
|
}
|
|
28
28
|
}, [open]);
|
|
29
|
-
if (
|
|
30
|
-
return jsx(Fragment, {});
|
|
29
|
+
// if (exited) return <></>
|
|
31
30
|
let duration = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition) === null || _b === void 0 ? void 0 : _b.duration) || 300;
|
|
32
31
|
let delay = ((_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition) === null || _c === void 0 ? void 0 : _c.delay) || 0;
|
|
33
|
-
let content = jsx(Transition, Object.assign({ duration: duration, delay: delay, easing: "standard", variant: transition || "zoomOver" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition, { open: open,
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
let content = jsx(Transition, Object.assign({ duration: duration, delay: delay, easing: "standard", variant: transition || "zoomOver" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition, { open: open, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExited: () => {
|
|
33
|
+
setExited(true);
|
|
34
|
+
onExited && onExited();
|
|
36
35
|
}, children: children }));
|
|
37
|
-
return (jsx(Transition, { duration: duration, delay: delay, easing: "smooth", variant: "fade", open: open, children: jsx(Tag, Object.assign({ baseClass: "layer" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.root, { sxr: Object.assign(Object.assign(Object.assign({}, (_d = slotProps === null || slotProps === void 0 ? void 0 : slotProps.root) === null || _d === void 0 ? void 0 : _d.sx), { position: "fixed", zIndex: 1500 + (zIndex || 0), top: 0, left: 0, bottom: 0, right: 0, width: "100%", height: "100%" }), blurCss), children: onClickOutside ? jsx(ClickOutside, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.clickOutside, { onClickOutside: onClickOutside || (() => { }), children: content })) : content })) }));
|
|
36
|
+
return (jsx(Transition, { duration: duration, delay: delay, easing: "smooth", variant: "fade", open: open, exitOnUnmount: true, initialTransition: false, children: jsx(Tag, Object.assign({ baseClass: "layer" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.root, { sxr: Object.assign(Object.assign(Object.assign({}, (_d = slotProps === null || slotProps === void 0 ? void 0 : slotProps.root) === null || _d === void 0 ? void 0 : _d.sx), { position: "fixed", zIndex: 1500 + (zIndex || 0), top: 0, left: 0, bottom: 0, right: 0, width: "100%", height: "100%" }), blurCss), children: onClickOutside ? jsx(ClickOutside, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.clickOutside, { onClickOutside: onClickOutside || (() => { }), children: content })) : content })) }));
|
|
38
37
|
};
|
|
39
38
|
Layer.open = (Children, props) => {
|
|
40
39
|
const InstanceLayer = (_a) => {
|
|
41
40
|
var { children } = _a, props = __rest(_a, ["children"]);
|
|
42
41
|
return jsx(Layer, Object.assign({}, props, { children: children }));
|
|
43
42
|
};
|
|
44
|
-
const l = Renderar.render(InstanceLayer, Object.assign(Object.assign({}, props), { open: true, children: typeof Children === "function" ? jsx(Children, { open: () => l.updateProps({ open: true }), close: () => l.updateProps({ open: false }) }) : Children,
|
|
43
|
+
const l = Renderar.render(InstanceLayer, Object.assign(Object.assign({}, props), { open: true, children: typeof Children === "function" ? jsx(Children, { open: () => l.updateProps({ open: true }), close: () => l.updateProps({ open: false }) }) : Children, onExited: () => {
|
|
45
44
|
Renderar.unrender(InstanceLayer);
|
|
46
|
-
if (props === null || props === void 0 ? void 0 : props.
|
|
47
|
-
props.
|
|
45
|
+
if (props === null || props === void 0 ? void 0 : props.onExited) {
|
|
46
|
+
props.onExited();
|
|
48
47
|
}
|
|
49
48
|
} }));
|
|
50
49
|
return {
|
package/Layer/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Layer/index.tsx"],"sourcesContent":["\"use client\";\nimport { ReactNode, useEffect, useState } from 'react'\nimport { Tag, TagProps, useBreakpointProps, useBreakpointPropsType, useInterface, TransitionProps, Transition } from \"@xanui/core\"\nimport useBlurCss from '../useBlurCss';\nimport { Renderar } from \"@xanui/core\";\nimport ClickOutside, { ClickOutsideProps } from '../ClickOutside';\n\nexport type LayerProps = {\n open: boolean;\n children: ReactNode;\n transition?: TransitionProps['variant'];\n zIndex?: number;\n blur?: useBreakpointPropsType<number>\n blurMode?: useBreakpointPropsType<\"blur\" | \"transparent\">\n onClickOutside?: () => void;\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Layer/index.tsx"],"sourcesContent":["\"use client\";\nimport { ReactNode, useEffect, useState } from 'react'\nimport { Tag, TagProps, useBreakpointProps, useBreakpointPropsType, useInterface, TransitionProps, Transition } from \"@xanui/core\"\nimport useBlurCss from '../useBlurCss';\nimport { Renderar } from \"@xanui/core\";\nimport ClickOutside, { ClickOutsideProps } from '../ClickOutside';\n// import Transition from '../Transition';\n\nexport type LayerProps = {\n open: boolean;\n children: ReactNode;\n transition?: TransitionProps['variant'];\n zIndex?: number;\n blur?: useBreakpointPropsType<number>\n blurMode?: useBreakpointPropsType<\"blur\" | \"transparent\">\n onClickOutside?: () => void;\n onEnter?: TransitionProps[\"onEnter\"];\n onEntered?: TransitionProps['onEntered'];\n onExit?: TransitionProps['onExit'];\n onExited?: TransitionProps['onExited'];\n slotProps?: {\n root?: Omit<TagProps<\"div\">, \"children\">;\n transition?: Omit<TransitionProps, \"children\" | \"open\" | \"variant\" | \"onExit\" | \"onExited\" | \"onEnter\" | \"onEntered\">;\n content?: Omit<TagProps<\"div\">, \"children\">;\n clickOutside?: Omit<ClickOutsideProps, \"children\" | \"onClickOutside\">;\n }\n}\n\nexport type ActionLayerFunctionChildreProps = {\n open: Function,\n close: Function\n}\nexport type ActionLayerChildren = ReactNode | ((props: ActionLayerFunctionChildreProps) => ReactNode)\n\nconst Layer = ({ children, open, ...props }: LayerProps) => {\n let [{\n onClickOutside,\n placement,\n transition,\n zIndex,\n blur,\n blurMode,\n onEnter,\n onEntered,\n onExit,\n onExited,\n slotProps\n }] = useInterface<any>(\"Layer\", props, {})\n\n const _p: any = {}\n if (blur) _p.blur = blur\n if (blurMode) _p.blurMode = blurMode\n const p: any = useBreakpointProps(_p)\n\n blur = p.blur\n blurMode = p.blurMode\n\n const [exited, setExited] = useState(!open)\n placement = placement || \"bottom-left\"\n const blurCss = blur ? useBlurCss(blur, blurMode) : {}\n\n useEffect(() => {\n if (exited && open) {\n setExited(false)\n }\n }, [open])\n\n // if (exited) return <></>\n let duration = slotProps?.transition?.duration || 300\n let delay = slotProps?.transition?.delay || 0\n\n let content = <Transition\n duration={duration}\n delay={delay}\n easing=\"standard\"\n variant={transition || \"zoomOver\"}\n {...slotProps?.transition}\n open={open}\n onEnter={onEnter}\n onEntered={onEntered}\n onExit={onExit}\n onExited={() => {\n setExited(true)\n onExited && onExited()\n }}\n >\n {children}\n </Transition>\n\n return (\n <Transition\n duration={duration}\n delay={delay}\n easing=\"smooth\"\n variant={\"fade\"}\n open={open}\n exitOnUnmount\n initialTransition={false}\n >\n <Tag\n baseClass=\"layer\"\n {...slotProps?.root}\n sxr={{\n ...slotProps?.root?.sx,\n position: \"fixed\",\n zIndex: 1500 + (zIndex || 0),\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n width: \"100%\",\n height: \"100%\",\n ...blurCss\n }}\n >\n {\n onClickOutside ? <ClickOutside\n {...slotProps?.clickOutside}\n onClickOutside={onClickOutside || (() => { })}\n >\n {content}\n </ClickOutside> : content\n }\n </Tag>\n </Transition>\n )\n}\n\nLayer.open = (Children: ActionLayerChildren, props?: Partial<Omit<LayerProps, 'children'>>) => {\n const InstanceLayer = ({ children, ...props }: LayerProps) => <Layer {...props} >{children}</Layer>;\n const l = Renderar.render(InstanceLayer as any, {\n ...props,\n open: true,\n children: typeof Children === \"function\" ? <Children\n open={() => l.updateProps({ open: true })}\n close={() => l.updateProps({ open: false })}\n /> : Children,\n onExited: () => {\n Renderar.unrender(InstanceLayer as any)\n if (props?.onExited) {\n props.onExited()\n }\n }\n })\n return {\n open: () => {\n l.updateProps({ open: true })\n },\n close: () => {\n l.updateProps({ open: false })\n },\n }\n}\n\nexport default Layer"],"names":[],"mappings":";;;;;;;;AAkCA;;;AACI;;AAeA;AAAU;AACV;AAAc;AACd;AAEA;AACA;;AAGA;AACA;;AAGI;;;AAGJ;;AAGA;AACA;;;;;AAoBA;AAqCJ;AAEA;AACI;AAAuB;AAAuC;;AAC9D;AAQQ;;;;AAIJ;;;;;;;;;AAUR;;"}
|
package/LineProgress/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@ var React = require('react');
|
|
|
7
7
|
var core = require('@xanui/core');
|
|
8
8
|
|
|
9
9
|
const LineProgress = React.forwardRef((_a, ref) => {
|
|
10
|
-
var _b, _c;
|
|
10
|
+
var _b, _c, _d;
|
|
11
11
|
var { children } = _a, props = tslib.__rest(_a, ["children"]);
|
|
12
12
|
const uid = "line-progress" + React.useId().replace(":", "");
|
|
13
13
|
let [{ color, value, thumbSize, hideTrack, speed }] = core.useInterface("LineProgress", props, {});
|
|
@@ -24,10 +24,10 @@ const LineProgress = React.forwardRef((_a, ref) => {
|
|
|
24
24
|
_p.speed = speed;
|
|
25
25
|
const p = core.useBreakpointProps(_p);
|
|
26
26
|
thumbSize = (_b = p.thumbSize) !== null && _b !== void 0 ? _b : 4;
|
|
27
|
-
color = (_c = p.color) !== null && _c !== void 0 ? _c : "
|
|
27
|
+
color = (_c = p.color) !== null && _c !== void 0 ? _c : "primary";
|
|
28
28
|
value = p.value;
|
|
29
29
|
hideTrack = p.hideTrack;
|
|
30
|
-
speed = p.speed;
|
|
30
|
+
speed = (_d = p.speed) !== null && _d !== void 0 ? _d : 1;
|
|
31
31
|
let isVal = typeof value === 'number';
|
|
32
32
|
if (isVal && value > 100)
|
|
33
33
|
value = 100;
|
|
@@ -38,15 +38,15 @@ const LineProgress = React.forwardRef((_a, ref) => {
|
|
|
38
38
|
height: thumbSize,
|
|
39
39
|
position: "relative",
|
|
40
40
|
overflow: "hidden",
|
|
41
|
-
bgcolor: hideTrack ? "transparent" :
|
|
41
|
+
bgcolor: hideTrack ? "transparent" : `surface.divider`,
|
|
42
42
|
radius: 2,
|
|
43
43
|
}, ref: ref, children: jsxRuntime.jsx(core.Tag, { component: "span", baseClass: "line-progress-thumb", sxr: {
|
|
44
|
-
bgcolor: color === '
|
|
44
|
+
bgcolor: color === 'surface' ? `surface.contrast` : `${color}`,
|
|
45
45
|
width: isVal ? `${value}%` : "50%",
|
|
46
46
|
height: thumbSize,
|
|
47
47
|
position: "absolute",
|
|
48
48
|
left: 0,
|
|
49
|
-
animation: isVal ? "none" : `${uid} ${speed
|
|
49
|
+
animation: isVal ? "none" : `${uid} ${speed}s linear infinite`,
|
|
50
50
|
[`@keyframes ${uid}`]: {
|
|
51
51
|
"0%": { left: "-40%" },
|
|
52
52
|
"50%": { left: "20%", width: "80%" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/LineProgress/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { ReactElement, useId } from \"react\"\nimport { Tag, useBreakpointProps, UseColorTemplateColor, useInterface, useBreakpointPropsType } from '@xanui/core';\n\nexport type LineProgressProps = {\n children?: ReactElement;\n thumbSize?: useBreakpointPropsType<number>;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n value?: useBreakpointPropsType<number>;\n hideTrack?: useBreakpointPropsType<boolean>;\n speed?: useBreakpointPropsType<number>;\n}\n\n\nconst LineProgress = React.forwardRef(({ children, ...props }: LineProgressProps, ref: React.Ref<any>) => {\n const uid = \"line-progress\" + useId().replace(\":\", \"\")\n let [{ color, value, thumbSize, hideTrack, speed }] = useInterface<any>(\"LineProgress\", props, {})\n const _p: any = {}\n if (thumbSize) _p.thumbSize = thumbSize\n if (color) _p.color = color\n if (value) _p.value = value\n if (hideTrack) _p.hideTrack = hideTrack\n if (speed) _p.speed = speed\n const p: any = useBreakpointProps(_p)\n\n thumbSize = p.thumbSize ?? 4\n color = p.color ?? \"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/LineProgress/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { ReactElement, useId } from \"react\"\nimport { Tag, useBreakpointProps, UseColorTemplateColor, useInterface, useBreakpointPropsType } from '@xanui/core';\n\nexport type LineProgressProps = {\n children?: ReactElement;\n thumbSize?: useBreakpointPropsType<number>;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n value?: useBreakpointPropsType<number>;\n hideTrack?: useBreakpointPropsType<boolean>;\n speed?: useBreakpointPropsType<number>;\n}\n\n\nconst LineProgress = React.forwardRef(({ children, ...props }: LineProgressProps, ref: React.Ref<any>) => {\n const uid = \"line-progress\" + useId().replace(\":\", \"\")\n let [{ color, value, thumbSize, hideTrack, speed }] = useInterface<any>(\"LineProgress\", props, {})\n const _p: any = {}\n if (thumbSize) _p.thumbSize = thumbSize\n if (color) _p.color = color\n if (value) _p.value = value\n if (hideTrack) _p.hideTrack = hideTrack\n if (speed) _p.speed = speed\n const p: any = useBreakpointProps(_p)\n\n thumbSize = p.thumbSize ?? 4\n color = p.color ?? \"primary\"\n value = p.value\n hideTrack = p.hideTrack\n speed = p.speed ?? 1\n\n let isVal = typeof value === 'number'\n if (isVal && (value as number) > 100) value = 100\n\n return (\n <Tag\n baseClass='line-progress'\n sxr={{\n display: \"flex\",\n alignItems: \"center\",\n width: '100%',\n height: thumbSize,\n position: \"relative\",\n overflow: \"hidden\",\n bgcolor: hideTrack ? \"transparent\" : `surface.divider`,\n radius: 2,\n }}\n ref={ref}\n >\n <Tag\n component=\"span\"\n baseClass=\"line-progress-thumb\"\n sxr={{\n bgcolor: color === 'surface' ? `surface.contrast` : `${color}`,\n width: isVal ? `${value}%` : \"50%\",\n height: thumbSize,\n position: \"absolute\",\n left: 0,\n animation: isVal ? \"none\" : `${uid} ${speed}s linear infinite`,\n [`@keyframes ${uid}`]: {\n \"0%\": { left: \"-40%\" },\n \"50%\": { left: \"20%\", width: \"80%\" },\n \"100%\": { left: \"100%\", width: \"100%\" }\n }\n }}\n />\n </Tag >\n )\n})\n\nexport default LineProgress\n\n"],"names":[],"mappings":";;;;;;;;AAcA;;AAAuC;AACnC;;;AAGA;AAAe;AACf;AAAW;AACX;AAAW;AACX;AAAe;AACf;AAAW;AACX;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;;;AAMY;AACA;AACA;AACA;AACA;AACA;;AAEA;AACH;AAOO;;AAEA;AACA;AACA;AACA;AACA;AACI;;;AAGH;;AAKrB;;"}
|
package/LineProgress/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { ReactElement } from 'react';
|
|
2
2
|
import { useBreakpointPropsType, UseColorTemplateColor } from '@xanui/core';
|
|
3
3
|
|
|
4
4
|
type LineProgressProps = {
|
|
@@ -9,7 +9,7 @@ type LineProgressProps = {
|
|
|
9
9
|
hideTrack?: useBreakpointPropsType<boolean>;
|
|
10
10
|
speed?: useBreakpointPropsType<number>;
|
|
11
11
|
};
|
|
12
|
-
declare const LineProgress:
|
|
12
|
+
declare const LineProgress: React__default.ForwardRefExoticComponent<LineProgressProps & React__default.RefAttributes<any>>;
|
|
13
13
|
|
|
14
14
|
export { LineProgress as default };
|
|
15
15
|
export type { LineProgressProps };
|
package/LineProgress/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import React, { useId } from 'react';
|
|
|
5
5
|
import { useInterface, useBreakpointProps, Tag } from '@xanui/core';
|
|
6
6
|
|
|
7
7
|
const LineProgress = React.forwardRef((_a, ref) => {
|
|
8
|
-
var _b, _c;
|
|
8
|
+
var _b, _c, _d;
|
|
9
9
|
var { children } = _a, props = __rest(_a, ["children"]);
|
|
10
10
|
const uid = "line-progress" + useId().replace(":", "");
|
|
11
11
|
let [{ color, value, thumbSize, hideTrack, speed }] = useInterface("LineProgress", props, {});
|
|
@@ -22,10 +22,10 @@ const LineProgress = React.forwardRef((_a, ref) => {
|
|
|
22
22
|
_p.speed = speed;
|
|
23
23
|
const p = useBreakpointProps(_p);
|
|
24
24
|
thumbSize = (_b = p.thumbSize) !== null && _b !== void 0 ? _b : 4;
|
|
25
|
-
color = (_c = p.color) !== null && _c !== void 0 ? _c : "
|
|
25
|
+
color = (_c = p.color) !== null && _c !== void 0 ? _c : "primary";
|
|
26
26
|
value = p.value;
|
|
27
27
|
hideTrack = p.hideTrack;
|
|
28
|
-
speed = p.speed;
|
|
28
|
+
speed = (_d = p.speed) !== null && _d !== void 0 ? _d : 1;
|
|
29
29
|
let isVal = typeof value === 'number';
|
|
30
30
|
if (isVal && value > 100)
|
|
31
31
|
value = 100;
|
|
@@ -36,15 +36,15 @@ const LineProgress = React.forwardRef((_a, ref) => {
|
|
|
36
36
|
height: thumbSize,
|
|
37
37
|
position: "relative",
|
|
38
38
|
overflow: "hidden",
|
|
39
|
-
bgcolor: hideTrack ? "transparent" :
|
|
39
|
+
bgcolor: hideTrack ? "transparent" : `surface.divider`,
|
|
40
40
|
radius: 2,
|
|
41
41
|
}, ref: ref, children: jsx(Tag, { component: "span", baseClass: "line-progress-thumb", sxr: {
|
|
42
|
-
bgcolor: color === '
|
|
42
|
+
bgcolor: color === 'surface' ? `surface.contrast` : `${color}`,
|
|
43
43
|
width: isVal ? `${value}%` : "50%",
|
|
44
44
|
height: thumbSize,
|
|
45
45
|
position: "absolute",
|
|
46
46
|
left: 0,
|
|
47
|
-
animation: isVal ? "none" : `${uid} ${speed
|
|
47
|
+
animation: isVal ? "none" : `${uid} ${speed}s linear infinite`,
|
|
48
48
|
[`@keyframes ${uid}`]: {
|
|
49
49
|
"0%": { left: "-40%" },
|
|
50
50
|
"50%": { left: "20%", width: "80%" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/LineProgress/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { ReactElement, useId } from \"react\"\nimport { Tag, useBreakpointProps, UseColorTemplateColor, useInterface, useBreakpointPropsType } from '@xanui/core';\n\nexport type LineProgressProps = {\n children?: ReactElement;\n thumbSize?: useBreakpointPropsType<number>;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n value?: useBreakpointPropsType<number>;\n hideTrack?: useBreakpointPropsType<boolean>;\n speed?: useBreakpointPropsType<number>;\n}\n\n\nconst LineProgress = React.forwardRef(({ children, ...props }: LineProgressProps, ref: React.Ref<any>) => {\n const uid = \"line-progress\" + useId().replace(\":\", \"\")\n let [{ color, value, thumbSize, hideTrack, speed }] = useInterface<any>(\"LineProgress\", props, {})\n const _p: any = {}\n if (thumbSize) _p.thumbSize = thumbSize\n if (color) _p.color = color\n if (value) _p.value = value\n if (hideTrack) _p.hideTrack = hideTrack\n if (speed) _p.speed = speed\n const p: any = useBreakpointProps(_p)\n\n thumbSize = p.thumbSize ?? 4\n color = p.color ?? \"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/LineProgress/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { ReactElement, useId } from \"react\"\nimport { Tag, useBreakpointProps, UseColorTemplateColor, useInterface, useBreakpointPropsType } from '@xanui/core';\n\nexport type LineProgressProps = {\n children?: ReactElement;\n thumbSize?: useBreakpointPropsType<number>;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n value?: useBreakpointPropsType<number>;\n hideTrack?: useBreakpointPropsType<boolean>;\n speed?: useBreakpointPropsType<number>;\n}\n\n\nconst LineProgress = React.forwardRef(({ children, ...props }: LineProgressProps, ref: React.Ref<any>) => {\n const uid = \"line-progress\" + useId().replace(\":\", \"\")\n let [{ color, value, thumbSize, hideTrack, speed }] = useInterface<any>(\"LineProgress\", props, {})\n const _p: any = {}\n if (thumbSize) _p.thumbSize = thumbSize\n if (color) _p.color = color\n if (value) _p.value = value\n if (hideTrack) _p.hideTrack = hideTrack\n if (speed) _p.speed = speed\n const p: any = useBreakpointProps(_p)\n\n thumbSize = p.thumbSize ?? 4\n color = p.color ?? \"primary\"\n value = p.value\n hideTrack = p.hideTrack\n speed = p.speed ?? 1\n\n let isVal = typeof value === 'number'\n if (isVal && (value as number) > 100) value = 100\n\n return (\n <Tag\n baseClass='line-progress'\n sxr={{\n display: \"flex\",\n alignItems: \"center\",\n width: '100%',\n height: thumbSize,\n position: \"relative\",\n overflow: \"hidden\",\n bgcolor: hideTrack ? \"transparent\" : `surface.divider`,\n radius: 2,\n }}\n ref={ref}\n >\n <Tag\n component=\"span\"\n baseClass=\"line-progress-thumb\"\n sxr={{\n bgcolor: color === 'surface' ? `surface.contrast` : `${color}`,\n width: isVal ? `${value}%` : \"50%\",\n height: thumbSize,\n position: \"absolute\",\n left: 0,\n animation: isVal ? \"none\" : `${uid} ${speed}s linear infinite`,\n [`@keyframes ${uid}`]: {\n \"0%\": { left: \"-40%\" },\n \"50%\": { left: \"20%\", width: \"80%\" },\n \"100%\": { left: \"100%\", width: \"100%\" }\n }\n }}\n />\n </Tag >\n )\n})\n\nexport default LineProgress\n\n"],"names":[],"mappings":";;;;;;AAcA;;AAAuC;AACnC;;;AAGA;AAAe;AACf;AAAW;AACX;AAAW;AACX;AAAe;AACf;AAAW;AACX;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;;;AAMY;AACA;AACA;AACA;AACA;AACA;;AAEA;AACH;AAOO;;AAEA;AACA;AACA;AACA;AACA;AACI;;;AAGH;;AAKrB;;"}
|
package/Link/index.cjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var tslib = require('tslib');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var core = require('@xanui/core');
|
|
8
|
+
|
|
9
|
+
const Link = React.forwardRef((_a, ref) => {
|
|
10
|
+
var { children, component, href, target, rel, underline = "hover", external, isActive, isDisabled } = _a, props = tslib.__rest(_a, ["children", "component", "href", "target", "rel", "underline", "external", "isActive", "isDisabled"]);
|
|
11
|
+
const Component = component || "a";
|
|
12
|
+
const isExternal = React.useMemo(() => {
|
|
13
|
+
if (external !== undefined)
|
|
14
|
+
return external;
|
|
15
|
+
if (!href)
|
|
16
|
+
return false;
|
|
17
|
+
return /^https?:\/\//.test(href);
|
|
18
|
+
}, [external, href]);
|
|
19
|
+
const computedRel = React.useMemo(() => {
|
|
20
|
+
if (isExternal && target === "_blank") {
|
|
21
|
+
return rel || "noopener noreferrer";
|
|
22
|
+
}
|
|
23
|
+
return rel;
|
|
24
|
+
}, [isExternal, target, rel]);
|
|
25
|
+
return (jsxRuntime.jsx(core.Tag, Object.assign({}, props, { ref: ref, component: Component, href: href, target: isExternal ? "_blank" : target, rel: computedRel, "aria-disabled": isDisabled || undefined, baseClass: "link", "data-active": isActive || undefined, "data-disabled": isDisabled || undefined, sxr: {
|
|
26
|
+
textDecoration: underline === "always" ? "underline" : "none",
|
|
27
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
28
|
+
opacity: isDisabled ? 0.6 : 1,
|
|
29
|
+
"&:hover": {
|
|
30
|
+
textDecoration: underline === "hover" ? "underline" : undefined,
|
|
31
|
+
},
|
|
32
|
+
"&:focus-visible": {
|
|
33
|
+
outline: "2px solid var(--color-primary)",
|
|
34
|
+
outlineOffset: "2px",
|
|
35
|
+
},
|
|
36
|
+
}, children: children })));
|
|
37
|
+
});
|
|
38
|
+
Link.displayName = "Link";
|
|
39
|
+
|
|
40
|
+
module.exports = Link;
|
|
41
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Link/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { useMemo } from \"react\";\nimport { Tag, TagProps, TagComponentType } from \"@xanui/core\";\n\nexport type LinkProps<T extends TagComponentType = \"a\"> = Omit<TagProps<T>, \"component\"> & {\n component?: TagComponentType;\n\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n\n underline?: \"none\" | \"hover\" | \"always\";\n external?: boolean;\n\n isActive?: boolean;\n isDisabled?: boolean;\n};\n\nconst Link = React.forwardRef(<T extends TagComponentType = \"a\">({ children, component, href, target, rel, underline = \"hover\", external, isActive, isDisabled, ...props }: LinkProps<T>, ref: React.Ref<any>) => {\n const Component = component || \"a\";\n\n const isExternal = useMemo(() => {\n if (external !== undefined) return external;\n if (!href) return false;\n return /^https?:\\/\\//.test(href);\n }, [external, href]);\n\n const computedRel = useMemo(() => {\n if (isExternal && target === \"_blank\") {\n return rel || \"noopener noreferrer\";\n }\n return rel;\n }, [isExternal, target, rel]);\n\n return (\n <Tag\n {...props}\n ref={ref}\n component={Component}\n href={href}\n target={isExternal ? \"_blank\" : target}\n rel={computedRel}\n aria-disabled={isDisabled || undefined}\n baseClass=\"link\"\n data-active={isActive || undefined}\n data-disabled={isDisabled || undefined}\n sxr={{\n textDecoration: underline === \"always\" ? \"underline\" : \"none\",\n cursor: isDisabled ? \"not-allowed\" : \"pointer\",\n opacity: isDisabled ? 0.6 : 1,\n \"&:hover\": {\n textDecoration:\n underline === \"hover\" ? \"underline\" : undefined,\n },\n \"&:focus-visible\": {\n outline: \"2px solid var(--color-primary)\",\n outlineOffset: \"2px\",\n },\n }}\n >\n {children}\n </Tag>\n );\n}\n);\n\nLink.displayName = \"Link\";\n\nexport default Link;"],"names":[],"mappings":";;;;;;;;AAkBA;;AACI;AAEA;;AACgC;AAC5B;AAAW;AACX;AACJ;AAEA;AACI;;;AAGA;;;;;;AAmBQ;;AAGC;AACD;AACI;AACA;AACH;;AAMjB;AAGA;;"}
|