@atom-learning/components 1.24.1 → 2.0.0
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 +21 -2
- package/dist/components/action-icon/ActionIcon.constants.d.ts +6 -0
- package/dist/components/action-icon/ActionIcon.constants.js +1 -0
- package/dist/components/action-icon/ActionIcon.d.ts +1 -1
- package/dist/components/action-icon/ActionIcon.js +1 -1
- package/dist/components/calendar/Calendar.js +1 -1
- package/dist/components/date-input/DateInput.js +1 -1
- package/dist/components/dialog/DialogContent.js +1 -1
- package/dist/components/password-input/PasswordInput.js +1 -1
- package/dist/components/popover/PopoverContent.js +1 -1
- package/dist/components/search-input/SearchInput.js +1 -1
- package/dist/components/tabs/TabsTriggerList.js +1 -1
- package/dist/docgen.json +1 -1
- package/dist/docs/ActionIcon.mdx +13 -19
- package/dist/docs/Checkbox.mdx +4 -0
- package/dist/docs/Icon.mdx +1 -1
- package/dist/index.cjs.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
# [2.0.0](https://github.com/Atom-Learning/components/compare/v1.24.2...v2.0.0) (2022-09-06)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* action icon sizes ([e46f613](https://github.com/Atom-Learning/components/commit/e46f613c030e3e3cc15ab2c8e148fa95e11f01e8))
|
|
7
|
+
* align sizes to buttons ([4df4f1f](https://github.com/Atom-Learning/components/commit/4df4f1fbd8e1a2eaf6f26166a28086a70009a2c2))
|
|
8
|
+
* always base icon size on actionicon size ([2570aaa](https://github.com/Atom-Learning/components/commit/2570aaa26fa919355f33f7eb8fea5f16be6df787))
|
|
9
|
+
* attempting manual merge ([51a1c66](https://github.com/Atom-Learning/components/commit/51a1c666de0b6cad1c086bcc6efe1dd1f57ab47d))
|
|
10
|
+
* changing back missed icon size ([23348a3](https://github.com/Atom-Learning/components/commit/23348a3c3588329de9285aa9002ba77497ac0789))
|
|
11
|
+
* display px value in docs ([fe24ca0](https://github.com/Atom-Learning/components/commit/fe24ca09a74cdfd4c4e8d3fb3603f2c3b61e6c24))
|
|
12
|
+
* fixing type issue ([1510885](https://github.com/Atom-Learning/components/commit/1510885f5b0e97e75d48e8e1414e7b4324dc8ba6))
|
|
13
|
+
* further aligning with design after unintended change to icon ([1ccaf5e](https://github.com/Atom-Learning/components/commit/1ccaf5e087475411f194bd359a6567977c91b9af))
|
|
14
|
+
* merge in main ([52176f2](https://github.com/Atom-Learning/components/commit/52176f203441f96d4e8b702ca63d79db715d4242))
|
|
15
|
+
* moving logic into compound variants ([8567512](https://github.com/Atom-Learning/components/commit/85675123c43f7e4e0c71093163380e42a91fb3ed))
|
|
16
|
+
* moving to size map rather than compound variants ([ab10933](https://github.com/Atom-Learning/components/commit/ab10933dc308cc563dd11fe29245717705c1262b))
|
|
17
|
+
* retaining conditional logic on input fields ([72c1e52](https://github.com/Atom-Learning/components/commit/72c1e52562d4939b1a4cc10771d4885f1f2e55ce))
|
|
18
|
+
* updating mdx to remove unused prop ([94444f3](https://github.com/Atom-Learning/components/commit/94444f3aff999ad4b56216f47fda4e08464667db))
|
|
19
|
+
* updating snapshot ([59e1460](https://github.com/Atom-Learning/components/commit/59e14605b727eb6e46827dc8d524059dd0f6f658))
|
|
20
|
+
* updating snapshots after merge conflict ([8c0577a](https://github.com/Atom-Learning/components/commit/8c0577a4223936fdfbad6c2950798d7c9dbfcddc))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### BREAKING CHANGES
|
|
24
|
+
|
|
25
|
+
* { sizes for ActionIcon are going from sm-xl to xs-lg }
|
|
7
26
|
|
|
8
27
|
# [1.4.0](https://github.com/Atom-Learning/components/compare/v1.3.0...v1.4.0) (2022-04-11)
|
|
9
28
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const m={xs:"sm",sm:"sm",md:"md",lg:"lg"};export{m as ActionIconSizeMap};
|
|
@@ -5,7 +5,7 @@ import { Override } from '../../utilities';
|
|
|
5
5
|
declare const StyledButton: import("@stitches/react/types/styled-component").StyledComponent<"button", {
|
|
6
6
|
theme?: "primary" | "success" | "danger" | "warning" | "neutral" | undefined;
|
|
7
7
|
appearance?: "outline" | "solid" | "simple" | undefined;
|
|
8
|
-
size?: "md" | "lg" | "
|
|
8
|
+
size?: "sm" | "md" | "lg" | "xs" | undefined;
|
|
9
9
|
isRounded?: boolean | "true" | undefined;
|
|
10
10
|
}, {
|
|
11
11
|
sm: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{darken as i}from"color2k";import g from"invariant";import*as
|
|
1
|
+
import{darken as i}from"color2k";import g from"invariant";import*as o from"react";import{styled as D,theme as n}from"../../stitches.js";import{ActionIconSizeMap as w}from"./ActionIcon.constants.js";import{Icon as m}from"../icon/Icon.js";const c=(e,r,a)=>({bg:"transparent",color:e,"&:not(:disabled):hover, &:not(:disabled):focus":{color:r},"&:not(:disabled):active":{color:a},"&[disabled]":{color:"$tonal400",cursor:"not-allowed"}}),l=(e,r,a)=>({bg:e,color:"white","&:not(:disabled):hover, &:not(:disabled):focus":{bg:r,color:"white"},"&:not(:disabled):active":{bg:a},"&[disabled]":{bg:"$tonal100",color:"$tonal400",cursor:"not-allowed"}}),p=(e,r,a)=>({border:"1px solid",borderColor:"currentColor",color:e,"&:not(:disabled):hover, &:not(:disabled):focus":{color:r},"&:not(:disabled):active":{color:a},"&[disabled]":{borderColor:"$tonal400",color:"$tonal400",cursor:"not-allowed"}}),f=D("button",{alignItems:"center",appearance:"none",bg:"white",border:"unset",borderRadius:"$0",boxSizing:"border-box",cursor:"pointer",display:"flex",justifyContent:"center",p:"unset",transition:"all 100ms ease-out",variants:{theme:{neutral:{},primary:{},success:{},warning:{},danger:{}},appearance:{simple:{},outline:{},solid:{}},size:{xs:{size:"$2"},sm:{size:"$3"},md:{size:"$4"},lg:{size:"$5"}},isRounded:{true:{borderRadius:"$round"}}},compoundVariants:[{theme:"neutral",appearance:"simple",css:c("$tonal300","$primaryMid","$primaryDark")},{theme:"primary",appearance:"simple",css:c("$primary","$primaryMid","$primaryDark")},{theme:"primaryDark",appearance:"simple",css:c("$primaryDark",i(n.colors.primaryDark.value,.1),i(n.colors.primaryDark.value,.15))},{theme:"success",appearance:"simple",css:c("$success","$successMid","$successDark")},{theme:"warning",appearance:"simple",css:c("$warning","$warningMid","$warningDark")},{theme:"danger",appearance:"simple",css:c("$danger","$dangerMid","$dangerDark")},{theme:"primary",appearance:"solid",css:l("$primary","$primaryMid","$primaryDark")},{theme:"primaryDark",appearance:"solid",css:l("$primaryDark",i(n.colors.primaryDark.value,.1),i(n.colors.primaryDark.value,.15))},{theme:"success",appearance:"solid",css:l("$success","$successMid","$successDark")},{theme:"warning",appearance:"solid",css:l("$warning","$warningMid","$warningDark")},{theme:"danger",appearance:"solid",css:l("$danger","$dangerMid","$dangerDark")},{theme:"primary",appearance:"outline",css:p("$primary","$primaryMid","$primaryDark")},{theme:"primaryDark",appearance:"outline",css:p("$primaryDark",i(n.colors.primaryDark.value,.1),i(n.colors.primaryDark.value,.15))},{theme:"success",appearance:"outline",css:p("$success","$successMid","$successDark")},{theme:"warning",appearance:"outline",css:p("$warning","$warningMid","$warningDark")},{theme:"danger",appearance:"outline",css:p("$danger","$dangerMid","$dangerDark")}]}),t=o.forwardRef(({children:e,theme:r="primary",appearance:a="simple",size:$="sm",label:b,href:u,disabled:d,...h},k)=>{const y=`A single ${m.displayName} component is permitted as a child of ${t.displayName}`;return g(o.Children.count(e)===1,y),o.createElement(f,{...h,...u?{as:"a",href:d?null:u,onClick:void 0,"aria-disabled":!!d}:{type:"button"},"aria-label":b,theme:r,appearance:a,size:$,ref:k,disabled:d},o.Children.map(e,s=>{if(!o.isValidElement(s))throw new Error(y);return g(s.type===m,`Children of type ${s==null?void 0:s.type} aren't permitted. Only an ${m.displayName} component is allowed in ${t.displayName}`),o.cloneElement(s,{size:w[$],css:{...s.props.css?s.props.css:{}}})}))});t.displayName="ActionIcon";export{t as ActionIcon};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ChevronLeft as q,ChevronRight as H}from"@atom-learning/icons";import{useDayzed as J}from"dayzed";import*as e from"react";import{ActionIcon as x}from"../action-icon/ActionIcon.js";import{Box as h}from"../box/Box.js";import{Flex as C}from"../flex/Flex.js";import{Icon as Y}from"../icon/Icon.js";import{Text as K}from"../text/Text.js";import{Button as w}from"../button/Button.js";import{styled as F}from"../../stitches.js";import{monthNamesShort as Q,weekdayNamesShort as V,DEFAULT_LABELS as X}from"./constants.js";import{Day as Z}from"./Day.js";const g=F("div",{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gridGap:"$1 $2"}),ee=F(w,{color:"$tonal600",p:"$3",width:"$6",variants:{selected:{false:{color:"$tonal600 !important",fontWeight:"400","&:hover":{bg:"$tonal100 !important",color:"$tonal600 !important"},"&[disabled]":{bg:"white !important"}}}}}),te=(i,c)=>{const u=i.slice(0,c);return i.slice(c).concat(u)},S=({css:i,refDateSelected:c,refDateToday:u,firstDayOfWeek:f=0,monthNames:N=Q,weekdayNames:T=V,labels:y=X,date:o=new Date,minDate:l,maxDate:s,setYear:A,...L})=>{const[a,E]=e.useState(!1),[m,k]=e.useState(o==null?void 0:o.getFullYear()),O=t=>{const r=o;r.setFullYear(t),A(r),E(!1)},W=l&&m-16<=l.getFullYear(),z=s&&m>=s.getFullYear(),B=Array.from({length:16},(t,r)=>{const n=m-r;return s&&n>s.getFullYear()||l&&n<l.getFullYear()?0:n}),{calendars:d,getBackProps:I,getForwardProps:M,getDateProps:G}=J({firstDayOfWeek:f,showOutsideDays:!0,date:o,minDate:l,maxDate:s,...L});return d.length?e.createElement(h,{css:{position:"relative",width:"min-content",mt:"-$1",...i}},e.createElement(C,{css:{position:"absolute",top:0,right:"-$1"}},e.createElement(x,{label:y[a?"previousYear":"previous"],theme:"neutral",size:"
|
|
1
|
+
import{ChevronLeft as q,ChevronRight as H}from"@atom-learning/icons";import{useDayzed as J}from"dayzed";import*as e from"react";import{ActionIcon as x}from"../action-icon/ActionIcon.js";import{Box as h}from"../box/Box.js";import{Flex as C}from"../flex/Flex.js";import{Icon as Y}from"../icon/Icon.js";import{Text as K}from"../text/Text.js";import{Button as w}from"../button/Button.js";import{styled as F}from"../../stitches.js";import{monthNamesShort as Q,weekdayNamesShort as V,DEFAULT_LABELS as X}from"./constants.js";import{Day as Z}from"./Day.js";const g=F("div",{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gridGap:"$1 $2"}),ee=F(w,{color:"$tonal600",p:"$3",width:"$6",variants:{selected:{false:{color:"$tonal600 !important",fontWeight:"400","&:hover":{bg:"$tonal100 !important",color:"$tonal600 !important"},"&[disabled]":{bg:"white !important"}}}}}),te=(i,c)=>{const u=i.slice(0,c);return i.slice(c).concat(u)},S=({css:i,refDateSelected:c,refDateToday:u,firstDayOfWeek:f=0,monthNames:N=Q,weekdayNames:T=V,labels:y=X,date:o=new Date,minDate:l,maxDate:s,setYear:A,...L})=>{const[a,E]=e.useState(!1),[m,k]=e.useState(o==null?void 0:o.getFullYear()),O=t=>{const r=o;r.setFullYear(t),A(r),E(!1)},W=l&&m-16<=l.getFullYear(),z=s&&m>=s.getFullYear(),B=Array.from({length:16},(t,r)=>{const n=m-r;return s&&n>s.getFullYear()||l&&n<l.getFullYear()?0:n}),{calendars:d,getBackProps:I,getForwardProps:M,getDateProps:G}=J({firstDayOfWeek:f,showOutsideDays:!0,date:o,minDate:l,maxDate:s,...L});return d.length?e.createElement(h,{css:{position:"relative",width:"min-content",mt:"-$1",...i}},e.createElement(C,{css:{position:"absolute",top:0,right:"-$1"}},e.createElement(x,{label:y[a?"previousYear":"previous"],theme:"neutral",size:"md",...!a&&I({calendars:d}),...a&&{onClick:()=>k(m-16)},disabled:a&&W},e.createElement(Y,{is:q})),e.createElement(x,{label:y[a?"nextYear":"next"],theme:"neutral",size:"md",...!a&&M({calendars:d}),...a&&{onClick:()=>k(m+16)},disabled:a&&z},e.createElement(Y,{is:H}))),a&&e.createElement(g,{css:{gridTemplateColumns:"repeat(4, 1fr)",pt:"$7",direction:"rtl",gridGap:"$3 $1"}},B.map((t,r)=>{const n=t===o.getFullYear();return t?e.createElement(ee,{key:`${t}${r}`,theme:n?"primary":"neutral",isRounded:!0,onClick:()=>O(t),selected:n},t):e.createElement(h,{key:r,css:{width:"$6",height:"$4"}})})),!a&&d.map(({month:t,year:r,weeks:n})=>e.createElement(h,{key:`${t}${r}`},e.createElement(C,{css:{height:"$4",alignItems:"center",mb:"$4"}},e.createElement(w,{theme:"neutral",css:{px:"0",color:"$tonal600"},onClick:()=>E(!0)},N[t]," ",r)),e.createElement(g,{css:{mb:"$3"}},te(T,f).map(p=>e.createElement(K,{as:"span",size:"sm",key:`${t}${r}${p}`,css:{fontWeight:600,textAlign:"center"}},p))),e.createElement(g,null,n.map((p,P)=>p.map(($,R)=>{const D=`${t}${r}${P}${R}`;if(!$)return e.createElement("div",{key:D});const{date:j,selected:b,today:v,prevMonth:U,nextMonth:_}=$;return e.createElement(Z,{isOutsideMonth:U||_,isSelected:b,isToday:v,key:D,ref:b?c:v?u:null,...G({dateObj:$}),type:"button"},j.getDate())})))))):null};S.displayName="Calendar";export{S as Calendar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CalendarEvent as
|
|
1
|
+
import{CalendarEvent as N}from"@atom-learning/icons";import*as e from"react";import{ActionIcon as O}from"../action-icon/ActionIcon.js";import{Box as S}from"../box/Box.js";import{Calendar as k}from"../calendar/Calendar.js";import{DEFAULT_LABELS as x}from"../calendar/constants.js";import{Icon as z}from"../icon/Icon.js";import{Input as L}from"../input/Input.js";import{Popover as m}from"../popover/Popover.js";import{DEFAULT_DATE_FORMAT as R}from"./constants.js";import{useDate as B}from"./use-date.js";const D=e.forwardRef(({initialDate:E,dateFormat:g=R,firstDayOfWeek:h=1,disabled:s,monthNames:C,weekdayNames:b,size:l="md",labels:v,revalidate:o,onChange:n,minDate:y,maxDate:w,...A},T)=>{const{date:a,dateString:F,setDate:r}=B(E,g),i={...x,...v},[I,d]=e.useState(!1),f=e.useRef(null),c=e.useRef(null);return e.useEffect(()=>{n==null||n(a)},[a,n]),e.createElement(S,{css:{position:"relative"}},e.createElement(L,{name:"date",disabled:s,size:l,...A,onChange:t=>r(t.target.value,!0),value:F,ref:T}),e.createElement(m,{modal:!0,open:I,onOpenChange:d},e.createElement(m.Trigger,{asChild:!0},e.createElement(O,{css:{position:"absolute",top:"0",right:"0"},disabled:s,label:i.open,size:l,theme:"neutral"},e.createElement(z,{is:N}))),e.createElement(m.Content,{css:{pr:"$sizes$2"},side:"bottom",align:"end",showCloseButton:!1,onOpenAutoFocus:t=>{var p,u;t.preventDefault(),a?(p=c.current)==null||p.focus():(u=f.current)==null||u.focus()}},e.createElement(k,{date:a||new Date,selected:a,onDateSelected:async t=>{d(!1),await r(t.date,!1),o&&o()},setYear:async t=>{await r(t,!1),o&&o()},minDate:y,maxDate:w,refDateToday:f,refDateSelected:c,firstDayOfWeek:h,monthNames:C,weekdayNames:b,labels:i}))))});D.displayName="DateInput";export{D as DateInput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Close as h}from"@atom-learning/icons";import{Overlay as x,Content as b,Portal as
|
|
1
|
+
import{Close as h}from"@atom-learning/icons";import{Overlay as x,Content as b,Portal as w,Close as g}from"@radix-ui/react-dialog";import*as o from"react";import{DIALOG_Z_INDEX as r}from"../../constants/dialog.js";import{keyframes as n,styled as l}from"../../stitches.js";import{ActionIcon as v}from"../action-icon/ActionIcon.js";import{Icon as $}from"../icon/Icon.js";import{DialogBackground as s}from"./DialogBackground.js";import{fadeIn as z,fadeOut as C}from"../../utilities/style/keyframe-animations.js";const e="translate3d(-50%, -50%, 0)",m="translate3d(-50%, 50vh, 0)",d="modal_overlay",D=n({"0%":{transform:m},"100%":{transform:e}}),I=n({"0%":{transform:e},"100%":{transform:m}}),y=l(x,{backgroundColor:"$alpha600",inset:0,position:"fixed",overflowY:"auto",zIndex:r,"@allowMotion":{'&[data-state="open"]':{animation:`${z} 250ms ease-out`},'&[data-state="closed"]':{animation:`${C} 550ms ease-out`}}}),E=l(b,{bg:"white",borderRadius:"$1",boxShadow:"$3",boxSizing:"border-box",left:"50%",maxWidth:"90vw",maxHeight:"90vh",overflowY:"auto",p:"$5",position:"fixed",top:"50%",transform:e,zIndex:r,"&:focus":{outline:"none"},"@allowMotion":{'&[data-state="open"]':{animation:`${D} 550ms cubic-bezier(0.22, 1, 0.36, 1)`},'&[data-state="closed"]':{animation:`${I} 550ms cubic-bezier(0.22, 1, 0.36, 1)`}},variants:{size:{xs:{width:"380px"},sm:{width:"480px"},md:{width:"600px"},lg:{width:"800px"},xl:{width:"1100px"}}}}),O=({size:p="sm",children:a,closeDialogText:f="Close dialog",showCloseButton:c=!0,...u})=>o.createElement(w,null,o.createElement(y,{id:d},o.Children.map(a,t=>(t==null?void 0:t.type)===s&&t),o.createElement(E,{size:p,"aria-label":"Dialog",onPointerDownOutside:t=>{const i=t.target;(i==null?void 0:i.id)!==d&&t.preventDefault()},...u},c&&o.createElement(v,{as:g,css:{position:"absolute",right:"$4",top:"$4"},label:f,size:"md",theme:"neutral"},o.createElement($,{is:h})),o.Children.map(a,t=>(t==null?void 0:t.type)!==s&&t))));export{O as DialogContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Eye as l,EyeCrossed as
|
|
1
|
+
import{Eye as l,EyeCrossed as f}from"@atom-learning/icons";import*as e from"react";import{useState as w}from"react";import{ActionIcon as u}from"../action-icon/ActionIcon.js";import{Box as E}from"../box/Box.js";import{Icon as h}from"../icon/Icon.js";import{Input as x}from"../input/Input.js";const r=e.forwardRef(({css:a,hidePasswordText:i="Hide password",showPasswordText:m="Show password",size:t="md",...p},n)=>{const[o,c]=w(!1),d=()=>c(s=>!s);return e.createElement(E,{css:{position:"relative",...a}},e.createElement(x,{...p,size:t,type:o?"text":"password",ref:n,css:{pr:"$sizes$2"}}),e.createElement(u,{appearance:"simple",theme:"neutral",css:{bottom:0,position:"absolute",right:0},label:o?i:m,onClick:d,onMouseDown:s=>s.preventDefault(),size:t},e.createElement(h,{is:o?l:f})))});r.displayName="PasswordInput";export{r as PasswordInput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Close as r}from"@atom-learning/icons";import{Content as l,Arrow as p,Close as h}from"@radix-ui/react-popover";import*as e from"react";import{styled as t}from"../../stitches.js";import{ActionIcon as c}from"../action-icon/ActionIcon.js";import{Icon as f}from"../icon/Icon.js";import{slideDownAndFade as $,slideLeftAndFade as
|
|
1
|
+
import{Close as r}from"@atom-learning/icons";import{Content as l,Arrow as p,Close as h}from"@radix-ui/react-popover";import*as e from"react";import{styled as t}from"../../stitches.js";import{ActionIcon as c}from"../action-icon/ActionIcon.js";import{Icon as f}from"../icon/Icon.js";import{slideDownAndFade as $,slideLeftAndFade as x,slideUpAndFade as g,slideRightAndFade as w}from"../../utilities/style/keyframe-animations.js";const b=t(l,{bg:"white",borderRadius:"$1",boxShadow:"$2",maxWidth:"90vw",p:"$sizes$2",pr:"$6",position:"relative","@allowMotion":{animationDuration:"75ms",animationTimingFunction:"cubic-bezier(0.16, 1, 0.3, 1)",willChange:"transform, opacity",'&[data-state="open"]':{'&[data-side="top"]':{animationName:$},'&[data-side="right"]':{animationName:x},'&[data-side="bottom"]':{animationName:g},'&[data-side="left"]':{animationName:w}}},variants:{size:{sm:{maxWidth:"200px"},md:{maxWidth:"400px"},lg:{maxWidth:"600px"}}}}),z=t(p,{fill:"white",zIndex:1,'[data-align="end"] &':{mr:"$sizes$2"},'[data-align="start"] &':{ml:"$sizes$2"}}),C=({children:i,side:o="top",sideOffset:a=8,closePopoverText:s="Close popover",showCloseButton:n=!0,size:m="md",...d})=>e.createElement(b,{size:m,side:o,sideOffset:a,...d},n&&e.createElement(c,{as:h,css:{position:"absolute",right:"$0",top:"$0"},label:s,size:"md",theme:"neutral"},e.createElement(f,{is:r})),i,e.createElement(z,{width:16,height:8}));export{C as PopoverContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Search as
|
|
1
|
+
import{Search as g,Close as w}from"@atom-learning/icons";import*as t from"react";import{ActionIcon as z}from"../action-icon/ActionIcon.js";import{Box as y}from"../box/Box.js";import{Icon as c}from"../icon/Icon.js";import{Input as I}from"../input/Input.js";import{styled as l}from"../../stitches.js";import{useCallbackRef as k}from"../../utilities/hooks/useCallbackRef.js";var H=(e=>(e.SEARCH="SEARCH",e.CLEAR="CLEAR",e))(H||{});const L=l(c,{color:"$tonal300",position:"absolute",pointerEvents:"none",variants:{size:{sm:{top:"$2",right:"$2",size:"$1"},md:{top:10,right:10,size:20}}}}),x=l(I,{'&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, & input[type="search"]::-webkit-search-results-decoration':{display:"none"}}),p=({size:e="md",css:u,value:n,clearText:m="Clear",onChange:a,...E})=>{const[h,C]=k(),[b,v]=t.useState(n||""),[f,d]=t.useState(n?"CLEAR":"SEARCH"),A=()=>{var r,i;const s=h.current;if(!s)return;const o=(r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value"))==null?void 0:r.set;(i=o==null?void 0:o.call)==null||i.call(o,s,"");const $=new Event("input",{bubbles:!0});s.dispatchEvent($),s.focus()},R=r=>{v(r.target.value),d(r.target.value?"CLEAR":"SEARCH"),a==null||a(r)},S=()=>f==="SEARCH"?t.createElement(L,{is:g,size:e,css:{size:e=="sm"?"$1":20}}):t.createElement(z,{label:m,theme:"neutral",size:e,css:{position:"absolute",top:"0",right:"$1"},onClick:A},t.createElement(c,{is:w}));return t.createElement(y,{css:{position:"relative",...u}},t.createElement(x,{ref:C,size:e,type:"search",...E,value:b,onChange:R,css:{pr:e==="sm"?"$5":"$6"}}),S())};p.displayName="SearchInput";export{p as SearchInput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ChevronLeft as P,ChevronRight as R}from"@atom-learning/icons";import{List as _}from"@radix-ui/react-tabs";import{opacify as
|
|
1
|
+
import{ChevronLeft as P,ChevronRight as R}from"@atom-learning/icons";import{List as _}from"@radix-ui/react-tabs";import{opacify as y}from"color2k";import o,{useRef as F,useState as f,useCallback as J,useEffect as k}from"react";import{debounce as K}from"throttle-debounce";import{ActionIcon as M}from"../action-icon/ActionIcon.js";import{Flex as X}from"../flex/Flex.js";import{Icon as W}from"../icon/Icon.js";import{theme as j,styled as x}from"../../stitches.js";import{TabTrigger as L}from"./TabTrigger.js";import{passPropsToChildren as C}from"./utils.js";const q=y("white",-.2),G=y(j.colors.primaryDark.value,-.2),T=x(M,{position:"absolute",transition:"all 125ms",variants:{theme:{light:{bg:`${q} !important`},dark:{bg:`${G} !important`,color:"currentColor !important"}},visible:{true:{opacity:1,visibility:"visible",pointerEvents:"all"},false:{opacity:0,visibility:"hidden",pointerEvents:"none"}}}}),S=x(_,{flexShrink:0,display:"flex",width:"100%",overflowX:"auto","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",variants:{theme:{light:{borderBottom:"1px solid $tonal300"},dark:{bg:"$primaryDark",borderBottom:"1px solid $tonal200"}},appearance:{uppercase:{"& button":{textTransform:"uppercase"}}}}}),H=({children:h,theme:i,appearance:d,enableTabScrolling:$,scrollPercentage:z=10,...b})=>{const s=F(null),[u,a]=f(!1),[v,c]=f(!1),[D,I]=f(),g=J(t=>{const e=s.current;if(e){const{scrollWidth:l,scrollLeft:n,offsetWidth:m}=e,E=Math.round(l*(z/100));let p=n;if(t==="right"){const r=n+E;p=r+m<=l?r:l-m}else{const r=n-E;p=r>0?r:0}e.scroll({left:p,behavior:"smooth"}),setTimeout(()=>{const{scrollWidth:r,scrollLeft:w,offsetWidth:A}=e,B=r-(w+A);w===0?(a(!1),c(!0)):B<5?(c(!1),a(!0)):(a(!0),c(!0))},500)}},[]);return k(()=>{const t=K(500,()=>{I(window.innerWidth)});return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[]),k(()=>{var t;const e=s.current;if(e){const{offsetWidth:l,scrollWidth:n}=e,m=n>l;(t=e.scroll)==null||t.call(e,{left:0}),a(!1),c(m)}},[D]),u||v||$?o.createElement(X,{css:{position:"relative"}},o.createElement(T,{size:"lg",label:"Scroll Left",theme:i,onClick:()=>g("left"),visible:u,css:{left:0}},o.createElement(W,{is:P})),o.createElement(S,{...b,ref:s,appearance:d,theme:i},C(h,{theme:i},[L])),o.createElement(T,{size:"lg",label:"Scroll right",theme:i,onClick:()=>g("right"),visible:v,css:{right:0}},o.createElement(W,{is:R}))):o.createElement(S,{theme:i,...b,appearance:d,ref:s},C(h,{theme:i},[L]))};export{H as TriggerListWrapper};
|