@atom-learning/components 1.4.0 → 1.5.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.
Files changed (45) hide show
  1. package/dist/components/calendar/Calendar.d.ts +19 -0
  2. package/dist/components/calendar/Calendar.js +1 -0
  3. package/dist/components/calendar/Day.d.ts +269 -0
  4. package/dist/components/calendar/Day.js +1 -0
  5. package/dist/components/calendar/constants.d.ts +2 -0
  6. package/dist/components/calendar/constants.js +1 -0
  7. package/dist/components/date-field/DateField.d.ts +17 -0
  8. package/dist/components/date-field/DateField.js +1 -0
  9. package/dist/components/date-field/index.d.ts +1 -0
  10. package/dist/components/date-input/DateInput.d.ts +17 -0
  11. package/dist/components/date-input/DateInput.js +1 -0
  12. package/dist/components/date-input/constants.d.ts +1 -0
  13. package/dist/components/date-input/constants.js +1 -0
  14. package/dist/components/date-input/index.d.ts +1 -0
  15. package/dist/components/date-input/use-date.d.ts +5 -0
  16. package/dist/components/date-input/use-date.js +1 -0
  17. package/dist/components/dialog/DialogContent.d.ts +1 -0
  18. package/dist/components/dialog/DialogContent.js +1 -1
  19. package/dist/components/index.d.ts +5 -1
  20. package/dist/components/popover/PopoverContent.d.ts +1 -0
  21. package/dist/components/popover/PopoverContent.js +1 -1
  22. package/dist/components/search-input/SearchInput.d.ts +3 -1
  23. package/dist/components/search-input/SearchInput.js +1 -1
  24. package/dist/components/slider/Slider.d.ts +276 -0
  25. package/dist/components/slider/Slider.js +1 -0
  26. package/dist/components/slider/SliderSteps.d.ts +13 -0
  27. package/dist/components/slider/SliderSteps.js +1 -0
  28. package/dist/components/slider/SliderValue.d.ts +9 -0
  29. package/dist/components/slider/SliderValue.js +1 -0
  30. package/dist/components/slider/index.d.ts +1 -0
  31. package/dist/components/slider-field/SliderField.d.ts +13 -0
  32. package/dist/components/slider-field/SliderField.js +1 -0
  33. package/dist/components/slider-field/index.d.ts +1 -0
  34. package/dist/components/text/Text.js +1 -1
  35. package/dist/docgen.json +1 -1
  36. package/dist/docs/DateField.mdx +20 -0
  37. package/dist/docs/DateInput.mdx +81 -0
  38. package/dist/docs/Dialog.mdx +16 -1
  39. package/dist/docs/RadioButton.mdx +1 -1
  40. package/dist/docs/SearchInput.mdx +2 -1
  41. package/dist/docs/Slider.mdx +117 -0
  42. package/dist/docs/SliderField.mdx +35 -0
  43. package/dist/index.cjs.js +1 -1
  44. package/dist/index.js +1 -1
  45. package/package.json +5 -1
