@lotte-innovate/ui-component-test 0.2.71 → 0.2.72
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +225 -226
- package/dist/globals.css +4 -4
- package/dist/lib/color/constants.js +1 -1
- package/dist/lib/color/constants.mjs +1 -1
- package/dist/lib/color/constants.mjs.map +1 -1
- package/dist/lib/components/Badge/index.js +3 -3
- package/dist/lib/components/Badge/index.mjs +1 -1
- package/dist/lib/components/Box/index.js +2 -2
- package/dist/lib/components/Box/index.mjs +1 -1
- package/dist/lib/components/Box/index.mjs.map +1 -1
- package/dist/lib/components/Breadcrumb/BreadcrumbLink.js +2 -2
- package/dist/lib/components/Breadcrumb/BreadcrumbLink.mjs +1 -1
- package/dist/lib/components/Breadcrumb/BreadcrumbLink.mjs.map +1 -1
- package/dist/lib/components/Breadcrumb/BreadcrumbPage.js +3 -3
- package/dist/lib/components/Breadcrumb/BreadcrumbPage.mjs +1 -1
- package/dist/lib/components/Breadcrumb/BreadcrumbPage.mjs.map +1 -1
- package/dist/lib/components/Breadcrumb/BreadcrumbRoot.js +2 -2
- package/dist/lib/components/Breadcrumb/BreadcrumbRoot.mjs +1 -1
- package/dist/lib/components/CheckboxGroup/CheckboxGroupRoot.d.ts +1 -1
- package/dist/lib/components/CheckboxGroup/index.d.ts +1 -1
- package/dist/lib/components/Container/index.js +2 -2
- package/dist/lib/components/Container/index.mjs +1 -1
- package/dist/lib/components/Container/index.mjs.map +1 -1
- package/dist/lib/components/Datepicker/index.d.ts +2 -1
- package/dist/lib/components/Datepicker/index.js +2 -2
- package/dist/lib/components/Datepicker/index.mjs +1 -1
- package/dist/lib/components/Dialog/DialogRoot.d.ts +4 -3
- package/dist/lib/components/Dialog/index.d.ts +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuTrigger.js +3 -3
- package/dist/lib/components/DropdownMenu/DropdownMenuTrigger.mjs +1 -1
- package/dist/lib/components/Editor/index.js +0 -1
- package/dist/lib/components/Flex/index.js +2 -2
- package/dist/lib/components/Flex/index.mjs +1 -1
- package/dist/lib/components/Flex/index.mjs.map +1 -1
- package/dist/lib/components/Gnb/GnbInfo.js +2 -2
- package/dist/lib/components/Gnb/GnbInfo.mjs +1 -1
- package/dist/lib/components/Gnb/GnbLogo.js +1 -1
- package/dist/lib/components/Gnb/GnbLogo.mjs +1 -1
- package/dist/lib/components/Gnb/GnbLogo.mjs.map +1 -1
- package/dist/lib/components/Grid/NumberingPagination.d.ts +1 -1
- package/dist/lib/components/Grid/NumberingPagination.js +59 -17
- package/dist/lib/components/Grid/NumberingPagination.mjs +1 -1
- package/dist/lib/components/Grid/NumberingPagination.mjs.map +1 -1
- package/dist/lib/components/Grid/index.d.ts +2 -2
- package/dist/lib/components/Grid/index.js +57 -39
- package/dist/lib/components/Grid/index.mjs +1 -1
- package/dist/lib/components/Grid/useGrid.js +19 -14
- package/dist/lib/components/Grid/useGrid.mjs +1 -1
- package/dist/lib/components/IconButton/index.js +10 -10
- package/dist/lib/components/IconButton/index.mjs +1 -1
- package/dist/lib/components/Modal/ModalRoot.d.ts +2 -2
- package/dist/lib/components/Radio/index.js +2 -2
- package/dist/lib/components/Radio/index.mjs +1 -1
- package/dist/lib/components/RadioCards/RadioCardsRoot.d.ts +3 -1
- package/dist/lib/components/RadioCards/index.d.ts +1 -1
- package/dist/lib/components/SearchBar/index.js +2 -2
- package/dist/lib/components/SearchBar/index.mjs +1 -1
- package/dist/lib/components/Select/index.d.ts +4 -4
- package/dist/lib/components/Select/index.js +2 -2
- package/dist/lib/components/Select/index.mjs +1 -1
- package/dist/lib/components/Separator/index.d.ts +1 -1
- package/dist/lib/components/SideBar/index.d.ts +27 -0
- package/dist/lib/components/SideBar/index.js +17 -4
- package/dist/lib/components/SideBar/index.mjs +1 -1
- package/dist/lib/components/Slider/index.d.ts +1 -1
- package/dist/lib/components/Table/index.d.ts +1 -1
- package/dist/lib/components/Table/index.js +17 -10
- package/dist/lib/components/Table/index.mjs +1 -1
- package/dist/lib/components/Tabs/DynamicTabs.d.ts +4 -2
- package/dist/lib/components/Tabs/DynamicTabs.js +21 -18
- package/dist/lib/components/Tabs/DynamicTabs.mjs +1 -1
- package/dist/lib/components/TextField/index.js +2 -0
- package/dist/lib/components/TextField/index.mjs +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +150 -150
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../lib/components/Flex/index.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { forwardRef } from 'react';\nimport { cva } from 'class-variance-authority';\nimport { Flex as FlexTheme
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../lib/components/Flex/index.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { forwardRef } from 'react';\nimport { cva } from 'class-variance-authority';\nimport { Flex as FlexTheme } from '@radix-ui/themes';\nimport { scalingVariants } from '../../../lib/constants';\nimport { useTheme } from '../../../lib/theme';\nimport { cn } from '../../../lib/utils/utils';\nvar flexVariants = cva(\"\", {\n variants: {\n scaling: __assign({}, scalingVariants),\n },\n defaultVariants: {\n scaling: '100%',\n },\n});\nexport var Flex = forwardRef(function (_a, ref) {\n var children = _a.children, className = _a.className, scaling = _a.scaling, props = __rest(_a, [\"children\", \"className\", \"scaling\"]);\n var theme = useTheme().theme;\n var flexStyle = {\n scaling: scaling !== null && scaling !== void 0 ? scaling : theme.themeScaling,\n };\n return (_jsx(FlexTheme, __assign({ ref: ref, className: cn(flexVariants(flexStyle), className) }, props, { children: children })));\n});\nFlex.displayName = 'Flex';\nexport default Flex;\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","__rest","e","indexOf","getOwnPropertySymbols","propertyIsEnumerable","flexVariants","cva","variants","scaling","scalingVariants","defaultVariants","Flex","forwardRef","_a","ref","children","className","props","theme","useTheme","flexStyle","themeScaling","_jsx","FlexTheme","cn","displayName"],"mappings":"4TAAA,IAAIA,EAAsC,WAStC,OARAA,EAAWC,OAAOC,QAAU,SAASC,GACjC,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KACzDN,EAAEM,GAAKL,EAAEK,IAEjB,OAAON,CACf,EACWH,EAASa,MAAMC,KAAMP,UAChC,EACIQ,EAAkC,SAAUX,EAAGY,GAC/C,IAAIb,EAAI,CAAA,EACR,IAAK,IAAIM,KAAKL,EAAOH,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,IAAMO,EAAEC,QAAQR,GAAK,IAC9EN,EAAEM,GAAKL,EAAEK,IACb,GAAS,MAALL,GAAqD,mBAAjCH,OAAOiB,sBACtB,KAAIb,EAAI,EAAb,IAAgBI,EAAIR,OAAOiB,sBAAsBd,GAAIC,EAAII,EAAED,OAAQH,IAC3DW,EAAEC,QAAQR,EAAEJ,IAAM,GAAKJ,OAAOS,UAAUS,qBAAqBP,KAAKR,EAAGK,EAAEJ,MACvEF,EAAEM,EAAEJ,IAAMD,EAAEK,EAAEJ,IAF4B,CAItD,OAAOF,CACX,EAQIiB,EAAeC,EAAI,GAAI,CACvBC,SAAU,CACNC,QAASvB,EAAS,CAAE,EAAEwB,IAE1BC,gBAAiB,CACbF,QAAS,UAGNG,EAAOC,GAAW,SAAUC,EAAIC,GACvC,IAAIC,EAAWF,EAAGE,SAAUC,EAAYH,EAAGG,UAAWR,EAAUK,EAAGL,QAASS,EAAQjB,EAAOa,EAAI,CAAC,WAAY,YAAa,YACrHK,EAAQC,IAAWD,MACnBE,EAAY,CACZZ,QAASA,QAAyCA,EAAUU,EAAMG,cAEtE,OAAQC,EAAKC,EAAWtC,EAAS,CAAE6B,IAAKA,EAAKE,UAAWQ,EAAGnB,EAAae,GAAYJ,IAAcC,EAAO,CAAEF,SAAUA,IACzH,IACAJ,EAAKc,YAAc"}
|
@@ -26,7 +26,7 @@ import { forwardRef, useContext } from 'react';
|
|
26
26
|
import { cva } from 'class-variance-authority';
|
27
27
|
import { GnbContext } from './GnbRoot';
|
28
28
|
import { cn } from '../../../lib/utils/utils';
|
29
|
-
var gnbInfoVariants = cva('flex flex-1 items-center justify-end
|
29
|
+
var gnbInfoVariants = cva('flex flex-1 items-center justify-end', {
|
30
30
|
variants: {
|
31
31
|
size: {
|
32
32
|
small: 'text-xs',
|
@@ -41,6 +41,6 @@ var gnbInfoVariants = cva('flex flex-1 items-center justify-end space-x-2', {
|
|
41
41
|
export var GnbInfo = forwardRef(function (_a, ref) {
|
42
42
|
var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
|
43
43
|
var size = useContext(GnbContext).size;
|
44
|
-
return (_jsx("
|
44
|
+
return (_jsx("nav", __assign({ className: cn(gnbInfoVariants({ size: size }), className), ref: ref }, props, { children: children })));
|
45
45
|
});
|
46
46
|
GnbInfo.displayName = 'Gnb.Info';
|
@@ -1,3 +1,3 @@
|
|
1
1
|
"use client";
|
2
|
-
import{jsx as e}from"react/jsx-runtime";import{forwardRef as t,useContext as r}from"react";import{cva as n}from"class-variance-authority";import{GnbContext as a}from"./GnbRoot.mjs";import{cn as
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{forwardRef as t,useContext as r}from"react";import{cva as n}from"class-variance-authority";import{GnbContext as a}from"./GnbRoot.mjs";import{cn as o}from"../../utils/utils.mjs";var i=function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},i.apply(this,arguments)},s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},l=n("flex flex-1 items-center justify-end",{variants:{size:{small:"text-xs",medium:"text-sm",large:"text-base"}},defaultVariants:{size:"medium"}}),m=t((function(t,n){var m=t.children,c=t.className,f=s(t,["children","className"]),p=r(a).size;return e("nav",i({className:o(l({size:p}),c),ref:n},f,{children:m}))}));m.displayName="Gnb.Info";export{m as GnbInfo};
|
3
3
|
//# sourceMappingURL=GnbInfo.mjs.map
|
@@ -26,7 +26,7 @@ import { cva } from 'class-variance-authority';
|
|
26
26
|
import { GnbContext } from './GnbRoot';
|
27
27
|
import { cn } from '../../../lib/utils/utils';
|
28
28
|
import { Text } from '../../../lib/Typography';
|
29
|
-
var gnbLogoVariants = cva('mr-4 flex items-center
|
29
|
+
var gnbLogoVariants = cva('mr-4 flex items-center text-slate-12 dark:text-slateDark-12', {
|
30
30
|
variants: {
|
31
31
|
size: {
|
32
32
|
small: 'text-xs w-[140px] h-[15px]',
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{forwardRef as e,useContext as t}from"react";import{cva as a}from"class-variance-authority";import{GnbContext as o}from"./GnbRoot.mjs";import{cn as n}from"../../utils/utils.mjs";import"../../Typography/Header/index.mjs";import i from"../../Typography/Text/index.mjs";var s=function(){return s=Object.assign||function(r){for(var e,t=1,a=arguments.length;t<a;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r},s.apply(this,arguments)},l=function(r,e){var t={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&e.indexOf(a)<0&&(t[a]=r[a]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(r);o<a.length;o++)e.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(r,a[o])&&(t[a[o]]=r[a[o]])}return t},p=a("mr-4 flex items-center
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{forwardRef as e,useContext as t}from"react";import{cva as a}from"class-variance-authority";import{GnbContext as o}from"./GnbRoot.mjs";import{cn as n}from"../../utils/utils.mjs";import"../../Typography/Header/index.mjs";import i from"../../Typography/Text/index.mjs";var s=function(){return s=Object.assign||function(r){for(var e,t=1,a=arguments.length;t<a;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r},s.apply(this,arguments)},l=function(r,e){var t={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&e.indexOf(a)<0&&(t[a]=r[a]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(r);o<a.length;o++)e.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(r,a[o])&&(t[a[o]]=r[a[o]])}return t},p=a("mr-4 flex items-center text-slate-12 dark:text-slateDark-12",{variants:{size:{small:"text-xs w-[140px] h-[15px]",medium:"text-sm w-[150px] h-[20px]",large:"text-base w-[160px] h-[25px]"}},defaultVariants:{size:"medium"}}),m=e((function(e,a){var m=e.children,c=e.className,f=e.href,x=l(e,["children","className","href"]),u=t(o).size;return r("a",s({href:f,className:n(p({size:u}),c)},x,{children:null!=m?m:r(i,{children:"LOGO 영역"})}))}));m.displayName="Gnb.Logo";export{m as GnbLogo};
|
2
2
|
//# sourceMappingURL=GnbLogo.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GnbLogo.mjs","sources":["../../../lib/components/Gnb/GnbLogo.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { forwardRef, useContext } from 'react';\nimport { cva } from 'class-variance-authority';\nimport { GnbContext } from './GnbRoot';\nimport { cn } from '../../../lib/utils/utils';\nimport { Text } from '../../../lib/Typography';\nvar gnbLogoVariants = cva('mr-4 flex items-center
|
1
|
+
{"version":3,"file":"GnbLogo.mjs","sources":["../../../lib/components/Gnb/GnbLogo.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { forwardRef, useContext } from 'react';\nimport { cva } from 'class-variance-authority';\nimport { GnbContext } from './GnbRoot';\nimport { cn } from '../../../lib/utils/utils';\nimport { Text } from '../../../lib/Typography';\nvar gnbLogoVariants = cva('mr-4 flex items-center text-slate-12 dark:text-slateDark-12', {\n variants: {\n size: {\n small: 'text-xs w-[140px] h-[15px]',\n medium: 'text-sm w-[150px] h-[20px]',\n large: 'text-base w-[160px] h-[25px]',\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\nexport var GnbLogo = forwardRef(function (_a, ref) {\n var children = _a.children, className = _a.className, href = _a.href, props = __rest(_a, [\"children\", \"className\", \"href\"]);\n var size = useContext(GnbContext).size;\n return (_jsx(\"a\", __assign({ href: href, className: cn(gnbLogoVariants({ size: size }), className) }, props, { children: children !== null && children !== void 0 ? children : _jsx(Text, { children: \"LOGO \\uC601\\uC5ED\" }) })));\n});\nGnbLogo.displayName = 'Gnb.Logo';\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","__rest","e","indexOf","getOwnPropertySymbols","propertyIsEnumerable","gnbLogoVariants","cva","variants","size","small","medium","large","defaultVariants","GnbLogo","forwardRef","_a","ref","children","className","href","props","useContext","GnbContext","_jsx","cn","Text","displayName"],"mappings":"yTAAA,IAAIA,EAAsC,WAStC,OARAA,EAAWC,OAAOC,QAAU,SAASC,GACjC,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KACzDN,EAAEM,GAAKL,EAAEK,IAEjB,OAAON,CACf,EACWH,EAASa,MAAMC,KAAMP,UAChC,EACIQ,EAAkC,SAAUX,EAAGY,GAC/C,IAAIb,EAAI,CAAA,EACR,IAAK,IAAIM,KAAKL,EAAOH,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,IAAMO,EAAEC,QAAQR,GAAK,IAC9EN,EAAEM,GAAKL,EAAEK,IACb,GAAS,MAALL,GAAqD,mBAAjCH,OAAOiB,sBACtB,KAAIb,EAAI,EAAb,IAAgBI,EAAIR,OAAOiB,sBAAsBd,GAAIC,EAAII,EAAED,OAAQH,IAC3DW,EAAEC,QAAQR,EAAEJ,IAAM,GAAKJ,OAAOS,UAAUS,qBAAqBP,KAAKR,EAAGK,EAAEJ,MACvEF,EAAEM,EAAEJ,IAAMD,EAAEK,EAAEJ,IAF4B,CAItD,OAAOF,CACX,EAOIiB,EAAkBC,EAAI,8DAA+D,CACrFC,SAAU,CACNC,KAAM,CACFC,MAAO,6BACPC,OAAQ,6BACRC,MAAO,iCAGfC,gBAAiB,CACbJ,KAAM,YAGHK,EAAUC,GAAW,SAAUC,EAAIC,GAC1C,IAAIC,EAAWF,EAAGE,SAAUC,EAAYH,EAAGG,UAAWC,EAAOJ,EAAGI,KAAMC,EAAQpB,EAAOe,EAAI,CAAC,WAAY,YAAa,SAC/GP,EAAOa,EAAWC,GAAYd,KAClC,OAAQe,EAAK,IAAKtC,EAAS,CAAEkC,KAAMA,EAAMD,UAAWM,EAAGnB,EAAgB,CAAEG,KAAMA,IAASU,IAAcE,EAAO,CAAEH,SAAUA,QAA2CA,EAAWM,EAAKE,EAAM,CAAER,SAAU,cAC1M,IACAJ,EAAQa,YAAc"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare function NumberingPagination({ table
|
1
|
+
declare function NumberingPagination({ table }: any): import("react/jsx-runtime").JSX.Element;
|
2
2
|
export default NumberingPagination;
|
@@ -1,3 +1,14 @@
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
2
|
+
__assign = Object.assign || function(t) {
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
+
s = arguments[i];
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
+
t[p] = s[p];
|
7
|
+
}
|
8
|
+
return t;
|
9
|
+
};
|
10
|
+
return __assign.apply(this, arguments);
|
11
|
+
};
|
1
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
13
|
import { useState } from 'react';
|
3
14
|
import IconButton from '../IconButton';
|
@@ -8,18 +19,28 @@ import Button from '../Button';
|
|
8
19
|
import TextField from '../TextField';
|
9
20
|
import Text from '../../Typography/Text';
|
10
21
|
function NumberingPagination(_a) {
|
11
|
-
var _b;
|
12
|
-
var table = _a.table
|
13
|
-
var
|
22
|
+
var _b, _c;
|
23
|
+
var table = _a.table;
|
24
|
+
var _d = useState('1'), nowPage = _d[0], setNowPage = _d[1];
|
14
25
|
var color = (_b = table.options.color) !== null && _b !== void 0 ? _b : MAIN_COLOR;
|
26
|
+
var size = table.options.size == 'x-small' ? 'small' : table.options.size;
|
27
|
+
var currentPage = table.options.pagination
|
28
|
+
? table.options.pagination.pageIndex
|
29
|
+
: table.getState().pagination.pageIndex;
|
15
30
|
var renderPageNumbers = function () {
|
16
31
|
var pageNumbers = [];
|
17
|
-
var currentInx = table.
|
32
|
+
var currentInx = table.options.pagination
|
33
|
+
? table.options.pagination.pageIndex
|
34
|
+
: table.getState().pagination.pageIndex;
|
18
35
|
var _loop_1 = function (i) {
|
19
36
|
pageNumbers.push(_jsx(Button, { size: size, appearance: "ghost", onClick: function () {
|
20
|
-
|
21
|
-
|
22
|
-
|
37
|
+
if (currentInx !== i) {
|
38
|
+
table.setPageIndex(i);
|
39
|
+
table.options.setPagination &&
|
40
|
+
table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: i }));
|
41
|
+
setNowPage(String(i + 1));
|
42
|
+
}
|
43
|
+
}, color: currentInx === i ? color : 'slate', children: i + 1 }, i));
|
23
44
|
};
|
24
45
|
for (var i = 0; i < table.getPageCount(); i++) {
|
25
46
|
_loop_1(i);
|
@@ -29,48 +50,69 @@ function NumberingPagination(_a) {
|
|
29
50
|
pageNumbers = pageNumbers.slice(currentInx - 2, currentInx + 3);
|
30
51
|
pageNumbers.unshift(_jsx(Button, { size: size, appearance: "ghost", onClick: function () {
|
31
52
|
table.setPageIndex(0);
|
53
|
+
table.options.setPagination &&
|
54
|
+
table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: 0 }));
|
32
55
|
setNowPage('1');
|
33
|
-
}, color:
|
56
|
+
}, color: currentInx === 0 ? color : 'slate', children: 1 }, 0), _jsx(Button, { appearance: "ghost", disabled: true, size: size, children: "..." }));
|
34
57
|
pageNumbers.push(_jsx(Button, { appearance: "ghost", disabled: true, size: size, children: "..." }), _jsx(Button, { size: size, appearance: "ghost", onClick: function () {
|
35
58
|
table.setPageIndex(table.getPageCount() - 1);
|
59
|
+
table.options.setPagination &&
|
60
|
+
table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: table.getPageCount() - 1 }));
|
36
61
|
setNowPage(String(table.getPageCount()));
|
37
|
-
}, color:
|
62
|
+
}, color: currentInx === table.getPageCount() - 1 ? color : 'slate', children: table.getPageCount() }, table.getPageCount() - 1));
|
38
63
|
}
|
39
64
|
else if (currentInx - 3 <= 0) {
|
40
65
|
pageNumbers = pageNumbers.slice(0, 7);
|
41
66
|
pageNumbers.push(_jsx(Button, { appearance: "ghost", disabled: true, size: size, children: "..." }), _jsx(Button, { size: size, appearance: "ghost", onClick: function () {
|
42
67
|
table.setPageIndex(table.getPageCount() - 1);
|
68
|
+
table.options.setPagination &&
|
69
|
+
table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: table.getPageCount() - 1 }));
|
43
70
|
setNowPage(String(table.getPageCount()));
|
44
|
-
}, color:
|
71
|
+
}, color: currentInx === table.getPageCount() - 1 ? color : 'slate', children: table.getPageCount() }, table.getPageCount() - 1));
|
45
72
|
}
|
46
73
|
else {
|
47
74
|
pageNumbers = pageNumbers.slice(table.getPageCount() - 7, table.getPageCount());
|
48
75
|
pageNumbers.unshift(_jsx(Button, { size: size, appearance: "ghost", onClick: function () {
|
49
76
|
table.setPageIndex(0);
|
77
|
+
table.options.setPagination &&
|
78
|
+
table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: 0 }));
|
50
79
|
setNowPage('1');
|
51
|
-
}, color:
|
80
|
+
}, color: currentInx === 0 ? color : 'slate', children: 1 }, 0), _jsx(Button, { appearance: "ghost", disabled: true, size: size, children: "..." }));
|
52
81
|
}
|
53
82
|
}
|
54
83
|
return pageNumbers;
|
55
84
|
};
|
56
85
|
return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-center gap-2", children: [_jsxs(Select.Root, { size: size, color: color, value: String(table.getState().pagination.pageSize), defaultValue: String(table.getState().pagination.pageSize), onValueChange: function (e) {
|
86
|
+
table.options.setPagination &&
|
87
|
+
table.options.setPagination({
|
88
|
+
pageIndex: 0,
|
89
|
+
pageSize: Number(e),
|
90
|
+
});
|
57
91
|
table.setPageSize(Number(e));
|
58
92
|
setNowPage('1');
|
59
93
|
table.setPageIndex(0);
|
60
|
-
}, children: [_jsx(Select.Trigger, {}), _jsx(Select.Content, { children: [10, 20, 30, 50, 100].map(function (pageSize) { return (_jsx(Select.Item, { value: String(pageSize), children: pageSize }, pageSize)); }) })] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(IconButton, { size: size, className: "rounded border p-1", color: color, onClick: function () {
|
94
|
+
}, children: [_jsx(Select.Trigger, {}), _jsx(Select.Content, { children: [10, 20, 30, 50, 100].map(function (pageSize) { return (_jsx(Select.Item, { value: String(pageSize), children: pageSize }, pageSize)); }) })] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(IconButton, { size: size, appearance: "ghost", className: "rounded border p-1", color: color, onClick: function () {
|
61
95
|
table.firstPage();
|
96
|
+
table.options.setPagination &&
|
97
|
+
table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: 0 }));
|
62
98
|
setNowPage('1');
|
63
|
-
}, disabled:
|
99
|
+
}, disabled: currentPage === 0, children: _jsx(DoubleArrowLeftIcon, {}) }), _jsx(IconButton, { size: size, appearance: "ghost", className: "rounded border p-1", color: color, onClick: function () {
|
64
100
|
table.previousPage();
|
65
101
|
setNowPage(String(table.getState().pagination.pageIndex));
|
66
|
-
|
102
|
+
table.options.setPagination &&
|
103
|
+
table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: table.options.pagination.pageIndex - 1 }));
|
104
|
+
}, disabled: currentPage === 0, children: _jsx(ChevronLeftIcon, {}) })] }), _jsx("div", { children: renderPageNumbers() }), _jsxs("div", { className: "flex gap-2", children: [_jsx(IconButton, { size: size, appearance: "ghost", className: "rounded border p-1", color: color, onClick: function () {
|
67
105
|
table.nextPage();
|
68
106
|
setNowPage(String(table.getState().pagination.pageIndex + 2));
|
69
|
-
|
107
|
+
table.options.setPagination &&
|
108
|
+
table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: table.options.pagination.pageIndex + 1 }));
|
109
|
+
}, disabled: currentPage === table.getPageCount() - 1, children: _jsx(ChevronRightIcon, {}) }), _jsx(IconButton, { size: size, appearance: "ghost", className: "rounded border p-1", color: color, onClick: function () {
|
70
110
|
table.lastPage();
|
71
111
|
setNowPage(String(table.getPageCount()));
|
72
|
-
|
112
|
+
table.options.setPagination &&
|
113
|
+
table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: table.getPageCount() - 1 }));
|
114
|
+
}, disabled: currentPage === table.getPageCount() - 1, children: _jsx(DoubleArrowRightIcon, {}) })] })] }), !((_c = table.options) === null || _c === void 0 ? void 0 : _c.disableInputPagination) && (_jsxs("div", { className: "mt-4 flex items-center justify-center gap-2", children: [_jsx(TextField.Root, { size: size, type: "number", color: color, min: "1", max: table.getPageCount(), value: nowPage, onChange: function (e) {
|
73
115
|
setNowPage(e.target.value);
|
74
|
-
}, className: "w-[50px] rounded border" }), _jsxs(Text, { children: ["/ ", table.getPageCount()] }), _jsx(Button, { size: size, onClick: function () { return table.setPageIndex(nowPage ? Number(nowPage) - 1 : 0); }, children: "\uC774\uB3D9" })] })] }));
|
116
|
+
}, className: "w-[50px] rounded border" }), _jsxs(Text, { children: ["/ ", table.getPageCount()] }), _jsx(Button, { size: size, onClick: function () { return table.setPageIndex(nowPage ? Number(nowPage) - 1 : 0); }, children: "\uC774\uB3D9" })] }))] }));
|
75
117
|
}
|
76
118
|
export default NumberingPagination;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{jsxs as e,jsx as
|
1
|
+
import{jsxs as e,jsx as n}from"react/jsx-runtime";import{useState as t}from"react";import{IconButton as o}from"../IconButton/index.mjs";import{DoubleArrowLeftIcon as i,ChevronLeftIcon as a,ChevronRightIcon as s,DoubleArrowRightIcon as g}from"@radix-ui/react-icons";import p from"../Select/index.mjs";import{MAIN_COLOR as r}from"../../color/constants.mjs";import{Button as c}from"../Button/index.mjs";import l from"../TextField/index.mjs";import d from"../../Typography/Text/index.mjs";var u=function(){return u=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},u.apply(this,arguments)};function P(P){var h,m,x=P.table,f=t("1"),C=f[0],I=f[1],z=null!==(h=x.options.color)&&void 0!==h?h:r,b="x-small"==x.options.size?"small":x.options.size,S=x.options.pagination?x.options.pagination.pageIndex:x.getState().pagination.pageIndex;return e("div",{children:[e("div",{className:"flex items-center justify-center gap-2",children:[e(p.Root,{size:b,color:z,value:String(x.getState().pagination.pageSize),defaultValue:String(x.getState().pagination.pageSize),onValueChange:function(e){x.options.setPagination&&x.options.setPagination({pageIndex:0,pageSize:Number(e)}),x.setPageSize(Number(e)),I("1"),x.setPageIndex(0)},children:[n(p.Trigger,{}),n(p.Content,{children:[10,20,30,50,100].map((function(e){return n(p.Item,{value:String(e),children:e},e)}))})]}),e("div",{className:"flex gap-2",children:[n(o,{size:b,appearance:"ghost",className:"rounded border p-1",color:z,onClick:function(){x.firstPage(),x.options.setPagination&&x.options.setPagination(u(u({},x.options.pagination),{pageIndex:0})),I("1")},disabled:0===S,children:n(i,{})}),n(o,{size:b,appearance:"ghost",className:"rounded border p-1",color:z,onClick:function(){x.previousPage(),I(String(x.getState().pagination.pageIndex)),x.options.setPagination&&x.options.setPagination(u(u({},x.options.pagination),{pageIndex:x.options.pagination.pageIndex-1}))},disabled:0===S,children:n(a,{})})]}),n("div",{children:function(){for(var e=[],t=x.options.pagination?x.options.pagination.pageIndex:x.getState().pagination.pageIndex,o=function(o){e.push(n(c,{size:b,appearance:"ghost",onClick:function(){t!==o&&(x.setPageIndex(o),x.options.setPagination&&x.options.setPagination(u(u({},x.options.pagination),{pageIndex:o})),I(String(o+1)))},color:t===o?z:"slate",children:o+1},o))},i=0;i<x.getPageCount();i++)o(i);return e.length>10&&(t-3>0&&t+3<x.getPageCount()?((e=e.slice(t-2,t+3)).unshift(n(c,{size:b,appearance:"ghost",onClick:function(){x.setPageIndex(0),x.options.setPagination&&x.options.setPagination(u(u({},x.options.pagination),{pageIndex:0})),I("1")},color:0===t?z:"slate",children:1},0),n(c,{appearance:"ghost",disabled:!0,size:b,children:"..."})),e.push(n(c,{appearance:"ghost",disabled:!0,size:b,children:"..."}),n(c,{size:b,appearance:"ghost",onClick:function(){x.setPageIndex(x.getPageCount()-1),x.options.setPagination&&x.options.setPagination(u(u({},x.options.pagination),{pageIndex:x.getPageCount()-1})),I(String(x.getPageCount()))},color:t===x.getPageCount()-1?z:"slate",children:x.getPageCount()},x.getPageCount()-1))):t-3<=0?(e=e.slice(0,7)).push(n(c,{appearance:"ghost",disabled:!0,size:b,children:"..."}),n(c,{size:b,appearance:"ghost",onClick:function(){x.setPageIndex(x.getPageCount()-1),x.options.setPagination&&x.options.setPagination(u(u({},x.options.pagination),{pageIndex:x.getPageCount()-1})),I(String(x.getPageCount()))},color:t===x.getPageCount()-1?z:"slate",children:x.getPageCount()},x.getPageCount()-1)):(e=e.slice(x.getPageCount()-7,x.getPageCount())).unshift(n(c,{size:b,appearance:"ghost",onClick:function(){x.setPageIndex(0),x.options.setPagination&&x.options.setPagination(u(u({},x.options.pagination),{pageIndex:0})),I("1")},color:0===t?z:"slate",children:1},0),n(c,{appearance:"ghost",disabled:!0,size:b,children:"..."}))),e}()}),e("div",{className:"flex gap-2",children:[n(o,{size:b,appearance:"ghost",className:"rounded border p-1",color:z,onClick:function(){x.nextPage(),I(String(x.getState().pagination.pageIndex+2)),x.options.setPagination&&x.options.setPagination(u(u({},x.options.pagination),{pageIndex:x.options.pagination.pageIndex+1}))},disabled:S===x.getPageCount()-1,children:n(s,{})}),n(o,{size:b,appearance:"ghost",className:"rounded border p-1",color:z,onClick:function(){x.lastPage(),I(String(x.getPageCount())),x.options.setPagination&&x.options.setPagination(u(u({},x.options.pagination),{pageIndex:x.getPageCount()-1}))},disabled:S===x.getPageCount()-1,children:n(g,{})})]})]}),!(null===(m=x.options)||void 0===m?void 0:m.disableInputPagination)&&e("div",{className:"mt-4 flex items-center justify-center gap-2",children:[n(l.Root,{size:b,type:"number",color:z,min:"1",max:x.getPageCount(),value:C,onChange:function(e){I(e.target.value)},className:"w-[50px] rounded border"}),e(d,{children:["/ ",x.getPageCount()]}),n(c,{size:b,onClick:function(){return x.setPageIndex(C?Number(C)-1:0)},children:"이동"})]})]})}export{P as default};
|
2
2
|
//# sourceMappingURL=NumberingPagination.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"NumberingPagination.mjs","sources":["../../../lib/components/Grid/NumberingPagination.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport IconButton from '../IconButton';\nimport { ChevronLeftIcon, ChevronRightIcon, DoubleArrowLeftIcon, DoubleArrowRightIcon, } from '@radix-ui/react-icons';\nimport Select from '../Select';\nimport { MAIN_COLOR } from '../../../lib/color/constants';\nimport Button from '../Button';\nimport TextField from '../TextField';\nimport Text from '../../Typography/Text';\nfunction NumberingPagination(_a) {\n var _b;\n var table = _a.table, size = _a.size;\n var _c = useState('1'), nowPage = _c[0], setNowPage = _c[1];\n var color = (_b = table.options.color) !== null && _b !== void 0 ? _b : MAIN_COLOR;\n var renderPageNumbers = function () {\n var pageNumbers = [];\n var currentInx = table.getState().pagination.pageIndex;\n var _loop_1 = function (i) {\n pageNumbers.push(_jsx(Button, { size: size, appearance: \"ghost\", onClick: function () {\n table.setPageIndex(i);\n setNowPage(String(i + 1));\n }, color: table.getState().pagination.pageIndex === i ? color : 'slate', children: i + 1 }, i));\n };\n for (var i = 0; i < table.getPageCount(); i++) {\n _loop_1(i);\n }\n if (pageNumbers.length > 10) {\n if (currentInx - 3 > 0 && currentInx + 3 < table.getPageCount()) {\n pageNumbers = pageNumbers.slice(currentInx - 2, currentInx + 3);\n pageNumbers.unshift(_jsx(Button, { size: size, appearance: \"ghost\", onClick: function () {\n table.setPageIndex(0);\n setNowPage('1');\n }, color: table.getState().pagination.pageIndex === 0 ? color : 'slate', children: 1 }, 0), _jsx(Button, { appearance: \"ghost\", disabled: true, size: size, children: \"...\" }));\n pageNumbers.push(_jsx(Button, { appearance: \"ghost\", disabled: true, size: size, children: \"...\" }), _jsx(Button, { size: size, appearance: \"ghost\", onClick: function () {\n table.setPageIndex(table.getPageCount() - 1);\n setNowPage(String(table.getPageCount()));\n }, color: table.getState().pagination.pageIndex === table.getPageCount() - 1 ? color : 'slate', children: table.getPageCount() }, table.getPageCount() - 1));\n }\n else if (currentInx - 3 <= 0) {\n pageNumbers = pageNumbers.slice(0, 7);\n pageNumbers.push(_jsx(Button, { appearance: \"ghost\", disabled: true, size: size, children: \"...\" }), _jsx(Button, { size: size, appearance: \"ghost\", onClick: function () {\n table.setPageIndex(table.getPageCount() - 1);\n setNowPage(String(table.getPageCount()));\n }, color: table.getState().pagination.pageIndex === table.getPageCount() - 1 ? color : 'slate', children: table.getPageCount() }, table.getPageCount() - 1));\n }\n else {\n pageNumbers = pageNumbers.slice(table.getPageCount() - 7, table.getPageCount());\n pageNumbers.unshift(_jsx(Button, { size: size, appearance: \"ghost\", onClick: function () {\n table.setPageIndex(0);\n setNowPage('1');\n }, color: table.getState().pagination.pageIndex === 0 ? color : 'slate', children: 1 }, 0), _jsx(Button, { appearance: \"ghost\", disabled: true, size: size, children: \"...\" }));\n }\n }\n return pageNumbers;\n };\n return (_jsxs(\"div\", { children: [_jsxs(\"div\", { className: \"flex items-center justify-center gap-2\", children: [_jsxs(Select.Root, { size: size, color: color, value: String(table.getState().pagination.pageSize), defaultValue: String(table.getState().pagination.pageSize), onValueChange: function (e) {\n table.setPageSize(Number(e));\n setNowPage('1');\n table.setPageIndex(0);\n }, children: [_jsx(Select.Trigger, {}), _jsx(Select.Content, { children: [10, 20, 30, 50, 100].map(function (pageSize) { return (_jsx(Select.Item, { value: String(pageSize), children: pageSize }, pageSize)); }) })] }), _jsxs(\"div\", { className: \"flex gap-2\", children: [_jsx(IconButton, { size: size, className: \"rounded border p-1\", color: color, onClick: function () {\n table.firstPage();\n setNowPage('1');\n }, disabled: !table.getCanPreviousPage(), children: _jsx(DoubleArrowLeftIcon, {}) }), _jsx(IconButton, { size: size, className: \"rounded border p-1\", color: color, onClick: function () {\n table.previousPage();\n setNowPage(String(table.getState().pagination.pageIndex));\n }, disabled: !table.getCanPreviousPage(), children: _jsx(ChevronLeftIcon, {}) })] }), _jsx(\"div\", { children: renderPageNumbers() }), _jsxs(\"div\", { className: \"flex gap-2\", children: [_jsx(IconButton, { size: size, className: \"rounded border p-1\", color: color, onClick: function () {\n table.nextPage();\n setNowPage(String(table.getState().pagination.pageIndex + 2));\n }, disabled: !table.getCanNextPage(), children: _jsx(ChevronRightIcon, {}) }), _jsx(IconButton, { size: size, className: \"rounded border p-1\", color: color, onClick: function () {\n table.lastPage();\n setNowPage(String(table.getPageCount()));\n }, disabled: !table.getCanNextPage(), children: _jsx(DoubleArrowRightIcon, {}) })] })] }), _jsxs(\"div\", { className: \"mt-4 flex items-center justify-center gap-2\", children: [_jsx(TextField.Root, { size: size, type: \"number\", color: color, min: \"1\", max: table.getPageCount(), value: nowPage, onChange: function (e) {\n setNowPage(e.target.value);\n }, className: \"w-[50px] rounded border\" }), _jsxs(Text, { children: [\"/ \", table.getPageCount()] }), _jsx(Button, { size: size, onClick: function () { return table.setPageIndex(nowPage ? Number(nowPage) - 1 : 0); }, children: \"\\uC774\\uB3D9\" })] })] }));\n}\nexport default NumberingPagination;\n"],"names":["NumberingPagination","_a","_b","table","size","_c","useState","nowPage","setNowPage","color","options","MAIN_COLOR","_jsxs","children","className","Select","Root","value","String","getState","pagination","pageSize","defaultValue","onValueChange","e","setPageSize","Number","setPageIndex","_jsx","Trigger","Content","map","Item","IconButton","onClick","firstPage","disabled","getCanPreviousPage","DoubleArrowLeftIcon","previousPage","pageIndex","ChevronLeftIcon","pageNumbers","currentInx","_loop_1","i","push","Button","appearance","getPageCount","length","slice","unshift","renderPageNumbers","nextPage","getCanNextPage","ChevronRightIcon","lastPage","DoubleArrowRightIcon","TextField","type","min","max","onChange","target","Text"],"mappings":"qeASA,SAASA,EAAoBC,GACzB,IAAIC,EACAC,EAAQF,EAAGE,MAAOC,EAAOH,EAAGG,KAC5BC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AOoD,IAAK,IAAKC,IAAK3D,EAAM8C,eAAgBhC,MAAOV,EAASwD,SAAU,SAAUvC,GAC7ThB,EAAWgB,EAAEwC,OAAO/C,MAChD,EAA2BH,UAAW,4BAA8BF,EAAMqD,EAAM,CAAEpD,SAAU,CAAC,KAAMV,EAAM8C,kBAAoBrB,EAAKmB,EAAQ,CAAE3C,KAAMA,EAAM8B,QAAS,WAAc,OAAO/B,EAAMwB,aAAapB,EAAUmB,OAAOnB,GAAW,EAAI,EAAG,EAAIM,SAAU,YAC1P"}
|
1
|
+
{"version":3,"file":"NumberingPagination.mjs","sources":["../../../lib/components/Grid/NumberingPagination.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport IconButton from '../IconButton';\nimport { ChevronLeftIcon, ChevronRightIcon, DoubleArrowLeftIcon, DoubleArrowRightIcon, } from '@radix-ui/react-icons';\nimport Select from '../Select';\nimport { MAIN_COLOR } from '../../../lib/color/constants';\nimport Button from '../Button';\nimport TextField from '../TextField';\nimport Text from '../../Typography/Text';\nfunction NumberingPagination(_a) {\n var _b, _c;\n var table = _a.table;\n var _d = useState('1'), nowPage = _d[0], setNowPage = _d[1];\n var color = (_b = table.options.color) !== null && _b !== void 0 ? _b : MAIN_COLOR;\n var size = table.options.size == 'x-small' ? 'small' : table.options.size;\n var currentPage = table.options.pagination\n ? table.options.pagination.pageIndex\n : table.getState().pagination.pageIndex;\n var renderPageNumbers = function () {\n var pageNumbers = [];\n var currentInx = table.options.pagination\n ? table.options.pagination.pageIndex\n : table.getState().pagination.pageIndex;\n var _loop_1 = function (i) {\n pageNumbers.push(_jsx(Button, { size: size, appearance: \"ghost\", onClick: function () {\n if (currentInx !== i) {\n table.setPageIndex(i);\n table.options.setPagination &&\n table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: i }));\n setNowPage(String(i + 1));\n }\n }, color: currentInx === i ? color : 'slate', children: i + 1 }, i));\n };\n for (var i = 0; i < table.getPageCount(); i++) {\n _loop_1(i);\n }\n if (pageNumbers.length > 10) {\n if (currentInx - 3 > 0 && currentInx + 3 < table.getPageCount()) {\n pageNumbers = pageNumbers.slice(currentInx - 2, currentInx + 3);\n pageNumbers.unshift(_jsx(Button, { size: size, appearance: \"ghost\", onClick: function () {\n table.setPageIndex(0);\n table.options.setPagination &&\n table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: 0 }));\n setNowPage('1');\n }, color: currentInx === 0 ? color : 'slate', children: 1 }, 0), _jsx(Button, { appearance: \"ghost\", disabled: true, size: size, children: \"...\" }));\n pageNumbers.push(_jsx(Button, { appearance: \"ghost\", disabled: true, size: size, children: \"...\" }), _jsx(Button, { size: size, appearance: \"ghost\", onClick: function () {\n table.setPageIndex(table.getPageCount() - 1);\n table.options.setPagination &&\n table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: table.getPageCount() - 1 }));\n setNowPage(String(table.getPageCount()));\n }, color: currentInx === table.getPageCount() - 1 ? color : 'slate', children: table.getPageCount() }, table.getPageCount() - 1));\n }\n else if (currentInx - 3 <= 0) {\n pageNumbers = pageNumbers.slice(0, 7);\n pageNumbers.push(_jsx(Button, { appearance: \"ghost\", disabled: true, size: size, children: \"...\" }), _jsx(Button, { size: size, appearance: \"ghost\", onClick: function () {\n table.setPageIndex(table.getPageCount() - 1);\n table.options.setPagination &&\n table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: table.getPageCount() - 1 }));\n setNowPage(String(table.getPageCount()));\n }, color: currentInx === table.getPageCount() - 1 ? color : 'slate', children: table.getPageCount() }, table.getPageCount() - 1));\n }\n else {\n pageNumbers = pageNumbers.slice(table.getPageCount() - 7, table.getPageCount());\n pageNumbers.unshift(_jsx(Button, { size: size, appearance: \"ghost\", onClick: function () {\n table.setPageIndex(0);\n table.options.setPagination &&\n table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: 0 }));\n setNowPage('1');\n }, color: currentInx === 0 ? color : 'slate', children: 1 }, 0), _jsx(Button, { appearance: \"ghost\", disabled: true, size: size, children: \"...\" }));\n }\n }\n return pageNumbers;\n };\n return (_jsxs(\"div\", { children: [_jsxs(\"div\", { className: \"flex items-center justify-center gap-2\", children: [_jsxs(Select.Root, { size: size, color: color, value: String(table.getState().pagination.pageSize), defaultValue: String(table.getState().pagination.pageSize), onValueChange: function (e) {\n table.options.setPagination &&\n table.options.setPagination({\n pageIndex: 0,\n pageSize: Number(e),\n });\n table.setPageSize(Number(e));\n setNowPage('1');\n table.setPageIndex(0);\n }, children: [_jsx(Select.Trigger, {}), _jsx(Select.Content, { children: [10, 20, 30, 50, 100].map(function (pageSize) { return (_jsx(Select.Item, { value: String(pageSize), children: pageSize }, pageSize)); }) })] }), _jsxs(\"div\", { className: \"flex gap-2\", children: [_jsx(IconButton, { size: size, appearance: \"ghost\", className: \"rounded border p-1\", color: color, onClick: function () {\n table.firstPage();\n table.options.setPagination &&\n table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: 0 }));\n setNowPage('1');\n }, disabled: currentPage === 0, children: _jsx(DoubleArrowLeftIcon, {}) }), _jsx(IconButton, { size: size, appearance: \"ghost\", className: \"rounded border p-1\", color: color, onClick: function () {\n table.previousPage();\n setNowPage(String(table.getState().pagination.pageIndex));\n table.options.setPagination &&\n table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: table.options.pagination.pageIndex - 1 }));\n }, disabled: currentPage === 0, children: _jsx(ChevronLeftIcon, {}) })] }), _jsx(\"div\", { children: renderPageNumbers() }), _jsxs(\"div\", { className: \"flex gap-2\", children: [_jsx(IconButton, { size: size, appearance: \"ghost\", className: \"rounded border p-1\", color: color, onClick: function () {\n table.nextPage();\n setNowPage(String(table.getState().pagination.pageIndex + 2));\n table.options.setPagination &&\n table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: table.options.pagination.pageIndex + 1 }));\n }, disabled: currentPage === table.getPageCount() - 1, children: _jsx(ChevronRightIcon, {}) }), _jsx(IconButton, { size: size, appearance: \"ghost\", className: \"rounded border p-1\", color: color, onClick: function () {\n table.lastPage();\n setNowPage(String(table.getPageCount()));\n table.options.setPagination &&\n table.options.setPagination(__assign(__assign({}, table.options.pagination), { pageIndex: table.getPageCount() - 1 }));\n }, disabled: currentPage === table.getPageCount() - 1, children: _jsx(DoubleArrowRightIcon, {}) })] })] }), !((_c = table.options) === null || _c === void 0 ? void 0 : _c.disableInputPagination) && (_jsxs(\"div\", { className: \"mt-4 flex items-center justify-center gap-2\", children: [_jsx(TextField.Root, { size: size, type: \"number\", color: color, min: \"1\", max: table.getPageCount(), value: nowPage, onChange: function (e) {\n setNowPage(e.target.value);\n }, className: \"w-[50px] rounded border\" }), _jsxs(Text, { children: [\"/ \", table.getPageCount()] }), _jsx(Button, { size: size, onClick: function () { return table.setPageIndex(nowPage ? Number(nowPage) - 1 : 0); }, children: \"\\uC774\\uB3D9\" })] }))] }));\n}\nexport default NumberingPagination;\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","NumberingPagination","_a","_b","_c","table","_d","useState","nowPage","setNowPage","color","options","MAIN_COLOR","size","currentPage","pagination","pageIndex","getState","_jsxs","children","className","Select","Root","value","String","pageSize","defaultValue","onValueChange","e","setPagination","Number","setPageSize","setPageIndex","_jsx","Trigger","Content","map","Item","IconButton","appearance","onClick","firstPage","disabled","DoubleArrowLeftIcon","previousPage","ChevronLeftIcon","pageNumbers","currentInx","_loop_1","push","Button","getPageCount","slice","unshift","renderPageNumbers","nextPage","ChevronRightIcon","lastPage","DoubleArrowRightIcon","disableInputPagination","TextField","type","min","max","onChange","target","Text"],"mappings":"qeAAA,IAAIA,EAA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B,EAAGhC,SAAUc,EAAKuB,EAAkB,CAAA,KAAQvB,EAAKK,EAAY,CAAEzB,KAAMA,EAAM0B,WAAY,QAASnB,UAAW,qBAAsBV,MAAOA,EAAO8B,QAAS,WACxMnC,EAAMoD,WACNhD,EAAWe,OAAOnB,EAAM8C,iBACxB9C,EAAMM,QAAQkB,eACVxB,EAAMM,QAAQkB,cAAc3C,EAASA,EAAS,CAAE,EAAEmB,EAAMM,QAAQI,YAAa,CAAEC,UAAWX,EAAM8C,eAAiB,IACxH,EAAET,SAAU5B,IAAgBT,EAAM8C,eAAiB,EAAGhC,SAAUc,EAAKyB,EAAsB,CAAE,aAAyC,QAAxBtD,EAAKC,EAAMM,eAA4B,IAAPP,OAAgB,EAASA,EAAGuD,yBAA4BzC,EAAM,MAAO,CAAEE,UAAW,8CAA+CD,SAAU,CAACc,EAAK2B,EAAUtC,KAAM,CAAET,KAAMA,EAAMgD,KAAM,SAAUnD,MAAOA,EAAOoD,IAAK,IAAKC,IAAK1D,EAAM8C,eAAgB5B,MAAOf,EAASwD,SAAU,SAAUpC,GACzanB,EAAWmB,EAAEqC,OAAO1C,MAChD,EAA2BH,UAAW,4BAA8BF,EAAMgD,EAAM,CAAE/C,SAAU,CAAC,KAAMd,EAAM8C,kBAAoBlB,EAAKiB,EAAQ,CAAErC,KAAMA,EAAM2B,QAAS,WAAc,OAAOnC,EAAM2B,aAAaxB,EAAUsB,OAAOtB,GAAW,EAAI,EAAG,EAAIW,SAAU,YAC1P"}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
export declare const GridVariants: (props?: ({
|
2
2
|
color?: string | null | undefined;
|
3
|
+
radius?: "none" | "small" | "medium" | "large" | "full" | null | undefined;
|
3
4
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
4
|
-
declare function Grid({ table
|
5
|
+
declare function Grid({ table }: {
|
5
6
|
table: any;
|
6
|
-
size?: 'small' | 'medium' | 'large';
|
7
7
|
}): import("react/jsx-runtime").JSX.Element;
|
8
8
|
export default Grid;
|
@@ -1,59 +1,77 @@
|
|
1
1
|
'use client';
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
3
|
+
__assign = Object.assign || function(t) {
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
+
s = arguments[i];
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
+
t[p] = s[p];
|
8
|
+
}
|
9
|
+
return t;
|
10
|
+
};
|
11
|
+
return __assign.apply(this, arguments);
|
12
|
+
};
|
2
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
3
14
|
import { flexRender } from '@tanstack/react-table';
|
4
15
|
// import './index.css';
|
5
16
|
import Table from '../Table';
|
6
17
|
import { ChevronDownIcon, ChevronUpIcon } from '@radix-ui/react-icons';
|
7
18
|
import { cn } from '../../../lib/utils/utils';
|
8
|
-
import { bgColorStyle } from '../../../lib/constants';
|
19
|
+
import { bgColorStyle, radiusVariants } from '../../../lib/constants';
|
9
20
|
import { cva } from 'class-variance-authority';
|
10
21
|
import NumberingPagination from './NumberingPagination';
|
11
22
|
export var GridVariants = cva("", {
|
12
23
|
variants: {
|
13
24
|
color: bgColorStyle(),
|
25
|
+
radius: __assign({}, radiusVariants['large']),
|
14
26
|
},
|
15
27
|
defaultVariants: {
|
16
|
-
|
28
|
+
radius: 'medium',
|
17
29
|
},
|
18
30
|
});
|
19
31
|
function Grid(_a) {
|
20
|
-
var _b, _c, _d;
|
21
|
-
var table = _a.table
|
22
|
-
return (
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
:
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
32
|
+
var _b, _c, _d, _e;
|
33
|
+
var table = _a.table;
|
34
|
+
return (_jsxs("div", { style: { direction: table.options.columnResizeDirection }, children: [_jsxs(Table.Root, { size: (_b = table.options) === null || _b === void 0 ? void 0 : _b.size, appearance: (_c = table.options) === null || _c === void 0 ? void 0 : _c.appearance, radius: table.options.radius, className: cn("rounded-b-none", (_d = table.options) === null || _d === void 0 ? void 0 : _d.tableRootClassName), children: [_jsx(Table.Header, { children: table
|
35
|
+
.getHeaderGroups()
|
36
|
+
.map(function (headerGroup) {
|
37
|
+
return (_jsx(Table.Row, { children: headerGroup.headers.map(function (header, index) {
|
38
|
+
var _a;
|
39
|
+
return (_jsxs(Table.ColumnHeaderCell, { colSpan: header.colSpan,
|
40
|
+
style: {
|
41
|
+
width: header.getSize(),
|
42
|
+
borderLeftWidth: index === 0 ? '' : '1px',
|
43
|
+
}, children: [header.isPlaceholder ? null : (_jsxs("div", { className: header.column.getCanSort()
|
44
|
+
? 'flex cursor-pointer select-none items-center justify-between'
|
45
|
+
: 'h-full w-full flex-1', onClick: header.column.getToggleSortingHandler(), title: header.column.getCanSort()
|
46
|
+
? header.column.getNextSortingOrder() === 'asc'
|
47
|
+
? 'Sort ascending'
|
48
|
+
: header.column.getNextSortingOrder() === 'desc'
|
49
|
+
? 'Sort descending'
|
50
|
+
: 'Clear sort'
|
51
|
+
: undefined, children: [flexRender(header.column.columnDef.header, header.getContext()), header.column.getIsSorted() == 'asc' ? (_jsx(ChevronUpIcon, {})) : header.column.getIsSorted() == 'desc' ? (_jsx(ChevronDownIcon, {})) : null] })), _jsx("div", { onDoubleClick: function () { return header.column.resetSize(); },
|
52
|
+
onMouseDown: header.getResizeHandler(),
|
53
|
+
onTouchStart: header.getResizeHandler(),
|
54
|
+
className: cn('absolute top-0 h-full w-[3px] bg-slateA-3 cursor-col-resize select-none touch-none right-0 opacity-0 hover:opacity-100', table.options.columnResizeDirection, header.column.getIsResizing()
|
55
|
+
? GridVariants({
|
56
|
+
color: table.options.color,
|
57
|
+
})
|
58
|
+
: ''),
|
59
|
+
style: {
|
60
|
+
transform: header.column.getIsResizing()
|
61
|
+
? "translateX(".concat((table.options.columnResizeDirection === 'rtl' ? -1 : 1) *
|
62
|
+
((_a = table.getState().columnSizingInfo.deltaOffset) !== null && _a !== void 0 ? _a : 0), "px)")
|
63
|
+
: '',
|
64
|
+
} })] }, header.id));
|
65
|
+
}) }, headerGroup.id));
|
66
|
+
}) }), _jsx(Table.Body, { className: "border-b", children: table
|
67
|
+
.getRowModel()
|
68
|
+
.rows.map(function (row) { return (_jsx(Table.Row, { onClick: function () { return table.options.onRowClick && table.options.onRowClick(row); }, onDoubleClick: function () {
|
69
|
+
return table.options.onRowDoubleClick && table.options.onRowDoubleClick(row);
|
70
|
+
}, className: "hover:bg-gray-100 ".concat(row.getIsSelected() ? 'bg-gray-200' : ''), children: row.getVisibleCells().map(function (cell, index) {
|
71
|
+
return (_jsx(Table.Cell, __assign({ style: {
|
56
72
|
width: cell.column.getSize(),
|
57
|
-
|
73
|
+
borderLeftWidth: index === 0 ? '' : '1px',
|
74
|
+
} }, cell.column.columnDef.meta, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }), cell.id));
|
75
|
+
}) }, row.id)); }) })] }), _jsx("div", { className: cn('border-[1px] border-t-0 py-[6px]', GridVariants({ radius: table.options.radius }), 'rounded-t-none'), children: ((_e = table.options) === null || _e === void 0 ? void 0 : _e.enableRowPagination) && _jsx(NumberingPagination, { table: table }) })] }));
|
58
76
|
}
|
59
77
|
export default Grid;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
"use client";
|
2
|
-
import{
|
2
|
+
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{flexRender as n}from"@tanstack/react-table";import t from"../Table/index.mjs";import{ChevronUpIcon as r,ChevronDownIcon as i}from"@radix-ui/react-icons";import{cn as l}from"../../utils/utils.mjs";import{bgColorStyle as a,radiusVariants as c}from"../../constants.mjs";import{cva as s}from"class-variance-authority";import u from"./NumberingPagination.mjs";var d=function(){return d=Object.assign||function(e){for(var o,n=1,t=arguments.length;n<t;n++)for(var r in o=arguments[n])Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r]);return e},d.apply(this,arguments)},m=s("",{variants:{color:a(),radius:d({},c.large)},defaultVariants:{radius:"medium"}});function p(a){var c,s,p,g,f=a.table;return e("div",{style:{direction:f.options.columnResizeDirection},children:[e(t.Root,{size:null===(c=f.options)||void 0===c?void 0:c.size,appearance:null===(s=f.options)||void 0===s?void 0:s.appearance,radius:f.options.radius,className:l("rounded-b-none",null===(p=f.options)||void 0===p?void 0:p.tableRootClassName),children:[o(t.Header,{children:f.getHeaderGroups().map((function(a){return o(t.Row,{children:a.headers.map((function(a,c){var s;return e(t.ColumnHeaderCell,{colSpan:a.colSpan,style:{width:a.getSize(),borderLeftWidth:0===c?"":"1px"},children:[a.isPlaceholder?null:e("div",{className:a.column.getCanSort()?"flex cursor-pointer select-none items-center justify-between":"h-full w-full flex-1",onClick:a.column.getToggleSortingHandler(),title:a.column.getCanSort()?"asc"===a.column.getNextSortingOrder()?"Sort ascending":"desc"===a.column.getNextSortingOrder()?"Sort descending":"Clear sort":void 0,children:[n(a.column.columnDef.header,a.getContext()),"asc"==a.column.getIsSorted()?o(r,{}):"desc"==a.column.getIsSorted()?o(i,{}):null]}),o("div",{onDoubleClick:function(){return a.column.resetSize()},onMouseDown:a.getResizeHandler(),onTouchStart:a.getResizeHandler(),className:l("absolute top-0 h-full w-[3px] bg-slateA-3 cursor-col-resize select-none touch-none right-0 opacity-0 hover:opacity-100",f.options.columnResizeDirection,a.column.getIsResizing()?m({color:f.options.color}):""),style:{transform:a.column.getIsResizing()?"translateX(".concat(("rtl"===f.options.columnResizeDirection?-1:1)*(null!==(s=f.getState().columnSizingInfo.deltaOffset)&&void 0!==s?s:0),"px)"):""}})]},a.id)}))},a.id)}))}),o(t.Body,{className:"border-b",children:f.getRowModel().rows.map((function(e){return o(t.Row,{onClick:function(){return f.options.onRowClick&&f.options.onRowClick(e)},onDoubleClick:function(){return f.options.onRowDoubleClick&&f.options.onRowDoubleClick(e)},className:"hover:bg-gray-100 ".concat(e.getIsSelected()?"bg-gray-200":""),children:e.getVisibleCells().map((function(e,r){return o(t.Cell,d({style:{width:e.column.getSize(),borderLeftWidth:0===r?"":"1px"}},e.column.columnDef.meta,{children:n(e.column.columnDef.cell,e.getContext())}),e.id)}))},e.id)}))})]}),o("div",{className:l("border-[1px] border-t-0 py-[6px]",m({radius:f.options.radius}),"rounded-t-none"),children:(null===(g=f.options)||void 0===g?void 0:g.enableRowPagination)&&o(u,{table:f})})]})}export{m as GridVariants,p as default};
|
3
3
|
//# sourceMappingURL=index.mjs.map
|