@strapi/design-system 1.7.9 → 1.8.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 (78) hide show
  1. package/README.md +9 -17
  2. package/dist/Alert/Alert.cjs +23 -29
  3. package/dist/Alert/Alert.js +33 -39
  4. package/dist/Alert/utils.cjs +1 -1
  5. package/dist/Alert/utils.js +14 -3
  6. package/dist/Button/Button.cjs +9 -4
  7. package/dist/Button/Button.js +28 -23
  8. package/dist/CarouselInput/CarouselImage.cjs +1 -1
  9. package/dist/CarouselInput/CarouselImage.js +3 -3
  10. package/dist/CarouselInput/CarouselSlide.cjs +1 -1
  11. package/dist/CarouselInput/CarouselSlide.js +2 -2
  12. package/dist/Combobox/Combobox.cjs +14 -13
  13. package/dist/Combobox/Combobox.js +73 -68
  14. package/dist/DatePicker/DatePicker.cjs +82 -6
  15. package/dist/DatePicker/DatePicker.js +381 -55
  16. package/dist/DateTimePicker/DateTimePicker.cjs +7 -1
  17. package/dist/DateTimePicker/DateTimePicker.js +91 -53
  18. package/dist/DateTimePicker/index.cjs +1 -1
  19. package/dist/DateTimePicker/index.js +3 -2
  20. package/dist/DesignSystemProvider.cjs +1 -0
  21. package/dist/DesignSystemProvider.js +10 -0
  22. package/dist/Flex/Flex.cjs +1 -1
  23. package/dist/Flex/Flex.js +1 -1
  24. package/dist/NumberInput/NumberInput.cjs +2 -2
  25. package/dist/NumberInput/NumberInput.js +40 -40
  26. package/dist/Popover/Popover.cjs +3 -4
  27. package/dist/Popover/Popover.js +46 -48
  28. package/dist/Popover/index.cjs +1 -1
  29. package/dist/Popover/index.js +5 -9
  30. package/dist/Popover/primitives.cjs +1 -0
  31. package/dist/Popover/primitives.js +5 -0
  32. package/dist/Searchbar/Searchbar.cjs +2 -2
  33. package/dist/Searchbar/Searchbar.js +5 -5
  34. package/dist/Select/SelectParts.cjs +1 -1
  35. package/dist/Select/SelectParts.js +1 -1
  36. package/dist/Select/SingleSelect.cjs +1 -1
  37. package/dist/Select/SingleSelect.js +36 -32
  38. package/dist/TextInput/TextInput.cjs +1 -1
  39. package/dist/TextInput/TextInput.js +5 -5
  40. package/dist/ThemeProvider/ThemeProvider.cjs +2 -2
  41. package/dist/ThemeProvider/ThemeProvider.js +4 -3
  42. package/dist/TimePicker/TimePicker.cjs +5 -7
  43. package/dist/TimePicker/TimePicker.js +79 -33
  44. package/dist/TimePicker/index.cjs +1 -1
  45. package/dist/TimePicker/index.js +3 -2
  46. package/dist/helpers/context.cjs +1 -0
  47. package/dist/helpers/context.js +21 -0
  48. package/dist/helpers/getDefaultLocale.cjs +4 -1
  49. package/dist/helpers/getDefaultLocale.js +7 -2
  50. package/dist/hooks/useDateFormatter.cjs +1 -0
  51. package/dist/hooks/useDateFormatter.js +20 -0
  52. package/dist/index.cjs +1 -1
  53. package/dist/index.js +309 -304
  54. package/package.json +6 -5
  55. package/dist/DatePicker/DatePickerCalendar.cjs +0 -1
  56. package/dist/DatePicker/DatePickerCalendar.js +0 -43
  57. package/dist/DatePicker/DatePickerTd.cjs +0 -19
  58. package/dist/DatePicker/DatePickerTd.js +0 -29
  59. package/dist/DatePicker/DatePickerTh.cjs +0 -9
  60. package/dist/DatePicker/DatePickerTh.js +0 -18
  61. package/dist/DatePicker/compareDates.cjs +0 -1
  62. package/dist/DatePicker/compareDates.js +0 -4
  63. package/dist/DatePicker/components.cjs +0 -39
  64. package/dist/DatePicker/components.js +0 -53
  65. package/dist/DatePicker/utils/formatDate.cjs +0 -1
  66. package/dist/DatePicker/utils/formatDate.js +0 -4
  67. package/dist/DatePicker/utils/generateWeeks.cjs +0 -1
  68. package/dist/DatePicker/utils/generateWeeks.js +0 -17
  69. package/dist/DatePicker/utils/getDayOfWeek.cjs +0 -1
  70. package/dist/DatePicker/utils/getDayOfWeek.js +0 -15
  71. package/dist/DatePicker/utils/getMonths.cjs +0 -1
  72. package/dist/DatePicker/utils/getMonths.js +0 -7
  73. package/dist/DatePicker/utils/getYears.cjs +0 -1
  74. package/dist/DatePicker/utils/getYears.js +0 -9
  75. package/dist/DatePicker/utils/index.cjs +0 -1
  76. package/dist/DatePicker/utils/index.js +0 -12
  77. package/dist/DateTimePicker/parseDate.cjs +0 -1
  78. package/dist/DateTimePicker/parseDate.js +0 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/design-system",
