@xanui/ui 1.1.54 → 1.1.56
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.map +1 -1
- package/Accordion/index.js.map +1 -1
- package/Alert/index.cjs.map +1 -1
- package/Alert/index.js.map +1 -1
- package/Autocomplete/index.cjs.map +1 -1
- package/Autocomplete/index.js.map +1 -1
- package/Avatar/index.cjs.map +1 -1
- package/Avatar/index.js.map +1 -1
- package/Badge/index.cjs.map +1 -1
- package/Badge/index.js.map +1 -1
- package/Box/index.cjs.map +1 -1
- package/Box/index.js.map +1 -1
- package/Button/index.cjs.map +1 -1
- package/Button/index.js.map +1 -1
- package/ButtonGroup/index.cjs.map +1 -1
- package/ButtonGroup/index.js.map +1 -1
- package/Calendar/index.cjs.map +1 -1
- package/Calendar/index.js.map +1 -1
- package/CalendarInput/index.cjs.map +1 -1
- package/CalendarInput/index.js.map +1 -1
- package/Checkbox/index.cjs.map +1 -1
- package/Checkbox/index.js.map +1 -1
- package/Chip/index.cjs.map +1 -1
- package/Chip/index.js.map +1 -1
- package/CircleProgress/index.cjs.map +1 -1
- package/CircleProgress/index.js.map +1 -1
- package/ClickOutside/index.cjs.map +1 -1
- package/ClickOutside/index.js.map +1 -1
- package/Collaps/index.cjs.map +1 -1
- package/Collaps/index.js.map +1 -1
- package/Container/index.cjs.map +1 -1
- package/Container/index.js.map +1 -1
- package/DataFilter/index.cjs.map +1 -1
- package/DataFilter/index.js.map +1 -1
- package/DataFilter/options/DateFilter.cjs.map +1 -1
- package/DataFilter/options/DateFilter.js.map +1 -1
- package/DataFilter/options/DateRangeFilter.cjs.map +1 -1
- package/DataFilter/options/DateRangeFilter.js.map +1 -1
- package/DataFilter/options/MultiSelectFilter.cjs.map +1 -1
- package/DataFilter/options/MultiSelectFilter.js.map +1 -1
- package/DataFilter/options/NumberFilter.cjs.map +1 -1
- package/DataFilter/options/NumberFilter.js.map +1 -1
- package/DataFilter/options/NumberRangeFilter.cjs.map +1 -1
- package/DataFilter/options/NumberRangeFilter.js.map +1 -1
- package/DataFilter/options/SelectFilter.cjs.map +1 -1
- package/DataFilter/options/SelectFilter.js.map +1 -1
- package/DataFilter/options/TextFilter.cjs.map +1 -1
- package/DataFilter/options/TextFilter.js.map +1 -1
- package/Datatable/FilterBox.cjs.map +1 -1
- package/Datatable/FilterBox.js.map +1 -1
- package/Datatable/Row.cjs.map +1 -1
- package/Datatable/Row.js.map +1 -1
- package/Datatable/SelectedBox.cjs.map +1 -1
- package/Datatable/SelectedBox.js.map +1 -1
- package/Datatable/Table.cjs.map +1 -1
- package/Datatable/Table.js.map +1 -1
- package/Datatable/TableHead.cjs.map +1 -1
- package/Datatable/TableHead.js.map +1 -1
- package/Datatable/index.cjs.map +1 -1
- package/Datatable/index.js.map +1 -1
- package/Divider/index.cjs.map +1 -1
- package/Divider/index.js.map +1 -1
- package/Drawer/index.cjs.map +1 -1
- package/Drawer/index.js.map +1 -1
- package/Form/index.cjs.map +1 -1
- package/Form/index.js.map +1 -1
- package/GridContainer/index.cjs.map +1 -1
- package/GridContainer/index.js.map +1 -1
- package/GridItem/index.cjs.map +1 -1
- package/GridItem/index.js.map +1 -1
- package/IconButton/index.cjs.map +1 -1
- package/IconButton/index.js.map +1 -1
- package/Image/index.cjs.map +1 -1
- package/Image/index.js.map +1 -1
- package/Input/index.cjs.map +1 -1
- package/Input/index.js.map +1 -1
- package/InputNumber/index.cjs.map +1 -1
- package/InputNumber/index.d.ts +8 -0
- package/InputNumber/index.js.map +1 -1
- package/Label/index.cjs.map +1 -1
- package/Label/index.js.map +1 -1
- package/Layer/index.cjs.map +1 -1
- package/Layer/index.js.map +1 -1
- package/LineProgress/index.cjs.map +1 -1
- package/LineProgress/index.js.map +1 -1
- package/List/ListContext.cjs.map +1 -1
- package/List/ListContext.js.map +1 -1
- package/List/index.cjs.map +1 -1
- package/List/index.js.map +1 -1
- package/ListItem/index.cjs.map +1 -1
- package/ListItem/index.js.map +1 -1
- package/LoadingBox/index.cjs.map +1 -1
- package/LoadingBox/index.js.map +1 -1
- package/Menu/index.cjs.map +1 -1
- package/Menu/index.js.map +1 -1
- package/Modal/index.cjs.map +1 -1
- package/Modal/index.js.map +1 -1
- package/NoSSR/index.cjs.map +1 -1
- package/NoSSR/index.js.map +1 -1
- package/Option/index.cjs.map +1 -1
- package/Option/index.js.map +1 -1
- package/Paper/index.cjs.map +1 -1
- package/Paper/index.js.map +1 -1
- package/Portal/index.cjs.map +1 -1
- package/Portal/index.js.map +1 -1
- package/Radio/index.cjs.map +1 -1
- package/Radio/index.js.map +1 -1
- package/Scrollbar/index.cjs +26 -6
- package/Scrollbar/index.cjs.map +1 -1
- package/Scrollbar/index.d.ts +3 -0
- package/Scrollbar/index.js +26 -6
- package/Scrollbar/index.js.map +1 -1
- package/Select/index.cjs.map +1 -1
- package/Select/index.js.map +1 -1
- package/Skeleton/index.cjs.map +1 -1
- package/Skeleton/index.js.map +1 -1
- package/Stack/index.cjs.map +1 -1
- package/Stack/index.js.map +1 -1
- package/Switch/index.cjs.map +1 -1
- package/Switch/index.js.map +1 -1
- package/Tab/index.cjs.map +1 -1
- package/Tab/index.js.map +1 -1
- package/Table/index.cjs.map +1 -1
- package/Table/index.js.map +1 -1
- package/TableBody/index.cjs.map +1 -1
- package/TableBody/index.js.map +1 -1
- package/TableCell/index.cjs.map +1 -1
- package/TableCell/index.js.map +1 -1
- package/TableFooter/index.cjs.map +1 -1
- package/TableFooter/index.js.map +1 -1
- package/TableHead/index.cjs.map +1 -1
- package/TableHead/index.js.map +1 -1
- package/TablePagination/index.cjs.map +1 -1
- package/TablePagination/index.js.map +1 -1
- package/TableRow/index.cjs.map +1 -1
- package/TableRow/index.js.map +1 -1
- package/Tabs/index.cjs.map +1 -1
- package/Tabs/index.js.map +1 -1
- package/Text/index.cjs.map +1 -1
- package/Text/index.js.map +1 -1
- package/Toast/index.cjs.map +1 -1
- package/Toast/index.js.map +1 -1
- package/Tooltip/index.cjs.map +1 -1
- package/Tooltip/index.js.map +1 -1
- package/ViewBox/index.cjs.map +1 -1
- package/ViewBox/index.js.map +1 -1
- package/index.cjs +64 -62
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/readme.md +104 -104
- package/useAlert/index.cjs.map +1 -1
- package/useAlert/index.js.map +1 -1
- package/useBlurCss/index.cjs.map +1 -1
- package/useBlurCss/index.js.map +1 -1
- package/useCorner/index.cjs.map +1 -1
- package/useCorner/index.js.map +1 -1
- package/useLayer/index.cjs.map +1 -1
- package/useLayer/index.js.map +1 -1
- package/useModal/index.cjs.map +1 -1
- package/useModal/index.js.map +1 -1
package/Button/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Button/index.tsx"],"sourcesContent":["\"use client\";\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Button/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { ReactElement } from 'react';\nimport { Tag, TagProps, TagComponentType, useInterface, useColorTemplate, UseColorTemplateColor, UseColorTemplateType, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\nimport useCorner, { UseCornerTypes } from '../useCorner'\nimport CircleProgress, { CircleProgressProps } from '../CircleProgress'\nimport Skeleton, { SkeletonProps } from '../Skeleton';\n\n\nexport type ButtonProps<T extends TagComponentType = 'button'> = Omit<TagProps<T>, \"color\" | \"size\" | \"direction\"> & {\n startIcon?: useBreakpointPropsType<ReactElement>;\n endIcon?: useBreakpointPropsType<ReactElement>;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n variant?: useBreakpointPropsType<UseColorTemplateType>;\n corner?: useBreakpointPropsType<UseCornerTypes>;\n size?: useBreakpointPropsType<\"small\" | \"medium\" | \"large\">;\n direction?: useBreakpointPropsType<\"row\" | \"column\">;\n loading?: boolean;\n skeleton?: boolean;\n slotProps?: {\n loading?: Omit<CircleProgressProps, \"color\" | \"hideTrack\" | \"size\">;\n skeleton?: Omit<SkeletonProps, \"height\" | \"width\" | \"loading\" | \"children\">\n }\n}\n\n\nconst Button = React.forwardRef(<T extends TagComponentType = 'button'>({ children, skeleton, ...rest }: ButtonProps<T>, ref: React.Ref<any>) => {\n let [{ variant, startIcon, endIcon, color, corner, size, loading, direction, slotProps, ..._props }] = useInterface<any>('Button', rest, {\n variant: \"fill\",\n color: \"brand\",\n corner: \"rounded\",\n size: \"medium\"\n })\n\n const _p: any = {}\n if (startIcon) _p.startIcon = startIcon\n if (endIcon) _p.endIcon = endIcon\n if (color) _p.color = color\n if (variant) _p.variant = variant\n if (corner) _p.corner = corner\n if (size) _p.size = size\n if (direction) _p.direction = direction\n const p: any = useBreakpointProps(_p)\n\n startIcon = p.startIcon\n endIcon = p.endIcon\n color = p.color\n variant = p.variant\n corner = p.corner\n size = p.size\n direction = p.direction || \"row\"\n\n const template = useColorTemplate(color, variant)\n const cornerCss = useCorner(corner)\n\n const sizes: any = {\n small: {\n height: 38,\n px: (startIcon || endIcon) ? 1 : 1.5,\n gap: .5,\n fontSize: 'button'\n },\n medium: {\n height: 44,\n px: (startIcon || endIcon) ? 1.5 : 2,\n gap: 1,\n fontSize: 'button'\n },\n large: {\n height: 52,\n px: (startIcon || endIcon) ? 2 : 3,\n gap: 1,\n fontSize: \"text\"\n }\n }\n\n const progressSizes: any = {\n small: 20,\n medium: 25,\n large: 30\n }\n\n let _size = (sizes[size as any] || {})\n if (direction === 'column') {\n delete _size.height\n _size.gap = .5\n _size.py = 1\n }\n\n if (skeleton) {\n return <Skeleton\n {...slotProps?.skeleton}\n height={_size.height}\n animation={\"wave\"}\n sx={{\n ...slotProps?.skeleton?.sx,\n ..._size,\n ...cornerCss,\n }}\n />\n }\n\n return (\n <Tag\n component='button'\n baseClass='button'\n {..._props}\n sxr={{\n flexShrink: \"0\",\n whiteSpace: \"nowrap\",\n cursor: \"pointer\",\n display: \"flex\",\n textTransform: \"uppercase\",\n flexDirection: direction,\n alignItems: \"center\",\n justifyContent: \"center\",\n position: \"relative\",\n overflow: \"hidden\",\n userSelect: \"none\",\n fontWeight: 500,\n ..._size,\n ...cornerCss,\n ...template.primary,\n\n }}\n hover={{\n ...template.secondary,\n ...((_props as any)?.hover || {})\n }}\n disabled={loading ?? _props.disabled ?? false}\n ref={ref}\n >\n {loading && <Tag\n baseClass='button-loading-container'\n sxr={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 1,\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n }}\n >\n <CircleProgress\n {...slotProps?.loading}\n color={color === 'default' ? `brand` : \"default\"}\n size={progressSizes[size]}\n className='button-loading-progress'\n />\n </Tag>}\n {startIcon && <Tag\n baseClass='button-start-icon'\n component='span'\n display=\"inline-block\"\n flexShrink={0}\n >{startIcon}</Tag>}\n {children}\n {endIcon && <Tag\n baseClass='button-end-icon'\n component='span'\n display=\"inline-block\"\n flexShrink={0}\n >{endIcon}</Tag>}\n </Tag>\n )\n})\n\nexport default Button\n"],"names":[],"mappings":";;;;;;;;;AAyBA;;;AACI;AACI;AACA;AACA;AACA;;;AAIJ;AAAe;AACf;AAAa;AACb;AAAW;AACX;AAAa;AACb;AAAY;AACZ;AAAU;AACV;AAAe;AACf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AAEA;AACI;AACI;AACA;AACA;AACA;AACH;AACD;AACI;AACA;AACA;AACA;AACH;AACD;AACI;AACA;AACA;AACA;AACH;;AAGL;AACI;AACA;AACA;;;AAIJ;;AAEI;AACA;;;AAIA;;;AA6CY;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACH;AAwBjB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/ButtonGroup/index.tsx"],"sourcesContent":["import React, { ReactElement, Children, cloneElement } from 'react';\
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/ButtonGroup/index.tsx"],"sourcesContent":["import React, { ReactElement, Children, cloneElement } from 'react';\nimport { Tag, TagProps, TagComponentType, useInterface, UseColorTemplateColor, UseColorTemplateType, useBreakpointPropsType, useBreakpointProps } from '@xanui/core';\nimport { ButtonProps } from '../Button';\n\nexport type ButtonGroupProps<T extends TagComponentType = \"div\"> = Omit<TagProps<T>, 'children' | \"size\"> & {\n children?: ReactElement<ButtonProps> | ReactElement<ButtonProps>[];\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n variant?: useBreakpointPropsType<UseColorTemplateType>;\n size?: useBreakpointPropsType<\"small\" | \"medium\" | \"large\">;\n}\n\nconst ButtonGroup = React.forwardRef(<T extends TagComponentType = \"div\">({ children, ...rest }: ButtonGroupProps<T>, ref: React.Ref<any>) => {\n let [{ color, variant, size, ...props }] = useInterface<any>(\"ButtonGroup\", rest, {\n size: \"medium\",\n variant: \"outline\",\n color: \"default\"\n })\n const _p: any = {}\n if (color) _p.color = color\n const p: any = useBreakpointProps(_p)\n color = p.color\n\n const sizes: any = {\n small: {\n height: 40,\n },\n medium: {\n height: 46,\n },\n large: {\n height: 52,\n }\n }\n\n let borderColor = color === 'default' ? 'divider.secondary' : `${color}.secondary`\n\n return (\n <Tag\n {...props}\n {...sizes[size]}\n sxr={{\n display: \"inline-flex\",\n flexWrap: \"nowrap\",\n overflow: \"hidden\",\n radius: 1,\n border: \"1px solid\",\n borderColor: borderColor,\n '& button, & button:hover': {\n borderRight: \"1px solid\",\n borderColor: borderColor\n },\n \"& button:last-child, & button:last-child:hover\": {\n borderRight: \"none\"\n }\n }}\n baseClass='button-group'\n ref={ref}\n >\n {Children.map(children, (child: any) => {\n return cloneElement(child, {\n flex: \"0 0 auto\",\n color,\n variant,\n size,\n corner: \"squar\",\n })\n })}\n </Tag>\n )\n})\n\nexport default ButtonGroup\n\n\n"],"names":["__rest","useInterface","useBreakpointProps","_jsx","Tag","Children","cloneElement"],"mappings":";;;;;;;AAWA,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAA0C,EAAE,GAAmB,KAAI;AAAnE,IAAA,IAAA,EAAE,QAAQ,EAAA,GAAA,EAAgC,EAA3B,IAAI,GAAAA,YAAA,CAAA,EAAA,EAAnB,YAAqB,CAAF;AACzF,IAAA,IAAI,OAAuCC,iBAAY,CAAM,aAAa,EAAE,IAAI,EAAE;AAC9E,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,KAAK,EAAE;AACV,KAAA,CAAC,EAJG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAA,GAAA,EAAY,EAAP,KAAK,GAAAD,YAAA,CAAA,EAAA,EAAhC,CAAA,OAAA,EAAA,SAAA,EAAA,MAAA,CAAkC,CAIrC;IACF,MAAM,EAAE,GAAQ,EAAE;AAClB,IAAA,IAAI,KAAK;AAAE,QAAA,EAAE,CAAC,KAAK,GAAG,KAAK;AAC3B,IAAA,MAAM,CAAC,GAAQE,uBAAkB,CAAC,EAAE,CAAC;AACrC,IAAA,KAAK,GAAG,CAAC,CAAC,KAAK;AAEf,IAAA,MAAM,KAAK,GAAQ;AACf,QAAA,KAAK,EAAE;AACH,YAAA,MAAM,EAAE,EAAE;AACb,SAAA;AACD,QAAA,MAAM,EAAE;AACJ,YAAA,MAAM,EAAE,EAAE;AACb,SAAA;AACD,QAAA,KAAK,EAAE;AACH,YAAA,MAAM,EAAE,EAAE;AACb;KACJ;AAED,IAAA,IAAI,WAAW,GAAG,KAAK,KAAK,SAAS,GAAG,mBAAmB,GAAG,CAAA,EAAG,KAAK,YAAY;AAElF,IAAA,QACIC,cAAA,CAACC,QAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACI,KAAK,EACL,KAAK,CAAC,IAAI,CAAC,EAAA,EACf,GAAG,EAAE;AACD,YAAA,OAAO,EAAE,aAAa;AACtB,YAAA,QAAQ,EAAE,QAAQ;AAClB,YAAA,QAAQ,EAAE,QAAQ;AAClB,YAAA,MAAM,EAAE,CAAC;AACT,YAAA,MAAM,EAAE,WAAW;AACnB,YAAA,WAAW,EAAE,WAAW;AACxB,YAAA,0BAA0B,EAAE;AACxB,gBAAA,WAAW,EAAE,WAAW;AACxB,gBAAA,WAAW,EAAE;AAChB,aAAA;AACD,YAAA,gDAAgD,EAAE;AAC9C,gBAAA,WAAW,EAAE;AAChB;AACJ,SAAA,EACD,SAAS,EAAC,cAAc,EACxB,GAAG,EAAE,GAAG,EAAA,QAAA,EAEPC,cAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAU,KAAI;YACnC,OAAOC,kBAAY,CAAC,KAAK,EAAE;AACvB,gBAAA,IAAI,EAAE,UAAU;gBAChB,KAAK;gBACL,OAAO;gBACP,IAAI;AACJ,gBAAA,MAAM,EAAE,OAAO;AAClB,aAAA,CAAC;QACN,CAAC,CAAC,EAAA,CAAA,CACA;AAEd,CAAC;;;;"}
|
package/ButtonGroup/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/ButtonGroup/index.tsx"],"sourcesContent":["import React, { ReactElement, Children, cloneElement } from 'react';\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/ButtonGroup/index.tsx"],"sourcesContent":["import React, { ReactElement, Children, cloneElement } from 'react';\nimport { Tag, TagProps, TagComponentType, useInterface, UseColorTemplateColor, UseColorTemplateType, useBreakpointPropsType, useBreakpointProps } from '@xanui/core';\nimport { ButtonProps } from '../Button';\n\nexport type ButtonGroupProps<T extends TagComponentType = \"div\"> = Omit<TagProps<T>, 'children' | \"size\"> & {\n children?: ReactElement<ButtonProps> | ReactElement<ButtonProps>[];\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n variant?: useBreakpointPropsType<UseColorTemplateType>;\n size?: useBreakpointPropsType<\"small\" | \"medium\" | \"large\">;\n}\n\nconst ButtonGroup = React.forwardRef(<T extends TagComponentType = \"div\">({ children, ...rest }: ButtonGroupProps<T>, ref: React.Ref<any>) => {\n let [{ color, variant, size, ...props }] = useInterface<any>(\"ButtonGroup\", rest, {\n size: \"medium\",\n variant: \"outline\",\n color: \"default\"\n })\n const _p: any = {}\n if (color) _p.color = color\n const p: any = useBreakpointProps(_p)\n color = p.color\n\n const sizes: any = {\n small: {\n height: 40,\n },\n medium: {\n height: 46,\n },\n large: {\n height: 52,\n }\n }\n\n let borderColor = color === 'default' ? 'divider.secondary' : `${color}.secondary`\n\n return (\n <Tag\n {...props}\n {...sizes[size]}\n sxr={{\n display: \"inline-flex\",\n flexWrap: \"nowrap\",\n overflow: \"hidden\",\n radius: 1,\n border: \"1px solid\",\n borderColor: borderColor,\n '& button, & button:hover': {\n borderRight: \"1px solid\",\n borderColor: borderColor\n },\n \"& button:last-child, & button:last-child:hover\": {\n borderRight: \"none\"\n }\n }}\n baseClass='button-group'\n ref={ref}\n >\n {Children.map(children, (child: any) => {\n return cloneElement(child, {\n flex: \"0 0 auto\",\n color,\n variant,\n size,\n corner: \"squar\",\n })\n })}\n </Tag>\n )\n})\n\nexport default ButtonGroup\n\n\n"],"names":["_jsx"],"mappings":";;;;;AAWA,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAA0C,EAAE,GAAmB,KAAI;AAAnE,IAAA,IAAA,EAAE,QAAQ,EAAA,GAAA,EAAgC,EAA3B,IAAI,GAAA,MAAA,CAAA,EAAA,EAAnB,YAAqB,CAAF;AACzF,IAAA,IAAI,OAAuC,YAAY,CAAM,aAAa,EAAE,IAAI,EAAE;AAC9E,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,KAAK,EAAE;AACV,KAAA,CAAC,EAJG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAA,GAAA,EAAY,EAAP,KAAK,GAAA,MAAA,CAAA,EAAA,EAAhC,CAAA,OAAA,EAAA,SAAA,EAAA,MAAA,CAAkC,CAIrC;IACF,MAAM,EAAE,GAAQ,EAAE;AAClB,IAAA,IAAI,KAAK;AAAE,QAAA,EAAE,CAAC,KAAK,GAAG,KAAK;AAC3B,IAAA,MAAM,CAAC,GAAQ,kBAAkB,CAAC,EAAE,CAAC;AACrC,IAAA,KAAK,GAAG,CAAC,CAAC,KAAK;AAEf,IAAA,MAAM,KAAK,GAAQ;AACf,QAAA,KAAK,EAAE;AACH,YAAA,MAAM,EAAE,EAAE;AACb,SAAA;AACD,QAAA,MAAM,EAAE;AACJ,YAAA,MAAM,EAAE,EAAE;AACb,SAAA;AACD,QAAA,KAAK,EAAE;AACH,YAAA,MAAM,EAAE,EAAE;AACb;KACJ;AAED,IAAA,IAAI,WAAW,GAAG,KAAK,KAAK,SAAS,GAAG,mBAAmB,GAAG,CAAA,EAAG,KAAK,YAAY;AAElF,IAAA,QACIA,GAAA,CAAC,GAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACI,KAAK,EACL,KAAK,CAAC,IAAI,CAAC,EAAA,EACf,GAAG,EAAE;AACD,YAAA,OAAO,EAAE,aAAa;AACtB,YAAA,QAAQ,EAAE,QAAQ;AAClB,YAAA,QAAQ,EAAE,QAAQ;AAClB,YAAA,MAAM,EAAE,CAAC;AACT,YAAA,MAAM,EAAE,WAAW;AACnB,YAAA,WAAW,EAAE,WAAW;AACxB,YAAA,0BAA0B,EAAE;AACxB,gBAAA,WAAW,EAAE,WAAW;AACxB,gBAAA,WAAW,EAAE;AAChB,aAAA;AACD,YAAA,gDAAgD,EAAE;AAC9C,gBAAA,WAAW,EAAE;AAChB;AACJ,SAAA,EACD,SAAS,EAAC,cAAc,EACxB,GAAG,EAAE,GAAG,EAAA,QAAA,EAEP,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAU,KAAI;YACnC,OAAO,YAAY,CAAC,KAAK,EAAE;AACvB,gBAAA,IAAI,EAAE,UAAU;gBAChB,KAAK;gBACL,OAAO;gBACP,IAAI;AACJ,gBAAA,MAAM,EAAE,OAAO;AAClB,aAAA,CAAC;QACN,CAAC,CAAC,EAAA,CAAA,CACA;AAEd,CAAC;;;;"}
|
package/Calendar/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/Calendar/index.tsx"],"sourcesContent":["\"use client\";\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport Stack from '../Stack'\r\nimport IconButton from '../IconButton';\r\nimport IconKeyboardArrowRight from '@xanui/icons/KeyboardArrowRight';\r\nimport IconKeyboardArrowLeft from '@xanui/icons/KeyboardArrowLeft';\r\nimport Text from '../Text';\r\nimport Button from '../Button';\r\nimport ResetIcon from '@xanui/icons/Replay';\r\nimport ViewBox from '../ViewBox';\r\nimport { UseColorTemplateColor, useInterface, useBreakpointPropsType, useBreakpointProps } from '@xanui/core';\r\n\r\nexport type CalendarProps = {\r\n value?: Date | null;\r\n onChange?: (date: Date | null) => void;\r\n viewMode?: useBreakpointPropsType<\"year\" | \"month\" | \"day\">;\r\n onButtonClick?: (mode: CalendarProps[\"viewMode\"], value: CalendarProps[\"value\"]) => void;\r\n color?: useBreakpointPropsType<UseColorTemplateColor>;\r\n}\r\n\r\n\r\nconst ShowYears = ({ color, year, today, onClick }: any) => {\r\n let years: any[] = []\r\n const selectedRef: any = useRef(null)\r\n for (let y = 1900; y < today.getFullYear() + 40; y++) {\r\n const selected = year == y\r\n years.push(<Stack\r\n key={y}\r\n sx={{\r\n width: 50,\r\n p: .1\r\n }}\r\n className='calender-year-item'\r\n >\r\n <Button\r\n color={selected ? color : \"default\"}\r\n className='calender-year-button'\r\n size='small'\r\n corner=\"circle\"\r\n ref={selected ? selectedRef : null}\r\n onClick={() => onClick(y)}\r\n variant={selected ? \"fill\" : \"text\"}\r\n >\r\n {y}\r\n </Button>\r\n </Stack>)\r\n }\r\n\r\n useEffect(() => {\r\n if (selectedRef?.current) {\r\n selectedRef?.current.scrollIntoView({ behavior: \"smooth\", block: \"center\", inline: \"nearest\" })\r\n }\r\n }, [])\r\n\r\n return (\r\n <Stack\r\n sx={{\r\n flexWrap: \"wrap\",\r\n flexDirection: \"row\",\r\n overflow: \"hidden\",\r\n overflowY: \"auto\"\r\n }}\r\n className='calender-years'\r\n >\r\n {years}\r\n </Stack>\r\n )\r\n}\r\n\r\n\r\nconst Calendar = ({ value, ...rest }: CalendarProps) => {\r\n let [{ onChange, viewMode: VMode, onButtonClick, color }] = useInterface<any>(\"Calender\", rest, {})\r\n const _p: any = {}\r\n if (VMode) _p.VMode = VMode\r\n if (color) _p.color = color\r\n const p: any = useBreakpointProps(_p)\r\n color = p.color || \"brand\"\r\n\r\n let [viewMode, setViewMode] = useState<any>(p.VMode || \"day\");\r\n let [selectedDate, setSelectedDate] = useState(new Date());\r\n selectedDate = value instanceof Date ? value : selectedDate\r\n const [currentDate, setCurrentDate] = useState(selectedDate);\r\n const year = currentDate.getFullYear()\r\n const month = currentDate.getMonth()\r\n const daysInMonth = 32 - new Date(year, month, 32).getDate()\r\n const today = new Date();\r\n const btnWidth = 36\r\n const boxWidth = btnWidth * 7\r\n\r\n const showCalendar = () => {\r\n\r\n let firstDay = (new Date(year, month)).getDay();\r\n let rows = []\r\n let row = []\r\n\r\n const dayNames = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];\r\n for (let i = 0; i < dayNames.length; i++) {\r\n const k = dayNames[i];\r\n row.push(<Stack\r\n key={\"dayname-\" + i}\r\n sx={{\r\n width: btnWidth,\r\n height: btnWidth,\r\n alignItems: \"center\",\r\n justifyContent: \"center\"\r\n }}\r\n >\r\n <IconButton\r\n variant={\"text\"}\r\n color=\"default\"\r\n disabled\r\n >\r\n {k}\r\n </IconButton>\r\n </Stack>)\r\n }\r\n\r\n rows.push(<Stack flexRow key={\"header\"} className='calender-day-row'>\r\n {row}\r\n </Stack>);\r\n\r\n let date = 1;\r\n for (let i = 0; i < 6; i++) {\r\n let row = []\r\n for (let j = 0; j < 7; j++) {\r\n if (i === 0 && j < firstDay) {\r\n row.push(<Stack\r\n alignItems=\"center\"\r\n justifyContent=\"center\"\r\n key={date + j + i}\r\n sx={{\r\n width: btnWidth,\r\n height: btnWidth,\r\n alignItems: \"center\",\r\n justifyContent: \"center\"\r\n }}\r\n >\r\n\r\n </Stack>)\r\n } else if (date > daysInMonth) {\r\n break;\r\n } else {\r\n let isToday = date === today.getDate() && year === today.getFullYear() && month === today.getMonth()\r\n let isSelected = date === selectedDate.getDate() && year === selectedDate.getFullYear() && month === selectedDate.getMonth()\r\n\r\n let css: any = {}\r\n if (isToday) {\r\n css = {\r\n variant: \"fill\",\r\n color: \"default\"\r\n }\r\n }\r\n\r\n if (isSelected) {\r\n css = {\r\n variant: \"fill\",\r\n color: color\r\n }\r\n }\r\n\r\n row.push(<Stack\r\n sx={{\r\n width: btnWidth,\r\n height: btnWidth,\r\n alignItems: \"center\",\r\n justifyContent: \"center\"\r\n }}\r\n key={date + j + i}\r\n className='calender-day-item'\r\n >\r\n <IconButton\r\n className='calender-day-button'\r\n variant={isSelected ? \"fill\" : \"text\"}\r\n color={isToday ? color : \"default\"}\r\n {...css}\r\n data-value={date}\r\n onClick={(e: any) => {\r\n let d = e.target.getAttribute(\"data-value\")\r\n if (!d) return\r\n let selectedDate = new Date(year, month, parseInt(d))\r\n onChange ? onChange(selectedDate) : setSelectedDate(selectedDate)\r\n onButtonClick && onButtonClick(\"day\", selectedDate)\r\n }}\r\n >\r\n {date}\r\n </IconButton>\r\n </Stack>)\r\n date++;\r\n }\r\n }\r\n rows.push(<Stack flexRow key={\"row\" + i} className='calender-day-row'>\r\n {row}\r\n </Stack>);\r\n }\r\n return rows\r\n }\r\n\r\n const showMonth = () => {\r\n let months: any[] = []\r\n const monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\r\n for (let m = 0; m < monthNames.length; m++) {\r\n const selected = currentDate.getMonth() === m\r\n\r\n months.push(<Stack\r\n key={m}\r\n width={\"50%\"}\r\n alignItems=\"center\"\r\n justifyContent=\"center\"\r\n p={.1}\r\n className='calender-months-item'\r\n >\r\n <Button\r\n color={selected ? color : \"default\"}\r\n className='calender-month-button'\r\n size='small'\r\n corner=\"circle\"\r\n variant={selected ? \"fill\" : 'text'}\r\n onClick={() => {\r\n const v = new Date(currentDate.getFullYear(), m)\r\n setCurrentDate(v)\r\n setViewMode(\"day\")\r\n onButtonClick && onButtonClick(\"month\", v)\r\n }}\r\n sx={{\r\n color: selected ? \"brand.text\" : \"text.primary\"\r\n }}\r\n >\r\n {monthNames[m]}\r\n </Button>\r\n </Stack>)\r\n }\r\n\r\n return (\r\n <Stack\r\n className='calender-months'\r\n sx={{\r\n flexWrap: \"wrap\",\r\n overflow: \"hidden\",\r\n overflowY: \"auto\",\r\n flexDirection: \"row\"\r\n }}\r\n >\r\n {months}\r\n </Stack>\r\n )\r\n }\r\n\r\n let view: any = null\r\n switch (viewMode) {\r\n case \"year\":\r\n view = <ShowYears\r\n color={color}\r\n today={today}\r\n year={year}\r\n boxWidth={boxWidth}\r\n onClick={(y: any) => {\r\n currentDate.setFullYear(y)\r\n setCurrentDate(currentDate)\r\n setViewMode(\"month\")\r\n onButtonClick && onButtonClick(\"year\", currentDate)\r\n }}\r\n />\r\n break;\r\n case \"month\":\r\n view = showMonth()\r\n break;\r\n default:\r\n view = (<>\r\n\r\n {showCalendar()}\r\n </>\r\n )\r\n break;\r\n }\r\n\r\n return (\r\n <ViewBox\r\n className='calender-root'\r\n maxHeight={308}\r\n width={250}\r\n radius={1}\r\n bgcolor=\"background.secondary\"\r\n startContent={\r\n <Stack className='calender-header' flexRow alignItems=\"center\" justifyContent=\"space-between\" p={1}>\r\n <Text\r\n fontWeight=\"bold\"\r\n cursor=\"pointer\"\r\n onClick={() => setViewMode(viewMode !== 'day' ? \"day\" : \"year\")}\r\n flex={1}\r\n >\r\n {currentDate.toLocaleDateString(undefined, { year: 'numeric', month: 'long' })}\r\n </Text>\r\n <IconButton\r\n color=\"default\"\r\n variant='text'\r\n size={28}\r\n onClick={() => {\r\n setCurrentDate(new Date())\r\n onChange ? onChange(new Date()) : setSelectedDate(new Date())\r\n }}\r\n >\r\n <ResetIcon fontSize={20} />\r\n </IconButton>\r\n <IconButton\r\n color=\"default\"\r\n variant='text'\r\n size={28}\r\n onClick={() => {\r\n setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, 1))\r\n }}\r\n >\r\n <IconKeyboardArrowLeft />\r\n </IconButton>\r\n <IconButton\r\n color=\"default\"\r\n variant='text'\r\n size={28}\r\n onClick={() => {\r\n setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 1))\r\n }}\r\n >\r\n <IconKeyboardArrowRight />\r\n </IconButton>\r\n </Stack>\r\n }\r\n >\r\n <Stack height=\"100%\" p={.5} className='calender-container'>\r\n {view}\r\n </Stack>\r\n </ViewBox>\r\n );\r\n};\r\n\r\nexport default Calendar;"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAqBA;;AAEI;AACA;AACI;AACA;AAGQ;AACA;AACH;;;;;;;AAuBT;AAGY;AACA;AACA;AACA;AACH;AAMb;AAGA;AAAkB;;;AAGd;AAAW;AACX;AAAW;AACX;AACA;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAII;;;AAIA;AACA;AACI;AACA;AAGQ;AACA;AACA;AACA;;;AAaZ;;AAKA;;AAEI;;AAEQ;AAKQ;AACA;AACA;AACA;AACH;;AAIF;;;;;;;;AAQC;AACI;AACA;;;;AAKJ;AACI;AACA;;;AAIR;AAEQ;AACA;AACA;AACA;;;AAaI;;AACA;AACA;AACA;;AAMZ;;;AAGR;;AAIJ;AACJ;;;;AAKI;;AAGI;AAeY;;;AAGA;;;;;;AAeJ;AACA;AACA;AACA;;AAMhB;;;AAII;;AAOY;;;AAGA;AACJ;;AAGR;;;AAGA;AACI;;;;AA8BgB;AACA;AACJ;AASI;;AAUA;;AAa5B;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Calendar/index.tsx"],"sourcesContent":["\"use client\";\nimport { useEffect, useRef, useState } from 'react';\nimport Stack from '../Stack'\nimport IconButton from '../IconButton';\nimport IconKeyboardArrowRight from '@xanui/icons/KeyboardArrowRight';\nimport IconKeyboardArrowLeft from '@xanui/icons/KeyboardArrowLeft';\nimport Text from '../Text';\nimport Button from '../Button';\nimport ResetIcon from '@xanui/icons/Replay';\nimport ViewBox from '../ViewBox';\nimport { UseColorTemplateColor, useInterface, useBreakpointPropsType, useBreakpointProps } from '@xanui/core';\n\nexport type CalendarProps = {\n value?: Date | null;\n onChange?: (date: Date | null) => void;\n viewMode?: useBreakpointPropsType<\"year\" | \"month\" | \"day\">;\n onButtonClick?: (mode: CalendarProps[\"viewMode\"], value: CalendarProps[\"value\"]) => void;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n}\n\n\nconst ShowYears = ({ color, year, today, onClick }: any) => {\n let years: any[] = []\n const selectedRef: any = useRef(null)\n for (let y = 1900; y < today.getFullYear() + 40; y++) {\n const selected = year == y\n years.push(<Stack\n key={y}\n sx={{\n width: 50,\n p: .1\n }}\n className='calender-year-item'\n >\n <Button\n color={selected ? color : \"default\"}\n className='calender-year-button'\n size='small'\n corner=\"circle\"\n ref={selected ? selectedRef : null}\n onClick={() => onClick(y)}\n variant={selected ? \"fill\" : \"text\"}\n >\n {y}\n </Button>\n </Stack>)\n }\n\n useEffect(() => {\n if (selectedRef?.current) {\n selectedRef?.current.scrollIntoView({ behavior: \"smooth\", block: \"center\", inline: \"nearest\" })\n }\n }, [])\n\n return (\n <Stack\n sx={{\n flexWrap: \"wrap\",\n flexDirection: \"row\",\n overflow: \"hidden\",\n overflowY: \"auto\"\n }}\n className='calender-years'\n >\n {years}\n </Stack>\n )\n}\n\n\nconst Calendar = ({ value, ...rest }: CalendarProps) => {\n let [{ onChange, viewMode: VMode, onButtonClick, color }] = useInterface<any>(\"Calender\", rest, {})\n const _p: any = {}\n if (VMode) _p.VMode = VMode\n if (color) _p.color = color\n const p: any = useBreakpointProps(_p)\n color = p.color || \"brand\"\n\n let [viewMode, setViewMode] = useState<any>(p.VMode || \"day\");\n let [selectedDate, setSelectedDate] = useState(new Date());\n selectedDate = value instanceof Date ? value : selectedDate\n const [currentDate, setCurrentDate] = useState(selectedDate);\n const year = currentDate.getFullYear()\n const month = currentDate.getMonth()\n const daysInMonth = 32 - new Date(year, month, 32).getDate()\n const today = new Date();\n const btnWidth = 36\n const boxWidth = btnWidth * 7\n\n const showCalendar = () => {\n\n let firstDay = (new Date(year, month)).getDay();\n let rows = []\n let row = []\n\n const dayNames = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];\n for (let i = 0; i < dayNames.length; i++) {\n const k = dayNames[i];\n row.push(<Stack\n key={\"dayname-\" + i}\n sx={{\n width: btnWidth,\n height: btnWidth,\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n >\n <IconButton\n variant={\"text\"}\n color=\"default\"\n disabled\n >\n {k}\n </IconButton>\n </Stack>)\n }\n\n rows.push(<Stack flexRow key={\"header\"} className='calender-day-row'>\n {row}\n </Stack>);\n\n let date = 1;\n for (let i = 0; i < 6; i++) {\n let row = []\n for (let j = 0; j < 7; j++) {\n if (i === 0 && j < firstDay) {\n row.push(<Stack\n alignItems=\"center\"\n justifyContent=\"center\"\n key={date + j + i}\n sx={{\n width: btnWidth,\n height: btnWidth,\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n >\n\n </Stack>)\n } else if (date > daysInMonth) {\n break;\n } else {\n let isToday = date === today.getDate() && year === today.getFullYear() && month === today.getMonth()\n let isSelected = date === selectedDate.getDate() && year === selectedDate.getFullYear() && month === selectedDate.getMonth()\n\n let css: any = {}\n if (isToday) {\n css = {\n variant: \"fill\",\n color: \"default\"\n }\n }\n\n if (isSelected) {\n css = {\n variant: \"fill\",\n color: color\n }\n }\n\n row.push(<Stack\n sx={{\n width: btnWidth,\n height: btnWidth,\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n key={date + j + i}\n className='calender-day-item'\n >\n <IconButton\n className='calender-day-button'\n variant={isSelected ? \"fill\" : \"text\"}\n color={isToday ? color : \"default\"}\n {...css}\n data-value={date}\n onClick={(e: any) => {\n let d = e.target.getAttribute(\"data-value\")\n if (!d) return\n let selectedDate = new Date(year, month, parseInt(d))\n onChange ? onChange(selectedDate) : setSelectedDate(selectedDate)\n onButtonClick && onButtonClick(\"day\", selectedDate)\n }}\n >\n {date}\n </IconButton>\n </Stack>)\n date++;\n }\n }\n rows.push(<Stack flexRow key={\"row\" + i} className='calender-day-row'>\n {row}\n </Stack>);\n }\n return rows\n }\n\n const showMonth = () => {\n let months: any[] = []\n const monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n for (let m = 0; m < monthNames.length; m++) {\n const selected = currentDate.getMonth() === m\n\n months.push(<Stack\n key={m}\n width={\"50%\"}\n alignItems=\"center\"\n justifyContent=\"center\"\n p={.1}\n className='calender-months-item'\n >\n <Button\n color={selected ? color : \"default\"}\n className='calender-month-button'\n size='small'\n corner=\"circle\"\n variant={selected ? \"fill\" : 'text'}\n onClick={() => {\n const v = new Date(currentDate.getFullYear(), m)\n setCurrentDate(v)\n setViewMode(\"day\")\n onButtonClick && onButtonClick(\"month\", v)\n }}\n sx={{\n color: selected ? \"brand.text\" : \"text.primary\"\n }}\n >\n {monthNames[m]}\n </Button>\n </Stack>)\n }\n\n return (\n <Stack\n className='calender-months'\n sx={{\n flexWrap: \"wrap\",\n overflow: \"hidden\",\n overflowY: \"auto\",\n flexDirection: \"row\"\n }}\n >\n {months}\n </Stack>\n )\n }\n\n let view: any = null\n switch (viewMode) {\n case \"year\":\n view = <ShowYears\n color={color}\n today={today}\n year={year}\n boxWidth={boxWidth}\n onClick={(y: any) => {\n currentDate.setFullYear(y)\n setCurrentDate(currentDate)\n setViewMode(\"month\")\n onButtonClick && onButtonClick(\"year\", currentDate)\n }}\n />\n break;\n case \"month\":\n view = showMonth()\n break;\n default:\n view = (<>\n\n {showCalendar()}\n </>\n )\n break;\n }\n\n return (\n <ViewBox\n className='calender-root'\n maxHeight={308}\n width={250}\n radius={1}\n bgcolor=\"background.secondary\"\n startContent={\n <Stack className='calender-header' flexRow alignItems=\"center\" justifyContent=\"space-between\" p={1}>\n <Text\n fontWeight=\"bold\"\n cursor=\"pointer\"\n onClick={() => setViewMode(viewMode !== 'day' ? \"day\" : \"year\")}\n flex={1}\n >\n {currentDate.toLocaleDateString(undefined, { year: 'numeric', month: 'long' })}\n </Text>\n <IconButton\n color=\"default\"\n variant='text'\n size={28}\n onClick={() => {\n setCurrentDate(new Date())\n onChange ? onChange(new Date()) : setSelectedDate(new Date())\n }}\n >\n <ResetIcon fontSize={20} />\n </IconButton>\n <IconButton\n color=\"default\"\n variant='text'\n size={28}\n onClick={() => {\n setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, 1))\n }}\n >\n <IconKeyboardArrowLeft />\n </IconButton>\n <IconButton\n color=\"default\"\n variant='text'\n size={28}\n onClick={() => {\n setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 1))\n }}\n >\n <IconKeyboardArrowRight />\n </IconButton>\n </Stack>\n }\n >\n <Stack height=\"100%\" p={.5} className='calender-container'>\n {view}\n </Stack>\n </ViewBox>\n );\n};\n\nexport default Calendar;"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAqBA;;AAEI;AACA;AACI;AACA;AAGQ;AACA;AACH;;;;;;;AAuBT;AAGY;AACA;AACA;AACA;AACH;AAMb;AAGA;AAAkB;;;AAGd;AAAW;AACX;AAAW;AACX;AACA;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAII;;;AAIA;AACA;AACI;AACA;AAGQ;AACA;AACA;AACA;;;AAaZ;;AAKA;;AAEI;;AAEQ;AAKQ;AACA;AACA;AACA;AACH;;AAIF;;;;;;;;AAQC;AACI;AACA;;;;AAKJ;AACI;AACA;;;AAIR;AAEQ;AACA;AACA;AACA;;;AAaI;;AACA;AACA;AACA;;AAMZ;;;AAGR;;AAIJ;AACJ;;;;AAKI;;AAGI;AAeY;;;AAGA;;;;;;AAeJ;AACA;AACA;AACA;;AAMhB;;;AAII;;AAOY;;;AAGA;AACJ;;AAGR;;;AAGA;AACI;;;;AA8BgB;AACA;AACJ;AASI;;AAUA;;AAa5B;;"}
|
package/Calendar/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Calendar/index.tsx"],"sourcesContent":["\"use client\";\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport Stack from '../Stack'\r\nimport IconButton from '../IconButton';\r\nimport IconKeyboardArrowRight from '@xanui/icons/KeyboardArrowRight';\r\nimport IconKeyboardArrowLeft from '@xanui/icons/KeyboardArrowLeft';\r\nimport Text from '../Text';\r\nimport Button from '../Button';\r\nimport ResetIcon from '@xanui/icons/Replay';\r\nimport ViewBox from '../ViewBox';\r\nimport { UseColorTemplateColor, useInterface, useBreakpointPropsType, useBreakpointProps } from '@xanui/core';\r\n\r\nexport type CalendarProps = {\r\n value?: Date | null;\r\n onChange?: (date: Date | null) => void;\r\n viewMode?: useBreakpointPropsType<\"year\" | \"month\" | \"day\">;\r\n onButtonClick?: (mode: CalendarProps[\"viewMode\"], value: CalendarProps[\"value\"]) => void;\r\n color?: useBreakpointPropsType<UseColorTemplateColor>;\r\n}\r\n\r\n\r\nconst ShowYears = ({ color, year, today, onClick }: any) => {\r\n let years: any[] = []\r\n const selectedRef: any = useRef(null)\r\n for (let y = 1900; y < today.getFullYear() + 40; y++) {\r\n const selected = year == y\r\n years.push(<Stack\r\n key={y}\r\n sx={{\r\n width: 50,\r\n p: .1\r\n }}\r\n className='calender-year-item'\r\n >\r\n <Button\r\n color={selected ? color : \"default\"}\r\n className='calender-year-button'\r\n size='small'\r\n corner=\"circle\"\r\n ref={selected ? selectedRef : null}\r\n onClick={() => onClick(y)}\r\n variant={selected ? \"fill\" : \"text\"}\r\n >\r\n {y}\r\n </Button>\r\n </Stack>)\r\n }\r\n\r\n useEffect(() => {\r\n if (selectedRef?.current) {\r\n selectedRef?.current.scrollIntoView({ behavior: \"smooth\", block: \"center\", inline: \"nearest\" })\r\n }\r\n }, [])\r\n\r\n return (\r\n <Stack\r\n sx={{\r\n flexWrap: \"wrap\",\r\n flexDirection: \"row\",\r\n overflow: \"hidden\",\r\n overflowY: \"auto\"\r\n }}\r\n className='calender-years'\r\n >\r\n {years}\r\n </Stack>\r\n )\r\n}\r\n\r\n\r\nconst Calendar = ({ value, ...rest }: CalendarProps) => {\r\n let [{ onChange, viewMode: VMode, onButtonClick, color }] = useInterface<any>(\"Calender\", rest, {})\r\n const _p: any = {}\r\n if (VMode) _p.VMode = VMode\r\n if (color) _p.color = color\r\n const p: any = useBreakpointProps(_p)\r\n color = p.color || \"brand\"\r\n\r\n let [viewMode, setViewMode] = useState<any>(p.VMode || \"day\");\r\n let [selectedDate, setSelectedDate] = useState(new Date());\r\n selectedDate = value instanceof Date ? value : selectedDate\r\n const [currentDate, setCurrentDate] = useState(selectedDate);\r\n const year = currentDate.getFullYear()\r\n const month = currentDate.getMonth()\r\n const daysInMonth = 32 - new Date(year, month, 32).getDate()\r\n const today = new Date();\r\n const btnWidth = 36\r\n const boxWidth = btnWidth * 7\r\n\r\n const showCalendar = () => {\r\n\r\n let firstDay = (new Date(year, month)).getDay();\r\n let rows = []\r\n let row = []\r\n\r\n const dayNames = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];\r\n for (let i = 0; i < dayNames.length; i++) {\r\n const k = dayNames[i];\r\n row.push(<Stack\r\n key={\"dayname-\" + i}\r\n sx={{\r\n width: btnWidth,\r\n height: btnWidth,\r\n alignItems: \"center\",\r\n justifyContent: \"center\"\r\n }}\r\n >\r\n <IconButton\r\n variant={\"text\"}\r\n color=\"default\"\r\n disabled\r\n >\r\n {k}\r\n </IconButton>\r\n </Stack>)\r\n }\r\n\r\n rows.push(<Stack flexRow key={\"header\"} className='calender-day-row'>\r\n {row}\r\n </Stack>);\r\n\r\n let date = 1;\r\n for (let i = 0; i < 6; i++) {\r\n let row = []\r\n for (let j = 0; j < 7; j++) {\r\n if (i === 0 && j < firstDay) {\r\n row.push(<Stack\r\n alignItems=\"center\"\r\n justifyContent=\"center\"\r\n key={date + j + i}\r\n sx={{\r\n width: btnWidth,\r\n height: btnWidth,\r\n alignItems: \"center\",\r\n justifyContent: \"center\"\r\n }}\r\n >\r\n\r\n </Stack>)\r\n } else if (date > daysInMonth) {\r\n break;\r\n } else {\r\n let isToday = date === today.getDate() && year === today.getFullYear() && month === today.getMonth()\r\n let isSelected = date === selectedDate.getDate() && year === selectedDate.getFullYear() && month === selectedDate.getMonth()\r\n\r\n let css: any = {}\r\n if (isToday) {\r\n css = {\r\n variant: \"fill\",\r\n color: \"default\"\r\n }\r\n }\r\n\r\n if (isSelected) {\r\n css = {\r\n variant: \"fill\",\r\n color: color\r\n }\r\n }\r\n\r\n row.push(<Stack\r\n sx={{\r\n width: btnWidth,\r\n height: btnWidth,\r\n alignItems: \"center\",\r\n justifyContent: \"center\"\r\n }}\r\n key={date + j + i}\r\n className='calender-day-item'\r\n >\r\n <IconButton\r\n className='calender-day-button'\r\n variant={isSelected ? \"fill\" : \"text\"}\r\n color={isToday ? color : \"default\"}\r\n {...css}\r\n data-value={date}\r\n onClick={(e: any) => {\r\n let d = e.target.getAttribute(\"data-value\")\r\n if (!d) return\r\n let selectedDate = new Date(year, month, parseInt(d))\r\n onChange ? onChange(selectedDate) : setSelectedDate(selectedDate)\r\n onButtonClick && onButtonClick(\"day\", selectedDate)\r\n }}\r\n >\r\n {date}\r\n </IconButton>\r\n </Stack>)\r\n date++;\r\n }\r\n }\r\n rows.push(<Stack flexRow key={\"row\" + i} className='calender-day-row'>\r\n {row}\r\n </Stack>);\r\n }\r\n return rows\r\n }\r\n\r\n const showMonth = () => {\r\n let months: any[] = []\r\n const monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\r\n for (let m = 0; m < monthNames.length; m++) {\r\n const selected = currentDate.getMonth() === m\r\n\r\n months.push(<Stack\r\n key={m}\r\n width={\"50%\"}\r\n alignItems=\"center\"\r\n justifyContent=\"center\"\r\n p={.1}\r\n className='calender-months-item'\r\n >\r\n <Button\r\n color={selected ? color : \"default\"}\r\n className='calender-month-button'\r\n size='small'\r\n corner=\"circle\"\r\n variant={selected ? \"fill\" : 'text'}\r\n onClick={() => {\r\n const v = new Date(currentDate.getFullYear(), m)\r\n setCurrentDate(v)\r\n setViewMode(\"day\")\r\n onButtonClick && onButtonClick(\"month\", v)\r\n }}\r\n sx={{\r\n color: selected ? \"brand.text\" : \"text.primary\"\r\n }}\r\n >\r\n {monthNames[m]}\r\n </Button>\r\n </Stack>)\r\n }\r\n\r\n return (\r\n <Stack\r\n className='calender-months'\r\n sx={{\r\n flexWrap: \"wrap\",\r\n overflow: \"hidden\",\r\n overflowY: \"auto\",\r\n flexDirection: \"row\"\r\n }}\r\n >\r\n {months}\r\n </Stack>\r\n )\r\n }\r\n\r\n let view: any = null\r\n switch (viewMode) {\r\n case \"year\":\r\n view = <ShowYears\r\n color={color}\r\n today={today}\r\n year={year}\r\n boxWidth={boxWidth}\r\n onClick={(y: any) => {\r\n currentDate.setFullYear(y)\r\n setCurrentDate(currentDate)\r\n setViewMode(\"month\")\r\n onButtonClick && onButtonClick(\"year\", currentDate)\r\n }}\r\n />\r\n break;\r\n case \"month\":\r\n view = showMonth()\r\n break;\r\n default:\r\n view = (<>\r\n\r\n {showCalendar()}\r\n </>\r\n )\r\n break;\r\n }\r\n\r\n return (\r\n <ViewBox\r\n className='calender-root'\r\n maxHeight={308}\r\n width={250}\r\n radius={1}\r\n bgcolor=\"background.secondary\"\r\n startContent={\r\n <Stack className='calender-header' flexRow alignItems=\"center\" justifyContent=\"space-between\" p={1}>\r\n <Text\r\n fontWeight=\"bold\"\r\n cursor=\"pointer\"\r\n onClick={() => setViewMode(viewMode !== 'day' ? \"day\" : \"year\")}\r\n flex={1}\r\n >\r\n {currentDate.toLocaleDateString(undefined, { year: 'numeric', month: 'long' })}\r\n </Text>\r\n <IconButton\r\n color=\"default\"\r\n variant='text'\r\n size={28}\r\n onClick={() => {\r\n setCurrentDate(new Date())\r\n onChange ? onChange(new Date()) : setSelectedDate(new Date())\r\n }}\r\n >\r\n <ResetIcon fontSize={20} />\r\n </IconButton>\r\n <IconButton\r\n color=\"default\"\r\n variant='text'\r\n size={28}\r\n onClick={() => {\r\n setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, 1))\r\n }}\r\n >\r\n <IconKeyboardArrowLeft />\r\n </IconButton>\r\n <IconButton\r\n color=\"default\"\r\n variant='text'\r\n size={28}\r\n onClick={() => {\r\n setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 1))\r\n }}\r\n >\r\n <IconKeyboardArrowRight />\r\n </IconButton>\r\n </Stack>\r\n }\r\n >\r\n <Stack height=\"100%\" p={.5} className='calender-container'>\r\n {view}\r\n </Stack>\r\n </ViewBox>\r\n );\r\n};\r\n\r\nexport default Calendar;"],"names":[],"mappings":";;;;;;;;;;;;;;AAqBA;;AAEI;AACA;AACI;AACA;AAGQ;AACA;AACH;;;;;;;AAuBT;AAGY;AACA;AACA;AACA;AACH;AAMb;AAGA;AAAkB;;;AAGd;AAAW;AACX;AAAW;AACX;AACA;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAII;;;AAIA;AACA;AACI;AACA;AAGQ;AACA;AACA;AACA;;;AAaZ;;AAKA;;AAEI;;AAEQ;AAKQ;AACA;AACA;AACA;AACH;;AAIF;;;;;;;;AAQC;AACI;AACA;;;;AAKJ;AACI;AACA;;;AAIR;AAEQ;AACA;AACA;AACA;;;AAaI;;AACA;AACA;AACA;;AAMZ;;;AAGR;;AAIJ;AACJ;;;;AAKI;;AAGI;AAeY;;;AAGA;;;;;;AAeJ;AACA;AACA;AACA;;AAMhB;;;AAII;;AAOY;;;AAGA;AACJ;;AAGR;;;AAGA;AACI;;;;AA8BgB;AACA;AACJ;AASI;;AAUA;;AAa5B;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Calendar/index.tsx"],"sourcesContent":["\"use client\";\nimport { useEffect, useRef, useState } from 'react';\nimport Stack from '../Stack'\nimport IconButton from '../IconButton';\nimport IconKeyboardArrowRight from '@xanui/icons/KeyboardArrowRight';\nimport IconKeyboardArrowLeft from '@xanui/icons/KeyboardArrowLeft';\nimport Text from '../Text';\nimport Button from '../Button';\nimport ResetIcon from '@xanui/icons/Replay';\nimport ViewBox from '../ViewBox';\nimport { UseColorTemplateColor, useInterface, useBreakpointPropsType, useBreakpointProps } from '@xanui/core';\n\nexport type CalendarProps = {\n value?: Date | null;\n onChange?: (date: Date | null) => void;\n viewMode?: useBreakpointPropsType<\"year\" | \"month\" | \"day\">;\n onButtonClick?: (mode: CalendarProps[\"viewMode\"], value: CalendarProps[\"value\"]) => void;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n}\n\n\nconst ShowYears = ({ color, year, today, onClick }: any) => {\n let years: any[] = []\n const selectedRef: any = useRef(null)\n for (let y = 1900; y < today.getFullYear() + 40; y++) {\n const selected = year == y\n years.push(<Stack\n key={y}\n sx={{\n width: 50,\n p: .1\n }}\n className='calender-year-item'\n >\n <Button\n color={selected ? color : \"default\"}\n className='calender-year-button'\n size='small'\n corner=\"circle\"\n ref={selected ? selectedRef : null}\n onClick={() => onClick(y)}\n variant={selected ? \"fill\" : \"text\"}\n >\n {y}\n </Button>\n </Stack>)\n }\n\n useEffect(() => {\n if (selectedRef?.current) {\n selectedRef?.current.scrollIntoView({ behavior: \"smooth\", block: \"center\", inline: \"nearest\" })\n }\n }, [])\n\n return (\n <Stack\n sx={{\n flexWrap: \"wrap\",\n flexDirection: \"row\",\n overflow: \"hidden\",\n overflowY: \"auto\"\n }}\n className='calender-years'\n >\n {years}\n </Stack>\n )\n}\n\n\nconst Calendar = ({ value, ...rest }: CalendarProps) => {\n let [{ onChange, viewMode: VMode, onButtonClick, color }] = useInterface<any>(\"Calender\", rest, {})\n const _p: any = {}\n if (VMode) _p.VMode = VMode\n if (color) _p.color = color\n const p: any = useBreakpointProps(_p)\n color = p.color || \"brand\"\n\n let [viewMode, setViewMode] = useState<any>(p.VMode || \"day\");\n let [selectedDate, setSelectedDate] = useState(new Date());\n selectedDate = value instanceof Date ? value : selectedDate\n const [currentDate, setCurrentDate] = useState(selectedDate);\n const year = currentDate.getFullYear()\n const month = currentDate.getMonth()\n const daysInMonth = 32 - new Date(year, month, 32).getDate()\n const today = new Date();\n const btnWidth = 36\n const boxWidth = btnWidth * 7\n\n const showCalendar = () => {\n\n let firstDay = (new Date(year, month)).getDay();\n let rows = []\n let row = []\n\n const dayNames = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];\n for (let i = 0; i < dayNames.length; i++) {\n const k = dayNames[i];\n row.push(<Stack\n key={\"dayname-\" + i}\n sx={{\n width: btnWidth,\n height: btnWidth,\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n >\n <IconButton\n variant={\"text\"}\n color=\"default\"\n disabled\n >\n {k}\n </IconButton>\n </Stack>)\n }\n\n rows.push(<Stack flexRow key={\"header\"} className='calender-day-row'>\n {row}\n </Stack>);\n\n let date = 1;\n for (let i = 0; i < 6; i++) {\n let row = []\n for (let j = 0; j < 7; j++) {\n if (i === 0 && j < firstDay) {\n row.push(<Stack\n alignItems=\"center\"\n justifyContent=\"center\"\n key={date + j + i}\n sx={{\n width: btnWidth,\n height: btnWidth,\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n >\n\n </Stack>)\n } else if (date > daysInMonth) {\n break;\n } else {\n let isToday = date === today.getDate() && year === today.getFullYear() && month === today.getMonth()\n let isSelected = date === selectedDate.getDate() && year === selectedDate.getFullYear() && month === selectedDate.getMonth()\n\n let css: any = {}\n if (isToday) {\n css = {\n variant: \"fill\",\n color: \"default\"\n }\n }\n\n if (isSelected) {\n css = {\n variant: \"fill\",\n color: color\n }\n }\n\n row.push(<Stack\n sx={{\n width: btnWidth,\n height: btnWidth,\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n key={date + j + i}\n className='calender-day-item'\n >\n <IconButton\n className='calender-day-button'\n variant={isSelected ? \"fill\" : \"text\"}\n color={isToday ? color : \"default\"}\n {...css}\n data-value={date}\n onClick={(e: any) => {\n let d = e.target.getAttribute(\"data-value\")\n if (!d) return\n let selectedDate = new Date(year, month, parseInt(d))\n onChange ? onChange(selectedDate) : setSelectedDate(selectedDate)\n onButtonClick && onButtonClick(\"day\", selectedDate)\n }}\n >\n {date}\n </IconButton>\n </Stack>)\n date++;\n }\n }\n rows.push(<Stack flexRow key={\"row\" + i} className='calender-day-row'>\n {row}\n </Stack>);\n }\n return rows\n }\n\n const showMonth = () => {\n let months: any[] = []\n const monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n for (let m = 0; m < monthNames.length; m++) {\n const selected = currentDate.getMonth() === m\n\n months.push(<Stack\n key={m}\n width={\"50%\"}\n alignItems=\"center\"\n justifyContent=\"center\"\n p={.1}\n className='calender-months-item'\n >\n <Button\n color={selected ? color : \"default\"}\n className='calender-month-button'\n size='small'\n corner=\"circle\"\n variant={selected ? \"fill\" : 'text'}\n onClick={() => {\n const v = new Date(currentDate.getFullYear(), m)\n setCurrentDate(v)\n setViewMode(\"day\")\n onButtonClick && onButtonClick(\"month\", v)\n }}\n sx={{\n color: selected ? \"brand.text\" : \"text.primary\"\n }}\n >\n {monthNames[m]}\n </Button>\n </Stack>)\n }\n\n return (\n <Stack\n className='calender-months'\n sx={{\n flexWrap: \"wrap\",\n overflow: \"hidden\",\n overflowY: \"auto\",\n flexDirection: \"row\"\n }}\n >\n {months}\n </Stack>\n )\n }\n\n let view: any = null\n switch (viewMode) {\n case \"year\":\n view = <ShowYears\n color={color}\n today={today}\n year={year}\n boxWidth={boxWidth}\n onClick={(y: any) => {\n currentDate.setFullYear(y)\n setCurrentDate(currentDate)\n setViewMode(\"month\")\n onButtonClick && onButtonClick(\"year\", currentDate)\n }}\n />\n break;\n case \"month\":\n view = showMonth()\n break;\n default:\n view = (<>\n\n {showCalendar()}\n </>\n )\n break;\n }\n\n return (\n <ViewBox\n className='calender-root'\n maxHeight={308}\n width={250}\n radius={1}\n bgcolor=\"background.secondary\"\n startContent={\n <Stack className='calender-header' flexRow alignItems=\"center\" justifyContent=\"space-between\" p={1}>\n <Text\n fontWeight=\"bold\"\n cursor=\"pointer\"\n onClick={() => setViewMode(viewMode !== 'day' ? \"day\" : \"year\")}\n flex={1}\n >\n {currentDate.toLocaleDateString(undefined, { year: 'numeric', month: 'long' })}\n </Text>\n <IconButton\n color=\"default\"\n variant='text'\n size={28}\n onClick={() => {\n setCurrentDate(new Date())\n onChange ? onChange(new Date()) : setSelectedDate(new Date())\n }}\n >\n <ResetIcon fontSize={20} />\n </IconButton>\n <IconButton\n color=\"default\"\n variant='text'\n size={28}\n onClick={() => {\n setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, 1))\n }}\n >\n <IconKeyboardArrowLeft />\n </IconButton>\n <IconButton\n color=\"default\"\n variant='text'\n size={28}\n onClick={() => {\n setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 1))\n }}\n >\n <IconKeyboardArrowRight />\n </IconButton>\n </Stack>\n }\n >\n <Stack height=\"100%\" p={.5} className='calender-container'>\n {view}\n </Stack>\n </ViewBox>\n );\n};\n\nexport default Calendar;"],"names":[],"mappings":";;;;;;;;;;;;;;AAqBA;;AAEI;AACA;AACI;AACA;AAGQ;AACA;AACH;;;;;;;AAuBT;AAGY;AACA;AACA;AACA;AACH;AAMb;AAGA;AAAkB;;;AAGd;AAAW;AACX;AAAW;AACX;AACA;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAII;;;AAIA;AACA;AACI;AACA;AAGQ;AACA;AACA;AACA;;;AAaZ;;AAKA;;AAEI;;AAEQ;AAKQ;AACA;AACA;AACA;AACH;;AAIF;;;;;;;;AAQC;AACI;AACA;;;;AAKJ;AACI;AACA;;;AAIR;AAEQ;AACA;AACA;AACA;;;AAaI;;AACA;AACA;AACA;;AAMZ;;;AAGR;;AAIJ;AACJ;;;;AAKI;;AAGI;AAeY;;;AAGA;;;;;;AAeJ;AACA;AACA;AACA;;AAMhB;;;AAII;;AAOY;;;AAGA;AACJ;;AAGR;;;AAGA;AACI;;;;AA8BgB;AACA;AACJ;AASI;;AAUA;;AAa5B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/CalendarInput/index.tsx"],"sourcesContent":["\"use client\";\
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/CalendarInput/index.tsx"],"sourcesContent":["\"use client\";\nimport Input, { InputProps } from '../Input'\nimport Menu, { MenuProps } from '../Menu'\nimport { useRef, useState } from 'react'\nimport Calendar, { CalendarProps } from '../Calendar'\nimport Stack from '../Stack'\nimport ClickOutside from '../ClickOutside'\nimport CalendarIcon from '@xanui/icons/CalendarMonth';\nimport IconButton from '../IconButton'\nimport ClearIcon from '@xanui/icons/Clear';\nimport { useInterface } from '@xanui/core'\n\nexport type CalenderInpurProps = Omit<InputProps, \"value\" | \"onChange\" | \"slotProps\"> & {\n value?: CalendarProps[\"value\"];\n onChange?: CalendarProps[\"onChange\"];\n getInputValue?: (value?: Date | null) => string;\n slotProps?: {\n input?: InputProps['slotProps'];\n calender?: CalendarProps;\n menu?: MenuProps;\n }\n}\n\nconst CalenderInput = (props: CalenderInpurProps) => {\n let [{ value, onChange, getInputValue, slotProps, placeholder, ...inputProps }] = useInterface<any>(\"CanlendarInput\", props, {})\n const [target, setTarget] = useState<any>()\n const inputRef: any = useRef(null)\n\n return (\n <>\n <Input\n readOnly\n startIcon={<CalendarIcon />}\n placeholder={placeholder}\n {...inputProps}\n endIcon={<>\n {value && <Stack>\n <IconButton\n color=\"default\"\n size={28}\n variant=\"text\"\n onClick={() => {\n onChange && onChange(null)\n }}\n >\n <ClearIcon fontSize={20} />\n </IconButton>\n </Stack>}\n </>}\n cursor=\"pointer\"\n ref={inputRef}\n onFocus={() => setTarget(target ? null : inputRef?.current)}\n value={getInputValue ? getInputValue(value) : (value ? value.toLocaleDateString(\"en-US\") : \"\")}\n />\n <Menu\n target={target}\n placement=\"bottom-left\"\n bgcolor=\"transparent\"\n {...slotProps?.menu}\n >\n <ClickOutside onClickOutside={() => setTarget(null)}>\n <Calendar\n {...slotProps?.calender}\n value={value}\n onChange={(e) => {\n setTarget(null)\n onChange && onChange(e)\n }}\n />\n </ClickOutside>\n </Menu>\n </>\n )\n}\n\nexport default CalenderInput"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAuBA;;;AAGI;;AAgB4B;AACJ;;AAuBA;AACJ;AAMxB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/CalendarInput/index.tsx"],"sourcesContent":["\"use client\";\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/CalendarInput/index.tsx"],"sourcesContent":["\"use client\";\nimport Input, { InputProps } from '../Input'\nimport Menu, { MenuProps } from '../Menu'\nimport { useRef, useState } from 'react'\nimport Calendar, { CalendarProps } from '../Calendar'\nimport Stack from '../Stack'\nimport ClickOutside from '../ClickOutside'\nimport CalendarIcon from '@xanui/icons/CalendarMonth';\nimport IconButton from '../IconButton'\nimport ClearIcon from '@xanui/icons/Clear';\nimport { useInterface } from '@xanui/core'\n\nexport type CalenderInpurProps = Omit<InputProps, \"value\" | \"onChange\" | \"slotProps\"> & {\n value?: CalendarProps[\"value\"];\n onChange?: CalendarProps[\"onChange\"];\n getInputValue?: (value?: Date | null) => string;\n slotProps?: {\n input?: InputProps['slotProps'];\n calender?: CalendarProps;\n menu?: MenuProps;\n }\n}\n\nconst CalenderInput = (props: CalenderInpurProps) => {\n let [{ value, onChange, getInputValue, slotProps, placeholder, ...inputProps }] = useInterface<any>(\"CanlendarInput\", props, {})\n const [target, setTarget] = useState<any>()\n const inputRef: any = useRef(null)\n\n return (\n <>\n <Input\n readOnly\n startIcon={<CalendarIcon />}\n placeholder={placeholder}\n {...inputProps}\n endIcon={<>\n {value && <Stack>\n <IconButton\n color=\"default\"\n size={28}\n variant=\"text\"\n onClick={() => {\n onChange && onChange(null)\n }}\n >\n <ClearIcon fontSize={20} />\n </IconButton>\n </Stack>}\n </>}\n cursor=\"pointer\"\n ref={inputRef}\n onFocus={() => setTarget(target ? null : inputRef?.current)}\n value={getInputValue ? getInputValue(value) : (value ? value.toLocaleDateString(\"en-US\") : \"\")}\n />\n <Menu\n target={target}\n placement=\"bottom-left\"\n bgcolor=\"transparent\"\n {...slotProps?.menu}\n >\n <ClickOutside onClickOutside={() => setTarget(null)}>\n <Calendar\n {...slotProps?.calender}\n value={value}\n onChange={(e) => {\n setTarget(null)\n onChange && onChange(e)\n }}\n />\n </ClickOutside>\n </Menu>\n </>\n )\n}\n\nexport default CalenderInput"],"names":[],"mappings":";;;;;;;;;;;;;;AAuBA;;;AAGI;;AAgB4B;AACJ;;AAuBA;AACJ;AAMxB;;"}
|
package/Checkbox/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/Checkbox/index.tsx"],"sourcesContent":["\"use client\";\
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Checkbox/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { useState, ReactElement } from 'react';\nimport { Tag, useInterface, UseColorTemplateColor, TagProps, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\nimport CheckIcon from '@xanui/icons/CheckBox'\nimport UnCheckIcon from '@xanui/icons/CheckBoxOutlineBlank'\nimport IndeterminateCheckBoxIcon from '@xanui/icons/IndeterminateCheckBox';\n\n\nexport type CheckboxProps = Omit<TagProps<\"input\">, \"color\" | \"size\" | \"component\" | \"type\" | \"checked\"> & {\n checkIcon?: useBreakpointPropsType<ReactElement>;\n uncheckIcon?: useBreakpointPropsType<ReactElement>;\n indeterminate?: useBreakpointPropsType<boolean>;\n checked?: boolean;\n size?: useBreakpointPropsType<number | \"small\" | \"medium\" | \"large\">;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n}\n\nconst Checkbox = React.forwardRef((props: CheckboxProps, ref?: React.Ref<any>) => {\n let [{ color, size, checkIcon, uncheckIcon, checked, indeterminate, disabled, onChange, ...rest }] = useInterface<any>(\"Checkbox\", props, {})\n const _p: any = {}\n if (checkIcon) _p.checkIcon = checkIcon\n if (uncheckIcon) _p.uncheckIcon = uncheckIcon\n if (indeterminate) _p.indeterminate = indeterminate\n if (size) _p.size = size\n if (color) _p.color = color\n const p: any = useBreakpointProps(_p)\n\n checkIcon = p.checkIcon\n uncheckIcon = p.uncheckIcon\n indeterminate = p.indeterminate\n size = p.size\n color = p.color\n\n const [c, set] = useState(false)\n checked ??= c\n size ??= \"medium\"\n color ??= \"brand\"\n\n onChange = onChange || (() => set(!c));\n if (indeterminate) {\n checked = true\n checkIcon = <IndeterminateCheckBoxIcon />\n }\n\n let sizes: any = {\n small: 22,\n medium: 24,\n large: 32\n }\n\n if (typeof size === 'string' && sizes[size]) {\n size = sizes[size]\n }\n\n return (\n <>\n <Tag\n baseClass='checkbox'\n onClick={() => {\n onChange && onChange()\n }}\n sxr={{\n height: size,\n width: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n color: checked ? color : \"text.secondary\",\n cursor: \"pointer\",\n disabled: disabled,\n \"& svg\": {\n fontSize: size\n },\n ...rest?.sx\n }}\n >\n {checked ? (checkIcon || <CheckIcon />) : (uncheckIcon || <UnCheckIcon />)}\n </Tag>\n <Tag\n {...rest}\n component='input'\n ref={ref}\n readOnly\n type=\"checkbox\"\n checked={checked}\n sxr={{\n display: \"none!important\"\n }}\n />\n </>\n )\n})\n\nexport default Checkbox\n"],"names":[],"mappings":";;;;;;;;;;;AAiBA;AACI;;AAEA;AAAe;AACf;AAAiB;AACjB;AAAmB;AACnB;AAAU;AACV;AAAW;AACX;AAEA;AACA;AACA;AACA;AACA;;;;;AAOA;;;AAGI;;AAGJ;AACI;AACA;AACA;;;AAIA;;AAGJ;;;AAiBoB;;AAeJ;;AAKpB;;"}
|
package/Checkbox/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Checkbox/index.tsx"],"sourcesContent":["\"use client\";\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Checkbox/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { useState, ReactElement } from 'react';\nimport { Tag, useInterface, UseColorTemplateColor, TagProps, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\nimport CheckIcon from '@xanui/icons/CheckBox'\nimport UnCheckIcon from '@xanui/icons/CheckBoxOutlineBlank'\nimport IndeterminateCheckBoxIcon from '@xanui/icons/IndeterminateCheckBox';\n\n\nexport type CheckboxProps = Omit<TagProps<\"input\">, \"color\" | \"size\" | \"component\" | \"type\" | \"checked\"> & {\n checkIcon?: useBreakpointPropsType<ReactElement>;\n uncheckIcon?: useBreakpointPropsType<ReactElement>;\n indeterminate?: useBreakpointPropsType<boolean>;\n checked?: boolean;\n size?: useBreakpointPropsType<number | \"small\" | \"medium\" | \"large\">;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n}\n\nconst Checkbox = React.forwardRef((props: CheckboxProps, ref?: React.Ref<any>) => {\n let [{ color, size, checkIcon, uncheckIcon, checked, indeterminate, disabled, onChange, ...rest }] = useInterface<any>(\"Checkbox\", props, {})\n const _p: any = {}\n if (checkIcon) _p.checkIcon = checkIcon\n if (uncheckIcon) _p.uncheckIcon = uncheckIcon\n if (indeterminate) _p.indeterminate = indeterminate\n if (size) _p.size = size\n if (color) _p.color = color\n const p: any = useBreakpointProps(_p)\n\n checkIcon = p.checkIcon\n uncheckIcon = p.uncheckIcon\n indeterminate = p.indeterminate\n size = p.size\n color = p.color\n\n const [c, set] = useState(false)\n checked ??= c\n size ??= \"medium\"\n color ??= \"brand\"\n\n onChange = onChange || (() => set(!c));\n if (indeterminate) {\n checked = true\n checkIcon = <IndeterminateCheckBoxIcon />\n }\n\n let sizes: any = {\n small: 22,\n medium: 24,\n large: 32\n }\n\n if (typeof size === 'string' && sizes[size]) {\n size = sizes[size]\n }\n\n return (\n <>\n <Tag\n baseClass='checkbox'\n onClick={() => {\n onChange && onChange()\n }}\n sxr={{\n height: size,\n width: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n color: checked ? color : \"text.secondary\",\n cursor: \"pointer\",\n disabled: disabled,\n \"& svg\": {\n fontSize: size\n },\n ...rest?.sx\n }}\n >\n {checked ? (checkIcon || <CheckIcon />) : (uncheckIcon || <UnCheckIcon />)}\n </Tag>\n <Tag\n {...rest}\n component='input'\n ref={ref}\n readOnly\n type=\"checkbox\"\n checked={checked}\n sxr={{\n display: \"none!important\"\n }}\n />\n </>\n )\n})\n\nexport default Checkbox\n"],"names":[],"mappings":";;;;;;;;;AAiBA;AACI;;AAEA;AAAe;AACf;AAAiB;AACjB;AAAmB;AACnB;AAAU;AACV;AAAW;AACX;AAEA;AACA;AACA;AACA;AACA;;;;;AAOA;;;AAGI;;AAGJ;AACI;AACA;AACA;;;AAIA;;AAGJ;;;AAiBoB;;AAeJ;;AAKpB;;"}
|
package/Chip/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/Chip/index.tsx"],"sourcesContent":["import React, { ReactElement } from 'react';\
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Chip/index.tsx"],"sourcesContent":["import React, { ReactElement } from 'react';\nimport { Tag, TagProps, TagComponentType, useInterface, useColorTemplate, UseColorTemplateColor, UseColorTemplateType, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\nimport useCorner, { UseCornerTypes } from '../useCorner'\n\n\n\nexport type ChipProps<T extends TagComponentType = 'div'> = Omit<TagProps<T>, \"color\" | \"children\" | \"size\"> & {\n label: useBreakpointPropsType<string | ReactElement>;\n startIcon?: useBreakpointPropsType<ReactElement>;\n endIcon?: useBreakpointPropsType<ReactElement>;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n variant?: useBreakpointPropsType<UseColorTemplateType>;\n corner?: useBreakpointPropsType<UseCornerTypes>;\n size?: useBreakpointPropsType<\"small\" | \"medium\" | \"large\">;\n}\n\n\nconst Chip = React.forwardRef(<T extends TagComponentType = 'div'>(props: ChipProps<T>, ref: React.Ref<any>) => {\n let [{ label, variant, startIcon, endIcon, color, corner, size, ...rest }] = useInterface<any>(\"Chip\", props, {})\n const _p: any = {}\n if (label) _p.label = label\n if (startIcon) _p.startIcon = startIcon\n if (endIcon) _p.endIcon = endIcon\n if (color) _p.color = color\n if (variant) _p.variant = variant\n if (corner) _p.corner = corner\n if (size) _p.size = size\n const p: any = useBreakpointProps(_p)\n\n label = p.label\n startIcon = p.startIcon\n endIcon = p.endIcon\n color = p.color || \"brand\"\n variant = p.variant || \"fill\"\n corner = p.corner || \"circle\"\n size = p.size || \"medium\"\n rest.sx = (rest as any).sx || {};\n\n const cornerCss = useCorner(corner)\n const template = useColorTemplate(color, variant)\n\n const sizes: any = {\n small: {\n height: 24,\n gap: .5,\n px: startIcon || endIcon ? .8 : 1,\n fontSize: \"small\"\n },\n medium: {\n height: 32,\n gap: 1,\n px: startIcon || endIcon ? .8 : 1.5,\n fontSize: 'button',\n },\n large: {\n height: 40,\n fontSize: 'text',\n gap: 1,\n px: startIcon || endIcon ? .8 : 1.5,\n }\n }\n\n return (\n <Tag\n {...cornerCss}\n {...template.primary}\n {...(sizes[size as any] || {})}\n {...rest}\n sxr={{\n display: \"inline-flex\",\n flexDirection: \"row\",\n alignItems: \"center\",\n transition: \"background .3s\",\n overflow: \"hidden\",\n\n \"& > *\": {\n flex: \"0 0 auto\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n },\n }}\n baseClass='chip'\n ref={ref}\n >\n {startIcon}\n <Tag\n sxr={{\n alignItems: \"center\",\n flexBox: true\n }}\n >{label}</Tag>\n {endIcon}\n </Tag>\n )\n})\n\nexport default Chip\n"],"names":["useInterface","__rest","useBreakpointProps","useCorner","useColorTemplate","_jsxs","Tag","_jsx"],"mappings":"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"}
|
package/Chip/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Chip/index.tsx"],"sourcesContent":["import React, { ReactElement } from 'react';\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Chip/index.tsx"],"sourcesContent":["import React, { ReactElement } from 'react';\nimport { Tag, TagProps, TagComponentType, useInterface, useColorTemplate, UseColorTemplateColor, UseColorTemplateType, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\nimport useCorner, { UseCornerTypes } from '../useCorner'\n\n\n\nexport type ChipProps<T extends TagComponentType = 'div'> = Omit<TagProps<T>, \"color\" | \"children\" | \"size\"> & {\n label: useBreakpointPropsType<string | ReactElement>;\n startIcon?: useBreakpointPropsType<ReactElement>;\n endIcon?: useBreakpointPropsType<ReactElement>;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n variant?: useBreakpointPropsType<UseColorTemplateType>;\n corner?: useBreakpointPropsType<UseCornerTypes>;\n size?: useBreakpointPropsType<\"small\" | \"medium\" | \"large\">;\n}\n\n\nconst Chip = React.forwardRef(<T extends TagComponentType = 'div'>(props: ChipProps<T>, ref: React.Ref<any>) => {\n let [{ label, variant, startIcon, endIcon, color, corner, size, ...rest }] = useInterface<any>(\"Chip\", props, {})\n const _p: any = {}\n if (label) _p.label = label\n if (startIcon) _p.startIcon = startIcon\n if (endIcon) _p.endIcon = endIcon\n if (color) _p.color = color\n if (variant) _p.variant = variant\n if (corner) _p.corner = corner\n if (size) _p.size = size\n const p: any = useBreakpointProps(_p)\n\n label = p.label\n startIcon = p.startIcon\n endIcon = p.endIcon\n color = p.color || \"brand\"\n variant = p.variant || \"fill\"\n corner = p.corner || \"circle\"\n size = p.size || \"medium\"\n rest.sx = (rest as any).sx || {};\n\n const cornerCss = useCorner(corner)\n const template = useColorTemplate(color, variant)\n\n const sizes: any = {\n small: {\n height: 24,\n gap: .5,\n px: startIcon || endIcon ? .8 : 1,\n fontSize: \"small\"\n },\n medium: {\n height: 32,\n gap: 1,\n px: startIcon || endIcon ? .8 : 1.5,\n fontSize: 'button',\n },\n large: {\n height: 40,\n fontSize: 'text',\n gap: 1,\n px: startIcon || endIcon ? .8 : 1.5,\n }\n }\n\n return (\n <Tag\n {...cornerCss}\n {...template.primary}\n {...(sizes[size as any] || {})}\n {...rest}\n sxr={{\n display: \"inline-flex\",\n flexDirection: \"row\",\n alignItems: \"center\",\n transition: \"background .3s\",\n overflow: \"hidden\",\n\n \"& > *\": {\n flex: \"0 0 auto\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n },\n }}\n baseClass='chip'\n ref={ref}\n >\n {startIcon}\n <Tag\n sxr={{\n alignItems: \"center\",\n flexBox: true\n }}\n >{label}</Tag>\n {endIcon}\n </Tag>\n )\n})\n\nexport default Chip\n"],"names":["_jsxs","_jsx"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/CircleProgress/index.tsx"],"sourcesContent":["\"use client\";\
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/CircleProgress/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { ReactElement, useId } from \"react\"\nimport { Tag, UseColorTemplateColor, useInterface, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\n\nexport type CircleProgressProps = {\n children?: ReactElement;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n trackColor?: useBreakpointPropsType<UseColorTemplateColor>;\n thumbColor?: useBreakpointPropsType<UseColorTemplateColor>;\n size?: useBreakpointPropsType<number | \"small\" | \"medium\" | \"large\">;\n thumbSize?: useBreakpointPropsType<number>;\n trackSize?: useBreakpointPropsType<number>;\n value?: useBreakpointPropsType<number>;\n hideTrack?: useBreakpointPropsType<boolean>;\n showPercentage?: useBreakpointPropsType<boolean>;\n speed?: useBreakpointPropsType<number>;\n}\n\nconst CircleProgress = React.forwardRef(({ children, ...props }: CircleProgressProps, ref: React.Ref<any>) => {\n let [{ color, trackColor, thumbColor, size, value, thumbSize, hideTrack, trackSize, showPercentage, speed }] = useInterface<any>(\"CircleProgress\", props, {})\n const _p: any = {}\n if (color) _p.color = color\n if (trackColor) _p.trackColor = trackColor\n if (thumbColor) _p.thumbColor = thumbColor\n if (size) _p.size = size\n if (thumbSize) _p.thumbSize = thumbSize\n if (trackSize) _p.trackSize = trackSize\n if (value) _p.value = value\n if (hideTrack) _p.hideTrack = hideTrack\n if (showPercentage) _p.showPercentage = showPercentage\n if (speed) _p.speed = speed\n const p: any = useBreakpointProps(_p)\n\n color = p.color ?? \"brand\"\n trackColor = p.trackColor\n thumbColor = p.thumbColor\n size = p.size ?? \"medium\"\n thumbSize = p.thumbSize ?? 4\n trackSize = p.trackSize\n value = p.value\n hideTrack = p.hideTrack\n showPercentage = p.showPercentage\n speed = p.speed ?? 1.3\n\n if (trackColor === 'default') {\n trackColor = \"divider\"\n }\n\n if (thumbColor === 'default') {\n thumbColor = \"divider.secondary\"\n }\n\n\n let sizes: any = {\n small: 24,\n medium: 32,\n large: 44\n }\n if (typeof size === 'string' && sizes[size]) {\n size = sizes[size]\n }\n\n let isVal = typeof value === 'number'\n const animrotate = \"anim\" + useId().replace(\":\", \"\")\n const animdash = \"anim\" + useId().replace(\":\", \"\")\n if (isVal && (value as number) > 100) value = 100\n const circumference = 125.66370614359172 //radius * 2 * Math.PI\n const percent = circumference - ((value || 0) / 100) * circumference\n\n if (showPercentage && !children) {\n children = <Tag\n sxr={{\n color: color === 'default' ? \"text.primary\" : `${color}.primary`,\n fontSize: size / 4\n }}\n >{value}%</Tag>\n }\n\n return (\n <Tag\n baseClass='circle-progress'\n sxr={{\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n \"& svg[class='circle-progress-svg']\": {\n zIndex: 1,\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n transform: isVal ? \"rotate(-90deg)\" : \"none\",\n transformOrigin: isVal ? \"center\" : \"initial\",\n animation: isVal ? \"none\" : `${animrotate} ${speed}s linear infinite`,\n [`@keyframes ${animrotate}`]: {\n \"100%\": {\n transform: \"rotate(360deg)\"\n }\n },\n \"& circle.circle-progress-thumb\": {\n\n strokeDasharray: circumference,\n strokeDashoffset: percent,\n stroke: thumbColor || (color === 'default' ? `divider` : `${color}.primary`),\n fill: \"none\",\n strokeWidth: thumbSize,\n strokeLinecap: \"round\",\n animation: isVal ? \"none\" : `${animdash} ${speed}s ease-in-out infinite`,\n [`@keyframes ${animdash}`]: {\n \"0%\": { strokeDasharray: \"1, 150\", strokeDashoffset: 0 },\n \"50%\": { strokeDasharray: \"90, 150\", strokeDashoffset: -35 },\n \"100%\": { strokeDasharray: \"90, 150\", strokeDashoffset: -124 }\n }\n },\n \"& circle.circle-progress-track\": {\n fill: \"none\",\n stroke: trackColor || (color === 'default' ? `text.primary` : `${color}.soft.secondary`),\n strokeWidth: trackSize ?? thumbSize,\n }\n },\n width: size,\n height: size,\n position: \"relative\"\n }}\n ref={ref}\n >\n <svg viewBox=\"0 0 50 50\" className=\"circle-progress-svg\">\n {!hideTrack && <circle className=\"circle-progress-track\" cx=\"25\" cy=\"25\" r={20} />}\n <circle className=\"circle-progress-thumb\" cx=\"25\" cy=\"25\" r={20} />\n </svg>\n {!!children && <Tag\n baseClass=\"circle-progress-content\"\n sxr={{\n zIndex: 2,\n width: size - thumbSize,\n height: size - thumbSize,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n '& *': {\n maxWidth: size - (thumbSize + 8),\n maxHeight: size - (thumbSize + 8),\n }\n }}\n >\n {children}\n </Tag>}\n </Tag >\n )\n})\n\nexport default CircleProgress\n\n"],"names":[],"mappings":";;;;;;;;AAkBA;;AAAyC;AACrC;;AAEA;AAAW;AACX;AAAgB;AAChB;AAAgB;AAChB;AAAU;AACV;AAAe;AACf;AAAe;AACf;AAAW;AACX;AAAe;AACf;AAAoB;AACpB;AAAW;AACX;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;AAIA;;;AAKA;AACI;AACA;AACA;;;AAGA;;AAGJ;AACA;AACA;AACA;;AACA;AACA;AAEA;AACI;AAEQ;;;;;AAUA;AACA;AACA;AACA;AACI;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACI;AACI;AACH;AACJ;AACD;AAEI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIC;AACJ;AACD;AACI;AACA;AACA;AACH;AACJ;AACD;AACA;AACA;AACH;AAUO;;;AAGA;AACA;AACA;AACA;AACI;AACA;AACH;AACJ;AAMjB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/CircleProgress/index.tsx"],"sourcesContent":["\"use client\";\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/CircleProgress/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { ReactElement, useId } from \"react\"\nimport { Tag, UseColorTemplateColor, useInterface, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\n\nexport type CircleProgressProps = {\n children?: ReactElement;\n color?: useBreakpointPropsType<UseColorTemplateColor>;\n trackColor?: useBreakpointPropsType<UseColorTemplateColor>;\n thumbColor?: useBreakpointPropsType<UseColorTemplateColor>;\n size?: useBreakpointPropsType<number | \"small\" | \"medium\" | \"large\">;\n thumbSize?: useBreakpointPropsType<number>;\n trackSize?: useBreakpointPropsType<number>;\n value?: useBreakpointPropsType<number>;\n hideTrack?: useBreakpointPropsType<boolean>;\n showPercentage?: useBreakpointPropsType<boolean>;\n speed?: useBreakpointPropsType<number>;\n}\n\nconst CircleProgress = React.forwardRef(({ children, ...props }: CircleProgressProps, ref: React.Ref<any>) => {\n let [{ color, trackColor, thumbColor, size, value, thumbSize, hideTrack, trackSize, showPercentage, speed }] = useInterface<any>(\"CircleProgress\", props, {})\n const _p: any = {}\n if (color) _p.color = color\n if (trackColor) _p.trackColor = trackColor\n if (thumbColor) _p.thumbColor = thumbColor\n if (size) _p.size = size\n if (thumbSize) _p.thumbSize = thumbSize\n if (trackSize) _p.trackSize = trackSize\n if (value) _p.value = value\n if (hideTrack) _p.hideTrack = hideTrack\n if (showPercentage) _p.showPercentage = showPercentage\n if (speed) _p.speed = speed\n const p: any = useBreakpointProps(_p)\n\n color = p.color ?? \"brand\"\n trackColor = p.trackColor\n thumbColor = p.thumbColor\n size = p.size ?? \"medium\"\n thumbSize = p.thumbSize ?? 4\n trackSize = p.trackSize\n value = p.value\n hideTrack = p.hideTrack\n showPercentage = p.showPercentage\n speed = p.speed ?? 1.3\n\n if (trackColor === 'default') {\n trackColor = \"divider\"\n }\n\n if (thumbColor === 'default') {\n thumbColor = \"divider.secondary\"\n }\n\n\n let sizes: any = {\n small: 24,\n medium: 32,\n large: 44\n }\n if (typeof size === 'string' && sizes[size]) {\n size = sizes[size]\n }\n\n let isVal = typeof value === 'number'\n const animrotate = \"anim\" + useId().replace(\":\", \"\")\n const animdash = \"anim\" + useId().replace(\":\", \"\")\n if (isVal && (value as number) > 100) value = 100\n const circumference = 125.66370614359172 //radius * 2 * Math.PI\n const percent = circumference - ((value || 0) / 100) * circumference\n\n if (showPercentage && !children) {\n children = <Tag\n sxr={{\n color: color === 'default' ? \"text.primary\" : `${color}.primary`,\n fontSize: size / 4\n }}\n >{value}%</Tag>\n }\n\n return (\n <Tag\n baseClass='circle-progress'\n sxr={{\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n \"& svg[class='circle-progress-svg']\": {\n zIndex: 1,\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n transform: isVal ? \"rotate(-90deg)\" : \"none\",\n transformOrigin: isVal ? \"center\" : \"initial\",\n animation: isVal ? \"none\" : `${animrotate} ${speed}s linear infinite`,\n [`@keyframes ${animrotate}`]: {\n \"100%\": {\n transform: \"rotate(360deg)\"\n }\n },\n \"& circle.circle-progress-thumb\": {\n\n strokeDasharray: circumference,\n strokeDashoffset: percent,\n stroke: thumbColor || (color === 'default' ? `divider` : `${color}.primary`),\n fill: \"none\",\n strokeWidth: thumbSize,\n strokeLinecap: \"round\",\n animation: isVal ? \"none\" : `${animdash} ${speed}s ease-in-out infinite`,\n [`@keyframes ${animdash}`]: {\n \"0%\": { strokeDasharray: \"1, 150\", strokeDashoffset: 0 },\n \"50%\": { strokeDasharray: \"90, 150\", strokeDashoffset: -35 },\n \"100%\": { strokeDasharray: \"90, 150\", strokeDashoffset: -124 }\n }\n },\n \"& circle.circle-progress-track\": {\n fill: \"none\",\n stroke: trackColor || (color === 'default' ? `text.primary` : `${color}.soft.secondary`),\n strokeWidth: trackSize ?? thumbSize,\n }\n },\n width: size,\n height: size,\n position: \"relative\"\n }}\n ref={ref}\n >\n <svg viewBox=\"0 0 50 50\" className=\"circle-progress-svg\">\n {!hideTrack && <circle className=\"circle-progress-track\" cx=\"25\" cy=\"25\" r={20} />}\n <circle className=\"circle-progress-thumb\" cx=\"25\" cy=\"25\" r={20} />\n </svg>\n {!!children && <Tag\n baseClass=\"circle-progress-content\"\n sxr={{\n zIndex: 2,\n width: size - thumbSize,\n height: size - thumbSize,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n '& *': {\n maxWidth: size - (thumbSize + 8),\n maxHeight: size - (thumbSize + 8),\n }\n }}\n >\n {children}\n </Tag>}\n </Tag >\n )\n})\n\nexport default CircleProgress\n\n"],"names":[],"mappings":";;;;;;AAkBA;;AAAyC;AACrC;;AAEA;AAAW;AACX;AAAgB;AAChB;AAAgB;AAChB;AAAU;AACV;AAAe;AACf;AAAe;AACf;AAAW;AACX;AAAe;AACf;AAAoB;AACpB;AAAW;AACX;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;AAIA;;;AAKA;AACI;AACA;AACA;;;AAGA;;AAGJ;AACA;AACA;AACA;;AACA;AACA;AAEA;AACI;AAEQ;;;;;AAUA;AACA;AACA;AACA;AACI;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACI;AACI;AACH;AACJ;AACD;AAEI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIC;AACJ;AACD;AACI;AACA;AACA;AACH;AACJ;AACD;AACA;AACA;AACH;AAUO;;;AAGA;AACA;AACA;AACA;AACI;AACA;AACH;AACJ;AAMjB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/ClickOutside/index.tsx"],"sourcesContent":["\"use client\";\
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/ClickOutside/index.tsx"],"sourcesContent":["\"use client\";\nimport { Tag, TagComponentType, TagProps } from '@xanui/core';\nimport React, { useEffect, useRef } from 'react';\n\nexport type ClickOutsideProps<T extends TagComponentType = \"div\"> = TagProps<T> & {\n onClickOutside: (e: MouseEvent) => void;\n children: React.ReactElement\n};\n\nconst ClickOutside = React.forwardRef(<T extends TagComponentType = \"div\">({ children, onClickOutside, ...props }: ClickOutsideProps<T>, forwardedRef: any) => {\n\n const innerRef = useRef<HTMLElement | null>(null);\n\n // merge refs\n const setRefs = (el: HTMLElement) => {\n innerRef.current = el;\n if (typeof forwardedRef === \"function\") {\n forwardedRef(el);\n } else if (forwardedRef) {\n forwardedRef.current = el;\n }\n };\n\n useEffect(() => {\n const handler = (e: MouseEvent) => {\n if (!innerRef.current) return;\n if (!innerRef.current.contains(e.target as Node)) {\n onClickOutside(e);\n }\n };\n\n document.addEventListener(\"mousedown\", handler);\n return () => document.removeEventListener(\"mousedown\", handler);\n }, [onClickOutside]);\n\n return (\n <Tag\n component=\"div\"\n display=\"inline-block\"\n {...props}\n baseClass='click-outside'\n ref={setRefs}\n >\n {children}\n </Tag>\n )\n});\n\nexport default ClickOutside;\n"],"names":[],"mappings":";;;;;;;;AASA;;AAEI;;AAGA;AACI;AACA;;;;AAGI;;AAER;;AAGI;;;AAEI;;;AAGJ;AAEA;;AAEJ;;AAaJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/ClickOutside/index.tsx"],"sourcesContent":["\"use client\";\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/ClickOutside/index.tsx"],"sourcesContent":["\"use client\";\nimport { Tag, TagComponentType, TagProps } from '@xanui/core';\nimport React, { useEffect, useRef } from 'react';\n\nexport type ClickOutsideProps<T extends TagComponentType = \"div\"> = TagProps<T> & {\n onClickOutside: (e: MouseEvent) => void;\n children: React.ReactElement\n};\n\nconst ClickOutside = React.forwardRef(<T extends TagComponentType = \"div\">({ children, onClickOutside, ...props }: ClickOutsideProps<T>, forwardedRef: any) => {\n\n const innerRef = useRef<HTMLElement | null>(null);\n\n // merge refs\n const setRefs = (el: HTMLElement) => {\n innerRef.current = el;\n if (typeof forwardedRef === \"function\") {\n forwardedRef(el);\n } else if (forwardedRef) {\n forwardedRef.current = el;\n }\n };\n\n useEffect(() => {\n const handler = (e: MouseEvent) => {\n if (!innerRef.current) return;\n if (!innerRef.current.contains(e.target as Node)) {\n onClickOutside(e);\n }\n };\n\n document.addEventListener(\"mousedown\", handler);\n return () => document.removeEventListener(\"mousedown\", handler);\n }, [onClickOutside]);\n\n return (\n <Tag\n component=\"div\"\n display=\"inline-block\"\n {...props}\n baseClass='click-outside'\n ref={setRefs}\n >\n {children}\n </Tag>\n )\n});\n\nexport default ClickOutside;\n"],"names":[],"mappings":";;;;;;AASA;;AAEI;;AAGA;AACI;AACA;;;;AAGI;;AAER;;AAGI;;;AAEI;;;AAGJ;AAEA;;AAEJ;;AAaJ;;"}
|
package/Collaps/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/Collaps/index.tsx"],"sourcesContent":["import React from 'react';\
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Collaps/index.tsx"],"sourcesContent":["import React from 'react';\nimport { Tag, TagProps, TagComponentType, useInterface, TransitionProps, Transition } from '@xanui/core';\n\nexport type CollapsProps<T extends TagComponentType = \"div\"> = TagProps<T> & Omit<TransitionProps, \"variant\" | \"children\"> & {\n\n}\n\nconst Collaps = React.forwardRef(<T extends TagComponentType = \"div\">({ children, open, ...props }: CollapsProps<T>, ref: any) => {\n let [{\n ease,\n easing,\n duration,\n delay,\n onStart,\n onFinish,\n onOpen,\n onOpened,\n onClose,\n onClosed,\n ...rest\n }] = useInterface<any>(\"Collaps\", props, {})\n\n open ??= false\n easing ??= \"standard\"\n\n return (\n <Transition\n {...{\n ease,\n easing,\n duration,\n delay,\n onStart,\n onFinish,\n onOpen,\n onOpened,\n onClose,\n onClosed\n }}\n disableInitialTransition\n variant=\"collapseVertical\"\n open={open}\n >\n <Tag\n {...rest}\n baseClass='collaps'\n ref={ref}\n >{children}</Tag>\n </Transition>\n )\n})\n\nexport default Collaps\n\n\n"],"names":["__rest","useInterface","_jsx","Transition","Tag"],"mappings":";;;;;;;AAOA,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAA6C,EAAE,GAAQ,KAAI;QAA3D,EAAE,QAAQ,EAAE,IAAI,EAAA,GAAA,EAA6B,EAAxB,KAAK,GAAAA,YAAA,CAAA,EAAA,EAA1B,oBAA4B,CAAF;AAC5F,IAAA,IAAI,OAYCC,iBAAY,CAAM,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,EAZvC,EACD,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,OAEX,EADM,IAAI,GAAAD,YAAA,CAAA,EAAA,EAXN,CAAA,MAAA,EAAA,QAAA,EAAA,UAAA,EAAA,OAAA,EAAA,SAAA,EAAA,UAAA,EAAA,QAAA,EAAA,UAAA,EAAA,SAAA,EAAA,UAAA,CAYJ,CAA2C;IAE5C,IAAI,KAAA,IAAA,IAAJ,IAAI,KAAA,MAAA,GAAJ,IAAI,IAAJ,IAAI,GAAK,KAAK,CAAA;IACd,MAAM,KAAA,IAAA,IAAN,MAAM,KAAA,MAAA,GAAN,MAAM,IAAN,MAAM,GAAK,UAAU,CAAA;AAErB,IAAA,QACIE,cAAA,CAACC,eAAU,EAAA,EAEH,IAAI;QACJ,MAAM;QACN,QAAQ;QACR,KAAK;QACL,OAAO;QACP,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,OAAO;AACP,QAAA,QAAQ,EAEZ,wBAAwB,EAAA,IAAA,EACxB,OAAO,EAAC,kBAAkB,EAC1B,IAAI,EAAE,IAAI,EAAA,QAAA,EAEVD,cAAA,CAACE,QAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACI,IAAI,EAAA,EACR,SAAS,EAAC,SAAS,EACnB,GAAG,EAAE,GAAG,EAAA,QAAA,EACV,QAAQ,EAAA,CAAA,CAAO,EAAA,CACR;AAErB,CAAC;;;;"}
|
package/Collaps/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Collaps/index.tsx"],"sourcesContent":["import React from 'react';\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Collaps/index.tsx"],"sourcesContent":["import React from 'react';\nimport { Tag, TagProps, TagComponentType, useInterface, TransitionProps, Transition } from '@xanui/core';\n\nexport type CollapsProps<T extends TagComponentType = \"div\"> = TagProps<T> & Omit<TransitionProps, \"variant\" | \"children\"> & {\n\n}\n\nconst Collaps = React.forwardRef(<T extends TagComponentType = \"div\">({ children, open, ...props }: CollapsProps<T>, ref: any) => {\n let [{\n ease,\n easing,\n duration,\n delay,\n onStart,\n onFinish,\n onOpen,\n onOpened,\n onClose,\n onClosed,\n ...rest\n }] = useInterface<any>(\"Collaps\", props, {})\n\n open ??= false\n easing ??= \"standard\"\n\n return (\n <Transition\n {...{\n ease,\n easing,\n duration,\n delay,\n onStart,\n onFinish,\n onOpen,\n onOpened,\n onClose,\n onClosed\n }}\n disableInitialTransition\n variant=\"collapseVertical\"\n open={open}\n >\n <Tag\n {...rest}\n baseClass='collaps'\n ref={ref}\n >{children}</Tag>\n </Transition>\n )\n})\n\nexport default Collaps\n\n\n"],"names":["_jsx"],"mappings":";;;;;AAOA,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAA6C,EAAE,GAAQ,KAAI;QAA3D,EAAE,QAAQ,EAAE,IAAI,EAAA,GAAA,EAA6B,EAAxB,KAAK,GAAA,MAAA,CAAA,EAAA,EAA1B,oBAA4B,CAAF;AAC5F,IAAA,IAAI,OAYC,YAAY,CAAM,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,EAZvC,EACD,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,OAEX,EADM,IAAI,GAAA,MAAA,CAAA,EAAA,EAXN,CAAA,MAAA,EAAA,QAAA,EAAA,UAAA,EAAA,OAAA,EAAA,SAAA,EAAA,UAAA,EAAA,QAAA,EAAA,UAAA,EAAA,SAAA,EAAA,UAAA,CAYJ,CAA2C;IAE5C,IAAI,KAAA,IAAA,IAAJ,IAAI,KAAA,MAAA,GAAJ,IAAI,IAAJ,IAAI,GAAK,KAAK,CAAA;IACd,MAAM,KAAA,IAAA,IAAN,MAAM,KAAA,MAAA,GAAN,MAAM,IAAN,MAAM,GAAK,UAAU,CAAA;AAErB,IAAA,QACIA,GAAA,CAAC,UAAU,EAAA,EAEH,IAAI;QACJ,MAAM;QACN,QAAQ;QACR,KAAK;QACL,OAAO;QACP,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,OAAO;AACP,QAAA,QAAQ,EAEZ,wBAAwB,EAAA,IAAA,EACxB,OAAO,EAAC,kBAAkB,EAC1B,IAAI,EAAE,IAAI,EAAA,QAAA,EAEVA,GAAA,CAAC,GAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACI,IAAI,EAAA,EACR,SAAS,EAAC,SAAS,EACnB,GAAG,EAAE,GAAG,EAAA,QAAA,EACV,QAAQ,EAAA,CAAA,CAAO,EAAA,CACR;AAErB,CAAC;;;;"}
|
package/Container/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/Container/index.tsx"],"sourcesContent":["import React from 'react';\
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Container/index.tsx"],"sourcesContent":["import React from 'react';\nimport { Tag, TagProps, TagComponentType, useTheme, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\n\n\nexport type ContainerProps<T extends TagComponentType = \"div\"> = TagProps<T> & {\n maxWidth?: useBreakpointPropsType<'lg' | 'md' | \"sm\" | 'xs'>\n}\n\nconst Container = React.forwardRef(<T extends TagComponentType = \"div\">({ children, maxWidth, ...rest }: ContainerProps<T>, ref?: React.Ref<any>) => {\n const _p: any = {}\n if (maxWidth) _p.maxWidth = maxWidth\n const p: any = useBreakpointProps(_p)\n maxWidth = p.maxWidth\n\n const { breakpoints } = useTheme()\n maxWidth = maxWidth || \"lg\"\n return (\n <Tag\n {...rest}\n sxr={{\n width: \"100%\",\n maxWidth: {\n xs: \"100%\",\n [maxWidth as any]: (breakpoints as any)[maxWidth as any]\n },\n mx: \"auto\",\n px: 2,\n }}\n baseClass=\"container\"\n ref={ref}\n >{children}</Tag>\n )\n})\n\nexport default Container\n\n\n"],"names":["__rest","useBreakpointProps","useTheme","_jsx","Tag"],"mappings":";;;;;;;AAQA,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAAkD,EAAE,GAAoB,KAAI;QAA5E,EAAE,QAAQ,EAAE,QAAQ,EAAA,GAAA,EAA8B,EAAzB,IAAI,GAAAA,YAAA,CAAA,EAAA,EAA7B,wBAA+B,CAAF;IACjG,MAAM,EAAE,GAAQ,EAAE;AAClB,IAAA,IAAI,QAAQ;AAAE,QAAA,EAAE,CAAC,QAAQ,GAAG,QAAQ;AACpC,IAAA,MAAM,CAAC,GAAQC,uBAAkB,CAAC,EAAE,CAAC;AACrC,IAAA,QAAQ,GAAG,CAAC,CAAC,QAAQ;AAErB,IAAA,MAAM,EAAE,WAAW,EAAE,GAAGC,aAAQ,EAAE;AAClC,IAAA,QAAQ,GAAG,QAAQ,IAAI,IAAI;AAC3B,IAAA,QACIC,cAAA,CAACC,QAAG,oBACI,IAAI,EAAA,EACR,GAAG,EAAE;AACD,YAAA,KAAK,EAAE,MAAM;AACb,YAAA,QAAQ,EAAE;AACN,gBAAA,EAAE,EAAE,MAAM;AACV,gBAAA,CAAC,QAAe,GAAI,WAAmB,CAAC,QAAe;AAC1D,aAAA;AACD,YAAA,EAAE,EAAE,MAAM;AACV,YAAA,EAAE,EAAE,CAAC;SACR,EACD,SAAS,EAAC,WAAW,EACrB,GAAG,EAAE,GAAG,EAAA,QAAA,EACV,QAAQ,EAAA,CAAA,CAAO;AAEzB,CAAC;;;;"}
|