@binamik/components 0.1.1 → 0.1.2
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/dist/Assets/animations/Spinner/SpinnerStyles.d.ts +1 -0
- package/dist/Buttons/DefaultButton/Button.styles.d.ts +1 -0
- package/dist/Table/EmptyRow.d.ts +6 -0
- package/dist/Table/Header.d.ts +8 -0
- package/dist/Table/MobileSortMenu.d.ts +7 -0
- package/dist/Table/Row.d.ts +12 -0
- package/dist/Table/Table.d.ts +38 -0
- package/dist/Table/helpers.d.ts +5 -0
- package/dist/Table/index.d.ts +5 -0
- package/dist/Table/styles.d.ts +2349 -0
- package/dist/binamik-components.es.js +770 -3
- package/dist/binamik-components.umd.js +402 -24
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(i,s){typeof exports=="object"&&typeof module!="undefined"?s(exports,require("@emotion/react"),require("@emotion/styled"),require("react"),require("framer-motion")):typeof define=="function"&&define.amd?define(["exports","@emotion/react","@emotion/styled","react","framer-motion"],s):(i=typeof globalThis!="undefined"?globalThis:i||self,s(i.BinamikCompoents={},i["emotion-react"],i.styled,i.React,i.framerMotion))})(this,function(i,s,g,c,h){"use strict";var tr=Object.defineProperty,ar=Object.defineProperties;var or=Object.getOwnPropertyDescriptors;var F=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var ee=(i,s,g)=>s in i?tr(i,s,{enumerable:!0,configurable:!0,writable:!0,value:g}):i[s]=g,$=(i,s)=>{for(var g in s||(s={}))re.call(s,g)&&ee(i,g,s[g]);if(F)for(var g of F(s))te.call(s,g)&&ee(i,g,s[g]);return i},A=(i,s)=>ar(i,or(s));var N=(i,s)=>{var g={};for(var c in i)re.call(i,c)&&s.indexOf(c)<0&&(g[c]=i[c]);if(i!=null&&F)for(var c of F(i))s.indexOf(c)<0&&te.call(i,c)&&(g[c]=i[c]);return g};function P(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var b=P(g),v=P(c);const ae=s.keyframes`
|
|
2
2
|
0% {
|
|
3
3
|
stroke-dasharray: 1, 200;
|
|
4
4
|
stroke-dashoffset: 0;
|
|
@@ -11,22 +11,22 @@
|
|
|
11
11
|
stroke-dasharray: 89, 200;
|
|
12
12
|
stroke-dashoffset: -124px;
|
|
13
13
|
}
|
|
14
|
-
`,
|
|
14
|
+
`,oe=s.keyframes`
|
|
15
15
|
100% {
|
|
16
16
|
transform: rotate(360deg);
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
`,ne=b.default.div`
|
|
19
19
|
position: relative;
|
|
20
20
|
margin: 0 auto;
|
|
21
|
-
width: ${({size:
|
|
21
|
+
width: ${({size:e})=>e||"1.5rem"};
|
|
22
22
|
|
|
23
23
|
&:before {
|
|
24
24
|
content: '';
|
|
25
25
|
display: block;
|
|
26
26
|
padding-top: 100%;
|
|
27
27
|
}
|
|
28
|
-
`,
|
|
29
|
-
animation: ${
|
|
28
|
+
`,le=b.default.svg`
|
|
29
|
+
animation: ${oe} 2s linear infinite;
|
|
30
30
|
height: 100%;
|
|
31
31
|
transform-origin: center center;
|
|
32
32
|
width: 100%;
|
|
@@ -36,31 +36,31 @@
|
|
|
36
36
|
left: 0;
|
|
37
37
|
right: 0;
|
|
38
38
|
margin: auto;
|
|
39
|
-
`,
|
|
39
|
+
`,ie=b.default.circle`
|
|
40
40
|
stroke-dasharray: 1, 200;
|
|
41
41
|
stroke-dashoffset: 0;
|
|
42
|
-
animation: ${
|
|
42
|
+
animation: ${ae} 1.5s ease-in-out infinite;
|
|
43
43
|
stroke-linecap: round;
|
|
44
|
-
`;var
|
|
44
|
+
`;var T={exports:{}},k={};/*
|
|
45
45
|
object-assign
|
|
46
46
|
(c) Sindre Sorhus
|
|
47
47
|
@license MIT
|
|
48
|
-
*/var
|
|
48
|
+
*/var D=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;function de(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function ce(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;var a=Object.getOwnPropertyNames(r).map(function(p){return r[p]});if(a.join("")!=="0123456789")return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(p){n[p]=p}),Object.keys(Object.assign({},n)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}ce();/** @license React v17.0.2
|
|
49
49
|
* react-jsx-runtime.production.min.js
|
|
50
50
|
*
|
|
51
51
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
52
52
|
*
|
|
53
53
|
* This source code is licensed under the MIT license found in the
|
|
54
54
|
* LICENSE file in the root directory of this source tree.
|
|
55
|
-
*/var
|
|
55
|
+
*/var ue=v.default,M=60103;if(k.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var R=Symbol.for;M=R("react.element"),k.Fragment=R("react.fragment")}var xe=ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,me=Object.prototype.hasOwnProperty,be={key:!0,ref:!0,__self:!0,__source:!0};function I(e,r,t){var a,n={},p=null,u=null;t!==void 0&&(p=""+t),r.key!==void 0&&(p=""+r.key),r.ref!==void 0&&(u=r.ref);for(a in r)me.call(r,a)&&!be.hasOwnProperty(a)&&(n[a]=r[a]);if(e&&e.defaultProps)for(a in r=e.defaultProps,r)n[a]===void 0&&(n[a]=r[a]);return{$$typeof:M,type:e,key:p,ref:u,props:n,_owner:xe.current}}k.jsx=I,k.jsxs=I,T.exports=k;const d=T.exports.jsx,y=T.exports.jsxs,C=T.exports.Fragment,q=({size:e,color:r,thickness:t})=>d(ne,{size:e,children:d(le,{viewBox:"25 25 50 50",children:d(ie,{className:"path",cx:"50",cy:"50",r:"20",fill:"none",stroke:r||"currentColor",opacity:"0.5",strokeWidth:t||5,strokeMiterlimit:"10"})})}),ge=s.keyframes`
|
|
56
56
|
100% {
|
|
57
57
|
opacity: 0.5;
|
|
58
58
|
}
|
|
59
|
-
`,
|
|
59
|
+
`,fe=b.default.button`
|
|
60
60
|
--button-hover-brightness: 0.88;
|
|
61
61
|
|
|
62
62
|
position: relative;
|
|
63
|
-
padding: ${({isLoading:
|
|
63
|
+
padding: ${({isLoading:e,hasLoadingText:r})=>e&&r?"0.75em 1.125em 0.75em 2.5em":"0.75em 1.25em"};
|
|
64
64
|
border-radius: 30px;
|
|
65
65
|
border: 0;
|
|
66
66
|
|
|
@@ -74,7 +74,7 @@ object-assign
|
|
|
74
74
|
cursor: pointer;
|
|
75
75
|
|
|
76
76
|
.button__text_wrapper {
|
|
77
|
-
animation: ${({isLoading:
|
|
77
|
+
animation: ${({isLoading:e})=>e?ge:"none"} 0.75s infinite
|
|
78
78
|
alternate;
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -121,20 +121,20 @@ object-assign
|
|
|
121
121
|
content: '';
|
|
122
122
|
display: block;
|
|
123
123
|
|
|
124
|
-
width: ${({isLoading:
|
|
124
|
+
width: ${({isLoading:e,hasLoadingText:r})=>e&&r?"2em":"0"};
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
.button__spinner_wrapper {
|
|
128
128
|
margin: -0.5em 0;
|
|
129
|
-
display: ${({isLoading:
|
|
130
|
-
${({hasLoadingText:
|
|
129
|
+
display: ${({isLoading:e})=>e?"block":"none"};
|
|
130
|
+
${({hasLoadingText:e})=>e&&s.css`
|
|
131
131
|
top: calc(50% + 0.5em);
|
|
132
132
|
transform: translateY(-50%);
|
|
133
133
|
position: absolute;
|
|
134
134
|
left: 0.5rem;
|
|
135
135
|
`}
|
|
136
136
|
}
|
|
137
|
-
`,
|
|
137
|
+
`,he=o=>{var l=o,{disabled:e=!1,isLoading:r=!1,loadingText:t="",outlined:a=!1,className:n="",children:p}=l,u=N(l,["disabled","isLoading","loadingText","outlined","className","children"]);return y(fe,A($({disabled:e||r,isLoading:r,hasLoadingText:!!t,className:`${n} ${a?"button__outline":""}`,type:"button"},u),{children:[d("div",{className:"button__spinner_wrapper",children:d(q,{size:"1.5em"})}),d("span",{className:"button__text_wrapper",children:r?t||"":p})]}))},ve=s.css`
|
|
138
138
|
:root {
|
|
139
139
|
--clr-white: #ffffff;
|
|
140
140
|
--clr-black: #000000;
|
|
@@ -234,7 +234,7 @@ object-assign
|
|
|
234
234
|
|
|
235
235
|
--bp-tablet: 64rem; // 1024px
|
|
236
236
|
}
|
|
237
|
-
`,
|
|
237
|
+
`,ye=s.css`
|
|
238
238
|
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p,
|
|
239
239
|
blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em,
|
|
240
240
|
img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u,
|
|
@@ -320,7 +320,7 @@ object-assign
|
|
|
320
320
|
background-clip: text;
|
|
321
321
|
-webkit-background-clip: text;
|
|
322
322
|
}
|
|
323
|
-
`,
|
|
323
|
+
`,we=s.css`
|
|
324
324
|
body {
|
|
325
325
|
line-height: 1;
|
|
326
326
|
color: #444;
|
|
@@ -382,10 +382,388 @@ object-assign
|
|
|
382
382
|
.primary_color_txt {
|
|
383
383
|
color: var(--clr-primary);
|
|
384
384
|
}
|
|
385
|
-
`,
|
|
386
|
-
${
|
|
387
|
-
${
|
|
385
|
+
`,ke=(e="normal")=>e==="light"?"rgba(0, 0, 0, 0.05)":e==="normal"?"rgba(0, 0, 0, 0.1)":"rgba(0, 0, 0, 0.2)",Ce=(e="normal")=>e==="light"?"rgba(0, 0, 0, 0.03)":e==="normal"?"rgba(0, 0, 0, 0.07)":"rgba(0, 0, 0, 0.14)",Te=(e="normal")=>e==="light"?"rgba(0, 0, 0, 0.02)":e==="normal"?"rgba(0, 0, 0, 0.06)":"rgba(0, 0, 0, 0.12)",_e={0:"0px 0px 0px 0px",1:"0px 2px 1px -1px",2:"0px 3px 1px -2px",3:"0px 3px 3px -2px",4:"0px 2px 4px -1px",5:"0px 3px 5px -1px",6:"0px 3px 5px -1px",7:"0px 4px 5px -2px",8:"0px 5px 5px -3px",9:"0px 5px 6px -3px",10:"0px 6px 6px -3px",11:"0px 6px 7px -4px",12:"0px 7px 8px -4px",13:"0px 7px 8px -4px",14:"0px 7px 9px -4px",15:"0px 8px 9px -5px",16:"0px 8px 10px -5px",17:"0px 8px 11px -5px",18:"0px 9px 11px -5px",19:"0px 9px 12px -6px",20:"0px 10px 13px -6px",21:"0px 10px 13px -6px",22:"0px 10px 14px -6px",23:"0px 11px 14px -7px",24:"0px 11px 15px -7px"},Ee={0:"0px 0px 0px 0px",1:"0px 1px 1px 0px",2:"0px 2px 2px 0px",3:"0px 3px 4px 0px",4:"0px 4px 5px 0px",5:"0px 5px 8px 0px",6:"0px 6px 10px 0px",7:"0px 7px 10px 1px",8:"0px 8px 10px 1px",9:"0px 9px 12px 1px",10:"0px 10px 14px 1px",11:"0px 11px 15px 1px",12:"0px 12px 17px 2px",13:"0px 13px 19px 2px",14:"0px 14px 21px 2px",15:"0px 15px 22px 2px",16:"0px 16px 24px 2px",17:"0px 17px 26px 2px",18:"0px 18px 28px 2px",19:"0px 19px 29px 2px",20:"0px 20px 31px 3px",21:"0px 21px 33px 3px",22:"0px 22px 35px 3px",23:"0px 23px 36px 3px",24:"0px 24px 38px 3px"},Oe={0:"0px 0px 0px 0px",1:"0px 1px 3px 0px",2:"0px 1px 5px 0px",3:"0px 1px 8px 0px",4:"0px 1px 10px 0px",5:"0px 1px 14px 0px",6:"0px 1px 18px 0px",7:"0px 2px 16px 1px",8:"0px 3px 14px 2px",9:"0px 3px 16px 2px",10:"0px 4px 18px 3px",11:"0px 4px 20px 3px",12:"0px 5px 22px 4px",13:"0px 5px 24px 4px",14:"0px 5px 26px 4px",15:"0px 6px 28px 5px",16:"0px 6px 30px 5px",17:"0px 6px 32px 5px",18:"0px 7px 34px 6px",19:"0px 7px 36px 6px",20:"0px 8px 38px 7px",21:"0px 8px 40px 7px",22:"0px 8px 42px 7px",23:"0px 9px 44px 8px",24:"0px 9px 46px 8px"},L=(e,r="light")=>`box-shadow: ${_e[e]} ${ke(r)},
|
|
386
|
+
${Ee[e]} ${Ce(r)},
|
|
387
|
+
${Oe[e]} ${Te(r)};`,Fe=()=>d(s.Global,{styles:s.css`
|
|
388
388
|
body {
|
|
389
389
|
overflow: hidden;
|
|
390
390
|
}
|
|
391
|
-
`})
|
|
391
|
+
`}),S=480,$e=e=>Math.max(e.mobileBreakpoint,S),Ae={shouldForwardProp(e){return!["columnTemplate","mobileBreakpoint","customCss"].includes(e)}},Se=b.default(h.motion.div,Ae)`
|
|
392
|
+
--radius: 0.625rem;
|
|
393
|
+
--column-template: ${e=>e.columnTemplate};
|
|
394
|
+
--table-padding: 1.875rem;
|
|
395
|
+
|
|
396
|
+
--header-row-display: grid;
|
|
397
|
+
--label-background: rgba(0, 0, 0, 0.045);
|
|
398
|
+
--highlight-transition: 150ms ease-in-out;
|
|
399
|
+
|
|
400
|
+
--row-padding: 0.5rem;
|
|
401
|
+
--row-margin: 0;
|
|
402
|
+
--row-border: none;
|
|
403
|
+
--row-even-background: var(--clr-gray14);
|
|
404
|
+
--row-odd-background: var(--clr-white);
|
|
405
|
+
--row-hover-background: var(--clr-gray11);
|
|
406
|
+
|
|
407
|
+
--cell-column-template: 1fr;
|
|
408
|
+
--cell-padding: 0.75rem;
|
|
409
|
+
|
|
410
|
+
--row-annex-border: 1px solid var(--clr-gray7);
|
|
411
|
+
--row-annex-padding: calc(var(--row-padding) + var(--cell-padding));
|
|
412
|
+
--row-annex-margin: 0 var(--row-annex-padding) var(--row-annex-padding);
|
|
413
|
+
|
|
414
|
+
--mobile-decorators-content: none;
|
|
415
|
+
--mobile-ref-width: 20ch;
|
|
416
|
+
--mobile-ref-display: none;
|
|
417
|
+
--mobile-sorting-display: none;
|
|
418
|
+
|
|
419
|
+
--table-row-height: 3.75rem;
|
|
420
|
+
|
|
421
|
+
width: 100%;
|
|
422
|
+
color: #2d2d2d;
|
|
423
|
+
line-height: 1.25;
|
|
424
|
+
border-collapse: collapse;
|
|
425
|
+
background-color: var(--clr-white);
|
|
426
|
+
border: 1px solid var(--clr-gray11);
|
|
427
|
+
padding: var(--table-padding);
|
|
428
|
+
border-radius: var(--radius);
|
|
429
|
+
font-size: 0.875rem;
|
|
430
|
+
position: relative;
|
|
431
|
+
|
|
432
|
+
* {
|
|
433
|
+
box-sizing: border-box;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
@media (max-width: ${$e}px) {
|
|
437
|
+
--column-template: 1fr;
|
|
438
|
+
|
|
439
|
+
--header-row-display: none;
|
|
440
|
+
|
|
441
|
+
--row-padding: 0;
|
|
442
|
+
--row-margin: 1rem 0;
|
|
443
|
+
--row-border: 1px solid var(--clr-gray7);
|
|
444
|
+
--row-even-background: var(--clr-gray15);
|
|
445
|
+
--row-hover-background: var(--clr-gray14);
|
|
446
|
+
|
|
447
|
+
--cell-column-template: var(--mobile-ref-width) minmax(0, 1fr);
|
|
448
|
+
--cell-padding: 1rem;
|
|
449
|
+
|
|
450
|
+
--row-annex-padding: var(--cell-padding);
|
|
451
|
+
--row-annex-margin: var(--row-annex-padding);
|
|
452
|
+
|
|
453
|
+
--mobile-decorators-content: '';
|
|
454
|
+
--mobile-ref-display: block;
|
|
455
|
+
--mobile-sorting-display: flex;
|
|
456
|
+
--mobile-cell-display: grid;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
@media (max-width: 480px) {
|
|
460
|
+
--table-padding: 1.25rem;
|
|
461
|
+
|
|
462
|
+
--cell-padding: 0.9rem 0.8rem;
|
|
463
|
+
--mobile-ref-width: 15ch;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
@media (max-width: 360px) {
|
|
467
|
+
--table-padding: 0.7rem;
|
|
468
|
+
--cell-padding: 0.8rem 0.65rem;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
${e=>e.customCss}
|
|
472
|
+
`,Be=b.default(h.motion.div)`
|
|
473
|
+
width: auto;
|
|
474
|
+
position: relative;
|
|
475
|
+
border: var(--row-annex-border);
|
|
476
|
+
border-radius: var(--radius);
|
|
477
|
+
margin: var(--row-annex-margin);
|
|
478
|
+
padding: var(--row-annex-padding);
|
|
479
|
+
background-color: rgba(255, 255, 255, 0.6);
|
|
480
|
+
transition: background-color var(--highlight-transition);
|
|
481
|
+
`,W=s.css`
|
|
482
|
+
display: grid;
|
|
483
|
+
width: 100%;
|
|
484
|
+
grid-template-columns: var(--column-template);
|
|
485
|
+
padding: var(--row-padding);
|
|
486
|
+
border-radius: var(--radius);
|
|
487
|
+
transition: background-color var(--highlight-transition);
|
|
488
|
+
min-height: var(--table-row-height);
|
|
489
|
+
color: var(--clr-gray3);
|
|
490
|
+
min-height: 0;
|
|
491
|
+
min-width: 0;
|
|
492
|
+
`,je=b.default(h.motion.li)`
|
|
493
|
+
margin: var(--row-margin);
|
|
494
|
+
border: var(--row-border);
|
|
495
|
+
border-radius: var(--radius);
|
|
496
|
+
padding: 0.01px 0;
|
|
497
|
+
transition: background-color var(--highlight-transition);
|
|
498
|
+
background-color: var(--clr-white);
|
|
499
|
+
|
|
500
|
+
&:first-of-type {
|
|
501
|
+
margin-top: 0;
|
|
502
|
+
}
|
|
503
|
+
&:last-of-type {
|
|
504
|
+
margin-bottom: 0;
|
|
505
|
+
}
|
|
506
|
+
&:nth-of-type(even) {
|
|
507
|
+
background-color: var(--row-even-background);
|
|
508
|
+
}
|
|
509
|
+
&:nth-of-type(odd) {
|
|
510
|
+
background-color: var(--row-odd-background);
|
|
511
|
+
}
|
|
512
|
+
&:not(.empty_row):hover {
|
|
513
|
+
background-color: var(--row-hover-background);
|
|
514
|
+
}
|
|
515
|
+
`,ze=b.default(h.motion.div)`
|
|
516
|
+
${W}
|
|
517
|
+
|
|
518
|
+
max-width: 100%;
|
|
519
|
+
min-width: 0;
|
|
520
|
+
|
|
521
|
+
&:last-of-type .TableCellWrapper:last-of-type::before {
|
|
522
|
+
border-radius: 0 0 var(--radius) var(--radius);
|
|
523
|
+
}
|
|
524
|
+
&:last-of-type .TableCellWrapper:last-of-type .TableCellRef {
|
|
525
|
+
border-radius: 0 0 0 var(--radius);
|
|
526
|
+
}
|
|
527
|
+
`,Ne=b.default(h.motion.div)`
|
|
528
|
+
${W}
|
|
529
|
+
min-height: 4.375rem;
|
|
530
|
+
background-color: var(--label-background);
|
|
531
|
+
font-weight: bold;
|
|
532
|
+
color: var(--clr-gray3);
|
|
533
|
+
border-radius: var(--radius);
|
|
534
|
+
display: var(--header-row-display);
|
|
535
|
+
`,Pe=b.default(h.motion.ul)`
|
|
536
|
+
width: 100%;
|
|
537
|
+
list-style: none;
|
|
538
|
+
margin: 0;
|
|
539
|
+
padding: 0;
|
|
540
|
+
`,B=s.css`
|
|
541
|
+
padding: var(--cell-padding);
|
|
542
|
+
height: 100%;
|
|
543
|
+
display: flex;
|
|
544
|
+
align-items: center;
|
|
545
|
+
margin: 0;
|
|
546
|
+
`,De=s.css`
|
|
547
|
+
position: relative;
|
|
548
|
+
|
|
549
|
+
&::before {
|
|
550
|
+
content: var(--mobile-decorators-content);
|
|
551
|
+
position: absolute;
|
|
552
|
+
inset: 0;
|
|
553
|
+
pointer-events: none;
|
|
554
|
+
z-index: 0;
|
|
555
|
+
background-color: transparent;
|
|
556
|
+
transition: background-color var(--highlight-transition);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
&:nth-of-type(even) {
|
|
560
|
+
&::before {
|
|
561
|
+
background-color: rgba(0, 0, 0, 0.02);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
&:hover {
|
|
566
|
+
&::before {
|
|
567
|
+
background-color: rgba(0, 0, 0, 0.06);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
&:first-of-type::before {
|
|
572
|
+
border-radius: var(--radius) var(--radius) 0 0;
|
|
573
|
+
}
|
|
574
|
+
`,Me=b.default.div`
|
|
575
|
+
${B}
|
|
576
|
+
|
|
577
|
+
width: 100%;
|
|
578
|
+
`,Re=b.default.div`
|
|
579
|
+
${De}
|
|
580
|
+
|
|
581
|
+
min-width: 0;
|
|
582
|
+
|
|
583
|
+
display: var(--mobile-cell-display, flex);
|
|
584
|
+
|
|
585
|
+
margin: 0;
|
|
586
|
+
width: 100%;
|
|
587
|
+
align-items: center;
|
|
588
|
+
grid-template-columns: var(--cell-column-template);
|
|
589
|
+
|
|
590
|
+
& > * {
|
|
591
|
+
border-radius: none;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
&:first-of-type {
|
|
595
|
+
.TableCellRef {
|
|
596
|
+
border-radius: var(--radius) 0 0 0;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
`,Ie=b.default.div`
|
|
600
|
+
${B}
|
|
601
|
+
|
|
602
|
+
display: var(--mobile-ref-display);
|
|
603
|
+
background-color: var(--label-background);
|
|
604
|
+
font-weight: bold;
|
|
605
|
+
color: var(--clr-gray3);
|
|
606
|
+
`,qe=s.css`
|
|
607
|
+
&.sortable,
|
|
608
|
+
&.sorted-asc,
|
|
609
|
+
&.sorted-desc {
|
|
610
|
+
cursor: pointer;
|
|
611
|
+
position: relative;
|
|
612
|
+
padding-left: 3.5ch;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
&::after,
|
|
616
|
+
&::before {
|
|
617
|
+
content: '';
|
|
618
|
+
display: block;
|
|
619
|
+
position: absolute;
|
|
620
|
+
height: 0.8ch;
|
|
621
|
+
width: 0.8ch;
|
|
622
|
+
border: 0 solid var(--clr-gray3);
|
|
623
|
+
transform: rotate(45deg);
|
|
624
|
+
left: var(--cell-padding);
|
|
625
|
+
}
|
|
626
|
+
&::before {
|
|
627
|
+
border-width: 1.5px 0 0 1.5px;
|
|
628
|
+
margin-bottom: 1.2ch;
|
|
629
|
+
}
|
|
630
|
+
&::after {
|
|
631
|
+
border-width: 0 1.5px 1.5px 0;
|
|
632
|
+
margin-top: 0.8ch;
|
|
633
|
+
}
|
|
634
|
+
&:not(.sortable) {
|
|
635
|
+
cursor: default;
|
|
636
|
+
&::before,
|
|
637
|
+
&::after {
|
|
638
|
+
content: none;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
&.sorted-desc {
|
|
642
|
+
&::before {
|
|
643
|
+
content: none;
|
|
644
|
+
}
|
|
645
|
+
&::after {
|
|
646
|
+
content: '';
|
|
647
|
+
margin-top: 0;
|
|
648
|
+
margin-bottom: 0.65ch;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
&.sorted-asc {
|
|
652
|
+
&::after {
|
|
653
|
+
content: none;
|
|
654
|
+
}
|
|
655
|
+
&::before {
|
|
656
|
+
content: '';
|
|
657
|
+
margin-bottom: 0;
|
|
658
|
+
margin-top: 0.2ch;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
`,Le=b.default.div`
|
|
662
|
+
${B}
|
|
663
|
+
transition: background-color var(--highlight-transition);
|
|
664
|
+
border-radius: var(--radius);
|
|
665
|
+
|
|
666
|
+
&:hover {
|
|
667
|
+
background-color: var(--clr-gray8);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
${qe}
|
|
671
|
+
`,We=b.default(h.motion.button)`
|
|
672
|
+
display: var(--mobile-sorting-display);
|
|
673
|
+
align-items: center;
|
|
674
|
+
color: var(--clr-gray3);
|
|
675
|
+
margin: 0.5rem;
|
|
676
|
+
background-color: var(--clr-gray12);
|
|
677
|
+
border-radius: var(--radius);
|
|
678
|
+
padding: 0.5rem;
|
|
679
|
+
margin: -0.5rem 0 1rem auto;
|
|
680
|
+
cursor: default;
|
|
681
|
+
|
|
682
|
+
> svg {
|
|
683
|
+
margin-right: 0.5rem;
|
|
684
|
+
font-size: 1.75rem;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
> p {
|
|
688
|
+
margin-right: 0.25rem;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
&.sortable {
|
|
692
|
+
cursor: pointer;
|
|
693
|
+
&:hover {
|
|
694
|
+
background-color: var(--clr-gray8);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
&::after {
|
|
698
|
+
content: '';
|
|
699
|
+
display: inline-block;
|
|
700
|
+
width: 0.4rem;
|
|
701
|
+
height: 0.4rem;
|
|
702
|
+
border: 1px solid var(--clr-gray4);
|
|
703
|
+
border-width: 0 1px 1px 0;
|
|
704
|
+
transform: rotate(45deg);
|
|
705
|
+
margin: 0 0.25rem;
|
|
706
|
+
transition: transform 300ms, margin 300ms;
|
|
707
|
+
margin-bottom: 0.25rem;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
&.open {
|
|
711
|
+
z-index: 11;
|
|
712
|
+
&::after {
|
|
713
|
+
transform: rotate(225deg);
|
|
714
|
+
margin-top: 0.1rem;
|
|
715
|
+
margin-bottom: 0;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
`,He=b.default(h.motion.div)`
|
|
720
|
+
position: absolute;
|
|
721
|
+
top: 2.5rem;
|
|
722
|
+
right: 0;
|
|
723
|
+
background-color: var(--clr-white);
|
|
724
|
+
color: var(--clr-gray3);
|
|
725
|
+
margin: var(--table-padding);
|
|
726
|
+
padding: 0.5rem;
|
|
727
|
+
border-radius: var(--radius);
|
|
728
|
+
z-index: 11;
|
|
729
|
+
display: flex;
|
|
730
|
+
flex-direction: column;
|
|
731
|
+
align-items: flex-end;
|
|
732
|
+
border: 1px solid var(--clr-gray10);
|
|
733
|
+
overflow: auto;
|
|
734
|
+
max-height: calc(100vh - 5rem);
|
|
735
|
+
transform-origin: top right;
|
|
736
|
+
${L(8)}
|
|
737
|
+
`,Ue=b.default.button`
|
|
738
|
+
background-color: var(--clr-white);
|
|
739
|
+
padding: 0.5rem;
|
|
740
|
+
border-radius: var(--radius);
|
|
741
|
+
color: inherit;
|
|
742
|
+
display: flex;
|
|
743
|
+
align-items: center;
|
|
744
|
+
justify-content: space-between;
|
|
745
|
+
flex-direction: row-reverse;
|
|
746
|
+
width: 100%;
|
|
747
|
+
|
|
748
|
+
> p {
|
|
749
|
+
margin: 0.17rem 0;
|
|
750
|
+
margin-right: 0.25rem;
|
|
751
|
+
margin-left: 1.75rem;
|
|
752
|
+
&:not(:last-child) {
|
|
753
|
+
margin-left: 0.5rem;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
&:hover {
|
|
757
|
+
background-color: var(--clr-gray8);
|
|
758
|
+
}
|
|
759
|
+
`,Ge=b.default(h.motion.button)`
|
|
760
|
+
position: fixed;
|
|
761
|
+
inset: 0;
|
|
762
|
+
z-index: 10;
|
|
763
|
+
width: 100%;
|
|
764
|
+
height: 100%;
|
|
765
|
+
background-color: transparent;
|
|
766
|
+
cursor: default;
|
|
767
|
+
`,_=`
|
|
768
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
769
|
+
`,H=(e=[])=>e.map(({width:t})=>(t==null?void 0:t.replace(/\s/g,""))||"1fr").join(" "),Ve=({columns:e=[],children:r=[],mobileBreakpoint:t=900})=>{t<S&&console.warn(`Table: mobileBreakpoint (${t}) is too small. The minimum of ${S} will be used instead.${_}`),H(e).split(" ").map((o,l)=>({value:o,idx:l})).filter(o=>!CSS.supports("grid-template-columns",o.value)).forEach(o=>{const l=o.value.replace(/"/g,'\\"');console.warn(`Table: Invalid width value "${l}" on columnsWidths[${o.idx}].${_}`)});const p=r.map((o,l)=>({value:o,idx:l})).filter(o=>{var l,x,f,m;return v.default.isValidElement(o.value)&&(((x=(l=o.value)==null?void 0:l.type)==null?void 0:x.displayName)==="TableRow"||((m=(f=o.value)==null?void 0:f.type)==null?void 0:m.displayName)==="EmptyRow")});p.forEach(o=>{var x,f,m,O,Z;const l=(m=(f=(x=o.value)==null?void 0:x.props)==null?void 0:f.children)==null?void 0:m.filter(rr=>rr!==void 0).length;v.default.isValidElement(o.value)&&((Z=(O=o.value)==null?void 0:O.type)==null?void 0:Z.displayName)!=="EmptyRow"&&l!==e.length&&console.warn(`Table: children[${o.idx}] length (${l}) should be equal to labels length (${e.length}).${_}`)}),r.map((o,l)=>({value:o,idx:l})).filter(o=>!p.some(l=>l.idx===o.idx)).forEach(o=>{console.warn(`Table: children[${o.idx}] is not a TableRow. See TableRow component.${_}`)})},U=e=>e!=="asc"?"asc":"desc",Ke=({column:e,onSort:r})=>{const{sortedColumn:t,sortedOrder:a=""}=E(),n=c.useMemo(()=>t===e.name?a:"",[e.name,t,a]),p=c.useCallback(()=>{!e.sortable||r(U(n))},[e.sortable,r,n]);return d(Le,{className:["TableHeader",n?`sorted-${n}`:"",e.sortable?"sortable":""].join(" "),onClick:p,role:e.sortable?"button":void 0,children:e.label})};var G={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},V=v.default.createContext&&v.default.createContext(G),w=globalThis&&globalThis.__assign||function(){return w=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++){r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},w.apply(this,arguments)},Ye=globalThis&&globalThis.__rest||function(e,r){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(e);n<a.length;n++)r.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(t[a[n]]=e[a[n]]);return t};function K(e){return e&&e.map(function(r,t){return v.default.createElement(r.tag,w({key:t},r.attr),K(r.child))})}function j(e){return function(r){return v.default.createElement(Je,w({attr:w({},e.attr)},r),K(e.child))}}function Je(e){var r=function(t){var a=e.attr,n=e.size,p=e.title,u=Ye(e,["attr","size","title"]),o=n||t.size||"1em",l;return t.className&&(l=t.className),e.className&&(l=(l?l+" ":"")+e.className),v.default.createElement("svg",w({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,a,u,{className:l,style:w(w({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),p&&v.default.createElement("title",null,p),e.children)};return V!==void 0?v.default.createElement(V.Consumer,null,function(t){return r(t)}):r(G)}function Qe(e){return j({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M7 20h2V8h3L8 4 4 8h3zm13-4h-3V4h-2v12h-3l4 4z"}}]})(e)}function Y(e){return j({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"m6 20 4-4H7V4H5v12H2zm5-12h9v2h-9zm0 4h7v2h-7zm0-8h11v2H11zm0 12h5v2h-5z"}}]})(e)}function J(e){return j({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M11 9h9v2h-9zm0 4h7v2h-7zm0-8h11v2H11zm0 12h5v2h-5zm-6 3h2V8h3L6 4 2 8h3z"}}]})(e)}const Xe=({onSortingChange:e})=>{const{columns:r=[],sortedOrder:t="",sortedColumn:a=""}=E(),n=c.useMemo(()=>r.filter(({sortable:m})=>m),[r]),p=c.useMemo(()=>{var m;return((m=r.find(({name:O})=>O===a))==null?void 0:m.label)||""},[r,a]),u=c.useMemo(()=>n.length,[n]),[o,l]=c.useState(!1),x=c.useCallback(()=>{u&&l(m=>!m)},[u]);c.useEffect(()=>{u&&l(!1)},[u]);const f=c.useCallback(m=>()=>{l(!1),e(m)(U(a===m.name?t:""))},[e,a,t]);return u||p&&t?y(C,{children:[y(We,{className:[u?"sortable":"",o?"open":""].join(" "),onClick:x,disabled:!u,type:"button",layout:!0,children:[u&&(!p||!t)?y(C,{children:[d(Qe,{}),d("p",{children:"Ordenar"})]}):null,p&&t?y(C,{children:[t==="asc"?d(Y,{}):d(J,{}),d("p",{children:p})]}):null]}),d(h.AnimatePresence,{children:o?y(C,{children:[d(Ge,{onClick:x,type:"button"}),d(He,{initial:{transform:"scale(0)",opacity:0},animate:{transform:"scale(1)",opacity:1},exit:{transform:"scale(0)",opacity:0},transition:{type:"tween"},children:n.map(m=>y(Ue,{onClick:f(m),children:[d("p",{children:m.label}),m.name===a?t==="desc"?d(Y,{size:"1.25rem"}):d(J,{size:"1.25rem"}):null]},m.key))})]}):null})]}):null},Ze=e=>{},Q=c.createContext({}),er=({columns:e=[],children:r,customCss:t,sorting:a,onSortingChange:n=Ze,mobileBreakpoint:p=900})=>{const u=c.useCallback(x=>f=>{!(x!=null&&x.sortable)||n({column:x.name,order:f})},[n]);c.useEffect(()=>{const x=r.flat().filter(Boolean);Ve({columns:e,children:x,mobileBreakpoint:p})},[r,e,p]);const o=c.useMemo(()=>H(e),[e]),l=c.useMemo(()=>e.map((x,f)=>A($({},x),{index:f,key:`${x.name}-${f}`})),[e]);return d(Q.Provider,{value:{columns:l,sortedOrder:a==null?void 0:a.order,sortedColumn:a==null?void 0:a.column},children:y(Se,{columnTemplate:o,customCss:t,mobileBreakpoint:p,layout:!0,children:[d(Xe,{onSortingChange:u}),d(Ne,{layout:!0,children:l.map(x=>d(Ke,{column:x,onSort:u(x)},x.key))}),d(Pe,{children:r.map((x,f)=>d(c.Fragment,{children:x},f))})]})})};function E(){const e=c.useContext(Q);if(!e)throw new Error("useTable and TableRow must be used within a Table");return e}const z=n=>{var p=n,{children:e,className:r,annex:t}=p,a=N(p,["children","className","annex"]);const{columns:u=[]}=E(),o=c.useMemo(()=>`table-row-${Math.random().toString(16).slice(2)}`,[]);return d(C,{children:y(je,A($({layout:!0,className:r},a),{children:[d(ze,{id:o,layoutId:o,className:"TableRow",children:u.map(l=>y(Re,{className:`TableCellWrapper column-${l.index}`,children:[d(Ie,{className:`TableCellRef column-${l.index}`,children:l.label}),d(Me,{className:`TableCell column-${l.index}`,children:e[l.index]||null})]},l.key))}),d(h.AnimatePresence,{children:t?d(Be,{layoutId:`${o}-annex`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,height:0,padding:0,margin:0,overflow:"hidden"},transition:{type:"tween"},"aria-details":o,className:"TableRowAnnex",children:t},"annex"):null})]}))})};z.displayName="TableRow";const X=()=>{const{columns:e=[]}=E();return d(z,{className:"empty_row",children:Array(e.length).fill(null)})};X.displayName="EmptyRow",i.Button=he,i.EmptyRow=X,i.PreventScroll=Fe,i.Spinner=q,i.Table=er,i.TableRow=z,i.binamikCssReset=ye,i.binamikGlobalStyles=we,i.binamikTheme=ve,i.depth=L,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/index.d.ts
CHANGED