@fibery/ui-kit 1.35.0 → 1.36.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/.eslintignore +3 -0
- package/.eslintrc +14 -0
- package/CHANGELOG.md +586 -0
- package/babel.config.js +3 -0
- package/config/jest/testFrameworkSetup.js +1 -0
- package/package.json +6 -40
- package/scripts/generate-icons.mjs +116 -0
- package/src/__mocks__/createInlineTheme.js +3 -0
- package/src/__mocks__/styleMock.js +1 -0
- package/src/a11y-color.ts +1 -1
- package/src/action-badge.tsx +63 -0
- package/src/actions-panel.tsx +50 -0
- package/src/ai/max-tokens.tsx +42 -0
- package/src/ai/model.tsx +79 -0
- package/src/ai/temperature.tsx +75 -0
- package/src/animated-height-container.tsx +82 -0
- package/src/animated-number.tsx +38 -0
- package/src/animations.tsx +62 -0
- package/src/antd/AutoComplete.d.ts +1 -0
- package/src/antd/AutoComplete.js +34 -0
- package/src/antd/Tabs.d.ts +5 -0
- package/src/antd/Tabs.js +58 -0
- package/src/antd/ant-modal.tsx +11 -0
- package/src/antd/ant-upload.tsx +73 -0
- package/src/antd/auto-width-transparent-textarea.tsx +56 -0
- package/src/antd/get-wrapper.tsx +11 -0
- package/src/antd/index.tsx +4 -0
- package/src/antd/input-number.tsx +51 -0
- package/src/antd/input.tsx +56 -0
- package/src/antd/utils.tsx +43 -0
- package/src/app-icon-with-fallback.tsx +147 -0
- package/src/app-icon-wrapper.tsx +44 -0
- package/src/app-icon.tsx +52 -0
- package/src/app-mode.tsx +52 -0
- package/src/appIcons.json +13066 -0
- package/src/avatar.tsx +262 -0
- package/src/axis-header.tsx +160 -0
- package/src/badge.tsx +39 -0
- package/src/board-table-loader.tsx +106 -0
- package/src/box.tsx +444 -0
- package/src/breakpoints.tsx +59 -0
- package/src/card-container.tsx +483 -0
- package/src/checkbox-multi-select.tsx +71 -0
- package/src/checkbox.tsx +232 -0
- package/src/collapsible/index.tsx +43 -0
- package/src/collapsible-section.tsx +69 -0
- package/src/color-picker/ColorPickerOrLoader.js +23 -0
- package/src/color-picker/SliderPointer.js +14 -0
- package/src/color-picker/index.js +118 -0
- package/src/color-picker/swatch.tsx +85 -0
- package/src/command-menu/index.tsx +176 -0
- package/src/comment.tsx +218 -0
- package/src/context-menu/index.tsx +134 -0
- package/src/copy-to-clipboard.ts +1 -0
- package/src/country-selector.tsx +29 -0
- package/src/date-picker/autocomplete.tsx +74 -0
- package/src/date-picker/constants.ts +3 -0
- package/src/date-picker/contexts.ts +7 -0
- package/src/date-picker/date-range-input.tsx +346 -0
- package/src/date-picker/date-range-picker-popup-content.tsx +190 -0
- package/src/date-picker/date-range-picker.tsx +124 -0
- package/src/date-picker/day-with-start-end-buttons.tsx +171 -0
- package/src/date-picker/fake-date-input.tsx +40 -0
- package/src/date-picker/get-weekends-for-month.ts +7 -0
- package/src/date-picker/rc-input-types.ts +11 -0
- package/src/date-picker/relative-date-picker.tsx +141 -0
- package/src/date-picker/single-date-input.tsx +239 -0
- package/src/date-picker/single-date-picker-popup-content.tsx +90 -0
- package/src/date-picker/single-date-picker.tsx +243 -0
- package/src/date-picker/styles.ts +262 -0
- package/src/date-picker/types.ts +56 -0
- package/src/date-picker/utils.ts +110 -0
- package/src/date-picker/with-popup-control.tsx +61 -0
- package/src/day-select/day-select.tsx +94 -0
- package/src/day-select/iso-week-day-select.tsx +15 -0
- package/src/day-select/mount-day-select.tsx +11 -0
- package/src/day-select/week-day-select.test.tsx +48 -0
- package/src/day-select/week-day-select.tsx +42 -0
- package/src/delayed.tsx +26 -0
- package/src/design-system.test.ts +24 -0
- package/src/design-system.ts +23 -9
- package/src/dnd.tsx +55 -0
- package/src/emoji.tsx +30 -0
- package/src/empty-state/empty-state-action.tsx +3 -0
- package/src/empty-state/empty-state-emoji.tsx +20 -0
- package/src/empty-state/empty-state.tsx +80 -0
- package/src/empty-value.tsx +21 -0
- package/src/errors.ts +29 -0
- package/src/favorites-icon.tsx +87 -0
- package/src/features.tsx +10 -0
- package/src/fibermoji-placeholder.tsx +180 -0
- package/src/field-container.tsx +213 -0
- package/src/file-item.tsx +151 -0
- package/src/form-utils.ts +7 -0
- package/src/format-date-from-now.ts +33 -0
- package/src/full-fibery-logo.tsx +26 -0
- package/src/get-trigger-node-popup-container.ts +7 -0
- package/src/guide-link.tsx +24 -0
- package/src/header-layout.tsx +33 -0
- package/src/hint.tsx +47 -0
- package/src/hoverable-via-display.tsx +29 -0
- package/src/hoverable.tsx +53 -0
- package/src/html-styles.ts +720 -0
- package/src/icons/ast/AccessTemplate.ts +8 -0
- package/src/icons/ast/Asterisk.ts +8 -0
- package/src/icons/ast/Copy.ts +1 -1
- package/src/icons/ast/CrossCircle.ts +8 -0
- package/src/icons/ast/Duplicate.ts +1 -1
- package/src/icons/ast/Gift.ts +1 -1
- package/src/icons/ast/LevelPlus.ts +8 -0
- package/src/icons/ast/ResetPassword.ts +8 -0
- package/src/icons/ast/ViewGantt.ts +8 -0
- package/src/icons/ast/index.tsx +6 -0
- package/src/icons/react/AccessTemplate.tsx +13 -0
- package/src/icons/react/Asterisk.tsx +13 -0
- package/src/icons/react/CrossCircle.tsx +13 -0
- package/src/icons/react/LevelPlus.tsx +13 -0
- package/src/icons/react/ResetPassword.tsx +13 -0
- package/src/icons/react/ViewGantt.tsx +13 -0
- package/src/icons/react/index.tsx +6 -0
- package/src/icons/svg/abort.svg +3 -0
- package/src/icons/svg/access-template.svg +4 -0
- package/src/icons/svg/activity-log.svg +4 -0
- package/src/icons/svg/activity.svg +4 -0
- package/src/icons/svg/add-after.svg +4 -0
- package/src/icons/svg/add-before.svg +4 -0
- package/src/icons/svg/add-compact.svg +2 -0
- package/src/icons/svg/add-database.svg +3 -0
- package/src/icons/svg/add-group.svg +4 -0
- package/src/icons/svg/add-integration.svg +3 -0
- package/src/icons/svg/add-reactions.svg +8 -0
- package/src/icons/svg/add.svg +2 -0
- package/src/icons/svg/ai-assistant.svg +3 -0
- package/src/icons/svg/ai-avatar.svg +3 -0
- package/src/icons/svg/ai-search.svg +3 -0
- package/src/icons/svg/alert-triangle.svg +3 -0
- package/src/icons/svg/app-details.svg +7 -0
- package/src/icons/svg/app-store-one-color.svg +4 -0
- package/src/icons/svg/app-store.svg +4 -0
- package/src/icons/svg/app-templates.svg +7 -0
- package/src/icons/svg/app-webhooks.svg +2 -0
- package/src/icons/svg/app-wiki.svg +2 -0
- package/src/icons/svg/app.svg +2 -0
- package/src/icons/svg/appearance-auto.svg +3 -0
- package/src/icons/svg/appearance-dark.svg +3 -0
- package/src/icons/svg/appearance-light.svg +3 -0
- package/src/icons/svg/arrow-bar-left.svg +4 -0
- package/src/icons/svg/arrow-bar-right.svg +4 -0
- package/src/icons/svg/arrow-bottom.svg +3 -0
- package/src/icons/svg/arrow-collapse-vertical.svg +3 -0
- package/src/icons/svg/arrow-collapse.svg +3 -0
- package/src/icons/svg/arrow-forward.svg +3 -0
- package/src/icons/svg/arrow-left.svg +3 -0
- package/src/icons/svg/arrow-right.svg +3 -0
- package/src/icons/svg/arrow-top.svg +3 -0
- package/src/icons/svg/arrow-up-circle.svg +4 -0
- package/src/icons/svg/arrows-right-left.svg +3 -0
- package/src/icons/svg/ask-for-input.svg +6 -0
- package/src/icons/svg/asterisk.svg +3 -0
- package/src/icons/svg/atom.svg +4 -0
- package/src/icons/svg/automations-cancelled.svg +3 -0
- package/src/icons/svg/automations-disabled.svg +3 -0
- package/src/icons/svg/automations-error.svg +3 -0
- package/src/icons/svg/automations-in-progress.svg +3 -0
- package/src/icons/svg/automations-not-started.svg +3 -0
- package/src/icons/svg/automations-success.svg +3 -0
- package/src/icons/svg/back.svg +2 -0
- package/src/icons/svg/backlog-icon.svg +3 -0
- package/src/icons/svg/batch-actions-icon.svg +4 -0
- package/src/icons/svg/bell-circle.svg +4 -0
- package/src/icons/svg/bell-filled.svg +4 -0
- package/src/icons/svg/bell-off.svg +4 -0
- package/src/icons/svg/bell-ringing.svg +5 -0
- package/src/icons/svg/bell-x.svg +4 -0
- package/src/icons/svg/bolt.svg +3 -0
- package/src/icons/svg/bring-forward.svg +8 -0
- package/src/icons/svg/bring-to-front.svg +3 -0
- package/src/icons/svg/cards.svg +3 -0
- package/src/icons/svg/chat-ai.svg +5 -0
- package/src/icons/svg/chat.svg +3 -0
- package/src/icons/svg/check-circle-filled.svg +3 -0
- package/src/icons/svg/check-circle.svg +4 -0
- package/src/icons/svg/checked.svg +3 -0
- package/src/icons/svg/clean.svg +6 -0
- package/src/icons/svg/clear-input-filled.svg +3 -0
- package/src/icons/svg/clear-value.svg +6 -0
- package/src/icons/svg/clear.svg +6 -0
- package/src/icons/svg/clock-alarm.svg +6 -0
- package/src/icons/svg/clock-forward.svg +3 -0
- package/src/icons/svg/clock.svg +4 -0
- package/src/icons/svg/close.svg +4 -0
- package/src/icons/svg/collapse-all.svg +3 -0
- package/src/icons/svg/color-coding-filled.svg +3 -0
- package/src/icons/svg/color-coding.svg +4 -0
- package/src/icons/svg/columns-2.svg +3 -0
- package/src/icons/svg/columns-4.svg +3 -0
- package/src/icons/svg/columns.svg +3 -0
- package/src/icons/svg/comment-bubble.svg +3 -0
- package/src/icons/svg/copy.svg +5 -0
- package/src/icons/svg/create.svg +3 -0
- package/src/icons/svg/credits-filled.svg +3 -0
- package/src/icons/svg/cross-circle.svg +4 -0
- package/src/icons/svg/database-off.svg +3 -0
- package/src/icons/svg/database-stroke.svg +4 -0
- package/src/icons/svg/database.svg +4 -0
- package/src/icons/svg/delete.svg +6 -0
- package/src/icons/svg/demo.svg +2 -0
- package/src/icons/svg/dependency.svg +3 -0
- package/src/icons/svg/double-arrow-left.svg +2 -0
- package/src/icons/svg/double-arrow-right.svg +2 -0
- package/src/icons/svg/drag-block-handle-single.svg +5 -0
- package/src/icons/svg/drag-block-handle.svg +8 -0
- package/src/icons/svg/drag-handle.svg +2 -0
- package/src/icons/svg/duplicate.svg +5 -0
- package/src/icons/svg/dynamic-filter-value.svg +3 -0
- package/src/icons/svg/edit-value.svg +5 -0
- package/src/icons/svg/email.svg +3 -0
- package/src/icons/svg/emoji-delete.svg +5 -0
- package/src/icons/svg/entity-merge.svg +3 -0
- package/src/icons/svg/equation.svg +4 -0
- package/src/icons/svg/export.svg +4 -0
- package/src/icons/svg/extension/assignments.svg +7 -0
- package/src/icons/svg/extension/avatar.svg +2 -0
- package/src/icons/svg/extension/comments.svg +5 -0
- package/src/icons/svg/extension/files.svg +2 -0
- package/src/icons/svg/extension/references.svg +2 -0
- package/src/icons/svg/extension/workflow.svg +2 -0
- package/src/icons/svg/eye.svg +4 -0
- package/src/icons/svg/favorites-checked.svg +4 -0
- package/src/icons/svg/favorites-off.svg +4 -0
- package/src/icons/svg/favorites.svg +4 -0
- package/src/icons/svg/fibery-mono.svg +3 -0
- package/src/icons/svg/field-unit.svg +3 -0
- package/src/icons/svg/fields.svg +4 -0
- package/src/icons/svg/figma.svg +7 -0
- package/src/icons/svg/file-upload.svg +7 -0
- package/src/icons/svg/filter.svg +3 -0
- package/src/icons/svg/fit-to-screen.svg +5 -0
- package/src/icons/svg/focus-mode-off.svg +5 -0
- package/src/icons/svg/focus-mode.svg +5 -0
- package/src/icons/svg/folder.svg +4 -0
- package/src/icons/svg/form-with-cover.svg +7 -0
- package/src/icons/svg/form-without-cover.svg +6 -0
- package/src/icons/svg/fullscreen-mode-off-icon.svg +3 -0
- package/src/icons/svg/fullscreen-mode-on-icon.svg +3 -0
- package/src/icons/svg/fullscreen-mode-on.svg +4 -0
- package/src/icons/svg/gift.svg +3 -0
- package/src/icons/svg/github.svg +1 -0
- package/src/icons/svg/gitlab.svg +3 -0
- package/src/icons/svg/globe-simple.svg +3 -0
- package/src/icons/svg/globe.svg +3 -0
- package/src/icons/svg/go-to.svg +5 -0
- package/src/icons/svg/google-drive.svg +8 -0
- package/src/icons/svg/google-map.svg +7 -0
- package/src/icons/svg/headphones-ai.svg +4 -0
- package/src/icons/svg/headphones.svg +3 -0
- package/src/icons/svg/hide.svg +2 -0
- package/src/icons/svg/highlights.svg +3 -0
- package/src/icons/svg/hint.svg +4 -0
- package/src/icons/svg/home.svg +2 -0
- package/src/icons/svg/image-xmark.svg +2 -0
- package/src/icons/svg/import.svg +4 -0
- package/src/icons/svg/info-circle-filled.svg +3 -0
- package/src/icons/svg/info-circle.svg +6 -0
- package/src/icons/svg/integration.svg +2 -0
- package/src/icons/svg/integrations/integration-discourse-color.svg +8 -0
- package/src/icons/svg/integrations/integration-intercom-color.svg +3 -0
- package/src/icons/svg/integrations/integration-slack-color.svg +10 -0
- package/src/icons/svg/integrations/integration-zendesk-color.svg +6 -0
- package/src/icons/svg/invite-people.svg +6 -0
- package/src/icons/svg/items-timeline.svg +4 -0
- package/src/icons/svg/items.svg +3 -0
- package/src/icons/svg/jira.svg +3 -0
- package/src/icons/svg/key.svg +4 -0
- package/src/icons/svg/lab.svg +6 -0
- package/src/icons/svg/layout-double.svg +3 -0
- package/src/icons/svg/layout-single.svg +3 -0
- package/src/icons/svg/left-panel.svg +11 -0
- package/src/icons/svg/level-plus.svg +4 -0
- package/src/icons/svg/levels.svg +2 -0
- package/src/icons/svg/line-divider.svg +3 -0
- package/src/icons/svg/link.svg +6 -0
- package/src/icons/svg/lock-outline.svg +5 -0
- package/src/icons/svg/lock.svg +4 -0
- package/src/icons/svg/logout.svg +4 -0
- package/src/icons/svg/loom.svg +3 -0
- package/src/icons/svg/loupe-zoom-in.svg +3 -0
- package/src/icons/svg/loupe-zoom-out.svg +1 -0
- package/src/icons/svg/loupe-zoom.svg +3 -0
- package/src/icons/svg/many-people.svg +4 -0
- package/src/icons/svg/map-mode.svg +6 -0
- package/src/icons/svg/markdown.svg +3 -0
- package/src/icons/svg/menu-collapser.svg +2 -0
- package/src/icons/svg/message-plus-square.svg +4 -0
- package/src/icons/svg/milestones.svg +3 -0
- package/src/icons/svg/minus.svg +4 -0
- package/src/icons/svg/miro.svg +4 -0
- package/src/icons/svg/mirror-off.svg +8 -0
- package/src/icons/svg/mirror-on.svg +3 -0
- package/src/icons/svg/mixpanel.svg +3 -0
- package/src/icons/svg/monitor.svg +3 -0
- package/src/icons/svg/more-compact.svg +4 -0
- package/src/icons/svg/more.svg +4 -0
- package/src/icons/svg/move-bottom.svg +3 -0
- package/src/icons/svg/move-left.svg +3 -0
- package/src/icons/svg/move-right.svg +3 -0
- package/src/icons/svg/move-space.svg +5 -0
- package/src/icons/svg/move-top.svg +3 -0
- package/src/icons/svg/network-add.svg +5 -0
- package/src/icons/svg/network.svg +4 -0
- package/src/icons/svg/notifications.svg +2 -0
- package/src/icons/svg/obj-child.svg +2 -0
- package/src/icons/svg/obj-m2m.svg +2 -0
- package/src/icons/svg/obj-o2o.svg +2 -0
- package/src/icons/svg/obj-parent.svg +2 -0
- package/src/icons/svg/obj-self.svg +2 -0
- package/src/icons/svg/on-schedule.svg +3 -0
- package/src/icons/svg/open-as-page.svg +4 -0
- package/src/icons/svg/page-regular-mode.svg +5 -0
- package/src/icons/svg/page-wide-mode.svg +5 -0
- package/src/icons/svg/panel-add.svg +3 -0
- package/src/icons/svg/pencil.svg +5 -0
- package/src/icons/svg/people-check.svg +4 -0
- package/src/icons/svg/people.svg +7 -0
- package/src/icons/svg/photo.svg +2 -0
- package/src/icons/svg/pin-filled.svg +5 -0
- package/src/icons/svg/pin.svg +3 -0
- package/src/icons/svg/popup.svg +5 -0
- package/src/icons/svg/posts.svg +3 -0
- package/src/icons/svg/present-play.svg +4 -0
- package/src/icons/svg/present-stop.svg +3 -0
- package/src/icons/svg/private-items.svg +5 -0
- package/src/icons/svg/question.svg +4 -0
- package/src/icons/svg/refresh.svg +4 -0
- package/src/icons/svg/remove-people.svg +6 -0
- package/src/icons/svg/remove.svg +2 -0
- package/src/icons/svg/reply.svg +2 -0
- package/src/icons/svg/reset-password.svg +6 -0
- package/src/icons/svg/restore.svg +2 -0
- package/src/icons/svg/richeditor/actions/more.svg +2 -0
- package/src/icons/svg/richeditor/block/callout.svg +4 -0
- package/src/icons/svg/richeditor/block/code.svg +7 -0
- package/src/icons/svg/richeditor/block/embed.svg +4 -0
- package/src/icons/svg/richeditor/block/entity.svg +2 -0
- package/src/icons/svg/richeditor/block/file.svg +1 -0
- package/src/icons/svg/richeditor/block/h1.svg +2 -0
- package/src/icons/svg/richeditor/block/h2.svg +2 -0
- package/src/icons/svg/richeditor/block/h3.svg +2 -0
- package/src/icons/svg/richeditor/block/h4.svg +4 -0
- package/src/icons/svg/richeditor/block/mention.svg +2 -0
- package/src/icons/svg/richeditor/block/paragraph.svg +2 -0
- package/src/icons/svg/richeditor/block/quote.svg +2 -0
- package/src/icons/svg/richeditor/checklist/create.svg +2 -0
- package/src/icons/svg/richeditor/comment/create.svg +5 -0
- package/src/icons/svg/richeditor/entity-link/create.svg +2 -0
- package/src/icons/svg/richeditor/history/redo.svg +2 -0
- package/src/icons/svg/richeditor/history/undo.svg +2 -0
- package/src/icons/svg/richeditor/image/align-center.svg +2 -0
- package/src/icons/svg/richeditor/image/align-left.svg +2 -0
- package/src/icons/svg/richeditor/image/align-right.svg +2 -0
- package/src/icons/svg/richeditor/image/upload.svg +2 -0
- package/src/icons/svg/richeditor/image/wrap-center.svg +2 -0
- package/src/icons/svg/richeditor/image/wrap-left.svg +2 -0
- package/src/icons/svg/richeditor/image/wrap-right.svg +2 -0
- package/src/icons/svg/richeditor/image/zoom.svg +5 -0
- package/src/icons/svg/richeditor/link/create.svg +9 -0
- package/src/icons/svg/richeditor/linkedhighlight/create.svg +2 -0
- package/src/icons/svg/richeditor/list/bullet.svg +2 -0
- package/src/icons/svg/richeditor/list/indent.svg +2 -0
- package/src/icons/svg/richeditor/list/ordered.svg +2 -0
- package/src/icons/svg/richeditor/list/unindent.svg +2 -0
- package/src/icons/svg/richeditor/mark/code.svg +6 -0
- package/src/icons/svg/richeditor/mark/em.svg +2 -0
- package/src/icons/svg/richeditor/mark/strike.svg +2 -0
- package/src/icons/svg/richeditor/mark/strong.svg +2 -0
- package/src/icons/svg/richeditor/mark/text-background-color.svg +2 -0
- package/src/icons/svg/richeditor/mark/underline.svg +2 -0
- package/src/icons/svg/richeditor/open-link.svg +4 -0
- package/src/icons/svg/richeditor/table/create.svg +2 -0
- package/src/icons/svg/richeditor/unlink.svg +10 -0
- package/src/icons/svg/richeditor/video/upload.svg +2 -0
- package/src/icons/svg/right-panel.svg +11 -0
- package/src/icons/svg/rows.svg +3 -0
- package/src/icons/svg/rule-scheduled.svg +5 -0
- package/src/icons/svg/search-add.svg +4 -0
- package/src/icons/svg/search-remove.svg +4 -0
- package/src/icons/svg/search.svg +2 -0
- package/src/icons/svg/self-reference-off.svg +2 -0
- package/src/icons/svg/self-reference-on.svg +2 -0
- package/src/icons/svg/send-arrow.svg +3 -0
- package/src/icons/svg/send-backward.svg +8 -0
- package/src/icons/svg/send-to-back.svg +4 -0
- package/src/icons/svg/settings-off.svg +4 -0
- package/src/icons/svg/settings.svg +4 -0
- package/src/icons/svg/share.svg +5 -0
- package/src/icons/svg/shared.svg +7 -0
- package/src/icons/svg/shield-keyhole.svg +4 -0
- package/src/icons/svg/show-author.svg +5 -0
- package/src/icons/svg/sidebar-fields-opened.svg +3 -0
- package/src/icons/svg/sidebar-fields.svg +6 -0
- package/src/icons/svg/sidebar.svg +2 -0
- package/src/icons/svg/simple-compass.svg +5 -0
- package/src/icons/svg/slack-icon.svg +3 -0
- package/src/icons/svg/slack.svg +10 -0
- package/src/icons/svg/slide-menu-close.svg +4 -0
- package/src/icons/svg/slide-menu-open.svg +4 -0
- package/src/icons/svg/slide-menu.svg +5 -0
- package/src/icons/svg/smart-folder.svg +5 -0
- package/src/icons/svg/sort-on-bottom.svg +4 -0
- package/src/icons/svg/sort-on-top.svg +4 -0
- package/src/icons/svg/sort.svg +3 -0
- package/src/icons/svg/spinner.svg +2 -0
- package/src/icons/svg/success.svg +4 -0
- package/src/icons/svg/template.svg +3 -0
- package/src/icons/svg/templates.svg +4 -0
- package/src/icons/svg/terminal.svg +5 -0
- package/src/icons/svg/text-tool-align-bottom.svg +3 -0
- package/src/icons/svg/text-tool-align-middle.svg +3 -0
- package/src/icons/svg/text-tool-align-top.svg +3 -0
- package/src/icons/svg/twitter.svg +4 -0
- package/src/icons/svg/type/boolean.svg +2 -0
- package/src/icons/svg/type/button.svg +4 -0
- package/src/icons/svg/type/checkbox.svg +2 -0
- package/src/icons/svg/type/date.svg +2 -0
- package/src/icons/svg/type/email.svg +2 -0
- package/src/icons/svg/type/emoji.svg +2 -0
- package/src/icons/svg/type/formula.svg +2 -0
- package/src/icons/svg/type/function.svg +2 -0
- package/src/icons/svg/type/location.svg +4 -0
- package/src/icons/svg/type/lookup.svg +2 -0
- package/src/icons/svg/type/money.svg +2 -0
- package/src/icons/svg/type/multi-select.svg +2 -0
- package/src/icons/svg/type/number.svg +2 -0
- package/src/icons/svg/type/percent.svg +2 -0
- package/src/icons/svg/type/phone.svg +2 -0
- package/src/icons/svg/type/relation.svg +2 -0
- package/src/icons/svg/type/rich-text.svg +2 -0
- package/src/icons/svg/type/rule.svg +2 -0
- package/src/icons/svg/type/single-select.svg +2 -0
- package/src/icons/svg/type/text.svg +2 -0
- package/src/icons/svg/type/url.svg +9 -0
- package/src/icons/svg/units/avatar.svg +5 -0
- package/src/icons/svg/units/collection.svg +5 -0
- package/src/icons/svg/units/counter.svg +5 -0
- package/src/icons/svg/units/date.svg +5 -0
- package/src/icons/svg/units/db-badge-abbr.svg +4 -0
- package/src/icons/svg/units/db-badge-full.svg +4 -0
- package/src/icons/svg/units/db-icon.svg +4 -0
- package/src/icons/svg/units/field-icon-button.svg +5 -0
- package/src/icons/svg/units/field.svg +4 -0
- package/src/icons/svg/units/input.svg +5 -0
- package/src/icons/svg/units/progress-bar.svg +5 -0
- package/src/icons/svg/units/rich-text.svg +4 -0
- package/src/icons/svg/units/snippet.svg +5 -0
- package/src/icons/svg/unlink.svg +10 -0
- package/src/icons/svg/unlock-filled.svg +5 -0
- package/src/icons/svg/unlock-outline.svg +5 -0
- package/src/icons/svg/upgrade.svg +2 -0
- package/src/icons/svg/usb-flash-drive.svg +5 -0
- package/src/icons/svg/user-check.svg +3 -0
- package/src/icons/svg/user-group-remove.svg +5 -0
- package/src/icons/svg/user-group.svg +4 -0
- package/src/icons/svg/user-role.svg +4 -0
- package/src/icons/svg/user-x.svg +5 -0
- package/src/icons/svg/view-ai.svg +3 -0
- package/src/icons/svg/view-board.svg +2 -0
- package/src/icons/svg/view-calendar.svg +2 -0
- package/src/icons/svg/view-canvas.svg +2 -0
- package/src/icons/svg/view-chart.svg +2 -0
- package/src/icons/svg/view-details.svg +2 -0
- package/src/icons/svg/view-document.svg +2 -0
- package/src/icons/svg/view-feed.svg +3 -0
- package/src/icons/svg/view-form.svg +4 -0
- package/src/icons/svg/view-gantt.svg +5 -0
- package/src/icons/svg/view-list.svg +2 -0
- package/src/icons/svg/view-map.svg +3 -0
- package/src/icons/svg/view-page.svg +3 -0
- package/src/icons/svg/view-table.svg +2 -0
- package/src/icons/svg/view-timeline.svg +2 -0
- package/src/icons/svg/views.svg +11 -0
- package/src/icons/svg/warning-triangle.svg +4 -0
- package/src/icons/svg/warning.svg +2 -0
- package/src/icons/svg/workspace-map.svg +3 -0
- package/src/icons/svg/youtube.svg +4 -0
- package/src/icons/svg/zoom-in.svg +7 -0
- package/src/icons/svg/zoom-out.svg +7 -0
- package/src/is-android.ts +3 -0
- package/src/is-iOS.ts +8 -0
- package/src/is-in-popup.ts +15 -0
- package/src/layout.tsx +88 -0
- package/src/link-input/components/AntTextAreaWithCustomReadState.js +64 -0
- package/src/link-input/index.js +89 -0
- package/src/link-input/utils.js +13 -0
- package/src/logo.tsx +81 -0
- package/src/menu-item-actions.tsx +6 -0
- package/src/nested-menu-item.tsx +0 -0
- package/src/new-badge.tsx +16 -0
- package/src/new-card-placeholder.tsx +231 -0
- package/src/not-empty.ts +3 -0
- package/src/notification-dot.tsx +23 -0
- package/src/number-input/decimal.js +59 -0
- package/src/number-input/decimal.test.js +71 -0
- package/src/number-input/edit-unit-styles.ts +18 -0
- package/src/number-input/index.js +191 -0
- package/src/number-input/index.test.js +106 -0
- package/src/number-input/number-inline-input-with-autosize.tsx +156 -0
- package/src/number-input/number-input.tsx +152 -0
- package/src/number-input/stack.tsx +25 -0
- package/src/number-input/step-button.tsx +73 -0
- package/src/number-input/styles.ts +50 -0
- package/src/number-input/text-area-with-autosize.tsx +91 -0
- package/src/number-input/text-inline-input-with-autosize.tsx +60 -0
- package/src/online-users.tsx +238 -0
- package/src/platform.ts +4 -0
- package/src/popup/index.tsx +382 -0
- package/src/popup/modifiers.tsx +70 -0
- package/src/popup/popup-modifiers-context.ts +12 -0
- package/src/popup/popup-stack-context.tsx +44 -0
- package/src/popup/reference.ts +7 -0
- package/src/popup/styles.ts +62 -0
- package/src/popup/use-click-outside.ts +22 -0
- package/src/progress.tsx +14 -0
- package/src/reactions/get-word-divider.tsx +15 -0
- package/src/reactions/reaction-button.tsx +254 -0
- package/src/reactions/reaction-picker.tsx +126 -0
- package/src/reactions/reactions.tsx +30 -0
- package/src/ready-to-scroll-context.tsx +16 -0
- package/src/rich-input-loader.tsx +78 -0
- package/src/rich-text-embed-error.tsx +44 -0
- package/src/select/select-in-popover.tsx +3 -0
- package/src/styles-utils.tsx +16 -0
- package/src/tab-nav/tab-nav.tsx +208 -0
- package/src/table.tsx +91 -0
- package/src/toast/primitives.tsx +6 -7
- package/src/toast/toast-action.tsx +7 -1
- package/src/toast/toast-queue.ts +1 -1
- package/src/toast/toast.tsx +78 -16
- package/src/toast/toaster.tsx +2 -17
- package/src/toast/utils/toastify-item-name.ts +16 -5
- package/src/tooltip.tsx +3 -0
- package/src/type-badge-box.tsx +42 -0
- package/src/type-badge.tsx +315 -0
- package/src/unit/as-string.tsx +1 -0
- package/src/unit/index.tsx +55 -0
- package/src/unit/loading-unit-value.tsx +13 -0
- package/src/unit/maybe-unit-value.tsx +9 -0
- package/src/unit/primitive.tsx +167 -0
- package/src/unit/required-indicator.svg +3 -0
- package/src/unit/styles.ts +165 -0
- package/src/unit/types.ts +31 -0
- package/src/unit/unit-button-group.tsx +38 -0
- package/src/unit/unit-content-layout.tsx +37 -0
- package/src/unit/unit-content.tsx +37 -0
- package/src/unit/unit-with-title.tsx +8 -0
- package/src/unit/unit-with-tooltip.tsx +60 -0
- package/src/use-is-support-hover.ts +5 -0
- package/src/use-long-press.tsx +79 -0
- package/src/use-me.tsx +11 -0
- package/src/use-navigation.tsx +11 -0
- package/src/use-why-did-you-update.tsx +78 -0
- package/src/utils-dom.ts +26 -0
- package/src/with-data.tsx +78 -0
- package/src/workflow-progress-icon.tsx +73 -0
- package/tsconfig.json +4 -0
- package/src/icons/get-icon-container-style.tsx +0 -13
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {KeyboardEventHandler, useContext, useRef} from "react";
|
|
2
|
+
import {ActiveModifiers, Button, DayProps, useDayPicker, useDayRender, useFocusContext} from "react-day-picker";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
import {isAfter, isBefore, isSameDay} from "date-fns";
|
|
5
|
+
import {StartEndFocusContext} from "./contexts";
|
|
6
|
+
import {
|
|
7
|
+
dayButtonsContainerClassName,
|
|
8
|
+
dayContentClassName,
|
|
9
|
+
dayWrapper,
|
|
10
|
+
endButtonClassName,
|
|
11
|
+
startButtonClassName,
|
|
12
|
+
} from "./styles";
|
|
13
|
+
|
|
14
|
+
export const copyTime = (prev: Date | null, next: Date) => {
|
|
15
|
+
if (!prev) {
|
|
16
|
+
return next;
|
|
17
|
+
}
|
|
18
|
+
next.setHours(prev.getHours());
|
|
19
|
+
next.setMinutes(prev.getMinutes());
|
|
20
|
+
next.setSeconds(prev.getSeconds());
|
|
21
|
+
next.setMilliseconds(prev.getMilliseconds());
|
|
22
|
+
return next;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type DayClickHandler = (
|
|
26
|
+
dates: {from: Date; to: Date},
|
|
27
|
+
modifiers: ActiveModifiers,
|
|
28
|
+
e: React.MouseEvent<HTMLButtonElement>
|
|
29
|
+
) => void;
|
|
30
|
+
|
|
31
|
+
export const DayWithStartEndButtons = (props: DayProps & {className?: string}) => {
|
|
32
|
+
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
33
|
+
const dayRender = useDayRender(props.date, props.displayMonth, buttonRef);
|
|
34
|
+
|
|
35
|
+
const {
|
|
36
|
+
focusDayAfter,
|
|
37
|
+
focusDayBefore,
|
|
38
|
+
focusWeekAfter,
|
|
39
|
+
focusWeekBefore,
|
|
40
|
+
focusMonthBefore,
|
|
41
|
+
focusMonthAfter,
|
|
42
|
+
focusYearBefore,
|
|
43
|
+
focusYearAfter,
|
|
44
|
+
focusStartOfWeek,
|
|
45
|
+
focusEndOfWeek,
|
|
46
|
+
} = useFocusContext();
|
|
47
|
+
|
|
48
|
+
const dayPicker = useDayPicker();
|
|
49
|
+
const {focusOnStart, setFocusOnStart} = useContext(StartEndFocusContext);
|
|
50
|
+
const onKeyDown: KeyboardEventHandler = (e) => {
|
|
51
|
+
switch (e.key) {
|
|
52
|
+
case "ArrowLeft":
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
e.stopPropagation();
|
|
55
|
+
if (focusOnStart) {
|
|
56
|
+
dayPicker.dir === "rtl" ? focusDayAfter() : focusDayBefore();
|
|
57
|
+
} else {
|
|
58
|
+
setFocusOnStart(true);
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
case "ArrowRight":
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
if (!focusOnStart) {
|
|
65
|
+
dayPicker.dir === "rtl" ? focusDayBefore() : focusDayAfter();
|
|
66
|
+
} else {
|
|
67
|
+
setFocusOnStart(false);
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
case "ArrowDown":
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
e.stopPropagation();
|
|
73
|
+
focusWeekAfter();
|
|
74
|
+
break;
|
|
75
|
+
case "ArrowUp":
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
focusWeekBefore();
|
|
79
|
+
break;
|
|
80
|
+
case "PageUp":
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
e.stopPropagation();
|
|
83
|
+
e.shiftKey ? focusYearBefore() : focusMonthBefore();
|
|
84
|
+
break;
|
|
85
|
+
case "PageDown":
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
e.shiftKey ? focusYearAfter() : focusMonthAfter();
|
|
89
|
+
break;
|
|
90
|
+
case "Home":
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
e.stopPropagation();
|
|
93
|
+
focusStartOfWeek();
|
|
94
|
+
break;
|
|
95
|
+
case "End":
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
focusEndOfWeek();
|
|
99
|
+
break;
|
|
100
|
+
default:
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
dayPicker.onDayKeyDown?.(props.date, dayRender.activeModifiers, e);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
if (dayRender.isHidden) {
|
|
107
|
+
return <></>;
|
|
108
|
+
}
|
|
109
|
+
if (!dayRender.isButton) {
|
|
110
|
+
return <div {...dayRender.divProps} />;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
const onDayClick = dayPicker.onDayClick as DayClickHandler | undefined;
|
|
116
|
+
|
|
117
|
+
const selected = dayPicker?.selected as {from: Date; to: Date};
|
|
118
|
+
|
|
119
|
+
const from = selected?.from;
|
|
120
|
+
const to = selected?.to;
|
|
121
|
+
const current = props.date;
|
|
122
|
+
|
|
123
|
+
const handleClickStart: React.MouseEventHandler<HTMLButtonElement> = (e) => {
|
|
124
|
+
if (onDayClick) {
|
|
125
|
+
onDayClick({from: current, to}, dayRender.activeModifiers, e);
|
|
126
|
+
setFocusOnStart(true);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const handleClickEnd: React.MouseEventHandler<HTMLButtonElement> = (e) => {
|
|
131
|
+
if (onDayClick) {
|
|
132
|
+
onDayClick({from, to: current}, dayRender.activeModifiers, e);
|
|
133
|
+
setFocusOnStart(false);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const renderStart =
|
|
138
|
+
from === undefined ||
|
|
139
|
+
(to === undefined && isBefore(current, from)) ||
|
|
140
|
+
isAfter(to, current) ||
|
|
141
|
+
isSameDay(to, current);
|
|
142
|
+
const renderEnd = from !== undefined && (isBefore(from, current) || isSameDay(from, current));
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<div className={dayWrapper}>
|
|
146
|
+
<div {...dayRender.divProps} className={cx(props.className, dayRender.divProps.className, dayContentClassName)} />
|
|
147
|
+
<div className={cx(dayButtonsContainerClassName, dayRender.activeModifiers)}>
|
|
148
|
+
{renderStart && (
|
|
149
|
+
<Button
|
|
150
|
+
{...dayRender.buttonProps}
|
|
151
|
+
ref={!renderEnd || focusOnStart ? buttonRef : null}
|
|
152
|
+
className={startButtonClassName}
|
|
153
|
+
onClick={handleClickStart}
|
|
154
|
+
onKeyDown={onKeyDown}
|
|
155
|
+
children={null}
|
|
156
|
+
/>
|
|
157
|
+
)}
|
|
158
|
+
{renderEnd && (
|
|
159
|
+
<Button
|
|
160
|
+
{...dayRender.buttonProps}
|
|
161
|
+
ref={!renderStart || !focusOnStart ? buttonRef : null}
|
|
162
|
+
className={endButtonClassName}
|
|
163
|
+
onClick={handleClickEnd}
|
|
164
|
+
onKeyDown={onKeyDown}
|
|
165
|
+
children={null}
|
|
166
|
+
/>
|
|
167
|
+
)}
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
);
|
|
171
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import cn from "classnames";
|
|
2
|
+
import React, {forwardRef} from "react";
|
|
3
|
+
import {activeClassName, disabledClassName, fakeDateInputStyle} from "./styles";
|
|
4
|
+
import {css} from "@linaria/core";
|
|
5
|
+
import {themeVars, transition} from "../design-system";
|
|
6
|
+
import ArrowCollapseVertical from "../icons/react/ArrowCollapseVertical";
|
|
7
|
+
|
|
8
|
+
type Props = {children: JSX.Element; disabled: boolean; isPickerOpen: boolean};
|
|
9
|
+
|
|
10
|
+
const expanderExpandedStyle = css`
|
|
11
|
+
transform: rotate(180deg);
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
const expanderStyle = css`
|
|
15
|
+
transition: transform ${transition};
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export const FakeDateInputWrapper = forwardRef<HTMLDivElement, Props>(function FakeDateInputWrapper(
|
|
19
|
+
{children, disabled, isPickerOpen},
|
|
20
|
+
ref
|
|
21
|
+
) {
|
|
22
|
+
return (
|
|
23
|
+
<div
|
|
24
|
+
ref={ref}
|
|
25
|
+
className={cn(
|
|
26
|
+
fakeDateInputStyle,
|
|
27
|
+
css`
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
`,
|
|
30
|
+
disabled ? disabledClassName : activeClassName
|
|
31
|
+
)}
|
|
32
|
+
tabIndex={0}
|
|
33
|
+
>
|
|
34
|
+
<div>{children}</div>
|
|
35
|
+
<div className={cn(expanderStyle, isPickerOpen && expanderExpandedStyle)}>
|
|
36
|
+
<ArrowCollapseVertical color={themeVars.disabledTextColor} />
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import {eachDayOfInterval, endOfMonth, getISODay, startOfMonth} from "date-fns";
|
|
2
|
+
|
|
3
|
+
export const getWeekendsForMonth = (date: Date, weekends: number[]) => {
|
|
4
|
+
const start = startOfMonth(date);
|
|
5
|
+
const end = endOfMonth(date);
|
|
6
|
+
return eachDayOfInterval({start, end}).filter((date) => weekends.includes(getISODay(date)));
|
|
7
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface InputFocusOptions extends FocusOptions {
|
|
2
|
+
cursor?: "start" | "end" | "all";
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface InputRef {
|
|
6
|
+
focus: (options?: InputFocusOptions) => void;
|
|
7
|
+
blur: () => void;
|
|
8
|
+
setSelectionRange: (start: number, end: number, direction?: "forward" | "backward" | "none") => void;
|
|
9
|
+
select: () => void;
|
|
10
|
+
input: HTMLInputElement | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import {css} from "@linaria/core";
|
|
2
|
+
import {space, textStyles, themeVars} from "../design-system";
|
|
3
|
+
import {SingleRowSelect as SingleRowReactSelect, SingleValue} from "../select";
|
|
4
|
+
import {AlwaysVisibleDropdownIndicator} from "../select/custom-select-partials/drop-down-indicator";
|
|
5
|
+
import {RelativeDateValue} from "./types";
|
|
6
|
+
import {useCallback, useMemo, useState} from "react";
|
|
7
|
+
import {$TSFixMe} from "../tsfixme";
|
|
8
|
+
import {AntInputNumber} from "../antd/input-number";
|
|
9
|
+
|
|
10
|
+
type RelativeDatePickerProps = {
|
|
11
|
+
value: RelativeDateValue | null;
|
|
12
|
+
onChange: (value: RelativeDateValue) => void;
|
|
13
|
+
relativeDateToExactDate?: (value: RelativeDateValue) => string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const unitOptions = [
|
|
17
|
+
{value: "day", label: "days"},
|
|
18
|
+
{value: "week", label: "weeks"},
|
|
19
|
+
{value: "month", label: "months"},
|
|
20
|
+
{value: "year", label: "years"},
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const isBeforeNowOptions = [
|
|
24
|
+
{value: "ago", label: "ago"},
|
|
25
|
+
{value: "from now", label: "from now"},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const blurOnEnter = (e: $TSFixMe) => {
|
|
29
|
+
if (e.key === "Enter") {
|
|
30
|
+
e.target.blur();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const RelativeDatePicker = (props: RelativeDatePickerProps) => {
|
|
35
|
+
const {value, onChange, relativeDateToExactDate} = props;
|
|
36
|
+
|
|
37
|
+
const valueWithDefault = useMemo(() => value ?? {unit: "day", isBeforeNow: true, amount: 0}, [value]);
|
|
38
|
+
|
|
39
|
+
const onUnitChange = useCallback(
|
|
40
|
+
(newUnit: SingleValue<{value: string}>) => {
|
|
41
|
+
onChange({...valueWithDefault, unit: newUnit!.value});
|
|
42
|
+
},
|
|
43
|
+
[valueWithDefault, onChange]
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const [amount, setAmount] = useState(valueWithDefault.amount);
|
|
47
|
+
const onAmountChange = useCallback((newAmount: $TSFixMe) => {
|
|
48
|
+
if (newAmount === null || newAmount < 0) {
|
|
49
|
+
setAmount(0);
|
|
50
|
+
} else {
|
|
51
|
+
setAmount(Math.floor(newAmount));
|
|
52
|
+
}
|
|
53
|
+
}, []);
|
|
54
|
+
const handleBlur = useCallback(() => {
|
|
55
|
+
onChange({...valueWithDefault, amount});
|
|
56
|
+
}, [onChange, amount, valueWithDefault]);
|
|
57
|
+
|
|
58
|
+
const onIsBeforeNowChange = useCallback(
|
|
59
|
+
(newValue: SingleValue<{value: string}>) => {
|
|
60
|
+
onChange({...valueWithDefault, isBeforeNow: newValue!.value === "ago"});
|
|
61
|
+
},
|
|
62
|
+
[valueWithDefault, onChange]
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
className={css`
|
|
68
|
+
padding: ${space.s12}px;
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
gap: ${space.s12}px;
|
|
72
|
+
`}
|
|
73
|
+
>
|
|
74
|
+
<div
|
|
75
|
+
className={css`
|
|
76
|
+
display: flex;
|
|
77
|
+
gap: ${space.s8}px;
|
|
78
|
+
`}
|
|
79
|
+
>
|
|
80
|
+
<div>
|
|
81
|
+
<AntInputNumber
|
|
82
|
+
autoFocus={true}
|
|
83
|
+
value={valueWithDefault.amount}
|
|
84
|
+
controls={false}
|
|
85
|
+
style={{width: "56px"}}
|
|
86
|
+
onBlur={handleBlur}
|
|
87
|
+
onChange={onAmountChange}
|
|
88
|
+
onKeyDown={blurOnEnter}
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
<div
|
|
92
|
+
className={css`
|
|
93
|
+
flex: 1;
|
|
94
|
+
`}
|
|
95
|
+
>
|
|
96
|
+
<SingleRowReactSelect
|
|
97
|
+
value={unitOptions.find((option) => option.value === valueWithDefault.unit)}
|
|
98
|
+
components={{
|
|
99
|
+
DropdownIndicator: AlwaysVisibleDropdownIndicator,
|
|
100
|
+
}}
|
|
101
|
+
isCollectionMode={false}
|
|
102
|
+
options={unitOptions}
|
|
103
|
+
onChange={onUnitChange}
|
|
104
|
+
isSearchable={true}
|
|
105
|
+
virtualized={false}
|
|
106
|
+
menuShouldBlockScroll
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
<div
|
|
110
|
+
className={css`
|
|
111
|
+
flex: 1;
|
|
112
|
+
`}
|
|
113
|
+
>
|
|
114
|
+
<SingleRowReactSelect
|
|
115
|
+
value={isBeforeNowOptions.find(
|
|
116
|
+
(option) => option.value === (valueWithDefault.isBeforeNow ? "ago" : "from now")
|
|
117
|
+
)}
|
|
118
|
+
components={{
|
|
119
|
+
DropdownIndicator: AlwaysVisibleDropdownIndicator,
|
|
120
|
+
}}
|
|
121
|
+
isCollectionMode={false}
|
|
122
|
+
options={isBeforeNowOptions}
|
|
123
|
+
onChange={onIsBeforeNowChange}
|
|
124
|
+
isSearchable={true}
|
|
125
|
+
virtualized={false}
|
|
126
|
+
menuShouldBlockScroll
|
|
127
|
+
/>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
<div
|
|
131
|
+
className={css`
|
|
132
|
+
padding: ${space.s4}px;
|
|
133
|
+
${{...textStyles.heading6}}
|
|
134
|
+
color: ${themeVars.accentTextColor};
|
|
135
|
+
`}
|
|
136
|
+
>
|
|
137
|
+
{relativeDateToExactDate?.(valueWithDefault)}
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import {css} from "@linaria/core";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import React, {forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState} from "react";
|
|
4
|
+
import {MonthChangeEventHandler} from "react-day-picker";
|
|
5
|
+
import {AntTransparentInput} from "../antd/input";
|
|
6
|
+
import {inputOverrides} from "../antd/styles";
|
|
7
|
+
import {space} from "../design-system";
|
|
8
|
+
import {IconButton} from "../button/icon-button";
|
|
9
|
+
import RemoveIcon from "../icons/react/Remove";
|
|
10
|
+
import {AutoComplete, OnChangeArgs} from "./autocomplete";
|
|
11
|
+
import {InputRef} from "./rc-input-types";
|
|
12
|
+
import {disabledStyle, selectedStyle} from "./styles";
|
|
13
|
+
import {formatDateInputValue, getLocaleSpecificChrono, getTimeIntervals, setTime} from "./utils";
|
|
14
|
+
|
|
15
|
+
export const SingleDateInput = forwardRef<
|
|
16
|
+
{setValue: (value: string) => void},
|
|
17
|
+
{
|
|
18
|
+
value: Date | null;
|
|
19
|
+
showTime: boolean;
|
|
20
|
+
dateFormat?: string;
|
|
21
|
+
timeFormat?: string;
|
|
22
|
+
dateTimeFormat?: string;
|
|
23
|
+
onMonthChange: MonthChangeEventHandler;
|
|
24
|
+
onChange: (value: Date | null) => void;
|
|
25
|
+
initialInputValue: string;
|
|
26
|
+
allowClear: boolean;
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
placeholder: string;
|
|
29
|
+
autoFocus: boolean;
|
|
30
|
+
}
|
|
31
|
+
>(
|
|
32
|
+
(
|
|
33
|
+
{
|
|
34
|
+
value,
|
|
35
|
+
showTime,
|
|
36
|
+
dateFormat,
|
|
37
|
+
timeFormat,
|
|
38
|
+
dateTimeFormat,
|
|
39
|
+
onMonthChange,
|
|
40
|
+
onChange,
|
|
41
|
+
initialInputValue,
|
|
42
|
+
allowClear,
|
|
43
|
+
disabled,
|
|
44
|
+
placeholder,
|
|
45
|
+
autoFocus,
|
|
46
|
+
},
|
|
47
|
+
ref
|
|
48
|
+
) => {
|
|
49
|
+
const [prevInputValue, setPrevInputValue] = useState<string | null>(null);
|
|
50
|
+
const [inputValue, setInputValue] = useState(initialInputValue);
|
|
51
|
+
|
|
52
|
+
if (prevInputValue !== initialInputValue) {
|
|
53
|
+
setPrevInputValue(initialInputValue);
|
|
54
|
+
setInputValue(initialInputValue);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const [selected, setSelected] = useState(false);
|
|
58
|
+
|
|
59
|
+
const inputRef = useRef<InputRef>(null);
|
|
60
|
+
useImperativeHandle(ref, () => {
|
|
61
|
+
return {
|
|
62
|
+
setValue(v) {
|
|
63
|
+
setInputValue(v);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (inputRef.current && autoFocus) {
|
|
69
|
+
inputRef.current.focus({
|
|
70
|
+
cursor: "all",
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}, [autoFocus]);
|
|
74
|
+
|
|
75
|
+
const onChangeInput = useCallback(
|
|
76
|
+
(e: React.ChangeEvent<HTMLInputElement> | React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
77
|
+
setInputValue(e.target.value);
|
|
78
|
+
},
|
|
79
|
+
[]
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const [timeAutoComplete, setTimeAutoComplete] = useState(false);
|
|
83
|
+
|
|
84
|
+
const timeoutIdRef = useRef<ReturnType<typeof setTimeout>>();
|
|
85
|
+
|
|
86
|
+
const onClick = useCallback(
|
|
87
|
+
(e: React.MouseEvent<HTMLInputElement> | React.MouseEvent<HTMLTextAreaElement>) => {
|
|
88
|
+
const input = e.target as HTMLInputElement | HTMLTextAreaElement;
|
|
89
|
+
if (showTime && value) {
|
|
90
|
+
// wait until click will be applied to input
|
|
91
|
+
timeoutIdRef.current = setTimeout(() => {
|
|
92
|
+
if (input.selectionStart !== null) {
|
|
93
|
+
const timeInterval = getTimeIntervals(input.value);
|
|
94
|
+
|
|
95
|
+
if (input.selectionStart >= timeInterval[0] && input.selectionStart <= timeInterval[1]) {
|
|
96
|
+
setTimeAutoComplete(true);
|
|
97
|
+
} else {
|
|
98
|
+
setTimeAutoComplete(false);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, 0);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
[showTime, value]
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
return () => {
|
|
109
|
+
if (timeoutIdRef.current) {
|
|
110
|
+
clearTimeout(timeoutIdRef.current);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}, []);
|
|
114
|
+
|
|
115
|
+
const onTimeClick = useCallback(
|
|
116
|
+
(time: string) => {
|
|
117
|
+
setTimeAutoComplete(false);
|
|
118
|
+
const newValue = setTime(value, time, timeFormat);
|
|
119
|
+
onChange(newValue);
|
|
120
|
+
setInputValue(formatDateInputValue(newValue, {showTime, dateFormat, dateTimeFormat}));
|
|
121
|
+
},
|
|
122
|
+
[onChange, showTime, dateFormat, timeFormat, dateTimeFormat, value]
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const onTimeSelect = useCallback(
|
|
126
|
+
(option: OnChangeArgs) => (option ? onTimeClick(option.value) : null),
|
|
127
|
+
[onTimeClick]
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
const onClear = useCallback(() => {
|
|
131
|
+
onChange(null);
|
|
132
|
+
inputRef.current?.focus();
|
|
133
|
+
}, [onChange]);
|
|
134
|
+
|
|
135
|
+
const onSaveValue = useCallback(
|
|
136
|
+
(e: React.SyntheticEvent) => {
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
if (inputValue === "") {
|
|
139
|
+
if (allowClear) {
|
|
140
|
+
onClear();
|
|
141
|
+
} else {
|
|
142
|
+
setInputValue(formatDateInputValue(value, {showTime, dateFormat, dateTimeFormat}));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const [result] = getLocaleSpecificChrono().parse(inputValue);
|
|
147
|
+
if (result && result.start) {
|
|
148
|
+
const newValue = result.start.date();
|
|
149
|
+
onChange(newValue);
|
|
150
|
+
setInputValue(formatDateInputValue(newValue, {showTime, dateFormat, dateTimeFormat}));
|
|
151
|
+
onMonthChange(newValue);
|
|
152
|
+
} else {
|
|
153
|
+
setInputValue(prevInputValue || "");
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
[
|
|
157
|
+
allowClear,
|
|
158
|
+
inputValue,
|
|
159
|
+
onChange,
|
|
160
|
+
onClear,
|
|
161
|
+
onMonthChange,
|
|
162
|
+
prevInputValue,
|
|
163
|
+
showTime,
|
|
164
|
+
dateFormat,
|
|
165
|
+
dateTimeFormat,
|
|
166
|
+
value,
|
|
167
|
+
]
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const onBlur: React.FocusEventHandler<HTMLInputElement> = useCallback(
|
|
171
|
+
(e) => {
|
|
172
|
+
if (e.target.value !== initialInputValue) {
|
|
173
|
+
onSaveValue(e);
|
|
174
|
+
}
|
|
175
|
+
setTimeAutoComplete(false);
|
|
176
|
+
setSelected(false);
|
|
177
|
+
},
|
|
178
|
+
[initialInputValue, onSaveValue]
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
const onFocus = useCallback(() => {
|
|
182
|
+
setSelected(true);
|
|
183
|
+
}, []);
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<div
|
|
187
|
+
className={cx(
|
|
188
|
+
css`
|
|
189
|
+
${inputOverrides.main};
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
justify-content: center;
|
|
192
|
+
display: flex;
|
|
193
|
+
margin-bottom: ${space.s12 + space.s6}px;
|
|
194
|
+
padding-right: ${space.s12 - 2}px;
|
|
195
|
+
`,
|
|
196
|
+
{[selectedStyle]: selected, [disabledStyle]: disabled}
|
|
197
|
+
)}
|
|
198
|
+
>
|
|
199
|
+
<div
|
|
200
|
+
className={css`
|
|
201
|
+
display: grid;
|
|
202
|
+
grid-template-columns: 1fr auto;
|
|
203
|
+
align-items: center;
|
|
204
|
+
justify-content: center;
|
|
205
|
+
padding-top: ${space.s6}px;
|
|
206
|
+
padding-bottom: ${space.s6}px;
|
|
207
|
+
`}
|
|
208
|
+
>
|
|
209
|
+
<div>
|
|
210
|
+
<AntTransparentInput
|
|
211
|
+
bypassedRef={inputRef}
|
|
212
|
+
autoFocus={autoFocus}
|
|
213
|
+
value={inputValue}
|
|
214
|
+
onChange={onChangeInput}
|
|
215
|
+
onPressEnter={onSaveValue}
|
|
216
|
+
onClick={onClick}
|
|
217
|
+
onBlur={onBlur}
|
|
218
|
+
onFocus={onFocus}
|
|
219
|
+
style={{width: "100%", minHeight: "auto"}}
|
|
220
|
+
placeholder={placeholder}
|
|
221
|
+
/>
|
|
222
|
+
<AutoComplete
|
|
223
|
+
menuIsOpen={timeAutoComplete}
|
|
224
|
+
value={value}
|
|
225
|
+
timeFormat={timeFormat}
|
|
226
|
+
onChange={onTimeSelect}
|
|
227
|
+
position={0}
|
|
228
|
+
/>
|
|
229
|
+
</div>
|
|
230
|
+
{allowClear && inputValue !== "" && (
|
|
231
|
+
<IconButton onClick={onClear} size={"tiny"}>
|
|
232
|
+
<RemoveIcon />
|
|
233
|
+
</IconButton>
|
|
234
|
+
)}
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
);
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {DatePickerCommonProps, NativeSingleDatePickerProps} from "./types";
|
|
2
|
+
import {forwardRef, useCallback, useMemo, useRef, useState} from "react";
|
|
3
|
+
import {DayPicker} from "react-day-picker";
|
|
4
|
+
import enGB from "date-fns/locale/en-GB";
|
|
5
|
+
import {SingleDateInput} from "./single-date-input";
|
|
6
|
+
import {copyTime} from "./day-with-start-end-buttons";
|
|
7
|
+
import {formatDateInputValue, getRandomPlaceholder} from "./utils";
|
|
8
|
+
import {
|
|
9
|
+
datePickerStylesOverrideClassName,
|
|
10
|
+
outsideClassName,
|
|
11
|
+
selectedSingleDateClassName,
|
|
12
|
+
todayClassName,
|
|
13
|
+
weekendClassName,
|
|
14
|
+
} from "./styles";
|
|
15
|
+
import {getWeekendsForMonth} from "./get-weekends-for-month";
|
|
16
|
+
|
|
17
|
+
export const SingleDatePickerPopupContent = forwardRef<
|
|
18
|
+
{setValue: (value: string) => void},
|
|
19
|
+
DatePickerCommonProps & NativeSingleDatePickerProps
|
|
20
|
+
>(function SingleDatePickerPopupContent(props, ref) {
|
|
21
|
+
const {
|
|
22
|
+
value,
|
|
23
|
+
onChange,
|
|
24
|
+
disabled = false,
|
|
25
|
+
showTime = false,
|
|
26
|
+
allowClear = true,
|
|
27
|
+
dateFormat,
|
|
28
|
+
timeFormat,
|
|
29
|
+
dateTimeFormat,
|
|
30
|
+
onKeyDown,
|
|
31
|
+
bypassedRef,
|
|
32
|
+
weekStartsOn,
|
|
33
|
+
weekends,
|
|
34
|
+
} = props;
|
|
35
|
+
const [month, setMonth] = useState(value || new Date());
|
|
36
|
+
const dateValue = value;
|
|
37
|
+
const onDayClick = useCallback(
|
|
38
|
+
(date: Date) => {
|
|
39
|
+
onChange(copyTime(dateValue, date));
|
|
40
|
+
},
|
|
41
|
+
[dateValue, onChange]
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const inputValue = formatDateInputValue(value, {showTime, dateFormat, dateTimeFormat});
|
|
45
|
+
const placeholder = useRef<string>(`e.g. ${getRandomPlaceholder(showTime, false)}`);
|
|
46
|
+
|
|
47
|
+
const weekendsForMonth = useMemo(() => getWeekendsForMonth(month, weekends), [month, weekends]);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div className={datePickerStylesOverrideClassName} ref={bypassedRef} onKeyDown={onKeyDown}>
|
|
51
|
+
<SingleDateInput
|
|
52
|
+
ref={ref}
|
|
53
|
+
value={dateValue}
|
|
54
|
+
showTime={showTime}
|
|
55
|
+
dateFormat={dateFormat}
|
|
56
|
+
timeFormat={timeFormat}
|
|
57
|
+
dateTimeFormat={dateTimeFormat}
|
|
58
|
+
onMonthChange={setMonth}
|
|
59
|
+
onChange={onChange}
|
|
60
|
+
initialInputValue={inputValue}
|
|
61
|
+
allowClear={allowClear}
|
|
62
|
+
disabled={disabled}
|
|
63
|
+
placeholder={placeholder.current}
|
|
64
|
+
autoFocus
|
|
65
|
+
/>
|
|
66
|
+
<DayPicker
|
|
67
|
+
mode={"single"}
|
|
68
|
+
numberOfMonths={1}
|
|
69
|
+
showOutsideDays
|
|
70
|
+
month={month}
|
|
71
|
+
onMonthChange={setMonth}
|
|
72
|
+
modifiers={{
|
|
73
|
+
weekend: weekendsForMonth,
|
|
74
|
+
}}
|
|
75
|
+
modifiersClassNames={{
|
|
76
|
+
selected: selectedSingleDateClassName,
|
|
77
|
+
today: todayClassName,
|
|
78
|
+
outside: outsideClassName,
|
|
79
|
+
weekend: weekendClassName,
|
|
80
|
+
}}
|
|
81
|
+
selected={dateValue || undefined}
|
|
82
|
+
onDayClick={onDayClick}
|
|
83
|
+
disabled={disabled}
|
|
84
|
+
locale={enGB}
|
|
85
|
+
weekStartsOn={weekStartsOn}
|
|
86
|
+
fixedWeeks
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
});
|