@toptal/picasso-lab 9.1.1-alpha-sat-750--poc-picasso-with-ssr.2531 → 9.3.1
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/CHANGELOG.md +1385 -0
- package/{Calendar → dist-package/Calendar}/Calendar.d.ts +0 -0
- package/{Calendar → dist-package/Calendar}/Calendar.js +0 -0
- package/{Calendar → dist-package/Calendar}/Calendar.js.map +0 -0
- package/{Calendar → dist-package/Calendar}/index.d.ts +0 -0
- package/{Calendar → dist-package/Calendar}/index.js +0 -0
- package/{Calendar → dist-package/Calendar}/index.js.map +0 -0
- package/{Calendar → dist-package/Calendar}/styles.d.ts +0 -0
- package/{Calendar → dist-package/Calendar}/styles.js +0 -0
- package/{Calendar → dist-package/Calendar}/styles.js.map +0 -0
- package/{Calendar → dist-package/Calendar}/types.d.ts +0 -0
- package/{Calendar → dist-package/Calendar}/types.js +0 -0
- package/{Calendar → dist-package/Calendar}/types.js.map +0 -0
- package/{DatePicker → dist-package/DatePicker}/DatePicker.d.ts +9 -9
- package/{DatePicker → dist-package/DatePicker}/DatePicker.js +24 -14
- package/dist-package/DatePicker/DatePicker.js.map +1 -0
- package/dist-package/DatePicker/constants.d.ts +2 -0
- package/dist-package/DatePicker/constants.js +3 -0
- package/dist-package/DatePicker/constants.js.map +1 -0
- package/dist-package/DatePicker/index.d.ts +5 -0
- package/dist-package/DatePicker/index.js +4 -0
- package/{DatePicker → dist-package/DatePicker}/index.js.map +1 -1
- package/{DatePicker → dist-package/DatePicker}/styles.d.ts +0 -0
- package/{DatePicker → dist-package/DatePicker}/styles.js +0 -0
- package/{DatePicker → dist-package/DatePicker}/styles.js.map +0 -0
- package/dist-package/DatePicker/types.d.ts +8 -0
- package/dist-package/DatePicker/types.js +2 -0
- package/dist-package/DatePicker/types.js.map +1 -0
- package/{DatePicker → dist-package/DatePicker}/utils.d.ts +3 -0
- package/{DatePicker → dist-package/DatePicker}/utils.js +12 -0
- package/{DatePicker → dist-package/DatePicker}/utils.js.map +1 -1
- package/{Drawer → dist-package/Drawer}/Drawer.d.ts +0 -0
- package/{Drawer → dist-package/Drawer}/Drawer.js +0 -0
- package/{Drawer → dist-package/Drawer}/Drawer.js.map +0 -0
- package/{Drawer → dist-package/Drawer}/index.d.ts +0 -0
- package/{Drawer → dist-package/Drawer}/index.js +0 -0
- package/{Drawer → dist-package/Drawer}/index.js.map +0 -0
- package/{Drawer → dist-package/Drawer}/styles.d.ts +0 -0
- package/{Drawer → dist-package/Drawer}/styles.js +0 -0
- package/{Drawer → dist-package/Drawer}/styles.js.map +0 -0
- package/{DrawerTitle → dist-package/DrawerTitle}/DrawerTitle.d.ts +0 -0
- package/{DrawerTitle → dist-package/DrawerTitle}/DrawerTitle.js +0 -0
- package/{DrawerTitle → dist-package/DrawerTitle}/DrawerTitle.js.map +0 -0
- package/{DrawerTitle → dist-package/DrawerTitle}/index.d.ts +0 -0
- package/{DrawerTitle → dist-package/DrawerTitle}/index.js +0 -0
- package/{DrawerTitle → dist-package/DrawerTitle}/index.js.map +0 -0
- package/{DrawerTitle → dist-package/DrawerTitle}/styles.d.ts +0 -0
- package/{DrawerTitle → dist-package/DrawerTitle}/styles.js +0 -0
- package/{DrawerTitle → dist-package/DrawerTitle}/styles.js.map +0 -0
- package/{Dropzone → dist-package/Dropzone}/Dropzone.d.ts +0 -0
- package/{Dropzone → dist-package/Dropzone}/Dropzone.js +1 -1
- package/{Dropzone → dist-package/Dropzone}/Dropzone.js.map +1 -1
- package/{Dropzone → dist-package/Dropzone}/index.d.ts +0 -0
- package/{Dropzone → dist-package/Dropzone}/index.js +0 -0
- package/{Dropzone → dist-package/Dropzone}/index.js.map +0 -0
- package/{Dropzone → dist-package/Dropzone}/styles.d.ts +1 -1
- package/{Dropzone → dist-package/Dropzone}/styles.js +0 -0
- package/{Dropzone → dist-package/Dropzone}/styles.js.map +0 -0
- package/{Dropzone → dist-package/Dropzone}/types.d.ts +0 -0
- package/{Dropzone → dist-package/Dropzone}/types.js +0 -0
- package/{Dropzone → dist-package/Dropzone}/types.js.map +0 -0
- package/{EmptyState → dist-package/EmptyState}/EmptyState.d.ts +0 -0
- package/{EmptyState → dist-package/EmptyState}/EmptyState.js +0 -0
- package/{EmptyState → dist-package/EmptyState}/EmptyState.js.map +0 -0
- package/{EmptyState → dist-package/EmptyState}/index.d.ts +0 -0
- package/{EmptyState → dist-package/EmptyState}/index.js +0 -0
- package/{EmptyState → dist-package/EmptyState}/index.js.map +0 -0
- package/{EmptyStateCollection → dist-package/EmptyStateCollection}/EmptyStateCollection.d.ts +0 -0
- package/{EmptyStateCollection → dist-package/EmptyStateCollection}/EmptyStateCollection.js +0 -0
- package/{EmptyStateCollection → dist-package/EmptyStateCollection}/EmptyStateCollection.js.map +0 -0
- package/{EmptyStateCollection → dist-package/EmptyStateCollection}/index.d.ts +0 -0
- package/{EmptyStateCollection → dist-package/EmptyStateCollection}/index.js +0 -0
- package/{EmptyStateCollection → dist-package/EmptyStateCollection}/index.js.map +0 -0
- package/{EmptyStateCollection → dist-package/EmptyStateCollection}/styles.d.ts +0 -0
- package/{EmptyStateCollection → dist-package/EmptyStateCollection}/styles.js +0 -0
- package/{EmptyStateCollection → dist-package/EmptyStateCollection}/styles.js.map +0 -0
- package/{EmptyStatePage → dist-package/EmptyStatePage}/EmptyStatePage.d.ts +0 -0
- package/{EmptyStatePage → dist-package/EmptyStatePage}/EmptyStatePage.js +0 -0
- package/{EmptyStatePage → dist-package/EmptyStatePage}/EmptyStatePage.js.map +0 -0
- package/{EmptyStatePage → dist-package/EmptyStatePage}/index.d.ts +0 -0
- package/{EmptyStatePage → dist-package/EmptyStatePage}/index.js +0 -0
- package/{EmptyStatePage → dist-package/EmptyStatePage}/index.js.map +0 -0
- package/{EmptyStatePage → dist-package/EmptyStatePage}/styles.d.ts +0 -0
- package/{EmptyStatePage → dist-package/EmptyStatePage}/styles.js +0 -0
- package/{EmptyStatePage → dist-package/EmptyStatePage}/styles.js.map +0 -0
- package/{Note → dist-package/Note}/Note.d.ts +0 -0
- package/{Note → dist-package/Note}/Note.js +0 -0
- package/{Note → dist-package/Note}/Note.js.map +0 -0
- package/{Note → dist-package/Note}/index.d.ts +0 -0
- package/{Note → dist-package/Note}/index.js +0 -0
- package/{Note → dist-package/Note}/index.js.map +0 -0
- package/{Note → dist-package/Note}/styles.d.ts +0 -0
- package/{Note → dist-package/Note}/styles.js +0 -0
- package/{Note → dist-package/Note}/styles.js.map +0 -0
- package/{NoteContent → dist-package/NoteContent}/NoteContent.d.ts +0 -0
- package/{NoteContent → dist-package/NoteContent}/NoteContent.js +0 -0
- package/{NoteContent → dist-package/NoteContent}/NoteContent.js.map +0 -0
- package/{NoteContent → dist-package/NoteContent}/index.d.ts +0 -0
- package/{NoteContent → dist-package/NoteContent}/index.js +0 -0
- package/{NoteContent → dist-package/NoteContent}/index.js.map +0 -0
- package/{NoteSubtitle → dist-package/NoteSubtitle}/NoteSubtitle.d.ts +0 -0
- package/{NoteSubtitle → dist-package/NoteSubtitle}/NoteSubtitle.js +0 -0
- package/{NoteSubtitle → dist-package/NoteSubtitle}/NoteSubtitle.js.map +0 -0
- package/{NoteSubtitle → dist-package/NoteSubtitle}/index.d.ts +0 -0
- package/{NoteSubtitle → dist-package/NoteSubtitle}/index.js +0 -0
- package/{NoteSubtitle → dist-package/NoteSubtitle}/index.js.map +0 -0
- package/{NoteTitle → dist-package/NoteTitle}/NoteTitle.d.ts +0 -0
- package/{NoteTitle → dist-package/NoteTitle}/NoteTitle.js +0 -0
- package/{NoteTitle → dist-package/NoteTitle}/NoteTitle.js.map +0 -0
- package/{NoteTitle → dist-package/NoteTitle}/index.d.ts +0 -0
- package/{NoteTitle → dist-package/NoteTitle}/index.js +0 -0
- package/{NoteTitle → dist-package/NoteTitle}/index.js.map +0 -0
- package/{NoteTitle → dist-package/NoteTitle}/styles.d.ts +0 -0
- package/{NoteTitle → dist-package/NoteTitle}/styles.js +0 -0
- package/{NoteTitle → dist-package/NoteTitle}/styles.js.map +0 -0
- package/{OverviewBlock → dist-package/OverviewBlock}/OverviewBlock.d.ts +0 -0
- package/{OverviewBlock → dist-package/OverviewBlock}/OverviewBlock.js +0 -0
- package/{OverviewBlock → dist-package/OverviewBlock}/OverviewBlock.js.map +0 -0
- package/{OverviewBlock → dist-package/OverviewBlock}/index.d.ts +0 -0
- package/{OverviewBlock → dist-package/OverviewBlock}/index.js +0 -0
- package/{OverviewBlock → dist-package/OverviewBlock}/index.js.map +0 -0
- package/{OverviewBlock → dist-package/OverviewBlock}/styles.d.ts +0 -0
- package/{OverviewBlock → dist-package/OverviewBlock}/styles.js +0 -0
- package/{OverviewBlock → dist-package/OverviewBlock}/styles.js.map +0 -0
- package/{OverviewBlockGroup → dist-package/OverviewBlockGroup}/OverviewBlockGroup.d.ts +0 -0
- package/{OverviewBlockGroup → dist-package/OverviewBlockGroup}/OverviewBlockGroup.js +0 -0
- package/{OverviewBlockGroup → dist-package/OverviewBlockGroup}/OverviewBlockGroup.js.map +0 -0
- package/{OverviewBlockGroup → dist-package/OverviewBlockGroup}/OverviewBlockGroupContext.d.ts +0 -0
- package/{OverviewBlockGroup → dist-package/OverviewBlockGroup}/OverviewBlockGroupContext.js +0 -0
- package/{OverviewBlockGroup → dist-package/OverviewBlockGroup}/OverviewBlockGroupContext.js.map +0 -0
- package/{OverviewBlockGroup → dist-package/OverviewBlockGroup}/index.d.ts +0 -0
- package/{OverviewBlockGroup → dist-package/OverviewBlockGroup}/index.js +0 -0
- package/{OverviewBlockGroup → dist-package/OverviewBlockGroup}/index.js.map +0 -0
- package/{OverviewBlockGroup → dist-package/OverviewBlockGroup}/settings.d.ts +0 -0
- package/{OverviewBlockGroup → dist-package/OverviewBlockGroup}/settings.js +0 -0
- package/{OverviewBlockGroup → dist-package/OverviewBlockGroup}/settings.js.map +0 -0
- package/{OverviewBlockRow → dist-package/OverviewBlockRow}/OverviewBlockRow.d.ts +0 -0
- package/{OverviewBlockRow → dist-package/OverviewBlockRow}/OverviewBlockRow.js +0 -0
- package/{OverviewBlockRow → dist-package/OverviewBlockRow}/OverviewBlockRow.js.map +0 -0
- package/{OverviewBlockRow → dist-package/OverviewBlockRow}/index.d.ts +0 -0
- package/{OverviewBlockRow → dist-package/OverviewBlockRow}/index.js +0 -0
- package/{OverviewBlockRow → dist-package/OverviewBlockRow}/index.js.map +0 -0
- package/{OverviewBlockRow → dist-package/OverviewBlockRow}/styles.d.ts +0 -0
- package/{OverviewBlockRow → dist-package/OverviewBlockRow}/styles.js +0 -0
- package/{OverviewBlockRow → dist-package/OverviewBlockRow}/styles.js.map +0 -0
- package/dist-package/README.md +26 -0
- package/{Section → dist-package/Section}/Section.d.ts +1 -1
- package/{Section → dist-package/Section}/Section.js +6 -5
- package/dist-package/Section/Section.js.map +1 -0
- package/{Section → dist-package/Section}/index.d.ts +0 -0
- package/{Section → dist-package/Section}/index.js +0 -0
- package/{Section → dist-package/Section}/index.js.map +0 -0
- package/dist-package/Section/styles.d.ts +3 -0
- package/dist-package/Section/styles.js +60 -0
- package/dist-package/Section/styles.js.map +1 -0
- package/{Timeline → dist-package/Timeline}/Timeline.d.ts +0 -0
- package/{Timeline → dist-package/Timeline}/Timeline.js +0 -0
- package/{Timeline → dist-package/Timeline}/Timeline.js.map +0 -0
- package/{Timeline → dist-package/Timeline}/index.d.ts +0 -0
- package/{Timeline → dist-package/Timeline}/index.js +0 -0
- package/{Timeline → dist-package/Timeline}/index.js.map +0 -0
- package/{TimelineRow → dist-package/TimelineRow}/TimelineRow.d.ts +0 -0
- package/{TimelineRow → dist-package/TimelineRow}/TimelineRow.js +0 -0
- package/{TimelineRow → dist-package/TimelineRow}/TimelineRow.js.map +0 -0
- package/{TimelineRow → dist-package/TimelineRow}/index.d.ts +0 -0
- package/{TimelineRow → dist-package/TimelineRow}/index.js +0 -0
- package/{TimelineRow → dist-package/TimelineRow}/index.js.map +0 -0
- package/{TimelineRow → dist-package/TimelineRow}/styles.d.ts +0 -0
- package/{TimelineRow → dist-package/TimelineRow}/styles.js +0 -0
- package/{TimelineRow → dist-package/TimelineRow}/styles.js.map +0 -0
- package/{TypographyOverflow → dist-package/TypographyOverflow}/TypographyOverflow.d.ts +0 -0
- package/{TypographyOverflow → dist-package/TypographyOverflow}/TypographyOverflow.js +0 -0
- package/{TypographyOverflow → dist-package/TypographyOverflow}/TypographyOverflow.js.map +0 -0
- package/{TypographyOverflow → dist-package/TypographyOverflow}/index.d.ts +0 -0
- package/{TypographyOverflow → dist-package/TypographyOverflow}/index.js +0 -0
- package/{TypographyOverflow → dist-package/TypographyOverflow}/index.js.map +0 -0
- package/{TypographyOverflow → dist-package/TypographyOverflow}/styles.d.ts +0 -0
- package/{TypographyOverflow → dist-package/TypographyOverflow}/styles.js +0 -0
- package/{TypographyOverflow → dist-package/TypographyOverflow}/styles.js.map +0 -0
- package/{index.d.ts → dist-package/index.d.ts} +2 -2
- package/{index.js → dist-package/index.js} +1 -1
- package/dist-package/index.js.map +1 -0
- package/dist-package/package.json +53 -0
- package/package.json +4 -5
- package/src/Calendar/Calendar.tsx +215 -0
- package/src/Calendar/__snapshots__/test.tsx.snap +447 -0
- package/src/Calendar/index.ts +2 -0
- package/src/Calendar/styles.ts +104 -0
- package/src/Calendar/test.tsx +20 -0
- package/src/Calendar/types.ts +42 -0
- package/src/DatePicker/DatePicker.tsx +366 -0
- package/src/DatePicker/__image_snapshots__/datepicker-full-width-snap.png +0 -0
- package/src/DatePicker/__image_snapshots__/datepicker-with-custom-day-rendering-snap.png +0 -0
- package/src/DatePicker/__snapshots__/test.tsx.snap +51 -0
- package/src/DatePicker/constants.ts +2 -0
- package/src/DatePicker/index.ts +5 -0
- package/src/DatePicker/story/AllowCustomValue.example.tsx +33 -0
- package/src/DatePicker/story/Autocomplete.example.tsx +47 -0
- package/src/DatePicker/story/Default.example.tsx +19 -0
- package/src/DatePicker/story/Error.example.tsx +26 -0
- package/src/DatePicker/story/Range.example.tsx +22 -0
- package/src/DatePicker/story/WithCustomDayRendering.example.tsx +47 -0
- package/src/DatePicker/story/WithInitialValue.example.tsx +19 -0
- package/src/DatePicker/story/WithInputProps.example.tsx +24 -0
- package/src/DatePicker/story/WithNoHideOnSelect.example.tsx +20 -0
- package/src/DatePicker/story/WithOnBlurHandler.example.tsx +22 -0
- package/src/DatePicker/story/WithSelectionLimits.example.tsx +32 -0
- package/src/DatePicker/story/WithTimezone.example.tsx +25 -0
- package/src/DatePicker/story/index.jsx +50 -0
- package/src/DatePicker/styles.ts +8 -0
- package/src/DatePicker/test.tsx +370 -0
- package/src/DatePicker/types.ts +13 -0
- package/src/DatePicker/utils.ts +123 -0
- package/src/Drawer/Drawer.tsx +105 -0
- package/src/Drawer/__image_snapshots__/drawer-custom-title-effect-1-snap.png +0 -0
- package/src/Drawer/__image_snapshots__/drawer-custom-title-snap.png +0 -0
- package/src/Drawer/__image_snapshots__/drawer-default-effect-1-snap.png +0 -0
- package/src/Drawer/__image_snapshots__/drawer-default-snap.png +0 -0
- package/src/Drawer/__image_snapshots__/drawer-width-effect-1-snap.png +0 -0
- package/src/Drawer/__image_snapshots__/drawer-width-effect-2-snap.png +0 -0
- package/src/Drawer/__image_snapshots__/drawer-width-effect-3-snap.png +0 -0
- package/src/Drawer/__image_snapshots__/drawer-width-effect-4-snap.png +0 -0
- package/src/Drawer/__image_snapshots__/drawer-width-effect-5-snap.png +0 -0
- package/src/Drawer/__image_snapshots__/drawer-width-snap.png +0 -0
- package/src/Drawer/__image_snapshots__/drawer-without-title-effect-1-snap.png +0 -0
- package/src/Drawer/__image_snapshots__/drawer-without-title-snap.png +0 -0
- package/src/Drawer/index.ts +6 -0
- package/src/Drawer/story/CustomTitle.example.tsx +32 -0
- package/src/Drawer/story/Default.example.tsx +29 -0
- package/src/Drawer/story/DrawerAndNotification.example.tsx +34 -0
- package/src/Drawer/story/Widths.example.tsx +46 -0
- package/src/Drawer/story/WithoutTitle.example.tsx +22 -0
- package/src/Drawer/story/index.jsx +80 -0
- package/src/Drawer/styles.ts +42 -0
- package/src/DrawerTitle/DrawerTitle.tsx +35 -0
- package/src/DrawerTitle/index.ts +1 -0
- package/src/DrawerTitle/styles.ts +12 -0
- package/src/Dropzone/Dropzone.tsx +146 -0
- package/src/Dropzone/__snapshots__/test.tsx.snap +40 -0
- package/src/Dropzone/index.ts +7 -0
- package/src/Dropzone/story/Default.example.tsx +8 -0
- package/src/Dropzone/story/Disabled.example.tsx +25 -0
- package/src/Dropzone/story/Error.example.tsx +16 -0
- package/src/Dropzone/story/Multiple.example.tsx +30 -0
- package/src/Dropzone/story/Uploader.example.tsx +116 -0
- package/src/Dropzone/story/Uploading.example.tsx +16 -0
- package/src/Dropzone/story/index.jsx +85 -0
- package/src/Dropzone/styles.ts +43 -0
- package/src/Dropzone/test.tsx +33 -0
- package/src/Dropzone/types.ts +56 -0
- package/src/EmptyState/EmptyState.tsx +7 -0
- package/src/EmptyState/index.tsx +1 -0
- package/src/EmptyState/story/index.jsx +13 -0
- package/src/EmptyStateCollection/EmptyStateCollection.tsx +56 -0
- package/src/EmptyStateCollection/__image_snapshots__/emptystate-collection-emptystatecollection-snap.png +0 -0
- package/src/EmptyStateCollection/index.tsx +1 -0
- package/src/EmptyStateCollection/story/Default.example.tsx +11 -0
- package/src/EmptyStateCollection/story/index.jsx +20 -0
- package/src/EmptyStateCollection/styles.ts +10 -0
- package/src/EmptyStatePage/EmptyStatePage.tsx +65 -0
- package/src/EmptyStatePage/__image_snapshots__/emptystate-page-emptystatepage-snap.png +0 -0
- package/src/EmptyStatePage/index.tsx +1 -0
- package/src/EmptyStatePage/story/Default.example.tsx +21 -0
- package/src/EmptyStatePage/story/index.jsx +21 -0
- package/src/EmptyStatePage/styles.ts +9 -0
- package/src/Note/Note.tsx +36 -0
- package/src/Note/__snapshots__/test.tsx.snap +37 -0
- package/src/Note/index.ts +6 -0
- package/src/Note/story/Default.example.tsx +14 -0
- package/src/Note/story/index.jsx +23 -0
- package/src/Note/styles.ts +27 -0
- package/src/Note/test.tsx +22 -0
- package/src/NoteContent/NoteContent.tsx +23 -0
- package/src/NoteContent/index.ts +1 -0
- package/src/NoteContent/story/index.jsx +12 -0
- package/src/NoteSubtitle/NoteSubtitle.tsx +25 -0
- package/src/NoteSubtitle/index.ts +1 -0
- package/src/NoteSubtitle/story/index.jsx +12 -0
- package/src/NoteTitle/NoteTitle.tsx +34 -0
- package/src/NoteTitle/index.ts +1 -0
- package/src/NoteTitle/story/index.jsx +12 -0
- package/src/NoteTitle/styles.ts +8 -0
- package/src/OverviewBlock/OverviewBlock.tsx +125 -0
- package/src/OverviewBlock/__image_snapshots__/overviewblock-default-snap.png +0 -0
- package/src/OverviewBlock/__image_snapshots__/overviewblock-multi-line-snap.png +0 -0
- package/src/OverviewBlock/__image_snapshots__/overviewblock-number-snap.png +0 -0
- package/src/OverviewBlock/__image_snapshots__/overviewblock-routing-snap.png +0 -0
- package/src/OverviewBlock/__image_snapshots__/overviewblock-text-snap.png +0 -0
- package/src/OverviewBlock/index.ts +6 -0
- package/src/OverviewBlock/story/Default.example.tsx +35 -0
- package/src/OverviewBlock/story/Multiline.example.tsx +51 -0
- package/src/OverviewBlock/story/Number.example.tsx +20 -0
- package/src/OverviewBlock/story/Routing.example.tsx +40 -0
- package/src/OverviewBlock/story/Text.example.tsx +15 -0
- package/src/OverviewBlock/story/index.jsx +100 -0
- package/src/OverviewBlock/styles.ts +44 -0
- package/src/OverviewBlock/test.tsx +111 -0
- package/src/OverviewBlockGroup/OverviewBlockGroup.tsx +56 -0
- package/src/OverviewBlockGroup/OverviewBlockGroupContext.tsx +21 -0
- package/src/OverviewBlockGroup/__image_snapshots__/visual-variants-of-the-groups-block-width-snap.png +0 -0
- package/src/OverviewBlockGroup/__image_snapshots__/visual-variants-of-the-groups-center-aligned-snap.png +0 -0
- package/src/OverviewBlockGroup/index.ts +1 -0
- package/src/OverviewBlockGroup/settings.ts +2 -0
- package/src/OverviewBlockGroup/story/BlockWidth.example.tsx +38 -0
- package/src/OverviewBlockGroup/story/CenterAligned.example.tsx +17 -0
- package/src/OverviewBlockGroup/story/index.jsx +25 -0
- package/src/OverviewBlockGroup/test.tsx +17 -0
- package/src/OverviewBlockRow/OverviewBlockRow.tsx +22 -0
- package/src/OverviewBlockRow/index.ts +1 -0
- package/src/OverviewBlockRow/story/index.jsx +11 -0
- package/src/OverviewBlockRow/styles.ts +27 -0
- package/src/Section/Section.tsx +163 -0
- package/src/Section/__snapshots__/test.tsx.snap +186 -0
- package/src/Section/index.ts +6 -0
- package/src/Section/story/Actions.example.tsx +85 -0
- package/src/Section/story/Collapsible.example.tsx +113 -0
- package/src/Section/story/Default.example.tsx +77 -0
- package/src/Section/story/TitleSize.example.tsx +34 -0
- package/src/Section/story/Variant.example.tsx +108 -0
- package/src/Section/story/index.jsx +35 -0
- package/src/Section/styles.ts +65 -0
- package/src/Section/test.tsx +115 -0
- package/src/Timeline/Timeline.tsx +25 -0
- package/src/Timeline/__snapshots__/test.tsx.snap +332 -0
- package/src/Timeline/index.ts +6 -0
- package/src/Timeline/story/Dates.example.tsx +52 -0
- package/src/Timeline/story/Default.example.tsx +34 -0
- package/src/Timeline/story/TrimLastConnector.example.tsx +29 -0
- package/src/Timeline/story/index.jsx +27 -0
- package/src/Timeline/test.tsx +101 -0
- package/src/TimelineRow/TimelineRow.tsx +83 -0
- package/src/TimelineRow/index.ts +6 -0
- package/src/TimelineRow/story/index.jsx +11 -0
- package/src/TimelineRow/styles.ts +47 -0
- package/src/TypographyOverflow/TypographyOverflow.tsx +153 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-checkbox-label-effect-1-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-checkbox-label-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-custom-tooltip-content-effect-1-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-custom-tooltip-content-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-default-effect-1-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-default-effect-2-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-default-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-delay-effect-1-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-delay-effect-2-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-delay-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-light-tooltip-background-effect-1-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-light-tooltip-background-effect-2-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-light-tooltip-background-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-multiline-effect-1-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-multiline-effect-2-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-multiline-effect-3-snap.png +0 -0
- package/src/TypographyOverflow/__image_snapshots__/typographyoverflow-multiline-snap.png +0 -0
- package/src/TypographyOverflow/index.ts +6 -0
- package/src/TypographyOverflow/story/CheckboxLabel.example.tsx +21 -0
- package/src/TypographyOverflow/story/CustomTooltip.example.tsx +22 -0
- package/src/TypographyOverflow/story/Default.example.tsx +32 -0
- package/src/TypographyOverflow/story/Delay.example.tsx +29 -0
- package/src/TypographyOverflow/story/GridWithControls.example.tsx +64 -0
- package/src/TypographyOverflow/story/Multiline.example.tsx +59 -0
- package/src/TypographyOverflow/story/TooltipVariants.example.tsx +23 -0
- package/src/TypographyOverflow/story/index.jsx +83 -0
- package/src/TypographyOverflow/styles.ts +29 -0
- package/src/TypographyOverflow/test.tsx +60 -0
- package/src/index.ts +35 -0
- package/src/story/index.jsx +10 -0
- package/tsconfig.build.json +7 -0
- package/DatePicker/DatePicker.js.map +0 -1
- package/DatePicker/index.d.ts +0 -2
- package/DatePicker/index.js +0 -2
- package/Section/Section.js.map +0 -1
- package/Section/styles.d.ts +0 -3
- package/Section/styles.js +0 -36
- package/Section/styles.js.map +0 -1
- package/index.js.map +0 -1
@@ -0,0 +1,366 @@
|
|
1
|
+
/* eslint-disable max-lines-per-function, max-lines */
|
2
|
+
/* eslint-disable complexity, max-statements */ // Squiggly lines makes code difficult to work with
|
3
|
+
import { makeStyles, Theme } from '@material-ui/core/styles'
|
4
|
+
import {
|
5
|
+
BaseProps,
|
6
|
+
Container,
|
7
|
+
Input,
|
8
|
+
InputAdornment,
|
9
|
+
InputProps
|
10
|
+
} from '@toptal/picasso'
|
11
|
+
import { Calendar16 } from '@toptal/picasso/Icon'
|
12
|
+
import Popper from '@toptal/picasso/Popper'
|
13
|
+
import { noop } from '@toptal/picasso/utils'
|
14
|
+
import formatDate from 'date-fns/format'
|
15
|
+
import PopperJs from 'popper.js'
|
16
|
+
import React, {
|
17
|
+
KeyboardEvent,
|
18
|
+
ReactNode,
|
19
|
+
useCallback,
|
20
|
+
useLayoutEffect,
|
21
|
+
useRef,
|
22
|
+
useState
|
23
|
+
} from 'react'
|
24
|
+
|
25
|
+
import Calendar, {
|
26
|
+
DateOrDateRangeType,
|
27
|
+
DateRangeType,
|
28
|
+
DayProps
|
29
|
+
} from '../Calendar'
|
30
|
+
import {
|
31
|
+
DEFAULT_DATE_PICKER_DISPLAY_DATE_FORMAT,
|
32
|
+
DEFAULT_DATE_PICKER_EDIT_DATE_FORMAT
|
33
|
+
} from './constants'
|
34
|
+
import styles from './styles'
|
35
|
+
import { DatePickerValue, DatePickerStringParser } from './types'
|
36
|
+
import {
|
37
|
+
formatDateRange,
|
38
|
+
datePickerParseDateString,
|
39
|
+
timezoneConvert,
|
40
|
+
timezoneFormat,
|
41
|
+
isValidDateValue
|
42
|
+
} from './utils'
|
43
|
+
|
44
|
+
const EMPTY_INPUT_VALUE = ''
|
45
|
+
|
46
|
+
const useStyles = makeStyles<Theme>(styles, {
|
47
|
+
name: 'PicassoDatePicker'
|
48
|
+
})
|
49
|
+
|
50
|
+
export interface Props
|
51
|
+
extends BaseProps,
|
52
|
+
Omit<
|
53
|
+
InputProps,
|
54
|
+
| 'value'
|
55
|
+
| 'onSelect'
|
56
|
+
| 'type'
|
57
|
+
| 'multiline'
|
58
|
+
| 'rows'
|
59
|
+
| 'defaultValue'
|
60
|
+
| 'onChange'
|
61
|
+
> {
|
62
|
+
/** Date that will be selected in `DatePicker` */
|
63
|
+
value?: DatePickerValue
|
64
|
+
/** Method that will be invoked with selected values */
|
65
|
+
onChange: (value: DatePickerValue) => void
|
66
|
+
/** Invoked when user goes away from `DatePicker` input */
|
67
|
+
onBlur?: () => void
|
68
|
+
/** Whether calendar supports single date selection or range */
|
69
|
+
range?: boolean
|
70
|
+
/** Earliest date available for selection */
|
71
|
+
minDate?: Date
|
72
|
+
/** Latest date available for selection */
|
73
|
+
maxDate?: Date
|
74
|
+
/** Whether calendar should be closed after date selection. True by default */
|
75
|
+
hideOnSelect?: boolean
|
76
|
+
/** Date format that user will see in the input */
|
77
|
+
displayDateFormat?: string
|
78
|
+
/** Date range where selection is not allowed */
|
79
|
+
disabledIntervals?: { start: Date; end: Date }[]
|
80
|
+
/** Date format that user will see during manual input */
|
81
|
+
editDateFormat?: string
|
82
|
+
/** Specify icon which should be rendered inside `DatePicker` */
|
83
|
+
icon?: ReactNode
|
84
|
+
/** Specify a value if want to enable browser autofill */
|
85
|
+
autoComplete?: string
|
86
|
+
/** Indicate whether `DatePicker`'s input is in error state */
|
87
|
+
error?: boolean
|
88
|
+
/** Function to override default markup to show Date */
|
89
|
+
renderDay?: (args: DayProps) => ReactNode
|
90
|
+
popperContainer?: HTMLElement
|
91
|
+
/** Index of the first day of the week (0 - Sunday). Default is 1 - Monday */
|
92
|
+
weekStartsOn?: number
|
93
|
+
/** IANA timezone to display and edit date(s) */
|
94
|
+
timezone?: string
|
95
|
+
/* Invoked when input value has been changed. If method failed to parse a value, it must return undefined. Used to process input value before passing it to the `onChange` */
|
96
|
+
parseInputValue?: DatePickerStringParser
|
97
|
+
}
|
98
|
+
export const DatePicker = (props: Props) => {
|
99
|
+
const {
|
100
|
+
range,
|
101
|
+
hideOnSelect,
|
102
|
+
displayDateFormat = DEFAULT_DATE_PICKER_DISPLAY_DATE_FORMAT,
|
103
|
+
editDateFormat = DEFAULT_DATE_PICKER_EDIT_DATE_FORMAT,
|
104
|
+
onBlur = noop,
|
105
|
+
onChange,
|
106
|
+
value,
|
107
|
+
width,
|
108
|
+
icon,
|
109
|
+
minDate,
|
110
|
+
maxDate,
|
111
|
+
disabledIntervals,
|
112
|
+
popperContainer,
|
113
|
+
renderDay,
|
114
|
+
weekStartsOn,
|
115
|
+
timezone,
|
116
|
+
size,
|
117
|
+
parseInputValue = datePickerParseDateString,
|
118
|
+
...rest
|
119
|
+
} = props
|
120
|
+
const classes = useStyles()
|
121
|
+
|
122
|
+
const inputProps = rest
|
123
|
+
|
124
|
+
const [calendarIsShown, setCalendarIsShown] = useState(false)
|
125
|
+
const [isInputFocused, setIsInputFocused] = useState(false)
|
126
|
+
const [inputValue, setInputValue] = useState(EMPTY_INPUT_VALUE)
|
127
|
+
const [
|
128
|
+
calendarValue,
|
129
|
+
setCalendarValue
|
130
|
+
] = useState<DateOrDateRangeType | null>(null)
|
131
|
+
|
132
|
+
const hideCalendar = () => setCalendarIsShown(false)
|
133
|
+
const showCalendar = () => setCalendarIsShown(true)
|
134
|
+
|
135
|
+
const inputRef = useRef<HTMLInputElement>(null)
|
136
|
+
const popperRef = useRef<PopperJs>(null)
|
137
|
+
const calendarRef = useRef<HTMLDivElement>(null)
|
138
|
+
const inputWrapperRef = useRef<HTMLDivElement>(null)
|
139
|
+
|
140
|
+
// Format the input based on its 'focus' state
|
141
|
+
const formatInputValue = useCallback(
|
142
|
+
(valueToFormat: DateOrDateRangeType | string) => {
|
143
|
+
if (!isValidDateValue(valueToFormat)) {
|
144
|
+
return valueToFormat
|
145
|
+
}
|
146
|
+
|
147
|
+
return Array.isArray(valueToFormat)
|
148
|
+
? formatDateRange(valueToFormat as DateRangeType, displayDateFormat)
|
149
|
+
: formatDate(
|
150
|
+
valueToFormat as Date,
|
151
|
+
isInputFocused ? editDateFormat : displayDateFormat
|
152
|
+
)
|
153
|
+
},
|
154
|
+
[isInputFocused, editDateFormat, displayDateFormat]
|
155
|
+
)
|
156
|
+
|
157
|
+
// Keep the input format in sync with its 'focus' state
|
158
|
+
useLayoutEffect(() => {
|
159
|
+
setInputValue(() => {
|
160
|
+
if (!value) {
|
161
|
+
return EMPTY_INPUT_VALUE
|
162
|
+
}
|
163
|
+
|
164
|
+
if (!isValidDateValue(value)) {
|
165
|
+
return value
|
166
|
+
}
|
167
|
+
|
168
|
+
return formatInputValue(timezoneConvert(value, timezone))
|
169
|
+
})
|
170
|
+
}, [value, timezone, formatInputValue])
|
171
|
+
|
172
|
+
// Keep the calendar in sync with the input value
|
173
|
+
useLayoutEffect(() => {
|
174
|
+
setCalendarValue(() => {
|
175
|
+
if (!value || !isValidDateValue(value)) {
|
176
|
+
return null
|
177
|
+
}
|
178
|
+
|
179
|
+
return timezoneConvert(value, timezone)
|
180
|
+
})
|
181
|
+
}, [value, timezone])
|
182
|
+
|
183
|
+
const isInsideDatePicker = (node: Node) => {
|
184
|
+
return (
|
185
|
+
popperRef.current?.popper.contains(node) ||
|
186
|
+
inputWrapperRef.current?.contains(node)
|
187
|
+
)
|
188
|
+
}
|
189
|
+
|
190
|
+
const handleBlur = (event: React.FocusEvent<HTMLDivElement>) => {
|
191
|
+
const isFocusedInsideDatePicker = isInsideDatePicker(
|
192
|
+
(event.relatedTarget || document.activeElement) as Node
|
193
|
+
)
|
194
|
+
|
195
|
+
if (isFocusedInsideDatePicker) {
|
196
|
+
return
|
197
|
+
}
|
198
|
+
|
199
|
+
hideCalendar()
|
200
|
+
onBlur()
|
201
|
+
|
202
|
+
setIsInputFocused(false)
|
203
|
+
}
|
204
|
+
|
205
|
+
const handleInputChange = (
|
206
|
+
e: React.ChangeEvent<
|
207
|
+
HTMLTextAreaElement | HTMLInputElement | HTMLSelectElement
|
208
|
+
>
|
209
|
+
) => {
|
210
|
+
// TODO: change this if manual entering of range is needed
|
211
|
+
if (range) {
|
212
|
+
return
|
213
|
+
}
|
214
|
+
|
215
|
+
const nextValue = e.target.value
|
216
|
+
|
217
|
+
// TODO: add char filtering (only number , `-` or ` ` allowed)
|
218
|
+
setInputValue(nextValue)
|
219
|
+
if (!nextValue) {
|
220
|
+
onChange(null)
|
221
|
+
} else {
|
222
|
+
const parsedInputValue = parseInputValue(nextValue, {
|
223
|
+
dateFormat: editDateFormat,
|
224
|
+
timezone,
|
225
|
+
minDate,
|
226
|
+
maxDate
|
227
|
+
})
|
228
|
+
|
229
|
+
if (parsedInputValue) {
|
230
|
+
onChange(parsedInputValue)
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
const focus = () => {
|
236
|
+
if (inputRef && inputRef.current) {
|
237
|
+
inputRef.current.focus()
|
238
|
+
}
|
239
|
+
}
|
240
|
+
|
241
|
+
const handleCalendarChange = (nextValue: DateOrDateRangeType) => {
|
242
|
+
const nextTimezoneValue = Array.isArray(nextValue)
|
243
|
+
? (nextValue.map((date: Date) =>
|
244
|
+
timezoneFormat(date, timezone)
|
245
|
+
) as DateRangeType)
|
246
|
+
: timezoneFormat(nextValue, timezone)
|
247
|
+
|
248
|
+
onChange(nextTimezoneValue)
|
249
|
+
setCalendarValue(nextTimezoneValue)
|
250
|
+
|
251
|
+
if (hideOnSelect) {
|
252
|
+
focus()
|
253
|
+
hideCalendar()
|
254
|
+
}
|
255
|
+
}
|
256
|
+
|
257
|
+
const handleInputKeydown = (event: KeyboardEvent<HTMLInputElement>) => {
|
258
|
+
const key = event.key
|
259
|
+
|
260
|
+
if (key === 'Escape') {
|
261
|
+
hideCalendar()
|
262
|
+
event.currentTarget.blur()
|
263
|
+
|
264
|
+
return
|
265
|
+
}
|
266
|
+
|
267
|
+
if (key === 'Enter') {
|
268
|
+
if (!calendarIsShown) {
|
269
|
+
showCalendar()
|
270
|
+
} else {
|
271
|
+
hideCalendar()
|
272
|
+
}
|
273
|
+
|
274
|
+
return
|
275
|
+
}
|
276
|
+
|
277
|
+
if (key === 'Tab' && calendarIsShown) {
|
278
|
+
event.preventDefault()
|
279
|
+
event.stopPropagation()
|
280
|
+
|
281
|
+
if (!calendarIsShown) {
|
282
|
+
event.currentTarget.blur()
|
283
|
+
} else {
|
284
|
+
// TODO: Manage this whole logic inside simple-react-calendar
|
285
|
+
const firstButton = calendarRef.current?.querySelector<HTMLButtonElement>(
|
286
|
+
'button:not([tabindex="-1"])'
|
287
|
+
)
|
288
|
+
|
289
|
+
if (firstButton) {
|
290
|
+
firstButton.focus()
|
291
|
+
}
|
292
|
+
}
|
293
|
+
}
|
294
|
+
}
|
295
|
+
|
296
|
+
const handleFocusOrClick = () => {
|
297
|
+
showCalendar()
|
298
|
+
setIsInputFocused(true)
|
299
|
+
}
|
300
|
+
|
301
|
+
const startAdornment =
|
302
|
+
size !== 'small' ? (
|
303
|
+
<InputAdornment position='start' disablePointerEvents>
|
304
|
+
{icon || <Calendar16 />}
|
305
|
+
</InputAdornment>
|
306
|
+
) : undefined
|
307
|
+
|
308
|
+
return (
|
309
|
+
<>
|
310
|
+
<Container inline={width !== 'full'} ref={inputWrapperRef}>
|
311
|
+
<Input
|
312
|
+
{...inputProps}
|
313
|
+
ref={inputRef}
|
314
|
+
onKeyDown={handleInputKeydown}
|
315
|
+
onClick={handleFocusOrClick}
|
316
|
+
onFocus={handleFocusOrClick}
|
317
|
+
onBlur={handleBlur}
|
318
|
+
value={inputValue}
|
319
|
+
onChange={handleInputChange}
|
320
|
+
size={size}
|
321
|
+
startAdornment={startAdornment}
|
322
|
+
width={width}
|
323
|
+
/>
|
324
|
+
</Container>
|
325
|
+
{inputWrapperRef.current && (
|
326
|
+
<Popper
|
327
|
+
placement='bottom-start'
|
328
|
+
open={calendarIsShown}
|
329
|
+
anchorEl={inputWrapperRef.current}
|
330
|
+
autoWidth={false}
|
331
|
+
enableCompactMode
|
332
|
+
container={popperContainer}
|
333
|
+
ref={popperRef}
|
334
|
+
>
|
335
|
+
<Calendar
|
336
|
+
data-testid='calendar'
|
337
|
+
ref={calendarRef}
|
338
|
+
range={range}
|
339
|
+
value={calendarValue ?? undefined}
|
340
|
+
minDate={minDate}
|
341
|
+
maxDate={maxDate}
|
342
|
+
disabledIntervals={disabledIntervals}
|
343
|
+
renderDay={renderDay}
|
344
|
+
onChange={handleCalendarChange}
|
345
|
+
onBlur={handleBlur}
|
346
|
+
className={classes.calendar}
|
347
|
+
weekStartsOn={weekStartsOn}
|
348
|
+
/>
|
349
|
+
</Popper>
|
350
|
+
)}
|
351
|
+
</>
|
352
|
+
)
|
353
|
+
}
|
354
|
+
|
355
|
+
DatePicker.defaultProps = {
|
356
|
+
range: false,
|
357
|
+
hideOnSelect: true,
|
358
|
+
onBlur: noop,
|
359
|
+
editDateFormat: 'MM-dd-yyyy',
|
360
|
+
displayDateFormat: 'MMM d, yyyy',
|
361
|
+
autoComplete: 'off'
|
362
|
+
}
|
363
|
+
|
364
|
+
DatePicker.displayName = 'DatePicker'
|
365
|
+
|
366
|
+
export default DatePicker
|
Binary file
|
@@ -0,0 +1,51 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`DatePicker renders 1`] = `
|
4
|
+
<div>
|
5
|
+
<div
|
6
|
+
class="Picasso-root"
|
7
|
+
>
|
8
|
+
<div
|
9
|
+
class="PicassoContainer-inline"
|
10
|
+
>
|
11
|
+
<div
|
12
|
+
class="MuiInputBase-root MuiOutlinedInput-root PicassoOutlinedInput-root PicassoInput-root PicassoOutlinedInput-rootAuto PicassoOutlinedInput-rootMedium MuiInputBase-adornedStart MuiOutlinedInput-adornedStart MuiInputBase-adornedEnd MuiOutlinedInput-adornedEnd"
|
13
|
+
>
|
14
|
+
<div
|
15
|
+
class="MuiInputAdornment-root PicassoInputAdornment-root MuiInputAdornment-disablePointerEvents MuiInputAdornment-positionStart"
|
16
|
+
>
|
17
|
+
<svg
|
18
|
+
class="PicassoSvgCalendar16-root"
|
19
|
+
style="min-width: 16px; min-height: 16px;"
|
20
|
+
viewBox="0 0 16 16"
|
21
|
+
>
|
22
|
+
<path
|
23
|
+
d="M3 2V1h1v1h8V1h1v1h3v13H0V2h3zm0 1H1v2h14V3h-2v1h-1V3H4v1H3V3zm12 3H1v8h14V6z"
|
24
|
+
/>
|
25
|
+
</svg>
|
26
|
+
</div>
|
27
|
+
<input
|
28
|
+
autocomplete="off"
|
29
|
+
class="MuiInputBase-input MuiOutlinedInput-input PicassoOutlinedInput-input PicassoOutlinedInput-inputMedium MuiInputBase-inputAdornedStart MuiOutlinedInput-inputAdornedStart MuiInputBase-inputAdornedEnd MuiOutlinedInput-inputAdornedEnd"
|
30
|
+
type="text"
|
31
|
+
value="Dec 12, 2019"
|
32
|
+
/>
|
33
|
+
<fieldset
|
34
|
+
aria-hidden="true"
|
35
|
+
class="PrivateNotchedOutline-root MuiOutlinedInput-notchedOutline PicassoOutlinedInput-notchedOutline"
|
36
|
+
style="padding-left: 8px;"
|
37
|
+
>
|
38
|
+
<legend
|
39
|
+
class="PrivateNotchedOutline-legend"
|
40
|
+
style="width: 0.01px;"
|
41
|
+
>
|
42
|
+
<span>
|
43
|
+
|
44
|
+
</span>
|
45
|
+
</legend>
|
46
|
+
</fieldset>
|
47
|
+
</div>
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
`;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export { default } from './DatePicker'
|
2
|
+
export type { Props as DatePickerProps } from './DatePicker'
|
3
|
+
export type { DatePickerValue, DatePickerStringParser } from './types'
|
4
|
+
export { datePickerParseDateString } from './utils'
|
5
|
+
export { DEFAULT_DATE_PICKER_EDIT_DATE_FORMAT, DEFAULT_DATE_PICKER_DISPLAY_DATE_FORMAT } from './constants'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import {
|
2
|
+
DatePicker,
|
3
|
+
DatePickerValue,
|
4
|
+
DEFAULT_DATE_PICKER_EDIT_DATE_FORMAT,
|
5
|
+
datePickerParseDateString
|
6
|
+
} from '@toptal/picasso-lab'
|
7
|
+
import React, { useState } from 'react'
|
8
|
+
|
9
|
+
const AllowCustomValue = () => {
|
10
|
+
const [datepickerValue, setDatepickerValue] = useState<DatePickerValue>(
|
11
|
+
'some custom value'
|
12
|
+
)
|
13
|
+
|
14
|
+
const parseInputValue = (value: string) => {
|
15
|
+
const result = datePickerParseDateString(value, {
|
16
|
+
dateFormat: DEFAULT_DATE_PICKER_EDIT_DATE_FORMAT
|
17
|
+
})
|
18
|
+
|
19
|
+
return result ?? value
|
20
|
+
}
|
21
|
+
|
22
|
+
return (
|
23
|
+
<div style={{ height: '50vh' }}>
|
24
|
+
<DatePicker
|
25
|
+
value={datepickerValue}
|
26
|
+
parseInputValue={parseInputValue}
|
27
|
+
onChange={setDatepickerValue}
|
28
|
+
/>
|
29
|
+
</div>
|
30
|
+
)
|
31
|
+
}
|
32
|
+
|
33
|
+
export default AllowCustomValue
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import React, { useState, FormEvent } from 'react'
|
2
|
+
import { DatePicker } from '@toptal/picasso-lab'
|
3
|
+
import { Form, Button, Container } from '@toptal/picasso'
|
4
|
+
|
5
|
+
const AutocompleteExample = () => {
|
6
|
+
const [datepickerValue, setDatepickerValue] = useState<Date>()
|
7
|
+
|
8
|
+
return (
|
9
|
+
<div style={{ height: '50vh' }}>
|
10
|
+
<Form
|
11
|
+
onSubmit={(e: FormEvent<HTMLFormElement>) => {
|
12
|
+
e.preventDefault()
|
13
|
+
}}
|
14
|
+
>
|
15
|
+
<Form.Field>
|
16
|
+
<Form.Label>Disabled by default</Form.Label>
|
17
|
+
<DatePicker
|
18
|
+
name='date'
|
19
|
+
value={datepickerValue}
|
20
|
+
onChange={date => {
|
21
|
+
setDatepickerValue(date as Date)
|
22
|
+
}}
|
23
|
+
/>
|
24
|
+
</Form.Field>
|
25
|
+
<Form.Field>
|
26
|
+
<Form.Label>Enabled</Form.Label>
|
27
|
+
<DatePicker
|
28
|
+
name='cc-exp'
|
29
|
+
value={datepickerValue}
|
30
|
+
autoComplete='cc-exp'
|
31
|
+
onChange={date => {
|
32
|
+
setDatepickerValue(date as Date)
|
33
|
+
}}
|
34
|
+
/>
|
35
|
+
</Form.Field>
|
36
|
+
|
37
|
+
<Container top='small'>
|
38
|
+
<Button type='submit'>
|
39
|
+
Submit to include value to the browser autocomplete
|
40
|
+
</Button>
|
41
|
+
</Container>
|
42
|
+
</Form>
|
43
|
+
</div>
|
44
|
+
)
|
45
|
+
}
|
46
|
+
|
47
|
+
export default AutocompleteExample
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { DatePicker } from '@toptal/picasso-lab'
|
3
|
+
|
4
|
+
const DefaultExample = () => {
|
5
|
+
const [datepickerValue, setDatepickerValue] = useState<Date>()
|
6
|
+
|
7
|
+
return (
|
8
|
+
<div style={{ height: '50vh' }}>
|
9
|
+
<DatePicker
|
10
|
+
value={datepickerValue}
|
11
|
+
onChange={date => {
|
12
|
+
setDatepickerValue(date as Date)
|
13
|
+
}}
|
14
|
+
/>
|
15
|
+
</div>
|
16
|
+
)
|
17
|
+
}
|
18
|
+
|
19
|
+
export default DefaultExample
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Form } from '@toptal/picasso'
|
3
|
+
import { DatePicker } from '@toptal/picasso-lab'
|
4
|
+
|
5
|
+
const DefaultExample = () => {
|
6
|
+
const [datepickerValue, setDatepickerValue] = useState<Date>()
|
7
|
+
|
8
|
+
return (
|
9
|
+
<div style={{ height: '50vh' }}>
|
10
|
+
<Form>
|
11
|
+
<Form.Field>
|
12
|
+
<Form.Label>Failed validation</Form.Label>
|
13
|
+
<DatePicker
|
14
|
+
value={datepickerValue}
|
15
|
+
error
|
16
|
+
onChange={date => {
|
17
|
+
setDatepickerValue(date as Date)
|
18
|
+
}}
|
19
|
+
/>
|
20
|
+
</Form.Field>
|
21
|
+
</Form>
|
22
|
+
</div>
|
23
|
+
)
|
24
|
+
}
|
25
|
+
|
26
|
+
export default DefaultExample
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { DatePicker } from '@toptal/picasso-lab'
|
3
|
+
|
4
|
+
const RangeExample = () => {
|
5
|
+
const [value, setValue] = useState<[Date, Date]>()
|
6
|
+
|
7
|
+
return (
|
8
|
+
<div style={{ height: '50vh' }}>
|
9
|
+
<DatePicker
|
10
|
+
range
|
11
|
+
value={value}
|
12
|
+
onChange={dates => {
|
13
|
+
const [start, end] = dates as [Date, Date]
|
14
|
+
|
15
|
+
setValue([start, end])
|
16
|
+
}}
|
17
|
+
/>
|
18
|
+
</div>
|
19
|
+
)
|
20
|
+
}
|
21
|
+
|
22
|
+
export default RangeExample
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Tooltip } from '@toptal/picasso'
|
3
|
+
import { DatePicker } from '@toptal/picasso-lab'
|
4
|
+
import { isBefore, isWithinInterval } from 'date-fns'
|
5
|
+
|
6
|
+
const WithCustomDayRendering = () => {
|
7
|
+
const [datepickerValue, setDatepickerValue] = useState(new Date('2015-12-12'))
|
8
|
+
|
9
|
+
const minDate = new Date('2015-12-07')
|
10
|
+
|
11
|
+
const disabledIntervals = [
|
12
|
+
{ start: new Date('2015-12-20'), end: new Date('2015-12-30') }
|
13
|
+
]
|
14
|
+
|
15
|
+
return (
|
16
|
+
<div style={{ height: '50vh' }}>
|
17
|
+
<DatePicker
|
18
|
+
value={datepickerValue}
|
19
|
+
minDate={minDate}
|
20
|
+
disabledIntervals={disabledIntervals}
|
21
|
+
renderDay={({ date, children, isSelectable }) => {
|
22
|
+
const day = new Date(date)
|
23
|
+
|
24
|
+
if (!isSelectable) {
|
25
|
+
if (isBefore(day, minDate)) {
|
26
|
+
return <Tooltip content='It is vacation time'>{children}</Tooltip>
|
27
|
+
}
|
28
|
+
const isWithinDisabledInterval = disabledIntervals.some(interval =>
|
29
|
+
isWithinInterval(day, interval)
|
30
|
+
)
|
31
|
+
|
32
|
+
if (isWithinDisabledInterval) {
|
33
|
+
return <Tooltip content='In a meeting'>{children}</Tooltip>
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
return children
|
38
|
+
}}
|
39
|
+
onChange={date => {
|
40
|
+
setDatepickerValue(date as Date)
|
41
|
+
}}
|
42
|
+
/>
|
43
|
+
</div>
|
44
|
+
)
|
45
|
+
}
|
46
|
+
|
47
|
+
export default WithCustomDayRendering
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { DatePicker } from '@toptal/picasso-lab'
|
3
|
+
|
4
|
+
const WithInitialValueExample = () => {
|
5
|
+
const [datepickerValue, setDatepickerValue] = useState(new Date(2019, 10, 10))
|
6
|
+
|
7
|
+
return (
|
8
|
+
<div style={{ height: '50vh' }}>
|
9
|
+
<DatePicker
|
10
|
+
value={datepickerValue}
|
11
|
+
onChange={date => {
|
12
|
+
setDatepickerValue(date as Date)
|
13
|
+
}}
|
14
|
+
/>
|
15
|
+
</div>
|
16
|
+
)
|
17
|
+
}
|
18
|
+
|
19
|
+
export default WithInitialValueExample
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { DatePicker } from '@toptal/picasso-lab'
|
3
|
+
import { Search16 } from '@toptal/picasso'
|
4
|
+
|
5
|
+
const WithInputPropsExample = () => {
|
6
|
+
const [value, setValue] = useState<Date>()
|
7
|
+
|
8
|
+
return (
|
9
|
+
<div style={{ height: '50vh', width: '100%' }}>
|
10
|
+
<DatePicker
|
11
|
+
value={value}
|
12
|
+
icon={<Search16 />}
|
13
|
+
iconPosition='end'
|
14
|
+
width='full'
|
15
|
+
placeholder='Please select date...'
|
16
|
+
onChange={date => {
|
17
|
+
setValue(date as Date)
|
18
|
+
}}
|
19
|
+
/>
|
20
|
+
</div>
|
21
|
+
)
|
22
|
+
}
|
23
|
+
|
24
|
+
export default WithInputPropsExample
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { DatePicker, DatePickerValue } from '@toptal/picasso-lab'
|
3
|
+
|
4
|
+
const WithNoHideOnSelect = () => {
|
5
|
+
const [datepickerValue, setDatepickerValue] = useState<DatePickerValue>()
|
6
|
+
|
7
|
+
return (
|
8
|
+
<div style={{ height: '50vh' }}>
|
9
|
+
<DatePicker
|
10
|
+
value={datepickerValue}
|
11
|
+
hideOnSelect={false}
|
12
|
+
onChange={(date: DatePickerValue) => {
|
13
|
+
setDatepickerValue(date)
|
14
|
+
}}
|
15
|
+
/>
|
16
|
+
</div>
|
17
|
+
)
|
18
|
+
}
|
19
|
+
|
20
|
+
export default WithNoHideOnSelect
|