@soul-refiner/design-system 2.14.170 → 2.14.171
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/input/calendar/calendar_panel.js +40 -8
- package/dist/src/components/input/calendar/calendar_panel.d.ts +18 -4
- package/dist/src/components/input/calendar/calendar_panel.d.ts.map +1 -1
- package/dist/src/components/input/calendar/index.d.ts +1 -1
- package/dist/src/components/input/calendar/index.d.ts.map +1 -1
- package/dist/src/components/input/index.d.ts +1 -1
- package/dist/src/components/input/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("styled-components"),n=require("../../../common/date.js"),a=require("../../atoms/typography/paragraph.js"),o=require("../../../icons/arrow/chevron_left.js"),i=require("../../../icons/arrow/chevron_right.js"),
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("styled-components"),n=require("../../../common/date.js"),a=require("../../atoms/typography/paragraph.js"),o=require("../../../icons/arrow/chevron_left.js"),i=require("../../../icons/arrow/chevron_right.js"),l=require("../../../utils/date.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=s(t);const c=r.styled.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
gap: 0;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
align-items: center;
|
|
15
15
|
margin-bottom: 18px;
|
|
16
16
|
user-select: none;
|
|
17
|
-
`,
|
|
17
|
+
`,g=r.styled.button`
|
|
18
18
|
appearance: none;
|
|
19
19
|
border: none;
|
|
20
20
|
outline: none;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
fill: #ffffff;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
`,
|
|
39
|
+
`,f=r.styled.div`
|
|
40
40
|
display: grid;
|
|
41
41
|
grid-template-columns: repeat(7, 1fr);
|
|
42
42
|
gap: 20px;
|
|
@@ -50,20 +50,53 @@
|
|
|
50
50
|
justify-content: center;
|
|
51
51
|
align-items: center;
|
|
52
52
|
}
|
|
53
|
-
`,
|
|
53
|
+
`,p=r.styled.div`
|
|
54
54
|
display: flex;
|
|
55
55
|
flex-direction: column;
|
|
56
56
|
gap: 16px;
|
|
57
57
|
margin: 16px 0 5px;
|
|
58
58
|
user-select: none;
|
|
59
59
|
width: 100%;
|
|
60
|
-
`,
|
|
60
|
+
`,m=r.styled.div`
|
|
61
61
|
display: grid;
|
|
62
62
|
grid-template-columns: repeat(7, 1fr);
|
|
63
63
|
gap: 20px;
|
|
64
64
|
border-radius: 24px;
|
|
65
65
|
width: 100%;
|
|
66
|
-
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
`,h=r.styled.div`
|
|
68
|
+
position: relative;
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
align-items: center;
|
|
72
|
+
height: 28px;
|
|
73
|
+
|
|
74
|
+
&.in-range::before,
|
|
75
|
+
&.range-start::before,
|
|
76
|
+
&.range-end::before {
|
|
77
|
+
content: '';
|
|
78
|
+
position: absolute;
|
|
79
|
+
top: 0;
|
|
80
|
+
bottom: 0;
|
|
81
|
+
background: var(--color-blue-9);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.in-range::before {
|
|
85
|
+
left: -10px;
|
|
86
|
+
right: -10px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.range-start:not(.range-end)::before {
|
|
90
|
+
left: 50%;
|
|
91
|
+
right: -10px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&.range-end:not(.range-start)::before {
|
|
95
|
+
left: -10px;
|
|
96
|
+
right: 50%;
|
|
97
|
+
}
|
|
98
|
+
`,b=r.styled.button`
|
|
99
|
+
position: relative;
|
|
67
100
|
outline: none;
|
|
68
101
|
border: none;
|
|
69
102
|
background: transparent;
|
|
@@ -77,7 +110,6 @@
|
|
|
77
110
|
font-family: var(--font-inter);
|
|
78
111
|
font-size: 16px;
|
|
79
112
|
line-height: 24px;
|
|
80
|
-
justify-self: center;
|
|
81
113
|
|
|
82
114
|
&.today {
|
|
83
115
|
color: var(--color-primary-blue-2);
|
|
@@ -98,4 +130,4 @@
|
|
|
98
130
|
background-color: var(--color-blue-9);
|
|
99
131
|
}
|
|
100
132
|
}
|
|
101
|
-
`;exports.CalendarPanel=
|
|
133
|
+
`;exports.CalendarPanel=t=>{const{disablePastDates:r,disableFutureDates:s}=t,x="range"===t.mode,y=d.default.useMemo(()=>{const e=new Date;return e.setHours(0,0,0,0),e},[]),v=x?t.selectedRange.start:null,j=x?t.selectedRange.end:null,w=x?null:t.selectedDate,D=x?v:w,[T,S]=d.default.useState(()=>D?.toDateString()||(new Date).toDateString());d.default.useEffect(()=>{D&&S(D.toDateString())},[D?.getTime()]);const[M,$]=d.default.useState(null),k=e=>{const r=e.currentTarget,n=r.getAttribute("data-day"),a=r.getAttribute("data-month"),o=r.getAttribute("data-year");if(!n||!a||!o)return;const i=new Date(`${a}/${n}/${o}`);if("range"===t.mode){const{start:e,end:r}=t.selectedRange;$(i),!e||r?t.onSelect({start:i,end:null}):i.getTime()<e.getTime()?t.onSelect({start:i,end:e}):t.onSelect({start:e,end:i})}else t.onSelect(i)},q=e=>{if(!x)return;const t=e.currentTarget,r=t.getAttribute("data-day"),n=t.getAttribute("data-month"),a=t.getAttribute("data-year");r&&n&&a&&$(new Date(`${n}/${r}/${a}`))},A=l.buildCalendar(new Date(T).getMonth()+1,new Date(T).getFullYear());let C=null,P=null;x&&(v&&j?(C=v,P=j):v&&M?M.getTime()<v.getTime()?(C=M,P=v):(C=v,P=M):v&&(C=v));const z=!(!C||!P||C.getTime()===P.getTime());return e.jsxs(c,{children:[e.jsxs(u,{children:[e.jsx(g,{type:"button",onClick:()=>{S(e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t.toDateString()})},children:e.jsx(o.ChevronLeft,{size:24})}),e.jsx(a.P,{$bold:!0,children:`${Object.values(n.MONTHS)[Math.max(0,Math.min(new Date(T).getMonth(),11))]} ${new Date(T).getFullYear()}`}),e.jsx(g,{type:"button",onClick:()=>{S(e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t.toDateString()})},children:e.jsx(i.ChevronRight,{size:24})})]}),e.jsx(f,{children:Object.values(n.WEEKDAYS).map(t=>e.jsx(a.P,{children:t},t))}),e.jsx(p,{onMouseLeave:()=>{x&&$(null)},children:A.map((t,n)=>e.jsx(m,{children:t.map((t,n)=>{const a=new Date(`${t[1]}/${t[2]}/${t[0]}`).getTime(),o=y.getTime()-a>0,i=a-y.getTime()>0,d=t[1]!==l.zeroPad(new Date(T).getMonth()+1,2),c=r?o:s?i:d,u=Math.abs(a-y.getTime())<.5,g=!x&&!!w&&w.getTime()===a,f=x&&!!C&&a===C.getTime(),p=x&&!!P&&a===P.getTime(),m=[x&&z&&!!C&&!!P&&a>C.getTime()&&a<P.getTime()&&"in-range",f&&z&&"range-start",p&&z&&"range-end"].filter(Boolean).join(" "),v=[u&&"today",c&&"not-current",(g||f||p)&&"selected"].filter(Boolean).join(" ");return e.jsx(h,{className:m,children:e.jsx(b,{type:"button",className:v,"data-day":t[2],"data-month":t[1],"data-year":t[0],onClick:k,onMouseEnter:q,children:`${t[2]}`.startsWith("0")?`${t[2]}`[1]:t[2]})},"day-"+n.toString(36))})},"week-"+n.toString(36)))})]})};
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export interface DateRange {
|
|
2
|
+
start: Date | null;
|
|
3
|
+
end: Date | null;
|
|
4
|
+
}
|
|
5
|
+
interface CalendarPanelBaseProps {
|
|
4
6
|
disablePastDates?: true;
|
|
5
7
|
disableFutureDates?: true;
|
|
6
8
|
}
|
|
7
|
-
|
|
9
|
+
interface CalendarPanelSingleProps extends CalendarPanelBaseProps {
|
|
10
|
+
mode?: 'single';
|
|
11
|
+
selectedDate: Date | null;
|
|
12
|
+
onSelect: (value: Date) => void;
|
|
13
|
+
}
|
|
14
|
+
interface CalendarPanelRangeProps extends CalendarPanelBaseProps {
|
|
15
|
+
mode: 'range';
|
|
16
|
+
selectedRange: DateRange;
|
|
17
|
+
onSelect: (value: DateRange) => void;
|
|
18
|
+
}
|
|
19
|
+
export type CalendarPanelProps = CalendarPanelSingleProps | CalendarPanelRangeProps;
|
|
20
|
+
export declare const CalendarPanel: (props: CalendarPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
8
22
|
//# sourceMappingURL=calendar_panel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar_panel.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/calendar/calendar_panel.tsx"],"names":[],"mappings":"AAYA,MAAM,WAAW,kBAAkB;
|
|
1
|
+
{"version":3,"file":"calendar_panel.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/calendar/calendar_panel.tsx"],"names":[],"mappings":"AAYA,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;CAClB;AAED,UAAU,sBAAsB;IAC9B,gBAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,kBAAkB,CAAC,EAAE,IAAI,CAAC;CAC3B;AAED,UAAU,wBAAyB,SAAQ,sBAAsB;IAC/D,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC;CACjC;AAED,UAAU,uBAAwB,SAAQ,sBAAsB;IAC9D,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,EAAE,SAAS,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CACtC;AAED,MAAM,MAAM,kBAAkB,GAC1B,wBAAwB,GACxB,uBAAuB,CAAC;AAE5B,eAAO,MAAM,aAAa,UAAW,kBAAkB,4CA+MtD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CalendarInput } from './calendar';
|
|
2
2
|
export type { CalendarInputProps } from './calendar';
|
|
3
3
|
export { CalendarPanel } from './calendar_panel';
|
|
4
|
-
export type { CalendarPanelProps } from './calendar_panel';
|
|
4
|
+
export type { CalendarPanelProps, DateRange } from './calendar_panel';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -19,7 +19,7 @@ export type { TextInputProps } from './text_input';
|
|
|
19
19
|
export { CalendarInput } from './calendar';
|
|
20
20
|
export type { CalendarInputProps } from './calendar';
|
|
21
21
|
export { CalendarPanel } from './calendar';
|
|
22
|
-
export type { CalendarPanelProps } from './calendar';
|
|
22
|
+
export type { CalendarPanelProps, DateRange } from './calendar';
|
|
23
23
|
export { Time } from './time';
|
|
24
24
|
export type { TimeProps } from './time';
|
|
25
25
|
export { TimeInput } from './time_input';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,YAAY,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EAAE,kBAAkB,EAAE,MA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