@flipdish/ui-library 0.32.0 → 0.33.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/atoms/Avatar/components/AvatarLabelGroup.cjs +6 -4
- package/dist/components/atoms/Avatar/components/AvatarLabelGroup.cjs.map +1 -1
- package/dist/components/atoms/Avatar/components/AvatarLabelGroup.d.ts +7 -1
- package/dist/components/atoms/Avatar/components/AvatarLabelGroup.d.ts.map +1 -1
- package/dist/components/atoms/Avatar/components/AvatarLabelGroup.js +6 -4
- package/dist/components/atoms/Avatar/components/AvatarLabelGroup.js.map +1 -1
- package/dist/components/atoms/Badge/badge.types.cjs.map +1 -1
- package/dist/components/atoms/Badge/badge.types.d.ts +2 -1
- package/dist/components/atoms/Badge/badge.types.d.ts.map +1 -1
- package/dist/components/atoms/Badge/badge.types.js.map +1 -1
- package/dist/components/atoms/Badge/index.cjs +2 -1
- package/dist/components/atoms/Badge/index.cjs.map +1 -1
- package/dist/components/atoms/Badge/index.d.ts.map +1 -1
- package/dist/components/atoms/Badge/index.js +2 -1
- package/dist/components/atoms/Badge/index.js.map +1 -1
- package/dist/components/atoms/Card/index.cjs +28 -0
- package/dist/components/atoms/Card/index.cjs.map +1 -0
- package/dist/components/atoms/Card/index.d.ts +20 -0
- package/dist/components/atoms/Card/index.d.ts.map +1 -0
- package/dist/components/atoms/Card/index.js +26 -0
- package/dist/components/atoms/Card/index.js.map +1 -0
- package/dist/components/atoms/CopyButton/index.cjs +27 -0
- package/dist/components/atoms/CopyButton/index.cjs.map +1 -0
- package/dist/components/atoms/CopyButton/index.d.ts +28 -0
- package/dist/components/atoms/CopyButton/index.d.ts.map +1 -0
- package/dist/components/atoms/CopyButton/index.js +25 -0
- package/dist/components/atoms/CopyButton/index.js.map +1 -0
- package/dist/components/atoms/Flag/flag.types.d.ts +6 -0
- package/dist/components/atoms/Flag/flag.types.d.ts.map +1 -0
- package/dist/components/atoms/Flag/flag.utils.cjs +45 -0
- package/dist/components/atoms/Flag/flag.utils.cjs.map +1 -0
- package/dist/components/atoms/Flag/flag.utils.d.ts +15 -0
- package/dist/components/atoms/Flag/flag.utils.d.ts.map +1 -0
- package/dist/components/atoms/Flag/flag.utils.js +42 -0
- package/dist/components/atoms/Flag/flag.utils.js.map +1 -0
- package/dist/components/atoms/Flag/index.cjs +47 -0
- package/dist/components/atoms/Flag/index.cjs.map +1 -0
- package/dist/components/atoms/Flag/index.d.ts +27 -0
- package/dist/components/atoms/Flag/index.d.ts.map +1 -0
- package/dist/components/atoms/Flag/index.js +45 -0
- package/dist/components/atoms/Flag/index.js.map +1 -0
- package/dist/components/atoms/SearchInput/index.cjs +32 -0
- package/dist/components/atoms/SearchInput/index.cjs.map +1 -0
- package/dist/components/atoms/SearchInput/index.d.ts +40 -0
- package/dist/components/atoms/SearchInput/index.d.ts.map +1 -0
- package/dist/components/atoms/SearchInput/index.js +30 -0
- package/dist/components/atoms/SearchInput/index.js.map +1 -0
- package/dist/components/molecules/Carousel/hooks/useCarouselScroll.cjs +81 -0
- package/dist/components/molecules/Carousel/hooks/useCarouselScroll.cjs.map +1 -0
- package/dist/components/molecules/Carousel/hooks/useCarouselScroll.d.ts +46 -0
- package/dist/components/molecules/Carousel/hooks/useCarouselScroll.d.ts.map +1 -0
- package/dist/components/molecules/Carousel/hooks/useCarouselScroll.js +79 -0
- package/dist/components/molecules/Carousel/hooks/useCarouselScroll.js.map +1 -0
- package/dist/components/molecules/Carousel/index.cjs +8 -55
- package/dist/components/molecules/Carousel/index.cjs.map +1 -1
- package/dist/components/molecules/Carousel/index.d.ts +3 -7
- package/dist/components/molecules/Carousel/index.d.ts.map +1 -1
- package/dist/components/molecules/Carousel/index.js +9 -56
- package/dist/components/molecules/Carousel/index.js.map +1 -1
- package/dist/components/molecules/CodeSnippet/codeSnippet.utils.cjs +17 -0
- package/dist/components/molecules/CodeSnippet/codeSnippet.utils.cjs.map +1 -0
- package/dist/components/molecules/CodeSnippet/codeSnippet.utils.d.ts +8 -0
- package/dist/components/molecules/CodeSnippet/codeSnippet.utils.d.ts.map +1 -0
- package/dist/components/molecules/CodeSnippet/codeSnippet.utils.js +15 -0
- package/dist/components/molecules/CodeSnippet/codeSnippet.utils.js.map +1 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetCollapse.cjs +29 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetCollapse.cjs.map +1 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetCollapse.d.ts +29 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetCollapse.d.ts.map +1 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetCollapse.js +27 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetCollapse.js.map +1 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetHighlight.cjs +23 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetHighlight.cjs.map +1 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetHighlight.d.ts +21 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetHighlight.d.ts.map +1 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetHighlight.js +21 -0
- package/dist/components/molecules/CodeSnippet/hooks/useCodeSnippetHighlight.js.map +1 -0
- package/dist/components/molecules/CodeSnippet/index.cjs +7 -22
- package/dist/components/molecules/CodeSnippet/index.cjs.map +1 -1
- package/dist/components/molecules/CodeSnippet/index.d.ts.map +1 -1
- package/dist/components/molecules/CodeSnippet/index.js +8 -23
- package/dist/components/molecules/CodeSnippet/index.js.map +1 -1
- package/dist/components/molecules/DetailList/detailList.types.d.ts +15 -0
- package/dist/components/molecules/DetailList/detailList.types.d.ts.map +1 -0
- package/dist/components/molecules/DetailList/index.cjs +32 -0
- package/dist/components/molecules/DetailList/index.cjs.map +1 -0
- package/dist/components/molecules/DetailList/index.d.ts +26 -0
- package/dist/components/molecules/DetailList/index.d.ts.map +1 -0
- package/dist/components/molecules/DetailList/index.js +30 -0
- package/dist/components/molecules/DetailList/index.js.map +1 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.cjs +43 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.cjs.map +1 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.d.ts +24 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.d.ts.map +1 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.js +41 -0
- package/dist/components/molecules/RadioGroup/components/RadioGroupAvatarCard.js.map +1 -0
- package/dist/components/molecules/RadioGroup/index.cjs +2 -0
- package/dist/components/molecules/RadioGroup/index.cjs.map +1 -1
- package/dist/components/molecules/RadioGroup/index.d.ts +2 -0
- package/dist/components/molecules/RadioGroup/index.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroup/index.js +1 -0
- package/dist/components/molecules/RadioGroup/index.js.map +1 -1
- package/dist/components/molecules/RadioGroup/radioGroup.types.d.ts +17 -1
- package/dist/components/molecules/RadioGroup/radioGroup.types.d.ts.map +1 -1
- package/dist/components/organisms/ApplicationHeader/applicationHeader.types.d.ts +8 -2
- package/dist/components/organisms/ApplicationHeader/applicationHeader.types.d.ts.map +1 -1
- package/dist/components/organisms/ApplicationHeader/components/AvatarButton.cjs +4 -1
- package/dist/components/organisms/ApplicationHeader/components/AvatarButton.cjs.map +1 -1
- package/dist/components/organisms/ApplicationHeader/components/AvatarButton.d.ts +2 -1
- package/dist/components/organisms/ApplicationHeader/components/AvatarButton.d.ts.map +1 -1
- package/dist/components/organisms/ApplicationHeader/components/AvatarButton.js +4 -1
- package/dist/components/organisms/ApplicationHeader/components/AvatarButton.js.map +1 -1
- package/dist/components/organisms/ApplicationHeader/index.cjs +1 -1
- package/dist/components/organisms/ApplicationHeader/index.cjs.map +1 -1
- package/dist/components/organisms/ApplicationHeader/index.d.ts.map +1 -1
- package/dist/components/organisms/ApplicationHeader/index.js +1 -1
- package/dist/components/organisms/ApplicationHeader/index.js.map +1 -1
- package/dist/components/organisms/DatePicker/calendarCell.utils.cjs +53 -0
- package/dist/components/organisms/DatePicker/calendarCell.utils.cjs.map +1 -0
- package/dist/components/organisms/DatePicker/calendarCell.utils.d.ts +70 -0
- package/dist/components/organisms/DatePicker/calendarCell.utils.d.ts.map +1 -0
- package/dist/components/organisms/DatePicker/calendarCell.utils.js +49 -0
- package/dist/components/organisms/DatePicker/calendarCell.utils.js.map +1 -0
- package/dist/components/organisms/DatePicker/components/Cell.cjs +24 -30
- package/dist/components/organisms/DatePicker/components/Cell.cjs.map +1 -1
- package/dist/components/organisms/DatePicker/components/Cell.d.ts.map +1 -1
- package/dist/components/organisms/DatePicker/components/Cell.js +25 -31
- package/dist/components/organisms/DatePicker/components/Cell.js.map +1 -1
- package/dist/components/organisms/FileUpload/fileUpload.utils.cjs +69 -0
- package/dist/components/organisms/FileUpload/fileUpload.utils.cjs.map +1 -0
- package/dist/components/organisms/FileUpload/fileUpload.utils.d.ts +46 -0
- package/dist/components/organisms/FileUpload/fileUpload.utils.d.ts.map +1 -0
- package/dist/components/organisms/FileUpload/fileUpload.utils.js +65 -0
- package/dist/components/organisms/FileUpload/fileUpload.utils.js.map +1 -0
- package/dist/components/organisms/FileUpload/index.cjs +15 -66
- package/dist/components/organisms/FileUpload/index.cjs.map +1 -1
- package/dist/components/organisms/FileUpload/index.d.ts.map +1 -1
- package/dist/components/organisms/FileUpload/index.js +13 -64
- package/dist/components/organisms/FileUpload/index.js.map +1 -1
- package/dist/components/organisms/HeaderNavigation/index.cjs +2 -3
- package/dist/components/organisms/HeaderNavigation/index.cjs.map +1 -1
- package/dist/components/organisms/HeaderNavigation/index.d.ts.map +1 -1
- package/dist/components/organisms/HeaderNavigation/index.js +2 -3
- package/dist/components/organisms/HeaderNavigation/index.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.cjs +3 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.js +3 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.cjs +3 -3
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.d.ts +7 -2
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.js +3 -3
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.cjs +7 -3
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.d.ts +6 -2
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.js +7 -3
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.cjs +8 -3
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.d.ts +2 -1
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.js +8 -3
- package/dist/components/organisms/SidePanel/components/SidePanelRegion.js.map +1 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.cjs +12 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.d.ts +3 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.js +13 -2
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.js.map +1 -1
- package/dist/components/organisms/SidePanel/index.cjs +2 -2
- package/dist/components/organisms/SidePanel/index.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/index.d.ts +3 -1
- package/dist/components/organisms/SidePanel/index.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/index.js +2 -2
- package/dist/components/organisms/SidePanel/index.js.map +1 -1
- package/dist/components/organisms/TreeView/index.cjs +11 -26
- package/dist/components/organisms/TreeView/index.cjs.map +1 -1
- package/dist/components/organisms/TreeView/index.d.ts.map +1 -1
- package/dist/components/organisms/TreeView/index.js +12 -27
- package/dist/components/organisms/TreeView/index.js.map +1 -1
- package/dist/components/organisms/TreeView/treeView.utils.cjs +40 -0
- package/dist/components/organisms/TreeView/treeView.utils.cjs.map +1 -1
- package/dist/components/organisms/TreeView/treeView.utils.d.ts +37 -0
- package/dist/components/organisms/TreeView/treeView.utils.d.ts.map +1 -1
- package/dist/components/organisms/TreeView/treeView.utils.js +39 -1
- package/dist/components/organisms/TreeView/treeView.utils.js.map +1 -1
- package/dist/native/components/atoms/Card/index.d.ts +12 -0
- package/dist/native/components/atoms/CopyButton/index.d.ts +12 -0
- package/dist/native/components/atoms/Flag/index.d.ts +12 -0
- package/dist/native/components/atoms/SearchInput/index.d.ts +12 -0
- package/dist/native/components/molecules/DetailList/index.d.ts +12 -0
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/ApplicationHeader/index.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useHotkeyHint","safeHref","_jsx","TestIdProvider","_jsxs","cx","MenuButton","joinTestId","FlipdishLogo","AriaLink","SearchTrigger","HeaderAction","Bell01","getNotificationsLabel","formatBadgeCount","Stars01","AvatarButton"],"mappings":";;;;;;;;;;;;;;;;AA+BA;;;AAGG;AACI,MAAM,uBAAuB,GAAG;AAiCvC;;;;;;AAMG;AACI,MAAM,i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AC,QAAQ,EACvB,SAAS,EAAC,WAAW,EAAA,aAAA,EACR,IAAI,CAAC,aAAa,CAAC,IAAIC,sBAAU,CAAC,UAAU,EAAE,MAAM,CAAC,GAClE,CACH,EAEDL,wBAAK,SAAS,EAAC,4CAA4C,EAAA,QAAA,EACxD,YAAY,KAAK,SAAS;;AAEzB,oBAAAA,cAAA,CAACM,yBAAY,EAAA,EAAC,IAAI,EAAC,IAAI,EAAA,aAAA,EAAcD,sBAAU,CAAC,UAAU,EAAE,MAAM,CAAC,GAAI,KAEvEL,cAAA,CAACO,wBAAQ,EAAA,EACP,IAAI,EAAE,YAAY,EAAA,YAAA,EACP,gBAAgB,EAAA,aAAA,EACdF,sBAAU,CAAC,UAAU,EAAE,MAAM,CAAC,EAC3C,SAAS,EAAC,sFAAsF,EAAA,QAAA,EAEhGL,cAAA,CAACM,yBAAY,EAAA,EAAC,IAAI,EAAC,IAAI,EAAA,aAAA,EAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/ApplicationHeader/index.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useHotkeyHint","safeHref","_jsx","TestIdProvider","_jsxs","cx","MenuButton","joinTestId","FlipdishLogo","AriaLink","SearchTrigger","HeaderAction","Bell01","getNotificationsLabel","formatBadgeCount","Stars01","AvatarButton"],"mappings":";;;;;;;;;;;;;;;;AA+BA;;;AAGG;AACI,MAAM,uBAAuB,GAAG;AAiCvC;;;;;;AAMG;AACI,MAAM,iBAAiB,GAAG,CAAC,EAChC,MAAM,EACN,aAAa,EACb,SAAS,EACT,MAAM,EACN,IAAI,EACJ,QAAQ,GAAG,GAAG,EACd,SAAS,EACT,aAAa,EAAE,UAAU,GACF,KAAI;AAC3B,IAAA,MAAM,UAAU,GAAGA,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,CAAC;;IAG3H,MAAM,QAAQ,G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EAAEI,eAAO,EACb,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,SAAS,CAAC,MAAM,EACxB,OAAO,EAAE,SAAS,CAAC,OAAO,EAAA,aAAA,EACb,SAAS,CAAC,aAAa,CAAC,IAAIR,sBAAU,CAAC,UAAU,EAAE,WAAW,CAAC,EAAA,CAC5E,CACH,EAEA,MAAM,KACLL,cAAA,CAACc,yBAAY,EAAA,EACX,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,GAAG,EAAE,MAAM,CAAC,GAAG,EACf,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,EAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EACrB,OAAO,EAAE,MAAM,CAAC,OAAO,iBACV,MAAM,CAAC,aAAa,CAAC,IAAIT,sBAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAA,CACtE,CACH,CAAA,EAAA,CACG,CACP,CAAA,EAAA,CACM,EAAA,CACM;AAErB;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/ApplicationHeader/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,EAC9B,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AAOnC,YAAY,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,+DAA+D;IAC/D,aAAa,CAAC,EAAE,8BAA8B,CAAC;IAC/C,yCAAyC;IACzC,SAAS,CAAC,EAAE,0BAA0B,CAAC;IACvC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC;;;OAGG;IACH,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,qGAS/B,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/ApplicationHeader/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,EAC9B,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AAOnC,YAAY,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,+DAA+D;IAC/D,aAAa,CAAC,EAAE,8BAA8B,CAAC;IAC/C,yCAAyC;IACzC,SAAS,CAAC,EAAE,0BAA0B,CAAC;IACvC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC;;;OAGG;IACH,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,qGAS/B,sBAAsB,gCAsGxB,CAAC"}
|
|
@@ -36,7 +36,7 @@ const ApplicationHeader = ({ search, notifications, assistant, avatar, menu, hom
|
|
|
36
36
|
const safeHomeHref = safeHref(homeHref);
|
|
37
37
|
return (jsx(TestIdProvider, { value: rootTestId, children: jsxs("header", { "data-testid": rootTestId, className: cx('sticky top-0 z-30 flex h-14 w-full items-center gap-2 border-b border-secondary bg-primary pr-3 pl-4 lg:h-16 lg:px-6', className), children: [menu && (jsx(MenuButton, { isOpen: menu.isOpen, onPress: () => menu.onOpenChange(!menu.isOpen), label: menuLabel, controls: menu.controls, className: "lg:hidden", "data-testid": menu['data-testid'] ?? joinTestId(rootTestId, 'menu') })), jsx("div", { className: "flex min-w-0 flex-1 items-center lg:hidden", children: safeHomeHref === undefined ? (
|
|
38
38
|
// A rejected `homeHref` leaves a plain logo: no link role, nothing to activate.
|
|
39
|
-
jsx(FlipdishLogo, { size: "sm", "data-testid": joinTestId(rootTestId, 'logo') })) : (jsx(Link, { href: safeHomeHref, "aria-label": "Go to homepage", "data-testid": joinTestId(rootTestId, 'logo'), className: "rounded-xs outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2", children: jsx(FlipdishLogo, { size: "sm", "aria-hidden": "true" }) })) }), search && (jsx(SearchTrigger, { size: "sm", placeholder: search.placeholder ?? 'Search', label: search.label ?? 'Search', onPress: search.onPress, shortcutHint: shortcutHint, className: "w-80 max-lg:hidden", "data-testid": search['data-testid'] ?? joinTestId(rootTestId, 'search') })), hasActions && (jsxs("div", { className: "flex shrink-0 items-center gap-2 lg:ml-auto", children: [notifications && (jsx(HeaderAction, { icon: Bell01, label: getNotificationsLabel(notificationsLabel, notifications.count), tooltip: notificationsLabel, badge: formatBadgeCount(notifications.count), isOpen: notifications.isOpen, onPress: notifications.onPress, "data-testid": notifications['data-testid'] ?? joinTestId(rootTestId, 'notifications') })), assistant && (jsx(HeaderAction, { icon: Stars01, label: assistantLabel, tooltip: assistantLabel, isOpen: assistant.isOpen, onPress: assistant.onPress, "data-testid": assistant['data-testid'] ?? joinTestId(rootTestId, 'assistant') })), avatar && (jsx(AvatarButton, { name: avatar.name, src: avatar.src, initials: avatar.initials, label: avatar.label ?? avatar.name, onPress: avatar.onPress, "data-testid": avatar['data-testid'] ?? joinTestId(rootTestId, 'avatar') }))] }))] }) }));
|
|
39
|
+
jsx(FlipdishLogo, { size: "sm", "data-testid": joinTestId(rootTestId, 'logo') })) : (jsx(Link, { href: safeHomeHref, "aria-label": "Go to homepage", "data-testid": joinTestId(rootTestId, 'logo'), className: "rounded-xs outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2", children: jsx(FlipdishLogo, { size: "sm", "aria-hidden": "true" }) })) }), search && (jsx(SearchTrigger, { size: "sm", placeholder: search.placeholder ?? 'Search', label: search.label ?? 'Search', onPress: search.onPress, shortcutHint: shortcutHint, className: "w-80 max-lg:hidden", "data-testid": search['data-testid'] ?? joinTestId(rootTestId, 'search') })), hasActions && (jsxs("div", { className: "flex shrink-0 items-center gap-2 lg:ml-auto", children: [notifications && (jsx(HeaderAction, { icon: Bell01, label: getNotificationsLabel(notificationsLabel, notifications.count), tooltip: notificationsLabel, badge: formatBadgeCount(notifications.count), isOpen: notifications.isOpen, onPress: notifications.onPress, "data-testid": notifications['data-testid'] ?? joinTestId(rootTestId, 'notifications') })), assistant && (jsx(HeaderAction, { icon: Stars01, label: assistantLabel, tooltip: assistantLabel, isOpen: assistant.isOpen, onPress: assistant.onPress, "data-testid": assistant['data-testid'] ?? joinTestId(rootTestId, 'assistant') })), avatar && (jsx(AvatarButton, { name: avatar.name, src: avatar.src, initials: avatar.initials, label: avatar.label ?? avatar.name, isOpen: avatar.isOpen, onPress: avatar.onPress, "data-testid": avatar['data-testid'] ?? joinTestId(rootTestId, 'avatar') }))] }))] }) }));
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
export { ApplicationHeader, DEFAULT_SEARCH_SHORTCUT };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/ApplicationHeader/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","AriaLink"],"mappings":";;;;;;;;;;;;;;AA+BA;;;AAGG;AACI,MAAM,uBAAuB,GAAG;AAiCvC;;;;;;AAMG;AACI,MAAM,iBAAiB,GAAG,CAAC,EAChC,MAAM,EACN,aAAa,EACb,SAAS,EACT,MAAM,EACN,IAAI,EACJ,QAAQ,GAAG,GAAG,EACd,SAAS,EACT,aAAa,EAAE,UAAU,GACF,KAAI;AAC3B,IAAA,MAAM,UAAU,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,CAAC;;IAG3H,MAAM,QAAQ,GAAG,MAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,GAAG,uBAAuB,GAAG,MAAM,CAAC,QAAQ,IAAI,IAAI;AAC5G,IAAA,MAAM,YAAY,GAAG,aAAa,CAAC,QAAQ,CAAC;AAE5C,IAAA,MAAM,kBAAkB,GAAG,aAAa,EAAE,KAAK,IAAI,eAAe;AAClE,IAAA,MAAM,cAAc,GAAG,SAAS,EAAE,KAAK,IAAI,WAAW;AACtD,IAAA,MAAM,SAAS,GAAG,IAAI,EAAE,KAAK,KAAK,IAAI,EAAE,MAAM,GAAG,uBAAuB,GAAG,sBAAsB,CAAC;IAClG,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,IAAI,SAAS,IAAI,MAAM,CAAC;AAChE,IAAA,MAAM,YAAY,GAAG,QAAQ,CAAC,QAAQ,CAAC;AAEvC,IAAA,QACEA,GAAA,CAAC,cAAc,IAAC,KAAK,EAAE,UAAU,EAAA,QAAA,EAC/BC,IAAA,CAAA,QAAA,EAAA,EAAA,aAAA,EACe,UAAU,EACvB,SAAS,EAAE,EAAE,CACX,sHAAsH,EACtH,SAAS,CACV,EAAA,QAAA,EAAA,CAEA,IAAI,KACHD,GAAA,CAAC,UAAU,IACT,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAC9C,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAC,WAAW,EAAA,aAAA,EACR,IAAI,CAAC,aAAa,CAAC,IAAI,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,GAClE,CACH,EAEDA,aAAK,SAAS,EAAC,4CAA4C,EAAA,QAAA,EACxD,YAAY,KAAK,SAAS;;AAEzB,oBAAAA,GAAA,CAAC,YAAY,EAAA,EAAC,IAAI,EAAC,IAAI,EAAA,aAAA,EAAc,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,GAAI,KAEvEA,GAAA,CAACE,IAAQ,EAAA,EACP,IAAI,EAAE,YAAY,EAAA,YAAA,EACP,gBAAgB,EAAA,aAAA,EACd,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,EAC3C,SAAS,EAAC,sFAAsF,EAAA,QAAA,EAEhGF,GAAA,CAAC,YAAY,EAAA,EAAC,IAAI,EAAC,IAAI,EAAA,aAAA,EAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/ApplicationHeader/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","AriaLink"],"mappings":";;;;;;;;;;;;;;AA+BA;;;AAGG;AACI,MAAM,uBAAuB,GAAG;AAiCvC;;;;;;AAMG;AACI,MAAM,iBAAiB,GAAG,CAAC,EAChC,MAAM,EACN,aAAa,EACb,SAAS,EACT,MAAM,EACN,IAAI,EACJ,QAAQ,GAAG,GAAG,EACd,SAAS,EACT,aAAa,EAAE,UAAU,GACF,KAAI;AAC3B,IAAA,MAAM,UAAU,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,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A,GAAA,CAAC,YAAY,EAAA,EACX,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,SAAS,CAAC,MAAM,EACxB,OAAO,EAAE,SAAS,CAAC,OAAO,EAAA,aAAA,EACb,SAAS,CAAC,aAAa,CAAC,IAAI,UAAU,CAAC,UAAU,EAAE,WAAW,CAAC,EAAA,CAC5E,CACH,EAEA,MAAM,KACLA,GAAA,CAAC,YAAY,EAAA,EACX,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,GAAG,EAAE,MAAM,CAAC,GAAG,EACf,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,EAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EACrB,OAAO,EAAE,MAAM,CAAC,OAAO,iBACV,MAAM,CAAC,aAAa,CAAC,IAAI,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAA,CACtE,CACH,CAAA,EAAA,CACG,CACP,CAAA,EAAA,CACM,EAAA,CACM;AAErB;;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var date = require('@internationalized/date');
|
|
4
|
+
|
|
5
|
+
/** Day 0 of the next 0-based month is the last day of this calendar month. */
|
|
6
|
+
const lastDayOfMonth = (date) => new Date(date.year, date.month, 0).getDate();
|
|
7
|
+
/**
|
|
8
|
+
* Places a calendar date against the live range.
|
|
9
|
+
*
|
|
10
|
+
* @param date The cell's date.
|
|
11
|
+
* @param range The calendar's current start and end, or null on a single-date calendar.
|
|
12
|
+
* @returns Position flags used to choose the cell's range styling.
|
|
13
|
+
*/
|
|
14
|
+
const getCalendarCellRangePosition = (date, range) => {
|
|
15
|
+
const start = range?.start;
|
|
16
|
+
const end = range?.end;
|
|
17
|
+
const isAfterOrOnStart = Boolean(start && date.compare(start) >= 0);
|
|
18
|
+
const isBeforeOrOnEnd = Boolean(end && date.compare(end) <= 0);
|
|
19
|
+
return {
|
|
20
|
+
isAfterStart: start ? date.compare(start) > 0 : true,
|
|
21
|
+
isBeforeEnd: end ? date.compare(end) < 0 : true,
|
|
22
|
+
isInRange: isAfterOrOnStart && isBeforeOrOnEnd,
|
|
23
|
+
isFirstDayOfMonth: date.day === 1,
|
|
24
|
+
isLastDayOfMonth: date.day === lastDayOfMonth(date),
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Decides the range chrome for one cell state. Week edges round even mid-range, so a selection that spans a week still reads as one pill per row.
|
|
29
|
+
*
|
|
30
|
+
* @param options The cell date, the locale, and the selection state from the calendar.
|
|
31
|
+
* @returns Which corners round and which month-edge gradients to paint.
|
|
32
|
+
*/
|
|
33
|
+
const getCalendarCellOutline = ({ date: date$1, locale, isSelectionStart, isSelectionEnd, isSelected, isRangeCalendar, position, }) => {
|
|
34
|
+
const dayOfWeek = date.getDayOfWeek(date$1, locale);
|
|
35
|
+
return {
|
|
36
|
+
isRoundedLeft: isSelectionStart || dayOfWeek === 0,
|
|
37
|
+
isRoundedRight: isSelectionEnd || dayOfWeek === 6,
|
|
38
|
+
showLeadingGradient: position.isFirstDayOfMonth && isSelected && position.isAfterStart && isRangeCalendar,
|
|
39
|
+
showTrailingGradient: position.isLastDayOfMonth && isSelected && position.isBeforeEnd && isRangeCalendar,
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Whether the inner disc uses the solid selected fill.
|
|
44
|
+
*
|
|
45
|
+
* @param options Selection and disabled state for this cell.
|
|
46
|
+
* @returns True for either end of a range, or for the selected day of a single-date calendar that is not disabled.
|
|
47
|
+
*/
|
|
48
|
+
const isCalendarCellMarkedSelected = ({ isSelectionStart, isSelectionEnd, isSelected, isDisabled, isRangeCalendar, }) => isSelectionStart || isSelectionEnd || (isSelected && !isDisabled && !isRangeCalendar);
|
|
49
|
+
|
|
50
|
+
exports.getCalendarCellOutline = getCalendarCellOutline;
|
|
51
|
+
exports.getCalendarCellRangePosition = getCalendarCellRangePosition;
|
|
52
|
+
exports.isCalendarCellMarkedSelected = isCalendarCellMarkedSelected;
|
|
53
|
+
//# sourceMappingURL=calendarCell.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendarCell.utils.cjs","sources":["../../../../src/components/organisms/DatePicker/calendarCell.utils.ts"],"sourcesContent":[null],"names":["date","getDayOfWeek"],"mappings":";;;;AA8BA;AACA,MAAM,cAAc,GAAG,CAAC,IAAe,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE;AAExF;;;;;;AAMG;MACU,4BAA4B,GAAG,CAAC,IAAe,EAAE,KAA+B,KAA+B;AAC1H,IAAA,MAAM,KAAK,GAAG,KAAK,EAAE,KAAK;AAC1B,IAAA,MAAM,GAAG,GAAG,KAAK,EAAE,GAAG;AACtB,IAAA,MAAM,gBAAgB,GAAG,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACnE,IAAA,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAE9D,OAAO;AACL,QAAA,YAAY,EAAE,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI;AACpD,QAAA,WAAW,EAAE,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI;QAC/C,SAAS,EAAE,gBAAgB,IAAI,eAAe;AAC9C,QAAA,iBAAiB,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC;QACjC,gBAAgB,EAAE,IAAI,CAAC,GAAG,KAAK,cAAc,CAAC,IAAI,CAAC;KACpD;AACH;AAeA;;;;;AAKG;MACU,sBAAsB,GAAG,CAAC,QACrCA,MAAI,EACJ,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,eAAe,EACf,QAAQ,GACmB,KAAyB;IACpD,MAAM,SAAS,GAAGC,iBAAY,CAACD,MAAI,EAAE,MAAM,CAAC;IAE5C,OAAO;AACL,QAAA,aAAa,EAAE,gBAAgB,IAAI,SAAS,KAAK,CAAC;AAClD,QAAA,cAAc,EAAE,cAAc,IAAI,SAAS,KAAK,CAAC;QACjD,mBAAmB,EAAE,QAAQ,CAAC,iBAAiB,IAAI,UAAU,IAAI,QAAQ,CAAC,YAAY,IAAI,eAAe;QACzG,oBAAoB,EAAE,QAAQ,CAAC,gBAAgB,IAAI,UAAU,IAAI,QAAQ,CAAC,WAAW,IAAI,eAAe;KACzG;AACH;AAWA;;;;;AAKG;AACI,MAAM,4BAA4B,GAAG,CAAC,EAC3C,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,UAAU,EACV,eAAe,GACmB,KAAc,gBAAgB,IAAI,cAAc,KAAK,UAAU,IAAI,CAAC,UAAU,IAAI,CAAC,eAAe;;;;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type DateValue } from '@internationalized/date';
|
|
2
|
+
/** The live range a cell is painted against. Either bound may be missing while a selection is in progress. */
|
|
3
|
+
export interface CalendarCellRange {
|
|
4
|
+
start?: DateValue | null;
|
|
5
|
+
end?: DateValue | null;
|
|
6
|
+
}
|
|
7
|
+
/** Where a date sits relative to the range, and whether it is a month edge. */
|
|
8
|
+
export interface CalendarCellRangePosition {
|
|
9
|
+
/** True when a start exists and this date is strictly after it. True when there is no start, so the open side stays paintable. */
|
|
10
|
+
isAfterStart: boolean;
|
|
11
|
+
/** True when an end exists and this date is strictly before it. True when there is no end. */
|
|
12
|
+
isBeforeEnd: boolean;
|
|
13
|
+
/** True only when both bounds exist and this date is on or between them. */
|
|
14
|
+
isInRange: boolean;
|
|
15
|
+
isFirstDayOfMonth: boolean;
|
|
16
|
+
isLastDayOfMonth: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** Which range chrome a cell draws for one selection state. */
|
|
19
|
+
export interface CalendarCellOutline {
|
|
20
|
+
isRoundedLeft: boolean;
|
|
21
|
+
isRoundedRight: boolean;
|
|
22
|
+
/** Gradient continuing the range into the previous month, painted on the 1st. */
|
|
23
|
+
showLeadingGradient: boolean;
|
|
24
|
+
/** Gradient continuing the range into the next month, painted on the last day. */
|
|
25
|
+
showTrailingGradient: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Places a calendar date against the live range.
|
|
29
|
+
*
|
|
30
|
+
* @param date The cell's date.
|
|
31
|
+
* @param range The calendar's current start and end, or null on a single-date calendar.
|
|
32
|
+
* @returns Position flags used to choose the cell's range styling.
|
|
33
|
+
*/
|
|
34
|
+
export declare const getCalendarCellRangePosition: (date: DateValue, range: CalendarCellRange | null) => CalendarCellRangePosition;
|
|
35
|
+
interface CalendarCellOutlineOptions {
|
|
36
|
+
/** The cell's date, used with `locale` to find the week edges. */
|
|
37
|
+
date: DateValue;
|
|
38
|
+
/** BCP 47 locale whose first day of the week is the row's rounded edge. */
|
|
39
|
+
locale: string;
|
|
40
|
+
isSelectionStart: boolean;
|
|
41
|
+
isSelectionEnd: boolean;
|
|
42
|
+
isSelected: boolean;
|
|
43
|
+
/** False on a single-date calendar, which never paints a range gradient. */
|
|
44
|
+
isRangeCalendar: boolean;
|
|
45
|
+
position: CalendarCellRangePosition;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Decides the range chrome for one cell state. Week edges round even mid-range, so a selection that spans a week still reads as one pill per row.
|
|
49
|
+
*
|
|
50
|
+
* @param options The cell date, the locale, and the selection state from the calendar.
|
|
51
|
+
* @returns Which corners round and which month-edge gradients to paint.
|
|
52
|
+
*/
|
|
53
|
+
export declare const getCalendarCellOutline: ({ date, locale, isSelectionStart, isSelectionEnd, isSelected, isRangeCalendar, position, }: CalendarCellOutlineOptions) => CalendarCellOutline;
|
|
54
|
+
interface CalendarCellMarkedSelectedOptions {
|
|
55
|
+
isSelectionStart: boolean;
|
|
56
|
+
isSelectionEnd: boolean;
|
|
57
|
+
isSelected: boolean;
|
|
58
|
+
isDisabled: boolean;
|
|
59
|
+
/** False on a single-date calendar, which fills the selected day rather than only the endpoints. */
|
|
60
|
+
isRangeCalendar: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Whether the inner disc uses the solid selected fill.
|
|
64
|
+
*
|
|
65
|
+
* @param options Selection and disabled state for this cell.
|
|
66
|
+
* @returns True for either end of a range, or for the selected day of a single-date calendar that is not disabled.
|
|
67
|
+
*/
|
|
68
|
+
export declare const isCalendarCellMarkedSelected: ({ isSelectionStart, isSelectionEnd, isSelected, isDisabled, isRangeCalendar, }: CalendarCellMarkedSelectedOptions) => boolean;
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=calendarCell.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendarCell.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/DatePicker/calendarCell.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,yBAAyB,CAAC;AAEvE,8GAA8G;AAC9G,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CACxB;AAED,+EAA+E;AAC/E,MAAM,WAAW,yBAAyB;IACxC,kIAAkI;IAClI,YAAY,EAAE,OAAO,CAAC;IACtB,8FAA8F;IAC9F,WAAW,EAAE,OAAO,CAAC;IACrB,4EAA4E;IAC5E,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,+DAA+D;AAC/D,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,iFAAiF;IACjF,mBAAmB,EAAE,OAAO,CAAC;IAC7B,kFAAkF;IAClF,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAKD;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GAAI,MAAM,SAAS,EAAE,OAAO,iBAAiB,GAAG,IAAI,KAAG,yBAa/F,CAAC;AAEF,UAAU,0BAA0B;IAClC,kEAAkE;IAClE,IAAI,EAAE,SAAS,CAAC;IAChB,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,4EAA4E;IAC5E,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,yBAAyB,CAAC;CACrC;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,4FAQpC,0BAA0B,KAAG,mBAS/B,CAAC;AAEF,UAAU,iCAAiC;IACzC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,oGAAoG;IACpG,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GAAI,gFAM1C,iCAAiC,KAAG,OAAgG,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { getDayOfWeek } from '@internationalized/date';
|
|
2
|
+
|
|
3
|
+
/** Day 0 of the next 0-based month is the last day of this calendar month. */
|
|
4
|
+
const lastDayOfMonth = (date) => new Date(date.year, date.month, 0).getDate();
|
|
5
|
+
/**
|
|
6
|
+
* Places a calendar date against the live range.
|
|
7
|
+
*
|
|
8
|
+
* @param date The cell's date.
|
|
9
|
+
* @param range The calendar's current start and end, or null on a single-date calendar.
|
|
10
|
+
* @returns Position flags used to choose the cell's range styling.
|
|
11
|
+
*/
|
|
12
|
+
const getCalendarCellRangePosition = (date, range) => {
|
|
13
|
+
const start = range?.start;
|
|
14
|
+
const end = range?.end;
|
|
15
|
+
const isAfterOrOnStart = Boolean(start && date.compare(start) >= 0);
|
|
16
|
+
const isBeforeOrOnEnd = Boolean(end && date.compare(end) <= 0);
|
|
17
|
+
return {
|
|
18
|
+
isAfterStart: start ? date.compare(start) > 0 : true,
|
|
19
|
+
isBeforeEnd: end ? date.compare(end) < 0 : true,
|
|
20
|
+
isInRange: isAfterOrOnStart && isBeforeOrOnEnd,
|
|
21
|
+
isFirstDayOfMonth: date.day === 1,
|
|
22
|
+
isLastDayOfMonth: date.day === lastDayOfMonth(date),
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Decides the range chrome for one cell state. Week edges round even mid-range, so a selection that spans a week still reads as one pill per row.
|
|
27
|
+
*
|
|
28
|
+
* @param options The cell date, the locale, and the selection state from the calendar.
|
|
29
|
+
* @returns Which corners round and which month-edge gradients to paint.
|
|
30
|
+
*/
|
|
31
|
+
const getCalendarCellOutline = ({ date, locale, isSelectionStart, isSelectionEnd, isSelected, isRangeCalendar, position, }) => {
|
|
32
|
+
const dayOfWeek = getDayOfWeek(date, locale);
|
|
33
|
+
return {
|
|
34
|
+
isRoundedLeft: isSelectionStart || dayOfWeek === 0,
|
|
35
|
+
isRoundedRight: isSelectionEnd || dayOfWeek === 6,
|
|
36
|
+
showLeadingGradient: position.isFirstDayOfMonth && isSelected && position.isAfterStart && isRangeCalendar,
|
|
37
|
+
showTrailingGradient: position.isLastDayOfMonth && isSelected && position.isBeforeEnd && isRangeCalendar,
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Whether the inner disc uses the solid selected fill.
|
|
42
|
+
*
|
|
43
|
+
* @param options Selection and disabled state for this cell.
|
|
44
|
+
* @returns True for either end of a range, or for the selected day of a single-date calendar that is not disabled.
|
|
45
|
+
*/
|
|
46
|
+
const isCalendarCellMarkedSelected = ({ isSelectionStart, isSelectionEnd, isSelected, isDisabled, isRangeCalendar, }) => isSelectionStart || isSelectionEnd || (isSelected && !isDisabled && !isRangeCalendar);
|
|
47
|
+
|
|
48
|
+
export { getCalendarCellOutline, getCalendarCellRangePosition, isCalendarCellMarkedSelected };
|
|
49
|
+
//# sourceMappingURL=calendarCell.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendarCell.utils.js","sources":["../../../../src/components/organisms/DatePicker/calendarCell.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA8BA;AACA,MAAM,cAAc,GAAG,CAAC,IAAe,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE;AAExF;;;;;;AAMG;MACU,4BAA4B,GAAG,CAAC,IAAe,EAAE,KAA+B,KAA+B;AAC1H,IAAA,MAAM,KAAK,GAAG,KAAK,EAAE,KAAK;AAC1B,IAAA,MAAM,GAAG,GAAG,KAAK,EAAE,GAAG;AACtB,IAAA,MAAM,gBAAgB,GAAG,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACnE,IAAA,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAE9D,OAAO;AACL,QAAA,YAAY,EAAE,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI;AACpD,QAAA,WAAW,EAAE,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI;QAC/C,SAAS,EAAE,gBAAgB,IAAI,eAAe;AAC9C,QAAA,iBAAiB,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC;QACjC,gBAAgB,EAAE,IAAI,CAAC,GAAG,KAAK,cAAc,CAAC,IAAI,CAAC;KACpD;AACH;AAeA;;;;;AAKG;MACU,sBAAsB,GAAG,CAAC,EACrC,IAAI,EACJ,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,eAAe,EACf,QAAQ,GACmB,KAAyB;IACpD,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC;IAE5C,OAAO;AACL,QAAA,aAAa,EAAE,gBAAgB,IAAI,SAAS,KAAK,CAAC;AAClD,QAAA,cAAc,EAAE,cAAc,IAAI,SAAS,KAAK,CAAC;QACjD,mBAAmB,EAAE,QAAQ,CAAC,iBAAiB,IAAI,UAAU,IAAI,QAAQ,CAAC,YAAY,IAAI,eAAe;QACzG,oBAAoB,EAAE,QAAQ,CAAC,gBAAgB,IAAI,UAAU,IAAI,QAAQ,CAAC,WAAW,IAAI,eAAe;KACzG;AACH;AAWA;;;;;AAKG;AACI,MAAM,4BAA4B,GAAG,CAAC,EAC3C,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,UAAU,EACV,eAAe,GACmB,KAAc,gBAAgB,IAAI,cAAc,KAAK,UAAU,IAAI,CAAC,UAAU,IAAI,CAAC,eAAe;;"}
|
|
@@ -6,48 +6,42 @@ var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
|
6
6
|
var date = require('@internationalized/date');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var reactAriaComponents = require('react-aria-components');
|
|
9
|
+
var calendarCell_utils = require('../calendarCell.utils.cjs');
|
|
9
10
|
|
|
10
11
|
const CalendarCell = ({ date: date$1, isHighlighted, showOutOfRangeDates = false, ...props }) => {
|
|
11
12
|
const { locale } = reactAriaComponents.useLocale();
|
|
12
|
-
|
|
13
|
-
// Read the calendar's actual live selection from the state context that `AriaRangeCalendar`
|
|
14
|
-
// provides to its own descendants, rather than the ambient `RangeCalendarContext` props
|
|
15
|
-
// context — the latter is merged into `AriaRangeCalendar`'s own `value`/`defaultValue` props
|
|
16
|
-
// via `useContextProps`, so relying on it here would re-couple this cell's rendering to that
|
|
17
|
-
// merge (and any future changes to how a standalone `RangeCalendar` seeds its fallback context).
|
|
13
|
+
// The props context is merged into the calendar's value, so the cell reads the state context instead.
|
|
18
14
|
const rangeCalendarState = React.useContext(reactAriaComponents.RangeCalendarStateContext);
|
|
19
15
|
const isRangeCalendar = !!rangeCalendarState;
|
|
20
|
-
const
|
|
21
|
-
const end = rangeCalendarState?.value?.end;
|
|
22
|
-
const isAfterStart = start ? date$1.compare(start) > 0 : true;
|
|
23
|
-
const isBeforeEnd = end ? date$1.compare(end) < 0 : true;
|
|
24
|
-
const isAfterOrOnStart = start && date$1.compare(start) >= 0;
|
|
25
|
-
const isBeforeOrOnEnd = end && date$1.compare(end) <= 0;
|
|
26
|
-
const isInRange = isAfterOrOnStart && isBeforeOrOnEnd;
|
|
27
|
-
const lastDayOfMonth = new Date(date$1.year, date$1.month, 0).getDate();
|
|
28
|
-
const isLastDayOfMonth = date$1.day === lastDayOfMonth;
|
|
29
|
-
const isFirstDayOfMonth = date$1.day === 1;
|
|
16
|
+
const position = calendarCell_utils.getCalendarCellRangePosition(date$1, rangeCalendarState?.value ?? null);
|
|
30
17
|
const isTodayDate = date.isToday(date$1, date.getLocalTimeZone());
|
|
31
18
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
32
19
|
const cellTestId = prefix ? testIdUtils.joinTestId(prefix, `cell-${testIdUtils.slugifyTestId(date$1.toString())}`) : undefined;
|
|
33
20
|
return (jsxRuntime.jsx(reactAriaComponents.CalendarCell, { ...props, date: date$1, "data-testid": cellTestId, className: ({ isDisabled, isFocusVisible, isSelectionStart, isSelectionEnd, isSelected, isOutsideMonth }) => {
|
|
34
|
-
const isRoundedLeft
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
isSelected
|
|
40
|
-
|
|
41
|
-
|
|
21
|
+
const { isRoundedLeft, isRoundedRight, showLeadingGradient, showTrailingGradient } = calendarCell_utils.getCalendarCellOutline({
|
|
22
|
+
date: date$1,
|
|
23
|
+
locale,
|
|
24
|
+
isSelectionStart,
|
|
25
|
+
isSelectionEnd,
|
|
26
|
+
isSelected,
|
|
27
|
+
isRangeCalendar,
|
|
28
|
+
position,
|
|
29
|
+
});
|
|
30
|
+
return cx.cx('relative size-10 focus:outline-hidden', isRoundedLeft && 'rounded-l-full', isRoundedRight && 'rounded-r-full', position.isInRange && isDisabled && 'bg-secondary', isSelected && isRangeCalendar && 'bg-secondary', isDisabled ? 'pointer-events-none' : 'cursor-pointer', isFocusVisible ? 'z-10' : 'z-0', isOutsideMonth && 'opacity-50', isRangeCalendar && isOutsideMonth && !showOutOfRangeDates && 'hidden',
|
|
31
|
+
// The range continues into the next month, so the highlight must bleed past this cell.
|
|
32
|
+
showTrailingGradient &&
|
|
42
33
|
'after:absolute after:inset-0 after:translate-x-full after:bg-gradient-to-l after:from-transparent after:to-bg-secondary in-[[role=gridcell]:last-child]:after:hidden',
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
isSelected &&
|
|
46
|
-
isAfterStart &&
|
|
47
|
-
isRangeCalendar &&
|
|
34
|
+
// The range continues from the previous month, so the highlight must bleed past this cell.
|
|
35
|
+
showLeadingGradient &&
|
|
48
36
|
'after:absolute after:inset-0 after:-translate-x-full after:bg-gradient-to-r after:from-transparent after:to-bg-secondary in-[[role=gridcell]:first-child]:after:hidden');
|
|
49
37
|
}, children: ({ isDisabled, isFocusVisible, isSelectionStart, isSelectionEnd, isSelected, formattedDate }) => {
|
|
50
|
-
const markedAsSelected =
|
|
38
|
+
const markedAsSelected = calendarCell_utils.isCalendarCellMarkedSelected({
|
|
39
|
+
isSelectionStart,
|
|
40
|
+
isSelectionEnd,
|
|
41
|
+
isSelected,
|
|
42
|
+
isDisabled,
|
|
43
|
+
isRangeCalendar,
|
|
44
|
+
});
|
|
51
45
|
return (jsxRuntime.jsxs("div", { className: cx.cx('relative flex size-full items-center justify-center rounded-full text-sm text-secondary hover:text-secondary_hover',
|
|
52
46
|
// Disabled state.
|
|
53
47
|
isDisabled && 'text-secondary/50',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.cjs","sources":["../../../../../src/components/organisms/DatePicker/components/Cell.tsx"],"sourcesContent":[null],"names":["date","useLocale","
|
|
1
|
+
{"version":3,"file":"Cell.cjs","sources":["../../../../../src/components/organisms/DatePicker/components/Cell.tsx"],"sourcesContent":[null],"names":["date","useLocale","useContext","RangeCalendarStateContext","getCalendarCellRangePosition","isToday","getLocalTimeZone","useTestIdPrefix","joinTestId","slugifyTestId","_jsx","AriaCalendarCell","getCalendarCellOutline","cx","isCalendarCellMarkedSelected","_jsxs"],"mappings":";;;;;;;;;;AAiBO,MAAM,YAAY,GAAG,CAAC,QAAEA,MAAI,EAAE,aAAa,EAAE,mBAAmB,GAAG,KAAK,EAAE,GAAG,KAAK,EAAqB,KAAI;AAChH,IAAA,MAAM,EAAE,MAAM,EAAE,GAAGC,6BAAS,EAAE;;AAE9B,IAAA,MAAM,kBAAkB,GAAGC,gBAAU,CAACC,6CAAyB,CAAC;AAChE,IAAA,MAAM,eAAe,GAAG,CAAC,CAAC,kBAAkB;AAC5C,IAAA,MAAM,QAAQ,GAAGC,+CAA4B,CAACJ,MAAI,EAAE,kBAAkB,EAAE,KAAK,IAAI,IAAI,CAAC;IACtF,MAAM,WAAW,GAAGK,YAAO,CAACL,MAAI,EAAEM,qBAAgB,EAAE,CAAC;AAErD,IAAA,MAAM,MAAM,GAAGC,2BAAe,EAAE;IAChC,MAAM,UAAU,GAAG,MAAM,GAAGC,sBAAU,CAAC,MAAM,EAAE,CAAA,KAAA,EAAQC,yBAAa,CAACT,MAAI,CAAC,QAAQ,EAAE,CAAC,CAAA,CAAE,CAAC,GAAG,SAAS;AAEpG,IAAA,QACEU,cAAA,CAACC,gCAAgB,EAAA,EAAA,GACX,KAAK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GAAG,aAAa,GAAG,EAAE,EACjE,gBAAgB,IAAI,mFAAmF;;AAEvG,gBAAA,CAAC,UAAU,IAAI,CAAC,UAAU,GAAG,2CAA2C,GAAG,EAAE,EAC7E,CAAC,UAAU,IAAI,WAAW,GAAG,mDAAmD,GAAG,EAAE,CACtF,EAAA,QAAA,EAAA,CAEA,aAAa,EAEb,CAAC,aAAa,IAAI,WAAW,MAC5BH,cAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAEG,KAAE,CACX,oEAAoE,EACpE,gBAAgB,GAAG,aAAa,GAAG,qBAAqB,EACxD,UAAU,IAAI,YAAY,CAC3B,EAAA,CACD,CACH,CAAA,EAAA,CACG;QAEV,CAAC,EAAA,CACgB;AAEvB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/DatePicker/components/Cell.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/DatePicker/components/Cell.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAIxF,UAAU,iBAAkB,SAAQ,qBAAqB;IACvD,uCAAuC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0CAA0C;IAC1C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,YAAY,GAAI,wDAAgE,iBAAiB,gCAyF7G,CAAC"}
|
|
@@ -1,51 +1,45 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
3
3
|
import { useTestIdPrefix, joinTestId, slugifyTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
4
|
-
import {
|
|
4
|
+
import { isToday, getLocalTimeZone } from '@internationalized/date';
|
|
5
5
|
import { useContext } from 'react';
|
|
6
6
|
import { useLocale, RangeCalendarStateContext, CalendarCell as CalendarCell$1 } from 'react-aria-components';
|
|
7
|
+
import { getCalendarCellRangePosition, getCalendarCellOutline, isCalendarCellMarkedSelected } from '../calendarCell.utils.js';
|
|
7
8
|
|
|
8
9
|
const CalendarCell = ({ date, isHighlighted, showOutOfRangeDates = false, ...props }) => {
|
|
9
10
|
const { locale } = useLocale();
|
|
10
|
-
|
|
11
|
-
// Read the calendar's actual live selection from the state context that `AriaRangeCalendar`
|
|
12
|
-
// provides to its own descendants, rather than the ambient `RangeCalendarContext` props
|
|
13
|
-
// context — the latter is merged into `AriaRangeCalendar`'s own `value`/`defaultValue` props
|
|
14
|
-
// via `useContextProps`, so relying on it here would re-couple this cell's rendering to that
|
|
15
|
-
// merge (and any future changes to how a standalone `RangeCalendar` seeds its fallback context).
|
|
11
|
+
// The props context is merged into the calendar's value, so the cell reads the state context instead.
|
|
16
12
|
const rangeCalendarState = useContext(RangeCalendarStateContext);
|
|
17
13
|
const isRangeCalendar = !!rangeCalendarState;
|
|
18
|
-
const
|
|
19
|
-
const end = rangeCalendarState?.value?.end;
|
|
20
|
-
const isAfterStart = start ? date.compare(start) > 0 : true;
|
|
21
|
-
const isBeforeEnd = end ? date.compare(end) < 0 : true;
|
|
22
|
-
const isAfterOrOnStart = start && date.compare(start) >= 0;
|
|
23
|
-
const isBeforeOrOnEnd = end && date.compare(end) <= 0;
|
|
24
|
-
const isInRange = isAfterOrOnStart && isBeforeOrOnEnd;
|
|
25
|
-
const lastDayOfMonth = new Date(date.year, date.month, 0).getDate();
|
|
26
|
-
const isLastDayOfMonth = date.day === lastDayOfMonth;
|
|
27
|
-
const isFirstDayOfMonth = date.day === 1;
|
|
14
|
+
const position = getCalendarCellRangePosition(date, rangeCalendarState?.value ?? null);
|
|
28
15
|
const isTodayDate = isToday(date, getLocalTimeZone());
|
|
29
16
|
const prefix = useTestIdPrefix();
|
|
30
17
|
const cellTestId = prefix ? joinTestId(prefix, `cell-${slugifyTestId(date.toString())}`) : undefined;
|
|
31
18
|
return (jsx(CalendarCell$1, { ...props, date: date, "data-testid": cellTestId, className: ({ isDisabled, isFocusVisible, isSelectionStart, isSelectionEnd, isSelected, isOutsideMonth }) => {
|
|
32
|
-
const isRoundedLeft
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
isSelected
|
|
38
|
-
|
|
39
|
-
|
|
19
|
+
const { isRoundedLeft, isRoundedRight, showLeadingGradient, showTrailingGradient } = getCalendarCellOutline({
|
|
20
|
+
date,
|
|
21
|
+
locale,
|
|
22
|
+
isSelectionStart,
|
|
23
|
+
isSelectionEnd,
|
|
24
|
+
isSelected,
|
|
25
|
+
isRangeCalendar,
|
|
26
|
+
position,
|
|
27
|
+
});
|
|
28
|
+
return cx('relative size-10 focus:outline-hidden', isRoundedLeft && 'rounded-l-full', isRoundedRight && 'rounded-r-full', position.isInRange && isDisabled && 'bg-secondary', isSelected && isRangeCalendar && 'bg-secondary', isDisabled ? 'pointer-events-none' : 'cursor-pointer', isFocusVisible ? 'z-10' : 'z-0', isOutsideMonth && 'opacity-50', isRangeCalendar && isOutsideMonth && !showOutOfRangeDates && 'hidden',
|
|
29
|
+
// The range continues into the next month, so the highlight must bleed past this cell.
|
|
30
|
+
showTrailingGradient &&
|
|
40
31
|
'after:absolute after:inset-0 after:translate-x-full after:bg-gradient-to-l after:from-transparent after:to-bg-secondary in-[[role=gridcell]:last-child]:after:hidden',
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
isSelected &&
|
|
44
|
-
isAfterStart &&
|
|
45
|
-
isRangeCalendar &&
|
|
32
|
+
// The range continues from the previous month, so the highlight must bleed past this cell.
|
|
33
|
+
showLeadingGradient &&
|
|
46
34
|
'after:absolute after:inset-0 after:-translate-x-full after:bg-gradient-to-r after:from-transparent after:to-bg-secondary in-[[role=gridcell]:first-child]:after:hidden');
|
|
47
35
|
}, children: ({ isDisabled, isFocusVisible, isSelectionStart, isSelectionEnd, isSelected, formattedDate }) => {
|
|
48
|
-
const markedAsSelected =
|
|
36
|
+
const markedAsSelected = isCalendarCellMarkedSelected({
|
|
37
|
+
isSelectionStart,
|
|
38
|
+
isSelectionEnd,
|
|
39
|
+
isSelected,
|
|
40
|
+
isDisabled,
|
|
41
|
+
isRangeCalendar,
|
|
42
|
+
});
|
|
49
43
|
return (jsxs("div", { className: cx('relative flex size-full items-center justify-center rounded-full text-sm text-secondary hover:text-secondary_hover',
|
|
50
44
|
// Disabled state.
|
|
51
45
|
isDisabled && 'text-secondary/50',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.js","sources":["../../../../../src/components/organisms/DatePicker/components/Cell.tsx"],"sourcesContent":[null],"names":["_jsx","AriaCalendarCell","_jsxs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Cell.js","sources":["../../../../../src/components/organisms/DatePicker/components/Cell.tsx"],"sourcesContent":[null],"names":["_jsx","AriaCalendarCell","_jsxs"],"mappings":";;;;;;;;AAiBO,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,mBAAmB,GAAG,KAAK,EAAE,GAAG,KAAK,EAAqB,KAAI;AAChH,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE;;AAE9B,IAAA,MAAM,kBAAkB,GAAG,UAAU,CAAC,yBAAyB,CAAC;AAChE,IAAA,MAAM,eAAe,GAAG,CAAC,CAAC,kBAAkB;AAC5C,IAAA,MAAM,QAAQ,GAAG,4BAA4B,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,IAAI,IAAI,CAAC;IACtF,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,gBAAgB,EAAE,CAAC;AAErD,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE;IAChC,MAAM,UAAU,GAAG,MAAM,GAAG,UA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SAAS,EAAE,EAAE,CACX,oHAAoH;;AAEpH,gBAAA,UAAU,IAAI,mBAAmB;;AAEjC,gBAAA,cAAc,GAAG,+CAA+C,GAAG,EAAE;;AAErE,gBAAA,UAAU,IAAI,CAAC,UAAU,IAAI,eAAe,GAAG,aAAa,GAAG,EAAE,EACjE,gBAAgB,IAAI,mFAAmF;;AAEvG,gBAAA,CAAC,UAAU,IAAI,CAAC,UAAU,GAAG,2CAA2C,GAAG,EAAE,EAC7E,CAAC,UAAU,IAAI,WAAW,GAAG,mDAAmD,GAAG,EAAE,CACtF,EAAA,QAAA,EAAA,CAEA,aAAa,EAEb,CAAC,aAAa,IAAI,WAAW,MAC5BF,GAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,oEAAoE,EACpE,gBAAgB,GAAG,aAAa,GAAG,qBAAqB,EACxD,UAAU,IAAI,YAAY,CAC3B,EAAA,CACD,CACH,CAAA,EAAA,CACG;QAEV,CAAC,EAAA,CACgB;AAEvB;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Formats a byte count the way the upload list prints it, flooring into the largest 1024-based unit that still fits.
|
|
5
|
+
*
|
|
6
|
+
* @param bytes File size in bytes. `0` is reported as `0 KB` rather than `0 B`.
|
|
7
|
+
* @returns A label such as `0 KB`, `12 KB` or `3 MB`.
|
|
8
|
+
*/
|
|
9
|
+
const getReadableFileSize = (bytes) => {
|
|
10
|
+
if (bytes === 0)
|
|
11
|
+
return '0 KB';
|
|
12
|
+
const suffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
13
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
14
|
+
return `${Math.floor(bytes / 1024 ** i)} ${suffixes[i]}`;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Reports whether a file matches an HTML accept string.
|
|
18
|
+
*
|
|
19
|
+
* @param file Name and MIME type to test. The extension is the segment after the last dot, compared case-insensitively; the MIME type is compared exactly.
|
|
20
|
+
* @param accept Comma-separated extensions (`.pdf`), wildcards (`image/*`) or exact MIME types. Omitted or empty accepts every file.
|
|
21
|
+
* @returns `true` when any token matches, or when `accept` is omitted or empty.
|
|
22
|
+
*/
|
|
23
|
+
const isFileTypeAccepted = (file, accept) => {
|
|
24
|
+
if (!accept)
|
|
25
|
+
return true;
|
|
26
|
+
const acceptedTypes = accept.split(',').map((type) => type.trim());
|
|
27
|
+
return acceptedTypes.some((acceptedType) => {
|
|
28
|
+
if (acceptedType.startsWith('.')) {
|
|
29
|
+
const extension = `.${file.name.split('.').pop()?.toLowerCase()}`;
|
|
30
|
+
return extension === acceptedType.toLowerCase();
|
|
31
|
+
}
|
|
32
|
+
if (acceptedType.endsWith('/*')) {
|
|
33
|
+
const typePrefix = acceptedType.split('/')[0];
|
|
34
|
+
return file.type.startsWith(`${typePrefix}/`);
|
|
35
|
+
}
|
|
36
|
+
return file.type === acceptedType;
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Splits dropped files into accepted, wrong-type and oversized lists. Size is judged before type.
|
|
41
|
+
*
|
|
42
|
+
* @param files Files from a drop or the file input, in arrival order.
|
|
43
|
+
* @param options Limits from the drop zone.
|
|
44
|
+
* @returns The three lists, each preserving input order.
|
|
45
|
+
*/
|
|
46
|
+
const classifyDroppedFiles = (files, options) => {
|
|
47
|
+
const accepted = [];
|
|
48
|
+
const unaccepted = [];
|
|
49
|
+
const oversized = [];
|
|
50
|
+
const filesToProcess = options.allowsMultiple ? files : files.slice(0, 1);
|
|
51
|
+
for (const file of filesToProcess) {
|
|
52
|
+
if (options.maxSize && file.size > options.maxSize) {
|
|
53
|
+
oversized.push(file);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (isFileTypeAccepted(file, options.accept)) {
|
|
57
|
+
accepted.push(file);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
unaccepted.push(file);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { accepted, unaccepted, oversized };
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
exports.classifyDroppedFiles = classifyDroppedFiles;
|
|
67
|
+
exports.getReadableFileSize = getReadableFileSize;
|
|
68
|
+
exports.isFileTypeAccepted = isFileTypeAccepted;
|
|
69
|
+
//# sourceMappingURL=fileUpload.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileUpload.utils.cjs","sources":["../../../../src/components/organisms/FileUpload/fileUpload.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAwBA;;;;;AAKG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAAa,KAAY;IAC3D,IAAI,KAAK,KAAK,CAAC;AAAE,QAAA,OAAO,MAAM;IAE9B,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IACtE,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAEtD,IAAA,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAA,CAAA,EAAI,QAAQ,CAAC,CAAC,CAAC,EAAE;AAC1D;AAEA;;;;;;AAMG;MACU,kBAAkB,GAAG,CAAC,IAAwC,EAAE,MAAe,KAAa;AACvG,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,IAAI;IAExB,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;AAElE,IAAA,OAAO,aAAa,CAAC,I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AC,IAAI,CAAC,IAAI,CAAC;QACvB;IACF;AAEA,IAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE;AAC5C;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** A dropped file judged by its name, MIME type and byte size. */
|
|
2
|
+
interface DroppedFile {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
size: number;
|
|
6
|
+
}
|
|
7
|
+
/** Files grouped by the drop zone's accept and size rules. */
|
|
8
|
+
export interface ClassifiedDroppedFiles<T> {
|
|
9
|
+
accepted: T[];
|
|
10
|
+
unaccepted: T[];
|
|
11
|
+
oversized: T[];
|
|
12
|
+
}
|
|
13
|
+
/** Limits the drop zone applies while sorting a drop. */
|
|
14
|
+
export interface ClassifyDroppedFilesOptions {
|
|
15
|
+
/** HTML accept string. Omitted or empty accepts every type. */
|
|
16
|
+
accept?: string;
|
|
17
|
+
/** When false, only the first file is classified and the rest are ignored. */
|
|
18
|
+
allowsMultiple: boolean;
|
|
19
|
+
/** Files larger than this many bytes are oversized. `0` and omitted skip the size check. */
|
|
20
|
+
maxSize?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Formats a byte count the way the upload list prints it, flooring into the largest 1024-based unit that still fits.
|
|
24
|
+
*
|
|
25
|
+
* @param bytes File size in bytes. `0` is reported as `0 KB` rather than `0 B`.
|
|
26
|
+
* @returns A label such as `0 KB`, `12 KB` or `3 MB`.
|
|
27
|
+
*/
|
|
28
|
+
export declare const getReadableFileSize: (bytes: number) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Reports whether a file matches an HTML accept string.
|
|
31
|
+
*
|
|
32
|
+
* @param file Name and MIME type to test. The extension is the segment after the last dot, compared case-insensitively; the MIME type is compared exactly.
|
|
33
|
+
* @param accept Comma-separated extensions (`.pdf`), wildcards (`image/*`) or exact MIME types. Omitted or empty accepts every file.
|
|
34
|
+
* @returns `true` when any token matches, or when `accept` is omitted or empty.
|
|
35
|
+
*/
|
|
36
|
+
export declare const isFileTypeAccepted: (file: Pick<DroppedFile, "name" | "type">, accept?: string) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Splits dropped files into accepted, wrong-type and oversized lists. Size is judged before type.
|
|
39
|
+
*
|
|
40
|
+
* @param files Files from a drop or the file input, in arrival order.
|
|
41
|
+
* @param options Limits from the drop zone.
|
|
42
|
+
* @returns The three lists, each preserving input order.
|
|
43
|
+
*/
|
|
44
|
+
export declare const classifyDroppedFiles: <T extends DroppedFile>(files: readonly T[], options: ClassifyDroppedFilesOptions) => ClassifiedDroppedFiles<T>;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=fileUpload.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileUpload.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/FileUpload/fileUpload.utils.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,8DAA8D;AAC9D,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,QAAQ,EAAE,CAAC,EAAE,CAAC;IACd,UAAU,EAAE,CAAC,EAAE,CAAC;IAChB,SAAS,EAAE,CAAC,EAAE,CAAC;CAChB;AAED,yDAAyD;AACzD,MAAM,WAAW,2BAA2B;IAC1C,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,cAAc,EAAE,OAAO,CAAC;IACxB,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,KAAG,MAOnD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,EAAE,SAAS,MAAM,KAAG,OAkB9F,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,WAAW,EAAE,OAAO,SAAS,CAAC,EAAE,EAAE,SAAS,2BAA2B,KAAG,sBAAsB,CAAC,CAAC,CAoB/I,CAAC"}
|