@@ -0,0 +1,276 @@
1
+ import * as React from 'react';
2
+ import { SliderSteps } from './SliderSteps';
3
+ import { SliderValue } from './SliderValue';
4
+ declare const StyledSlider: import("@stitches/react/types/styled-component").StyledComponent<React.ForwardRefExoticComponent<import("@radix-ui/react-slider").SliderProps & React.RefAttributes<HTMLSpanElement>>, {
5
+ theme?: "light" | "tonal" | undefined;
6
+ }, {
7
+ sm: string;
8
+ md: string;
9
+ lg: string;
10
+ xl: string;
11
+ reducedMotion: string;
12
+ allowMotion: string;
13
+ hover: string;
14
+ }, import("@stitches/react/types/css-util").CSS<{
15
+ sm: string;
16
+ md: string;
17
+ lg: string;
18
+ xl: string;
19
+ reducedMotion: string;
20
+ allowMotion: string;
21
+ hover: string;
22
+ }, {
23
+ colors: {
24
+ textForeground: any;
25
+ textSubtle: any;
26
+ textPlaceholder: any;
27
+ background: any;
28
+ backgroundAccent: any;
29
+ tonal50: any;
30
+ tonal100: any;
31
+ tonal200: any;
32
+ tonal300: any;
33
+ tonal400: any;
34
+ tonal500: any;
35
+ tonal600: any;
36
+ alpha100: any;
37
+ alpha150: any;
38
+ alpha200: any;
39
+ alpha250: any;
40
+ alpha600: any;
41
+ primaryLight: any;
42
+ primary: any;
43
+ primaryMid: any;
44
+ primaryDark: any;
45
+ secondary: any;
46
+ brandRed: any;
47
+ brandRedAccent: any;
48
+ brandGreen: any;
49
+ brandGreenAccent: any;
50
+ brandPurple: any;
51
+ brandPurpleAccent: any;
52
+ brandYellow: any;
53
+ brandYellowAccent: any;
54
+ successLight: any;
55
+ success: any;
56
+ successMid: any;
57
+ successDark: any;
58
+ dangerLight: any;
59
+ danger: any;
60
+ dangerMid: any;
61
+ dangerDark: any;
62
+ warningLight: any;
63
+ warning: any;
64
+ warningMid: any;
65
+ warningDark: any;
66
+ subjectEnglish: any;
67
+ subjectMaths: any;
68
+ subjectScience: any;
69
+ subjectVerbalReasoning: any;
70
+ subjectNonVerbalReasoning: any;
71
+ subjectCreativeWriting: any;
72
+ subjectExamSkills: any;
73
+ };
74
+ space: {
75
+ "0": any;
76
+ "1": any;
77
+ "2": any;
78
+ "3": any;
79
+ "4": any;
80
+ "5": any;
81
+ "6": any;
82
+ "7": any;
83
+ "8": any;
84
+ "9": any;
85
+ };
86
+ fontSizes: {
87
+ xs: any;
88
+ sm: any;
89
+ md: any;
90
+ lg: any;
91
+ xl: any;
92
+ "2xl": any;
93
+ "3xl": any;
94
+ "4xl": any;
95
+ };
96
+ fonts: {
97
+ sans: any;
98
+ mono: any;
99
+ display: any;
100
+ body: any;
101
+ };
102
+ sizes: {
103
+ "0": any;
104
+ "1": any;
105
+ "2": any;
106
+ "3": any;
107
+ "4": any;
108
+ "5": any;
109
+ "6": any;
110
+ "7": any;
111
+ "8": any;
112
+ };
113
+ radii: {
114
+ "0": any;
115
+ "1": any;
116
+ "2": any;
117
+ "3": any;
118
+ round: any;
119
+ };
120
+ shadows: {
121
+ "0": any;
122
+ "1": any;
123
+ "2": any;
124
+ "3": any;
125
+ };
126
+ }, import("@stitches/react/types/config").DefaultThemeMap, {
127
+ bg: (value: {
128
+ readonly [$$PropertyValue]: "background";
129
+ }) => {
130
+ background: {
131
+ readonly [$$PropertyValue]: "background";
132
+ };
133
+ };
134
+ inset: (value: string | number | {
135
+ readonly [$$ScaleValue]: "space";
136
+ }) => {
137
+ top: string | number | {
138
+ readonly [$$ScaleValue]: "space";
139
+ };
140
+ right: string | number | {
141
+ readonly [$$ScaleValue]: "space";
142
+ };
143
+ bottom: string | number | {
144
+ readonly [$$ScaleValue]: "space";
145
+ };
146
+ left: string | number | {
147
+ readonly [$$ScaleValue]: "space";
148
+ };
149
+ };
150
+ size: (value: string | number | {
151
+ readonly [$$ScaleValue]: "size";
152
+ }) => {
153
+ height: string | number | {
154
+ readonly [$$ScaleValue]: "size";
155
+ };
156
+ width: string | number | {
157
+ readonly [$$ScaleValue]: "size";
158
+ };
159
+ };
160
+ p: (value: string | number | {
161
+ readonly [$$ScaleValue]: "space";
162
+ }) => {
163
+ padding: string | number | {
164
+ readonly [$$ScaleValue]: "space";
165
+ };
166
+ };
167
+ pt: (value: string | number | {
168
+ readonly [$$ScaleValue]: "space";
169
+ }) => {
170
+ paddingTop: string | number | {
171
+ readonly [$$ScaleValue]: "space";
172
+ };
173
+ };
174
+ pr: (value: string | number | {
175
+ readonly [$$ScaleValue]: "space";
176
+ }) => {
177
+ paddingRight: string | number | {
178
+ readonly [$$ScaleValue]: "space";
179
+ };
180
+ };
181
+ pb: (value: string | number | {
182
+ readonly [$$ScaleValue]: "space";
183
+ }) => {
184
+ paddingBottom: string | number | {
185
+ readonly [$$ScaleValue]: "space";
186
+ };
187
+ };
188
+ pl: (value: string | number | {
189
+ readonly [$$ScaleValue]: "space";
190
+ }) => {
191
+ paddingLeft: string | number | {
192
+ readonly [$$ScaleValue]: "space";
193
+ };
194
+ };
195
+ px: (value: string | number | {
196
+ readonly [$$ScaleValue]: "space";
197
+ }) => {
198
+ paddingLeft: string | number | {
199
+ readonly [$$ScaleValue]: "space";
200
+ };
201
+ paddingRight: string | number | {
202
+ readonly [$$ScaleValue]: "space";
203
+ };
204
+ };
205
+ py: (value: string | number | {
206
+ readonly [$$ScaleValue]: "space";
207
+ }) => {
208
+ paddingTop: string | number | {
209
+ readonly [$$ScaleValue]: "space";
210
+ };
211
+ paddingBottom: string | number | {
212
+ readonly [$$ScaleValue]: "space";
213
+ };
214
+ };
215
+ m: (value: string | number | {
216
+ readonly [$$ScaleValue]: "space";
217
+ }) => {
218
+ margin: string | number | {
219
+ readonly [$$ScaleValue]: "space";
220
+ };
221
+ };
222
+ mt: (value: string | number | {
223
+ readonly [$$ScaleValue]: "space";
224
+ }) => {
225
+ marginTop: string | number | {
226
+ readonly [$$ScaleValue]: "space";
227
+ };
228
+ };
229
+ mr: (value: string | number | {
230
+ readonly [$$ScaleValue]: "space";
231
+ }) => {
232
+ marginRight: string | number | {
233
+ readonly [$$ScaleValue]: "space";
234
+ };
235
+ };
236
+ mb: (value: string | number | {
237
+ readonly [$$ScaleValue]: "space";
238
+ }) => {
239
+ marginBottom: string | number | {
240
+ readonly [$$ScaleValue]: "space";
241
+ };
242
+ };
243
+ ml: (value: string | number | {
244
+ readonly [$$ScaleValue]: "space";
245
+ }) => {
246
+ marginLeft: string | number | {
247
+ readonly [$$ScaleValue]: "space";
248
+ };
249
+ };
250
+ mx: (value: string | number | {
251
+ readonly [$$ScaleValue]: "space";
252
+ }) => {
253
+ marginLeft: string | number | {
254
+ readonly [$$ScaleValue]: "space";
255
+ };
256
+ marginRight: string | number | {
257
+ readonly [$$ScaleValue]: "space";
258
+ };
259
+ };
260
+ my: (value: string | number | {
261
+ readonly [$$ScaleValue]: "space";
262
+ }) => {
263
+ marginTop: string | number | {
264
+ readonly [$$ScaleValue]: "space";
265
+ };
266
+ marginBottom: string | number | {
267
+ readonly [$$ScaleValue]: "space";
268
+ };
269
+ };
270
+ }>>;
271
+ export declare type SliderProps = React.ComponentProps<typeof StyledSlider>;
272
+ export declare const Slider: React.FC<SliderProps> & {
273
+ Value: typeof SliderValue;
274
+ Steps: typeof SliderSteps;
275
+ };
276
+ export {};
@@ -0,0 +1 @@
1
+ const e=["value","defaultValue","min","max","theme","css","children"];import{Track as t,Root as i,Range as r,Thumb as a}from"@radix-ui/react-slider";import{createElement as o}from"react";import{styled as l}from"../../stitches.js";import{CSSWrapper as n}from"../../utilities/css-wrapper/CSSWrapper.js";import"polished";import"../../utilities/style/keyframe-animations.js";import{SliderSteps as s}from"./SliderSteps.js";import{SliderValue as d}from"./SliderValue.js";const u=l(t,{borderRadius:"$round",flexGrow:1,position:"relative",'&[data-orientation="horizontal"]':{height:"$space$1"},'&[data-orientation="vertical"]':{width:"$space$1"}}),m=l(i,{alignItems:"center",display:"flex",position:"relative",touchAction:"none",userSelect:"none",cursor:"pointer",'&[data-orientation="horizontal"]':{height:"$1"},'&[data-orientation="vertical"]':{flexDirection:"column",width:"$1"},"&[data-disabled]":{cursor:"not-allowed",bg:"$tonal100"},variants:{theme:{light:{[`${u}`]:{bg:"#fff"}},tonal:{[`${u}`]:{bg:"$tonal200"}}}}}),p=l(r,{bg:"$primary",borderRadius:"$round",height:"100%",position:"absolute","&[data-disabled]":{bg:"$tonal200",cursor:"not-allowed"}}),c=l(a,{bg:"$primaryMid",borderRadius:"$round",display:"block",size:"$1","&:hover":{bg:"$primaryDark"},"&:focus":{outline:"2px solid $primaryMid",outlineOffset:"2px"},"&[data-disabled]":{bg:"$tonal200",cursor:"not-allowed"}}),h=t=>{let{value:i,defaultValue:r,min:a=0,max:l=100,theme:s="tonal",css:d,children:h}=t,f=function(e,t){if(null==e)return{};var i,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)i=o[r],t.indexOf(i)>=0||(a[i]=e[i]);return a}(t,e);const $=i||r;return o(n,{css:d},o(m,Object.assign({theme:s,defaultValue:r,value:i,min:a,max:l},f),o(u,null,o(p,null)),(null==$?void 0:$.length)&&$.map(((e,t)=>o(c,{key:`thumb${t}`})))),h)};h.Value=d,h.Steps=s,h.displayName="Slider";export{h as Slider};
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ export declare type SliderStepsType = {
3
+ steps: {
4
+ label: string;
5
+ value: number;
6
+ }[];
7
+ };
8
+ declare type SliderStepsProps = {
9
+ min: number;
10
+ max: number;
11
+ } & SliderStepsType;
12
+ export declare const SliderSteps: React.FC<SliderStepsProps>;
13
+ export {};
@@ -0,0 +1 @@
1
+ import{createElement as t}from"react";import{styled as e}from"../../stitches.js";import{Text as s}from"../text/Text.js";const o=e("div",{height:"$space$3",mt:"$3",position:"relative",width:"100%"}),l=(t,e,s)=>(t-e)/(s-e)*100,a=(t,e,s)=>{const o=l(t,e,s);return o<=10?0:o>=90?100:50},r=({min:e,max:r,steps:i})=>0===i.length?null:t(o,null,i.map((o=>t(s,{as:"span",key:o.value,css:{position:"absolute",color:"$tonal300"},style:{left:`${l(o.value,e,r)}%`,transform:`translateX(-${a(o.value,e,r)}%)`}},o.label))));export{r as SliderSteps};
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ export declare type SliderValueType = {
3
+ outputLabel?: (value: number | number[]) => string;
4
+ };
5
+ declare type SliderValueProps = SliderValueType & {
6
+ value?: number[];
7
+ };
8
+ export declare const SliderValue: React.FC<SliderValueProps>;
9
+ export {};
@@ -0,0 +1 @@
1
+ import{createElement as t}from"react";import{Text as o}from"../text/Text.js";const e=({value:e=[],outputLabel:r=(t=>`Current value is ${t}`)})=>t(o,{css:{mt:"$4",color:"$tonal300",width:"100%"}},r(1===e.length?e[0]:e));export{e as SliderValue};
@@ -0,0 +1 @@
1
+ export * from './Slider';
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { SliderProps } from '../../components/slider';
3
+ import { SliderStepsType } from '../../components/slider/SliderSteps';
4
+ import { SliderValueType } from '../slider/SliderValue';
5
+ import type { CSS } from '../../stitches';
6
+ declare type SliderFieldProps = SliderProps & SliderStepsType & SliderValueType & {
7
+ css?: CSS;
8
+ label: string;
9
+ name: string;
10
+ defaultValue: number[];
11
+ };
12
+ export declare const SliderField: React.FC<SliderFieldProps>;
13
+ export {};
@@ -0,0 +1 @@
1
+ const e=["css","label","name","defaultValue","outputLabel","min","max","steps"];import t from"react";import{useFormContext as l,Controller as a}from"react-hook-form";import{FieldWrapper as r}from"../field-wrapper/FieldWrapper.js";import"../field-wrapper/InlineFieldWrapper.js";import{Slider as n}from"../slider/Slider.js";const o=o=>{let{css:m,label:s,name:u,defaultValue:i,outputLabel:p,min:c=0,max:d=100,steps:f=[]}=o,b=function(e,t){if(null==e)return{};var l,a,r={},n=Object.keys(e);for(a=0;a<n.length;a++)l=n[a],t.indexOf(l)>=0||(r[l]=e[l]);return r}(o,e);const{control:V}=l();return t.createElement(r,{css:m,fieldId:u,label:s},t.createElement(a,{control:V,name:u,defaultValue:i,render:({onChange:e,value:l})=>t.createElement(n,Object.assign({name:u,defaultValue:i,onValueChange:e,value:l},b),t.createElement(n.Steps,{min:c,max:d,steps:f}),t.createElement(n.Value,{value:l||i,outputLabel:p}))}))};o.displayName="SliderField";export{o as SliderField};
@@ -0,0 +1 @@
1
+ export { SliderField } from './SliderField';
@@ -1 +1 @@
1
- const t=["size"];function e(){return(e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}import{forwardRef as i,createElement as r}from"react";import{styled as n}from"../../stitches.js";import"../../utilities/css-wrapper/CSSWrapper.js";import{capsize as s}from"../../utilities/style/capsize.js";import"polished";import"../../utilities/style/keyframe-animations.js";const o=({applyCapsize:t=!0}={})=>({xs:e({fontSize:"$xs",lineHeight:1.6},t?s(.4364):{}),sm:e({fontSize:"$sm",lineHeight:1.53},t?s(.4056):{}),md:e({fontSize:"$md",lineHeight:1.5},t?s(.3864):{}),lg:e({fontSize:"$lg",lineHeight:1.52},t?s(.3983):{}),xl:e({fontSize:"$xl",lineHeight:1.42},t?s(.3506):{})}),l=n("p",{color:"$tonal600",fontFamily:"$body",fontWeight:400,margin:0,variants:{size:o()}}),a=i(((e,i)=>{let{size:n="md"}=e,s=function(t,e){if(null==t)return{};var i,r,n={},s=Object.keys(t);for(r=0;r<s.length;r++)i=s[r],e.indexOf(i)>=0||(n[i]=t[i]);return n}(e,t);return r(l,Object.assign({size:n},s,{ref:i}))}));a.displayName="Text";export{l as StyledParagraph,a as Text,o as textVariantSize};
1
+ const e=["size"];function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}).apply(this,arguments)}import{forwardRef as i,createElement as r}from"react";import{styled as n}from"../../stitches.js";import"../../utilities/css-wrapper/CSSWrapper.js";import{capsize as s}from"../../utilities/style/capsize.js";import"polished";import"../../utilities/style/keyframe-animations.js";const o=({applyCapsize:e=!0}={})=>({xs:t({fontSize:"$xs",lineHeight:1.6},e?s(.4364):{}),sm:t({fontSize:"$sm",lineHeight:1.53},e?s(.4056):{}),md:t({fontSize:"$md",lineHeight:1.5},e?s(.3864):{}),lg:t({fontSize:"$lg",lineHeight:1.52},e?s(.3983):{}),xl:t({fontSize:"$xl",lineHeight:1.42},e?s(.3506):{})}),l=n("p",{color:"$tonal600",fontFamily:"$body",fontWeight:400,margin:0,"& > &":{"&:before, &:after":{display:"none"}},variants:{size:o()}}),a=i(((t,i)=>{let{size:n="md"}=t,s=function(e,t){if(null==e)return{};var i,r,n={},s=Object.keys(e);for(r=0;r<s.length;r++)i=s[r],t.indexOf(i)>=0||(n[i]=e[i]);return n}(t,e);return r(l,Object.assign({size:n},s,{ref:i}))}));a.displayName="Text";export{l as StyledParagraph,a as Text,o as textVariantSize};