3
- "version": "1.7.9",
3
+ "version": "1.8.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -20,12 +20,13 @@
20
20
  "dependencies": {
21
21
  "@codemirror/lang-json": "^6.0.1",
22
22
  "@floating-ui/react-dom": "^1.3.0",
23
+ "@internationalized/date": "^3.2.0",
23
24
  "@internationalized/number": "^3.2.0",
24
25
  "@radix-ui/react-dismissable-layer": "^1.0.3",
25
26
  "@radix-ui/react-dropdown-menu": "^2.0.4",
26
27
  "@radix-ui/react-focus-scope": "1.0.2",
27
- "@strapi/ui-primitives": "^1.7.9",
28
- "@uiw/react-codemirror": "^4.19.16",
28
+ "@strapi/ui-primitives": "^1.8.0",
29
+ "@uiw/react-codemirror": "^4.20.4",
29
30
  "aria-hidden": "^1.2.3",
30
31
  "compute-scroll-into-view": "^3.0.3",
31
32
  "prop-types": "^15.8.1",
@@ -33,7 +34,7 @@
33
34
  },
34
35
  "devDependencies": {
35
36
  "@playwright/test": "1.33.0",
36
- "@strapi/icons": "^1.7.9",
37
+ "@strapi/icons": "^1.8.0",
37
38
  "@types/react-router-dom": "^5.3.3",
38
39
  "@types/styled-components": "^5.1.26",
39
40
  "axe-playwright": "^1.2.3",
@@ -64,5 +65,5 @@
64
65
  "test:e2e:watch": "chokidar '**/__tests__/*.e2e.js' -c 'npm run test:e2e -- --retries=0 {path}'",
65
66
  "test:e2e:debug": "cross-env PWDEBUG=1 playwright test"
66
67
  },
