@fibery/ui-kit 1.35.0 → 1.36.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/.eslintignore +3 -0
- package/.eslintrc +14 -0
- package/CHANGELOG.md +594 -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 +276 -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 +165 -0
- package/src/command-menu/nested-command-menu.tsx +349 -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 +152 -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/DateRange.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/ReadOnly.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 +8 -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/DateRange.tsx +13 -0
- package/src/icons/react/LevelPlus.tsx +13 -0
- package/src/icons/react/ReadOnly.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 +8 -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/date-range.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/read-only.svg +6 -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/loaders.tsx +28 -23
- 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 +133 -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/custom-select-partials/group-heading.tsx +24 -1
- package/src/select/custom-select-partials/option.tsx +17 -11
- package/src/select/select-in-popover.tsx +4 -1
- package/src/select/util.ts +2 -1
- 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,165 @@
|
|
|
1
|
+
import {CommandInput, CommandItem, CommandList, CommandGroup, CommandRoot, CommandEmpty, CommandSeparator} from "cmdk";
|
|
2
|
+
import {border, layout, space, textStyles, themeVars} from "../design-system";
|
|
3
|
+
import {styled} from "@linaria/react";
|
|
4
|
+
import {forwardRef, useRef, useState} from "react";
|
|
5
|
+
import Search from "../icons/react/Search";
|
|
6
|
+
import {css, cx} from "@linaria/core";
|
|
7
|
+
import ClearInputFilled from "../icons/react/ClearInputFilled";
|
|
8
|
+
import {useComposedRefs} from "@fibery/react/src/use-composed-refs";
|
|
9
|
+
import {useControllableState} from "@fibery/react/src/use-controllable-state";
|
|
10
|
+
|
|
11
|
+
export const CommandMenuRoot = styled(CommandRoot)`
|
|
12
|
+
display: flex;
|
|
13
|
+
height: 100%;
|
|
14
|
+
width: 100%;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
border-radius: ${border.radius8}px;
|
|
18
|
+
background-color: ${themeVars.colorBgActionsMenu};
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
const inputContainerCss = css`
|
|
22
|
+
display: flex;
|
|
23
|
+
padding: ${space.s8}px ${space.s12}px;
|
|
24
|
+
align-items: center;
|
|
25
|
+
border-bottom: 1px solid ${themeVars.separatorColor};
|
|
26
|
+
|
|
27
|
+
& input {
|
|
28
|
+
min-width: 120px;
|
|
29
|
+
width: 100%;
|
|
30
|
+
color: ${themeVars.textColor};
|
|
31
|
+
background-color: ${themeVars.transparent};
|
|
32
|
+
margin-left: ${space.s8}px;
|
|
33
|
+
font-size: 13px;
|
|
34
|
+
border: none;
|
|
35
|
+
outline: none;
|
|
36
|
+
resize: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
& input::placeholder {
|
|
40
|
+
color: ${themeVars.accentTextColor};
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
export const CommandMenuInput = forwardRef<
|
|
45
|
+
React.ElementRef<typeof CommandInput>,
|
|
46
|
+
React.ComponentPropsWithoutRef<typeof CommandInput>
|
|
47
|
+
>(function CommandMenuInput(props, ref) {
|
|
48
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
49
|
+
const composedRef = useComposedRefs(ref, inputRef);
|
|
50
|
+
const [value, onValueChange] = useControllableState({
|
|
51
|
+
value: props.value,
|
|
52
|
+
defaultValue: "",
|
|
53
|
+
onChange: props.onValueChange,
|
|
54
|
+
});
|
|
55
|
+
const clearValue = () => {
|
|
56
|
+
onValueChange("");
|
|
57
|
+
|
|
58
|
+
if (inputRef.current) {
|
|
59
|
+
inputRef.current.focus();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<div className={inputContainerCss}>
|
|
65
|
+
<Search iconSize={16} aria-hidden />
|
|
66
|
+
<CommandInput ref={composedRef} {...props} value={value} onValueChange={onValueChange} />
|
|
67
|
+
{value ? (
|
|
68
|
+
<div
|
|
69
|
+
className={css`
|
|
70
|
+
margin-left: ${space.s6}px;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
`}
|
|
73
|
+
onClick={clearValue}
|
|
74
|
+
>
|
|
75
|
+
<ClearInputFilled iconSize={16} containerSize={18} />
|
|
76
|
+
</div>
|
|
77
|
+
) : null}
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const CommandMenuList = styled(CommandList)`
|
|
83
|
+
overflow-y: scroll;
|
|
84
|
+
height: var(--cmdk-list-height);
|
|
85
|
+
max-height: 450px;
|
|
86
|
+
transition: height 100ms ease;
|
|
87
|
+
margin-top: ${space.s4}px;
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
export const CommandMenuEmpty = styled(CommandEmpty)`
|
|
91
|
+
${textStyles.small}
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
padding: 0 ${space.s12}px;
|
|
95
|
+
min-height: ${layout.itemHeight}px;
|
|
96
|
+
color: ${themeVars.accentTextColor};
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
export const CommandMenuGroup = styled(CommandGroup)`
|
|
100
|
+
[cmdk-group-heading] {
|
|
101
|
+
${textStyles.small}
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
padding: 0 ${space.s8}px;
|
|
105
|
+
min-height: ${layout.groupTitleHeight}px;
|
|
106
|
+
color: ${themeVars.accentTextColor};
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
export const CommandMenuSeparator = styled(CommandSeparator)`
|
|
111
|
+
background-color: ${themeVars.actionMenuSeparatorColor};
|
|
112
|
+
height: 0.5px;
|
|
113
|
+
margin: ${space.s4}px 0;
|
|
114
|
+
`;
|
|
115
|
+
|
|
116
|
+
export const commandItemCss = css`
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
gap: ${space.s6}px;
|
|
120
|
+
padding: 0 ${space.s12}px;
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
min-height: ${layout.menuItemHeight}px;
|
|
123
|
+
margin: 0 ${space.s4}px;
|
|
124
|
+
border-radius: ${border.radius6}px;
|
|
125
|
+
|
|
126
|
+
&[data-selected="true"] {
|
|
127
|
+
margin: 0 4px;
|
|
128
|
+
background-color: ${themeVars.colorBgActionsMenuItemHover};
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
const commandItemTitleCss = css`
|
|
132
|
+
flex: 1 1 0;
|
|
133
|
+
white-space: nowrap;
|
|
134
|
+
text-overflow: ellipsis;
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
`;
|
|
137
|
+
|
|
138
|
+
export const CommandMenuItem = forwardRef<
|
|
139
|
+
React.ElementRef<typeof CommandItem>,
|
|
140
|
+
React.ComponentPropsWithoutRef<typeof CommandItem> & {
|
|
141
|
+
icon?: React.ReactNode;
|
|
142
|
+
rightIcon?: React.ReactNode;
|
|
143
|
+
}
|
|
144
|
+
>(function CommandMenuItem({className, children, icon, rightIcon, ...props}, ref) {
|
|
145
|
+
const [showTitle, setShowTitle] = useState(false);
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<CommandItem ref={ref} className={cx(commandItemCss, className)} {...props}>
|
|
149
|
+
{icon}
|
|
150
|
+
<span
|
|
151
|
+
title={showTitle ? (children as string) : ""}
|
|
152
|
+
onMouseEnter={(e) => {
|
|
153
|
+
const target = e.target as HTMLElement;
|
|
154
|
+
if (typeof children === "string" && target.offsetWidth < target.scrollWidth) {
|
|
155
|
+
setShowTitle(true);
|
|
156
|
+
}
|
|
157
|
+
}}
|
|
158
|
+
className={commandItemTitleCss}
|
|
159
|
+
>
|
|
160
|
+
{children}
|
|
161
|
+
</span>
|
|
162
|
+
{rightIcon}
|
|
163
|
+
</CommandItem>
|
|
164
|
+
);
|
|
165
|
+
});
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import {CommandItem} from "cmdk";
|
|
2
|
+
import React, {forwardRef, ReactNode, useCallback, useEffect, useMemo, useRef, useState} from "react";
|
|
3
|
+
import {css, cx} from "@linaria/core";
|
|
4
|
+
import {border, space, themeVars} from "../design-system";
|
|
5
|
+
import Back from "../icons/react/Back";
|
|
6
|
+
import {
|
|
7
|
+
commandItemCss,
|
|
8
|
+
CommandMenuEmpty,
|
|
9
|
+
CommandMenuGroup,
|
|
10
|
+
CommandMenuInput,
|
|
11
|
+
CommandMenuItem,
|
|
12
|
+
CommandMenuList,
|
|
13
|
+
CommandMenuRoot,
|
|
14
|
+
CommandMenuSeparator,
|
|
15
|
+
} from "./index";
|
|
16
|
+
import cn from "classnames";
|
|
17
|
+
import {Tooltip} from "../tooltip";
|
|
18
|
+
import {IconButton} from "../button/icon-button";
|
|
19
|
+
import ArrowRight from "../icons/react/ArrowRight";
|
|
20
|
+
|
|
21
|
+
const selectedItemClassName = css`
|
|
22
|
+
background-color: ${themeVars.colorBgListItemGeneralSelected};
|
|
23
|
+
|
|
24
|
+
&[data-selected="true"] {
|
|
25
|
+
background-color: ${themeVars.colorBgListItemGeneralSelectedHover};
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
const arrowWrapperClassName = css`
|
|
30
|
+
flex-grow: 0;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
export type NestedMenuItem<T> = {
|
|
34
|
+
key: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
icon?: ReactNode;
|
|
37
|
+
value: T;
|
|
38
|
+
groupItems?: Array<NestedMenuItem<T>>;
|
|
39
|
+
filterPlaceholder?: string;
|
|
40
|
+
emptyMessage?: string;
|
|
41
|
+
calculateNestedItems?: () => Array<NestedMenuItem<T>>;
|
|
42
|
+
kind?: "separator" | "group";
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type NestedMenuStack<T> = Array<{
|
|
46
|
+
item: NestedMenuItem<T>;
|
|
47
|
+
nestedItems: NestedMenuItem<T>[];
|
|
48
|
+
}>;
|
|
49
|
+
|
|
50
|
+
type Props<T> = {
|
|
51
|
+
defaultStack?: NestedMenuStack<T>;
|
|
52
|
+
defaultValue?: string;
|
|
53
|
+
rootItems: Array<NestedMenuItem<T>>;
|
|
54
|
+
onChange: (item: NestedMenuItem<T>) => void;
|
|
55
|
+
filterPlaceholder: string;
|
|
56
|
+
emptyMessage: string;
|
|
57
|
+
getArrowTooltipMessage: (item: NestedMenuItem<T>) => string;
|
|
58
|
+
maxDepthLevel?: number;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const NestedCommandMenuItem = forwardRef<
|
|
62
|
+
React.ElementRef<typeof CommandItem>,
|
|
63
|
+
React.ComponentPropsWithoutRef<typeof CommandItem>
|
|
64
|
+
>(function CommandMenuItem({className, children, ...props}, ref) {
|
|
65
|
+
return (
|
|
66
|
+
<CommandItem ref={ref} className={cx(commandItemCss, className)} {...props}>
|
|
67
|
+
{children}
|
|
68
|
+
</CommandItem>
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
function isItemMatchFilter<T>(item: NestedMenuItem<T>, lowerCaseFilterValue: string) {
|
|
73
|
+
return item.title?.toLowerCase()?.includes(lowerCaseFilterValue);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function NestedCommandMenu<T>({
|
|
77
|
+
defaultStack,
|
|
78
|
+
defaultValue,
|
|
79
|
+
rootItems,
|
|
80
|
+
onChange,
|
|
81
|
+
filterPlaceholder,
|
|
82
|
+
emptyMessage,
|
|
83
|
+
getArrowTooltipMessage,
|
|
84
|
+
maxDepthLevel = Number.MAX_VALUE,
|
|
85
|
+
}: Props<T>) {
|
|
86
|
+
const [stack, setStack] = React.useState<NestedMenuStack<T>>(defaultStack || []);
|
|
87
|
+
const currentStackItem = stack[stack.length - 1];
|
|
88
|
+
|
|
89
|
+
const currentItems = currentStackItem?.nestedItems || rootItems;
|
|
90
|
+
|
|
91
|
+
const onGoToRelation = useCallback(
|
|
92
|
+
(key: string) => {
|
|
93
|
+
const item = currentItems.find((item) => item.key === key)!;
|
|
94
|
+
setStack((items) => [...items, {item, nestedItems: item.calculateNestedItems?.() || []}]);
|
|
95
|
+
setFilter("");
|
|
96
|
+
},
|
|
97
|
+
[currentItems]
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const onCmdkItemSelect = useCallback(
|
|
101
|
+
(item: NestedMenuItem<T>) => {
|
|
102
|
+
onChange(item);
|
|
103
|
+
},
|
|
104
|
+
[onChange]
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const [filter, setFilter] = useState("");
|
|
108
|
+
|
|
109
|
+
const filteredOptions = useMemo(() => {
|
|
110
|
+
const lowerCaseFilterValue = filter.toLowerCase();
|
|
111
|
+
if (!filter) {
|
|
112
|
+
return currentItems;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return currentItems
|
|
116
|
+
.map((item) => {
|
|
117
|
+
if (item.kind === "group") {
|
|
118
|
+
const groupItems = (item.groupItems || []).filter((groupItem) =>
|
|
119
|
+
isItemMatchFilter(groupItem, lowerCaseFilterValue)
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
return groupItems.length > 0 ? {...item, groupItems} : null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return isItemMatchFilter(item, lowerCaseFilterValue) ? item : null;
|
|
126
|
+
})
|
|
127
|
+
.filter(Boolean) as Array<NestedMenuItem<T>>;
|
|
128
|
+
}, [filter, currentItems]);
|
|
129
|
+
|
|
130
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
131
|
+
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
inputRef.current?.focus();
|
|
135
|
+
}, 0);
|
|
136
|
+
}, [stack]);
|
|
137
|
+
|
|
138
|
+
const menuListRef = useRef<HTMLDivElement>(null);
|
|
139
|
+
const scrollToTop = useCallback(() => {
|
|
140
|
+
menuListRef.current?.scrollTo({top: 0, behavior: "instant"});
|
|
141
|
+
}, []);
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
scrollToTop();
|
|
144
|
+
}, [stack, scrollToTop]);
|
|
145
|
+
|
|
146
|
+
const [value, setValue] = React.useState(defaultValue);
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<>
|
|
150
|
+
{stack.length > 0 && (
|
|
151
|
+
<>
|
|
152
|
+
<div
|
|
153
|
+
className={css`
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
|
|
156
|
+
&:hover {
|
|
157
|
+
background-color: ${themeVars.colorBgActionsMenuItemHover};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
display: flex;
|
|
161
|
+
padding: ${space.s6}px ${space.s8}px;
|
|
162
|
+
border-radius: ${border.radius6}px;
|
|
163
|
+
margin: 0 ${space.s4}px;
|
|
164
|
+
align-items: center;
|
|
165
|
+
gap: ${space.s8}px;
|
|
166
|
+
`}
|
|
167
|
+
onClick={() => {
|
|
168
|
+
setStack((relations) => relations.slice(0, -1));
|
|
169
|
+
setFilter("");
|
|
170
|
+
}}
|
|
171
|
+
>
|
|
172
|
+
<div>
|
|
173
|
+
<Back iconSize={16} aria-hidden />
|
|
174
|
+
</div>
|
|
175
|
+
<div>
|
|
176
|
+
Back
|
|
177
|
+
{stack.length > 1 ? ` to ${stack[stack.length - 2].item.title}` : ""}
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
<div
|
|
181
|
+
className={css`
|
|
182
|
+
background-color: ${themeVars.separatorColor};
|
|
183
|
+
height: 1px;
|
|
184
|
+
margin-top: ${space.s4}px;
|
|
185
|
+
`}
|
|
186
|
+
/>
|
|
187
|
+
</>
|
|
188
|
+
)}
|
|
189
|
+
|
|
190
|
+
<CommandMenuRoot
|
|
191
|
+
shouldFilter={false}
|
|
192
|
+
value={value}
|
|
193
|
+
onValueChange={setValue}
|
|
194
|
+
onKeyDown={(e) => {
|
|
195
|
+
if (e.key === "Escape" || (e.key === "Backspace" && !filter && stack.length > 0)) {
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
setStack((relations) => relations.slice(0, -1));
|
|
198
|
+
} else if (e.key === "ArrowRight") {
|
|
199
|
+
const currentItem = currentItems.find((item) => item.key === value);
|
|
200
|
+
if (currentItem && currentItem.calculateNestedItems) {
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
onGoToRelation(currentItem.key);
|
|
203
|
+
}
|
|
204
|
+
} else if (e.key === "ArrowLeft" && stack.length > 0) {
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
setStack((relations) => relations.slice(0, -1));
|
|
207
|
+
}
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
210
|
+
<CommandMenuInput
|
|
211
|
+
ref={inputRef}
|
|
212
|
+
value={filter}
|
|
213
|
+
onValueChange={setFilter}
|
|
214
|
+
placeholder={currentStackItem?.item?.filterPlaceholder || filterPlaceholder}
|
|
215
|
+
/>
|
|
216
|
+
<CommandMenuList
|
|
217
|
+
ref={menuListRef}
|
|
218
|
+
className={css`
|
|
219
|
+
&& {
|
|
220
|
+
transition: none;
|
|
221
|
+
max-height: 300px;
|
|
222
|
+
}
|
|
223
|
+
`}
|
|
224
|
+
>
|
|
225
|
+
<CommandMenuEmpty>{currentStackItem?.item?.emptyMessage || emptyMessage}</CommandMenuEmpty>
|
|
226
|
+
{renderLevel({
|
|
227
|
+
options: filteredOptions,
|
|
228
|
+
stack,
|
|
229
|
+
maxDepthLevel,
|
|
230
|
+
onCmdkItemSelect,
|
|
231
|
+
onGoToRelation,
|
|
232
|
+
getArrowTooltipMessage,
|
|
233
|
+
defaultValue,
|
|
234
|
+
})}
|
|
235
|
+
</CommandMenuList>
|
|
236
|
+
</CommandMenuRoot>
|
|
237
|
+
</>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function renderLevel<T>({
|
|
242
|
+
options,
|
|
243
|
+
defaultValue,
|
|
244
|
+
stack,
|
|
245
|
+
maxDepthLevel,
|
|
246
|
+
onCmdkItemSelect,
|
|
247
|
+
onGoToRelation,
|
|
248
|
+
getArrowTooltipMessage,
|
|
249
|
+
}: {
|
|
250
|
+
options: Array<NestedMenuItem<T>>;
|
|
251
|
+
defaultValue?: string;
|
|
252
|
+
stack: NestedMenuStack<T>;
|
|
253
|
+
maxDepthLevel: number;
|
|
254
|
+
onCmdkItemSelect: (item: NestedMenuItem<T>) => void;
|
|
255
|
+
onGoToRelation: (key: string) => void;
|
|
256
|
+
getArrowTooltipMessage: (item: NestedMenuItem<T>) => string;
|
|
257
|
+
}) {
|
|
258
|
+
return options.map((item) => {
|
|
259
|
+
if (item.kind === "separator") {
|
|
260
|
+
return <CommandMenuSeparator key={item.key} />;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (item.kind === "group") {
|
|
264
|
+
const nestedItems = item.groupItems || [];
|
|
265
|
+
if (nestedItems.length > 0) {
|
|
266
|
+
return (
|
|
267
|
+
<CommandMenuGroup heading={item.title} key={item.key}>
|
|
268
|
+
{renderLevel({
|
|
269
|
+
options: nestedItems,
|
|
270
|
+
defaultValue,
|
|
271
|
+
stack,
|
|
272
|
+
maxDepthLevel,
|
|
273
|
+
onCmdkItemSelect,
|
|
274
|
+
onGoToRelation,
|
|
275
|
+
getArrowTooltipMessage,
|
|
276
|
+
})}
|
|
277
|
+
</CommandMenuGroup>
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const isSelected = item.key === defaultValue;
|
|
285
|
+
if (item.calculateNestedItems && stack.length < maxDepthLevel) {
|
|
286
|
+
return (
|
|
287
|
+
<NestedCommandMenuItem
|
|
288
|
+
key={item.key}
|
|
289
|
+
value={item.key}
|
|
290
|
+
onSelect={() => onCmdkItemSelect(item)}
|
|
291
|
+
asChild
|
|
292
|
+
className={cn(
|
|
293
|
+
css`
|
|
294
|
+
padding-right: 0;
|
|
295
|
+
`,
|
|
296
|
+
isSelected ? selectedItemClassName : undefined
|
|
297
|
+
)}
|
|
298
|
+
>
|
|
299
|
+
<div
|
|
300
|
+
className={css`
|
|
301
|
+
display: flex;
|
|
302
|
+
align-items: center;
|
|
303
|
+
justify-content: space-between;
|
|
304
|
+
gap: ${space.s6}px;
|
|
305
|
+
|
|
306
|
+
&[data-selected="true"]:has(.${arrowWrapperClassName}:hover) {
|
|
307
|
+
background-color: transparent;
|
|
308
|
+
}
|
|
309
|
+
`}
|
|
310
|
+
>
|
|
311
|
+
{item.icon}
|
|
312
|
+
<div
|
|
313
|
+
className={css`
|
|
314
|
+
flex: 1;
|
|
315
|
+
`}
|
|
316
|
+
>
|
|
317
|
+
{item.title}
|
|
318
|
+
</div>
|
|
319
|
+
<div className={arrowWrapperClassName}>
|
|
320
|
+
<Tooltip title={getArrowTooltipMessage(item)}>
|
|
321
|
+
<IconButton
|
|
322
|
+
size={"medium"}
|
|
323
|
+
onClick={(e) => {
|
|
324
|
+
e.stopPropagation();
|
|
325
|
+
onGoToRelation(item.key);
|
|
326
|
+
}}
|
|
327
|
+
>
|
|
328
|
+
<ArrowRight color={themeVars.iconColor} containerSize={10} aria-hidden />
|
|
329
|
+
</IconButton>
|
|
330
|
+
</Tooltip>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
</NestedCommandMenuItem>
|
|
334
|
+
);
|
|
335
|
+
} else {
|
|
336
|
+
return (
|
|
337
|
+
<CommandMenuItem
|
|
338
|
+
key={item.key}
|
|
339
|
+
value={item.key}
|
|
340
|
+
onSelect={() => onCmdkItemSelect(item)}
|
|
341
|
+
icon={item.icon}
|
|
342
|
+
className={isSelected ? selectedItemClassName : undefined}
|
|
343
|
+
>
|
|
344
|
+
{item.title}
|
|
345
|
+
</CommandMenuItem>
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|