@kubed/components 0.0.35 → 0.0.38
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/CHANGELOG.md +29 -0
- package/cjs/Button/Button.styles.js +12 -13
- package/cjs/Button/Button.styles.js.map +1 -1
- package/cjs/Loading/Loading.js +1 -12
- package/cjs/Loading/Loading.js.map +1 -1
- package/cjs/Loading/loaders/Circle.js +13 -0
- package/cjs/Loading/loaders/Circle.js.map +1 -0
- package/cjs/Loading/loaders/Oval.js +6 -0
- package/cjs/Loading/loaders/Oval.js.map +1 -0
- package/cjs/ShowMore/ShowMore.js +11 -0
- package/cjs/ShowMore/ShowMore.js.map +1 -0
- package/cjs/Steps/Step/Step.js +2 -0
- package/cjs/Steps/Step/Step.js.map +1 -0
- package/cjs/Steps/Step/Step.styles.js +59 -0
- package/cjs/Steps/Step/Step.styles.js.map +1 -0
- package/cjs/Steps/StepCompleted/StepCompleted.js +2 -0
- package/cjs/Steps/StepCompleted/StepCompleted.js.map +1 -0
- package/cjs/Steps/Steps.js +2 -0
- package/cjs/Steps/Steps.js.map +1 -0
- package/cjs/Steps/Steps.styles.js +48 -0
- package/cjs/Steps/Steps.styles.js.map +1 -0
- package/cjs/Steps/TabStep/TabStep.js +2 -0
- package/cjs/Steps/TabStep/TabStep.js.map +1 -0
- package/cjs/Steps/TabStep/TabStep.styles.js +84 -0
- package/cjs/Steps/TabStep/TabStep.styles.js.map +1 -0
- package/cjs/Tabs/Tabs.js +1 -1
- package/cjs/Tabs/Tabs.js.map +1 -1
- package/cjs/Tabs/Tabs.styles.js +12 -12
- package/cjs/Tabs/Tabs.styles.js.map +1 -1
- package/cjs/Tag/Tag.js +13 -4
- package/cjs/Tag/Tag.js.map +1 -1
- package/cjs/TypeSelect/TypeSelect.js +2 -0
- package/cjs/TypeSelect/TypeSelect.js.map +1 -0
- package/cjs/TypeSelect/TypeSelect.styles.js +54 -0
- package/cjs/TypeSelect/TypeSelect.styles.js.map +1 -0
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/utils/toArray.js.map +1 -1
- package/cjs/utils/types.js.map +1 -1
- package/esm/Button/Button.styles.js +41 -42
- package/esm/Button/Button.styles.js.map +1 -1
- package/esm/Loading/Loading.js +1 -12
- package/esm/Loading/Loading.js.map +1 -1
- package/esm/Loading/loaders/Circle.js +13 -0
- package/esm/Loading/loaders/Circle.js.map +1 -0
- package/esm/Loading/loaders/Oval.js +6 -0
- package/esm/Loading/loaders/Oval.js.map +1 -0
- package/esm/ShowMore/ShowMore.js +11 -0
- package/esm/ShowMore/ShowMore.js.map +1 -0
- package/esm/Steps/Step/Step.js +2 -0
- package/esm/Steps/Step/Step.js.map +1 -0
- package/esm/Steps/Step/Step.styles.js +59 -0
- package/esm/Steps/Step/Step.styles.js.map +1 -0
- package/esm/Steps/StepCompleted/StepCompleted.js +2 -0
- package/esm/Steps/StepCompleted/StepCompleted.js.map +1 -0
- package/esm/Steps/Steps.js +2 -0
- package/esm/Steps/Steps.js.map +1 -0
- package/esm/Steps/Steps.styles.js +48 -0
- package/esm/Steps/Steps.styles.js.map +1 -0
- package/esm/Steps/TabStep/TabStep.js +2 -0
- package/esm/Steps/TabStep/TabStep.js.map +1 -0
- package/esm/Steps/TabStep/TabStep.styles.js +84 -0
- package/esm/Steps/TabStep/TabStep.styles.js.map +1 -0
- package/esm/Tabs/Tabs.js +1 -1
- package/esm/Tabs/Tabs.js.map +1 -1
- package/esm/Tabs/Tabs.styles.js +30 -30
- package/esm/Tabs/Tabs.styles.js.map +1 -1
- package/esm/Tag/Tag.js +18 -9
- package/esm/Tag/Tag.js.map +1 -1
- package/esm/TypeSelect/TypeSelect.js +2 -0
- package/esm/TypeSelect/TypeSelect.js.map +1 -0
- package/esm/TypeSelect/TypeSelect.styles.js +54 -0
- package/esm/TypeSelect/TypeSelect.styles.js.map +1 -0
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/utils/toArray.js.map +1 -1
- package/esm/utils/types.js.map +1 -1
- package/lib/src/Button/Button.styles.d.ts.map +1 -1
- package/lib/src/Loading/Loading.d.ts +10 -2
- package/lib/src/Loading/Loading.d.ts.map +1 -1
- package/lib/src/Loading/loaders/Circle.d.ts +12 -0
- package/lib/src/Loading/loaders/Circle.d.ts.map +1 -0
- package/lib/src/Loading/loaders/Oval.d.ts +4 -0
- package/lib/src/Loading/loaders/Oval.d.ts.map +1 -0
- package/lib/src/ShowMore/ShowMore.d.ts +18 -0
- package/lib/src/ShowMore/ShowMore.d.ts.map +1 -0
- package/lib/src/Slider/Slider.d.ts.map +1 -1
- package/lib/src/Steps/Step/Step.d.ts +38 -0
- package/lib/src/Steps/Step/Step.d.ts.map +1 -0
- package/lib/src/Steps/Step/Step.styles.d.ts +8 -0
- package/lib/src/Steps/Step/Step.styles.d.ts.map +1 -0
- package/lib/src/Steps/StepCompleted/StepCompleted.d.ts +10 -0
- package/lib/src/Steps/StepCompleted/StepCompleted.d.ts.map +1 -0
- package/lib/src/Steps/Steps.d.ts +37 -0
- package/lib/src/Steps/Steps.d.ts.map +1 -0
- package/lib/src/Steps/Steps.styles.d.ts +10 -0
- package/lib/src/Steps/Steps.styles.d.ts.map +1 -0
- package/lib/src/Steps/TabStep/TabStep.d.ts +42 -0
- package/lib/src/Steps/TabStep/TabStep.d.ts.map +1 -0
- package/lib/src/Steps/TabStep/TabStep.styles.d.ts +8 -0
- package/lib/src/Steps/TabStep/TabStep.styles.d.ts.map +1 -0
- package/lib/src/Tabs/Tabs.d.ts.map +1 -1
- package/lib/src/Tabs/Tabs.styles.d.ts +1 -1
- package/lib/src/Tabs/Tabs.styles.d.ts.map +1 -1
- package/lib/src/Tag/Tag.d.ts +8 -1
- package/lib/src/Tag/Tag.d.ts.map +1 -1
- package/lib/src/TypeSelect/TypeSelect.d.ts +20 -0
- package/lib/src/TypeSelect/TypeSelect.d.ts.map +1 -0
- package/lib/src/TypeSelect/TypeSelect.styles.d.ts +10 -0
- package/lib/src/TypeSelect/TypeSelect.styles.d.ts.map +1 -0
- package/lib/src/index.d.ts +3 -0
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/utils/toArray.d.ts.map +1 -1
- package/lib/src/utils/types.d.ts +3 -0
- package/lib/src/utils/types.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import t from"styled-components";import o from"../../theme/utils.js";const r=t.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
align-items: center;
|
|
6
|
+
text-align: left;
|
|
7
|
+
min-width: 180px;
|
|
8
|
+
height: 100%;
|
|
9
|
+
padding: 12px 15px;
|
|
10
|
+
&[data-progress='true'] {
|
|
11
|
+
background-color: ${({theme:e})=>e.palette.background};
|
|
12
|
+
}
|
|
13
|
+
`,i=t.div`
|
|
14
|
+
margin-left: 12px;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
`,n=t.div`
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
font-weight: 700;
|
|
20
|
+
line-height: 1.67;
|
|
21
|
+
text-align: left;
|
|
22
|
+
color: ${({theme:e})=>e.palette.accents_8};
|
|
23
|
+
`,l=t.div`
|
|
24
|
+
text-align: left;
|
|
25
|
+
line-height: 1.67;
|
|
26
|
+
color: ${({theme:e})=>e.palette.accents_5};
|
|
27
|
+
`,c=t.div`
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
position: relative;
|
|
32
|
+
font-weight: 700;
|
|
33
|
+
width: 40px;
|
|
34
|
+
height: 40px;
|
|
35
|
+
min-height: 40px;
|
|
36
|
+
//border-radius: 32px;
|
|
37
|
+
font-size: 16px;
|
|
38
|
+
//border: 2px solid ${({theme:e})=>e.palette.accents_2};
|
|
39
|
+
transition: background-color 150ms ease, border-color 150ms ease;
|
|
40
|
+
//background-color: ${({theme:e})=>e.palette.accents_2};
|
|
41
|
+
color: ${({theme:e})=>e.palette.accents_7};
|
|
42
|
+
&[data-progress='true'] {
|
|
43
|
+
&:after {
|
|
44
|
+
border-color: ${({theme:e})=>o.getPrimaryColor(e)};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
&[data-completed='true'] {
|
|
48
|
+
color: #fff;
|
|
49
|
+
&:after {
|
|
50
|
+
border-color: ${({theme:e})=>o.getPrimaryColor(e)};
|
|
51
|
+
background-color: ${({theme:e})=>o.getPrimaryColor(e)};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.kubed-icon {
|
|
56
|
+
width: 40px;
|
|
57
|
+
height: 40px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:after {
|
|
61
|
+
position: absolute;
|
|
62
|
+
right: 0;
|
|
63
|
+
bottom: 0;
|
|
64
|
+
content: ' ';
|
|
65
|
+
border: 2px solid ${({theme:e})=>e.palette.accents_3};
|
|
66
|
+
background-color: ${({theme:e})=>e.palette.background};
|
|
67
|
+
display: block;
|
|
68
|
+
width: 12px;
|
|
69
|
+
height: 12px;
|
|
70
|
+
border-radius: 50%;
|
|
71
|
+
}
|
|
72
|
+
`,a=t.div`
|
|
73
|
+
position: relative;
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
flex-shrink: 0;
|
|
76
|
+
`,p=t.div`
|
|
77
|
+
position: absolute;
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
color: #fff;
|
|
82
|
+
inset: 0;
|
|
83
|
+
`;export{i as StepBody,p as StepCompletedIcon,l as StepDescription,c as StepIcon,a as StepIconWrapper,n as StepLabel,r as StepWrapper};
|
|
84
|
+
//# sourceMappingURL=TabStep.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabStep.styles.js","sources":["../../../src/Steps/TabStep/TabStep.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { KubedTheme, themeUtils } from '../../theme';\n\nexport const StepWrapper = styled.div`\n display: flex;\n flex-direction: row;\n cursor: pointer;\n align-items: center;\n text-align: left;\n min-width: 180px;\n height: 100%;\n padding: 12px 15px;\n &[data-progress='true'] {\n background-color: ${({ theme }) => theme.palette.background};\n }\n`;\n\nexport const StepBody = styled.div`\n margin-left: 12px;\n display: flex;\n flex-direction: column;\n`;\n\nexport const StepLabel = styled.div`\n font-size: 12px;\n font-weight: 700;\n line-height: 1.67;\n text-align: left;\n color: ${({ theme }) => theme.palette.accents_8};\n`;\n\nexport const StepDescription = styled.div`\n text-align: left;\n line-height: 1.67;\n color: ${({ theme }) => theme.palette.accents_5};\n`;\n\nexport const StepIcon = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n font-weight: 700;\n width: 40px;\n height: 40px;\n min-height: 40px;\n //border-radius: 32px;\n font-size: 16px;\n //border: 2px solid ${({ theme }) => theme.palette.accents_2};\n transition: background-color 150ms ease, border-color 150ms ease;\n //background-color: ${({ theme }) => theme.palette.accents_2};\n color: ${({ theme }) => theme.palette.accents_7};\n &[data-progress='true'] {\n &:after {\n border-color: ${({ theme }) => themeUtils.getPrimaryColor(theme)};\n }\n }\n &[data-completed='true'] {\n color: #fff;\n &:after {\n border-color: ${({ theme }) => themeUtils.getPrimaryColor(theme)};\n background-color: ${({ theme }) => themeUtils.getPrimaryColor(theme)};\n }\n }\n\n .kubed-icon {\n width: 40px;\n height: 40px;\n }\n\n &:after {\n position: absolute;\n right: 0;\n bottom: 0;\n content: ' ';\n border: 2px solid ${({ theme }) => theme.palette.accents_3};\n background-color: ${({ theme }) => theme.palette.background};\n display: block;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n }\n`;\n\nexport const StepIconWrapper = styled.div`\n position: relative;\n overflow: hidden;\n flex-shrink: 0;\n`;\n\nexport const StepCompletedIcon = styled.div`\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\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AC,EAAE,KAAK,EAAE,KAAK,UAAU,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AAC/D,sBAAsB,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;AAChE;AACA;AACA;AACA;AACA;AACA,EAAE;AACU,MAAC,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC;AAC1C;AACA;AACA;AACA,EAAE;AACU,MAAC,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
|
package/esm/Tabs/Tabs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i,{useState as T,useRef as O,useEffect as W}from"react";import $ from"classnames";import{useUncontrolled as U,useId as q,useReducedMotion as H}from"@kubed/hooks";import{Group as J}from"../Group/Group.js";import Q from"../utils/toArray.js";import{WRAPPER_PADDING as E,TabControl as X,TabControlLabel as Z,TabsContainer as ee,TabControlList as te,PillsBg as re,LineBg as ne,TabPanel as ae}from"./Tabs.styles.js";var ie=Object.defineProperty,oe=Object.defineProperties,le=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,R=(t,e,r)=>e in t?ie(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,j=(t,e)=>{for(var r in e||(e={}))C.call(e,r)&&R(t,r,e[r]);if(g)for(var r of g(e))A.call(e,r)&&R(t,r,e[r]);return t},se=(t,e)=>oe(t,le(e)),ce=(t,e)=>{var r={};for(var n in t)C.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&g)for(var n of g(t))e.indexOf(n)<0&&A.call(t,n)&&(r[n]=t[n]);return r};const ue={horizontal:"row",vertical:"column"},me=t=>{for(let e=0;e<t.length;e+=1)if(!t[e].disabled)return t[e].key;return-1},fe=t=>Q(t).map(e=>{if(i.isValidElement(e)){const r=e.key!==void 0?String(e.key):void 0;return se(j({key:r},e.props),{node:e})}return null});function k(t){var e=t,{children:r,name:n,variant:o="pills",activeKey:D,defaultActiveKey:N,onTabChange:x,color:h,grow:y,radius:p="lg",size:P="sm",position:m="left",direction:f="horizontal",tabPadding:z="xs",transitionDuration:B=150,transitionTimingFunction:K}=e,S=ce(e,["children","name","variant","activeKey","defaultActiveKey","onTabChange","color","grow","radius","size","position","direction","tabPadding","transitionDuration","transitionTimingFunction"]);const[w,G]=T(!1),v=fe(r),[l,I]=U({value:D,defaultValue:N,finalValue:me(v),onChange:x,rule:a=>!!a}),[s,L]=T({width:0,height:0,translate:0,translateY:0}),M=q(n),V=H(),b=O({}),d=O(null);W(()=>{if(o==="outline")return null;const a=new ResizeObserver(()=>{if(l in b.current&&d.current){const u=b.current[l].getBoundingClientRect();L({width:u.width,height:u.height,translate:u.x-d.current.getBoundingClientRect().x-E,translateY:u.y-d.current.getBoundingClientRect().y-E}),w||setTimeout(()=>{G(!0)},4)}});return a.observe(d.current),()=>a.disconnect()},[l]);const Y=v.map(a=>{const{key:c,label:u}=a,_=l===c;return i.createElement(X,{key:c,active:_,radius:p,size:P,reduceMotion:V||!w,transitionTimingFunction:K,transitionDuration:B,className:$("tab-item",{"tab-item__active":_})},i.createElement(Z,{active:_,htmlFor:`${M}-${c}`,ref:F=>{b.current[c]=F},onClick:()=>I(c),className:"tab-label"},u))});return i.createElement(ee,j({variant:o,direction:f,position:m},S),i.createElement(te,{variant:o,fullWidth:y,radius:p,size:P,position:m,direction:f,color:h,ref:d},!!l&&o!=="outline"&&(o==="pills"?i.createElement(re,{variant:o,radius:p,color:h,width:s.width,transform:s.translate}):i.createElement(ne,{variant:o,radius:p,color:h,direction:f,position:m,width:s.width,height:s.height,transform:s.translate,translateY:s.translateY,className:"line-bg"})),i.createElement(J,{grow:y,spacing:0,position:m,direction:ue[f],className:"tab-group"},Y)),i.createElement(ae,{direction:f,position:m,variant:o,tabPadding:z},v.map(a=>a.key===l?a.children:null)))}k.displayName="@kubed/components/Tabs";export{k as Tabs};
|
|
2
2
|
//# sourceMappingURL=Tabs.js.map
|
package/esm/Tabs/Tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sources":["../../src/Tabs/Tabs.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport cx from 'classnames';\nimport { useId, useUncontrolled, useReducedMotion } from '@kubed/hooks';\nimport { KubedNumberSize, KubedSizes } from '../theme';\nimport { Group, GroupPosition, GroupDirection } from '../Group/Group';\nimport { Tab, TabProps } from './Tab/Tab';\nimport toArray from '../utils/toArray';\n\nimport {\n TabsContainer,\n TabControlList,\n TabControl,\n TabControlLabel,\n TabPanel,\n WRAPPER_PADDING,\n PillsBg,\n LineBg,\n} from './Tabs.styles';\n\nexport { Tab };\nexport type { TabProps };\n\nconst directionMapping = {\n horizontal: 'row',\n vertical: 'column',\n};\n\nconst findDefaultTab = (tabs: TabProps[]) => {\n for (let i = 0; i < tabs.length; i += 1) {\n if (!tabs[i].disabled) {\n return tabs[i].key;\n }\n }\n\n return -1;\n};\n\nexport interface TabsProps\n extends Omit<React.ComponentPropsWithoutRef<'div'>, 'value' | 'onChange'> {\n /** Current selected value */\n variant?: 'pills' | 'line' | 'outline';\n\n /** Current selected value */\n activeKey?: string;\n\n /** Default value for uncontrolled component */\n defaultActiveKey?: string;\n\n /** Called when value changes */\n onChange?(value: string): void;\n\n /** Name of the radio group, default to random id */\n name?: string;\n\n /** True if component should have 100% width */\n grow?: boolean;\n\n /** Active control color from theme, defaults to white in light color scheme and theme.colors.dark[9] in dark */\n color?: string | 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error';\n\n /** Controls font-size, paddings and height */\n size?: KubedSizes;\n\n /** Border-radius from theme or number to set border-radius in px */\n radius?: KubedNumberSize;\n\n /** Tab controls position */\n position?: GroupPosition;\n\n /** Tab controls direction */\n direction?: 'horizontal' | 'vertical';\n\n /** Controls tab content padding-top */\n tabPadding?: KubedNumberSize;\n\n /** Called when tab control is clicked with tab index */\n onTabChange?(tabKey: string): void;\n\n /** Transition duration in ms, set to 0 to turn off transitions */\n transitionDuration?: number;\n\n /** Transition timing function for all transitions, defaults to theme.transitionTimingFunction */\n transitionTimingFunction?: string;\n}\n\nconst parseTabList = (children: React.ReactNode): TabProps[] => {\n return toArray(children).map((node: React.ReactElement<TabProps>) => {\n if (React.isValidElement(node)) {\n const key = node.key !== undefined ? String(node.key) : undefined;\n return {\n key,\n ...node.props,\n node,\n };\n }\n return null;\n });\n};\n\nexport function Tabs({\n children,\n name,\n variant = 'pills',\n activeKey,\n defaultActiveKey,\n onTabChange,\n color,\n grow,\n radius = 'lg',\n size = 'sm',\n position = 'left',\n direction = 'horizontal',\n tabPadding = 'xs',\n transitionDuration = 150,\n transitionTimingFunction,\n ...others\n}: TabsProps) {\n const [shouldAnimate, setShouldAnimate] = useState(false);\n const tabs = parseTabList(children);\n\n const [_activeKey, handleActiveTabChange] = useUncontrolled({\n value: activeKey,\n defaultValue: defaultActiveKey,\n finalValue: findDefaultTab(tabs),\n onChange: onTabChange,\n rule: (val) => !!val,\n });\n\n const [activePosition, setActivePosition] = useState({\n width: 0,\n height: 0,\n translate: 0,\n translateY: 0,\n });\n const uuid = useId(name);\n const reduceMotion = useReducedMotion();\n const refs = useRef<Record<string, HTMLLabelElement>>({});\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (variant === 'outline') return null;\n const observer = new ResizeObserver(() => {\n if (_activeKey in refs.current && wrapperRef.current) {\n const element = refs.current[_activeKey];\n const rect = element.getBoundingClientRect();\n setActivePosition({\n width: rect.width,\n height: rect.height,\n translate: rect.x - wrapperRef.current.getBoundingClientRect().x - WRAPPER_PADDING,\n translateY: rect.y - wrapperRef.current.getBoundingClientRect().y - WRAPPER_PADDING,\n });\n\n if (!shouldAnimate) {\n setTimeout(() => {\n setShouldAnimate(true);\n }, 4);\n }\n }\n });\n observer.observe(wrapperRef.current);\n return () => observer.disconnect();\n }, [_activeKey]);\n\n const items = tabs.map((item) => {\n const { key, label } = item;\n const isActive = _activeKey === key;\n return (\n <TabControl\n key={key}\n active={isActive}\n radius={radius}\n size={size}\n reduceMotion={reduceMotion || !shouldAnimate}\n transitionTimingFunction={transitionTimingFunction}\n transitionDuration={transitionDuration}\n className={cx('tab-item', { 'tab-item__active': isActive })}\n >\n <TabControlLabel\n active={isActive}\n htmlFor={`${uuid}-${key}`}\n ref={(node) => {\n refs.current[key] = node;\n }}\n onClick={() => handleActiveTabChange(key)}\n >\n {label}\n </TabControlLabel>\n </TabControl>\n );\n });\n\n return (\n <TabsContainer variant={variant} direction={direction} position={position} {...others}>\n <TabControlList\n variant={variant}\n fullWidth={grow}\n radius={radius}\n size={size}\n position={position}\n direction={direction}\n ref={wrapperRef}\n >\n {!!_activeKey &&\n variant !== 'outline' &&\n (variant === 'pills' ? (\n <PillsBg\n variant={variant}\n radius={radius}\n color={color}\n width={activePosition.width}\n transform={activePosition.translate}\n />\n ) : (\n <LineBg\n variant={variant}\n radius={radius}\n color={color}\n direction={direction}\n position={position}\n width={activePosition.width}\n height={activePosition.height}\n transform={activePosition.translate}\n translateY={activePosition.translateY}\n />\n ))}\n <Group\n grow={grow}\n spacing={0}\n position={position}\n direction={directionMapping[direction] as GroupDirection}\n className=\"tab-group\"\n >\n {items}\n </Group>\n </TabControlList>\n\n <TabPanel direction={direction} position={position} variant={variant} tabPadding={tabPadding}>\n {tabs.map((tab) => {\n if (tab.key === _activeKey) {\n return tab.children;\n }\n return null;\n })}\n </TabPanel>\n </TabsContainer>\n );\n}\n\nTabs.displayName = '@kubed/components/Tabs';\n"],"names":["React"],"mappings":";;;;;;;AAAA,IAAI,SAAS,GAA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OAAO;AACX,IAAI,MAAM;AACV,IAAI,KAAK;AACT,IAAI,SAAS;AACb,IAAI,QAAQ;AACZ,IAAI,KAAK,EAAE,cAAc,CAAC,KAAK;AAC/B,IAAI,MAAM,EAAE,cAAc,CAAC,MAAM;AACjC,IAAI,SAAS,EAAE,cAAc,CAAC,SAAS;AACvC,IAAI,UAAU,EAAE,cAAc,CAAC,UAAU;AACzC,GAAG,CAAC,CAAC,kBAAkBA,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AAClD,IAAI,IAAI;AACR,IAAI,OAAO,EAAE,CAAC;AACd,IAAI,QAAQ;AACZ,IAAI,SAAS,EAAE,gBAAgB,CAAC,SAAS,CAAC;AAC1C,IAAI,SAAS,EAAE,WAAW;AAC1B,GAAG,EAAE,KAAK,CAAC,CAAC,kBAAkBA,cAAK,CAAC,aAAa,CAAC,QAAQ,EAAE;AAC5D,IAAI,SAAS;AACb,IAAI,QAAQ;AACZ,IAAI,OAAO;AACX,IAAI,UAAU;AACd,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK;AACvB,IAAI,IAAI,GAAG,CAAC,GAAG,KAAK,UAAU,EAAE;AAChC,MAAM,OAAO,GAAG,CAAC,QAAQ,CAAC;AAC1B,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AACD,IAAI,CAAC,WAAW,GAAG,wBAAwB;;;;"}
|
|
1
|
+
{"version":3,"file":"Tabs.js","sources":["../../src/Tabs/Tabs.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport cx from 'classnames';\nimport { useId, useUncontrolled, useReducedMotion } from '@kubed/hooks';\nimport { KubedNumberSize, KubedSizes } from '../theme';\nimport { Group, GroupPosition, GroupDirection } from '../Group/Group';\nimport { Tab, TabProps } from './Tab/Tab';\nimport toArray from '../utils/toArray';\n\nimport {\n TabsContainer,\n TabControlList,\n TabControl,\n TabControlLabel,\n TabPanel,\n WRAPPER_PADDING,\n PillsBg,\n LineBg,\n} from './Tabs.styles';\n\nexport { Tab };\nexport type { TabProps };\n\nconst directionMapping = {\n horizontal: 'row',\n vertical: 'column',\n};\n\nconst findDefaultTab = (tabs: TabProps[]) => {\n for (let i = 0; i < tabs.length; i += 1) {\n if (!tabs[i].disabled) {\n return tabs[i].key;\n }\n }\n\n return -1;\n};\n\nexport interface TabsProps\n extends Omit<React.ComponentPropsWithoutRef<'div'>, 'value' | 'onChange'> {\n /** Current selected value */\n variant?: 'pills' | 'line' | 'outline';\n\n /** Current selected value */\n activeKey?: string;\n\n /** Default value for uncontrolled component */\n defaultActiveKey?: string;\n\n /** Called when value changes */\n onChange?(value: string): void;\n\n /** Name of the radio group, default to random id */\n name?: string;\n\n /** True if component should have 100% width */\n grow?: boolean;\n\n /** Active control color from theme, defaults to white in light color scheme and theme.colors.dark[9] in dark */\n color?: string | 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error';\n\n /** Controls font-size, paddings and height */\n size?: KubedSizes;\n\n /** Border-radius from theme or number to set border-radius in px */\n radius?: KubedNumberSize;\n\n /** Tab controls position */\n position?: GroupPosition;\n\n /** Tab controls direction */\n direction?: 'horizontal' | 'vertical';\n\n /** Controls tab content padding-top */\n tabPadding?: KubedNumberSize;\n\n /** Called when tab control is clicked with tab index */\n onTabChange?(tabKey: string): void;\n\n /** Transition duration in ms, set to 0 to turn off transitions */\n transitionDuration?: number;\n\n /** Transition timing function for all transitions, defaults to theme.transitionTimingFunction */\n transitionTimingFunction?: string;\n}\n\nconst parseTabList = (children: React.ReactNode): TabProps[] => {\n return toArray(children).map((node: React.ReactElement<TabProps>) => {\n if (React.isValidElement(node)) {\n const key = node.key !== undefined ? String(node.key) : undefined;\n return {\n key,\n ...node.props,\n node,\n };\n }\n return null;\n });\n};\n\nexport function Tabs({\n children,\n name,\n variant = 'pills',\n activeKey,\n defaultActiveKey,\n onTabChange,\n color,\n grow,\n radius = 'lg',\n size = 'sm',\n position = 'left',\n direction = 'horizontal',\n tabPadding = 'xs',\n transitionDuration = 150,\n transitionTimingFunction,\n ...others\n}: TabsProps) {\n const [shouldAnimate, setShouldAnimate] = useState(false);\n const tabs = parseTabList(children);\n\n const [_activeKey, handleActiveTabChange] = useUncontrolled({\n value: activeKey,\n defaultValue: defaultActiveKey,\n finalValue: findDefaultTab(tabs),\n onChange: onTabChange,\n rule: (val) => !!val,\n });\n\n const [activePosition, setActivePosition] = useState({\n width: 0,\n height: 0,\n translate: 0,\n translateY: 0,\n });\n const uuid = useId(name);\n const reduceMotion = useReducedMotion();\n const refs = useRef<Record<string, HTMLLabelElement>>({});\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (variant === 'outline') return null;\n const observer = new ResizeObserver(() => {\n if (_activeKey in refs.current && wrapperRef.current) {\n const element = refs.current[_activeKey];\n const rect = element.getBoundingClientRect();\n setActivePosition({\n width: rect.width,\n height: rect.height,\n translate: rect.x - wrapperRef.current.getBoundingClientRect().x - WRAPPER_PADDING,\n translateY: rect.y - wrapperRef.current.getBoundingClientRect().y - WRAPPER_PADDING,\n });\n\n if (!shouldAnimate) {\n setTimeout(() => {\n setShouldAnimate(true);\n }, 4);\n }\n }\n });\n observer.observe(wrapperRef.current);\n return () => observer.disconnect();\n }, [_activeKey]);\n\n const items = tabs.map((item) => {\n const { key, label } = item;\n const isActive = _activeKey === key;\n return (\n <TabControl\n key={key}\n active={isActive}\n radius={radius}\n size={size}\n reduceMotion={reduceMotion || !shouldAnimate}\n transitionTimingFunction={transitionTimingFunction}\n transitionDuration={transitionDuration}\n className={cx('tab-item', { 'tab-item__active': isActive })}\n >\n <TabControlLabel\n active={isActive}\n htmlFor={`${uuid}-${key}`}\n ref={(node) => {\n refs.current[key] = node;\n }}\n onClick={() => handleActiveTabChange(key)}\n className=\"tab-label\"\n >\n {label}\n </TabControlLabel>\n </TabControl>\n );\n });\n\n return (\n <TabsContainer variant={variant} direction={direction} position={position} {...others}>\n <TabControlList\n variant={variant}\n fullWidth={grow}\n radius={radius}\n size={size}\n position={position}\n direction={direction}\n color={color}\n ref={wrapperRef}\n >\n {!!_activeKey &&\n variant !== 'outline' &&\n (variant === 'pills' ? (\n <PillsBg\n variant={variant}\n radius={radius}\n color={color}\n width={activePosition.width}\n transform={activePosition.translate}\n />\n ) : (\n <LineBg\n variant={variant}\n radius={radius}\n color={color}\n direction={direction}\n position={position}\n width={activePosition.width}\n height={activePosition.height}\n transform={activePosition.translate}\n translateY={activePosition.translateY}\n className=\"line-bg\"\n />\n ))}\n <Group\n grow={grow}\n spacing={0}\n position={position}\n direction={directionMapping[direction] as GroupDirection}\n className=\"tab-group\"\n >\n {items}\n </Group>\n </TabControlList>\n\n <TabPanel direction={direction} position={position} variant={variant} tabPadding={tabPadding}>\n {tabs.map((tab) => {\n if (tab.key === _activeKey) {\n return tab.children;\n }\n return null;\n })}\n </TabPanel>\n </TabsContainer>\n );\n}\n\nTabs.displayName = '@kubed/components/Tabs';\n"],"names":["React"],"mappings":";;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,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AAC,kBAAkBA,cAAK,CAAC,aAAa,CAAC,QAAQ,EAAE;AAC5D,IAAI,SAAS;AACb,IAAI,QAAQ;AACZ,IAAI,OAAO;AACX,IAAI,UAAU;AACd,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK;AACvB,IAAI,IAAI,GAAG,CAAC,GAAG,KAAK,UAAU,EAAE;AAChC,MAAM,OAAO,GAAG,CAAC,QAAQ,CAAC;AAC1B,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AACD,IAAI,CAAC,WAAW,GAAG,wBAAwB;;;;"}
|
package/esm/Tabs/Tabs.styles.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import l,{css as n}from"styled-components";import p from"../theme/utils.js";const{getSizeValue:d}=p,c=0,b={xs:{fontSize:"10px",height:"26px"},sm:{fontSize:"12px",height:"28px"},md:{fontSize:"14px",height:"36px"},lg:{fontSize:"16px",height:"48px"},xl:{fontSize:"18px",height:"56px"}},x=(t,r)=>{const{palette:e}=r;return e[t]?e[t]:e.colors[t]?e.colors[t][2]:e.accents_7},f=(t,r,e,i)=>{const o=`1px solid ${r.palette.border}`;if(e==="vertical"){if(i==="left")return n`
|
|
2
2
|
border-right: ${o};
|
|
3
3
|
|
|
4
4
|
.tab-item {
|
|
@@ -32,7 +32,7 @@ import s,{css as n}from"styled-components";import g from"../theme/utils.js";cons
|
|
|
32
32
|
width: 100%;
|
|
33
33
|
margin-bottom: -1px;
|
|
34
34
|
}
|
|
35
|
-
`},
|
|
35
|
+
`},u=(t,r,e,i)=>{const o=`1px solid ${r.palette.border}`;if(e==="vertical"){if(i==="left")return n`
|
|
36
36
|
border-right: ${o};
|
|
37
37
|
|
|
38
38
|
.tab-item {
|
|
@@ -59,11 +59,11 @@ import s,{css as n}from"styled-components";import g from"../theme/utils.js";cons
|
|
|
59
59
|
.tab-group {
|
|
60
60
|
width: 100%;
|
|
61
61
|
}
|
|
62
|
-
`},
|
|
62
|
+
`},h=(t,r,e,i,o,a)=>{const{palette:s,layout:g}=r;return t==="pills"?n`
|
|
63
63
|
padding: 1px;
|
|
64
|
-
border-radius: ${
|
|
65
|
-
background-color: ${
|
|
66
|
-
border: 1px solid ${
|
|
64
|
+
border-radius: ${d(e,g.radius)};
|
|
65
|
+
background-color: ${s.accents_0};
|
|
66
|
+
border: 1px solid ${s.border};
|
|
67
67
|
|
|
68
68
|
.tab-item {
|
|
69
69
|
font-weight: 500;
|
|
@@ -72,11 +72,11 @@ import s,{css as n}from"styled-components";import g from"../theme/utils.js";cons
|
|
|
72
72
|
|
|
73
73
|
.tab-item__active {
|
|
74
74
|
label {
|
|
75
|
-
color: ${
|
|
75
|
+
color: ${s.background};
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
`:t==="outline"?n`
|
|
79
|
-
${
|
|
79
|
+
${f(t,r,i,o)};
|
|
80
80
|
|
|
81
81
|
.tab-item {
|
|
82
82
|
padding: 0 15px;
|
|
@@ -89,14 +89,14 @@ import s,{css as n}from"styled-components";import g from"../theme/utils.js";cons
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
.tab-item__active {
|
|
92
|
-
background-color: ${
|
|
93
|
-
border-color: ${
|
|
92
|
+
background-color: ${s.background};
|
|
93
|
+
border-color: ${s.border};
|
|
94
94
|
label {
|
|
95
|
-
color: ${
|
|
95
|
+
color: ${s.accents_8};
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
`:n`
|
|
99
|
-
${
|
|
99
|
+
${u(t,r,i,o)};
|
|
100
100
|
|
|
101
101
|
.tab-item {
|
|
102
102
|
&:first-of-type {
|
|
@@ -106,21 +106,21 @@ import s,{css as n}from"styled-components";import g from"../theme/utils.js";cons
|
|
|
106
106
|
|
|
107
107
|
.tab-item__active {
|
|
108
108
|
label {
|
|
109
|
-
color: ${a.
|
|
109
|
+
color: ${a?p.getColor(a,r):s.accents_7};
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
`},m=(t,r,e,i)=>{const o=
|
|
112
|
+
`},m=(t,r,e,i)=>{const o=d(e,i.layout.spacing);return t==="horizontal"?n`
|
|
113
113
|
padding-top: ${o};
|
|
114
114
|
`:n`
|
|
115
115
|
padding-${r}: ${o};
|
|
116
|
-
`}
|
|
116
|
+
`},$=l("div")`
|
|
117
117
|
position: relative;
|
|
118
118
|
box-sizing: border-box;
|
|
119
119
|
flex: 1;
|
|
120
120
|
z-index: 2;
|
|
121
|
-
line-height: ${({size:t})=>
|
|
121
|
+
line-height: ${({size:t})=>b[t].height};
|
|
122
122
|
transition: ${({reduceMotion:t,transitionDuration:r,transitionTimingFunction:e})=>`border-left-color ${t?0:r}ms ${e||"cubic-bezier(.51,.3,0,1.21)"}`};
|
|
123
|
-
|
|
123
|
+
`,w=l("label")`
|
|
124
124
|
display: block;
|
|
125
125
|
cursor: pointer;
|
|
126
126
|
text-overflow: ellipsis;
|
|
@@ -129,31 +129,31 @@ import s,{css as n}from"styled-components";import g from"../theme/utils.js";cons
|
|
|
129
129
|
white-space: nowrap;
|
|
130
130
|
-webkit-tap-highlight-color: transparent;
|
|
131
131
|
transition: color 150ms ease 0s;
|
|
132
|
-
`,
|
|
132
|
+
`,z=l("div")`
|
|
133
133
|
position: relative;
|
|
134
134
|
display: ${({direction:t})=>t==="vertical"?"flex":"block"};
|
|
135
135
|
${({direction:t,position:r})=>t==="vertical"&&r==="right"?"flex-direction: row-reverse":null};
|
|
136
|
-
`,
|
|
136
|
+
`,v=l("div")`
|
|
137
137
|
position: relative;
|
|
138
138
|
display: ${({fullWidth:t,variant:r})=>t||r!=="pills"?"flex":"inline-flex"};
|
|
139
|
-
font-size: ${({size:t})=>
|
|
139
|
+
font-size: ${({size:t})=>b[t].fontSize};
|
|
140
140
|
align-items: center;
|
|
141
|
-
${({variant:t,theme:r,radius:e,direction:i,position:o})=>
|
|
142
|
-
`,
|
|
141
|
+
${({variant:t,theme:r,radius:e,direction:i,position:o,color:a})=>h(t,r,e,i,o,a)};
|
|
142
|
+
`,y=l("div")`
|
|
143
143
|
display: block;
|
|
144
144
|
${({direction:t,position:r,tabPadding:e,theme:i})=>m(t,r,e,i)};
|
|
145
|
-
`,
|
|
146
|
-
border-radius: ${({radius:t,theme:r})=>
|
|
145
|
+
`,_=l("span")`
|
|
146
|
+
border-radius: ${({radius:t,theme:r})=>d(t,r.layout.radius)};
|
|
147
147
|
position: absolute;
|
|
148
148
|
box-sizing: border-box;
|
|
149
149
|
top: 1px;
|
|
150
150
|
bottom: 1px;
|
|
151
151
|
z-index: 1;
|
|
152
|
-
background-color: ${({theme:t,color:r})=>
|
|
152
|
+
background-color: ${({theme:t,color:r})=>x(r,t)};
|
|
153
153
|
width: ${({width:t})=>t}px;
|
|
154
154
|
transform: translateX(${({transform:t})=>t}px);
|
|
155
155
|
transition: transform 150ms ease 0s, width 100ms linear 0s;
|
|
156
|
-
`,
|
|
156
|
+
`,k=(t,r,e,i,o,a)=>e==="vertical"?n`
|
|
157
157
|
width: 2px;
|
|
158
158
|
height: ${r}px;
|
|
159
159
|
transform: translateY(${a}px);
|
|
@@ -167,12 +167,12 @@ margin-right: -1px;`};
|
|
|
167
167
|
transform: translateX(${o}px);
|
|
168
168
|
bottom: 0;
|
|
169
169
|
margin-bottom: -1px;
|
|
170
|
-
`,
|
|
170
|
+
`,C=l("span")`
|
|
171
171
|
position: absolute;
|
|
172
172
|
box-sizing: border-box;
|
|
173
173
|
z-index: 1;
|
|
174
|
-
background-color: ${({theme:t,color:r})=>
|
|
174
|
+
background-color: ${({theme:t,color:r})=>r?p.getColor(r,t):t.palette.accents_7};
|
|
175
175
|
transition: transform 150ms ease 0s, width 100ms linear 0s;
|
|
176
|
-
${({width:t,height:r,direction:e,position:i,transform:o,translateY:a})=>
|
|
177
|
-
`;export{
|
|
176
|
+
${({width:t,height:r,direction:e,position:i,transform:o,translateY:a})=>k(t,r,e,i,o,a)};
|
|
177
|
+
`;export{C as LineBg,_ as PillsBg,$ as TabControl,w as TabControlLabel,v as TabControlList,y as TabPanel,z as TabsContainer,c as WRAPPER_PADDING};
|
|
178
178
|
//# sourceMappingURL=Tabs.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.styles.js","sources":["../../src/Tabs/Tabs.styles.ts"],"sourcesContent":["import React from 'react';\nimport styled, { css } from 'styled-components';\nimport { KubedNumberSize, KubedSizes, KubedTheme, themeUtils } from '../theme';\n\nconst { getSizeValue } = themeUtils;\n\nexport const WRAPPER_PADDING = 2;\n\nconst sizes = {\n xs: {\n fontSize: '10px',\n height: '26px',\n },\n sm: {\n fontSize: '12px',\n height: '28px',\n },\n md: {\n fontSize: '14px',\n height: '36px',\n },\n lg: {\n fontSize: '16px',\n height: '48px',\n },\n xl: {\n fontSize: '18px',\n height: '56px',\n },\n};\n\nconst getColor = (color, theme: KubedTheme) => {\n const { palette } = theme;\n if (palette[color]) {\n return palette[color];\n }\n if (palette.colors[color]) {\n return palette.colors[color][2];\n }\n return palette.accents_7;\n};\n\nconst getOutlineControlBorder = (variant, theme: KubedTheme, direction, position) => {\n const border = `1px solid ${theme.palette.border}`;\n if (direction === 'vertical') {\n if (position === 'left') {\n return css`\n border-right: ${border};\n\n .tab-item {\n width: 100%;\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n border-width: 1px 0 1px 1px;\n }\n .tab-group {\n margin-right: -1px;\n }\n `;\n }\n if (position === 'right') {\n return css`\n border-left: ${border};\n .tab-item {\n width: 100%;\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n border-width: 1px 1px 1px 0;\n }\n .tab-group {\n margin-left: -1px;\n }\n `;\n }\n }\n return css`\n border-bottom: ${border};\n .tab-item {\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n border-width: 1px 1px 0;\n }\n .tab-group {\n width: 100%;\n margin-bottom: -1px;\n }\n `;\n};\n\nconst getLineControlBorder = (variant, theme: KubedTheme, direction, position) => {\n const border = `1px solid ${theme.palette.border}`;\n if (direction === 'vertical') {\n if (position === 'left') {\n return css`\n border-right: ${border};\n\n .tab-item {\n padding: 0 15px;\n width: 100%;\n }\n .tab-group {\n margin-right: -1px;\n }\n `;\n }\n if (position === 'right') {\n return css`\n border-left: ${border};\n .tab-item {\n padding: 0 15px;\n width: 100%;\n }\n .tab-group {\n margin-left: -1px;\n }\n `;\n }\n }\n return css`\n border-bottom: ${border};\n .tab-item {\n margin: 0 15px;\n }\n .tab-group {\n width: 100%;\n }\n `;\n};\n\nconst getContainerStyles = (variant, theme: KubedTheme, radius, direction, position) => {\n const { palette, layout } = theme;\n if (variant === 'pills') {\n return css`\n padding: 1px;\n border-radius: ${getSizeValue(radius, layout.radius)};\n background-color: ${palette.accents_0};\n border: 1px solid ${palette.border};\n\n .tab-item {\n font-weight: 500;\n min-width: 117px;\n }\n\n .tab-item__active {\n label {\n color: ${palette.background};\n }\n }\n `;\n }\n if (variant === 'outline') {\n return css`\n ${getOutlineControlBorder(variant, theme, direction, position)};\n\n .tab-item {\n padding: 0 15px;\n background-color: transparent;\n border-style: solid;\n border-color: transparent;\n &:first-of-type {\n margin-left: 0;\n }\n }\n\n .tab-item__active {\n background-color: ${palette.background};\n border-color: ${palette.border};\n label {\n color: ${palette.accents_8};\n }\n }\n `;\n }\n\n return css`\n ${getLineControlBorder(variant, theme, direction, position)};\n\n .tab-item {\n &:first-of-type {\n margin-left: 0;\n }\n }\n\n .tab-item__active {\n label {\n color: ${palette.accents_8};\n }\n }\n `;\n};\n\ninterface TabsStyles extends React.ComponentPropsWithoutRef<any> {\n theme?: KubedTheme;\n fullWidth?: boolean;\n color?: string;\n radius?: KubedNumberSize;\n reduceMotion?: boolean;\n transitionDuration?: number;\n transitionTimingFunction?: string;\n size?: KubedSizes;\n direction?: 'horizontal' | 'vertical';\n variant?: 'pills' | 'line' | 'outline';\n active?: boolean;\n}\n\nconst getPanelPadding = (direction, position, tabPadding, theme) => {\n const padding = getSizeValue(tabPadding, theme.layout.spacing);\n if (direction === 'horizontal') {\n return css`\n padding-top: ${padding};\n `;\n }\n return css`\n padding-${position}: ${padding};\n `;\n};\n\nexport const TabControl = styled('div')<TabsStyles>`\n position: relative;\n box-sizing: border-box;\n flex: 1;\n z-index: 2;\n line-height: ${({ size }) => sizes[size].height};\n transition: ${({ reduceMotion, transitionDuration, transitionTimingFunction }) =>\n `border-left-color ${reduceMotion ? 0 : transitionDuration}ms ${\n transitionTimingFunction || 'cubic-bezier(.51,.3,0,1.21)'\n }`};\n`;\n\nexport const TabControlLabel = styled('label')<TabsStyles>`\n display: block;\n cursor: pointer;\n text-overflow: ellipsis;\n text-align: center;\n color: ${({ theme }) => theme.palette.accents_7};\n white-space: nowrap;\n -webkit-tap-highlight-color: transparent;\n transition: color 150ms ease 0s;\n`;\n\nexport const TabsContainer = styled('div')<TabsStyles>`\n position: relative;\n display: ${({ direction }) => (direction === 'vertical' ? 'flex' : 'block')};\n ${({ direction, position }) =>\n direction === 'vertical' && position === 'right' ? 'flex-direction: row-reverse' : null};\n`;\n\nexport const TabControlList = styled('div')<TabsStyles>`\n position: relative;\n display: ${({ fullWidth, variant }) =>\n fullWidth || variant !== 'pills' ? 'flex' : 'inline-flex'};\n font-size: ${({ size }) => sizes[size].fontSize};\n align-items: center;\n ${({ variant, theme, radius, direction, position }) =>\n getContainerStyles(variant, theme, radius, direction, position)};\n`;\n\nexport const TabPanel = styled('div')<TabsStyles>`\n display: block;\n ${({ direction, position, tabPadding, theme }) =>\n getPanelPadding(direction, position, tabPadding, theme)};\n`;\n\ninterface BgSpanStyles extends React.ComponentPropsWithoutRef<any> {}\n\nexport const PillsBg = styled('span')<BgSpanStyles>`\n border-radius: ${({ radius, theme }) => getSizeValue(radius, theme.layout.radius)};\n position: absolute;\n box-sizing: border-box;\n top: 1px;\n bottom: 1px;\n z-index: 1;\n background-color: ${({ theme, color }) => getColor(color, theme)};\n width: ${({ width }) => width}px;\n transform: translateX(${({ transform }) => transform}px);\n transition: transform 150ms ease 0s, width 100ms linear 0s;\n`;\n\nconst getLineBgStyles = (width, height, direction, position, translate, translateY) => {\n if (direction === 'vertical') {\n return css`\n width: 2px;\n height: ${height}px;\n transform: translateY(${translateY}px);\n top: 0;\n ${position === 'right' ? 'left: 0;\\nmargin-left: -1px;' : 'right: 0;\\nmargin-right: -1px;'};\n `;\n }\n\n return css`\n height: 2px;\n width: ${width}px;\n transform: translateX(${translate}px);\n bottom: 0;\n margin-bottom: -1px;\n `;\n};\n\nexport const LineBg = styled('span')<BgSpanStyles>`\n position: absolute;\n box-sizing: border-box;\n z-index: 1;\n background-color: ${({ theme, color }) => getColor(color, theme)};\n transition: transform 150ms ease 0s, width 100ms linear 0s;\n ${({ width, height, direction, position, transform, translateY }) =>\n getLineBgStyles(width, height, direction, position, transform, translateY)};\n`;\n"],"names":[],"mappings":";;;AAEA,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC;AACxB,MAAC,eAAe,GAAG,EAAE;AACjC,MAAM,KAAK,GAAG;AACd,EAAE,EAAE,EAAE;AACN,IAAI,QAAQ,EAAE,MAAM;AACpB,IAAI,MAAM,EAAE,MAAM;AAClB,GAAG;AACH,EAAE,EAAE,EAAE;AACN,IAAI,QAAQ,EAAE,MAAM;AACpB,IAAI,MAAM,EAAE,MAAM;AAClB,GAAG;AACH,EAAE,EAAE,EAAE;AACN,IAAI,QAAQ,EAAE,MAAM;AACpB,IAAI,MAAM,EAAE,MAAM;AAClB,GAAG;AACH,EAAE,EAAE,EAAE;AACN,IAAI,QAAQ,EAAE,MAAM;AACpB,IAAI,MAAM,EAAE,MAAM;AAClB,GAAG;AACH,EAAE,EAAE,EAAE;AACN,IAAI,QAAQ,EAAE,MAAM;AACpB,IAAI,MAAM,EAAE,MAAM;AAClB,GAAG;AACH,CAAC,CAAC;AACF,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK;AACnC,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,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E,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAClJ;;;;"}
|
|
1
|
+
{"version":3,"file":"Tabs.styles.js","sources":["../../src/Tabs/Tabs.styles.ts"],"sourcesContent":["import React from 'react';\nimport styled, { css } from 'styled-components';\nimport { KubedNumberSize, KubedSizes, KubedTheme, themeUtils } from '../theme';\n\nconst { getSizeValue } = themeUtils;\n\nexport const WRAPPER_PADDING = 0;\n\nconst sizes = {\n xs: {\n fontSize: '10px',\n height: '26px',\n },\n sm: {\n fontSize: '12px',\n height: '28px',\n },\n md: {\n fontSize: '14px',\n height: '36px',\n },\n lg: {\n fontSize: '16px',\n height: '48px',\n },\n xl: {\n fontSize: '18px',\n height: '56px',\n },\n};\n\nconst getColor = (color, theme: KubedTheme) => {\n const { palette } = theme;\n if (palette[color]) {\n return palette[color];\n }\n if (palette.colors[color]) {\n return palette.colors[color][2];\n }\n return palette.accents_7;\n};\n\nconst getOutlineControlBorder = (variant, theme: KubedTheme, direction, position) => {\n const border = `1px solid ${theme.palette.border}`;\n if (direction === 'vertical') {\n if (position === 'left') {\n return css`\n border-right: ${border};\n\n .tab-item {\n width: 100%;\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n border-width: 1px 0 1px 1px;\n }\n .tab-group {\n margin-right: -1px;\n }\n `;\n }\n if (position === 'right') {\n return css`\n border-left: ${border};\n .tab-item {\n width: 100%;\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n border-width: 1px 1px 1px 0;\n }\n .tab-group {\n margin-left: -1px;\n }\n `;\n }\n }\n return css`\n border-bottom: ${border};\n .tab-item {\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n border-width: 1px 1px 0;\n }\n .tab-group {\n width: 100%;\n margin-bottom: -1px;\n }\n `;\n};\n\nconst getLineControlBorder = (variant, theme: KubedTheme, direction, position) => {\n const border = `1px solid ${theme.palette.border}`;\n if (direction === 'vertical') {\n if (position === 'left') {\n return css`\n border-right: ${border};\n\n .tab-item {\n padding: 0 15px;\n width: 100%;\n }\n .tab-group {\n margin-right: -1px;\n }\n `;\n }\n if (position === 'right') {\n return css`\n border-left: ${border};\n .tab-item {\n padding: 0 15px;\n width: 100%;\n }\n .tab-group {\n margin-left: -1px;\n }\n `;\n }\n }\n return css`\n border-bottom: ${border};\n .tab-item {\n margin: 0 15px;\n }\n .tab-group {\n width: 100%;\n }\n `;\n};\n\nconst getContainerStyles = (variant, theme: KubedTheme, radius, direction, position, color) => {\n const { palette, layout } = theme;\n\n if (variant === 'pills') {\n return css`\n padding: 1px;\n border-radius: ${getSizeValue(radius, layout.radius)};\n background-color: ${palette.accents_0};\n border: 1px solid ${palette.border};\n\n .tab-item {\n font-weight: 500;\n min-width: 117px;\n }\n\n .tab-item__active {\n label {\n color: ${palette.background};\n }\n }\n `;\n }\n if (variant === 'outline') {\n return css`\n ${getOutlineControlBorder(variant, theme, direction, position)};\n\n .tab-item {\n padding: 0 15px;\n background-color: transparent;\n border-style: solid;\n border-color: transparent;\n &:first-of-type {\n margin-left: 0;\n }\n }\n\n .tab-item__active {\n background-color: ${palette.background};\n border-color: ${palette.border};\n label {\n color: ${palette.accents_8};\n }\n }\n `;\n }\n\n return css`\n ${getLineControlBorder(variant, theme, direction, position)};\n\n .tab-item {\n &:first-of-type {\n margin-left: 0;\n }\n }\n\n .tab-item__active {\n label {\n color: ${color ? themeUtils.getColor(color, theme) : palette.accents_7};\n }\n }\n `;\n};\n\ninterface TabsStyles extends React.ComponentPropsWithoutRef<any> {\n theme?: KubedTheme;\n fullWidth?: boolean;\n color?: string;\n radius?: KubedNumberSize;\n reduceMotion?: boolean;\n transitionDuration?: number;\n transitionTimingFunction?: string;\n size?: KubedSizes;\n direction?: 'horizontal' | 'vertical';\n variant?: 'pills' | 'line' | 'outline';\n active?: boolean;\n}\n\nconst getPanelPadding = (direction, position, tabPadding, theme) => {\n const padding = getSizeValue(tabPadding, theme.layout.spacing);\n if (direction === 'horizontal') {\n return css`\n padding-top: ${padding};\n `;\n }\n return css`\n padding-${position}: ${padding};\n `;\n};\n\nexport const TabControl = styled('div')<TabsStyles>`\n position: relative;\n box-sizing: border-box;\n flex: 1;\n z-index: 2;\n line-height: ${({ size }) => sizes[size].height};\n transition: ${({ reduceMotion, transitionDuration, transitionTimingFunction }) =>\n `border-left-color ${reduceMotion ? 0 : transitionDuration}ms ${\n transitionTimingFunction || 'cubic-bezier(.51,.3,0,1.21)'\n }`};\n`;\n\nexport const TabControlLabel = styled('label')<TabsStyles>`\n display: block;\n cursor: pointer;\n text-overflow: ellipsis;\n text-align: center;\n color: ${({ theme }) => theme.palette.accents_7};\n white-space: nowrap;\n -webkit-tap-highlight-color: transparent;\n transition: color 150ms ease 0s;\n`;\n\nexport const TabsContainer = styled('div')<TabsStyles>`\n position: relative;\n display: ${({ direction }) => (direction === 'vertical' ? 'flex' : 'block')};\n ${({ direction, position }) =>\n direction === 'vertical' && position === 'right' ? 'flex-direction: row-reverse' : null};\n`;\n\nexport const TabControlList = styled('div')<TabsStyles>`\n position: relative;\n display: ${({ fullWidth, variant }) =>\n fullWidth || variant !== 'pills' ? 'flex' : 'inline-flex'};\n font-size: ${({ size }) => sizes[size].fontSize};\n align-items: center;\n ${({ variant, theme, radius, direction, position, color }) =>\n getContainerStyles(variant, theme, radius, direction, position, color)};\n`;\n\nexport const TabPanel = styled('div')<TabsStyles>`\n display: block;\n ${({ direction, position, tabPadding, theme }) =>\n getPanelPadding(direction, position, tabPadding, theme)};\n`;\n\ninterface BgSpanStyles extends React.ComponentPropsWithoutRef<any> {}\n\nexport const PillsBg = styled('span')<BgSpanStyles>`\n border-radius: ${({ radius, theme }) => getSizeValue(radius, theme.layout.radius)};\n position: absolute;\n box-sizing: border-box;\n top: 1px;\n bottom: 1px;\n z-index: 1;\n background-color: ${({ theme, color }) => getColor(color, theme)};\n width: ${({ width }) => width}px;\n transform: translateX(${({ transform }) => transform}px);\n transition: transform 150ms ease 0s, width 100ms linear 0s;\n`;\n\nconst getLineBgStyles = (width, height, direction, position, translate, translateY) => {\n if (direction === 'vertical') {\n return css`\n width: 2px;\n height: ${height}px;\n transform: translateY(${translateY}px);\n top: 0;\n ${position === 'right' ? 'left: 0;\\nmargin-left: -1px;' : 'right: 0;\\nmargin-right: -1px;'};\n `;\n }\n\n return css`\n height: 2px;\n width: ${width}px;\n transform: translateX(${translate}px);\n bottom: 0;\n margin-bottom: -1px;\n `;\n};\n\nexport const LineBg = styled('span')<BgSpanStyles>`\n position: absolute;\n box-sizing: border-box;\n z-index: 1;\n background-color: ${({ theme, color }) =>\n color ? themeUtils.getColor(color, theme) : theme.palette.accents_7};\n transition: transform 150ms ease 0s, width 100ms linear 0s;\n ${({ width, height, direction, position, transform, translateY }) =>\n getLineBgStyles(width, height, direction, position, transform, translateY)};\n`;\n"],"names":[],"mappings":";;;AAEA,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC;AACxB,MAAC,eAAe,GAAG,EAAE;AACjC,MAAM,KAAK,GAAG;AACd,EAAE,EAAE,EAAE;AACN,IAAI,QAAQ,EAAE,MAAM;AACpB,IAAI,MAAM,EAAE,MAAM;AAClB,GAAG;AACH,EAAE,EAAE,EAAE;AACN,IAAI,QAAQ,EAAE,MAAM;AACpB,IAAI,MAAM,EAAE,MAAM;AAClB,GAAG;AACH,EAAE,EAAE,EAAE;AACN,IAAI,QAAQ,EAAE,MAAM;AACpB,IAAI,MAAM,EAAE,MAAM;AAClB,GAAG;AACH,EAAE,EAAE,EAAE;AACN,IAAI,QAAQ,EAAE,MAAM;AACpB,IAAI,MAAM,EAAE,MAAM;AAClB,GAAG;AACH,EAAE,EAAE,EAAE;AACN,IAAI,QAAQ,EAAE,MAAM;AACpB,IAAI,MAAM,EAAE,MAAM;AAClB,GAAG;AACH,CAAC,CAAC;AACF,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,KAAK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AAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AAChH;AACA,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAClJ;;;;"}
|
package/esm/Tag/Tag.js
CHANGED
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
import
|
|
1
|
+
import c,{useState as P,useEffect as $}from"react";import u,{css as j}from"styled-components";import{Close as E}from"@kubed/icons";import S from"../utils/forwardRef.js";import{addColorAlpha as T}from"../utils/color.js";import s from"../theme/utils.js";var R=Object.defineProperty,a=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable,b=(e,r,o)=>r in e?R(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,V=(e,r)=>{for(var o in r||(r={}))f.call(r,o)&&b(e,o,r[o]);if(a)for(var o of a(r))g.call(r,o)&&b(e,o,r[o]);return e},N=(e,r)=>{var o={};for(var t in e)f.call(e,t)&&r.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&a)for(var t of a(e))r.indexOf(t)<0&&g.call(e,t)&&(o[t]=e[t]);return o};const m={default:{color:"background",background:"accents_8"},primary:{color:"green4",background:"green0"},success:{color:"green4",background:"green0"},secondary:{color:"accents_7",background:"accents_2"},warning:{color:"yellow4",background:"yellow0"},error:{color:"red4",background:"red0"},info:{color:"blue4",background:"blue0"}},I=(e="default",r)=>{const o=s.getColor(m[e].color,r),t=s.getColor(m[e].background,r);return j`
|
|
2
2
|
background-color: ${t};
|
|
3
3
|
color: ${o};
|
|
4
|
-
`},
|
|
4
|
+
`},z=u("div")`
|
|
5
5
|
display: inline-flex;
|
|
6
6
|
align-items: center;
|
|
7
|
-
padding: ${({title:
|
|
7
|
+
padding: ${({title:e})=>e?"0 6px 0 2px":"0 4px"};
|
|
8
8
|
line-height: 20px;
|
|
9
|
-
border-radius: ${({title:r})=>r?"3px":"2px"};
|
|
9
|
+
border-radius: ${({title:e,radius:r,theme:o})=>r?s.getSizeValue(r,o.layout.radius):e?"3px":"2px"};
|
|
10
10
|
word-break: break-all;
|
|
11
11
|
white-space: normal;
|
|
12
12
|
font-weight: 600;
|
|
13
|
-
${({color:
|
|
14
|
-
|
|
13
|
+
${({color:e,theme:r})=>I(e,r)};
|
|
14
|
+
|
|
15
|
+
.tag-close {
|
|
16
|
+
margin-left: 6px;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
border-radius: 3px;
|
|
19
|
+
&:hover {
|
|
20
|
+
background-color: ${({theme:e})=>T(e.palette.accents_6,.6)};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`,A=u("span")`
|
|
15
24
|
display: inline-flex;
|
|
16
25
|
padding: 0 6px;
|
|
17
26
|
margin: 2px 6px 2px 0;
|
|
18
27
|
line-height: 16px;
|
|
19
|
-
color: ${({theme:
|
|
20
|
-
background-color: ${({theme:
|
|
28
|
+
color: ${({theme:e})=>e.palette.background};
|
|
29
|
+
background-color: ${({theme:e})=>e.palette.accents_7};
|
|
21
30
|
border-radius: 1px;
|
|
22
31
|
font-weight: 500;
|
|
23
|
-
`,
|
|
32
|
+
`,v=S((e,r)=>{var o=e,{radius:t,title:n,titleStyle:_,color:y,onClose:d,children:x,prepend:k,append:h,closable:w}=o,l=N(o,["radius","title","titleStyle","color","onClose","children","prepend","append","closable"]);const[O,p]=P(!0);$(()=>{"visible"in l&&p(l.visible)},[l.visible]);const C=i=>{i.stopPropagation(),d==null||d(i),!i.defaultPrevented&&("visible"in l||p(!1))};return O?c.createElement(z,V({ref:r,radius:t,title:n,color:y},l),k,n&&c.createElement(A,{style:_},n),x,h,w&&c.createElement(E,{variant:"light",className:"tag-close",onClick:C})):null});v.displayName="@kubed/components/Tag";export{v as Tag};
|
|
24
33
|
//# sourceMappingURL=Tag.js.map
|
package/esm/Tag/Tag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","sources":["../../src/Tag/Tag.tsx"],"sourcesContent":["import React from 'react';\nimport styled, { css } from 'styled-components';\nimport forwardRef from '../utils/forwardRef';\nimport { DefaultProps, KubedTheme, themeUtils } from '../theme';\n\nconst colorMap = {\n default: {\n color: 'background',\n background: 'accents_8',\n },\n primary: {\n color: 'green4',\n background: 'green0',\n },\n success: {\n color: 'green4',\n background: 'green0',\n },\n secondary: {\n color: 'accents_7',\n background: 'accents_2',\n },\n warning: {\n color: 'yellow4',\n background: 'yellow0',\n },\n error: {\n color: 'red4',\n background: 'red0',\n },\n info: {\n color: 'blue4',\n background: 'blue0',\n },\n};\n\nconst getColor = (color = 'default', theme: KubedTheme) => {\n const colorValue = themeUtils.getColor(colorMap[color].color, theme);\n const background = themeUtils.getColor(colorMap[color].background, theme);\n\n return css`\n background-color: ${background};\n color: ${colorValue};\n `;\n};\n\nconst TagWrapper = styled('div')<TagProps>`\n display: inline-flex;\n align-items: center;\n padding: ${({ title }) => (title ? '0 6px 0 2px' : '0 4px')};\n line-height: 20px;\n border-radius: ${({ title })
|
|
1
|
+
{"version":3,"file":"Tag.js","sources":["../../src/Tag/Tag.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport styled, { css } from 'styled-components';\nimport { Close } from '@kubed/icons';\nimport forwardRef from '../utils/forwardRef';\nimport { DefaultProps, KubedTheme, KubedNumberSize, themeUtils } from '../theme';\nimport { addColorAlpha } from '../utils/color';\n\nconst colorMap = {\n default: {\n color: 'background',\n background: 'accents_8',\n },\n primary: {\n color: 'green4',\n background: 'green0',\n },\n success: {\n color: 'green4',\n background: 'green0',\n },\n secondary: {\n color: 'accents_7',\n background: 'accents_2',\n },\n warning: {\n color: 'yellow4',\n background: 'yellow0',\n },\n error: {\n color: 'red4',\n background: 'red0',\n },\n info: {\n color: 'blue4',\n background: 'blue0',\n },\n};\n\nconst getColor = (color = 'default', theme: KubedTheme) => {\n const colorValue = themeUtils.getColor(colorMap[color].color, theme);\n const background = themeUtils.getColor(colorMap[color].background, theme);\n\n return css`\n background-color: ${background};\n color: ${colorValue};\n `;\n};\n\nconst TagWrapper = styled('div')<TagProps>`\n display: inline-flex;\n align-items: center;\n padding: ${({ title }) => (title ? '0 6px 0 2px' : '0 4px')};\n line-height: 20px;\n border-radius: ${({ title, radius, theme }) =>\n radius ? themeUtils.getSizeValue(radius, theme.layout.radius) : title ? '3px' : '2px'};\n word-break: break-all;\n white-space: normal;\n font-weight: 600;\n ${({ color, theme }) => getColor(color, theme)};\n\n .tag-close {\n margin-left: 6px;\n cursor: pointer;\n border-radius: 3px;\n &:hover {\n background-color: ${({ theme }) => addColorAlpha(theme.palette.accents_6, 0.6)};\n }\n }\n`;\n\nconst TagTitle = styled('span')`\n display: inline-flex;\n padding: 0 6px;\n margin: 2px 6px 2px 0;\n line-height: 16px;\n color: ${({ theme }) => theme.palette.background};\n background-color: ${({ theme }) => theme.palette.accents_7};\n border-radius: 1px;\n font-weight: 500;\n`;\n\nexport interface TagProps extends DefaultProps {\n /** Title of the tag */\n title?: React.ReactNode;\n\n /** Style of title */\n titleStyle?: React.CSSProperties;\n\n /** Tag color from theme */\n color?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info' | string;\n\n /** Append element of the tag */\n append?: React.ReactNode;\n\n /** Prepend element of the tag */\n prepend?: React.ReactNode;\n\n /** Radius of the tag */\n radius?: KubedNumberSize;\n\n visible?: boolean;\n\n closable?: boolean;\n\n onClose?: (e: React.MouseEvent<SVGElement>) => void;\n}\n\nexport const Tag = forwardRef<TagProps, 'div'>(\n (\n { radius, title, titleStyle, color, onClose, children, prepend, append, closable, ...rest },\n ref\n ) => {\n const [visible, setVisible] = useState(true);\n\n useEffect(() => {\n if ('visible' in rest) {\n setVisible(rest.visible!);\n }\n }, [rest.visible]);\n\n const handleClose = (e: React.MouseEvent<SVGElement>) => {\n e.stopPropagation();\n onClose?.(e);\n\n if (e.defaultPrevented) {\n return;\n }\n if (!('visible' in rest)) {\n setVisible(false);\n }\n };\n\n if (!visible) return null;\n\n return (\n <TagWrapper ref={ref} radius={radius} title={title} color={color} {...rest}>\n {prepend}\n {title && <TagTitle style={titleStyle}>{title}</TagTitle>}\n {children}\n {append}\n {closable && <Close variant=\"light\" className=\"tag-close\" onClick={handleClose} />}\n </TagWrapper>\n );\n }\n);\n\nTag.displayName = '@kubed/components/Tag';\n"],"names":["React"],"mappings":";;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAA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AACL,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AACrB,EAAE,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK;AAC7B,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACxB,IAAI,OAAO,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAC1C,IAAI,IAAI,CAAC,CAAC,gBAAgB,EAAE;AAC5B,MAAM,OAAO;AACb,KAAK;AACL,IAAI,IAAI,EAAE,SAAS,IAAI,IAAI,CAAC,EAAE;AAC9B,MAAM,UAAU,CAAC,KAAK,CAAC,CAAC;AACxB,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,IAAI,CAAC,OAAO;AACd,IAAI,OAAO,IAAI,CAAC;AAChB,EAAE,uBAAuBA,cAAK,CAAC,aAAa,CAAC,UAAU,EAAE,cAAc,CAAC;AACxE,IAAI,GAAG;AACP,IAAI,MAAM;AACV,IAAI,KAAK;AACT,IAAI,KAAK;AACT,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,oBAAoBA,cAAK,CAAC,aAAa,CAAC,QAAQ,EAAE;AAC5E,IAAI,KAAK,EAAE,UAAU;AACrB,GAAG,EAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,oBAAoBA,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AACtF,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,SAAS,EAAE,WAAW;AAC1B,IAAI,OAAO,EAAE,WAAW;AACxB,GAAG,CAAC,CAAC,CAAC;AACN,CAAC,EAAE;AACH,GAAG,CAAC,WAAW,GAAG,uBAAuB;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t,{useState as E,useEffect as V}from"react";import{isUndefined as k}from"lodash";import j from"classnames";import{ChevronDown as W}from"@kubed/icons";import{useClickOutside as _,useMergedRef as g}from"@kubed/hooks";import h from"../utils/forwardRef.js";import{Field as w}from"../Entity/Field.js";import{TypeSelectWrapper as F,ControlWrapper as N,DropdownWrapper as A,DropdownOption as I,DropdownArrow as M}from"./TypeSelect.styles.js";const y=h(({options:l,value:n,defaultValue:p,className:b,onChange:u},v)=>{const[o,a]=E(!1),C=_(()=>{a(!1)}),O=g(v,C),s=e=>k(e)?!1:l.some(r=>r.value===e),x=()=>s(n)?n:s(p)?p:l[0].value,[m,f]=E(x());V(()=>{s(n)&&f(n)},[n]);const R=()=>{const e=l.find(d=>d.value===m),{label:r,description:c,icon:i}=e;return t.createElement(N,{onClick:()=>{a(!o)},$expanded:o},t.createElement(w,{label:c,value:r,avatar:i}))},D=e=>{k(n)&&f(e.value),a(!1),u&&u(e.value,e)},S=()=>l.filter(r=>r.value!==m).map(r=>{const{label:c,description:i,icon:d,value:T}=r;return t.createElement(I,{key:T,onClick:()=>D(r)},t.createElement(w,{label:i,value:c,avatar:d}))});return t.createElement(F,{ref:O,className:j(b,{"is-expand":o})},R(),o&&t.createElement(A,null,S()),!o&&t.createElement(M,null,t.createElement(W,null)))});y.displayName="@kubed/components/TypeSelect";export{y as TypeSelect};
|
|
2
|
+
//# sourceMappingURL=TypeSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeSelect.js","sources":["../../src/TypeSelect/TypeSelect.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { isUndefined } from 'lodash';\nimport cx from 'classnames';\nimport { ChevronDown } from '@kubed/icons';\nimport { useClickOutside, useMergedRef } from '@kubed/hooks';\nimport { DefaultProps } from '../theme';\nimport forwardRef from '../utils/forwardRef';\nimport { Field } from '../Entity/Field';\nimport {\n TypeSelectWrapper,\n ControlWrapper,\n DropdownWrapper,\n DropdownOption,\n DropdownArrow,\n} from './TypeSelect.styles';\n\ninterface OptionProps {\n /** Field label */\n label: React.ReactNode;\n\n /** Field description */\n description?: React.ReactNode;\n\n value: React.ReactNode;\n\n /** Field avatar */\n icon?: React.ReactNode;\n}\n\nexport interface TypeSelectProps extends DefaultProps {\n value?: any;\n defaultValue?: any;\n options: OptionProps[];\n onChange?: (value: any, option: OptionProps) => void;\n}\n\nexport const TypeSelect = forwardRef<TypeSelectProps, 'div'>(\n ({ options, value, defaultValue, className, onChange }, ref) => {\n const [expanded, setExpanded] = useState(false);\n\n const useClickOutsideRef = useClickOutside(() => {\n setExpanded(false);\n });\n const mergedRef = useMergedRef(ref, useClickOutsideRef);\n\n const isValidValue = (v) => {\n if (isUndefined(v)) {\n return false;\n }\n return options.some((option) => option.value === v);\n };\n\n const getInitialValue = () => {\n if (isValidValue(value)) {\n return value;\n }\n if (isValidValue(defaultValue)) {\n return defaultValue;\n }\n return options[0].value;\n };\n\n const [_value, setValue] = useState(getInitialValue());\n\n useEffect(() => {\n if (isValidValue(value)) {\n setValue(value);\n }\n }, [value]);\n\n const renderControl = () => {\n const currentOption = options.find((option) => option.value === _value);\n const { label, description, icon } = currentOption;\n return (\n <ControlWrapper\n onClick={() => {\n setExpanded(!expanded);\n }}\n $expanded={expanded}\n >\n <Field label={description} value={label} avatar={icon} />\n </ControlWrapper>\n );\n };\n\n const onOptionClick = (option) => {\n if (isUndefined(value)) {\n setValue(option.value);\n }\n setExpanded(false);\n onChange && onChange(option.value, option);\n };\n\n const renderDropdown = () => {\n const dropdownOptions = options.filter((option) => option.value !== _value);\n return dropdownOptions.map((option) => {\n const { label, description, icon, value: optionValue } = option;\n return (\n // @ts-ignore\n <DropdownOption key={optionValue} onClick={() => onOptionClick(option)}>\n <Field label={description} value={label} avatar={icon} />\n </DropdownOption>\n );\n });\n };\n\n return (\n <TypeSelectWrapper ref={mergedRef} className={cx(className, { 'is-expand': expanded })}>\n {renderControl()}\n {expanded && <DropdownWrapper>{renderDropdown()}</DropdownWrapper>}\n {!expanded && (\n <DropdownArrow>\n <ChevronDown />\n </DropdownArrow>\n )}\n </TypeSelectWrapper>\n );\n }\n);\n\nTypeSelect.displayName = '@kubed/components/TypeSelect';\n"],"names":["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E,GAAG,MAAM,CAAC;AACtE,MAAM,uBAAuBA,cAAK,CAAC,aAAa,CAAC,cAAc,EAAE;AACjE,QAAQ,GAAG,EAAE,WAAW;AACxB,QAAQ,OAAO,EAAE,MAAM,aAAa,CAAC,MAAM,CAAC;AAC5C,OAAO,kBAAkBA,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AACpD,QAAQ,KAAK,EAAE,WAAW;AAC1B,QAAQ,KAAK,EAAE,KAAK;AACpB,QAAQ,MAAM,EAAE,IAAI;AACpB,OAAO,CAAC,CAAC,CAAC;AACV,KAAK,CAAC,CAAC;AACP,GAAG,CAAC;AACJ,EAAE,uBAAuBA,cAAK,CAAC,aAAa,CAAC,iBAAiB,EAAE;AAChE,IAAI,GAAG,EAAE,SAAS;AAClB,IAAI,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AACvD,GAAG,EAAE,aAAa,EAAE,EAAE,QAAQ,oBAAoBA,cAAK,CAAC,aAAa,CAAC,eAAe,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC,QAAQ,oBAAoBA,cAAK,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,kBAAkBA,cAAK,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/O,CAAC,EAAE;AACH,UAAU,CAAC,WAAW,GAAG,8BAA8B;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import r,{css as e}from"styled-components";const p=(o,t)=>o?e`
|
|
2
|
+
border-color: ${t.palette.accents_5};
|
|
3
|
+
border-bottom: 0;
|
|
4
|
+
border-bottom-right-radius: 0;
|
|
5
|
+
border-bottom-left-radius: 0;
|
|
6
|
+
transition: none;
|
|
7
|
+
background-color: ${t.palette.accents_1};
|
|
8
|
+
`:null,n=r("div")`
|
|
9
|
+
position: relative;
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
`,d=r("div")`
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
border: 1px solid ${({theme:o})=>o.palette.border};
|
|
15
|
+
height: 64px;
|
|
16
|
+
padding: 12px 64px 12px 12px;
|
|
17
|
+
transition: all 0.3s ease-in-out;
|
|
18
|
+
background-color: #fff;
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
border-color: ${({theme:o})=>o.palette.accents_5};
|
|
22
|
+
}
|
|
23
|
+
${({$expanded:o,theme:t})=>p(o,t)};
|
|
24
|
+
`,a=r.div`
|
|
25
|
+
position: absolute;
|
|
26
|
+
height: 16px;
|
|
27
|
+
top: 50%;
|
|
28
|
+
right: 12px;
|
|
29
|
+
transform: translateY(-50%);
|
|
30
|
+
&:hover {
|
|
31
|
+
background-color: ${({theme:o})=>o.palette.accents_1};
|
|
32
|
+
}
|
|
33
|
+
z-index: 999;
|
|
34
|
+
`,i=r.div`
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 63px;
|
|
37
|
+
left: 0px;
|
|
38
|
+
width: 100%;
|
|
39
|
+
border: 1px solid ${({theme:o})=>o.palette.accents_5};
|
|
40
|
+
border-radius: 4px;
|
|
41
|
+
border-top-right-radius: 0;
|
|
42
|
+
border-top-left-radius: 0;
|
|
43
|
+
border-top: 0;
|
|
44
|
+
background-color: ${({theme:o})=>o.palette.background};
|
|
45
|
+
z-index: 9999;
|
|
46
|
+
//box-sizing: content-box;
|
|
47
|
+
`,s=r.div`
|
|
48
|
+
height: 64px;
|
|
49
|
+
padding: 12px 64px 12px 12px;
|
|
50
|
+
&:hover {
|
|
51
|
+
background-color: ${({theme:o})=>o.palette.accents_0};
|
|
52
|
+
}
|
|
53
|
+
`;export{d as ControlWrapper,a as DropdownArrow,s as DropdownOption,i as DropdownWrapper,n as TypeSelectWrapper};
|
|
54
|
+
//# sourceMappingURL=TypeSelect.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeSelect.styles.js","sources":["../../src/TypeSelect/TypeSelect.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\n\ninterface ControlWrapperProps {\n $expanded: boolean;\n}\n\nconst getExpandedStyle = (expanded: boolean, theme) => {\n if (expanded) {\n return css`\n border-color: ${theme.palette.accents_5};\n border-bottom: 0;\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n transition: none;\n background-color: ${theme.palette.accents_1};\n `;\n }\n return null;\n};\n\nexport const TypeSelectWrapper = styled('div')`\n position: relative;\n border-radius: 4px;\n cursor: pointer;\n`;\n\nexport const ControlWrapper = styled('div')<ControlWrapperProps>`\n border-radius: 4px;\n border: 1px solid ${({ theme }) => theme.palette.border};\n height: 64px;\n padding: 12px 64px 12px 12px;\n transition: all 0.3s ease-in-out;\n background-color: #fff;\n\n &:hover {\n border-color: ${({ theme }) => theme.palette.accents_5};\n }\n ${({ $expanded, theme }) => getExpandedStyle($expanded, theme)};\n`;\n\nexport const DropdownArrow = styled.div`\n position: absolute;\n height: 16px;\n top: 50%;\n right: 12px;\n transform: translateY(-50%);\n &:hover {\n background-color: ${({ theme }) => theme.palette.accents_1};\n }\n z-index: 999;\n`;\n\nexport const DropdownWrapper = styled.div`\n position: absolute;\n top: 63px;\n left: 0px;\n width: 100%;\n border: 1px solid ${({ theme }) => theme.palette.accents_5};\n border-radius: 4px;\n border-top-right-radius: 0;\n border-top-left-radius: 0;\n border-top: 0;\n background-color: ${({ theme }) => theme.palette.background};\n z-index: 9999;\n //box-sizing: content-box;\n`;\n\nexport const DropdownOption = styled.div`\n height: 64px;\n padding: 12px 64px 12px 12px;\n &:hover {\n background-color: ${({ theme }) => theme.palette.accents_0};\n }\n`;\n"],"names":[],"mappings":";;AACA,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,KAAK,KAAK;AAC9C,EAAE,IAAI,QAAQ,EAAE;AAChB,IAAI,OAAO,GAAG,CAAC;AACf,oBAAoB,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;A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AS,CAAC;AAC/D;AACA;;;;"}
|
package/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{KubedConfigProvider}from"./ConfigProvider/index.js";export{Button}from"./Button/Button.js";export{Group}from"./Group/Group.js";export{Container}from"./Container/Container.js";export{Center}from"./Center/Center.js";export{Row}from"./Grid/Row.js";export{Navs}from"./Navs/Navs.js";export{Snippet}from"./Snippet/Snippet.js";export{Tabs}from"./Tabs/Tabs.js";export{Text}from"./Text/Text.js";export{Tooltip}from"./Tooltip/Tooltip.js";export{Popover}from"./Popover/Popover.js";export{Divider}from"./Divider/Divider.js";export{Menu}from"./Menu/Menu.js";export{StatusDot}from"./StatusDot/StatusDot.js";export{Tag}from"./Tag/Tag.js";export{Badge}from"./Badge/Badge.js";export{Alert}from"./Alert/Alert.js";export{Card}from"./Card/Card.js";export{Descriptions}from"./Descriptions/Descriptions.js";export{Entity}from"./Entity/Entity.js";export{Dropdown}from"./Dropdown/Dropdown.js";export{Loading}from"./Loading/Loading.js";export{LoadingOverlay}from"./LoadingOverlay/LoadingOverlay.js";export{Input}from"./Input/Input.js";export{InputPassword}from"./InputPassword/InputPassword.js";export{FilterInput}from"./FilterInput/FilterInput.js";export{Empty}from"./Empty/Empty.js";export{Form}from"./Form/Form.js";export{Select}from"./Select/Select.js";export{Checkbox}from"./Checkbox/Checkbox.js";export{Radio}from"./Radio/Radio.js";export{Switch}from"./Switch/Switch.js";export{InputNumber}from"./InputNumber/InputNumber.js";export{DatePicker}from"./DatePicker/DatePicker.js";export{default as TimePicker}from"./TimePicker/TimePicker.js";export{Banner}from"./Banner/Banner.js";export{Notify}from"./Notify/Notify.js";export{AutoComplete}from"./AutoComplete/AutoComplete.js";export{ActionConfirm}from"./ActionConfirm/ActionConfirm.js";export{Progress}from"./Progress/Progress.js";export{addColorAlpha,colorToRgbValues}from"./utils/color.js";export{default as Drawer}from"./Drawer/Drawer.js";export{default as Collapse}from"./Collapse/Collapse.js";export{default as forwardRef}from"./utils/forwardRef.js";export{default as toArray}from"./utils/toArray.js";export{default as useForm}from"./Form/hooks/useForm.js";export{Col}from"./Grid/Col.js";export{Tab}from"./Tabs/Tab/Tab.js";export{MenuLabel}from"./Menu/MenuLabel/MenuLabel.js";export{MenuItem}from"./Menu/MenuItem/MenuItem.js";export{BadgeAnchor}from"./Badge/BadgeAnchor.js";export{Description}from"./Descriptions/Description.js";export{Field}from"./Entity/Field.js";export{Modal}from"./Modal/Modal.js";export{useModal}from"./Modal/ModalProvider/ModalContext.js";export{CheckboxGroup}from"./Checkbox/CheckboxGroup.js";export{RadioGroup}from"./Radio/RadioGroup.js";export{BannerTip}from"./Banner/BannerTip.js";export{default as notify}from"react-hot-toast";export{Slider}from"./Slider/Slider/Slider.js";export{RangeSlider}from"./Slider/RangeSlider/RangeSlider.js";export{default as CssBaseline}from"./theme/CssBaseline.js";export{useTheme}from"./theme/ThemeContext.js";export{default as themeUtils}from"./theme/utils.js";export{List as FormList}from"rc-field-form";export{FormItem}from"./Form/FormItem/FormItem.js";
|
|
1
|
+
export{KubedConfigProvider}from"./ConfigProvider/index.js";export{Button}from"./Button/Button.js";export{Group}from"./Group/Group.js";export{Container}from"./Container/Container.js";export{Center}from"./Center/Center.js";export{Row}from"./Grid/Row.js";export{Navs}from"./Navs/Navs.js";export{Snippet}from"./Snippet/Snippet.js";export{Tabs}from"./Tabs/Tabs.js";export{Text}from"./Text/Text.js";export{Tooltip}from"./Tooltip/Tooltip.js";export{Popover}from"./Popover/Popover.js";export{Divider}from"./Divider/Divider.js";export{Menu}from"./Menu/Menu.js";export{StatusDot}from"./StatusDot/StatusDot.js";export{Tag}from"./Tag/Tag.js";export{Badge}from"./Badge/Badge.js";export{Alert}from"./Alert/Alert.js";export{Card}from"./Card/Card.js";export{Descriptions}from"./Descriptions/Descriptions.js";export{Entity}from"./Entity/Entity.js";export{Dropdown}from"./Dropdown/Dropdown.js";export{Loading}from"./Loading/Loading.js";export{LoadingOverlay}from"./LoadingOverlay/LoadingOverlay.js";export{Input}from"./Input/Input.js";export{InputPassword}from"./InputPassword/InputPassword.js";export{FilterInput}from"./FilterInput/FilterInput.js";export{Empty}from"./Empty/Empty.js";export{Form}from"./Form/Form.js";export{Select}from"./Select/Select.js";export{Checkbox}from"./Checkbox/Checkbox.js";export{Radio}from"./Radio/Radio.js";export{Switch}from"./Switch/Switch.js";export{InputNumber}from"./InputNumber/InputNumber.js";export{DatePicker}from"./DatePicker/DatePicker.js";export{default as TimePicker}from"./TimePicker/TimePicker.js";export{Banner}from"./Banner/Banner.js";export{Notify}from"./Notify/Notify.js";export{AutoComplete}from"./AutoComplete/AutoComplete.js";export{ActionConfirm}from"./ActionConfirm/ActionConfirm.js";export{Progress}from"./Progress/Progress.js";export{addColorAlpha,colorToRgbValues}from"./utils/color.js";export{Steps}from"./Steps/Steps.js";export{TypeSelect}from"./TypeSelect/TypeSelect.js";export{ShowMore}from"./ShowMore/ShowMore.js";export{default as Drawer}from"./Drawer/Drawer.js";export{default as Collapse}from"./Collapse/Collapse.js";export{default as forwardRef}from"./utils/forwardRef.js";export{default as toArray}from"./utils/toArray.js";export{default as useForm}from"./Form/hooks/useForm.js";export{Col}from"./Grid/Col.js";export{Tab}from"./Tabs/Tab/Tab.js";export{MenuLabel}from"./Menu/MenuLabel/MenuLabel.js";export{MenuItem}from"./Menu/MenuItem/MenuItem.js";export{BadgeAnchor}from"./Badge/BadgeAnchor.js";export{Description}from"./Descriptions/Description.js";export{Field}from"./Entity/Field.js";export{Modal}from"./Modal/Modal.js";export{useModal}from"./Modal/ModalProvider/ModalContext.js";export{CheckboxGroup}from"./Checkbox/CheckboxGroup.js";export{RadioGroup}from"./Radio/RadioGroup.js";export{BannerTip}from"./Banner/BannerTip.js";export{default as notify}from"react-hot-toast";export{Slider}from"./Slider/Slider/Slider.js";export{RangeSlider}from"./Slider/RangeSlider/RangeSlider.js";export{Step}from"./Steps/Step/Step.js";export{StepCompleted}from"./Steps/StepCompleted/StepCompleted.js";export{TabStep}from"./Steps/TabStep/TabStep.js";export{default as CssBaseline}from"./theme/CssBaseline.js";export{useTheme}from"./theme/ThemeContext.js";export{default as themeUtils}from"./theme/utils.js";export{List as FormList}from"rc-field-form";export{FormItem}from"./Form/FormItem/FormItem.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|