67
- "gitHead": "33bc1d7e6ff1ecbc74558af0f155f55293a39e4e"
68
+ "gitHead": "81283e7a5b2112d37be8e75caae5dbb883195349"
68
69
  }
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("react"),O=require("./components.cjs"),W=require("./DatePickerTd.cjs"),n=require("./DatePickerTh.cjs"),$=require("../helpers/getDefaultLocale.cjs"),E=require("./utils/generateWeeks.cjs"),H=require("./utils/getDayOfWeek.cjs"),I=require("./utils/getMonths.cjs"),V=require("./utils/getYears.cjs"),s=require("../SimpleMenu/SimpleMenu.cjs"),z=require("../RawTable/RawTable.cjs"),A=require("../RawTable/RawThead.cjs"),D=require("../RawTable/RawTr.cjs"),G=require("../RawTable/RawTbody.cjs"),J=require("./utils/formatDate.cjs"),K=require("../FocusTrap/FocusTrap.cjs"),h=require("../Box/Box.cjs"),N=require("../Flex/Flex.cjs"),Q=require("../VisuallyHidden/VisuallyHidden.cjs"),U=({onEscape:i,popoverSource:o,...l})=>e.jsx(O.DatePickerPopover,{source:o,role:"dialog","aria-modal":"true",spacing:4,children:e.jsx(K.FocusTrap,{onEscape:i,children:e.jsx(p,{...l})})}),p=({selectedDate:i,initialDate:o=new Date,locale:l,onChange:x,minDate:k,maxDate:T})=>{const[c,d]=j.useState(o),[g,q,w]=E.generateWeeks(c,i),{sun:P,mon:m,tue:f,wed:R,thu:C,fri:M,sat:y}=H.getDayOfWeek(),u=I.getMonths(),S=V.getYears(k,T),b=l||$.getDefaultLocale();j.useEffect(()=>{i&&d(i)},[i]);const F=r=>{const t=new Date(c);t.setMonth(u.indexOf(r)),d(t)},Y=r=>{const t=new Date(c);t.setFullYear(r),d(t)},B=r=>()=>{x&&x(r)};return e.jsxs(h.Box,{padding:4,children:[e.jsx(h.Box,{paddingBottom:4,paddingLeft:2,paddingRight:2,children:e.jsxs(N.Flex,{children:[e.jsx(s.SimpleMenu,{label:u[c.getMonth()],children:u.map(r=>e.jsx(s.MenuItem,{onClick:()=>F(r),children:r},r))}),e.jsx(h.Box,{paddingLeft:2,children:e.jsx(s.SimpleMenu,{label:c.getFullYear(),children:S.map(r=>e.jsx(s.MenuItem,{onClick:()=>Y(r),children:r},r))})})]})}),e.jsxs(z.RawTable,{colCount:7,rowCount:g.length+1,initialCol:w,initialRow:q,role:"grid",children:[e.jsx(A.RawThead,{children:e.jsxs(D.RawTr,{"aria-rowindex":1,children:[e.jsx(n.DatePickerTh,{children:P}),e.jsx(n.DatePickerTh,{children:m}),e.jsx(n.DatePickerTh,{children:f}),e.jsx(n.DatePickerTh,{children:R}),e.jsx(n.DatePickerTh,{children:C}),e.jsx(n.DatePickerTh,{children:M}),e.jsx(n.DatePickerTh,{children:y})]})}),e.jsx(G.RawTbody,{children:g.map((r,t)=>e.jsx(D.RawTr,{children:r.map(({date:a,outsideMonth:v,isSelected:L})=>e.jsxs(W.DatePickerTd,{outsideMonth:v,onSelectDay:B(a),isSelected:L,children:[e.jsx("span",{"aria-hidden":!0,children:a.getDate()}),e.jsx(Q.VisuallyHidden,{children:e.jsx("span",{children:J.formatDate(a,b)})})]},`${a.getFullYear()}-${a.getMonth()+1}-${a.getDate()}`))},t))})]})]})};exports.DatePickerCalendar=U;exports.DatePickerCalendarContent=p;
@@ -1,43 +0,0 @@
1
- import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
- import { useState as E, useEffect as O } from "react";
3
- import { DatePickerPopover as W } from "./components.js";
4
- import { DatePickerTd as H } from "./DatePickerTd.js";
5
- import { DatePickerTh as t } from "./DatePickerTh.js";
6
- import { getDefaultLocale as I } from "../helpers/getDefaultLocale.js";
7
- import { generateWeeks as V } from "./utils/generateWeeks.js";
8
- import { getDayOfWeek as q } from "./utils/getDayOfWeek.js";
9
- import { getMonths as z } from "./utils/getMonths.js";
10
- import { getYears as A } from "./utils/getYears.js";
11
- import { SimpleMenu as u, MenuItem as g } from "../SimpleMenu/SimpleMenu.js";
12
- import { RawTable as G } from "../RawTable/RawTable.js";
13
- import { RawThead as J } from "../RawTable/RawThead.js";
14
- import { RawTr as D } from "../RawTable/RawTr.js";
15
- import { RawTbody as K } from "../RawTable/RawTbody.js";
16
- import { formatDate as N } from "./utils/formatDate.js";
17
- import { FocusTrap as Q } from "../FocusTrap/FocusTrap.js";
18
- import { Box as p } from "../Box/Box.js";
19
- import { Flex as U } from "../Flex/Flex.js";
20
- import { VisuallyHidden as X } from "../VisuallyHidden/VisuallyHidden.js";
21
- const ke = ({ onEscape: i, popoverSource: c, ...d }) => e(W, { source: c, role: "dialog", "aria-modal": "true", spacing: 4, children: e(Q, { onEscape: i, children: e(Z, { ...d }) }) }), Z = ({ selectedDate: i, initialDate: c = /* @__PURE__ */ new Date(), locale: d, onChange: s, minDate: w, maxDate: k }) => {
22
- const [a, m] = E(c), [f, C, M] = V(a, i), { sun: x, mon: R, tue: T, wed: P, thu: F, fri: S, sat: Y } = q(), h = z(), b = A(w, k), y = d || I();
23
- O(() => {
24
- i && m(i);
25
- }, [i]);
26
- const v = (r) => {
27
- const o = new Date(a);
28
- o.setMonth(h.indexOf(r)), m(o);
29
- }, L = (r) => {
30
- const o = new Date(a);
31
- o.setFullYear(r), m(o);
32
- }, $ = (r) => () => {
33
- s && s(r);
34
- };
35
- return l(p, { padding: 4, children: [e(p, { paddingBottom: 4, paddingLeft: 2, paddingRight: 2, children: l(U, { children: [e(u, { label: h[a.getMonth()], children: h.map((r) => e(g, { onClick: () => v(r), children: r }, r)) }), e(p, { paddingLeft: 2, children: e(u, { label: a.getFullYear(), children: b.map((r) => e(g, { onClick: () => L(r), children: r }, r)) }) })] }) }), l(G, { colCount: 7, rowCount: f.length + 1, initialCol: M, initialRow: C, role: "grid", children: [e(J, { children: l(D, { "aria-rowindex": 1, children: [e(t, { children: x }), e(t, { children: R }), e(t, { children: T }), e(t, { children: P }), e(t, { children: F }), e(t, { children: S }), e(t, { children: Y })] }) }), e(K, { children: f.map((r, o) => (
36
- // eslint-disable-next-line react/no-array-index-key
37
- e(D, { children: r.map(({ date: n, outsideMonth: j, isSelected: B }) => l(H, { outsideMonth: j, onSelectDay: $(n), isSelected: B, children: [e("span", { "aria-hidden": !0, children: n.getDate() }), e(X, { children: e("span", { children: N(n, y) }) })] }, `${n.getFullYear()}-${n.getMonth() + 1}-${n.getDate()}`)) }, o)
38
- )) })] })] });
39
- };
40
- export {
41
- ke as DatePickerCalendar,
42
- Z as DatePickerCalendarContent
43
- };
@@ -1,19 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=require("styled-components"),s=require("../RawTable/RawCell.cjs"),l=require("../Typography/Typography.cjs"),c=e=>e&&e.__esModule?e:{default:e},d=c(u),f=d.default.button`
2
- border: none;
3
- background: ${({theme:e,$isSelected:r})=>r?e.colors.primary100:e.colors.neutral0};
4
- height: ${32/16}rem;
5
- text-align: center;
6
- width: ${32/16}rem;
7
- border-radius: ${({theme:e})=>e.borderRadius};
8
-
9
- // Trick to prevent the outline from overflowing because of the general outline-offset
10
- outline-offset: -2px;
11
-
12
- &:hover {
13
- background: ${({theme:e})=>e.colors.primary100};
14
- }
15
-
16
- &:hover > ${l.Typography} {
17
- color: ${({theme:e})=>e.colors.primary600};
18
- }
19
- `,p=({children:e,outsideMonth:r=!1,onSelectDay:i,isSelected:t=!1,...a})=>{let o="neutral900";return t?o="primary600":r&&(o="neutral600"),n.jsx(s.RawTd,{...a,children:n.jsx(f,{tabIndex:-1,onClick:i,$isSelected:t,type:"button",children:n.jsx(l.Typography,{variant:"pi",textColor:o,fontWeight:t?"bold":void 0,children:e})})})};exports.DatePickerTd=p;
@@ -1,29 +0,0 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import c from "styled-components";
3
- import { RawTd as d } from "../RawTable/RawCell.js";
4
- import { Typography as i } from "../Typography/Typography.js";
5
- const f = c.button`
6
- border: none;
7
- background: ${({ theme: r, $isSelected: o }) => o ? r.colors.primary100 : r.colors.neutral0};
8
- height: ${32 / 16}rem;
9
- text-align: center;
10
- width: ${32 / 16}rem;
11
- border-radius: ${({ theme: r }) => r.borderRadius};
12
-
13
- // Trick to prevent the outline from overflowing because of the general outline-offset
14
- outline-offset: -2px;
15
-
16
- &:hover {
17
- background: ${({ theme: r }) => r.colors.primary100};
18
- }
19
-
20
- &:hover > ${i} {
21
- color: ${({ theme: r }) => r.colors.primary600};
22
- }
23
- `, h = ({ children: r, outsideMonth: o = !1, onSelectDay: l, isSelected: e = !1, ...a }) => {
24
- let t = "neutral900";
25
- return e ? t = "primary600" : o && (t = "neutral600"), n(d, { ...a, children: n(f, { tabIndex: -1, onClick: l, $isSelected: e, type: "button", children: n(i, { variant: "pi", textColor: t, fontWeight: e ? "bold" : void 0, children: r }) }) });
26
- };
27
- export {
28
- h as DatePickerTd
29
- };
@@ -1,9 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),o=require("styled-components"),n=require("../RawTable/RawCell.cjs"),s=require("../Flex/Flex.cjs"),l=require("../Typography/Typography.cjs"),a=require("../VisuallyHidden/VisuallyHidden.cjs"),u=e=>e&&e.__esModule?e:{default:e},r=u(o),c=r.default(n.RawTh)`
2
- // Trick to prevent the outline from overflowing because of the general outline-offset
3
- outline-offset: -2px;
4
- border-radius: ${({theme:e})=>e.borderRadius};
5
- text-transform: capitalize;
6
- `,d=r.default(s.Flex)`
7
- height: ${24/16}rem;
8
- width: ${32/16}rem;
9
- `,h=({children:e,...i})=>t.jsx(c,{...i,children:t.jsxs(d,{justifyContent:"center",children:[t.jsx(l.Typography,{variant:"pi",fontWeight:"bold",color:"neutral800","aria-hidden":!0,children:e.substr(0,2)}),t.jsx(a.VisuallyHidden,{children:t.jsx("span",{children:e})})]})});exports.DatePickerTh=h;
@@ -1,18 +0,0 @@
1
- import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
- import t from "styled-components";
3
- import { RawTh as n } from "../RawTable/RawCell.js";
4
- import { Flex as a } from "../Flex/Flex.js";
5
- import { Typography as s } from "../Typography/Typography.js";
6
- import { VisuallyHidden as l } from "../VisuallyHidden/VisuallyHidden.js";
7
- const f = t(n)`
8
- // Trick to prevent the outline from overflowing because of the general outline-offset
9
- outline-offset: -2px;
10
- border-radius: ${({ theme: r }) => r.borderRadius};
11
- text-transform: capitalize;
12
- `, h = t(a)`
13
- height: ${24 / 16}rem;
14
- width: ${32 / 16}rem;
15
- `, T = ({ children: r, ...o }) => e(f, { ...o, children: i(h, { justifyContent: "center", children: [e(s, { variant: "pi", fontWeight: "bold", color: "neutral800", "aria-hidden": !0, children: r.substr(0, 2) }), e(l, { children: e("span", { children: r }) })] }) });
16
- export {
17
- T as DatePickerTh
18
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=(e,t)=>!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();exports.isDateEqual=l;
@@ -1,4 +0,0 @@
1
- const r = (e, t) => !e || !t ? !1 : e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
2
- export {
3
- r as isDateEqual
4
- };
@@ -1,39 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("styled-components"),n=require("../Field/FieldInput.cjs"),a=require("../Popover/Popover.cjs"),i=require("../Box/Box.cjs"),d=e=>e&&e.__esModule?e:{default:e},r=d(o),s=r.default(a.Popover)`
2
- max-height: ${3*6}rem;
3
- overflow: hidden;
4
- `;/**
5
- * @preserve
6
- * @deprecated This component will be removed in the next major version
7
- */const l=r.default.button`
8
- border: none;
9
- background: transparent;
10
- border-radius: ${({theme:e})=>e.borderRadius};
11
- cursor: ${e=>e["aria-disabled"]?"not-allowed":void 0};
12
-
13
- & svg path {
14
- fill: ${({theme:e})=>e.colors.neutral500};
15
- }
16
- `,u=r.default.div`
17
- ${({bold:e,theme:t})=>e?o.css`
18
- & ${n.InputWrapper} {
19
- border: 1px solid ${t.colors.primary600};
20
- }
21
- `:""}
22
- `;/**
23
- * @preserve
24
- * @deprecated This component will be removed in the next major version
25
- */const c=r.default(i.Box)`
26
- background: transparent;
27
- border: none;
28
- position: relative;
29
- z-index: 1;
30
-
31
- svg {
32
- height: ${11/16}rem;
33
- width: ${11/16}rem;
34
- }
35
-
36
- svg path {
37
- fill: ${({theme:e})=>e.colors.neutral600};
38
- }
39
- `;exports.DatePickerButton=l;exports.DatePickerPopover=s;exports.DatePickerWrapper=u;exports.IconBox=c;
@@ -1,53 +0,0 @@
1
- import o, { css as t } from "styled-components";
2
- import { InputWrapper as n } from "../Field/FieldInput.js";
3
- import { Popover as i } from "../Popover/Popover.js";
4
- import { Box as a } from "../Box/Box.js";
5
- const c = o(i)`
6
- max-height: ${3 * 6}rem;
7
- overflow: hidden;
8
- `;
9
- /**
10
- * @preserve
11
- * @deprecated This component will be removed in the next major version
12
- */
13
- const m = o.button`
14
- border: none;
15
- background: transparent;
16
- border-radius: ${({ theme: r }) => r.borderRadius};
17
- cursor: ${(r) => r["aria-disabled"] ? "not-allowed" : void 0};
18
-
19
- & svg path {
20
- fill: ${({ theme: r }) => r.colors.neutral500};
21
- }
22
- `, u = o.div`
23
- ${({ bold: r, theme: e }) => r ? t`
24
- & ${n} {
25
- border: 1px solid ${e.colors.primary600};
26
- }
27
- ` : ""}
28
- `;
29
- /**
30
- * @preserve
31
- * @deprecated This component will be removed in the next major version
32
- */
33
- const $ = o(a)`
34
- background: transparent;
35
- border: none;
36
- position: relative;
37
- z-index: 1;
38
-
39
- svg {
40
- height: ${11 / 16}rem;
41
- width: ${11 / 16}rem;
42
- }
43
-
44
- svg path {
45
- fill: ${({ theme: r }) => r.colors.neutral600};
46
- }
47
- `;
48
- export {
49
- m as DatePickerButton,
50
- c as DatePickerPopover,
51
- u as DatePickerWrapper,
52
- $ as IconBox
53
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=(t,e)=>new Intl.DateTimeFormat(e).format(t);exports.formatDate=r;
@@ -1,4 +0,0 @@
1
- const e = (t, r) => new Intl.DateTimeFormat(r).format(t);
2
- export {
3
- e as formatDate
4
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../compareDates.cjs"),D=7*6,M=(e,g)=>{const i=new Date(e.getFullYear(),e.getMonth(),1),l=new Date(e.getFullYear(),e.getMonth()+1,0).getDate(),c=new Date(e.getFullYear(),e.getMonth(),0).getDate(),r=i.getDay(),h=l+r,s=[];let a=0,u=0,n=0,o;for(let t=0;t<D;t++)t>6&&t%7===0&&n++,s[n]||(s[n]=[]),t<r?o={date:new Date(e.getFullYear(),e.getMonth()-1,c-r+t+1),outsideMonth:!0}:t<h?o={date:new Date(e.getFullYear(),e.getMonth(),t-r+1)}:o={date:new Date(e.getFullYear(),e.getMonth()+1,t-r-l+1),outsideMonth:!0},f.isDateEqual(g,o.date)&&(a=n+1,u=s[n].length,o.isSelected=!0),s[n].push(o);return[s,a,u]};exports.generateWeeks=M;
@@ -1,17 +0,0 @@
1
- import { isDateEqual as f } from "../compareDates.js";
2
- const D = 7 * 6, w = (e, g) => {
3
- const i = new Date(e.getFullYear(), e.getMonth(), 1), l = new Date(e.getFullYear(), e.getMonth() + 1, 0).getDate(), h = new Date(e.getFullYear(), e.getMonth(), 0).getDate(), r = i.getDay(), c = l + r, s = [];
4
- let a = 0, u = 0, n = 0, o;
5
- for (let t = 0; t < D; t++)
6
- t > 6 && t % 7 === 0 && n++, s[n] || (s[n] = []), t < r ? o = {
7
- date: new Date(e.getFullYear(), e.getMonth() - 1, h - r + t + 1),
8
- outsideMonth: !0
9
- } : t < c ? o = { date: new Date(e.getFullYear(), e.getMonth(), t - r + 1) } : o = {
10
- date: new Date(e.getFullYear(), e.getMonth() + 1, t - r - l + 1),
11
- outsideMonth: !0
12
- }, f(g, o.date) && (a = n + 1, u = s[n].length, o.isSelected = !0), s[n].push(o);
13
- return [s, a, u];
14
- };
15
- export {
16
- w as generateWeeks
17
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=()=>{const e=new Intl.DateTimeFormat(void 0,{weekday:"long"}).format,t=new Date(1970,0,1),n=new Date(1970,0,2),o=new Date(1970,0,3),a=new Date(1970,0,4),s=new Date(1970,0,5),c=new Date(1970,0,6),r=new Date(1970,0,7);return{sun:e(a),mon:e(s),tue:e(c),wed:e(r),thu:e(t),fri:e(n),sat:e(o)}};exports.getDayOfWeek=u;
@@ -1,15 +0,0 @@
1
- const D = () => {
2
- const e = new Intl.DateTimeFormat(void 0, { weekday: "long" }).format, t = new Date(1970, 0, 1), n = new Date(1970, 0, 2), o = new Date(1970, 0, 3), a = new Date(1970, 0, 4), s = new Date(1970, 0, 5), w = new Date(1970, 0, 6), c = new Date(1970, 0, 7);
3
- return {
4
- sun: e(a),
5
- mon: e(s),
6
- tue: e(w),
7
- wed: e(c),
8
- thu: e(t),
9
- fri: e(n),
10
- sat: e(o)
11
- };
12
- };
13
- export {
14
- D as getDayOfWeek
15
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=()=>{const t=new Intl.DateTimeFormat(void 0,{month:"long"}).format;return Array(12).fill(null).map((o,e)=>t(new Date(1970,e,1)))};exports.getMonths=n;
@@ -1,7 +0,0 @@
1
- const o = () => {
2
- const t = new Intl.DateTimeFormat(void 0, { month: "long" }).format;
3
- return Array(12).fill(null).map((e, n) => t(new Date(1970, n, 1)));
4
- };
5
- export {
6
- o as getMonths
7
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=200,l=15,u=(s,a)=>{const t=new Date().getFullYear(),n=s?.getFullYear()??t-c,o=a?.getFullYear()??t+l,r=[];for(let e=n;e<=o;e++)r.push(e);return r};exports.getYears=u;
@@ -1,9 +0,0 @@
1
- const E = (n, s) => {
2
- const t = (/* @__PURE__ */ new Date()).getFullYear(), a = n?.getFullYear() ?? t - 200, A = s?.getFullYear() ?? t + 15, r = [];
3
- for (let e = a; e <= A; e++)
4
- r.push(e);
5
- return r;
6
- };
7
- export {
8
- E as getYears
9
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./getDayOfWeek.cjs"),t=require("./getMonths.cjs"),r=require("./generateWeeks.cjs"),a=require("./getYears.cjs"),s=require("./formatDate.cjs");exports.getDayOfWeek=e.getDayOfWeek;exports.getMonths=t.getMonths;exports.generateWeeks=r.generateWeeks;exports.getYears=a.getYears;exports.formatDate=s.formatDate;
@@ -1,12 +0,0 @@
1
- import { getDayOfWeek as o } from "./getDayOfWeek.js";
2
- import { getMonths as f } from "./getMonths.js";
3
- import { generateWeeks as a } from "./generateWeeks.js";
4
- import { getYears as x } from "./getYears.js";
5
- import { formatDate as s } from "./formatDate.js";
6
- export {
7
- s as formatDate,
8
- a as generateWeeks,
9
- o as getDayOfWeek,
10
- f as getMonths,
11
- x as getYears
12
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=t=>{const e=Date.parse(t);if(!Number.isNaN(e))return new Date(e)};exports.parseDate=r;
@@ -1,8 +0,0 @@
1
- const r = (t) => {
2
- const e = Date.parse(t);
3
- if (!Number.isNaN(e))
4
- return new Date(e);
5
- };
6
- export {
7
- r as parseDate
8
- };