@atom-learning/components 1.2.3 → 1.3.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.
@@ -0,0 +1,273 @@
1
+ import React from 'react';
2
+ interface ListProps extends React.ComponentProps<typeof StyledTriggerList> {
3
+ enableTabScrolling?: boolean;
4
+ }
5
+ declare const StyledTriggerList: import("@stitches/react/types/styled-component").StyledComponent<React.ForwardRefExoticComponent<import("@radix-ui/react-tabs").TabsListProps & React.RefAttributes<HTMLDivElement>>, {
6
+ theme?: "dark" | "light" | undefined;
7
+ }, {
8
+ sm: string;
9
+ md: string;
10
+ lg: string;
11
+ xl: string;
12
+ reducedMotion: string;
13
+ allowMotion: string;
14
+ hover: string;
15
+ }, import("@stitches/react/types/css-util").CSS<{
16
+ sm: string;
17
+ md: string;
18
+ lg: string;
19
+ xl: string;
20
+ reducedMotion: string;
21
+ allowMotion: string;
22
+ hover: string;
23
+ }, {
24
+ colors: {
25
+ textForeground: any;
26
+ textSubtle: any;
27
+ textPlaceholder: any;
28
+ background: any;
29
+ backgroundAccent: any;
30
+ tonal50: any;
31
+ tonal100: any;
32
+ tonal200: any;
33
+ tonal300: any;
34
+ tonal400: any;
35
+ tonal500: any;
36
+ tonal600: any;
37
+ alpha100: any;
38
+ alpha150: any;
39
+ alpha200: any;
40
+ alpha250: any;
41
+ alpha600: any;
42
+ primaryLight: any;
43
+ primary: any;
44
+ primaryMid: any;
45
+ primaryDark: any;
46
+ secondary: any;
47
+ brandRed: any;
48
+ brandRedAccent: any;
49
+ brandGreen: any;
50
+ brandGreenAccent: any;
51
+ brandPurple: any;
52
+ brandPurpleAccent: any;
53
+ brandYellow: any;
54
+ brandYellowAccent: any;
55
+ successLight: any;
56
+ success: any;
57
+ successMid: any;
58
+ successDark: any;
59
+ dangerLight: any;
60
+ danger: any;
61
+ dangerMid: any;
62
+ dangerDark: any;
63
+ warningLight: any;
64
+ warning: any;
65
+ warningMid: any;
66
+ warningDark: any;
67
+ subjectEnglish: any;
68
+ subjectMaths: any;
69
+ subjectScience: any;
70
+ subjectVerbalReasoning: any;
71
+ subjectNonVerbalReasoning: any;
72
+ subjectCreativeWriting: any;
73
+ subjectExamSkills: any;
74
+ };
75
+ space: {
76
+ "0": any;
77
+ "1": any;
78
+ "2": any;
79
+ "3": any;
80
+ "4": any;
81
+ "5": any;
82
+ "6": any;
83
+ "7": any;
84
+ "8": any;
85
+ "9": any;
86
+ };
87
+ fontSizes: {
88
+ xs: any;
89
+ sm: any;
90
+ md: any;
91
+ lg: any;
92
+ xl: any;
93
+ "2xl": any;
94
+ "3xl": any;
95
+ "4xl": any;
96
+ };
97
+ fonts: {
98
+ sans: any;
99
+ mono: any;
100
+ display: any;
101
+ body: any;
102
+ };
103
+ sizes: {
104
+ "0": any;
105
+ "1": any;
106
+ "2": any;
107
+ "3": any;
108
+ "4": any;
109
+ "5": any;
110
+ "6": any;
111
+ "7": any;
112
+ "8": any;
113
+ };
114
+ radii: {
115
+ "0": any;
116
+ "1": any;
117
+ "2": any;
118
+ "3": any;
119
+ round: any;
120
+ };
121
+ shadows: {
122
+ "0": any;
123
+ "1": any;
124
+ "2": any;
125
+ "3": any;
126
+ };
127
+ }, import("@stitches/react/types/config").DefaultThemeMap, {
128
+ bg: (value: {
129
+ readonly [$$PropertyValue]: "background";
130
+ }) => {
131
+ background: {
132
+ readonly [$$PropertyValue]: "background";
133
+ };
134
+ };
135
+ inset: (value: string | number | {
136
+ readonly [$$ScaleValue]: "space";
137
+ }) => {
138
+ top: string | number | {
139
+ readonly [$$ScaleValue]: "space";
140
+ };
141
+ right: string | number | {
142
+ readonly [$$ScaleValue]: "space";
143
+ };
144
+ bottom: string | number | {
145
+ readonly [$$ScaleValue]: "space";
146
+ };
147
+ left: string | number | {
148
+ readonly [$$ScaleValue]: "space";
149
+ };
150
+ };
151
+ size: (value: string | number | {
152
+ readonly [$$ScaleValue]: "size";
153
+ }) => {
154
+ height: string | number | {
155
+ readonly [$$ScaleValue]: "size";
156
+ };
157
+ width: string | number | {
158
+ readonly [$$ScaleValue]: "size";
159
+ };
160
+ };
161
+ p: (value: string | number | {
162
+ readonly [$$ScaleValue]: "space";
163
+ }) => {
164
+ padding: string | number | {
165
+ readonly [$$ScaleValue]: "space";
166
+ };
167
+ };
168
+ pt: (value: string | number | {
169
+ readonly [$$ScaleValue]: "space";
170
+ }) => {
171
+ paddingTop: string | number | {
172
+ readonly [$$ScaleValue]: "space";
173
+ };
174
+ };
175
+ pr: (value: string | number | {
176
+ readonly [$$ScaleValue]: "space";
177
+ }) => {
178
+ paddingRight: string | number | {
179
+ readonly [$$ScaleValue]: "space";
180
+ };
181
+ };
182
+ pb: (value: string | number | {
183
+ readonly [$$ScaleValue]: "space";
184
+ }) => {
185
+ paddingBottom: string | number | {
186
+ readonly [$$ScaleValue]: "space";
187
+ };
188
+ };
189
+ pl: (value: string | number | {
190
+ readonly [$$ScaleValue]: "space";
191
+ }) => {
192
+ paddingLeft: string | number | {
193
+ readonly [$$ScaleValue]: "space";
194
+ };
195
+ };
196
+ px: (value: string | number | {
197
+ readonly [$$ScaleValue]: "space";
198
+ }) => {
199
+ paddingLeft: string | number | {
200
+ readonly [$$ScaleValue]: "space";
201
+ };
202
+ paddingRight: string | number | {
203
+ readonly [$$ScaleValue]: "space";
204
+ };
205
+ };
206
+ py: (value: string | number | {
207
+ readonly [$$ScaleValue]: "space";
208
+ }) => {
209
+ paddingTop: string | number | {
210
+ readonly [$$ScaleValue]: "space";
211
+ };
212
+ paddingBottom: string | number | {
213
+ readonly [$$ScaleValue]: "space";
214
+ };
215
+ };
216
+ m: (value: string | number | {
217
+ readonly [$$ScaleValue]: "space";
218
+ }) => {
219
+ margin: string | number | {
220
+ readonly [$$ScaleValue]: "space";
221
+ };
222
+ };
223
+ mt: (value: string | number | {
224
+ readonly [$$ScaleValue]: "space";
225
+ }) => {
226
+ marginTop: string | number | {
227
+ readonly [$$ScaleValue]: "space";
228
+ };
229
+ };
230
+ mr: (value: string | number | {
231
+ readonly [$$ScaleValue]: "space";
232
+ }) => {
233
+ marginRight: string | number | {
234
+ readonly [$$ScaleValue]: "space";
235
+ };
236
+ };
237
+ mb: (value: string | number | {
238
+ readonly [$$ScaleValue]: "space";
239
+ }) => {
240
+ marginBottom: string | number | {
241
+ readonly [$$ScaleValue]: "space";
242
+ };
243
+ };
244
+ ml: (value: string | number | {
245
+ readonly [$$ScaleValue]: "space";
246
+ }) => {
247
+ marginLeft: string | number | {
248
+ readonly [$$ScaleValue]: "space";
249
+ };
250
+ };
251
+ mx: (value: string | number | {
252
+ readonly [$$ScaleValue]: "space";
253
+ }) => {
254
+ marginLeft: string | number | {
255
+ readonly [$$ScaleValue]: "space";
256
+ };
257
+ marginRight: string | number | {
258
+ readonly [$$ScaleValue]: "space";
259
+ };
260
+ };
261
+ my: (value: string | number | {
262
+ readonly [$$ScaleValue]: "space";
263
+ }) => {
264
+ marginTop: string | number | {
265
+ readonly [$$ScaleValue]: "space";
266
+ };
267
+ marginBottom: string | number | {
268
+ readonly [$$ScaleValue]: "space";
269
+ };
270
+ };
271
+ }>>;
272
+ export declare const TriggerListWrapper: React.FC<ListProps>;
273
+ export {};
@@ -0,0 +1 @@
1
+ const e=["children","theme","enableTabScrolling"];import{List as t}from"@radix-ui/react-tabs";import i,{useRef as o,useState as r,useCallback as l,useEffect as n}from"react";import{ChevronLeft as s,ChevronRight as c}from"@atom-learning/icons";import{opacify as a}from"polished";import{debounce as m}from"throttle-debounce";import{theme as f,styled as h}from"../../stitches.js";import{ActionIcon as d}from"../action-icon/ActionIcon.js";import{Flex as b}from"../flex/Flex.js";import{Icon as p}from"../icon/Icon.js";import{TabTrigger as u}from"./TabTrigger.js";import{passPropsToChildren as g}from"./utils.js";const v=h(d,{position:"absolute",transition:"all 125ms",variants:{theme:{light:{bg:`${a(-.2,"white")} !important`},dark:{bg:`${a(-.2,f.colors.primaryDark.value)} !important`,color:"currentColor !important"}},visible:{true:{opacity:1,visibility:"visible",pointerEvents:"all"},false:{opacity:0,visibility:"hidden",pointerEvents:"none"}}}}),w=h(t,{flexShrink:0,display:"flex",width:"100%",overflowX:"auto","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",variants:{theme:{light:{borderBottom:"1px solid $tonal300"},dark:{borderBottom:"1px solid $tonal200"}}}}),x=t=>{let{children:a,theme:f,enableTabScrolling:h}=t,d=function(e,t){if(null==e)return{};var i,o,r={},l=Object.keys(e);for(o=0;o<l.length;o++)i=l[o],t.indexOf(i)>=0||(r[i]=e[i]);return r}(t,e);const x=o(null),[E,j]=r(!1),[k,y]=r(!1),[W,z]=r(window.innerWidth),L=l((e=>{const t=x.current;if(t){const{scrollWidth:i,scrollLeft:o}=t,r=Math.round(i/4);let l=o;if("right"===e){const e=t.scrollLeft+r;l=e<=i?e:o}else{const e=o-r;l=e>0?e:0}t.scroll({left:l,behavior:"smooth"}),setTimeout((()=>{const{scrollWidth:e,scrollLeft:i,offsetWidth:o}=t;0===i?(j(!1),y(!0)):i+o===e?(y(!1),j(!0)):(j(!0),y(!0))}),500)}}),[]);n((()=>{const e=m((()=>{z(window.innerWidth)}),500);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),n((()=>{const e=x.current;if(e){const{offsetWidth:t,scrollWidth:i}=e,o=i>t;null==e.scroll||e.scroll({left:0}),j(!1),y(o)}}),[W]);return E||k||h?i.createElement(b,{css:{position:"relative"}},i.createElement(v,{size:"xl",label:"Scroll Left",theme:f,onClick:()=>L("left"),visible:E,css:{left:0}},i.createElement(p,{is:s,size:"lg"})),i.createElement(w,Object.assign({},d,{ref:x,theme:f}),g(a,{theme:f},[u])),i.createElement(v,{size:"xl",label:"Scroll right",theme:f,onClick:()=>L("right"),visible:k,css:{right:0}},i.createElement(p,{is:c,size:"lg"}))):i.createElement(w,Object.assign({theme:f},d,{ref:x}),g(a,{theme:f},[u]))};export{x as TriggerListWrapper};
@@ -0,0 +1,2 @@
1
+ import { JSXElementConstructor } from 'react';
2
+ export declare const passPropsToChildren: (children: any, props: Record<string, any>, allowedChildNodeTypes?: JSXElementConstructor<any>[]) => any;
@@ -0,0 +1 @@
1
+ function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}import e from"react";const n=(n,r,o=[])=>e.Children.map(n,(n=>e.isValidElement(n)&&o.includes(null==n?void 0:n.type)?e.cloneElement(n,t({},r)):n));export{n as passPropsToChildren};