@atom-learning/components 1.6.3 → 1.6.6

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.
@@ -1,274 +1,10 @@
1
+ import { Root } from '@radix-ui/react-accordion';
2
+ import React from 'react';
3
+ import { AccordionContent } from './AccordionContent';
1
4
  import { AccordionItem } from './AccordionItem';
2
5
  import { AccordionTrigger } from './AccordionTrigger';
3
- import { AccordionContent } from './AccordionContent';
4
- import React from 'react';
5
- declare const StyledRoot: import("@stitches/react/types/styled-component").StyledComponent<React.ForwardRefExoticComponent<(import("@radix-ui/react-accordion").AccordionSingleProps & React.RefAttributes<HTMLDivElement>) | (import("@radix-ui/react-accordion").AccordionMultipleProps & React.RefAttributes<HTMLDivElement>)>, {}, {
6
- sm: string;
7
- md: string;
8
- lg: string;
9
- xl: string;
10
- reducedMotion: string;
11
- allowMotion: string;
12
- hover: string;
13
- }, import("@stitches/react/types/css-util").CSS<{
14
- sm: string;
15
- md: string;
16
- lg: string;
17
- xl: string;
18
- reducedMotion: string;
19
- allowMotion: string;
20
- hover: string;
21
- }, {
22
- colors: {
23
- textForeground: any;
24
- textSubtle: any;
25
- textPlaceholder: any;
26
- background: any;
27
- backgroundAccent: any;
28
- tonal50: any;
29
- tonal100: any;
30
- tonal200: any;
31
- tonal300: any;
32
- tonal400: any;
33
- tonal500: any;
34
- tonal600: any;
35
- alpha100: any;
36
- alpha150: any;
37
- alpha200: any;
38
- alpha250: any;
39
- alpha600: any;
40
- primaryLight: any;
41
- primary: any;
42
- primaryMid: any;
43
- primaryDark: any;
44
- secondary: any;
45
- brandRed: any;
46
- brandRedAccent: any;
47
- brandGreen: any;
48
- brandGreenAccent: any;
49
- brandPurple: any;
50
- brandPurpleAccent: any;
51
- brandYellow: any;
52
- brandYellowAccent: any;
53
- successLight: any;
54
- success: any;
55
- successMid: any;
56
- successDark: any;
57
- dangerLight: any;
58
- danger: any;
59
- dangerMid: any;
60
- dangerDark: any;
61
- warningLight: any;
62
- warning: any;
63
- warningMid: any;
64
- warningDark: any;
65
- subjectEnglish: any;
66
- subjectMaths: any;
67
- subjectScience: any;
68
- subjectVerbalReasoning: any;
69
- subjectNonVerbalReasoning: any;
70
- subjectCreativeWriting: any;
71
- subjectExamSkills: any;
72
- };
73
- space: {
74
- "0": any;
75
- "1": any;
76
- "2": any;
77
- "3": any;
78
- "4": any;
79
- "5": any;
80
- "6": any;
81
- "7": any;
82
- "8": any;
83
- "9": any;
84
- };
85
- fontSizes: {
86
- xs: any;
87
- sm: any;
88
- md: any;
89
- lg: any;
90
- xl: any;
91
- "2xl": any;
92
- "3xl": any;
93
- "4xl": any;
94
- };
95
- fonts: {
96
- sans: any;
97
- mono: any;
98
- display: any;
99
- body: any;
100
- };
101
- sizes: {
102
- "0": any;
103
- "1": any;
104
- "2": any;
105
- "3": any;
106
- "4": any;
107
- "5": any;
108
- "6": any;
109
- "7": any;
110
- "8": any;
111
- };
112
- radii: {
113
- "0": any;
114
- "1": any;
115
- "2": any;
116
- "3": any;
117
- round: any;
118
- };
119
- shadows: {
120
- "0": any;
121
- "1": any;
122
- "2": any;
123
- "3": any;
124
- };
125
- }, import("@stitches/react/types/config").DefaultThemeMap, {
126
- bg: (value: {
127
- readonly [$$PropertyValue]: "background";
128
- }) => {
129
- background: {
130
- readonly [$$PropertyValue]: "background";
131
- };
132
- };
133
- inset: (value: string | number | {
134
- readonly [$$ScaleValue]: "space";
135
- }) => {
136
- top: string | number | {
137
- readonly [$$ScaleValue]: "space";
138
- };
139
- right: string | number | {
140
- readonly [$$ScaleValue]: "space";
141
- };
142
- bottom: string | number | {
143
- readonly [$$ScaleValue]: "space";
144
- };
145
- left: string | number | {
146
- readonly [$$ScaleValue]: "space";
147
- };
148
- };
149
- size: (value: string | number | {
150
- readonly [$$ScaleValue]: "size";
151
- }) => {
152
- height: string | number | {
153
- readonly [$$ScaleValue]: "size";
154
- };
155
- width: string | number | {
156
- readonly [$$ScaleValue]: "size";
157
- };
158
- };
159
- p: (value: string | number | {
160
- readonly [$$ScaleValue]: "space";
161
- }) => {
162
- padding: string | number | {
163
- readonly [$$ScaleValue]: "space";
164
- };
165
- };
166
- pt: (value: string | number | {
167
- readonly [$$ScaleValue]: "space";
168
- }) => {
169
- paddingTop: string | number | {
170
- readonly [$$ScaleValue]: "space";
171
- };
172
- };
173
- pr: (value: string | number | {
174
- readonly [$$ScaleValue]: "space";
175
- }) => {
176
- paddingRight: string | number | {
177
- readonly [$$ScaleValue]: "space";
178
- };
179
- };
180
- pb: (value: string | number | {
181
- readonly [$$ScaleValue]: "space";
182
- }) => {
183
- paddingBottom: string | number | {
184
- readonly [$$ScaleValue]: "space";
185
- };
186
- };
187
- pl: (value: string | number | {
188
- readonly [$$ScaleValue]: "space";
189
- }) => {
190
- paddingLeft: string | number | {
191
- readonly [$$ScaleValue]: "space";
192
- };
193
- };
194
- px: (value: string | number | {
195
- readonly [$$ScaleValue]: "space";
196
- }) => {
197
- paddingLeft: string | number | {
198
- readonly [$$ScaleValue]: "space";
199
- };
200
- paddingRight: string | number | {
201
- readonly [$$ScaleValue]: "space";
202
- };
203
- };
204
- py: (value: string | number | {
205
- readonly [$$ScaleValue]: "space";
206
- }) => {
207
- paddingTop: string | number | {
208
- readonly [$$ScaleValue]: "space";
209
- };
210
- paddingBottom: string | number | {
211
- readonly [$$ScaleValue]: "space";
212
- };
213
- };
214
- m: (value: string | number | {
215
- readonly [$$ScaleValue]: "space";
216
- }) => {
217
- margin: string | number | {
218
- readonly [$$ScaleValue]: "space";
219
- };
220
- };
221
- mt: (value: string | number | {
222
- readonly [$$ScaleValue]: "space";
223
- }) => {
224
- marginTop: string | number | {
225
- readonly [$$ScaleValue]: "space";
226
- };
227
- };
228
- mr: (value: string | number | {
229
- readonly [$$ScaleValue]: "space";
230
- }) => {
231
- marginRight: string | number | {
232
- readonly [$$ScaleValue]: "space";
233
- };
234
- };
235
- mb: (value: string | number | {
236
- readonly [$$ScaleValue]: "space";
237
- }) => {
238
- marginBottom: string | number | {
239
- readonly [$$ScaleValue]: "space";
240
- };
241
- };
242
- ml: (value: string | number | {
243
- readonly [$$ScaleValue]: "space";
244
- }) => {
245
- marginLeft: string | number | {
246
- readonly [$$ScaleValue]: "space";
247
- };
248
- };
249
- mx: (value: string | number | {
250
- readonly [$$ScaleValue]: "space";
251
- }) => {
252
- marginLeft: string | number | {
253
- readonly [$$ScaleValue]: "space";
254
- };
255
- marginRight: string | number | {
256
- readonly [$$ScaleValue]: "space";
257
- };
258
- };
259
- my: (value: string | number | {
260
- readonly [$$ScaleValue]: "space";
261
- }) => {
262
- marginTop: string | number | {
263
- readonly [$$ScaleValue]: "space";
264
- };
265
- marginBottom: string | number | {
266
- readonly [$$ScaleValue]: "space";
267
- };
268
- };
269
- }>>;
270
- declare type AccordionProps = React.ComponentProps<typeof StyledRoot> & {
271
- type: 'single';
6
+ declare type AccordionProps = React.ComponentProps<typeof Root> & {
7
+ type: 'single' | 'multiple';
272
8
  };
273
9
  export declare const Accordion: React.FC<AccordionProps> & {
274
10
  Item: typeof AccordionItem;
@@ -1 +1 @@
1
- import{Root as i}from"@radix-ui/react-accordion";import{AccordionItem as m}from"./AccordionItem.js";import{AccordionTrigger as c}from"./AccordionTrigger.js";import{AccordionContent as n}from"./AccordionContent.js";import d from"react";import{styled as p}from"../../stitches.js";const f=p(i,{width:"100%"}),o=({type:r="single",children:t,...e})=>d.createElement(f,{type:r,...e},t);o.Item=m,o.Content=n,o.Trigger=c,o.displayName="Accordion";export{o as Accordion};
1
+ import{Root as i}from"@radix-ui/react-accordion";import m from"react";import{styled as c}from"../../stitches.js";import{AccordionContent as n}from"./AccordionContent.js";import{AccordionItem as d}from"./AccordionItem.js";import{AccordionTrigger as p}from"./AccordionTrigger.js";const f=c(i,{width:"100%"}),o=({type:r="single",children:t,...e})=>m.createElement(f,{type:r,...e},t);o.Item=d,o.Content=n,o.Trigger=p,o.displayName="Accordion";export{o as Accordion};
@@ -1 +1 @@
1
- import{Trigger as s}from"@radix-ui/react-accordion";import a from"react";import{Box as l}from"../box/Box.js";import{Icon as f}from"../icon/Icon.js";import{ChevronDown as d}from"@atom-learning/icons";import{styled as c,theme as i}from"../../stitches.js";import{darken as r}from"polished";const n=(t,e,o,m="#fff")=>({bg:t,color:m,"&[disabled]":{bg:"$tonal100",cursor:"not-allowed",color:"$tonal400"},"&:not([disabled]):hover":{bg:e},"&:not([disabled]):active":{bg:o}}),g=c(s,{border:0,py:"$3",px:"$4",width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",'&[data-state="open"]':{borderRadius:"$0 $0 0 0","& svg":{transition:"transform 300ms",transform:"rotate(180deg)"}},'&[data-state="closed"]':{borderRadius:"$0","& svg":{transition:"transform 300ms",transform:"rotate(0deg)"}},variants:{theme:{primaryDark:n("$primaryDark",r(.1,i.colors.primaryDark.value),r(.15,i.colors.primaryDark.value)),light:n("#fff",r(.1,"#fff"),r(.15,"#fff"),"$tonal600")}}}),p=({theme:t="primaryDark",children:e,...o})=>a.createElement(g,{theme:t,...o},a.createElement(l,null,e),a.createElement(f,{is:d}));export{p as AccordionTrigger};
1
+ import{ChevronDown as d}from"@atom-learning/icons";import{Trigger as l}from"@radix-ui/react-accordion";import{darken as r}from"polished";import a from"react";import{styled as i,theme as n}from"../../stitches.js";import{Icon as f}from"../icon/Icon.js";const s=(t,e,o,m="#fff")=>({bg:t,color:m,"&[disabled]":{bg:"$tonal100",cursor:"not-allowed",color:"$tonal400"},"&:not([disabled]):hover":{bg:e},"&:not([disabled]):active":{bg:o}}),c=i(f,{transition:"transform 300ms",'[data-state="open"] > &':{transform:"rotate(180deg)"},'[data-state="closed"] > &':{transform:"rotate(0deg)"}}),p=i(l,{border:0,py:"$3",px:"$4",width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",'&[data-state="open"]':{borderRadius:"$0 $0 0 0"},'&[data-state="closed"]':{borderRadius:"$0"},variants:{theme:{primaryDark:s("$primaryDark",r(.1,n.colors.primaryDark.value),r(.15,n.colors.primaryDark.value)),light:s("#fff",r(.1,"#fff"),r(.15,"#fff"),"$tonal600")}}}),g=({theme:t="primaryDark",children:e,...o})=>a.createElement(p,{theme:t,...o},e,a.createElement(c,{is:d}));export{g as AccordionTrigger};
@@ -1 +1 @@
1
- import{darken as c,opacify as i}from"polished";import{forwardRef as f,createElement as n,Children as w,cloneElement as k,Fragment as v}from"react";import{Box as S}from"../box/Box.js";import{Icon as D}from"../icon/Icon.js";import{Loader as x}from"../loader/Loader.js";import{styled as C,theme as l}from"../../stitches.js";const p=(e,o,t)=>({border:"1px solid",borderColor:"currentColor",color:e,"&[disabled]":{borderColor:"$tonal400",color:"$tonal400",cursor:"not-allowed"},"&:not([disabled]):hover, &:not([disabled]):focus":{textDecoration:"none",color:o},"&:not([disabled]):active":{color:t}}),a=(e,o,t,r="white")=>({bg:e,color:r,"&[disabled]":{bg:"$tonal100",color:"$tonal400",cursor:"not-allowed"},"&:not([disabled]):hover, &:not([disabled]):focus":{bg:o,color:r},"&:not([disabled]):active":{bg:t}}),d=C("button",{alignItems:"center",bg:"unset",border:"unset",borderRadius:"$0",cursor:"pointer",display:"flex",fontFamily:"$body",fontWeight:600,justifyContent:"center",p:"unset",textDecoration:"none",transition:"all 100ms ease-out",whiteSpace:"nowrap",width:"max-content",variants:{theme:{primary:{},secondary:{},success:{},warning:{},danger:{},neutral:{}},appearance:{solid:{},outline:{}},size:{sm:{fontSize:"$sm",lineHeight:1.53,height:"$3",px:"$4"},md:{fontSize:"$md",lineHeight:1.5,height:"$4",px:"$5"},lg:{fontSize:"$lg",lineHeight:1.5,height:"$5",px:"$5"}},isLoading:{true:{cursor:"not-allowed",opacity:.6,pointerEvents:"none"}},fullWidth:{true:{width:"100%"}},isRounded:{true:{borderRadius:"$round"}}},compoundVariants:[{theme:"primary",appearance:"solid",css:a("$primary","$primaryMid","$primaryDark")},{theme:"secondary",appearance:"solid",css:a("$primaryDark",c(.1,l.colors.primaryDark.value),c(.15,l.colors.primaryDark.value))},{theme:"success",appearance:"solid",css:a("$success","$successMid","$successDark")},{theme:"warning",appearance:"solid",css:a("$warning","$warningMid","$warningDark","$tonal500")},{theme:"danger",appearance:"solid",css:a("$danger","$dangerMid","$dangerDark")},{theme:"neutral",appearance:"solid",css:a("white",i(-.1,"white"),i(-.25,"white"),"$primary")},{theme:"primary",appearance:"outline",css:p("$primary","$primaryMid","$primaryDark")},{theme:"neutral",appearance:"outline",css:p("white",i(-.2,"white"),i(-.35,"white"))}]}),B=({isLoading:e,children:o})=>n(v,null,n(x,{css:{opacity:e?1:0,position:"absolute",transition:"opacity 150ms"}}),n(S,{as:"span",css:e?{opacity:0,transition:"opacity 150ms"}:{}},o)),M=e=>{switch(e){case"lg":return 22;case"md":return 20;case"sm":default:return 16}},m=(e,o)=>w.map(e,(t,r)=>(t==null?void 0:t.type)===D?k(t,{css:{[r===0?"mr":"ml"]:o==="sm"?"$2":"$3",size:M(o),...t.props.css?t.props.css:{}}}):t),u=f(({children:e,isLoading:o,onClick:t,href:r,appearance:$="solid",size:s="md",theme:h="primary",type:y="button",...g},b)=>n(d,{isLoading:o||!1,onClick:o?void 0:t,appearance:$,size:s,theme:h,...g,...r?{as:"a",href:r,onClick:void 0}:{},...r?{}:{type:y},ref:b},typeof o=="boolean"?n(B,{isLoading:o},m(e,s)):m(e,s)));u.displayName="Button";export{u as Button,d as StyledButton};
1
+ import{darken as i,opacify as s}from"polished";import{forwardRef as f,createElement as n,Children as w,cloneElement as k,Fragment as v}from"react";import{Box as D}from"../box/Box.js";import{Icon as S}from"../icon/Icon.js";import{Loader as x}from"../loader/Loader.js";import{styled as C,theme as c}from"../../stitches.js";const p=(e,r,o)=>({border:"1px solid",borderColor:"currentColor",color:e,"&[disabled]":{borderColor:"$tonal400",color:"$tonal400",cursor:"not-allowed"},"&:not([disabled]):hover, &:not([disabled]):focus":{textDecoration:"none",color:r},"&:not([disabled]):active":{color:o}}),a=(e,r,o,t="white")=>({bg:e,color:t,"&[disabled]":{bg:"$tonal100",color:"$tonal400",cursor:"not-allowed"},"&:not([disabled]):hover, &:not([disabled]):focus":{bg:r,color:t},"&:not([disabled]):active":{bg:o}}),d=C("button",{alignItems:"center",bg:"unset",border:"unset",borderRadius:"$0",cursor:"pointer",display:"flex",fontFamily:"$body",fontWeight:600,justifyContent:"center",p:"unset",textDecoration:"none",transition:"all 100ms ease-out",whiteSpace:"nowrap",width:"max-content",variants:{theme:{primary:{},secondary:{},success:{},warning:{},danger:{},neutral:{}},appearance:{solid:{},outline:{}},size:{sm:{fontSize:"$sm",lineHeight:1.53,height:"$3",px:"$4"},md:{fontSize:"$md",lineHeight:1.5,height:"$4",px:"$5"},lg:{fontSize:"$lg",lineHeight:1.5,height:"$5",px:"$5"}},isLoading:{true:{cursor:"not-allowed",opacity:.6,pointerEvents:"none"}},fullWidth:{true:{width:"100%"}},isRounded:{true:{borderRadius:"$round"}}},compoundVariants:[{theme:"primary",appearance:"solid",css:a("$primary","$primaryMid","$primaryDark")},{theme:"secondary",appearance:"solid",css:a("$primaryDark",i(.1,c.colors.primaryDark.value),i(.15,c.colors.primaryDark.value))},{theme:"success",appearance:"solid",css:a("$success","$successMid","$successDark")},{theme:"warning",appearance:"solid",css:a("$warning","$warningMid","$warningDark","$tonal500")},{theme:"danger",appearance:"solid",css:a("$danger","$dangerMid","$dangerDark")},{theme:"neutral",appearance:"solid",css:a("white",s(-.1,"white"),s(-.25,"white"),"$primary")},{theme:"primary",appearance:"outline",css:p("$primary","$primaryMid","$primaryDark")},{theme:"neutral",appearance:"outline",css:p("white",s(-.2,"white"),s(-.35,"white"))},{theme:"secondary",appearance:"outline",css:p("$primaryDark",i(.1,c.colors.primaryDark.value),i(.15,c.colors.primaryDark.value))}]}),B=({isLoading:e,children:r})=>n(v,null,n(x,{css:{opacity:e?1:0,position:"absolute",transition:"opacity 150ms"}}),n(D,{as:"span",css:e?{opacity:0,transition:"opacity 150ms"}:{}},r)),M=e=>{switch(e){case"lg":return 22;case"md":return 20;case"sm":default:return 16}},m=(e,r)=>w.map(e,(o,t)=>(o==null?void 0:o.type)===S?k(o,{css:{[t===0?"mr":"ml"]:r==="sm"?"$2":"$3",size:M(r),...o.props.css?o.props.css:{}}}):o),u=f(({children:e,isLoading:r,onClick:o,href:t,appearance:$="solid",size:l="md",theme:y="primary",type:h="button",...g},b)=>n(d,{isLoading:r||!1,onClick:r?void 0:o,appearance:$,size:l,theme:y,...g,...t?{as:"a",href:t,onClick:void 0}:{},...t?{}:{type:h},ref:b},typeof r=="boolean"?n(B,{isLoading:r},m(e,l)):m(e,l)));u.displayName="Button";export{u as Button,d as StyledButton};
@@ -1,2 +1,3 @@
1
1
  import * as React from 'react';
2
- export declare const StepperSteps: React.FC;
2
+ import { IStepperStepsProps } from './types';
3
+ export declare const StepperSteps: React.FC<IStepperStepsProps>;
@@ -1 +1 @@
1
- import{createElement as i}from"react";import{styled as m}from"../../stitches.js";import{Flex as l}from"../flex/Flex.js";import{useStepper as h}from"./stepper-context/StepperContext.js";const g=m(l,{position:"relative",p:"$2",justifyContent:"center",alignItems:"center",width:"$2",height:"$2",borderRadius:"50%",border:"none",bg:"$tonal50",fontFamily:"$body",fontWeight:400,fontSize:"$sm","&:not(:first-child)":{ml:"$3"},"&:not(:last-child)::after":{content:"",width:"$1",height:"1px",position:"absolute",left:"$sizes$2"},variants:{state:{normal:{bg:"$tonal50",color:"$tonal400"},active:{bg:"$primary",color:"white"},viewed:{bg:"$primaryDark",color:"white"}},separator:{normal:{"&:not(:last-child)::after":{bg:"$tonal50"}},highlight:{"&:not(:last-child)::after":{bg:"$primaryDark"}}}}}),u=()=>{const{steps:s,goToStep:n,activeStep:a,viewedSteps:r,allowSkip:o}=h(),p=e=>a===e?"active":r.includes(e)?"viewed":"normal",c=e=>e<Math.max(...r)?"highlight":"normal";return i(l,{css:{alignItems:"center"}},s.map((e,t)=>i(g,{key:`step_${t}`,as:o?"button":"div",onClick:()=>o&&r.includes(t)?n(t):void 0,state:p(t),separator:c(t),"aria-current":t===a?"step":void 0,"aria-label":`step ${t+1}`,css:{cursor:o&&r.includes(t)?"pointer":"auto"}},t+1)))};export{u as StepperSteps};
1
+ import{createElement as n}from"react";import{styled as $}from"../../stitches.js";import{Flex as s}from"../flex/Flex.js";import{useStepper as g}from"./stepper-context/StepperContext.js";const u=$(s,{position:"relative",p:"$2",justifyContent:"center",alignItems:"center",width:"$2",height:"$2",borderRadius:"50%",border:"none",bg:"$tonal50",fontFamily:"$body",fontWeight:400,fontSize:"$sm","&:not(:first-child)":{ml:"$3"},"&:not(:last-child)::after":{content:"",height:"1px",position:"absolute",left:"$sizes$2"},variants:{state:{normal:{bg:"$tonal50",color:"$tonal400"},active:{bg:"$primary",color:"white"},viewed:{bg:"$primaryDark",color:"white"}},separator:{normal:{"&:not(:last-child)::after":{bg:"$tonal50"}},highlight:{"&:not(:last-child)::after":{bg:"$primaryDark"}}}}}),f=({css:r,...p})=>{const{steps:a,goToStep:c,activeStep:l,viewedSteps:o,allowSkip:i}=g(),h=e=>l===e?"active":o.includes(e)?"viewed":"normal",m=e=>e<Math.max(...o)?"highlight":"normal";return n(s,{css:{alignItems:"center",justifyContent:"space-between",...r},...p},a.map((e,t)=>n(u,{key:`step_${t}`,as:i?"button":"div",onClick:()=>i&&o.includes(t)?c(t):void 0,state:h(t),separator:m(t),"aria-current":t===l?"step":void 0,"aria-label":`step ${t+1}`,css:{cursor:i&&o.includes(t)?"pointer":"auto","&:not(:last-child)::after":{width:(r==null?void 0:r.width)?`calc((${r.width} - ($2 * ${a.length})) / ${a.length-1})`:"$1"}}},t+1)))};export{f as StepperSteps};
@@ -1,3 +1,4 @@
1
+ import { CSS } from '../../stitches';
1
2
  export declare type Context = {
2
3
  steps: unknown[];
3
4
  goToPreviousStep: () => void;
@@ -22,3 +23,7 @@ export interface IStepperProps {
22
23
  export interface IStepperNavigateProps {
23
24
  label?: (currentStep?: number) => string;
24
25
  }
26
+ export interface IStepperStepsProps {
27
+ css?: CSS;
28
+ stepsWidth?: string;
29
+ }