@infonomic/uikit 1.5.0 → 2.1.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/button/button-group.d.ts +1 -1
- package/dist/components/button/button-group.d.ts.map +1 -1
- package/dist/components/button/button-group.js +1 -1
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/button/control-buttons.d.ts.map +1 -1
- package/dist/components/button/control-buttons.js +3 -3
- package/dist/components/button/copy-button.d.ts.map +1 -1
- package/dist/components/button/copy-button.js +2 -2
- package/dist/components/button/icon-button.d.ts.map +1 -1
- package/dist/components/button/icon-button.js +1 -1
- package/dist/components/button/index.js +17 -1
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/dropdown/dropdown.d.ts +1 -1
- package/dist/components/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/input/checkbox.d.ts.map +1 -1
- package/dist/components/input/checkbox.js +4 -4
- package/dist/components/input/error-text.d.ts.map +1 -1
- package/dist/components/input/error-text.js +1 -1
- package/dist/components/input/help-text.d.ts.map +1 -1
- package/dist/components/input/help-text.js +1 -1
- package/dist/components/input/input-adornment.d.ts.map +1 -1
- package/dist/components/input/input-adornment.js +1 -1
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/input.js +3 -3
- package/dist/components/input/label.d.ts.map +1 -1
- package/dist/components/input/label.js +1 -1
- package/dist/components/input/radio-group.js +1 -1
- package/dist/components/input/select.d.ts +1 -1
- package/dist/components/input/select.d.ts.map +1 -1
- package/dist/components/input/select.js +3 -3
- package/dist/components/input/text-area.d.ts.map +1 -1
- package/dist/components/input/text-area.js +3 -3
- package/dist/components/notifications/alert.d.ts.map +1 -1
- package/dist/components/notifications/alert.js +2 -2
- package/dist/components/notifications/toast.js +4 -4
- package/dist/components/pager/ellipses.d.ts.map +1 -1
- package/dist/components/pager/ellipses.js +1 -1
- package/dist/components/pager/first-button.d.ts.map +1 -1
- package/dist/components/pager/first-button.js +2 -2
- package/dist/components/pager/last-button.d.ts.map +1 -1
- package/dist/components/pager/last-button.js +2 -2
- package/dist/components/pager/next-button.d.ts.map +1 -1
- package/dist/components/pager/next-button.js +2 -2
- package/dist/components/pager/number-button.d.ts.map +1 -1
- package/dist/components/pager/number-button.js +2 -2
- package/dist/components/pager/pagination.d.ts +1 -1
- package/dist/components/pager/pagination.d.ts.map +1 -1
- package/dist/components/pager/pagination.js +5 -5
- package/dist/components/pager/previous-button.d.ts.map +1 -1
- package/dist/components/pager/previous-button.js +2 -2
- package/dist/components/scroll-area/scroll-area.js +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +2 -2
- package/dist/components/tabs/tabs.d.ts +1 -1
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/icons/index.js +1 -17
- package/package.json +9 -5
- package/src/astro.d.ts +43 -0
- package/src/astro.js +2 -2
- package/src/components/@types/shared.ts +24 -0
- package/src/components/accordion/accordion.module.css +60 -0
- package/src/components/accordion/accordion.stories.tsx +117 -0
- package/src/components/accordion/accordion.tsx +105 -0
- package/src/components/animation/fade-in-lift.stories.tsx +81 -0
- package/src/components/animation/fade-in-lift.tsx +42 -0
- package/src/components/avatar/avatar.module.css +54 -0
- package/src/components/avatar/avatar.stories.tsx +28 -0
- package/src/components/avatar/avatar.tsx +19 -0
- package/src/components/button/@types/button.ts +17 -0
- package/src/components/button/button-group.module.css +17 -0
- package/src/components/button/button-group.stories.tsx +45 -0
- package/src/components/button/button-group.tsx +132 -0
- package/src/components/button/button-icon.stories.tsx +145 -0
- package/src/components/button/button-intents.stories.tsx +50 -0
- package/src/components/button/button-variants.stories.tsx +60 -0
- package/src/components/button/button.astro +86 -0
- package/src/components/button/button.module.css +533 -0
- package/src/components/button/button.tsx +81 -0
- package/src/components/button/control-buttons.module.css +144 -0
- package/src/components/button/control-buttons.stories.tsx +60 -0
- package/src/components/button/control-buttons.tsx +137 -0
- package/src/components/button/copy-button.module.css +31 -0
- package/src/components/button/copy-button.stories.tsx +50 -0
- package/src/components/button/copy-button.tsx +92 -0
- package/src/components/button/icon-button.astro +47 -0
- package/src/components/button/icon-button.tsx +44 -0
- package/src/components/button/index.ts +5 -0
- package/src/components/calendar/calendar.module.css +315 -0
- package/src/components/calendar/calendar.stories.tsx +139 -0
- package/src/components/calendar/calendar.tsx +173 -0
- package/src/components/card/card-content.astro +14 -0
- package/src/components/card/card-description.astro +14 -0
- package/src/components/card/card-footer.astro +14 -0
- package/src/components/card/card-header.astro +14 -0
- package/src/components/card/card-title.astro +14 -0
- package/src/components/card/card.astro +41 -0
- package/src/components/card/card.module.css +67 -0
- package/src/components/card/card.stories.tsx +61 -0
- package/src/components/card/card.tsx +86 -0
- package/src/components/container/container.astro +13 -0
- package/src/components/container/container.module.css +28 -0
- package/src/components/container/container.stories.tsx +42 -0
- package/src/components/container/container.tsx +23 -0
- package/src/components/dropdown/dropdown.module.css +131 -0
- package/src/components/dropdown/dropdown.stories.tsx +103 -0
- package/src/components/dropdown/dropdown.tsx +193 -0
- package/src/components/hamburger/hamburger.astro +30 -0
- package/src/components/hamburger/hamburger.tsx +66 -0
- package/src/components/input/@types/checkbox.ts +20 -0
- package/src/components/input/@types/input.ts +20 -0
- package/src/components/input/checkbox-group.tsx +78 -0
- package/src/components/input/checkbox.module.css +267 -0
- package/src/components/input/checkbox.stories.tsx +240 -0
- package/src/components/input/checkbox.tsx +95 -0
- package/src/components/input/error-text.astro +14 -0
- package/src/components/input/error-text.module.css +19 -0
- package/src/components/input/error-text.tsx +18 -0
- package/src/components/input/errors.tsx +37 -0
- package/src/components/input/help-text.astro +13 -0
- package/src/components/input/help-text.module.css +19 -0
- package/src/components/input/help-text.tsx +13 -0
- package/src/components/input/index.tsx +8 -0
- package/src/components/input/input-adornment.astro +26 -0
- package/src/components/input/input-adornment.module.css +18 -0
- package/src/components/input/input-adornment.tsx +36 -0
- package/src/components/input/input.astro +99 -0
- package/src/components/input/input.module.css +310 -0
- package/src/components/input/input.stories.tsx +174 -0
- package/src/components/input/input.tsx +103 -0
- package/src/components/input/label.astro +24 -0
- package/src/components/input/label.module.css +28 -0
- package/src/components/input/label.tsx +25 -0
- package/src/components/input/radio-group.module.css +219 -0
- package/src/components/input/radio-group.stories.tsx +73 -0
- package/src/components/input/radio-group.tsx +67 -0
- package/src/components/input/select.module.css +75 -0
- package/src/components/input/select.stories.tsx +34 -0
- package/src/components/input/select.tsx +115 -0
- package/src/components/input/text-area.module.css +9 -0
- package/src/components/input/text-area.stories.tsx +51 -0
- package/src/components/input/text-area.tsx +81 -0
- package/src/components/input/utils.ts +21 -0
- package/src/components/notifications/@types/alert.ts +12 -0
- package/src/components/notifications/@types/toast.ts +12 -0
- package/src/components/notifications/alert.module.css +114 -0
- package/src/components/notifications/alert.stories.tsx +39 -0
- package/src/components/notifications/alert.tsx +117 -0
- package/src/components/notifications/index.ts +2 -0
- package/src/components/notifications/toast.module.css +237 -0
- package/src/components/notifications/toast.stories.tsx +42 -0
- package/src/components/notifications/toast.tsx +124 -0
- package/src/components/overlay/index.stories.tsx +29 -0
- package/src/components/overlay/index.ts +2 -0
- package/src/components/overlay/overlay.module.css +41 -0
- package/src/components/overlay/overlay.tsx +61 -0
- package/src/components/pager/@types/index.ts +2 -0
- package/src/components/pager/ellipses.tsx +18 -0
- package/src/components/pager/event-pager.tsx +18 -0
- package/src/components/pager/first-button.tsx +53 -0
- package/src/components/pager/hooks/types/usePagination.ts +80 -0
- package/src/components/pager/hooks/usePagination.ts +140 -0
- package/src/components/pager/icons/first.tsx +33 -0
- package/src/components/pager/icons/index.tsx +4 -0
- package/src/components/pager/icons/last.tsx +33 -0
- package/src/components/pager/icons/next.tsx +20 -0
- package/src/components/pager/icons/previous.tsx +20 -0
- package/src/components/pager/index.ts +4 -0
- package/src/components/pager/last-button.tsx +57 -0
- package/src/components/pager/next-button.tsx +55 -0
- package/src/components/pager/number-button.tsx +83 -0
- package/src/components/pager/pagination.module.css +165 -0
- package/src/components/pager/pagination.stories.tsx +190 -0
- package/src/components/pager/pagination.tsx +266 -0
- package/src/components/pager/previous-button.tsx +51 -0
- package/src/components/scroll-area/scroll-area.module.css +80 -0
- package/src/components/scroll-area/scroll-area.stories.tsx +33 -0
- package/src/components/scroll-area/scroll-area.tsx +22 -0
- package/src/components/scroll-to-top/scroll-to-top.tsx +59 -0
- package/src/components/section/section.astro +13 -0
- package/src/components/section/section.module.css +7 -0
- package/src/components/section/section.tsx +23 -0
- package/src/components/shimmer/shimmer.module.css +53 -0
- package/src/components/shimmer/shimmer.stories.tsx +24 -0
- package/src/components/shimmer/shimmer.tsx +70 -0
- package/src/components/table/table.module.css +100 -0
- package/src/components/table/table.stories.tsx +95 -0
- package/src/components/table/table.tsx +165 -0
- package/src/components/tabs/tabs.module.css +64 -0
- package/src/components/tabs/tabs.stories.tsx +47 -0
- package/src/components/tabs/tabs.tsx +75 -0
- package/src/components/timeline/timeline.module.css +87 -0
- package/src/components/timeline/timeline.stories.tsx +50 -0
- package/src/components/timeline/timeline.tsx +177 -0
- package/src/components/tooltip/tooltip.module.css +55 -0
- package/src/components/tooltip/tooltip.stories.tsx +59 -0
- package/src/components/tooltip/tooltip.tsx +51 -0
- package/src/declarations.d.ts +4 -0
- package/src/hooks/use-media-query.ts +20 -0
- package/src/icons/activity-icon.tsx +40 -0
- package/src/icons/calendar-icon.tsx +39 -0
- package/src/icons/check-icon.tsx +33 -0
- package/src/icons/chevron-down-icon.tsx +39 -0
- package/src/icons/chevron-left-double-icon.tsx +58 -0
- package/src/icons/chevron-left-icon.tsx +58 -0
- package/src/icons/chevron-right-double-icon.tsx +58 -0
- package/src/icons/chevron-right-icon.tsx +58 -0
- package/src/icons/chevrons-up-down.tsx +37 -0
- package/src/icons/close-icon.astro +38 -0
- package/src/icons/close-icon.tsx +30 -0
- package/src/icons/copy-icon.tsx +35 -0
- package/src/icons/danger-icon.tsx +18 -0
- package/src/icons/dashboard-icon.tsx +41 -0
- package/src/icons/delete-icon.tsx +34 -0
- package/src/icons/document-icon.tsx +38 -0
- package/src/icons/download-icon.tsx +39 -0
- package/src/icons/edit-icon.tsx +35 -0
- package/src/icons/ellipsis-icon.tsx +38 -0
- package/src/icons/email-icon.tsx +33 -0
- package/src/icons/external-link-icon.tsx +39 -0
- package/src/icons/github-icon.tsx +27 -0
- package/src/icons/globe-icon.tsx +50 -0
- package/src/icons/google-icon.tsx +44 -0
- package/src/icons/gripper-vertical-icon.tsx +43 -0
- package/src/icons/history-icon.tsx +32 -0
- package/src/icons/home-icon.tsx +34 -0
- package/src/icons/icon-element.astro +27 -0
- package/src/icons/icon-element.tsx +32 -0
- package/src/icons/icon-sprite.tsx +18 -0
- package/src/icons/icons.module.css +147 -0
- package/src/icons/index.stories.tsx +25 -0
- package/src/icons/index.ts +39 -0
- package/src/icons/info-icon.tsx +18 -0
- package/src/icons/infonomic-icon.tsx +173 -0
- package/src/icons/light-icon.astro +36 -0
- package/src/icons/light-icon.tsx +29 -0
- package/src/icons/location-pin-icon.tsx +36 -0
- package/src/icons/moon-icon.astro +38 -0
- package/src/icons/moon-icon.tsx +42 -0
- package/src/icons/plus-icon.tsx +34 -0
- package/src/icons/primary-icon.tsx +22 -0
- package/src/icons/refresh-icon.tsx +33 -0
- package/src/icons/return-icon.tsx +36 -0
- package/src/icons/roles-icon.tsx +34 -0
- package/src/icons/search-icon.astro +40 -0
- package/src/icons/search-icon.tsx +29 -0
- package/src/icons/search-menu-icon.tsx +42 -0
- package/src/icons/settings-gear-icon.tsx +36 -0
- package/src/icons/settings-sliders-icon.tsx +43 -0
- package/src/icons/sign-out-icon.tsx +35 -0
- package/src/icons/source/icon-calendar.svg +1 -0
- package/src/icons/source/icon-check.svg +4 -0
- package/src/icons/source/icon-close.svg +3 -0
- package/src/icons/source/icon-coinbase.svg +9 -0
- package/src/icons/source/icon-copy.svg +4 -0
- package/src/icons/source/icon-document.svg +5 -0
- package/src/icons/source/icon-download.svg +4 -0
- package/src/icons/source/icon-edit.svg +6 -0
- package/src/icons/source/icon-eth-purple.svg +15 -0
- package/src/icons/source/icon-etherscan.svg +5 -0
- package/src/icons/source/icon-external-link.svg +4 -0
- package/src/icons/source/icon-globe.svg +7 -0
- package/src/icons/source/icon-gripper-vertical.svg +9 -0
- package/src/icons/source/icon-info.svg +4 -0
- package/src/icons/source/icon-infonomic.svg +43 -0
- package/src/icons/source/icon-ledger.svg +4 -0
- package/src/icons/source/icon-light.svg +3 -0
- package/src/icons/source/icon-location-pin.svg +8 -0
- package/src/icons/source/icon-logout.svg +6 -0
- package/src/icons/source/icon-metamask.svg +32 -0
- package/src/icons/source/icon-moon.svg +3 -0
- package/src/icons/source/icon-plus.svg +4 -0
- package/src/icons/source/icon-refresh.svg +4 -0
- package/src/icons/source/icon-return.svg +4 -0
- package/src/icons/source/icon-search-menu.svg +13 -0
- package/src/icons/source/icon-search.svg +3 -0
- package/src/icons/source/icon-settings-gear.svg +5 -0
- package/src/icons/source/icon-settings.svg +12 -0
- package/src/icons/source/icon-wallet.svg +3 -0
- package/src/icons/source/icon-walletconnect.svg +4 -0
- package/src/icons/source/icon-x.svg +4 -0
- package/src/icons/stopwatch-icon.tsx +39 -0
- package/src/icons/success-icon.tsx +18 -0
- package/src/icons/types/icon.ts +8 -0
- package/src/icons/user-icon.tsx +33 -0
- package/src/icons/users-icon.tsx +35 -0
- package/src/icons/wallet-icon.tsx +29 -0
- package/src/icons/warning-icon.tsx +18 -0
- package/src/icons/x-icon.tsx +33 -0
- package/src/loaders/ellipses.tsx +36 -0
- package/src/loaders/loaders.stories.tsx +46 -0
- package/src/loaders/ring.tsx +33 -0
- package/src/loaders/spinner.tsx +28 -0
- package/src/loaders/types/index.ts +6 -0
- package/src/react.ts +99 -0
- package/src/styles/base/animations.css +143 -0
- package/src/styles/base/base.css +5 -0
- package/src/styles/base/colors.css +163 -0
- package/src/styles/base/colors.stories.tsx +671 -0
- package/src/styles/base/reset.css +464 -0
- package/src/styles/base/typography.css +25 -0
- package/src/styles/base/vars.css +188 -0
- package/src/styles/components/card.css +20 -0
- package/src/styles/components/checkbox.css +55 -0
- package/src/styles/components/components.css +11 -0
- package/src/styles/components/directional-button.css +92 -0
- package/src/styles/components/dropdown.css +19 -0
- package/src/styles/components/fade-in-lift.css +13 -0
- package/src/styles/components/hamburger.css +107 -0
- package/src/styles/components/icon-element.css +4 -0
- package/src/styles/components/list-checkbox.css +60 -0
- package/src/styles/components/loaders.css +196 -0
- package/src/styles/components/popover.css +15 -0
- package/src/styles/components/scroll-to-top.css +89 -0
- package/src/styles/components/toast.css +18 -0
- package/src/styles/styles.css +6 -0
- package/src/styles/theme/autofill.css +58 -0
- package/src/styles/theme/scrollers.css +52 -0
- package/src/styles/theme/theme.css +130 -0
- package/src/styles/theme/theme.stories.tsx +33 -0
- package/src/styles/typography/code.stories.tsx +76 -0
- package/src/styles/typography/default.stories.tsx +51 -0
- package/src/styles/typography/fonts.css +30 -0
- package/src/styles/typography/lists.stories.tsx +50 -0
- package/src/styles/typography/prose.css +404 -0
- package/src/styles/typography/quote.stories.tsx +37 -0
- package/src/styles/typography.css +24 -0
- package/src/styles/utils/scroll-layout-shift.css +9 -0
- package/src/styles/utils/utility-classes.css +1278 -0
- package/src/styles/utils/utils.css +2 -0
- package/src/theme/theme-provider/index.ts +1 -0
- package/src/theme/theme-provider/provider.tsx +44 -0
- package/src/utils/capitalize.ts +6 -0
- package/src/utils/externalLinkProps.ts +6 -0
- package/src/utils/findMatch.ts +7 -0
- package/src/utils/getPortalRoot.ts +3 -0
- package/src/utils/isTouchDevice.ts +11 -0
- package/src/utils/objectsToArray.ts +15 -0
- package/src/utils/objectsToString.ts +5 -0
- package/src/utils/polymorphic.ts +16 -0
- package/src/utils/to-kebab-case.ts +5 -0
- package/src/widgets/datepicker/datepicker.module.css +189 -0
- package/src/widgets/datepicker/datepicker.stories.tsx +25 -0
- package/src/widgets/datepicker/datepicker.tsx +310 -0
- package/src/widgets/drawer/drawer-container.tsx +26 -0
- package/src/widgets/drawer/drawer-content.tsx +26 -0
- package/src/widgets/drawer/drawer-context.tsx +49 -0
- package/src/widgets/drawer/drawer-header.tsx +27 -0
- package/src/widgets/drawer/drawer-top-actions.tsx +27 -0
- package/src/widgets/drawer/drawer-wrapper.tsx +54 -0
- package/src/widgets/drawer/drawer.module.css +116 -0
- package/src/widgets/drawer/drawer.stories.tsx +224 -0
- package/src/widgets/drawer/drawer.tsx +115 -0
- package/src/widgets/drawer/motionDomAnimation.ts +4 -0
- package/src/widgets/drawer/motionDomMax.ts +4 -0
- package/src/widgets/modal/modal-actions.tsx +26 -0
- package/src/widgets/modal/modal-container.tsx +26 -0
- package/src/widgets/modal/modal-content.tsx +26 -0
- package/src/widgets/modal/modal-header.tsx +27 -0
- package/src/widgets/modal/modal-wrapper.tsx +50 -0
- package/src/widgets/modal/modal.module.css +85 -0
- package/src/widgets/modal/modal.stories.tsx +71 -0
- package/src/widgets/modal/modal.tsx +110 -0
- package/src/widgets/modal/motionDomAnimation.ts +4 -0
- package/src/widgets/modal/motionDomMax.ts +4 -0
- package/src/widgets/search/index.ts +1 -0
- package/src/widgets/search/search.stories.tsx +18 -0
- package/src/widgets/search/search.tsx +186 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
@layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
|
|
2
|
+
|
|
3
|
+
@layer infonomic-components {
|
|
4
|
+
.day-picker {
|
|
5
|
+
padding: var(--spacing-3)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* relative flex flex-col gap-4 sm:flex-row */
|
|
9
|
+
.months {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: var(--spacing-4);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* 'relative flex h-7 items-center justify-center', */
|
|
17
|
+
.months-caption {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: flex;
|
|
20
|
+
height: 1.75rem;
|
|
21
|
+
/* 28px */
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* 'flex items-center justify-center gap-2 w-full',_dropdownsClassName */
|
|
27
|
+
.dropdowns {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
gap: var(--spacing-2);
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.select-trigger {
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 2.25rem;
|
|
38
|
+
/* 36px */
|
|
39
|
+
font-size: 0.875rem;
|
|
40
|
+
/* 14px */
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.select-content {
|
|
44
|
+
z-index: 100;
|
|
45
|
+
background-color: var(--background);
|
|
46
|
+
color: var(--foreground);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.select-item {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
width: 100%;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
padding: 0.25rem 0.5rem;
|
|
55
|
+
font-size: 0.875rem;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
border: none;
|
|
58
|
+
/* 14px */
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.select-item:hover {
|
|
62
|
+
background-color: var(--gray-50);
|
|
63
|
+
color: var(--foreground);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.select-chevrons {
|
|
67
|
+
stroke: var(--primary-400);
|
|
68
|
+
opacity: 0.7
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.scroll-area {
|
|
72
|
+
border: 1px solid var(--border-color);
|
|
73
|
+
height: 240px;
|
|
74
|
+
width: 120px;
|
|
75
|
+
background-color: var(--background);
|
|
76
|
+
text-align: center;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.disabled {
|
|
80
|
+
color: var(--muted);
|
|
81
|
+
opacity: 0.5;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* 'invisible flex-1' */
|
|
85
|
+
/* This is used to hide the month when the calendar is in single mode */
|
|
86
|
+
/* and the month is not selected */
|
|
87
|
+
.hidden {
|
|
88
|
+
visibility: hidden;
|
|
89
|
+
flex: 1;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
/* 'text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30', */
|
|
94
|
+
.outside {
|
|
95
|
+
color: var(--muted);
|
|
96
|
+
opacity: 0.5;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.outside[aria-selected='true'] {
|
|
100
|
+
color: var(--muted);
|
|
101
|
+
opacity: 0.3;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* 'pt-3 text-sm' */
|
|
105
|
+
.footer {
|
|
106
|
+
padding-top: var(--spacing-3);
|
|
107
|
+
font-size: 0.875rem;
|
|
108
|
+
/* 14px */
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.weekdays {
|
|
112
|
+
display: flex;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* 'w-9 text-sm font-normal text-muted-foreground', */
|
|
116
|
+
.weekday {
|
|
117
|
+
width: 2.25rem;
|
|
118
|
+
/* 36px */
|
|
119
|
+
font-size: 0.875rem;
|
|
120
|
+
/* 14px */
|
|
121
|
+
font-weight: normal;
|
|
122
|
+
color: var(--muted);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* 'truncate text-sm font-medium' */
|
|
126
|
+
.caption-label {
|
|
127
|
+
overflow: hidden;
|
|
128
|
+
text-overflow: ellipsis;
|
|
129
|
+
white-space: nowrap;
|
|
130
|
+
font-size: 0.875rem;
|
|
131
|
+
/* 14px */
|
|
132
|
+
font-weight: 500;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* 'mx-auto mt-4' */
|
|
136
|
+
.month-grid {
|
|
137
|
+
margin-left: auto;
|
|
138
|
+
margin-right: auto;
|
|
139
|
+
margin-top: var(--spacing-4);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* 'mt-2 flex w-max items-start' */
|
|
143
|
+
.week {
|
|
144
|
+
margin-top: var(--spacing-2);
|
|
145
|
+
display: flex;
|
|
146
|
+
width: max-content;
|
|
147
|
+
align-items: flex-start;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* 'flex size-9 flex-1 items-center justify-center p-0 text-sm', */
|
|
151
|
+
.day {
|
|
152
|
+
display: flex;
|
|
153
|
+
width: 2.25rem;
|
|
154
|
+
/* 36px */
|
|
155
|
+
height: 2.25rem;
|
|
156
|
+
/* 36px */
|
|
157
|
+
flex: 1;
|
|
158
|
+
align-items: center;
|
|
159
|
+
justify-content: center;
|
|
160
|
+
padding: 0;
|
|
161
|
+
font-size: 0.875rem;
|
|
162
|
+
/* 14px */
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* '[&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground', */
|
|
166
|
+
.day>button {
|
|
167
|
+
color: var(--foreground);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* '[&>button]:bg-accent [&>button]:text-accent-foreground', */
|
|
171
|
+
.today>button {
|
|
172
|
+
/* background-color: var(--gray-50); */
|
|
173
|
+
border: solid 1px var(--primary-300);
|
|
174
|
+
color: var(--foreground);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.day>button:hover,
|
|
178
|
+
.day-selected>button {
|
|
179
|
+
background-color: var(--primary-400);
|
|
180
|
+
color: white;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* 'size-9 rounded-md p-0 font-normal transition-none aria-selected:opacity-100', */
|
|
184
|
+
.day-button {
|
|
185
|
+
width: 2.25rem;
|
|
186
|
+
/* 36px */
|
|
187
|
+
height: 2.25rem;
|
|
188
|
+
/* 36px */
|
|
189
|
+
border-radius: var(--border-radius-md);
|
|
190
|
+
padding: 0;
|
|
191
|
+
font-weight: normal;
|
|
192
|
+
transition: none;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.day-button[aria-selected='true'] {
|
|
196
|
+
opacity: 1;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/* 'bg-accent [&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground' */
|
|
200
|
+
.button-range {
|
|
201
|
+
background-color: var(--gray-100);
|
|
202
|
+
color: var(--foreground);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.button-range>button {
|
|
206
|
+
background-color: var(--primary-400);
|
|
207
|
+
color: white;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.button-range>button:hover {
|
|
211
|
+
background-color: var(--primary-400);
|
|
212
|
+
color: var(--foreground);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.range-start {
|
|
216
|
+
border-top-left-radius: var(--border-radius-md);
|
|
217
|
+
border-bottom-left-radius: var(--border-radius-md);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.range-end {
|
|
221
|
+
border-top-right-radius: var(--border-radius-md);
|
|
222
|
+
border-bottom-right-radius: var(--border-radius-md);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/* 'bg-accent !text-foreground [&>button]:bg-transparent [&>button]:!text-foreground [&>button]:hover:bg-transparent [&>button]:hover:!text-foreground', */
|
|
226
|
+
.range-middle {
|
|
227
|
+
background-color: var(--gray-50);
|
|
228
|
+
color: var(--foreground);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.range-middle>button,
|
|
232
|
+
.range-middle>button:hover {
|
|
233
|
+
background-color: transparent;
|
|
234
|
+
color: var(--foreground);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
@media (min-width: 640px) {
|
|
238
|
+
.months {
|
|
239
|
+
flex-direction: row;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/* 🌙 Dark via `.dark` class. We rely on the
|
|
244
|
+
* consuming application to detect a user's preferred
|
|
245
|
+
* color scheme - either by header or cookie, and set
|
|
246
|
+
* a root html class accordingly
|
|
247
|
+
*/
|
|
248
|
+
:global(.dark) {
|
|
249
|
+
.select-content {
|
|
250
|
+
background-color: var(--canvas-800);
|
|
251
|
+
color: var(--foreground);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.scroll-area {
|
|
255
|
+
background-color: var(--canvas-800);
|
|
256
|
+
color: var(--foreground);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.select-item:hover {
|
|
260
|
+
background-color: var(--primary-400);
|
|
261
|
+
color: var(--foreground);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.select-chevrons {
|
|
265
|
+
stroke: var(--primary-200);
|
|
266
|
+
opacity: 0.7;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.footer {
|
|
270
|
+
color: var(--muted);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.day>button {
|
|
274
|
+
color: var(--foreground);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.day>button:hover,
|
|
278
|
+
.day-selected>button {
|
|
279
|
+
background-color: var(--primary-400);
|
|
280
|
+
color: var(--foreground);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/* '[&>button]:bg-accent [&>button]:text-accent-foreground', */
|
|
284
|
+
.today>button {
|
|
285
|
+
/* background-color: var(--canvas-700); */
|
|
286
|
+
border: solid 1px var(--primary-300);
|
|
287
|
+
color: var(--foreground);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.button-range {
|
|
291
|
+
background-color: var(--canvas-700);
|
|
292
|
+
color: var(--foreground);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.button-range>button {
|
|
296
|
+
background-color: var(--primary-400);
|
|
297
|
+
color: var(--foreground);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.button-range>button:hover {
|
|
301
|
+
background-color: var(--primary-400);
|
|
302
|
+
color: var(--foreground);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.range-middle {
|
|
306
|
+
background-color: var(--canvas-700);
|
|
307
|
+
color: var(--foreground);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.range-middle>button {
|
|
311
|
+
background-color: var(--canvas-700);
|
|
312
|
+
color: var(--foreground);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite'
|
|
2
|
+
import { format } from 'date-fns'
|
|
3
|
+
import { useRef, useState } from 'react'
|
|
4
|
+
import type { DateRange } from 'react-day-picker'
|
|
5
|
+
import { Button } from '../button/button.js'
|
|
6
|
+
import { Calendar as CalendarComponent } from './calendar.js'
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof CalendarComponent> = {
|
|
9
|
+
/* 👇 The title prop is optional.
|
|
10
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
11
|
+
* to learn how to generate automatic titles
|
|
12
|
+
*/
|
|
13
|
+
title: 'Components/Calendar',
|
|
14
|
+
component: CalendarComponent,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default meta
|
|
18
|
+
|
|
19
|
+
export const Calendar = (): React.JSX.Element => {
|
|
20
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
21
|
+
const [time, setTime] = useState<string>('05:00')
|
|
22
|
+
const [date, setDate] = useState<Date>(new Date())
|
|
23
|
+
const [month, setMonth] = useState<Date>(date)
|
|
24
|
+
|
|
25
|
+
const calendarRef = useRef<HTMLDivElement | null>(null)
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div style={{ height: '100vh' }}>
|
|
29
|
+
<div ref={calendarRef} style={{ position: 'relative', width: 'fit-content', margin: 'auto' }}>
|
|
30
|
+
<CalendarComponent
|
|
31
|
+
required
|
|
32
|
+
mode="single"
|
|
33
|
+
captionLayout="dropdown"
|
|
34
|
+
selected={date}
|
|
35
|
+
month={month}
|
|
36
|
+
onMonthChange={setMonth}
|
|
37
|
+
onSelect={(selectedDate: Date) => {
|
|
38
|
+
if (selectedDate) {
|
|
39
|
+
const [hours, minutes] = time.split(':')
|
|
40
|
+
selectedDate.setHours(Number.parseInt(hours), Number.parseInt(minutes))
|
|
41
|
+
setDate(selectedDate)
|
|
42
|
+
setMonth(selectedDate)
|
|
43
|
+
}
|
|
44
|
+
}}
|
|
45
|
+
onDayClick={() => setIsOpen(false)}
|
|
46
|
+
// fromYear={2000}
|
|
47
|
+
// toYear={new Date().getFullYear()}
|
|
48
|
+
// disabled={(date: Date) =>
|
|
49
|
+
// Number(date) < Date.now() - 1000 * 60 * 60 * 24 ||
|
|
50
|
+
// Number(date) > Date.now() + 1000 * 60 * 60 * 24 * 30
|
|
51
|
+
// }
|
|
52
|
+
/>
|
|
53
|
+
<div style={{ paddingLeft: '1rem', paddingTop: '1rem' }}>
|
|
54
|
+
{date ? `${format(date, 'PPPp')}` : 'No date selected'}
|
|
55
|
+
</div>
|
|
56
|
+
<div style={{ paddingLeft: '1rem', paddingTop: '1rem' }}>
|
|
57
|
+
<Button
|
|
58
|
+
size="sm"
|
|
59
|
+
intent="noeffect"
|
|
60
|
+
className="mt-2"
|
|
61
|
+
onClick={() => {
|
|
62
|
+
const today = new Date()
|
|
63
|
+
setDate(today)
|
|
64
|
+
setMonth(today)
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
Today
|
|
68
|
+
</Button>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const Multiple = (): React.JSX.Element => {
|
|
76
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
77
|
+
const [dates, setDates] = useState<Date[] | undefined>([new Date()])
|
|
78
|
+
|
|
79
|
+
const calendarRef = useRef<HTMLDivElement | null>(null)
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div style={{ height: '100vh' }}>
|
|
83
|
+
<div ref={calendarRef} style={{ position: 'relative', width: 'fit-content', margin: 'auto' }}>
|
|
84
|
+
<CalendarComponent
|
|
85
|
+
required
|
|
86
|
+
mode="multiple"
|
|
87
|
+
captionLayout="dropdown"
|
|
88
|
+
selected={dates}
|
|
89
|
+
onSelect={(selectedDates: Date[]) => {
|
|
90
|
+
if (selectedDates) {
|
|
91
|
+
// selectedDate.setHours(Number.parseInt(hours), Number.parseInt(minutes))
|
|
92
|
+
setDates(selectedDates)
|
|
93
|
+
}
|
|
94
|
+
}}
|
|
95
|
+
onDayClick={() => setIsOpen(false)}
|
|
96
|
+
// fromYear={2000}
|
|
97
|
+
// toYear={new Date().getFullYear()}
|
|
98
|
+
// disabled={(date: Date) =>
|
|
99
|
+
// Number(date) < Date.now() - 1000 * 60 * 60 * 24 ||
|
|
100
|
+
// Number(date) > Date.now() + 1000 * 60 * 60 * 24 * 30
|
|
101
|
+
// }
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const Range = (): React.JSX.Element => {
|
|
109
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
110
|
+
const [dateRange, setDateRange] = useState<DateRange | undefined>(undefined)
|
|
111
|
+
|
|
112
|
+
const calendarRef = useRef<HTMLDivElement | null>(null)
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<div style={{ height: '100vh' }}>
|
|
116
|
+
<div ref={calendarRef} style={{ position: 'relative', width: 'fit-content', margin: 'auto' }}>
|
|
117
|
+
<CalendarComponent
|
|
118
|
+
required
|
|
119
|
+
mode="range"
|
|
120
|
+
captionLayout="dropdown"
|
|
121
|
+
selected={dateRange}
|
|
122
|
+
onSelect={(selectedDateRange: DateRange) => {
|
|
123
|
+
if (selectedDateRange) {
|
|
124
|
+
// selectedDate.setHours(Number.parseInt(hours), Number.parseInt(minutes))
|
|
125
|
+
setDateRange(selectedDateRange)
|
|
126
|
+
}
|
|
127
|
+
}}
|
|
128
|
+
onDayClick={() => setIsOpen(false)}
|
|
129
|
+
// fromYear={2000}
|
|
130
|
+
// toYear={new Date().getFullYear()}
|
|
131
|
+
// disabled={(date: Date) =>
|
|
132
|
+
// Number(date) < Date.now() - 1000 * 60 * 60 * 24 ||
|
|
133
|
+
// Number(date) > Date.now() + 1000 * 60 * 60 * 24 * 30
|
|
134
|
+
// }
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/**
|
|
3
|
+
* @file Calendar component using react-day-picker and radix-ui
|
|
4
|
+
* @see https://github.com/Maliksidk19/shadcn-datetime-picker/
|
|
5
|
+
* Portions copyright (c) 2023 Maliksidk19 licensed under the MIT
|
|
6
|
+
* license found in the LICENSE file in the root directory of this source tree.
|
|
7
|
+
* of https://github.com/Maliksidk19/shadcn-datetime-picker/
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import cx from 'classnames'
|
|
11
|
+
import { Select as SelectPrimitive } from 'radix-ui'
|
|
12
|
+
import * as React from 'react'
|
|
13
|
+
import {
|
|
14
|
+
DayPicker,
|
|
15
|
+
type DayPickerProps,
|
|
16
|
+
type Dropdown as DropDownDayPicker,
|
|
17
|
+
} from 'react-day-picker'
|
|
18
|
+
import { ChevronsUpDown } from '../../icons/chevrons-up-down.js'
|
|
19
|
+
import { Button } from '../button/button.js'
|
|
20
|
+
import { ScrollArea } from '../scroll-area/scroll-area.js'
|
|
21
|
+
|
|
22
|
+
import styles from './calendar.module.css'
|
|
23
|
+
|
|
24
|
+
export type CalendarProps = DayPickerProps & {
|
|
25
|
+
ref?: React.RefObject<HTMLDivElement>
|
|
26
|
+
captionLabelClassName?: string
|
|
27
|
+
dayClassName?: string
|
|
28
|
+
dayButtonClassName?: string
|
|
29
|
+
dropdownsClassName?: string
|
|
30
|
+
footerClassName?: string
|
|
31
|
+
monthClassName?: string
|
|
32
|
+
monthCaptionClassName?: string
|
|
33
|
+
monthGridClassName?: string
|
|
34
|
+
monthsClassName?: string
|
|
35
|
+
weekClassName?: string
|
|
36
|
+
weekdayClassName?: string
|
|
37
|
+
weekdaysClassName?: string
|
|
38
|
+
rangeEndClassName?: string
|
|
39
|
+
rangeMiddleClassName?: string
|
|
40
|
+
rangeStartClassName?: string
|
|
41
|
+
selectedClassName?: string
|
|
42
|
+
disabledClassName?: string
|
|
43
|
+
hiddenClassName?: string
|
|
44
|
+
outsideClassName?: string
|
|
45
|
+
todayClassName?: string
|
|
46
|
+
selectTriggerClassName?: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function Calendar({
|
|
50
|
+
ref,
|
|
51
|
+
className,
|
|
52
|
+
classNames,
|
|
53
|
+
hideNavigation,
|
|
54
|
+
showOutsideDays = true,
|
|
55
|
+
components: customComponents,
|
|
56
|
+
...props
|
|
57
|
+
}: CalendarProps) {
|
|
58
|
+
const _monthsClassName = cx(styles.months, props.monthsClassName)
|
|
59
|
+
const _monthCaptionClassName = cx(styles['months-caption'], props.monthCaptionClassName)
|
|
60
|
+
const _dropdownsClassName = cx(styles.dropdowns, props.dropdownsClassName)
|
|
61
|
+
const _footerClassName = cx(styles.footer, props.footerClassName)
|
|
62
|
+
const _weekdaysClassName = cx(styles.weekdays, props.weekdaysClassName)
|
|
63
|
+
const _weekdayClassName = cx(styles.weekday, props.weekdayClassName)
|
|
64
|
+
const _captionLabelClassName = cx(styles['caption-label'], props.captionLabelClassName)
|
|
65
|
+
|
|
66
|
+
const _monthGridClassName = cx(styles['month-grid'], props.monthGridClassName)
|
|
67
|
+
const _weekClassName = cx(styles.week, props.weekClassName)
|
|
68
|
+
const _dayClassName = cx(styles.day, props.dayClassName)
|
|
69
|
+
const _dayButtonClassName = cx(styles['day-button'], props.dayButtonClassName)
|
|
70
|
+
|
|
71
|
+
const buttonRangeClassName = cx(styles['button-range'])
|
|
72
|
+
const _rangeStartClassName = cx(
|
|
73
|
+
buttonRangeClassName,
|
|
74
|
+
styles['range-start'],
|
|
75
|
+
props.rangeStartClassName
|
|
76
|
+
)
|
|
77
|
+
const _rangeEndClassName = cx(buttonRangeClassName, styles['range-end'], props.rangeEndClassName)
|
|
78
|
+
const _rangeMiddleClassName = cx(styles['range-middle'], props.rangeMiddleClassName)
|
|
79
|
+
const _selectedClassName = cx(styles['day-selected'], props.selectedClassName)
|
|
80
|
+
const _todayClassName = cx(styles.today, props.todayClassName)
|
|
81
|
+
const _outsideClassName = cx(styles.outside, props.outsideClassName)
|
|
82
|
+
const _disabledClassName = cx(styles.disabled, props.disabledClassName)
|
|
83
|
+
const _hiddenClassName = cx(styles.hidden, props.hiddenClassName)
|
|
84
|
+
|
|
85
|
+
const Dropdown = React.useCallback(
|
|
86
|
+
({ value, onChange, options }: React.ComponentProps<typeof DropDownDayPicker>) => {
|
|
87
|
+
const selected = options?.find((option) => option.value === value)
|
|
88
|
+
const handleChange = (value: string) => {
|
|
89
|
+
const changeEvent = {
|
|
90
|
+
target: { value },
|
|
91
|
+
} as React.ChangeEvent<HTMLSelectElement>
|
|
92
|
+
onChange?.(changeEvent)
|
|
93
|
+
}
|
|
94
|
+
return (
|
|
95
|
+
<SelectPrimitive.Root
|
|
96
|
+
value={value?.toString()}
|
|
97
|
+
onValueChange={(value) => {
|
|
98
|
+
handleChange(value)
|
|
99
|
+
}}
|
|
100
|
+
>
|
|
101
|
+
<SelectPrimitive.Trigger asChild>
|
|
102
|
+
<Button
|
|
103
|
+
variant="outlined"
|
|
104
|
+
size="sm"
|
|
105
|
+
className={cx(styles['select-trigger'], props.selectTriggerClassName)}
|
|
106
|
+
>
|
|
107
|
+
<SelectPrimitive.Value>{selected?.label}</SelectPrimitive.Value>
|
|
108
|
+
<ChevronsUpDown height="18px" width="18px" svgClassName={styles['select-chevrons']} />
|
|
109
|
+
</Button>
|
|
110
|
+
</SelectPrimitive.Trigger>
|
|
111
|
+
<SelectPrimitive.Content
|
|
112
|
+
className={styles['select-content']}
|
|
113
|
+
position="popper"
|
|
114
|
+
sideOffset={4}
|
|
115
|
+
align="center"
|
|
116
|
+
>
|
|
117
|
+
<ScrollArea className={cx(styles['scroll-area'])}>
|
|
118
|
+
{options?.map(({ value, label, disabled }, id) => (
|
|
119
|
+
<SelectPrimitive.Item
|
|
120
|
+
className={styles['select-item']}
|
|
121
|
+
key={`${value}-${id}`}
|
|
122
|
+
value={value?.toString()}
|
|
123
|
+
disabled={disabled}
|
|
124
|
+
>
|
|
125
|
+
{label}
|
|
126
|
+
</SelectPrimitive.Item>
|
|
127
|
+
))}
|
|
128
|
+
</ScrollArea>
|
|
129
|
+
</SelectPrimitive.Content>
|
|
130
|
+
</SelectPrimitive.Root>
|
|
131
|
+
)
|
|
132
|
+
},
|
|
133
|
+
[props.selectTriggerClassName]
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<DayPicker
|
|
138
|
+
showOutsideDays={showOutsideDays}
|
|
139
|
+
hideNavigation={true} // Ensure navigation is hidden
|
|
140
|
+
className={cx(styles['day-picker'], className)}
|
|
141
|
+
classNames={{
|
|
142
|
+
caption_label: _captionLabelClassName,
|
|
143
|
+
day: _dayClassName,
|
|
144
|
+
day_button: _dayButtonClassName,
|
|
145
|
+
dropdowns: _dropdownsClassName,
|
|
146
|
+
footer: _footerClassName,
|
|
147
|
+
month: props.monthClassName,
|
|
148
|
+
month_caption: _monthCaptionClassName,
|
|
149
|
+
month_grid: _monthGridClassName,
|
|
150
|
+
months: _monthsClassName,
|
|
151
|
+
week: _weekClassName,
|
|
152
|
+
weekday: _weekdayClassName,
|
|
153
|
+
weekdays: _weekdaysClassName,
|
|
154
|
+
range_end: _rangeEndClassName,
|
|
155
|
+
range_middle: _rangeMiddleClassName,
|
|
156
|
+
range_start: _rangeStartClassName,
|
|
157
|
+
selected: _selectedClassName,
|
|
158
|
+
disabled: _disabledClassName,
|
|
159
|
+
hidden: _hiddenClassName,
|
|
160
|
+
outside: _outsideClassName,
|
|
161
|
+
today: _todayClassName,
|
|
162
|
+
nav: 'hidden', // This hides the navigation (chevrons)
|
|
163
|
+
...classNames,
|
|
164
|
+
}}
|
|
165
|
+
components={{
|
|
166
|
+
Dropdown,
|
|
167
|
+
...customComponents,
|
|
168
|
+
}}
|
|
169
|
+
{...props}
|
|
170
|
+
/>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
Calendar.displayName = 'Calendar'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
interface Props extends HTMLAttributes<'div'> {
|
|
4
|
+
class?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
import styles from './card.module.css'
|
|
8
|
+
|
|
9
|
+
const { class: className, ...rest } = Astro.props as Props
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div class:list={[styles.cardContent, className]} {...rest}>
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
interface Props extends HTMLAttributes<'div'> {
|
|
4
|
+
class?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
import styles from './card.module.css'
|
|
8
|
+
|
|
9
|
+
const { class: className, ...rest } = Astro.props as Props
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div class:list={[styles.cardDescription, className]} {...rest}>
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
interface Props extends HTMLAttributes<'div'> {
|
|
4
|
+
class?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
import styles from './card.module.css'
|
|
8
|
+
|
|
9
|
+
const { class: className, ...rest } = Astro.props as Props
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div class:list={[styles.cardFooter, className]} {...rest}>
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
interface Props extends HTMLAttributes<'div'> {
|
|
4
|
+
class?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
import styles from './card.module.css'
|
|
8
|
+
|
|
9
|
+
const { class: className, ...rest } = Astro.props as Props
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div class:list={[styles.cardHeader, className]} {...rest}>
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
interface Props extends HTMLAttributes<'div'> {
|
|
4
|
+
class?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
import styles from './card.module.css'
|
|
8
|
+
|
|
9
|
+
const { class: className, ...rest } = Astro.props as Props
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div class:list={[styles.cardTitle, className]} {...rest}>
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|