@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.
- package/dist/components/calendar/Calendar.d.ts +19 -0
- package/dist/components/calendar/Calendar.js +1 -0
- package/dist/components/calendar/Day.d.ts +269 -0
- package/dist/components/calendar/Day.js +1 -0
- package/dist/components/calendar/constants.d.ts +2 -0
- package/dist/components/calendar/constants.js +1 -0
- package/dist/components/date-field/DateField.d.ts +17 -0
- package/dist/components/date-field/DateField.js +1 -0
- package/dist/components/date-field/index.d.ts +1 -0
- package/dist/components/date-input/DateInput.d.ts +17 -0
- package/dist/components/date-input/DateInput.js +1 -0
- package/dist/components/date-input/constants.d.ts +1 -0
- package/dist/components/date-input/constants.js +1 -0
- package/dist/components/date-input/index.d.ts +1 -0
- package/dist/components/date-input/use-date.d.ts +5 -0
- package/dist/components/date-input/use-date.js +1 -0
- package/dist/components/dialog/DialogContent.d.ts +1 -0
- package/dist/components/dialog/DialogContent.js +1 -1
- package/dist/components/index.d.ts +5 -1
- package/dist/components/popover/PopoverContent.d.ts +1 -0
- package/dist/components/popover/PopoverContent.js +1 -1
- package/dist/components/search-input/SearchInput.d.ts +3 -1
- package/dist/components/search-input/SearchInput.js +1 -1
- package/dist/components/slider/Slider.d.ts +276 -0
- package/dist/components/slider/Slider.js +1 -0
- package/dist/components/slider/SliderSteps.d.ts +13 -0
- package/dist/components/slider/SliderSteps.js +1 -0
- package/dist/components/slider/SliderValue.d.ts +9 -0
- package/dist/components/slider/SliderValue.js +1 -0
- package/dist/components/slider/index.d.ts +1 -0
- package/dist/components/slider-field/SliderField.d.ts +13 -0
- package/dist/components/slider-field/SliderField.js +1 -0
- package/dist/components/slider-field/index.d.ts +1 -0
- package/dist/components/text/Text.js +1 -1
- package/dist/docgen.json +1 -1
- package/dist/docs/DateField.mdx +20 -0
- package/dist/docs/DateInput.mdx +81 -0
- package/dist/docs/Dialog.mdx +16 -1
- package/dist/docs/RadioButton.mdx +1 -1
- package/dist/docs/SearchInput.mdx +2 -1
- package/dist/docs/Slider.mdx +117 -0
- package/dist/docs/SliderField.mdx +35 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Props as DayzedInterface } from 'dayzed';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { CSS } from '../../stitches';
|
|
4
|
+
export declare type CalendarTranslationProps = {
|
|
5
|
+
monthNames?: string[];
|
|
6
|
+
weekdayNames?: string[];
|
|
7
|
+
labels?: {
|
|
8
|
+
open: string;
|
|
9
|
+
next: string;
|
|
10
|
+
previous: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
declare type CalendarProps = DayzedInterface & CalendarTranslationProps & {
|
|
14
|
+
css?: CSS;
|
|
15
|
+
refDateToday?: React.RefObject<HTMLButtonElement>;
|
|
16
|
+
refDateSelected?: React.RefObject<HTMLButtonElement>;
|
|
17
|
+
};
|
|
18
|
+
export declare const Calendar: React.FC<CalendarProps>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=["css","refDateSelected","refDateToday","firstDayOfWeek","monthNames","weekdayNames","labels"];function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e}).apply(this,arguments)}import{ChevronLeft as s,ChevronRight as r}from"@atom-learning/icons";import{useDayzed as o}from"dayzed";import{createElement as n}from"react";import{ActionIcon as a}from"../action-icon/ActionIcon.js";import{Box as i}from"../box/Box.js";import{Flex as m}from"../flex/Flex.js";import{Heading as c}from"../heading/Heading.js";import{Icon as l}from"../icon/Icon.js";import{Text as p}from"../text/Text.js";import{styled as f}from"../../stitches.js";import{monthNamesShort as d,weekdayNamesShort as g}from"./constants.js";import{Day as u}from"./Day.js";const h=f("div",{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gridGap:"$1 $2"}),y=f=>{let{css:y,refDateSelected:j,refDateToday:$,firstDayOfWeek:b=0,monthNames:x=d,weekdayNames:O=g,labels:k={next:"Next month",previous:"Previous month"}}=f,v=function(e,t){if(null==e)return{};var s,r,o={},n=Object.keys(e);for(r=0;r<n.length;r++)s=n[r],t.indexOf(s)>=0||(o[s]=e[s]);return o}(f,e);const{calendars:D,getBackProps:w,getForwardProps:N,getDateProps:z}=o(t({firstDayOfWeek:b,showOutsideDays:!0},v));return D.length?n(i,{css:t({position:"relative",width:"min-content",mt:"-$1"},y)},n(m,{css:{position:"absolute",top:0,right:"-$1"}},n(a,Object.assign({label:k.previous,theme:"neutral",size:"lg"},w({calendars:D})),n(l,{is:s})),n(a,Object.assign({label:k.next,theme:"neutral",size:"lg"},N({calendars:D})),n(l,{is:r}))),D.map((({month:e,year:t,weeks:s})=>n(i,{key:`${e}${t}`},n(m,{css:{height:"$4",alignItems:"center",mb:"$4"}},n(c,{size:"xs"},x[e]," ",t)),n(h,{css:{mb:"$3"}},((e,t)=>{const s=e.slice(0,t);return e.slice(t).concat(s)})(O,b).map((s=>n(p,{as:"span",size:"sm",key:`${e}${t}${s}`,css:{fontWeight:600,textAlign:"center"}},s)))),n(h,null,s.map(((s,r)=>s.map(((s,o)=>{const a=`${e}${t}${r}${o}`;if(!s)return n("div",{key:a});const{date:i,selected:m,today:c,prevMonth:l,nextMonth:p}=s;return n(u,Object.assign({isOutsideMonth:l||p,isSelected:m,isToday:c,key:a,ref:m?j:c?$:null},z({dateObj:s})),i.getDate())}))))))))):null};y.displayName="Calendar";export{y as Calendar};
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
export declare const Day: import("@stitches/react/types/styled-component").StyledComponent<"button", {
|
|
2
|
+
isSelected?: boolean | "true" | undefined;
|
|
3
|
+
isToday?: boolean | "true" | undefined;
|
|
4
|
+
isOutsideMonth?: boolean | "true" | undefined;
|
|
5
|
+
}, {
|
|
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
|
+
}>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{styled as o}from"../../stitches.js";const r=o("button",{bg:"transparent",border:"none",borderRadius:"$round",color:"$tonal900",cursor:"pointer",fontFamily:"$body",fontSize:"$sm",size:"$3",p:0,transition:"all 75ms","&:hover":{bg:"$tonal100"},"&:active":{color:"white",bg:"$primary"},"&:focus":{outline:"2px solid $primary",outlineOffset:"2px"},variants:{isSelected:{true:{bg:"$primary",color:"white","&:hover":{bg:"$primary"}}},isToday:{true:{bg:"$tonal100"}},isOutsideMonth:{true:{color:"$tonal200"}}}});export{r as Day};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];export{e as monthNamesShort,u as weekdayNamesShort};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DateInputProps } from '../../components/date-input';
|
|
3
|
+
import { ValidationOptions } from '../../components/form';
|
|
4
|
+
import type { CSS } from '../../stitches';
|
|
5
|
+
declare type DateFieldProps = DateInputProps & {
|
|
6
|
+
css?: CSS;
|
|
7
|
+
description?: string;
|
|
8
|
+
label: string;
|
|
9
|
+
name: string;
|
|
10
|
+
prompt?: {
|
|
11
|
+
link: string;
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
14
|
+
validation?: ValidationOptions;
|
|
15
|
+
};
|
|
16
|
+
export declare const DateField: React.FC<DateFieldProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=["css","label","name","validation","prompt","description"];import{createElement as e}from"react";import{useFormContext as o}from"react-hook-form";import{DateInput as t}from"../date-input/DateInput.js";import{FieldWrapper as i}from"../field-wrapper/FieldWrapper.js";import"../field-wrapper/InlineFieldWrapper.js";import"../form/Form.js";import{useFieldError as p}from"../form/useFieldError.js";const a=a=>{let{css:n,label:l,name:s,validation:m,prompt:d,description:f}=a,c=function(r,e){if(null==r)return{};var o,t,i={},p=Object.keys(r);for(t=0;t<p.length;t++)o=p[t],e.indexOf(o)>=0||(i[o]=r[o]);return i}(a,r);const{register:u,trigger:j}=o(),{error:b}=p(s),g=m?u(m):u;return e(i,{css:n,description:f,error:b,fieldId:s,label:l,prompt:d,required:Boolean(null==m?void 0:m.required)},e(t,Object.assign({id:s,name:s,ref:g},b&&{state:"error"},c,{revalidate:j})))};a.displayName="DateField";export{a as DateField};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DateField } from './DateField';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Props as DayzedInterface } from 'dayzed';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { CalendarTranslationProps } from '../calendar/Calendar';
|
|
4
|
+
export declare type DateInputProps = DayzedInterface & CalendarTranslationProps & {
|
|
5
|
+
initialDate?: Date;
|
|
6
|
+
dateFormat?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
size?: 'sm' | 'md';
|
|
9
|
+
revalidate?: () => Promise<boolean>;
|
|
10
|
+
};
|
|
11
|
+
export declare const DateInput: React.ForwardRefExoticComponent<DayzedInterface & CalendarTranslationProps & {
|
|
12
|
+
initialDate?: Date | undefined;
|
|
13
|
+
dateFormat?: string | undefined;
|
|
14
|
+
disabled?: boolean | undefined;
|
|
15
|
+
size?: "sm" | "md" | undefined;
|
|
16
|
+
revalidate?: (() => Promise<boolean>) | undefined;
|
|
17
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=["initialDate","dateFormat","firstDayOfWeek","disabled","monthNames","weekdayNames","size","labels","revalidate"];import{CalendarEvent as t}from"@atom-learning/icons";import{forwardRef as a,useState as o,useRef as n,createElement as s}from"react";import{ActionIcon as r}from"../action-icon/ActionIcon.js";import{Box as i}from"../box/Box.js";import{Calendar as l}from"../calendar/Calendar.js";import{Icon as m}from"../icon/Icon.js";import{Input as d}from"../input/Input.js";import{Popover as p}from"../popover/Popover.js";import{DEFAULT_DATE_FORMAT as c}from"./constants.js";import{useDate as u}from"./use-date.js";const f=a(((a,f)=>{let{initialDate:b,dateFormat:g=c,firstDayOfWeek:h=1,disabled:v,monthNames:D,weekdayNames:j,size:y="md",labels:O={open:"Open calendar",next:"Next month",previous:"Previous month"},revalidate:N}=a,k=function(e,t){if(null==e)return{};var a,o,n={},s=Object.keys(e);for(o=0;o<s.length;o++)a=s[o],t.indexOf(a)>=0||(n[a]=e[a]);return n}(a,e);const{date:w,dateString:x,setDate:z}=u(b,g),[C,I]=o(!1),F=n(null),S=n(null);return s(i,{css:{position:"relative"}},s(d,Object.assign({name:"date",disabled:v,size:y},k,{onChange:e=>z(e.target.value,!0),value:x,ref:f})),s(p,{modal:!0,open:C,onOpenChange:I},s(p.Trigger,{asChild:!0},s(r,{css:{position:"absolute",top:0,right:0},disabled:v,label:O.open,size:"sm"===y?"md":"lg",theme:"neutral"},s(m,{size:"sm",is:t}))),s(p.Content,{css:{pr:"$sizes$2"},side:"bottom",align:"end",showCloseButton:!1,onOpenAutoFocus:e=>{var t,a;(e.preventDefault(),w)?null==(t=S.current)||t.focus():null==(a=F.current)||a.focus()}},s(l,{date:w||new Date,selected:w,onDateSelected:async e=>{I(!1),await z(e.date,!1),N&&N()},refDateToday:F,refDateSelected:S,firstDayOfWeek:h,monthNames:D,weekdayNames:j,labels:O}))))}));f.displayName="DateInput";export{f as DateInput};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEFAULT_DATE_FORMAT = "DD/MM/YYYY";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const Y="DD/MM/YYYY";export{Y as DEFAULT_DATE_FORMAT};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DateInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"dayjs";import o from"dayjs/plugin/customParseFormat";import{useState as r}from"react";import{DEFAULT_DATE_FORMAT as a}from"./constants.js";t.extend(o);const e=(o,e=a)=>{const[m,s]=r(o?t(o).toDate():void 0),[i,n]=r(o?t(o).format(e):"");return{dateString:i,date:m,setDate:(o,r=!1)=>{const a=r?t(o,e):t(o);s(a.isValid()?a.toDate():void 0),n(r?o:a.format(e))}}};export{e as useDate};
|
|
@@ -268,6 +268,7 @@ declare const StyledDialogContent: import("@stitches/react/types/styled-componen
|
|
|
268
268
|
}>>;
|
|
269
269
|
declare type DialogContentProps = React.ComponentProps<typeof StyledDialogContent> & {
|
|
270
270
|
closeDialogText?: string;
|
|
271
|
+
showCloseButton?: boolean;
|
|
271
272
|
};
|
|
272
273
|
export declare const DialogContent: React.FC<DialogContentProps>;
|
|
273
274
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=["size","children","closeDialogText"];import{Close as o}from"@atom-learning/icons";import{Overlay as i,Content as e,Close as
|
|
1
|
+
const t=["size","children","closeDialogText","showCloseButton"];import{Close as o}from"@atom-learning/icons";import{Overlay as i,Content as e,Close as s}from"@radix-ui/react-dialog";import{createElement as a,Fragment as r}from"react";import{keyframes as n,styled as l}from"../../stitches.js";import"../../utilities/css-wrapper/CSSWrapper.js";import"polished";import{fadeIn as m,fadeOut as d}from"../../utilities/style/keyframe-animations.js";import{ActionIcon as c}from"../action-icon/ActionIcon.js";import{Icon as p}from"../icon/Icon.js";const u=n({"0%":{transform:"translate3d(-50%, 50vh, 0)"},"100%":{transform:"translate3d(-50%, -50%, 0)"}}),f=n({"0%":{transform:"translate3d(-50%, -50%, 0)"},"100%":{transform:"translate3d(-50%, 50vh, 0)"}}),h=l(i,{backgroundColor:"$alpha600",inset:0,position:"fixed","@allowMotion":{'&[data-state="open"]':{animation:`${m} 250ms ease-out`},'&[data-state="closed"]':{animation:`${d} 550ms ease-out`}}}),x=l(e,{bg:"white",borderRadius:"$1",boxShadow:"$3",boxSizing:"border-box",left:"50%",maxWidth:"90vw",p:"$5",position:"fixed",top:"50%",transform:"translate3d(-50%, -50%, 0)","&:focus":{outline:"none"},"@allowMotion":{'&[data-state="open"]':{animation:`${u} 550ms cubic-bezier(0.22, 1, 0.36, 1)`},'&[data-state="closed"]':{animation:`${f} 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"}}}}),b=i=>{let{size:e="sm",children:n,closeDialogText:l="Close dialog",showCloseButton:m=!0}=i,d=function(t,o){if(null==t)return{};var i,e,s={},a=Object.keys(t);for(e=0;e<a.length;e++)i=a[e],o.indexOf(i)>=0||(s[i]=t[i]);return s}(i,t);return a(r,null,a(h,null),a(x,Object.assign({size:e},d),m&&a(c,{as:s,css:{position:"absolute",right:"$4",top:"$4"},label:l,size:"lg",theme:"neutral"},a(p,{is:o})),n))};export{b as DialogContent};
|
|
@@ -9,6 +9,8 @@ export { Checkbox } from './checkbox';
|
|
|
9
9
|
export { CheckboxField } from './checkbox-field';
|
|
10
10
|
export { Combobox } from './combobox';
|
|
11
11
|
export { Dialog } from './dialog';
|
|
12
|
+
export { DateInput } from './date-input';
|
|
13
|
+
export { DateField } from './date-field';
|
|
12
14
|
export { Divider } from './divider';
|
|
13
15
|
export { DropdownMenu } from './dropdown-menu';
|
|
14
16
|
export { FieldWrapper, InlineFieldWrapper } from './field-wrapper';
|
|
@@ -31,11 +33,13 @@ export { PasswordInput } from './password-input';
|
|
|
31
33
|
export { Popover } from './popover';
|
|
32
34
|
export { ProgressBar } from './progress-bar';
|
|
33
35
|
export { RadioButton, RadioButtonGroup } from './radio-button';
|
|
34
|
-
export { RadioCard, RadioCardGroup } from './radio-card';
|
|
35
36
|
export { RadioButtonField } from './radio-button-field';
|
|
37
|
+
export { RadioCard, RadioCardGroup } from './radio-card';
|
|
36
38
|
export { SearchInput } from './search-input';
|
|
37
39
|
export { Select } from './select';
|
|
38
40
|
export { SelectField } from './select-field';
|
|
41
|
+
export { Slider } from './slider';
|
|
42
|
+
export { SliderField } from './slider-field';
|
|
39
43
|
export { Stack } from './stack';
|
|
40
44
|
export { StackContent } from './stack-content';
|
|
41
45
|
export { Switch } from './switch';
|
|
@@ -269,6 +269,7 @@ declare const StyledContent: import("@stitches/react/types/styled-component").St
|
|
|
269
269
|
}>>;
|
|
270
270
|
declare type PopoverContentProps = React.ComponentProps<typeof StyledContent> & React.ComponentProps<typeof Content> & {
|
|
271
271
|
closePopoverText?: string;
|
|
272
|
+
showCloseButton?: boolean;
|
|
272
273
|
};
|
|
273
274
|
export declare const PopoverContent: React.FC<PopoverContentProps>;
|
|
274
275
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const i=["children","side","sideOffset","closePopoverText","size"];import{Close as t}from"@atom-learning/icons";import{Content as e,Arrow as o,Close as
|
|
1
|
+
const i=["children","side","sideOffset","closePopoverText","showCloseButton","size"];import{Close as t}from"@atom-learning/icons";import{Content as e,Arrow as o,Close as s}from"@radix-ui/react-popover";import{createElement as a}from"react";import{styled as n}from"../../stitches.js";import"../../utilities/css-wrapper/CSSWrapper.js";import"polished";import{slideDownAndFade as r,slideLeftAndFade as m,slideUpAndFade as d,slideRightAndFade as l}from"../../utilities/style/keyframe-animations.js";import{ActionIcon as p}from"../action-icon/ActionIcon.js";import{Icon as c}from"../icon/Icon.js";const f=n(e,{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:r},'&[data-side="right"]':{animationName:m},'&[data-side="bottom"]':{animationName:d},'&[data-side="left"]':{animationName:l}}},variants:{size:{sm:{maxWidth:"200px"},md:{maxWidth:"400px"},lg:{maxWidth:"600px"}}}}),h=n(o,{fill:"white",zIndex:1,'[data-align="end"] &':{mr:"$sizes$2"},'[data-align="start"] &':{ml:"$sizes$2"}}),u=e=>{let{children:o,side:n="top",sideOffset:r=8,closePopoverText:m="Close popover",showCloseButton:d=!0,size:l="md"}=e,u=function(i,t){if(null==i)return{};var e,o,s={},a=Object.keys(i);for(o=0;o<a.length;o++)e=a[o],t.indexOf(e)>=0||(s[e]=i[e]);return s}(e,i);return a(f,Object.assign({size:l,side:n,sideOffset:r},u),d&&a(p,{as:s,css:{position:"absolute",right:"$0",top:"$0"},label:m,size:"lg",theme:"neutral"},a(c,{is:t})),o,a(h,{width:16,height:8}))};export{u as PopoverContent};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Input } from '../../components/input';
|
|
2
3
|
import { CSS } from '../../stitches';
|
|
3
|
-
import { Input } from '../input/Input';
|
|
4
4
|
declare type SearchInputProps = React.ComponentProps<typeof Input> & {
|
|
5
5
|
size: 'sm' | 'md';
|
|
6
6
|
css?: CSS;
|
|
7
|
+
value?: string;
|
|
8
|
+
clearText?: string;
|
|
7
9
|
};
|
|
8
10
|
export declare const SearchInput: React.FC<SearchInputProps>;
|
|
9
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=["size","css"];function
|
|
1
|
+
const t=["size","css","value","clearText"];function e(){return(e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(t[o]=s[o])}return t}).apply(this,arguments)}import{Search as s,Close as o}from"@atom-learning/icons";import{useState as r,createElement as i}from"react";import{ActionIcon as n}from"../action-icon/ActionIcon.js";import{Box as a}from"../box/Box.js";import{Icon as c}from"../icon/Icon.js";import{Input as l}from"../input/Input.js";import{styled as p}from"../../stitches.js";var u;!function(t){t.SEARCH="SEARCH",t.CLEAR="CLEAR"}(u||(u={}));const m=p(c,{color:"$tonal300",position:"absolute",pointerEvents:"none",variants:{size:{sm:{top:"$2",right:"$2",size:"$1"},md:{top:10,right:10,size:20}}}}),h=p(l,{'&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, & input[type="search"]::-webkit-search-results-decoration':{display:"none"}}),f=l=>{let{size:p="md",css:f,value:b,clearText:v="Clear"}=l,C=function(t,e){if(null==t)return{};var s,o,r={},i=Object.keys(t);for(o=0;o<i.length;o++)s=i[o],e.indexOf(s)>=0||(r[s]=t[s]);return r}(l,t);const[g,A]=r(b||""),[E,R]=r(b?u.CLEAR:u.SEARCH),j=()=>{A(""),R(u.SEARCH)};return i(a,{css:e({position:"relative"},f)},i(h,Object.assign({size:p,type:"search"},C,{value:g,onChange:t=>{A(t.target.value),R(t.target.value?u.CLEAR:u.SEARCH)},css:{pr:"sm"===p?"$5":"$6"}})),E===u.SEARCH?i(m,{is:s,size:p,css:{size:"sm"==p?"$1":20}}):i(n,{label:v,theme:"neutral",size:"sm"==p?"md":"lg",css:{position:"absolute",top:0,right:0},onClick:j},i(c,{is:o})))};f.displayName="SearchInput";export{f as SearchInput};
|