@sgftech/medusa-plugin-product-variant-licenses 0.0.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/.cache/admin/index.html +12 -0
- package/.cache/admin/public/locales/ar/translation.json +1919 -0
- package/.cache/admin/public/locales/bg/translation.json +2011 -0
- package/.cache/admin/public/locales/bs/translation.json +2011 -0
- package/.cache/admin/public/locales/cs/translation.json +1942 -0
- package/.cache/admin/public/locales/de/translation.json +1924 -0
- package/.cache/admin/public/locales/en/translation.json +2011 -0
- package/.cache/admin/public/locales/es/translation.json +1924 -0
- package/.cache/admin/public/locales/fr/translation.json +1924 -0
- package/.cache/admin/public/locales/hi/translation.json +2011 -0
- package/.cache/admin/public/locales/hr/translation.json +2011 -0
- package/.cache/admin/public/locales/it/translation.json +1922 -0
- package/.cache/admin/public/locales/ja/translation.json +2006 -0
- package/.cache/admin/public/locales/ko/translation.json +2011 -0
- package/.cache/admin/public/locales/pl/translation.json +1919 -0
- package/.cache/admin/public/locales/pt/translation.json +1925 -0
- package/.cache/admin/public/locales/ru/translation.json +1919 -0
- package/.cache/admin/public/locales/sl/translation.json +2010 -0
- package/.cache/admin/public/locales/tm/translation.json +1924 -0
- package/.cache/admin/public/locales/uk/translation.json +1919 -0
- package/.cache/admin/public/locales/vi/translation.json +2011 -0
- package/.cache/admin/public/locales/zh/translation.json +2011 -0
- package/.cache/admin/public/logo.svg +10 -0
- package/.cache/admin/src/App.tsx +61 -0
- package/.cache/admin/src/assets/styles/emoji-picker.css +109 -0
- package/.cache/admin/src/assets/styles/global.css +465 -0
- package/.cache/admin/src/assets/svg/carrot.svg +5 -0
- package/.cache/admin/src/assets/svg/controller.svg +7 -0
- package/.cache/admin/src/assets/svg/flag.svg +4 -0
- package/.cache/admin/src/assets/svg/happy.svg +6 -0
- package/.cache/admin/src/assets/svg/heart.svg +3 -0
- package/.cache/admin/src/assets/svg/lightbulb.svg +5 -0
- package/.cache/admin/src/assets/svg/plane.svg +3 -0
- package/.cache/admin/src/assets/svg/search.svg +3 -0
- package/.cache/admin/src/assets/svg/sprout.svg +6 -0
- package/.cache/admin/src/assets/svg/star.svg +3 -0
- package/.cache/admin/src/components/atoms/avatar/index.tsx +62 -0
- package/.cache/admin/src/components/atoms/back-button/index.tsx +32 -0
- package/.cache/admin/src/components/atoms/checkbox/index.tsx +32 -0
- package/.cache/admin/src/components/atoms/copy-to-clipboard/index.tsx +59 -0
- package/.cache/admin/src/components/atoms/date-picker/custom-header.tsx +44 -0
- package/.cache/admin/src/components/atoms/date-picker/date-picker.tsx +155 -0
- package/.cache/admin/src/components/atoms/date-picker/time-picker.tsx +103 -0
- package/.cache/admin/src/components/atoms/date-picker/types.tsx +6 -0
- package/.cache/admin/src/components/atoms/date-picker/utils.ts +25 -0
- package/.cache/admin/src/components/atoms/fade-wrapper/index.tsx +47 -0
- package/.cache/admin/src/components/atoms/file-upload-field/index.tsx +105 -0
- package/.cache/admin/src/components/atoms/includes-tax-tooltip/index.tsx +25 -0
- package/.cache/admin/src/components/atoms/input-error/index.tsx +72 -0
- package/.cache/admin/src/components/atoms/loading-container/index.tsx +32 -0
- package/.cache/admin/src/components/atoms/notification/index.tsx +62 -0
- package/.cache/admin/src/components/atoms/number-scroller/index.tsx +51 -0
- package/.cache/admin/src/components/atoms/os-shortcut/index.tsx +48 -0
- package/.cache/admin/src/components/atoms/page-description/index.tsx +20 -0
- package/.cache/admin/src/components/atoms/save-notification/error-state.tsx +49 -0
- package/.cache/admin/src/components/atoms/save-notification/index.tsx +94 -0
- package/.cache/admin/src/components/atoms/save-notification/saving-state.tsx +30 -0
- package/.cache/admin/src/components/atoms/save-notification/success-state.tsx +49 -0
- package/.cache/admin/src/components/atoms/settings-card/index.tsx +58 -0
- package/.cache/admin/src/components/atoms/skeleton/index.tsx +25 -0
- package/.cache/admin/src/components/atoms/spacer/index.tsx +9 -0
- package/.cache/admin/src/components/atoms/spinner.tsx +35 -0
- package/.cache/admin/src/components/atoms/switch/index.tsx +30 -0
- package/.cache/admin/src/components/atoms/text-input/index.tsx +19 -0
- package/.cache/admin/src/components/atoms/thumbnail/index.ts +1 -0
- package/.cache/admin/src/components/atoms/thumbnail/thumbnail.tsx +31 -0
- package/.cache/admin/src/components/atoms/toaster-container/index.tsx +33 -0
- package/.cache/admin/src/components/atoms/tooltip/index.tsx +61 -0
- package/.cache/admin/src/components/atoms/two-step-delete/index.tsx +110 -0
- package/.cache/admin/src/components/declarative-toaster/index.tsx +23 -0
- package/.cache/admin/src/components/extensions/route-container/index.tsx +80 -0
- package/.cache/admin/src/components/extensions/route-container/route-error-element.tsx +75 -0
- package/.cache/admin/src/components/extensions/route-container/use-route-container-props.tsx +8 -0
- package/.cache/admin/src/components/extensions/setting-container/index.tsx +14 -0
- package/.cache/admin/src/components/extensions/setting-container/setting-error-element.tsx +77 -0
- package/.cache/admin/src/components/extensions/setting-container/use-setting-container-props.tsx +7 -0
- package/.cache/admin/src/components/extensions/widget-container/index.tsx +32 -0
- package/.cache/admin/src/components/extensions/widget-container/types.ts +77 -0
- package/.cache/admin/src/components/extensions/widget-container/use-widget-container-props.tsx +31 -0
- package/.cache/admin/src/components/extensions/widget-container/widget-error-boundary.tsx +136 -0
- package/.cache/admin/src/components/forms/customer-group/customer-group-general-form/index.tsx +34 -0
- package/.cache/admin/src/components/forms/discount/discount-conditions-form/index.tsx +0 -0
- package/.cache/admin/src/components/forms/discount/discount-configuration-form/index.tsx +159 -0
- package/.cache/admin/src/components/forms/discount/discount-general-form/index.tsx +192 -0
- package/.cache/admin/src/components/forms/general/address-contact-form/index.tsx +87 -0
- package/.cache/admin/src/components/forms/general/address-location-form/index.tsx +129 -0
- package/.cache/admin/src/components/forms/general/metadata-form/index.tsx +371 -0
- package/.cache/admin/src/components/forms/general/prices-form/price-form-input.tsx +92 -0
- package/.cache/admin/src/components/forms/gift-card/denomination-form/index.tsx +183 -0
- package/.cache/admin/src/components/forms/gift-card/gift-card-balance-form/index.tsx +67 -0
- package/.cache/admin/src/components/forms/gift-card/gift-card-ends-at-form/index.tsx +57 -0
- package/.cache/admin/src/components/forms/gift-card/gift-card-receiver-form/index.tsx +43 -0
- package/.cache/admin/src/components/forms/gift-card/gift-card-region-form/index.tsx +78 -0
- package/.cache/admin/src/components/forms/product/customs-form/index.tsx +75 -0
- package/.cache/admin/src/components/forms/product/dimensions-form/index.tsx +74 -0
- package/.cache/admin/src/components/forms/product/discountable-form/index.tsx +36 -0
- package/.cache/admin/src/components/forms/product/general-form/index.tsx +109 -0
- package/.cache/admin/src/components/forms/product/media-form/index.tsx +233 -0
- package/.cache/admin/src/components/forms/product/organize-form/index.tsx +131 -0
- package/.cache/admin/src/components/forms/product/organize-form/use-organize-data.tsx +63 -0
- package/.cache/admin/src/components/forms/product/sales-channels-modal/add-screen.tsx +132 -0
- package/.cache/admin/src/components/forms/product/sales-channels-modal/available-screen.tsx +89 -0
- package/.cache/admin/src/components/forms/product/sales-channels-modal/index.tsx +55 -0
- package/.cache/admin/src/components/forms/product/sales-channels-modal/table.tsx +227 -0
- package/.cache/admin/src/components/forms/product/sales-channels-modal/use-sales-channels-modal.tsx +23 -0
- package/.cache/admin/src/components/forms/product/thumbnail-form/index.tsx +113 -0
- package/.cache/admin/src/components/forms/product/variant-form/create-flow-variant-form/index.tsx +105 -0
- package/.cache/admin/src/components/forms/product/variant-form/edit-flow-variant-form/index.tsx +137 -0
- package/.cache/admin/src/components/forms/product/variant-form/variant-general-form/index.tsx +50 -0
- package/.cache/admin/src/components/forms/product/variant-form/variant-select-options-form/hooks.tsx +74 -0
- package/.cache/admin/src/components/forms/product/variant-form/variant-select-options-form/index.tsx +77 -0
- package/.cache/admin/src/components/forms/product/variant-form/variant-stock-form/index.tsx +241 -0
- package/.cache/admin/src/components/forms/product/variant-inventory-form/edit-flow-variant-form/index.tsx +44 -0
- package/.cache/admin/src/components/forms/product/variant-inventory-form/variant-stock-form/index.tsx +429 -0
- package/.cache/admin/src/components/fundamentals/badge/index.tsx +46 -0
- package/.cache/admin/src/components/fundamentals/button/index.tsx +79 -0
- package/.cache/admin/src/components/fundamentals/details-icon/contact.svg +7 -0
- package/.cache/admin/src/components/fundamentals/details-icon/index.tsx +57 -0
- package/.cache/admin/src/components/fundamentals/feature-toggle.tsx +21 -0
- package/.cache/admin/src/components/fundamentals/icon-badge/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/adjustments-icon.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/alert-icon/index.tsx +43 -0
- package/.cache/admin/src/components/fundamentals/icons/arrow-down-icon.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/arrow-left-icon/index.tsx +35 -0
- package/.cache/admin/src/components/fundamentals/icons/arrow-right-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/arrow-top-right-icon/index.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/arrow-up-icon.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/arrow-uturn-left/index.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/back-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/backspace-icon/index.tsx +42 -0
- package/.cache/admin/src/components/fundamentals/icons/bell-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/bell-noti-icon/index.tsx +41 -0
- package/.cache/admin/src/components/fundamentals/icons/bell-off-icon/index.tsx +57 -0
- package/.cache/admin/src/components/fundamentals/icons/building-tax-icon.tsx +67 -0
- package/.cache/admin/src/components/fundamentals/icons/buildings-icon/index.tsx +64 -0
- package/.cache/admin/src/components/fundamentals/icons/calendar-icon.tsx +54 -0
- package/.cache/admin/src/components/fundamentals/icons/cancel-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/cart-icon/index.tsx +49 -0
- package/.cache/admin/src/components/fundamentals/icons/cash-icon/index.tsx +99 -0
- package/.cache/admin/src/components/fundamentals/icons/channels-icon.tsx +65 -0
- package/.cache/admin/src/components/fundamentals/icons/check-circle-fill-icon/index.tsx +28 -0
- package/.cache/admin/src/components/fundamentals/icons/check-circle-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/check-icon.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/chevron-down.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/chevron-left-icon/index.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/chevron-right-icon/index.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/chevron-up.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/circle-quarter-solid/index.tsx +24 -0
- package/.cache/admin/src/components/fundamentals/icons/clipboard-copy-icon/index.tsx +50 -0
- package/.cache/admin/src/components/fundamentals/icons/clock-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/coins-icon/index.tsx +50 -0
- package/.cache/admin/src/components/fundamentals/icons/corner-down-right-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/cross-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/crosshair-icon/index.tsx +57 -0
- package/.cache/admin/src/components/fundamentals/icons/customer-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/details-icon.tsx +57 -0
- package/.cache/admin/src/components/fundamentals/icons/discord-icon.tsx +26 -0
- package/.cache/admin/src/components/fundamentals/icons/dollar-sign-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/down-left/index.tsx +34 -0
- package/.cache/admin/src/components/fundamentals/icons/download-icon.tsx +42 -0
- package/.cache/admin/src/components/fundamentals/icons/duplicate-icon.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/edit-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/edit-icon.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/ellipsis-vertical-icon/index.tsx +26 -0
- package/.cache/admin/src/components/fundamentals/icons/export-icon/index.tsx +43 -0
- package/.cache/admin/src/components/fundamentals/icons/eye-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/eye-off-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/fast-delivery-icon/index.tsx +64 -0
- package/.cache/admin/src/components/fundamentals/icons/file-icon.tsx +55 -0
- package/.cache/admin/src/components/fundamentals/icons/folder-open-icon/index.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/gear-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/gift-icon/index.tsx +57 -0
- package/.cache/admin/src/components/fundamentals/icons/grip-icon.tsx +64 -0
- package/.cache/admin/src/components/fundamentals/icons/happy-icon/index.tsx +50 -0
- package/.cache/admin/src/components/fundamentals/icons/help-circle.tsx +43 -0
- package/.cache/admin/src/components/fundamentals/icons/image-placeholder-icon/index.tsx +43 -0
- package/.cache/admin/src/components/fundamentals/icons/info-icon/index.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/key-icon.tsx +30 -0
- package/.cache/admin/src/components/fundamentals/icons/list-arrow-icon/index.tsx +57 -0
- package/.cache/admin/src/components/fundamentals/icons/list-icon.tsx +64 -0
- package/.cache/admin/src/components/fundamentals/icons/lock-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/log-out-icon/index.tsx +43 -0
- package/.cache/admin/src/components/fundamentals/icons/long-arrow-right-icon/index.tsx +38 -0
- package/.cache/admin/src/components/fundamentals/icons/mail-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/map-pin-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/medusa-icon/index.tsx +27 -0
- package/.cache/admin/src/components/fundamentals/icons/medusa-vice/index.tsx +39 -0
- package/.cache/admin/src/components/fundamentals/icons/minus-icon/index.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/more-horizontal-icon.tsx +43 -0
- package/.cache/admin/src/components/fundamentals/icons/package-icon/index.tsx +50 -0
- package/.cache/admin/src/components/fundamentals/icons/percent-icon/index.tsx +43 -0
- package/.cache/admin/src/components/fundamentals/icons/plus-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/pointer-icon/index.tsx +35 -0
- package/.cache/admin/src/components/fundamentals/icons/publish-icon/index.tsx +57 -0
- package/.cache/admin/src/components/fundamentals/icons/refresh-icon.tsx +50 -0
- package/.cache/admin/src/components/fundamentals/icons/refund.tsx +57 -0
- package/.cache/admin/src/components/fundamentals/icons/reorder-icon/index.tsx +64 -0
- package/.cache/admin/src/components/fundamentals/icons/sad-face-icon/index.tsx +50 -0
- package/.cache/admin/src/components/fundamentals/icons/sale-icon/index.tsx +50 -0
- package/.cache/admin/src/components/fundamentals/icons/search-icon/index.tsx +27 -0
- package/.cache/admin/src/components/fundamentals/icons/send-icon/index.tsx +33 -0
- package/.cache/admin/src/components/fundamentals/icons/sided-mouth-face/index.tsx +50 -0
- package/.cache/admin/src/components/fundamentals/icons/sorting-icon/index.tsx +54 -0
- package/.cache/admin/src/components/fundamentals/icons/sparkles-icon/index.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/squares-plus/index.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/stop-icon.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/swatch-icon/index.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/tag-dot-icon/index.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/tag-icon/index.tsx +36 -0
- package/.cache/admin/src/components/fundamentals/icons/taxes-icon.tsx +54 -0
- package/.cache/admin/src/components/fundamentals/icons/tile-icon.tsx +50 -0
- package/.cache/admin/src/components/fundamentals/icons/trash-icon.tsx +50 -0
- package/.cache/admin/src/components/fundamentals/icons/triangle-mini-icon/index.tsx +28 -0
- package/.cache/admin/src/components/fundamentals/icons/triangle-right-icon/index.tsx +28 -0
- package/.cache/admin/src/components/fundamentals/icons/truck-icon/index.tsx +43 -0
- package/.cache/admin/src/components/fundamentals/icons/types/icon-type.ts +8 -0
- package/.cache/admin/src/components/fundamentals/icons/u-turn-icon.tsx +29 -0
- package/.cache/admin/src/components/fundamentals/icons/unpublish-icon/index.tsx +57 -0
- package/.cache/admin/src/components/fundamentals/icons/upload-icon/index.tsx +43 -0
- package/.cache/admin/src/components/fundamentals/icons/users-icon/index.tsx +50 -0
- package/.cache/admin/src/components/fundamentals/icons/warning-circle.tsx +81 -0
- package/.cache/admin/src/components/fundamentals/icons/x-circle-icon.tsx +43 -0
- package/.cache/admin/src/components/fundamentals/image-placeholder.tsx +11 -0
- package/.cache/admin/src/components/fundamentals/input-container.tsx +37 -0
- package/.cache/admin/src/components/fundamentals/input-header.tsx +38 -0
- package/.cache/admin/src/components/fundamentals/status-indicator/index.tsx +36 -0
- package/.cache/admin/src/components/helpers/form/form.tsx +187 -0
- package/.cache/admin/src/components/helpers/form/index.ts +1 -0
- package/.cache/admin/src/components/molecules/actionables.tsx +115 -0
- package/.cache/admin/src/components/molecules/activity-card/index.tsx +68 -0
- package/.cache/admin/src/components/molecules/amount-input/amount-and-currency-input.tsx +134 -0
- package/.cache/admin/src/components/molecules/amount-input/amount-input.tsx +91 -0
- package/.cache/admin/src/components/molecules/amount-input/index.ts +4 -0
- package/.cache/admin/src/components/molecules/availability-duration/index.tsx +86 -0
- package/.cache/admin/src/components/molecules/banner-card/index.tsx +74 -0
- package/.cache/admin/src/components/molecules/batch-job-file-card/index.tsx +67 -0
- package/.cache/admin/src/components/molecules/collapsible-tree/index.tsx +186 -0
- package/.cache/admin/src/components/molecules/connected-form.tsx +20 -0
- package/.cache/admin/src/components/molecules/customer-avatar-item/index.tsx +34 -0
- package/.cache/admin/src/components/molecules/customers-groups-summary/index.tsx +33 -0
- package/.cache/admin/src/components/molecules/delimited-list/index.tsx +44 -0
- package/.cache/admin/src/components/molecules/emoji-picker/index.tsx +41 -0
- package/.cache/admin/src/components/molecules/filter-dropdown/container.tsx +99 -0
- package/.cache/admin/src/components/molecules/filter-dropdown/item.tsx +556 -0
- package/.cache/admin/src/components/molecules/filter-dropdown/save-field.tsx +48 -0
- package/.cache/admin/src/components/molecules/filter-menu/filter-menu.tsx +496 -0
- package/.cache/admin/src/components/molecules/filter-menu/index.ts +1 -0
- package/.cache/admin/src/components/molecules/filter-tab/index.tsx +62 -0
- package/.cache/admin/src/components/molecules/form-error-toaster/index.tsx +41 -0
- package/.cache/admin/src/components/molecules/form-toaster/index.tsx +177 -0
- package/.cache/admin/src/components/molecules/generating-input/index.tsx +93 -0
- package/.cache/admin/src/components/molecules/grid-input/index.tsx +15 -0
- package/.cache/admin/src/components/molecules/hot-key-action/index.tsx +23 -0
- package/.cache/admin/src/components/molecules/icon-tooltip/index.tsx +36 -0
- package/.cache/admin/src/components/molecules/indeterminate-checkbox/index.tsx +84 -0
- package/.cache/admin/src/components/molecules/input/index.tsx +165 -0
- package/.cache/admin/src/components/molecules/input-signin/index.tsx +101 -0
- package/.cache/admin/src/components/molecules/item-search/index.tsx +110 -0
- package/.cache/admin/src/components/molecules/json-view/index.tsx +94 -0
- package/.cache/admin/src/components/molecules/location-dropdown/index.tsx +50 -0
- package/.cache/admin/src/components/molecules/modal/focus-modal.tsx +114 -0
- package/.cache/admin/src/components/molecules/modal/index.tsx +167 -0
- package/.cache/admin/src/components/molecules/modal/layered-modal.tsx +163 -0
- package/.cache/admin/src/components/molecules/modal/side-modal.tsx +63 -0
- package/.cache/admin/src/components/molecules/modal/stepped-modal.tsx +227 -0
- package/.cache/admin/src/components/molecules/native-select/index.tsx +68 -0
- package/.cache/admin/src/components/molecules/note-input/index.tsx +76 -0
- package/.cache/admin/src/components/molecules/notification-bell/index.tsx +21 -0
- package/.cache/admin/src/components/molecules/numbered-item/index.tsx +52 -0
- package/.cache/admin/src/components/molecules/order-status/index.tsx +113 -0
- package/.cache/admin/src/components/molecules/rma-select-shipping/index.tsx +54 -0
- package/.cache/admin/src/components/molecules/sales-channels-display/index.tsx +82 -0
- package/.cache/admin/src/components/molecules/sales-channels-list/index.tsx +46 -0
- package/.cache/admin/src/components/molecules/sales-channels-summary/index.tsx +39 -0
- package/.cache/admin/src/components/molecules/search-bar.tsx +49 -0
- package/.cache/admin/src/components/molecules/section/index.tsx +32 -0
- package/.cache/admin/src/components/molecules/select/index.tsx +240 -0
- package/.cache/admin/src/components/molecules/select/next-select/components/containers.tsx +190 -0
- package/.cache/admin/src/components/molecules/select/next-select/components/control.tsx +149 -0
- package/.cache/admin/src/components/molecules/select/next-select/components/index.ts +39 -0
- package/.cache/admin/src/components/molecules/select/next-select/components/input.tsx +36 -0
- package/.cache/admin/src/components/molecules/select/next-select/components/menu.tsx +344 -0
- package/.cache/admin/src/components/molecules/select/next-select/components/multi-value.tsx +118 -0
- package/.cache/admin/src/components/molecules/select/next-select/components/placeholder.tsx +32 -0
- package/.cache/admin/src/components/molecules/select/next-select/components/select-primitives.ts +3 -0
- package/.cache/admin/src/components/molecules/select/next-select/components/single-value.tsx +74 -0
- package/.cache/admin/src/components/molecules/select/next-select/createable-select/index.tsx +40 -0
- package/.cache/admin/src/components/molecules/select/next-select/index.tsx +4 -0
- package/.cache/admin/src/components/molecules/select/next-select/module-augmentation.ts +74 -0
- package/.cache/admin/src/components/molecules/select/next-select/select/index.tsx +63 -0
- package/.cache/admin/src/components/molecules/select/next-select/use-select-props.tsx +85 -0
- package/.cache/admin/src/components/molecules/select/next-select/utils.tsx +83 -0
- package/.cache/admin/src/components/molecules/select/select-components.tsx +313 -0
- package/.cache/admin/src/components/molecules/shipping-option/index.tsx +70 -0
- package/.cache/admin/src/components/molecules/sidebar-company-logo/index.tsx +20 -0
- package/.cache/admin/src/components/molecules/sidebar-menu-item/index.tsx +80 -0
- package/.cache/admin/src/components/molecules/sidebar-team-member/index.tsx +28 -0
- package/.cache/admin/src/components/molecules/status-selector/index.tsx +55 -0
- package/.cache/admin/src/components/molecules/switchable-item/index.tsx +55 -0
- package/.cache/admin/src/components/molecules/table/filtering-option.tsx +96 -0
- package/.cache/admin/src/components/molecules/table/index.tsx +265 -0
- package/.cache/admin/src/components/molecules/table/table-search.tsx +47 -0
- package/.cache/admin/src/components/molecules/table-fileds-filter/index.tsx +200 -0
- package/.cache/admin/src/components/molecules/table-pagination/index.ts +1 -0
- package/.cache/admin/src/components/molecules/table-pagination/table-pagination.tsx +77 -0
- package/.cache/admin/src/components/molecules/table-toaster/index.tsx +27 -0
- package/.cache/admin/src/components/molecules/tag-grid/index.tsx +38 -0
- package/.cache/admin/src/components/molecules/tag-input/index.tsx +232 -0
- package/.cache/admin/src/components/molecules/textarea/index.tsx +114 -0
- package/.cache/admin/src/components/molecules/timeline-events/claim-event/index.tsx +267 -0
- package/.cache/admin/src/components/molecules/timeline-events/event-actionables.tsx +20 -0
- package/.cache/admin/src/components/molecules/timeline-events/event-container.tsx +108 -0
- package/.cache/admin/src/components/molecules/timeline-events/event-item-container.tsx +48 -0
- package/.cache/admin/src/components/molecules/timeline-events/event-type.ts +5 -0
- package/.cache/admin/src/components/molecules/timeline-events/exchange.tsx +336 -0
- package/.cache/admin/src/components/molecules/timeline-events/items-fulfilled.tsx +38 -0
- package/.cache/admin/src/components/molecules/timeline-events/items-shipped.tsx +37 -0
- package/.cache/admin/src/components/molecules/timeline-events/note.tsx +73 -0
- package/.cache/admin/src/components/molecules/timeline-events/notification/index.tsx +66 -0
- package/.cache/admin/src/components/molecules/timeline-events/notification/resend-modal.tsx +99 -0
- package/.cache/admin/src/components/molecules/timeline-events/order-canceled.tsx +20 -0
- package/.cache/admin/src/components/molecules/timeline-events/order-edit/canceled.tsx +26 -0
- package/.cache/admin/src/components/molecules/timeline-events/order-edit/confirmed.tsx +40 -0
- package/.cache/admin/src/components/molecules/timeline-events/order-edit/created.tsx +289 -0
- package/.cache/admin/src/components/molecules/timeline-events/order-edit/declined.tsx +46 -0
- package/.cache/admin/src/components/molecules/timeline-events/order-edit/index.tsx +27 -0
- package/.cache/admin/src/components/molecules/timeline-events/order-edit/payment-required.tsx +77 -0
- package/.cache/admin/src/components/molecules/timeline-events/order-edit/refund-required.tsx +73 -0
- package/.cache/admin/src/components/molecules/timeline-events/order-edit/requested.tsx +62 -0
- package/.cache/admin/src/components/molecules/timeline-events/order-placed.tsx +29 -0
- package/.cache/admin/src/components/molecules/timeline-events/refund.tsx +43 -0
- package/.cache/admin/src/components/molecules/timeline-events/return.tsx +151 -0
- package/.cache/admin/src/components/molecules/tooltip-icon/index.tsx +20 -0
- package/.cache/admin/src/components/molecules/user-menu/index.tsx +76 -0
- package/.cache/admin/src/components/organisms/accordion/index.tsx +113 -0
- package/.cache/admin/src/components/organisms/activity-drawer/index.tsx +87 -0
- package/.cache/admin/src/components/organisms/analytics-config-form/index.tsx +125 -0
- package/.cache/admin/src/components/organisms/analytics-preferences/index.tsx +150 -0
- package/.cache/admin/src/components/organisms/batch-jobs-activity-list/index.tsx +255 -0
- package/.cache/admin/src/components/organisms/batch-jobs-activity-list/utils.ts +43 -0
- package/.cache/admin/src/components/organisms/body-card.tsx +133 -0
- package/.cache/admin/src/components/organisms/confirmation-prompt.tsx +71 -0
- package/.cache/admin/src/components/organisms/currency-input/index.tsx +303 -0
- package/.cache/admin/src/components/organisms/custom-table-header/index.tsx +37 -0
- package/.cache/admin/src/components/organisms/delete-prompt.tsx +96 -0
- package/.cache/admin/src/components/organisms/details-collapsible/index.tsx +60 -0
- package/.cache/admin/src/components/organisms/edit-user-modal/index.tsx +145 -0
- package/.cache/admin/src/components/organisms/error-boundary/index.tsx +203 -0
- package/.cache/admin/src/components/organisms/export-modal/index.tsx +64 -0
- package/.cache/admin/src/components/organisms/file-upload-modal/index.tsx +36 -0
- package/.cache/admin/src/components/organisms/gift-card-banner/index.tsx +104 -0
- package/.cache/admin/src/components/organisms/gift-card-denominations-section/add-denominations-modal.tsx +198 -0
- package/.cache/admin/src/components/organisms/gift-card-denominations-section/denominations-table.tsx +75 -0
- package/.cache/admin/src/components/organisms/gift-card-denominations-section/edit-denominations-modal.tsx +211 -0
- package/.cache/admin/src/components/organisms/gift-card-denominations-section/index.tsx +56 -0
- package/.cache/admin/src/components/organisms/gift-card-denominations-section/use-denominations-columns.tsx +207 -0
- package/.cache/admin/src/components/organisms/help-dialog/index.tsx +103 -0
- package/.cache/admin/src/components/organisms/invite-modal/index.tsx +136 -0
- package/.cache/admin/src/components/organisms/login-card/index.tsx +119 -0
- package/.cache/admin/src/components/organisms/medusa-price-input/index.tsx +53 -0
- package/.cache/admin/src/components/organisms/metadata/index.tsx +150 -0
- package/.cache/admin/src/components/organisms/price-input/index.tsx +64 -0
- package/.cache/admin/src/components/organisms/product-attributes-section/attribute-modal.tsx +153 -0
- package/.cache/admin/src/components/organisms/product-attributes-section/index.tsx +98 -0
- package/.cache/admin/src/components/organisms/product-general-section/channels-modal.tsx +54 -0
- package/.cache/admin/src/components/organisms/product-general-section/general-modal.tsx +185 -0
- package/.cache/admin/src/components/organisms/product-general-section/index.tsx +217 -0
- package/.cache/admin/src/components/organisms/product-media-section/index.tsx +51 -0
- package/.cache/admin/src/components/organisms/product-media-section/media-modal.tsx +151 -0
- package/.cache/admin/src/components/organisms/product-raw-section/index.tsx +28 -0
- package/.cache/admin/src/components/organisms/product-thumbnail-section/index.tsx +96 -0
- package/.cache/admin/src/components/organisms/product-thumbnail-section/thumbnail-modal.tsx +158 -0
- package/.cache/admin/src/components/organisms/product-variant-tree/index.tsx +89 -0
- package/.cache/admin/src/components/organisms/product-variants-section/add-variant-modal.tsx +214 -0
- package/.cache/admin/src/components/organisms/product-variants-section/edit-prices-modal/currency-cell.tsx +243 -0
- package/.cache/admin/src/components/organisms/product-variants-section/edit-prices-modal/edit-prices-actions.tsx +106 -0
- package/.cache/admin/src/components/organisms/product-variants-section/edit-prices-modal/edit-prices-table.tsx +842 -0
- package/.cache/admin/src/components/organisms/product-variants-section/edit-prices-modal/index.tsx +387 -0
- package/.cache/admin/src/components/organisms/product-variants-section/edit-prices-modal/save-prompt.tsx +111 -0
- package/.cache/admin/src/components/organisms/product-variants-section/edit-prices-modal/utils.ts +84 -0
- package/.cache/admin/src/components/organisms/product-variants-section/edit-variant-inventory-modal.tsx +354 -0
- package/.cache/admin/src/components/organisms/product-variants-section/edit-variant-modal.tsx +217 -0
- package/.cache/admin/src/components/organisms/product-variants-section/edit-variants-modal/edit-variant-screen.tsx +153 -0
- package/.cache/admin/src/components/organisms/product-variants-section/edit-variants-modal/index.tsx +204 -0
- package/.cache/admin/src/components/organisms/product-variants-section/edit-variants-modal/use-edit-variants-modal.tsx +20 -0
- package/.cache/admin/src/components/organisms/product-variants-section/edit-variants-modal/variant-card.tsx +170 -0
- package/.cache/admin/src/components/organisms/product-variants-section/index.tsx +241 -0
- package/.cache/admin/src/components/organisms/product-variants-section/options-modal.tsx +273 -0
- package/.cache/admin/src/components/organisms/product-variants-section/options-provider.tsx +47 -0
- package/.cache/admin/src/components/organisms/product-variants-section/table.tsx +234 -0
- package/.cache/admin/src/components/organisms/radio-group/index.tsx +174 -0
- package/.cache/admin/src/components/organisms/raw-json/index.tsx +38 -0
- package/.cache/admin/src/components/organisms/reset-token-card/index.tsx +129 -0
- package/.cache/admin/src/components/organisms/rma-return-product-table/index.tsx +120 -0
- package/.cache/admin/src/components/organisms/rma-select-product-table/index.tsx +316 -0
- package/.cache/admin/src/components/organisms/section/index.tsx +52 -0
- package/.cache/admin/src/components/organisms/sidebar/index.tsx +142 -0
- package/.cache/admin/src/components/organisms/table-container/index.tsx +50 -0
- package/.cache/admin/src/components/organisms/table-container/pagination.tsx +86 -0
- package/.cache/admin/src/components/organisms/table-container/types.ts +12 -0
- package/.cache/admin/src/components/organisms/timeline/index.tsx +224 -0
- package/.cache/admin/src/components/organisms/topbar/index.tsx +62 -0
- package/.cache/admin/src/components/organisms/upload-modal/index.tsx +326 -0
- package/.cache/admin/src/components/private-route/index.tsx +31 -0
- package/.cache/admin/src/components/seo/index.tsx +80 -0
- package/.cache/admin/src/components/templates/add-products-modal/index.tsx +117 -0
- package/.cache/admin/src/components/templates/add-products-modal/product-table-config.tsx +106 -0
- package/.cache/admin/src/components/templates/add-products-modal/utils.ts +32 -0
- package/.cache/admin/src/components/templates/address-form.tsx +191 -0
- package/.cache/admin/src/components/templates/collection-modal/index.tsx +237 -0
- package/.cache/admin/src/components/templates/collection-product-table/add-product-table.tsx +240 -0
- package/.cache/admin/src/components/templates/collection-product-table/index.tsx +198 -0
- package/.cache/admin/src/components/templates/collection-product-table/types.ts +11 -0
- package/.cache/admin/src/components/templates/collection-product-table/use-collection-product-columns.tsx +48 -0
- package/.cache/admin/src/components/templates/collection-product-table/use-sorting-options.tsx +89 -0
- package/.cache/admin/src/components/templates/collection-product-table/use-view-product-columns.tsx +59 -0
- package/.cache/admin/src/components/templates/collection-product-table/utils.tsx +64 -0
- package/.cache/admin/src/components/templates/collection-product-table/view-products-table.tsx +205 -0
- package/.cache/admin/src/components/templates/collections-table/index.tsx +192 -0
- package/.cache/admin/src/components/templates/collections-table/use-collection-actions.tsx +48 -0
- package/.cache/admin/src/components/templates/collections-table/use-collection-column.tsx +54 -0
- package/.cache/admin/src/components/templates/customer-group-table/config.tsx +105 -0
- package/.cache/admin/src/components/templates/customer-group-table/customer-groups-table.tsx +295 -0
- package/.cache/admin/src/components/templates/customer-group-table/customers-list-table.tsx +240 -0
- package/.cache/admin/src/components/templates/customer-group-table/edit-customers-table.tsx +252 -0
- package/.cache/admin/src/components/templates/customer-orders-table/index.tsx +159 -0
- package/.cache/admin/src/components/templates/customer-orders-table/use-customer-orders-columns.tsx +221 -0
- package/.cache/admin/src/components/templates/customer-table/index.tsx +208 -0
- package/.cache/admin/src/components/templates/customer-table/use-customer-columns.tsx +54 -0
- package/.cache/admin/src/components/templates/customer-table/use-customer-filters.tsx +213 -0
- package/.cache/admin/src/components/templates/discount-filter-dropdown/index.tsx +142 -0
- package/.cache/admin/src/components/templates/discount-table/index.tsx +239 -0
- package/.cache/admin/src/components/templates/discount-table/use-copy-promotion.tsx +87 -0
- package/.cache/admin/src/components/templates/discount-table/use-promotion-columns.tsx +186 -0
- package/.cache/admin/src/components/templates/discount-table/use-promotion-filters.tsx +519 -0
- package/.cache/admin/src/components/templates/discount-table/use-promotion-row-actions.tsx +103 -0
- package/.cache/admin/src/components/templates/draft-order-table/index.tsx +168 -0
- package/.cache/admin/src/components/templates/draft-order-table/use-draft-order-column.tsx +94 -0
- package/.cache/admin/src/components/templates/draft-order-table/use-draft-order-filters.ts +213 -0
- package/.cache/admin/src/components/templates/gift-card-filter-dropdown/index.tsx +188 -0
- package/.cache/admin/src/components/templates/gift-card-table/index.tsx +199 -0
- package/.cache/admin/src/components/templates/gift-card-table/use-gift-card-column.tsx +113 -0
- package/.cache/admin/src/components/templates/gift-card-table/use-gift-card-filters.ts +591 -0
- package/.cache/admin/src/components/templates/image-table/index.tsx +165 -0
- package/.cache/admin/src/components/templates/inventory-table/index.tsx +499 -0
- package/.cache/admin/src/components/templates/inventory-table/use-inventory-column.tsx +111 -0
- package/.cache/admin/src/components/templates/inventory-table/use-inventory-filters.ts +467 -0
- package/.cache/admin/src/components/templates/layout.tsx +30 -0
- package/.cache/admin/src/components/templates/login-layout.tsx +62 -0
- package/.cache/admin/src/components/templates/order-filter-dropdown/index.tsx +263 -0
- package/.cache/admin/src/components/templates/order-table/index.tsx +243 -0
- package/.cache/admin/src/components/templates/order-table/use-order-column.tsx +155 -0
- package/.cache/admin/src/components/templates/order-table/use-order-filters.ts +644 -0
- package/.cache/admin/src/components/templates/price-list-table/price-list-filters.tsx +135 -0
- package/.cache/admin/src/components/templates/price-list-table/price-list-table.tsx +203 -0
- package/.cache/admin/src/components/templates/price-list-table/use-copy-price-list.tsx +69 -0
- package/.cache/admin/src/components/templates/price-list-table/use-price-list-actions.tsx +99 -0
- package/.cache/admin/src/components/templates/price-list-table/use-price-list-columns.tsx +80 -0
- package/.cache/admin/src/components/templates/price-list-table/use-price-list-filters.tsx +495 -0
- package/.cache/admin/src/components/templates/price-list-table/utils.tsx +42 -0
- package/.cache/admin/src/components/templates/price-overrides/index.tsx +232 -0
- package/.cache/admin/src/components/templates/price-overrides/price-amount.tsx +76 -0
- package/.cache/admin/src/components/templates/product-table/index.tsx +271 -0
- package/.cache/admin/src/components/templates/product-table/overview.tsx +106 -0
- package/.cache/admin/src/components/templates/product-table/use-copy-product.ts +208 -0
- package/.cache/admin/src/components/templates/product-table/use-filter-tabs.tsx +487 -0
- package/.cache/admin/src/components/templates/product-table/use-product-actions.tsx +133 -0
- package/.cache/admin/src/components/templates/product-table/use-product-column.tsx +146 -0
- package/.cache/admin/src/components/templates/product-table/use-product-filters.ts +604 -0
- package/.cache/admin/src/components/templates/reservations-table/components/reservation-form/index.tsx +172 -0
- package/.cache/admin/src/components/templates/reservations-table/components/reservations-filter/index.tsx +906 -0
- package/.cache/admin/src/components/templates/reservations-table/index.tsx +442 -0
- package/.cache/admin/src/components/templates/reservations-table/new/index.tsx +133 -0
- package/.cache/admin/src/components/templates/reservations-table/use-reservation-filters.ts +331 -0
- package/.cache/admin/src/components/templates/reservations-table/use-reservations-columns.tsx +47 -0
- package/.cache/admin/src/components/templates/search-modal/index.tsx +168 -0
- package/.cache/admin/src/components/templates/search-modal/keyboard-shortcuts.tsx +47 -0
- package/.cache/admin/src/components/templates/search-modal/results/customer-results.tsx +68 -0
- package/.cache/admin/src/components/templates/search-modal/results/discount-results.tsx +63 -0
- package/.cache/admin/src/components/templates/search-modal/results/order-results.tsx +62 -0
- package/.cache/admin/src/components/templates/search-modal/results/product-results.tsx +68 -0
- package/.cache/admin/src/components/templates/search-modal/section-collapsible.tsx +28 -0
- package/.cache/admin/src/components/templates/search-modal/use-keyboard-navigation-list.tsx +117 -0
- package/.cache/admin/src/components/templates/selectable-table/index.tsx +211 -0
- package/.cache/admin/src/components/templates/settings-overview.tsx +25 -0
- package/.cache/admin/src/components/templates/transfer-orders-modal/index.tsx +263 -0
- package/.cache/admin/src/components/templates/two-split-pane.tsx +54 -0
- package/.cache/admin/src/components/templates/user-table.tsx +373 -0
- package/.cache/admin/src/constants/analytics.ts +1 -0
- package/.cache/admin/src/constants/forbidden-routes.ts +59 -0
- package/.cache/admin/src/constants/injection-zones.ts +52 -0
- package/.cache/admin/src/constants/medusa-backend-url.ts +2 -0
- package/.cache/admin/src/constants/query-client.ts +11 -0
- package/.cache/admin/src/domain/categories/components/multiselect/index.tsx +401 -0
- package/.cache/admin/src/domain/categories/utils/transform-response.ts +12 -0
- package/.cache/admin/src/domain/collections/details/index.tsx +284 -0
- package/.cache/admin/src/domain/collections/index.tsx +27 -0
- package/.cache/admin/src/domain/customers/details/edit.tsx +187 -0
- package/.cache/admin/src/domain/customers/details/index.tsx +187 -0
- package/.cache/admin/src/domain/customers/groups/customer-group-modal.tsx +191 -0
- package/.cache/admin/src/domain/customers/groups/details.tsx +314 -0
- package/.cache/admin/src/domain/customers/groups/index.tsx +100 -0
- package/.cache/admin/src/domain/customers/header.tsx +28 -0
- package/.cache/admin/src/domain/customers/index.tsx +74 -0
- package/.cache/admin/src/domain/discounts/details/conditions/add-condition/conditions-provider.tsx +198 -0
- package/.cache/admin/src/domain/discounts/details/conditions/add-condition/index.tsx +30 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/add-condition-resources/collections/add-collections.tsx +82 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/add-condition-resources/collections/collections-conditions-table.tsx +82 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/add-condition-resources/customer-groups/add-customer-groups.tsx +83 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/add-condition-resources/customer-groups/customer-groups-conditions-table.tsx +82 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/add-condition-resources/product-types/add-types.tsx +84 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/add-condition-resources/product-types/type-conditions-table.tsx +82 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/add-condition-resources/products/add-products.tsx +79 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/add-condition-resources/products/product-conditions-table.tsx +84 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/add-condition-resources/tags/add-tags.tsx +80 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/add-condition-resources/tags/tags-conditions-table.tsx +80 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/add-conditions-screens.tsx +35 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/condition-table-actions.tsx +78 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/edit-condition-modal.tsx +82 -0
- package/.cache/admin/src/domain/discounts/details/conditions/edit-condition/edit-condition-provider.tsx +148 -0
- package/.cache/admin/src/domain/discounts/details/conditions/index.tsx +84 -0
- package/.cache/admin/src/domain/discounts/details/conditions/use-discount-conditions.tsx +131 -0
- package/.cache/admin/src/domain/discounts/details/configurations/edit-configurations.tsx +134 -0
- package/.cache/admin/src/domain/discounts/details/configurations/index.tsx +62 -0
- package/.cache/admin/src/domain/discounts/details/configurations/use-discount-configurations.tsx +173 -0
- package/.cache/admin/src/domain/discounts/details/general/edit-general.tsx +160 -0
- package/.cache/admin/src/domain/discounts/details/general/index.tsx +207 -0
- package/.cache/admin/src/domain/discounts/details/index.tsx +135 -0
- package/.cache/admin/src/domain/discounts/index.tsx +97 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/add-conditions-modal.tsx +133 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/add-condition-tables/add-condition-footer.tsx +71 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/add-condition-tables/collections.tsx +97 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/add-condition-tables/customer-groups.tsx +93 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/add-condition-tables/products.tsx +89 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/add-condition-tables/tags.tsx +79 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/add-condition-tables/types.tsx +82 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/details-condition-tables/collections.tsx +99 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/details-condition-tables/customer-groups.tsx +93 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/details-condition-tables/details-condition-footer.tsx +64 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/details-condition-tables/products.tsx +89 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/details-condition-tables/tags.tsx +81 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/details-condition-tables/types.tsx +84 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/edit-condition-tables/collections.tsx +95 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/edit-condition-tables/customer-groups.tsx +86 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/edit-condition-tables/edit-condition-footer.tsx +65 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/edit-condition-tables/products.tsx +83 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/edit-condition-tables/tags.tsx +82 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/edit-condition-tables/types.tsx +77 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/shared/collection.tsx +72 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/shared/common.tsx +4 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/shared/condition-operator.tsx +44 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/shared/groups.tsx +69 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/shared/products.tsx +120 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/shared/tags.tsx +64 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/condition-tables/shared/types.tsx +63 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/edit-conditions-modal.tsx +53 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/form/discount-form-context.tsx +224 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/form/mappers.ts +84 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/form/use-form-actions.tsx +44 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/index.tsx +196 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/sections/conditions/condition-item.tsx +248 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/sections/conditions/index.tsx +86 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/sections/configuration.tsx +273 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/sections/discount-allocation.tsx +49 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/sections/discount-type.tsx +65 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/sections/general.tsx +210 -0
- package/.cache/admin/src/domain/discounts/new/discount-form/use-condition-modal-items.tsx +135 -0
- package/.cache/admin/src/domain/discounts/new/index.tsx +14 -0
- package/.cache/admin/src/domain/discounts/types.ts +81 -0
- package/.cache/admin/src/domain/discounts/utils/index.tsx +24 -0
- package/.cache/admin/src/domain/gift-cards/custom-giftcard.tsx +154 -0
- package/.cache/admin/src/domain/gift-cards/details/edit-gift-card-modal.tsx +149 -0
- package/.cache/admin/src/domain/gift-cards/details/index.tsx +210 -0
- package/.cache/admin/src/domain/gift-cards/details/update-balance-modal.tsx +131 -0
- package/.cache/admin/src/domain/gift-cards/index.tsx +31 -0
- package/.cache/admin/src/domain/gift-cards/manage/index.tsx +105 -0
- package/.cache/admin/src/domain/gift-cards/new.tsx +336 -0
- package/.cache/admin/src/domain/gift-cards/overview.tsx +215 -0
- package/.cache/admin/src/domain/inventory/filter-dropdown.tsx +104 -0
- package/.cache/admin/src/domain/inventory/header.tsx +32 -0
- package/.cache/admin/src/domain/inventory/index.tsx +17 -0
- package/.cache/admin/src/domain/inventory/inventory/index.tsx +22 -0
- package/.cache/admin/src/domain/inventory/locations/components/address-form/index.tsx +165 -0
- package/.cache/admin/src/domain/inventory/locations/components/edit-sales-channels/index.tsx +81 -0
- package/.cache/admin/src/domain/inventory/locations/components/general-form/index.tsx +42 -0
- package/.cache/admin/src/domain/inventory/locations/components/location-card/index.tsx +124 -0
- package/.cache/admin/src/domain/inventory/locations/components/sales-channels-form/index.tsx +77 -0
- package/.cache/admin/src/domain/inventory/locations/components/sales-channels-section/index.tsx +31 -0
- package/.cache/admin/src/domain/inventory/locations/edit/index.tsx +146 -0
- package/.cache/admin/src/domain/inventory/locations/index.tsx +59 -0
- package/.cache/admin/src/domain/inventory/locations/new/index.tsx +263 -0
- package/.cache/admin/src/domain/inventory/reservations/index.tsx +22 -0
- package/.cache/admin/src/domain/oauth/index.tsx +29 -0
- package/.cache/admin/src/domain/orders/components/claim-type-form/index.tsx +48 -0
- package/.cache/admin/src/domain/orders/components/items-to-receive-form/index.ts +2 -0
- package/.cache/admin/src/domain/orders/components/items-to-receive-form/items-to-receive-form.tsx +75 -0
- package/.cache/admin/src/domain/orders/components/items-to-receive-form/items-to-receive-table.tsx +62 -0
- package/.cache/admin/src/domain/orders/components/items-to-receive-form/use-items-to-receive-columns.tsx +188 -0
- package/.cache/admin/src/domain/orders/components/items-to-return-form/add-return-reason/add-return-reason-screen.tsx +143 -0
- package/.cache/admin/src/domain/orders/components/items-to-return-form/add-return-reason/index.tsx +94 -0
- package/.cache/admin/src/domain/orders/components/items-to-return-form/index.tsx +93 -0
- package/.cache/admin/src/domain/orders/components/items-to-return-form/items-to-return-table.tsx +86 -0
- package/.cache/admin/src/domain/orders/components/items-to-return-form/use-return-item-columns.tsx +195 -0
- package/.cache/admin/src/domain/orders/components/items-to-send-form/add-additional-items-screen/add-additional-items-screen.tsx +199 -0
- package/.cache/admin/src/domain/orders/components/items-to-send-form/add-additional-items-screen/add-additional-items-table.tsx +90 -0
- package/.cache/admin/src/domain/orders/components/items-to-send-form/add-additional-items-screen/index.ts +1 -0
- package/.cache/admin/src/domain/orders/components/items-to-send-form/add-additional-items-screen/use-add-additional-items-columns.tsx +208 -0
- package/.cache/admin/src/domain/orders/components/items-to-send-form/additional-items-table.tsx +71 -0
- package/.cache/admin/src/domain/orders/components/items-to-send-form/index.tsx +100 -0
- package/.cache/admin/src/domain/orders/components/items-to-send-form/use-additional-items-columns.tsx +178 -0
- package/.cache/admin/src/domain/orders/components/refund-amount-form/index.tsx +128 -0
- package/.cache/admin/src/domain/orders/components/reservation-indicator/reservation-indicator.tsx +152 -0
- package/.cache/admin/src/domain/orders/components/rma-summaries/claim-summary.tsx +196 -0
- package/.cache/admin/src/domain/orders/components/rma-summaries/index.ts +3 -0
- package/.cache/admin/src/domain/orders/components/rma-summaries/receive-return-summary.tsx +126 -0
- package/.cache/admin/src/domain/orders/components/rma-summaries/summary-line-item.tsx +68 -0
- package/.cache/admin/src/domain/orders/components/rma-summaries/summary-shipping-line.tsx +43 -0
- package/.cache/admin/src/domain/orders/components/send-notification-form/index.tsx +57 -0
- package/.cache/admin/src/domain/orders/components/shipping-address-form/index.tsx +66 -0
- package/.cache/admin/src/domain/orders/components/shipping-address-form/shipping-address-form-modal.tsx +120 -0
- package/.cache/admin/src/domain/orders/components/shipping-form/index.tsx +238 -0
- package/.cache/admin/src/domain/orders/components/table-quantity-selector.tsx +93 -0
- package/.cache/admin/src/domain/orders/details/address-modal.tsx +229 -0
- package/.cache/admin/src/domain/orders/details/claim/register-claim-menu.tsx +395 -0
- package/.cache/admin/src/domain/orders/details/create-fulfillment/index.tsx +351 -0
- package/.cache/admin/src/domain/orders/details/create-fulfillment/item-table.tsx +241 -0
- package/.cache/admin/src/domain/orders/details/detail-cards/draft-summary.tsx +279 -0
- package/.cache/admin/src/domain/orders/details/detail-cards/summary.tsx +289 -0
- package/.cache/admin/src/domain/orders/details/email-modal.tsx +102 -0
- package/.cache/admin/src/domain/orders/details/index.tsx +650 -0
- package/.cache/admin/src/domain/orders/details/mark-shipped/index.tsx +273 -0
- package/.cache/admin/src/domain/orders/details/order-line/edit.tsx +330 -0
- package/.cache/admin/src/domain/orders/details/order-line/index.tsx +79 -0
- package/.cache/admin/src/domain/orders/details/receive-return/index.tsx +379 -0
- package/.cache/admin/src/domain/orders/details/refund/index.tsx +243 -0
- package/.cache/admin/src/domain/orders/details/reservation/edit-reservation-modal.tsx +408 -0
- package/.cache/admin/src/domain/orders/details/reservation/reserve-items-modal.tsx +345 -0
- package/.cache/admin/src/domain/orders/details/returns/index.tsx +483 -0
- package/.cache/admin/src/domain/orders/details/rma-sub-modals/address.tsx +208 -0
- package/.cache/admin/src/domain/orders/details/rma-sub-modals/products.tsx +302 -0
- package/.cache/admin/src/domain/orders/details/rma-sub-modals/return-reasons.tsx +183 -0
- package/.cache/admin/src/domain/orders/details/swap/create.tsx +511 -0
- package/.cache/admin/src/domain/orders/details/templates/address.tsx +34 -0
- package/.cache/admin/src/domain/orders/details/templates/display-total.tsx +60 -0
- package/.cache/admin/src/domain/orders/details/templates/fulfillment-status.tsx +63 -0
- package/.cache/admin/src/domain/orders/details/templates/fulfillment.tsx +195 -0
- package/.cache/admin/src/domain/orders/details/templates/index.ts +9 -0
- package/.cache/admin/src/domain/orders/details/templates/order-status.tsx +39 -0
- package/.cache/admin/src/domain/orders/details/templates/payment-actionables.tsx +86 -0
- package/.cache/admin/src/domain/orders/details/templates/payment-details.tsx +59 -0
- package/.cache/admin/src/domain/orders/details/templates/payment-status.tsx +36 -0
- package/.cache/admin/src/domain/orders/details/templates/tracking-link.tsx +18 -0
- package/.cache/admin/src/domain/orders/details/utils/create-filtering.ts +70 -0
- package/.cache/admin/src/domain/orders/details/utils/get-default-values.ts +262 -0
- package/.cache/admin/src/domain/orders/details/utils/use-admin-expand-paramter.ts +45 -0
- package/.cache/admin/src/domain/orders/draft-orders/details.tsx +517 -0
- package/.cache/admin/src/domain/orders/draft-orders/index.tsx +97 -0
- package/.cache/admin/src/domain/orders/edit/context.tsx +54 -0
- package/.cache/admin/src/domain/orders/edit/modal.tsx +478 -0
- package/.cache/admin/src/domain/orders/edit/utils/user.ts +19 -0
- package/.cache/admin/src/domain/orders/edit/variants-table.tsx +354 -0
- package/.cache/admin/src/domain/orders/index.tsx +167 -0
- package/.cache/admin/src/domain/orders/new/components/billing-details.tsx +89 -0
- package/.cache/admin/src/domain/orders/new/components/custom-item-sub-modal.tsx +90 -0
- package/.cache/admin/src/domain/orders/new/components/items.tsx +336 -0
- package/.cache/admin/src/domain/orders/new/components/select-region.tsx +66 -0
- package/.cache/admin/src/domain/orders/new/components/select-shipping.tsx +171 -0
- package/.cache/admin/src/domain/orders/new/components/shipping-details.tsx +274 -0
- package/.cache/admin/src/domain/orders/new/components/summary.tsx +406 -0
- package/.cache/admin/src/domain/orders/new/form/index.tsx +212 -0
- package/.cache/admin/src/domain/orders/new/new-order.tsx +141 -0
- package/.cache/admin/src/domain/orders/utils.ts +30 -0
- package/.cache/admin/src/domain/pricing/components/index.ts +1 -0
- package/.cache/admin/src/domain/pricing/components/product-filter-menu/index.ts +1 -0
- package/.cache/admin/src/domain/pricing/components/product-filter-menu/product-filter-menu.tsx +52 -0
- package/.cache/admin/src/domain/pricing/edit/details/details-drawer.tsx +184 -0
- package/.cache/admin/src/domain/pricing/edit/details/details-section.tsx +356 -0
- package/.cache/admin/src/domain/pricing/edit/details/index.ts +1 -0
- package/.cache/admin/src/domain/pricing/edit/edit.tsx +85 -0
- package/.cache/admin/src/domain/pricing/edit/index.ts +1 -0
- package/.cache/admin/src/domain/pricing/edit/prices/add-products-modal.tsx +695 -0
- package/.cache/admin/src/domain/pricing/edit/prices/edit-prices-modal.tsx +677 -0
- package/.cache/admin/src/domain/pricing/edit/prices/index.ts +1 -0
- package/.cache/admin/src/domain/pricing/edit/prices/prices-section.tsx +648 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-details-form/index.ts +3 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-details-form/price-list-details-form.tsx +753 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-details-form/schema.ts +37 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-details-form/types.ts +20 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-prices-form/helpers.ts +46 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-prices-form/index.ts +6 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-prices-form/price-list-prices-form.tsx +237 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-prices-form/schema.ts +32 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-prices-form/types.ts +12 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-prices-form/use-prices-form-data.tsx +78 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-product-prices-form/helpers.ts +566 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-product-prices-form/index.ts +3 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-product-prices-form/models.ts +187 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-product-prices-form/price-list-product-prices-form.tsx +2151 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-product-prices-form/schema.ts +27 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-product-prices-form/types.ts +91 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-products-form/index.ts +3 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-products-form/price-list-products-form.tsx +482 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-products-form/schema.ts +7 -0
- package/.cache/admin/src/domain/pricing/forms/price-list-products-form/types.ts +4 -0
- package/.cache/admin/src/domain/pricing/index.tsx +16 -0
- package/.cache/admin/src/domain/pricing/new/index.ts +1 -0
- package/.cache/admin/src/domain/pricing/new/new.tsx +769 -0
- package/.cache/admin/src/domain/pricing/overview/index.ts +1 -0
- package/.cache/admin/src/domain/pricing/overview/overview.tsx +481 -0
- package/.cache/admin/src/domain/product-categories/components/product-categories-list.tsx +151 -0
- package/.cache/admin/src/domain/product-categories/components/product-category-list-item-details.tsx +181 -0
- package/.cache/admin/src/domain/product-categories/components/tree-crumbs.tsx +54 -0
- package/.cache/admin/src/domain/product-categories/index.tsx +30 -0
- package/.cache/admin/src/domain/product-categories/modals/add-product-category.tsx +282 -0
- package/.cache/admin/src/domain/product-categories/modals/edit-product-category.tsx +241 -0
- package/.cache/admin/src/domain/product-categories/pages/index.tsx +135 -0
- package/.cache/admin/src/domain/product-categories/styles/product-categories.css +21 -0
- package/.cache/admin/src/domain/product-categories/utils/index.tsx +63 -0
- package/.cache/admin/src/domain/products/batch-job/download-template.ts +18 -0
- package/.cache/admin/src/domain/products/batch-job/import.tsx +235 -0
- package/.cache/admin/src/domain/products/edit/index.tsx +91 -0
- package/.cache/admin/src/domain/products/filter-dropdown.tsx +244 -0
- package/.cache/admin/src/domain/products/index.tsx +29 -0
- package/.cache/admin/src/domain/products/new/add-sales-channels.tsx +123 -0
- package/.cache/admin/src/domain/products/new/add-variants/index.tsx +508 -0
- package/.cache/admin/src/domain/products/new/add-variants/new-variant/index.tsx +380 -0
- package/.cache/admin/src/domain/products/new/index.tsx +518 -0
- package/.cache/admin/src/domain/products/overview/index.tsx +269 -0
- package/.cache/admin/src/domain/publishable-api-keys/index.tsx +33 -0
- package/.cache/admin/src/domain/publishable-api-keys/modals/add-sales-channels.tsx +149 -0
- package/.cache/admin/src/domain/publishable-api-keys/modals/details.tsx +116 -0
- package/.cache/admin/src/domain/publishable-api-keys/modals/manage-sales-channels.tsx +428 -0
- package/.cache/admin/src/domain/publishable-api-keys/pages/index.tsx +294 -0
- package/.cache/admin/src/domain/publishable-api-keys/tables/publishable-api-keys-table.tsx +342 -0
- package/.cache/admin/src/domain/publishable-api-keys/tables/sales-channels-table.tsx +244 -0
- package/.cache/admin/src/domain/sales-channels/form/add-sales-channel.tsx +211 -0
- package/.cache/admin/src/domain/sales-channels/form/edit-sales-channel.tsx +116 -0
- package/.cache/admin/src/domain/sales-channels/index.tsx +30 -0
- package/.cache/admin/src/domain/sales-channels/pages/details.tsx +501 -0
- package/.cache/admin/src/domain/sales-channels/tables/config.tsx +57 -0
- package/.cache/admin/src/domain/sales-channels/tables/placeholder.tsx +33 -0
- package/.cache/admin/src/domain/sales-channels/tables/product.tsx +539 -0
- package/.cache/admin/src/domain/settings/currencies/components/currency-tax-setting.tsx +111 -0
- package/.cache/admin/src/domain/settings/currencies/components/default-store-currency/default-currency-selector.tsx +104 -0
- package/.cache/admin/src/domain/settings/currencies/components/default-store-currency/index.tsx +33 -0
- package/.cache/admin/src/domain/settings/currencies/components/store-currencies/add-currencies-screen.tsx +160 -0
- package/.cache/admin/src/domain/settings/currencies/components/store-currencies/current-currencies-screen.tsx +197 -0
- package/.cache/admin/src/domain/settings/currencies/components/store-currencies/edit-currencies-modal.tsx +46 -0
- package/.cache/admin/src/domain/settings/currencies/components/store-currencies/index.tsx +38 -0
- package/.cache/admin/src/domain/settings/currencies/components/store-currencies/table.tsx +123 -0
- package/.cache/admin/src/domain/settings/currencies/components/store-currencies/use-currency-table-columns.tsx +58 -0
- package/.cache/admin/src/domain/settings/currencies/index.tsx +131 -0
- package/.cache/admin/src/domain/settings/details.tsx +184 -0
- package/.cache/admin/src/domain/settings/index.tsx +196 -0
- package/.cache/admin/src/domain/settings/personal-information/edit-user-information/edit-user-information-modal.tsx +116 -0
- package/.cache/admin/src/domain/settings/personal-information/edit-user-information/index.tsx +67 -0
- package/.cache/admin/src/domain/settings/personal-information/index.tsx +54 -0
- package/.cache/admin/src/domain/settings/personal-information/language-settings/index.tsx +42 -0
- package/.cache/admin/src/domain/settings/personal-information/language-settings/language-menu.tsx +31 -0
- package/.cache/admin/src/domain/settings/personal-information/usage-insights/index.tsx +65 -0
- package/.cache/admin/src/domain/settings/personal-information/usage-insights/usage-insights-modal.tsx +99 -0
- package/.cache/admin/src/domain/settings/regions/components/region-form/region-details-form.tsx +160 -0
- package/.cache/admin/src/domain/settings/regions/components/region-form/region-providers-form.tsx +111 -0
- package/.cache/admin/src/domain/settings/regions/components/region-form/use-store-data.tsx +58 -0
- package/.cache/admin/src/domain/settings/regions/components/shipping-option-card/edit-modal.tsx +170 -0
- package/.cache/admin/src/domain/settings/regions/components/shipping-option-card/index.tsx +127 -0
- package/.cache/admin/src/domain/settings/regions/components/shipping-option-form/index.tsx +332 -0
- package/.cache/admin/src/domain/settings/regions/components/shipping-option-form/use-shipping-option-form-data.tsx +136 -0
- package/.cache/admin/src/domain/settings/regions/edit/general-section/edit-region.modal.tsx +192 -0
- package/.cache/admin/src/domain/settings/regions/edit/general-section/index.tsx +210 -0
- package/.cache/admin/src/domain/settings/regions/edit/index.tsx +55 -0
- package/.cache/admin/src/domain/settings/regions/edit/return-shipping-options/create-return-shipping-option.modal.tsx +110 -0
- package/.cache/admin/src/domain/settings/regions/edit/return-shipping-options/index.tsx +59 -0
- package/.cache/admin/src/domain/settings/regions/edit/shipping-options/create-shipping-option-modal.tsx +107 -0
- package/.cache/admin/src/domain/settings/regions/edit/shipping-options/index.tsx +52 -0
- package/.cache/admin/src/domain/settings/regions/index.tsx +25 -0
- package/.cache/admin/src/domain/settings/regions/new/index.tsx +177 -0
- package/.cache/admin/src/domain/settings/regions/region-overview/index.tsx +95 -0
- package/.cache/admin/src/domain/settings/regions/region-overview/region-card.tsx +49 -0
- package/.cache/admin/src/domain/settings/return-reasons/create-reason-modal.tsx +150 -0
- package/.cache/admin/src/domain/settings/return-reasons/detail.tsx +163 -0
- package/.cache/admin/src/domain/settings/return-reasons/index.tsx +101 -0
- package/.cache/admin/src/domain/settings/taxes/details.tsx +160 -0
- package/.cache/admin/src/domain/settings/taxes/edit-form.tsx +379 -0
- package/.cache/admin/src/domain/settings/taxes/edit-tax-rate-details.tsx +83 -0
- package/.cache/admin/src/domain/settings/taxes/edit.tsx +56 -0
- package/.cache/admin/src/domain/settings/taxes/index.tsx +169 -0
- package/.cache/admin/src/domain/settings/taxes/new.tsx +300 -0
- package/.cache/admin/src/domain/settings/taxes/product-selector.tsx +80 -0
- package/.cache/admin/src/domain/settings/taxes/product-type-selector.tsx +44 -0
- package/.cache/admin/src/domain/settings/taxes/region-form.tsx +178 -0
- package/.cache/admin/src/domain/settings/taxes/selectable-table.tsx +197 -0
- package/.cache/admin/src/domain/settings/taxes/shipping-option-selector.tsx +46 -0
- package/.cache/admin/src/domain/settings/taxes/tax-rate-row.tsx +87 -0
- package/.cache/admin/src/domain/settings/taxes/tax-rule-item.tsx +43 -0
- package/.cache/admin/src/domain/settings/taxes/tax-rule-selector.tsx +161 -0
- package/.cache/admin/src/domain/settings/taxes/use-tax-rate-columns.tsx +50 -0
- package/.cache/admin/src/domain/settings/users/index.tsx +88 -0
- package/.cache/admin/src/extensions/_local-entry.ts +10 -0
- package/.cache/admin/src/extensions/_main-entry.ts +7 -0
- package/.cache/admin/src/fonts/Inter-Medium.ttf +0 -0
- package/.cache/admin/src/fonts/Inter-Regular.ttf +0 -0
- package/.cache/admin/src/fonts/Inter-SemiBold.ttf +0 -0
- package/.cache/admin/src/fonts/RobotoMono-Bold.ttf +0 -0
- package/.cache/admin/src/fonts/RobotoMono-Regular.ttf +0 -0
- package/.cache/admin/src/hooks/use-build-timeline.tsx +676 -0
- package/.cache/admin/src/hooks/use-command-history.tsx +66 -0
- package/.cache/admin/src/hooks/use-computed-height.ts +19 -0
- package/.cache/admin/src/hooks/use-debounce.ts +22 -0
- package/.cache/admin/src/hooks/use-debounced-search-param.tsx +33 -0
- package/.cache/admin/src/hooks/use-detect-change.tsx +50 -0
- package/.cache/admin/src/hooks/use-edit-product-actions.tsx +193 -0
- package/.cache/admin/src/hooks/use-extension-base-props.tsx +25 -0
- package/.cache/admin/src/hooks/use-highlight-search.tsx +33 -0
- package/.cache/admin/src/hooks/use-imperative-dialog.tsx +139 -0
- package/.cache/admin/src/hooks/use-is-me.tsx +12 -0
- package/.cache/admin/src/hooks/use-notification.tsx +20 -0
- package/.cache/admin/src/hooks/use-observe-width.ts +30 -0
- package/.cache/admin/src/hooks/use-on-click-outside.tsx +28 -0
- package/.cache/admin/src/hooks/use-outside-click.ts +19 -0
- package/.cache/admin/src/hooks/use-query-filters.ts +229 -0
- package/.cache/admin/src/hooks/use-scroll.ts +20 -0
- package/.cache/admin/src/hooks/use-selection-column.tsx +39 -0
- package/.cache/admin/src/hooks/use-set-search-params.tsx +24 -0
- package/.cache/admin/src/hooks/use-stock-locations.ts +28 -0
- package/.cache/admin/src/hooks/use-toggle-state.ts +46 -0
- package/.cache/admin/src/hooks/use-window-dimensions.ts +25 -0
- package/.cache/admin/src/i18n/index.ts +119 -0
- package/.cache/admin/src/main.tsx +27 -0
- package/.cache/admin/src/medusa-app.tsx +58 -0
- package/.cache/admin/src/pages/404.tsx +12 -0
- package/.cache/admin/src/pages/a.tsx +86 -0
- package/.cache/admin/src/pages/index.tsx +20 -0
- package/.cache/admin/src/pages/invite.tsx +246 -0
- package/.cache/admin/src/pages/login.tsx +50 -0
- package/.cache/admin/src/pages/reset-password.tsx +151 -0
- package/.cache/admin/src/providers/analytics-provider.tsx +223 -0
- package/.cache/admin/src/providers/feature-flag-provider.tsx +78 -0
- package/.cache/admin/src/providers/import-refresh.tsx +57 -0
- package/.cache/admin/src/providers/medusa-provider.tsx +17 -0
- package/.cache/admin/src/providers/polling-provider.tsx +112 -0
- package/.cache/admin/src/providers/providers.tsx +54 -0
- package/.cache/admin/src/providers/route-provider.tsx +55 -0
- package/.cache/admin/src/providers/setting-provider.tsx +49 -0
- package/.cache/admin/src/providers/skeleton-provider.tsx +32 -0
- package/.cache/admin/src/providers/widget-provider.tsx +38 -0
- package/.cache/admin/src/registries/route-registry.tsx +133 -0
- package/.cache/admin/src/registries/setting-registry.tsx +60 -0
- package/.cache/admin/src/registries/widget-registry.tsx +26 -0
- package/.cache/admin/src/services/analytics.ts +119 -0
- package/.cache/admin/src/types/extensions.ts +151 -0
- package/.cache/admin/src/types/shared.ts +55 -0
- package/.cache/admin/src/types/utils.ts +3 -0
- package/.cache/admin/src/utils/bytes-converter.ts +18 -0
- package/.cache/admin/src/utils/callAll.ts +4 -0
- package/.cache/admin/src/utils/color.ts +12 -0
- package/.cache/admin/src/utils/consolidate-images.ts +15 -0
- package/.cache/admin/src/utils/countries.ts +639 -0
- package/.cache/admin/src/utils/currencies.ts +1087 -0
- package/.cache/admin/src/utils/date-utils.ts +5 -0
- package/.cache/admin/src/utils/email.ts +9 -0
- package/.cache/admin/src/utils/equals-set.ts +11 -0
- package/.cache/admin/src/utils/error-messages.ts +10 -0
- package/.cache/admin/src/utils/extensions.ts +30 -0
- package/.cache/admin/src/utils/extract-customer-name.ts +69 -0
- package/.cache/admin/src/utils/extract-options.ts +26 -0
- package/.cache/admin/src/utils/focus-by-name.ts +3 -0
- package/.cache/admin/src/utils/form-helpers.ts +22 -0
- package/.cache/admin/src/utils/form-validator.ts +71 -0
- package/.cache/admin/src/utils/fulfillment-providers.mapper.ts +26 -0
- package/.cache/admin/src/utils/generate-promotion-code.ts +12 -0
- package/.cache/admin/src/utils/get-admin-path.ts +22 -0
- package/.cache/admin/src/utils/get-error-status.ts +11 -0
- package/.cache/admin/src/utils/get-relative-time.ts +35 -0
- package/.cache/admin/src/utils/handle-form-error.tsx +64 -0
- package/.cache/admin/src/utils/images.ts +33 -0
- package/.cache/admin/src/utils/is-line-item.ts +37 -0
- package/.cache/admin/src/utils/is-nullish-object.ts +14 -0
- package/.cache/admin/src/utils/map-address-to-form.ts +23 -0
- package/.cache/admin/src/utils/nested-form.ts +87 -0
- package/.cache/admin/src/utils/payment-providers-mapper.ts +73 -0
- package/.cache/admin/src/utils/prices.ts +153 -0
- package/.cache/admin/src/utils/product-status-variant.ts +13 -0
- package/.cache/admin/src/utils/remove-nullish.ts +11 -0
- package/.cache/admin/src/utils/sales-channel-compare-operator.ts +13 -0
- package/.cache/admin/src/utils/search-param-utils.ts +86 -0
- package/.cache/admin/src/utils/trim-values.ts +11 -0
- package/.cache/admin/src/utils/validate-email.ts +7 -0
- package/.cache/admin/src/utils/xorObjFields.ts +4 -0
- package/.cache/admin/tsconfig.json +22 -0
- package/.cache/admin-build-manifest.json +29 -0
- package/.eslintrc.js +112 -0
- package/.github/dependabot.yml +21 -0
- package/.github/scripts/wait-for-server-live.sh +29 -0
- package/.github/workflows/test-cli.yml +149 -0
- package/.github/workflows/update-preview-deps-ci.yml +70 -0
- package/.github/workflows/update-preview-deps.yml +70 -0
- package/.vscode/settings.json +2 -0
- package/.yarnrc.yml +1 -0
- package/README.md +70 -0
- package/build/230.c76076a78b7563553415.css +932 -0
- package/build/442f6a4cc2f03aaf41f6.ttf +0 -0
- package/build/68fda0752a470b05a5c5.ttf +0 -0
- package/build/6dcbc9bed1ec438907ee.ttf +0 -0
- package/build/6ed339415e1071e8ebc9.ttf +0 -0
- package/build/e62b16638c71c0eb4505.ttf +0 -0
- package/build/images/icon-minus-gray-fedf0680e4cc60b17e14.svg +16 -0
- package/build/images/icon-plus-gray-4813505451ce489532e3.svg +16 -0
- package/build/index.html +1 -0
- package/build/main.c5035eb0615ccdc82cbf.css +6635 -0
- package/build/public/locales/ar/translation.json +1919 -0
- package/build/public/locales/bg/translation.json +2011 -0
- package/build/public/locales/bs/translation.json +2011 -0
- package/build/public/locales/cs/translation.json +1942 -0
- package/build/public/locales/de/translation.json +1924 -0
- package/build/public/locales/en/translation.json +2011 -0
- package/build/public/locales/es/translation.json +1924 -0
- package/build/public/locales/fr/translation.json +1924 -0
- package/build/public/locales/hi/translation.json +2011 -0
- package/build/public/locales/hr/translation.json +2011 -0
- package/build/public/locales/it/translation.json +1922 -0
- package/build/public/locales/ja/translation.json +2006 -0
- package/build/public/locales/ko/translation.json +2011 -0
- package/build/public/locales/pl/translation.json +1919 -0
- package/build/public/locales/pt/translation.json +1925 -0
- package/build/public/locales/ru/translation.json +1919 -0
- package/build/public/locales/sl/translation.json +2010 -0
- package/build/public/locales/tm/translation.json +1924 -0
- package/build/public/locales/uk/translation.json +1919 -0
- package/build/public/locales/vi/translation.json +2011 -0
- package/build/public/locales/zh/translation.json +2011 -0
- package/build/public/logo.svg +10 -0
- package/data/seed-onboarding.json +141 -0
- package/data/seed.json +1006 -0
- package/datasource.js +18 -0
- package/dist/index.js +1 -0
- package/index.js +50 -0
- package/medusa-config.js +153 -0
- package/package.json +129 -0
- package/src/api/README.md +179 -0
- package/src/index.ts +0 -0
- package/src/jobs/README.md +32 -0
- package/src/loaders/README.md +19 -0
- package/src/migrations/1717765546068-licenseVariant.ts +20 -0
- package/src/migrations/README.md +29 -0
- package/src/models/README.md +46 -0
- package/src/models/product-variant.ts +35 -0
- package/src/repositories/ProductVariant.ts +11 -0
- package/src/services/README.md +49 -0
- package/src/subscribers/README.md +44 -0
- package/tsconfig.admin.json +8 -0
- package/tsconfig.json +30 -0
- package/tsconfig.server.json +8 -0
- package/tsconfig.spec.json +5 -0
|
@@ -0,0 +1,2151 @@
|
|
|
1
|
+
import { Adjustments, BuildingTax } from "@medusajs/icons"
|
|
2
|
+
import type { Currency, Product, Region } from "@medusajs/medusa"
|
|
3
|
+
import { Button, DropdownMenu, clx } from "@medusajs/ui"
|
|
4
|
+
import * as React from "react"
|
|
5
|
+
import AmountField, { formatValue } from "react-currency-input-field"
|
|
6
|
+
import { CurrencyInputOnChangeValues } from "react-currency-input-field/dist/components/CurrencyInputProps"
|
|
7
|
+
import {
|
|
8
|
+
Controller,
|
|
9
|
+
UseFormGetValues,
|
|
10
|
+
UseFormSetValue,
|
|
11
|
+
type Control,
|
|
12
|
+
} from "react-hook-form"
|
|
13
|
+
|
|
14
|
+
import { useTranslation } from "react-i18next"
|
|
15
|
+
import { useCommandHistory } from "../../../../hooks/use-command-history"
|
|
16
|
+
import useNotification from "../../../../hooks/use-notification"
|
|
17
|
+
import { currencies as CURRENCY_MAP } from "../../../../utils/currencies"
|
|
18
|
+
import {
|
|
19
|
+
calculateBoundingBoxes,
|
|
20
|
+
getBorderAttributes,
|
|
21
|
+
getCellAttributes,
|
|
22
|
+
getDragToFillSelection,
|
|
23
|
+
getElementFromPoint,
|
|
24
|
+
getKey,
|
|
25
|
+
getPoint,
|
|
26
|
+
getPointFromElement,
|
|
27
|
+
getRange,
|
|
28
|
+
getRect,
|
|
29
|
+
isParentRow,
|
|
30
|
+
validateTarget,
|
|
31
|
+
} from "./helpers"
|
|
32
|
+
import { DeleteCommand, PasteCommand, SortedSet } from "./models"
|
|
33
|
+
import {
|
|
34
|
+
BoundingBox,
|
|
35
|
+
DragPosition,
|
|
36
|
+
PriceListProductPricesPath,
|
|
37
|
+
RectStyles,
|
|
38
|
+
type CellProps,
|
|
39
|
+
type CellState,
|
|
40
|
+
type Point,
|
|
41
|
+
type PriceListProductPricesSchema,
|
|
42
|
+
} from "./types"
|
|
43
|
+
|
|
44
|
+
type BulkEditorProps = {
|
|
45
|
+
product: Product
|
|
46
|
+
regions: Region[]
|
|
47
|
+
currencies: Currency[]
|
|
48
|
+
control: Control<PriceListProductPricesSchema>
|
|
49
|
+
taxInclEnabled?: boolean
|
|
50
|
+
priceListTaxInclusive?: boolean
|
|
51
|
+
setValue: UseFormSetValue<PriceListProductPricesSchema>
|
|
52
|
+
getValues: UseFormGetValues<PriceListProductPricesSchema>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]
|
|
56
|
+
|
|
57
|
+
const PriceListProductPricesForm = ({
|
|
58
|
+
product,
|
|
59
|
+
regions,
|
|
60
|
+
currencies,
|
|
61
|
+
control,
|
|
62
|
+
taxInclEnabled,
|
|
63
|
+
priceListTaxInclusive,
|
|
64
|
+
setValue,
|
|
65
|
+
getValues,
|
|
66
|
+
}: BulkEditorProps) => {
|
|
67
|
+
const { t } = useTranslation()
|
|
68
|
+
const notification = useNotification()
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Reference to the table element.
|
|
72
|
+
*/
|
|
73
|
+
const tableRef = React.useRef<HTMLTableElement>(null)
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Reference to the container element.
|
|
77
|
+
*/
|
|
78
|
+
const containerRef = React.useRef<HTMLDivElement>(null)
|
|
79
|
+
|
|
80
|
+
/** Command History */
|
|
81
|
+
|
|
82
|
+
const { redo, undo, execute } = useCommandHistory()
|
|
83
|
+
|
|
84
|
+
/** Editing state */
|
|
85
|
+
|
|
86
|
+
const [isEditing, setIsEditing] = React.useState(false)
|
|
87
|
+
|
|
88
|
+
/** Cell state */
|
|
89
|
+
|
|
90
|
+
const [anchor, setAnchor] = React.useState<Point | null>(null)
|
|
91
|
+
const [rangeEnd, setRangeEnd] = React.useState<Point | null>(null)
|
|
92
|
+
|
|
93
|
+
const [selection, setSelection] = React.useState<Record<string, boolean>>({})
|
|
94
|
+
|
|
95
|
+
const [boundingBoxes, setBoundingBoxes] = React.useState<BoundingBox[]>([])
|
|
96
|
+
|
|
97
|
+
/** Matrix state */
|
|
98
|
+
|
|
99
|
+
const cols = React.useMemo(() => new SortedSet<number>(), [])
|
|
100
|
+
const rows = React.useMemo(() => new SortedSet<number>(), [])
|
|
101
|
+
|
|
102
|
+
const [cells, setCells] = React.useState<Record<string, boolean>>({})
|
|
103
|
+
|
|
104
|
+
/** Mouse interaction state */
|
|
105
|
+
|
|
106
|
+
const [isDragging, setIsDragging] = React.useState(false)
|
|
107
|
+
|
|
108
|
+
/** Drag to fill state */
|
|
109
|
+
|
|
110
|
+
const [isDragToFill, setIsDragtoFill] = React.useState(false)
|
|
111
|
+
|
|
112
|
+
const [dragToFillRangeEnd, setDragToFillRangeEnd] =
|
|
113
|
+
React.useState<Point | null>(null)
|
|
114
|
+
|
|
115
|
+
const [dragBoundingBoxes, setDragBoundingBoxes] = React.useState<
|
|
116
|
+
BoundingBox[]
|
|
117
|
+
>([])
|
|
118
|
+
|
|
119
|
+
const [dragSelection, setDragSelection] = React.useState<
|
|
120
|
+
Record<string, boolean>
|
|
121
|
+
>({})
|
|
122
|
+
|
|
123
|
+
const [dragRelativePosition, setDragRelativePosition] =
|
|
124
|
+
React.useState<DragPosition | null>(null)
|
|
125
|
+
|
|
126
|
+
/** Column visibility state */
|
|
127
|
+
|
|
128
|
+
const [visibleCurrencies, setVisibleCurrencies] = React.useState<string[]>(
|
|
129
|
+
currencies.map((c) => c.code)
|
|
130
|
+
)
|
|
131
|
+
const [visibleRegions, setVisibleRegions] = React.useState<string[]>([])
|
|
132
|
+
|
|
133
|
+
const [open, setOpen] = React.useState(false)
|
|
134
|
+
|
|
135
|
+
/** Callbacks */
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Get the state of a cell.
|
|
139
|
+
*/
|
|
140
|
+
const getCellState = React.useCallback(
|
|
141
|
+
(point: Point | null): CellState => {
|
|
142
|
+
const state: CellState = {
|
|
143
|
+
isSelected: false,
|
|
144
|
+
isAnchor: false,
|
|
145
|
+
isRangeEnd: false,
|
|
146
|
+
borders: {
|
|
147
|
+
bottom: false,
|
|
148
|
+
left: false,
|
|
149
|
+
right: false,
|
|
150
|
+
top: false,
|
|
151
|
+
},
|
|
152
|
+
outline: {
|
|
153
|
+
bottom: false,
|
|
154
|
+
left: false,
|
|
155
|
+
right: false,
|
|
156
|
+
top: false,
|
|
157
|
+
},
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (!point) {
|
|
161
|
+
return state
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const key = getKey(point)
|
|
165
|
+
|
|
166
|
+
if (selection[key]) {
|
|
167
|
+
state.isSelected = true
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (anchor && anchor.row === point.row && anchor.col === point.col) {
|
|
171
|
+
state.isAnchor = true
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (
|
|
175
|
+
rangeEnd &&
|
|
176
|
+
rangeEnd.row === point.row &&
|
|
177
|
+
rangeEnd.col === point.col
|
|
178
|
+
) {
|
|
179
|
+
state.isRangeEnd = true
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
state.borders = getBorderAttributes(point, boundingBoxes)
|
|
183
|
+
|
|
184
|
+
state.outline = getBorderAttributes(point, dragBoundingBoxes)
|
|
185
|
+
|
|
186
|
+
return state
|
|
187
|
+
},
|
|
188
|
+
[selection, anchor, rangeEnd, boundingBoxes, dragBoundingBoxes]
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Bulk get values of the selected cells.
|
|
193
|
+
*/
|
|
194
|
+
const getSelectionValues = React.useCallback(
|
|
195
|
+
(selection: Record<string, boolean>) => {
|
|
196
|
+
const keys = Object.keys(selection)
|
|
197
|
+
|
|
198
|
+
if (!keys.length) {
|
|
199
|
+
return []
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const rowData: string[][] = []
|
|
203
|
+
|
|
204
|
+
for (const key of keys) {
|
|
205
|
+
const point = getPoint(key)
|
|
206
|
+
|
|
207
|
+
const { variantId, currencyCode, regionId, type } = getCellAttributes(
|
|
208
|
+
point,
|
|
209
|
+
point,
|
|
210
|
+
tableRef.current
|
|
211
|
+
)[0]
|
|
212
|
+
|
|
213
|
+
const priceType = currencyCode ? "currency" : "region"
|
|
214
|
+
const priceIdentifier = currencyCode || regionId
|
|
215
|
+
|
|
216
|
+
const path =
|
|
217
|
+
`variants.${variantId}.${priceType}.${priceIdentifier}.${type}` as const
|
|
218
|
+
|
|
219
|
+
const value = getValues(path)
|
|
220
|
+
|
|
221
|
+
if (!rowData[point.row]) {
|
|
222
|
+
rowData[point.row] = Array(point.col + 1).fill(null) // Fill empty spaces with null to allow filtering them out later
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
rowData[point.row][point.col] = value ?? ""
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const filteredRows = rowData
|
|
229
|
+
.map((row) => row.filter((val) => val !== null))
|
|
230
|
+
.filter(Boolean)
|
|
231
|
+
|
|
232
|
+
return filteredRows
|
|
233
|
+
},
|
|
234
|
+
[getValues]
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Bulk update the values of the selected cells.
|
|
239
|
+
*/
|
|
240
|
+
const setSelectionValues = React.useCallback(
|
|
241
|
+
(selection: Record<string, boolean>, values: string[][]) => {
|
|
242
|
+
if (!values.length) {
|
|
243
|
+
return
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const keys = Object.keys(selection)
|
|
247
|
+
|
|
248
|
+
if (!keys.length) {
|
|
249
|
+
return
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const rowData: string[][] = []
|
|
253
|
+
|
|
254
|
+
for (const key of keys) {
|
|
255
|
+
const point = getPoint(key)
|
|
256
|
+
|
|
257
|
+
const { variantId, currencyCode, regionId, type } = getCellAttributes(
|
|
258
|
+
point,
|
|
259
|
+
point,
|
|
260
|
+
tableRef.current
|
|
261
|
+
)[0]
|
|
262
|
+
|
|
263
|
+
const priceType = currencyCode ? "currency" : "region"
|
|
264
|
+
const priceIdentifier = currencyCode || regionId
|
|
265
|
+
|
|
266
|
+
const path =
|
|
267
|
+
`variants.${variantId}.${priceType}.${priceIdentifier}.${type}` as const
|
|
268
|
+
|
|
269
|
+
if (!rowData[point.row]) {
|
|
270
|
+
rowData[point.row] = Array(point.col + 1).fill(null) // Fill empty spaces with null to allow filtering them out later
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
rowData[point.row][point.col] = path
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const filteredRows = rowData
|
|
277
|
+
.map((row) => row.filter((val) => val !== null))
|
|
278
|
+
.filter(Boolean)
|
|
279
|
+
|
|
280
|
+
for (let i = 0; i < filteredRows.length; i++) {
|
|
281
|
+
const valuesRow = values[i % values.length]
|
|
282
|
+
const row = filteredRows[i]
|
|
283
|
+
|
|
284
|
+
for (let j = 0; j < row.length; j++) {
|
|
285
|
+
const path = row[j]
|
|
286
|
+
const value = valuesRow[j % valuesRow.length]
|
|
287
|
+
|
|
288
|
+
setValue(path as PriceListProductPricesPath, value, {
|
|
289
|
+
shouldTouch: true,
|
|
290
|
+
shouldDirty: true,
|
|
291
|
+
})
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
[setValue]
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Clears the start and end of current range.
|
|
300
|
+
*/
|
|
301
|
+
const clearRange = React.useCallback(
|
|
302
|
+
(point?: Point | null) => {
|
|
303
|
+
const keys = Object.keys(selection)
|
|
304
|
+
const anchorKey = anchor ? getKey(anchor) : null
|
|
305
|
+
const newKey = point ? getKey(point) : null
|
|
306
|
+
|
|
307
|
+
const isAnchorOnlySelected = keys.length === 1 && anchorKey === keys[0]
|
|
308
|
+
const isAnchorNewPoint = anchorKey && newKey && anchorKey === newKey
|
|
309
|
+
|
|
310
|
+
const shouldIgnoreAnchor = isAnchorOnlySelected && isAnchorNewPoint
|
|
311
|
+
|
|
312
|
+
if (!shouldIgnoreAnchor) {
|
|
313
|
+
setAnchor(null)
|
|
314
|
+
setSelection({})
|
|
315
|
+
setRangeEnd(null)
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
setDragSelection({})
|
|
319
|
+
setBoundingBoxes([])
|
|
320
|
+
setDragBoundingBoxes([])
|
|
321
|
+
},
|
|
322
|
+
[anchor, selection]
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
const setSingleRange = React.useCallback((point: Point | null) => {
|
|
326
|
+
setAnchor(point)
|
|
327
|
+
setRangeEnd(point)
|
|
328
|
+
}, [])
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Adds a cell to the matrix.
|
|
332
|
+
*/
|
|
333
|
+
const onRegisterCell = React.useCallback(
|
|
334
|
+
(point: Point) => {
|
|
335
|
+
cols.insert(point.col)
|
|
336
|
+
rows.insert(point.row)
|
|
337
|
+
|
|
338
|
+
const key = getKey(point)
|
|
339
|
+
|
|
340
|
+
setCells((prev) => ({
|
|
341
|
+
...prev,
|
|
342
|
+
[key]: true,
|
|
343
|
+
}))
|
|
344
|
+
},
|
|
345
|
+
[cols, rows]
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Removes a cell from the matrix.
|
|
350
|
+
*/
|
|
351
|
+
const onUnregisterCell = React.useCallback(
|
|
352
|
+
(point: Point) => {
|
|
353
|
+
/**
|
|
354
|
+
* We only need to remove the column,
|
|
355
|
+
* as rows are determined by the
|
|
356
|
+
* product variants, and aren't
|
|
357
|
+
* hideable.
|
|
358
|
+
*/
|
|
359
|
+
cols.remove(point.col)
|
|
360
|
+
|
|
361
|
+
const key = getKey(point)
|
|
362
|
+
const { [key]: _, ...rest } = cells
|
|
363
|
+
|
|
364
|
+
setCells(rest)
|
|
365
|
+
},
|
|
366
|
+
[cells, cols]
|
|
367
|
+
)
|
|
368
|
+
|
|
369
|
+
/** Mouse event callbacks */
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Event handler for when the mouse is pressed down.
|
|
373
|
+
*/
|
|
374
|
+
const onCellMouseDown = React.useCallback(
|
|
375
|
+
(e: React.MouseEvent) => {
|
|
376
|
+
if (isDragToFill) {
|
|
377
|
+
return
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const target = e.target as HTMLElement | null
|
|
381
|
+
|
|
382
|
+
const cell = validateTarget(target)
|
|
383
|
+
|
|
384
|
+
if (!cell) {
|
|
385
|
+
return
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
setIsDragging(true)
|
|
389
|
+
|
|
390
|
+
const point = getPointFromElement(target)
|
|
391
|
+
|
|
392
|
+
if (e.shiftKey) {
|
|
393
|
+
setRangeEnd(point)
|
|
394
|
+
return
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
clearRange(point)
|
|
398
|
+
setAnchor(point)
|
|
399
|
+
},
|
|
400
|
+
[isDragToFill, clearRange]
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
const onDragOver = React.useCallback(
|
|
404
|
+
(e: React.MouseEvent) => {
|
|
405
|
+
if (!isDragging) {
|
|
406
|
+
return
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
const target = e.target as HTMLElement | null
|
|
410
|
+
|
|
411
|
+
const cell = validateTarget(target)
|
|
412
|
+
|
|
413
|
+
if (!cell) {
|
|
414
|
+
return
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const point = getPointFromElement(target)
|
|
418
|
+
|
|
419
|
+
let animationFrameId: number | null = null
|
|
420
|
+
|
|
421
|
+
const updateRangeEnd = () => {
|
|
422
|
+
setRangeEnd(point)
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (animationFrameId === null) {
|
|
426
|
+
animationFrameId = requestAnimationFrame(updateRangeEnd)
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// Cancel the previous animation frame if a new mousemove event occurs
|
|
430
|
+
return () => {
|
|
431
|
+
if (animationFrameId !== null) {
|
|
432
|
+
cancelAnimationFrame(animationFrameId)
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
[isDragging]
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
const onDragToFillOver = React.useCallback(
|
|
440
|
+
(e: React.MouseEvent) => {
|
|
441
|
+
if (!isDragToFill || !anchor || !rangeEnd) {
|
|
442
|
+
return
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const target = e.target as HTMLElement | null
|
|
446
|
+
|
|
447
|
+
const dragSelection = getDragToFillSelection(target, selection)
|
|
448
|
+
|
|
449
|
+
if (!dragSelection) {
|
|
450
|
+
setDragSelection({})
|
|
451
|
+
setDragRelativePosition(null)
|
|
452
|
+
|
|
453
|
+
return
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
setDragSelection(dragSelection.range)
|
|
457
|
+
setDragRelativePosition(dragSelection.position)
|
|
458
|
+
},
|
|
459
|
+
[isDragToFill, anchor, rangeEnd, selection]
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Event handler for when the mouse is moved.
|
|
464
|
+
*/
|
|
465
|
+
const onCellOver = React.useCallback(
|
|
466
|
+
(e: React.MouseEvent) => {
|
|
467
|
+
onDragOver(e)
|
|
468
|
+
onDragToFillOver(e)
|
|
469
|
+
},
|
|
470
|
+
[onDragOver, onDragToFillOver]
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
const onDragToFillEnd = React.useCallback(() => {
|
|
474
|
+
setIsDragtoFill(false)
|
|
475
|
+
setDragSelection({})
|
|
476
|
+
setDragRelativePosition(null)
|
|
477
|
+
setDragToFillRangeEnd(null)
|
|
478
|
+
setDragSelectionRect(null)
|
|
479
|
+
|
|
480
|
+
if (!Object.keys(dragSelection).length || !Object.keys(selection).length) {
|
|
481
|
+
return
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
const next = getSelectionValues(selection)
|
|
485
|
+
const prev = getSelectionValues(dragSelection)
|
|
486
|
+
|
|
487
|
+
const fillCommand = new PasteCommand({
|
|
488
|
+
selection: dragSelection,
|
|
489
|
+
next,
|
|
490
|
+
prev,
|
|
491
|
+
setter: setSelectionValues,
|
|
492
|
+
})
|
|
493
|
+
|
|
494
|
+
execute(fillCommand)
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Merge the drag selection into the main selection
|
|
498
|
+
* after a successful drag to fill.
|
|
499
|
+
*/
|
|
500
|
+
setSelection({
|
|
501
|
+
...selection,
|
|
502
|
+
...dragSelection,
|
|
503
|
+
})
|
|
504
|
+
}, [
|
|
505
|
+
execute,
|
|
506
|
+
dragSelection,
|
|
507
|
+
getSelectionValues,
|
|
508
|
+
selection,
|
|
509
|
+
setSelectionValues,
|
|
510
|
+
])
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Event handler for when the mouse is released.
|
|
514
|
+
*/
|
|
515
|
+
const onMouseUp = React.useCallback(
|
|
516
|
+
(_e: MouseEvent) => {
|
|
517
|
+
if (isDragToFill) {
|
|
518
|
+
onDragToFillEnd()
|
|
519
|
+
} else if (isDragging) {
|
|
520
|
+
setIsDragging(false)
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
[isDragToFill, isDragging, onDragToFillEnd]
|
|
524
|
+
)
|
|
525
|
+
|
|
526
|
+
/** Keyboard event callbacks */
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Callback for handling when the user presses one of the arrow keys.
|
|
530
|
+
*/
|
|
531
|
+
const onMoveAnchor = React.useCallback(
|
|
532
|
+
(e: KeyboardEvent) => {
|
|
533
|
+
e.preventDefault()
|
|
534
|
+
|
|
535
|
+
if (isEditing) {
|
|
536
|
+
/**
|
|
537
|
+
* If a cell is being edited, do nothing
|
|
538
|
+
* as we want to allow the user to move
|
|
539
|
+
* the cursor around the input.
|
|
540
|
+
*/
|
|
541
|
+
return
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if (!anchor) {
|
|
545
|
+
const firstRow = rows.getFirst()
|
|
546
|
+
const firstCol = cols.getFirst()
|
|
547
|
+
|
|
548
|
+
if (!firstRow || !firstCol) {
|
|
549
|
+
return
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
setSingleRange({ row: firstRow, col: firstCol })
|
|
553
|
+
return
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if (e.key === "ArrowUp") {
|
|
557
|
+
if (e.shiftKey) {
|
|
558
|
+
if (!rangeEnd) {
|
|
559
|
+
return
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
const previousRow = rows.getPrev(rangeEnd.row)
|
|
563
|
+
|
|
564
|
+
if (!previousRow) {
|
|
565
|
+
return
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
const point = { row: previousRow, col: rangeEnd.col }
|
|
569
|
+
|
|
570
|
+
setRangeEnd(point)
|
|
571
|
+
|
|
572
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
573
|
+
|
|
574
|
+
if (!element) {
|
|
575
|
+
return
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
element.scrollIntoView({ block: "nearest" })
|
|
579
|
+
|
|
580
|
+
return
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
if (e.metaKey || e.ctrlKey) {
|
|
584
|
+
const previousRow = rows.getFirst()
|
|
585
|
+
|
|
586
|
+
if (!previousRow) {
|
|
587
|
+
return
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
const point = { row: previousRow, col: anchor.col }
|
|
591
|
+
|
|
592
|
+
setSingleRange(point)
|
|
593
|
+
|
|
594
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
595
|
+
|
|
596
|
+
if (!element) {
|
|
597
|
+
return
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
element.scrollIntoView({ block: "nearest" })
|
|
601
|
+
|
|
602
|
+
return
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
const previousRow = rows.getPrev(anchor.row)
|
|
606
|
+
|
|
607
|
+
if (!previousRow) {
|
|
608
|
+
return
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
const point = { row: previousRow, col: anchor.col }
|
|
612
|
+
|
|
613
|
+
setSingleRange(point)
|
|
614
|
+
|
|
615
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
616
|
+
|
|
617
|
+
if (!element) {
|
|
618
|
+
return
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
element.scrollIntoView({ block: "nearest" })
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
if (e.key === "ArrowDown") {
|
|
625
|
+
if (e.shiftKey) {
|
|
626
|
+
if (!rangeEnd) {
|
|
627
|
+
return
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
const nextRow = rows.getNext(rangeEnd.row)
|
|
631
|
+
|
|
632
|
+
if (!nextRow) {
|
|
633
|
+
return
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
const point = { row: nextRow, col: rangeEnd.col }
|
|
637
|
+
|
|
638
|
+
setRangeEnd(point)
|
|
639
|
+
|
|
640
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
641
|
+
|
|
642
|
+
if (!element) {
|
|
643
|
+
return
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
element.scrollIntoView({ block: "nearest" })
|
|
647
|
+
|
|
648
|
+
return
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
if (e.metaKey || e.ctrlKey) {
|
|
652
|
+
const nextRow = rows.getLast()
|
|
653
|
+
|
|
654
|
+
if (!nextRow) {
|
|
655
|
+
return
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
const point = { row: nextRow, col: anchor.col }
|
|
659
|
+
|
|
660
|
+
setSingleRange(point)
|
|
661
|
+
|
|
662
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
663
|
+
|
|
664
|
+
if (!element) {
|
|
665
|
+
return
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
element.scrollIntoView({ block: "nearest" })
|
|
669
|
+
|
|
670
|
+
return
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
const nextRow = rows.getNext(anchor.row)
|
|
674
|
+
|
|
675
|
+
if (!nextRow) {
|
|
676
|
+
return
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
const point = { row: nextRow, col: anchor.col }
|
|
680
|
+
|
|
681
|
+
setSingleRange(point)
|
|
682
|
+
|
|
683
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
684
|
+
|
|
685
|
+
if (!element) {
|
|
686
|
+
return
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
element.scrollIntoView({ block: "nearest" })
|
|
690
|
+
|
|
691
|
+
return
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
if (e.key === "ArrowLeft") {
|
|
695
|
+
if (e.shiftKey) {
|
|
696
|
+
if (!rangeEnd) {
|
|
697
|
+
return
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
const previousCol = cols.getPrev(rangeEnd.col)
|
|
701
|
+
|
|
702
|
+
if (!previousCol) {
|
|
703
|
+
return
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
const point = { row: rangeEnd.row, col: previousCol }
|
|
707
|
+
|
|
708
|
+
setRangeEnd(point)
|
|
709
|
+
|
|
710
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
711
|
+
|
|
712
|
+
if (!element) {
|
|
713
|
+
return
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
element.scrollIntoView({ block: "nearest" })
|
|
717
|
+
|
|
718
|
+
return
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
if (e.metaKey || e.ctrlKey) {
|
|
722
|
+
const previousCol = cols.getFirst()
|
|
723
|
+
|
|
724
|
+
if (!previousCol) {
|
|
725
|
+
return
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
const point = { row: anchor.row, col: previousCol }
|
|
729
|
+
|
|
730
|
+
setSingleRange(point)
|
|
731
|
+
|
|
732
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
733
|
+
|
|
734
|
+
if (!element) {
|
|
735
|
+
return
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
element.scrollIntoView({ block: "nearest" })
|
|
739
|
+
|
|
740
|
+
return
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
const previousCol = cols.getPrev(anchor.col)
|
|
744
|
+
|
|
745
|
+
if (!previousCol) {
|
|
746
|
+
return
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
const point = { row: anchor.row, col: previousCol }
|
|
750
|
+
|
|
751
|
+
setSingleRange(point)
|
|
752
|
+
|
|
753
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
754
|
+
|
|
755
|
+
if (!element) {
|
|
756
|
+
return
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
element.scrollIntoView({ block: "nearest" })
|
|
760
|
+
|
|
761
|
+
return
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
if (e.key === "ArrowRight") {
|
|
765
|
+
if (e.shiftKey) {
|
|
766
|
+
if (!rangeEnd) {
|
|
767
|
+
return
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
const nextCol = cols.getNext(rangeEnd.col)
|
|
771
|
+
|
|
772
|
+
if (!nextCol) {
|
|
773
|
+
return
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
const point = { row: rangeEnd.row, col: nextCol }
|
|
777
|
+
|
|
778
|
+
setRangeEnd(point)
|
|
779
|
+
|
|
780
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
781
|
+
|
|
782
|
+
if (!element) {
|
|
783
|
+
return
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
element.scrollIntoView({ block: "nearest" })
|
|
787
|
+
|
|
788
|
+
return
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
if (e.metaKey || e.ctrlKey) {
|
|
792
|
+
const nextCol = cols.getLast()
|
|
793
|
+
|
|
794
|
+
if (!nextCol) {
|
|
795
|
+
return
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
const point = { row: anchor.row, col: nextCol }
|
|
799
|
+
|
|
800
|
+
setSingleRange(point)
|
|
801
|
+
|
|
802
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
803
|
+
|
|
804
|
+
if (!element) {
|
|
805
|
+
return
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
element.scrollIntoView({ block: "nearest" })
|
|
809
|
+
|
|
810
|
+
return
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
const nextCol = cols.getNext(anchor.col)
|
|
814
|
+
|
|
815
|
+
if (!nextCol) {
|
|
816
|
+
return
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
const point = { row: anchor.row, col: nextCol }
|
|
820
|
+
|
|
821
|
+
setSingleRange(point)
|
|
822
|
+
|
|
823
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
824
|
+
|
|
825
|
+
if (!element) {
|
|
826
|
+
return
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
element.scrollIntoView({ block: "nearest" })
|
|
830
|
+
|
|
831
|
+
return
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
[anchor, rangeEnd, rows, cols, isEditing, setSingleRange]
|
|
835
|
+
)
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Callback for handling when the user presses the backspace key.
|
|
839
|
+
*/
|
|
840
|
+
const onBackspace = React.useCallback(
|
|
841
|
+
(e: KeyboardEvent) => {
|
|
842
|
+
const keys = Object.keys(selection)
|
|
843
|
+
|
|
844
|
+
if (!keys.length) {
|
|
845
|
+
return
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
e.preventDefault()
|
|
849
|
+
e.stopPropagation()
|
|
850
|
+
|
|
851
|
+
const prev = getSelectionValues(selection)
|
|
852
|
+
const next = prev.map((row) => row.map(() => ""))
|
|
853
|
+
|
|
854
|
+
const deleteCommand = new DeleteCommand({
|
|
855
|
+
selection,
|
|
856
|
+
prev,
|
|
857
|
+
next,
|
|
858
|
+
setter: setSelectionValues,
|
|
859
|
+
})
|
|
860
|
+
|
|
861
|
+
execute(deleteCommand)
|
|
862
|
+
|
|
863
|
+
const anchorElement = getElementFromPoint(anchor, tableRef.current)
|
|
864
|
+
|
|
865
|
+
// Refocus the anchor element
|
|
866
|
+
if (anchorElement) {
|
|
867
|
+
anchorElement.focus()
|
|
868
|
+
}
|
|
869
|
+
},
|
|
870
|
+
[anchor, selection, getSelectionValues, setSelectionValues, execute]
|
|
871
|
+
)
|
|
872
|
+
|
|
873
|
+
const onTab = React.useCallback(
|
|
874
|
+
(e: KeyboardEvent) => {
|
|
875
|
+
if (!anchor) {
|
|
876
|
+
return
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
if (e.shiftKey) {
|
|
880
|
+
const previousCol = cols.getPrev(anchor.col)
|
|
881
|
+
|
|
882
|
+
if (!previousCol) {
|
|
883
|
+
const previousRow = rows.getPrev(anchor.row)
|
|
884
|
+
|
|
885
|
+
if (!previousRow) {
|
|
886
|
+
return
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
const lastCol = cols.getLast()
|
|
890
|
+
|
|
891
|
+
if (!lastCol) {
|
|
892
|
+
return
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
const point = { row: previousRow, col: lastCol }
|
|
896
|
+
|
|
897
|
+
setSingleRange(point)
|
|
898
|
+
|
|
899
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
900
|
+
|
|
901
|
+
if (!element) {
|
|
902
|
+
return
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
element.scrollIntoView({ block: "nearest" })
|
|
906
|
+
|
|
907
|
+
return
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
const point = { row: anchor.row, col: previousCol }
|
|
911
|
+
|
|
912
|
+
setSingleRange(point)
|
|
913
|
+
|
|
914
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
915
|
+
|
|
916
|
+
if (!element) {
|
|
917
|
+
return
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
element.scrollIntoView({ block: "nearest" })
|
|
921
|
+
|
|
922
|
+
return
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
const nextCol = cols.getNext(anchor.col)
|
|
926
|
+
|
|
927
|
+
if (!nextCol) {
|
|
928
|
+
const nextRow = rows.getNext(anchor.row)
|
|
929
|
+
|
|
930
|
+
if (!nextRow) {
|
|
931
|
+
return
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
const firstCol = cols.getFirst()
|
|
935
|
+
|
|
936
|
+
if (!firstCol) {
|
|
937
|
+
return
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
const point = { row: nextRow, col: firstCol }
|
|
941
|
+
|
|
942
|
+
setSingleRange(point)
|
|
943
|
+
|
|
944
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
945
|
+
|
|
946
|
+
if (!element) {
|
|
947
|
+
return
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
element.scrollIntoView({ block: "nearest" })
|
|
951
|
+
|
|
952
|
+
return
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
const point = { row: anchor.row, col: nextCol }
|
|
956
|
+
|
|
957
|
+
setSingleRange(point)
|
|
958
|
+
|
|
959
|
+
const element = getElementFromPoint(point, tableRef.current)
|
|
960
|
+
|
|
961
|
+
if (!element) {
|
|
962
|
+
return
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
element.scrollIntoView({ block: "nearest" })
|
|
966
|
+
|
|
967
|
+
return
|
|
968
|
+
},
|
|
969
|
+
[anchor, rows, cols, setSingleRange]
|
|
970
|
+
)
|
|
971
|
+
|
|
972
|
+
const onUndo = React.useCallback(
|
|
973
|
+
(e: KeyboardEvent) => {
|
|
974
|
+
if (e.shiftKey) {
|
|
975
|
+
redo()
|
|
976
|
+
return
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
undo()
|
|
980
|
+
},
|
|
981
|
+
[redo, undo]
|
|
982
|
+
)
|
|
983
|
+
|
|
984
|
+
const onPaste = React.useCallback(
|
|
985
|
+
(e: ClipboardEvent) => {
|
|
986
|
+
const keys = Object.keys(selection)
|
|
987
|
+
|
|
988
|
+
if (!keys.length) {
|
|
989
|
+
return
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
const prev = getSelectionValues(selection)
|
|
993
|
+
const next: string[][] = []
|
|
994
|
+
|
|
995
|
+
const values = e.clipboardData?.getData("text/plain")
|
|
996
|
+
|
|
997
|
+
if (!values) {
|
|
998
|
+
return
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
const rows = values.split("\n")
|
|
1002
|
+
|
|
1003
|
+
for (const row of rows) {
|
|
1004
|
+
next.push(row.split("\t"))
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
const isInvalid = next.some((row) => row.some((val) => isNaN(+val)))
|
|
1008
|
+
|
|
1009
|
+
if (isInvalid) {
|
|
1010
|
+
notification(
|
|
1011
|
+
t(
|
|
1012
|
+
"price-list-product-prices-form-invalid-data-title",
|
|
1013
|
+
"Invalid data"
|
|
1014
|
+
),
|
|
1015
|
+
t(
|
|
1016
|
+
"price-list-product-prices-form-invalid-data-body",
|
|
1017
|
+
"The data you pasted contains values that are not numbers."
|
|
1018
|
+
),
|
|
1019
|
+
"error"
|
|
1020
|
+
)
|
|
1021
|
+
|
|
1022
|
+
return
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
const pasteComand = new PasteCommand({
|
|
1026
|
+
selection,
|
|
1027
|
+
next,
|
|
1028
|
+
prev,
|
|
1029
|
+
setter: setSelectionValues,
|
|
1030
|
+
})
|
|
1031
|
+
|
|
1032
|
+
execute(pasteComand)
|
|
1033
|
+
},
|
|
1034
|
+
[
|
|
1035
|
+
selection,
|
|
1036
|
+
setSelectionValues,
|
|
1037
|
+
getSelectionValues,
|
|
1038
|
+
execute,
|
|
1039
|
+
notification,
|
|
1040
|
+
t,
|
|
1041
|
+
]
|
|
1042
|
+
)
|
|
1043
|
+
|
|
1044
|
+
const onCopy = React.useCallback(
|
|
1045
|
+
(e: ClipboardEvent) => {
|
|
1046
|
+
const data = getSelectionValues(selection)
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* Format data for copying to clipboard.
|
|
1050
|
+
* The data is tab separated, and each row is separated by a new line.
|
|
1051
|
+
*/
|
|
1052
|
+
const values = data.map((row) => row.join("\t")).join("\n")
|
|
1053
|
+
|
|
1054
|
+
e.preventDefault()
|
|
1055
|
+
e.clipboardData?.setData("text/plain", values)
|
|
1056
|
+
},
|
|
1057
|
+
[getSelectionValues, selection]
|
|
1058
|
+
)
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* Callback for delegating keyboard events to the appropriate handler.
|
|
1062
|
+
*/
|
|
1063
|
+
const onKeyDown = React.useCallback(
|
|
1064
|
+
(e: KeyboardEvent) => {
|
|
1065
|
+
if (open) {
|
|
1066
|
+
return // If the column visibility menu is open, do nothing
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
if (ARROW_KEYS.includes(e.key)) {
|
|
1070
|
+
e.preventDefault()
|
|
1071
|
+
onMoveAnchor(e)
|
|
1072
|
+
|
|
1073
|
+
return
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
if (e.key === "Backspace") {
|
|
1077
|
+
if (isEditing) {
|
|
1078
|
+
return
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
e.preventDefault()
|
|
1082
|
+
onBackspace(e)
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
if (e.key === "z") {
|
|
1086
|
+
onUndo(e)
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
if (e.key === "Tab") {
|
|
1090
|
+
// If the current focus is not within the tableRef, do nothing
|
|
1091
|
+
if (!tableRef.current?.contains(e.target as Node)) {
|
|
1092
|
+
return
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
e.preventDefault()
|
|
1096
|
+
onTab(e)
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1099
|
+
[onMoveAnchor, onBackspace, onUndo, onTab, isEditing, open]
|
|
1100
|
+
)
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* Callback for handling when the user presses the enter key,
|
|
1104
|
+
* on an already active anchor cell.
|
|
1105
|
+
*/
|
|
1106
|
+
const onNextRow = React.useCallback(() => {
|
|
1107
|
+
if (!anchor) {
|
|
1108
|
+
return
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
let col: number | null = anchor.col
|
|
1112
|
+
|
|
1113
|
+
let nextRow = rows.getNext(anchor.row)
|
|
1114
|
+
|
|
1115
|
+
if (!nextRow) {
|
|
1116
|
+
col = cols.getNext(col)
|
|
1117
|
+
|
|
1118
|
+
if (!col) {
|
|
1119
|
+
return
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
nextRow = rows.getFirst()
|
|
1123
|
+
|
|
1124
|
+
if (!nextRow) {
|
|
1125
|
+
return
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
const point = { row: nextRow, col }
|
|
1130
|
+
|
|
1131
|
+
setSingleRange(point)
|
|
1132
|
+
}, [anchor, rows, cols, setSingleRange])
|
|
1133
|
+
|
|
1134
|
+
/** Drag to fill callbacks */
|
|
1135
|
+
|
|
1136
|
+
const onDragToFillStart = React.useCallback(
|
|
1137
|
+
(e: React.MouseEvent) => {
|
|
1138
|
+
const keys = Object.keys(selection)
|
|
1139
|
+
|
|
1140
|
+
if (!keys.length) {
|
|
1141
|
+
return
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
e.preventDefault()
|
|
1145
|
+
e.stopPropagation()
|
|
1146
|
+
|
|
1147
|
+
setIsDragtoFill(true)
|
|
1148
|
+
},
|
|
1149
|
+
[selection]
|
|
1150
|
+
)
|
|
1151
|
+
|
|
1152
|
+
/** Column visibililty callbacks */
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* Toggle the visibility of a currency.
|
|
1156
|
+
*/
|
|
1157
|
+
const toggleCurrency = React.useCallback(
|
|
1158
|
+
(code: string) => {
|
|
1159
|
+
if (visibleCurrencies.includes(code)) {
|
|
1160
|
+
setVisibleCurrencies((prev) => prev.filter((c) => c !== code))
|
|
1161
|
+
} else {
|
|
1162
|
+
setVisibleCurrencies((prev) => [...prev, code])
|
|
1163
|
+
}
|
|
1164
|
+
},
|
|
1165
|
+
[visibleCurrencies]
|
|
1166
|
+
)
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* Toggle the visibility of a region.
|
|
1170
|
+
*/
|
|
1171
|
+
const toggleRegion = React.useCallback(
|
|
1172
|
+
(id: string) => {
|
|
1173
|
+
if (visibleRegions.includes(id)) {
|
|
1174
|
+
setVisibleRegions((prev) => prev.filter((c) => c !== id))
|
|
1175
|
+
} else {
|
|
1176
|
+
setVisibleRegions((prev) => [...prev, id])
|
|
1177
|
+
}
|
|
1178
|
+
},
|
|
1179
|
+
[visibleRegions]
|
|
1180
|
+
)
|
|
1181
|
+
|
|
1182
|
+
/** Effects */
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* If anchor and rangeEnd are set, then select all cells between them.
|
|
1186
|
+
*/
|
|
1187
|
+
React.useEffect(() => {
|
|
1188
|
+
if (!anchor || !rangeEnd) {
|
|
1189
|
+
return
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
const range = getRange(anchor, rangeEnd)
|
|
1193
|
+
|
|
1194
|
+
setSelection(range)
|
|
1195
|
+
}, [anchor, rangeEnd])
|
|
1196
|
+
|
|
1197
|
+
React.useEffect(() => {
|
|
1198
|
+
if (!anchor || !dragToFillRangeEnd) {
|
|
1199
|
+
return
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
const range = getRange(anchor, dragToFillRangeEnd)
|
|
1203
|
+
|
|
1204
|
+
setDragSelection(range)
|
|
1205
|
+
}, [anchor, dragToFillRangeEnd])
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* Auto corrective effect for ensuring that the anchor is always
|
|
1209
|
+
* part of the selected cells.
|
|
1210
|
+
*/
|
|
1211
|
+
React.useEffect(() => {
|
|
1212
|
+
if (!anchor) {
|
|
1213
|
+
return
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
setSelection((prev) => ({
|
|
1217
|
+
...prev,
|
|
1218
|
+
[getKey(anchor)]: true,
|
|
1219
|
+
}))
|
|
1220
|
+
}, [anchor])
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Auto corrective effect for ensuring we always
|
|
1224
|
+
* have a range end.
|
|
1225
|
+
*/
|
|
1226
|
+
React.useEffect(() => {
|
|
1227
|
+
if (!anchor) {
|
|
1228
|
+
return
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
if (rangeEnd) {
|
|
1232
|
+
return
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
setRangeEnd(anchor)
|
|
1236
|
+
}, [anchor, rangeEnd])
|
|
1237
|
+
|
|
1238
|
+
React.useEffect(() => {
|
|
1239
|
+
/**
|
|
1240
|
+
* If the user is dragging, do nothing.
|
|
1241
|
+
*/
|
|
1242
|
+
if (isDragging) {
|
|
1243
|
+
return
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
const keys = Object.keys(selection)
|
|
1247
|
+
|
|
1248
|
+
if (keys.length === 0) {
|
|
1249
|
+
return
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
const points = keys
|
|
1253
|
+
.map((key) => {
|
|
1254
|
+
return getPoint(key)
|
|
1255
|
+
})
|
|
1256
|
+
.filter((point) => !!point) as Point[]
|
|
1257
|
+
|
|
1258
|
+
const boundingBoxes = calculateBoundingBoxes(points)
|
|
1259
|
+
|
|
1260
|
+
setBoundingBoxes(boundingBoxes)
|
|
1261
|
+
}, [isDragging, selection])
|
|
1262
|
+
|
|
1263
|
+
React.useEffect(() => {
|
|
1264
|
+
const keys = Object.keys(dragSelection)
|
|
1265
|
+
|
|
1266
|
+
if (keys.length === 0) {
|
|
1267
|
+
return
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
const points = keys
|
|
1271
|
+
.map((key) => {
|
|
1272
|
+
return getPoint(key)
|
|
1273
|
+
})
|
|
1274
|
+
.filter((point) => !!point) as Point[]
|
|
1275
|
+
|
|
1276
|
+
const boundingBoxes = calculateBoundingBoxes(points)
|
|
1277
|
+
|
|
1278
|
+
setDragBoundingBoxes(boundingBoxes)
|
|
1279
|
+
}, [dragSelection])
|
|
1280
|
+
|
|
1281
|
+
/**
|
|
1282
|
+
* Add event listeners for all events that the bulk editor needs to handle.
|
|
1283
|
+
*/
|
|
1284
|
+
React.useEffect(() => {
|
|
1285
|
+
document.addEventListener("mouseup", onMouseUp)
|
|
1286
|
+
|
|
1287
|
+
document.addEventListener("keydown", onKeyDown)
|
|
1288
|
+
|
|
1289
|
+
document.addEventListener("copy", onCopy)
|
|
1290
|
+
document.addEventListener("paste", onPaste)
|
|
1291
|
+
|
|
1292
|
+
return () => {
|
|
1293
|
+
document.removeEventListener("mouseup", onMouseUp)
|
|
1294
|
+
|
|
1295
|
+
document.removeEventListener("keydown", onKeyDown)
|
|
1296
|
+
|
|
1297
|
+
document.removeEventListener("copy", onCopy)
|
|
1298
|
+
document.removeEventListener("paste", onPaste)
|
|
1299
|
+
}
|
|
1300
|
+
}, [onMouseUp, onKeyDown, onCopy, onPaste])
|
|
1301
|
+
|
|
1302
|
+
React.useEffect(() => {
|
|
1303
|
+
const table = tableRef.current
|
|
1304
|
+
|
|
1305
|
+
if (!table) {
|
|
1306
|
+
return
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
const onFocus = (_e: FocusEvent) => {
|
|
1310
|
+
if (anchor) {
|
|
1311
|
+
return
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
const firstRow = rows.getFirst()
|
|
1315
|
+
const firstCol = cols.getFirst()
|
|
1316
|
+
|
|
1317
|
+
if (!firstRow || !firstCol) {
|
|
1318
|
+
return
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
setSingleRange({ row: firstRow, col: firstCol })
|
|
1322
|
+
const element = getElementFromPoint(
|
|
1323
|
+
{ row: firstRow, col: firstCol },
|
|
1324
|
+
table
|
|
1325
|
+
)
|
|
1326
|
+
|
|
1327
|
+
if (!element) {
|
|
1328
|
+
return
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
element.scrollIntoView({ block: "nearest" })
|
|
1332
|
+
element.focus()
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
table.addEventListener("focusin", onFocus)
|
|
1336
|
+
|
|
1337
|
+
return () => {
|
|
1338
|
+
table.removeEventListener("focusin", onFocus)
|
|
1339
|
+
}
|
|
1340
|
+
}, [setSingleRange, clearRange, anchor, rows, cols])
|
|
1341
|
+
|
|
1342
|
+
React.useEffect(() => {
|
|
1343
|
+
if (!anchor) {
|
|
1344
|
+
return
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
const table = tableRef.current
|
|
1348
|
+
const element = getElementFromPoint(anchor, table)
|
|
1349
|
+
|
|
1350
|
+
if (!element) {
|
|
1351
|
+
return
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
element.focus()
|
|
1355
|
+
}, [anchor])
|
|
1356
|
+
|
|
1357
|
+
const [selectionRect, setSelectionRect] = React.useState<RectStyles | null>(
|
|
1358
|
+
null
|
|
1359
|
+
)
|
|
1360
|
+
|
|
1361
|
+
const [dragSelectionRect, setDragSelectionRect] =
|
|
1362
|
+
React.useState<RectStyles | null>(null)
|
|
1363
|
+
|
|
1364
|
+
const [anchorRect, setAnchorRect] = React.useState<RectStyles | null>(null)
|
|
1365
|
+
|
|
1366
|
+
React.useEffect(() => {
|
|
1367
|
+
const styles = getRect(selection, tableRef.current)
|
|
1368
|
+
|
|
1369
|
+
setSelectionRect(styles)
|
|
1370
|
+
}, [selection])
|
|
1371
|
+
|
|
1372
|
+
React.useEffect(() => {
|
|
1373
|
+
const styles = getRect(dragSelection, tableRef.current)
|
|
1374
|
+
|
|
1375
|
+
setDragSelectionRect(styles)
|
|
1376
|
+
}, [dragSelection])
|
|
1377
|
+
|
|
1378
|
+
React.useEffect(() => {
|
|
1379
|
+
if (!anchor) {
|
|
1380
|
+
setAnchorRect(null)
|
|
1381
|
+
return
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
const styles = getRect({ [getKey(anchor)]: true }, tableRef.current)
|
|
1385
|
+
|
|
1386
|
+
setAnchorRect(styles)
|
|
1387
|
+
}, [anchor])
|
|
1388
|
+
|
|
1389
|
+
return (
|
|
1390
|
+
<div className="h-full">
|
|
1391
|
+
<div className="border-ui-border-base flex items-center justify-between border-b px-4 py-3">
|
|
1392
|
+
<DropdownMenu open={open} onOpenChange={setOpen}>
|
|
1393
|
+
<DropdownMenu.Trigger asChild>
|
|
1394
|
+
<Button variant="secondary" type="button">
|
|
1395
|
+
<Adjustments className="text-ui-fg-subtle" />
|
|
1396
|
+
{t(
|
|
1397
|
+
"price-list-product-prices-form-column-visibility-button",
|
|
1398
|
+
"Currencies"
|
|
1399
|
+
)}
|
|
1400
|
+
</Button>
|
|
1401
|
+
</DropdownMenu.Trigger>
|
|
1402
|
+
<DropdownMenu.Content
|
|
1403
|
+
className="no-scrollbar max-h-[var(--radix-popper-available-height)] overflow-y-auto"
|
|
1404
|
+
collisionPadding={16}
|
|
1405
|
+
>
|
|
1406
|
+
<DropdownMenu.Label>
|
|
1407
|
+
{t(
|
|
1408
|
+
"price-list-product-prices-form-column-visibility-currencies-label",
|
|
1409
|
+
"Currencies"
|
|
1410
|
+
)}
|
|
1411
|
+
</DropdownMenu.Label>
|
|
1412
|
+
{currencies.map((currency) => {
|
|
1413
|
+
return (
|
|
1414
|
+
<DropdownMenu.CheckboxItem
|
|
1415
|
+
checked={visibleCurrencies.includes(currency.code)}
|
|
1416
|
+
onClick={(e) => {
|
|
1417
|
+
e.stopPropagation()
|
|
1418
|
+
e.preventDefault()
|
|
1419
|
+
toggleCurrency(currency.code)
|
|
1420
|
+
}}
|
|
1421
|
+
key={currency.code}
|
|
1422
|
+
>
|
|
1423
|
+
<span>
|
|
1424
|
+
{currency.name}{" "}
|
|
1425
|
+
<span className="text-ui-fg-subtle">
|
|
1426
|
+
({currency.code.toUpperCase()})
|
|
1427
|
+
</span>
|
|
1428
|
+
</span>
|
|
1429
|
+
</DropdownMenu.CheckboxItem>
|
|
1430
|
+
)
|
|
1431
|
+
})}
|
|
1432
|
+
<DropdownMenu.Separator />
|
|
1433
|
+
<DropdownMenu.Label>
|
|
1434
|
+
{t(
|
|
1435
|
+
"price-list-product-prices-form-column-visibility-regions-label",
|
|
1436
|
+
"Regions"
|
|
1437
|
+
)}
|
|
1438
|
+
</DropdownMenu.Label>
|
|
1439
|
+
{regions.map((region) => {
|
|
1440
|
+
return (
|
|
1441
|
+
<DropdownMenu.CheckboxItem
|
|
1442
|
+
checked={visibleRegions.includes(region.id)}
|
|
1443
|
+
onClick={(e) => {
|
|
1444
|
+
e.stopPropagation()
|
|
1445
|
+
e.preventDefault()
|
|
1446
|
+
toggleRegion(region.id)
|
|
1447
|
+
}}
|
|
1448
|
+
key={region.id}
|
|
1449
|
+
>
|
|
1450
|
+
<span>
|
|
1451
|
+
{region.name}{" "}
|
|
1452
|
+
<span className="text-ui-fg-subtle">
|
|
1453
|
+
({region.currency_code.toUpperCase()})
|
|
1454
|
+
</span>
|
|
1455
|
+
</span>
|
|
1456
|
+
</DropdownMenu.CheckboxItem>
|
|
1457
|
+
)
|
|
1458
|
+
})}
|
|
1459
|
+
</DropdownMenu.Content>
|
|
1460
|
+
</DropdownMenu>
|
|
1461
|
+
</div>
|
|
1462
|
+
<div
|
|
1463
|
+
ref={containerRef}
|
|
1464
|
+
className="relative h-[calc(100%-57px)] w-full overflow-auto"
|
|
1465
|
+
>
|
|
1466
|
+
<div
|
|
1467
|
+
role="presentation"
|
|
1468
|
+
style={
|
|
1469
|
+
anchorRect
|
|
1470
|
+
? anchorRect
|
|
1471
|
+
: {
|
|
1472
|
+
display: "none",
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
className="border-ui-border-interactive pointer-events-none absolute z-[52] border"
|
|
1476
|
+
/>
|
|
1477
|
+
<div
|
|
1478
|
+
role="presentation"
|
|
1479
|
+
style={
|
|
1480
|
+
selectionRect
|
|
1481
|
+
? selectionRect
|
|
1482
|
+
: {
|
|
1483
|
+
display: "none",
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
className="border-ui-border-interactive pointer-events-none absolute z-[51] border"
|
|
1487
|
+
/>
|
|
1488
|
+
<div
|
|
1489
|
+
role="presentation"
|
|
1490
|
+
style={
|
|
1491
|
+
dragSelectionRect
|
|
1492
|
+
? dragSelectionRect
|
|
1493
|
+
: {
|
|
1494
|
+
display: "none",
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
className={clx(
|
|
1498
|
+
"border-ui-border-interactive pointer-events-none absolute z-50 border border-dashed",
|
|
1499
|
+
{
|
|
1500
|
+
"border-b-0": dragRelativePosition === "above",
|
|
1501
|
+
"border-t-0": dragRelativePosition === "below",
|
|
1502
|
+
"border-l-0": dragRelativePosition === "right",
|
|
1503
|
+
"border-r-0": dragRelativePosition === "left",
|
|
1504
|
+
}
|
|
1505
|
+
)}
|
|
1506
|
+
/>
|
|
1507
|
+
<table
|
|
1508
|
+
className={clx("txt-compact-small text-ui-fg-base w-full", {
|
|
1509
|
+
"select-none": isDragging,
|
|
1510
|
+
})}
|
|
1511
|
+
ref={tableRef}
|
|
1512
|
+
>
|
|
1513
|
+
<thead>
|
|
1514
|
+
<tr className="[&_th]:txt-compact-small-plus text-ui-fg-subtle [&_th]:border-ui-border-base h-10 [&_th:last-of-type]:border-r-0 [&_th]:min-w-[220px] [&_th]:border-b [&_th]:border-r">
|
|
1515
|
+
<th className="max-w-[220px] text-left">
|
|
1516
|
+
<div className="px-4 py-2.5">
|
|
1517
|
+
{t(
|
|
1518
|
+
"price-list-product-prices-form-column-product-label",
|
|
1519
|
+
"Product"
|
|
1520
|
+
)}
|
|
1521
|
+
</div>
|
|
1522
|
+
</th>
|
|
1523
|
+
{currencies.map((currency) => {
|
|
1524
|
+
const isTaxIncluded =
|
|
1525
|
+
priceListTaxInclusive ?? currency.includes_tax
|
|
1526
|
+
|
|
1527
|
+
if (!visibleCurrencies.includes(currency.code)) {
|
|
1528
|
+
return null
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
return (
|
|
1532
|
+
<th className="text-left" key={currency.code}>
|
|
1533
|
+
<div className="flex items-center justify-between px-4 py-2.5">
|
|
1534
|
+
<span>
|
|
1535
|
+
{t(
|
|
1536
|
+
"price-list-product-prices-form-column-currencies-price-label",
|
|
1537
|
+
"Price {{code}}",
|
|
1538
|
+
{
|
|
1539
|
+
code: currency.code.toUpperCase(),
|
|
1540
|
+
}
|
|
1541
|
+
)}
|
|
1542
|
+
</span>
|
|
1543
|
+
{taxInclEnabled && (
|
|
1544
|
+
<div>
|
|
1545
|
+
{isTaxIncluded && (
|
|
1546
|
+
<BuildingTax className="text-ui-fg-subtle" />
|
|
1547
|
+
)}
|
|
1548
|
+
</div>
|
|
1549
|
+
)}
|
|
1550
|
+
</div>
|
|
1551
|
+
</th>
|
|
1552
|
+
)
|
|
1553
|
+
})}
|
|
1554
|
+
{regions.map((region) => {
|
|
1555
|
+
const isTaxIncluded =
|
|
1556
|
+
priceListTaxInclusive ?? region.includes_tax
|
|
1557
|
+
|
|
1558
|
+
if (!visibleRegions.includes(region.id)) {
|
|
1559
|
+
return null
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
return (
|
|
1563
|
+
<th className="text-left" key={region.id}>
|
|
1564
|
+
<div className="flex items-center justify-between px-4 py-2.5">
|
|
1565
|
+
<span>
|
|
1566
|
+
{t(
|
|
1567
|
+
"price-list-product-prices-form-column-regions-price-label",
|
|
1568
|
+
"Price {{name}} ({{code}})",
|
|
1569
|
+
{
|
|
1570
|
+
name: region.name,
|
|
1571
|
+
code: region.currency_code.toUpperCase(),
|
|
1572
|
+
}
|
|
1573
|
+
)}
|
|
1574
|
+
</span>
|
|
1575
|
+
{taxInclEnabled && (
|
|
1576
|
+
<div>
|
|
1577
|
+
{isTaxIncluded && (
|
|
1578
|
+
<BuildingTax className="text-ui-fg-subtle" />
|
|
1579
|
+
)}
|
|
1580
|
+
</div>
|
|
1581
|
+
)}
|
|
1582
|
+
</div>
|
|
1583
|
+
</th>
|
|
1584
|
+
)
|
|
1585
|
+
})}
|
|
1586
|
+
</tr>
|
|
1587
|
+
</thead>
|
|
1588
|
+
<tbody>
|
|
1589
|
+
<tr className="bg-ui-bg-subtle h-10 [&_td:last-of-type]:border-r-0 [&_td]:border-b [&_td]:border-r">
|
|
1590
|
+
<td className="w-[220px] max-w-[220px]">
|
|
1591
|
+
<div className="grid w-[220px] grid-cols-[16px_1fr] gap-x-3 overflow-hidden px-4 py-2.5">
|
|
1592
|
+
<div className="bg-ui-bg-component h-[22px] w-4 rounded-[4px]">
|
|
1593
|
+
{product.thumbnail && (
|
|
1594
|
+
<img
|
|
1595
|
+
src={product.thumbnail}
|
|
1596
|
+
className="h-full w-full object-cover"
|
|
1597
|
+
/>
|
|
1598
|
+
)}
|
|
1599
|
+
</div>
|
|
1600
|
+
<div className="flex items-center">
|
|
1601
|
+
<p className="w-[160px] overflow-hidden text-ellipsis whitespace-nowrap">
|
|
1602
|
+
{product.title}
|
|
1603
|
+
</p>
|
|
1604
|
+
</div>
|
|
1605
|
+
</div>
|
|
1606
|
+
</td>
|
|
1607
|
+
{currencies.map((currency) => {
|
|
1608
|
+
if (!visibleCurrencies.includes(currency.code)) {
|
|
1609
|
+
return null
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
return (
|
|
1613
|
+
<td key={currency.code}>
|
|
1614
|
+
<div className="text-ui-fg-muted px-4 py-2.5 text-right">
|
|
1615
|
+
-
|
|
1616
|
+
</div>
|
|
1617
|
+
</td>
|
|
1618
|
+
)
|
|
1619
|
+
})}
|
|
1620
|
+
{regions.map((region) => {
|
|
1621
|
+
if (!visibleRegions.includes(region.id)) {
|
|
1622
|
+
return null
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
return (
|
|
1626
|
+
<td key={region.id}>
|
|
1627
|
+
<div className="text-ui-fg-muted px-4 py-2.5 text-right">
|
|
1628
|
+
-
|
|
1629
|
+
</div>
|
|
1630
|
+
</td>
|
|
1631
|
+
)
|
|
1632
|
+
})}
|
|
1633
|
+
</tr>
|
|
1634
|
+
{product.variants.map((variant) => {
|
|
1635
|
+
return (
|
|
1636
|
+
<tr
|
|
1637
|
+
key={variant.id}
|
|
1638
|
+
className="[&_td]:border-r-ui-border-base [&_td]:border-b-ui-border-base h-10 [&_td:last-of-type]:border-r-transparent [&_td]:border [&_td]:border-l-transparent [&_td]:border-t-transparent"
|
|
1639
|
+
>
|
|
1640
|
+
<td className="max-w-[220px]">
|
|
1641
|
+
<div className="flex w-[220px] items-center gap-x-3 overflow-hidden px-4 py-2.5">
|
|
1642
|
+
<div className="h-[22px] w-4" />
|
|
1643
|
+
<p className="text-ui-fg-subtle w-[160px] overflow-hidden text-ellipsis whitespace-nowrap">
|
|
1644
|
+
<span>{variant.title}</span>
|
|
1645
|
+
{variant.sku && <span className="px-2">·</span>}
|
|
1646
|
+
{variant.sku && <span>{variant.sku}</span>}
|
|
1647
|
+
</p>
|
|
1648
|
+
</div>
|
|
1649
|
+
</td>
|
|
1650
|
+
{currencies.map((currency) => {
|
|
1651
|
+
if (!visibleCurrencies.includes(currency.code)) {
|
|
1652
|
+
return null
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
const meta = CURRENCY_MAP[currency.code.toUpperCase()]
|
|
1656
|
+
|
|
1657
|
+
return (
|
|
1658
|
+
<Controller
|
|
1659
|
+
key={currency.code}
|
|
1660
|
+
control={control}
|
|
1661
|
+
name={`variants.${variant.id}.currency.${currency.code}.amount`}
|
|
1662
|
+
render={({ field }) => {
|
|
1663
|
+
return (
|
|
1664
|
+
<Cell
|
|
1665
|
+
symbol={meta.symbol_native}
|
|
1666
|
+
decimalScale={meta.decimal_digits}
|
|
1667
|
+
type="amount"
|
|
1668
|
+
variantId={variant.id}
|
|
1669
|
+
currencyCode={currency.code}
|
|
1670
|
+
onRegisterCell={onRegisterCell}
|
|
1671
|
+
onUnregisterCell={onUnregisterCell}
|
|
1672
|
+
onDragToFillStart={onDragToFillStart}
|
|
1673
|
+
onCellMouseDown={onCellMouseDown}
|
|
1674
|
+
onCellOver={onCellOver}
|
|
1675
|
+
getCellState={getCellState}
|
|
1676
|
+
setIsEditing={setIsEditing}
|
|
1677
|
+
onNextRow={onNextRow}
|
|
1678
|
+
{...field}
|
|
1679
|
+
/>
|
|
1680
|
+
)
|
|
1681
|
+
}}
|
|
1682
|
+
/>
|
|
1683
|
+
)
|
|
1684
|
+
})}
|
|
1685
|
+
{regions.map((region) => {
|
|
1686
|
+
if (!visibleRegions.includes(region.id)) {
|
|
1687
|
+
return null
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
const meta =
|
|
1691
|
+
CURRENCY_MAP[region.currency_code.toUpperCase()]
|
|
1692
|
+
|
|
1693
|
+
return (
|
|
1694
|
+
<Controller
|
|
1695
|
+
key={region.id}
|
|
1696
|
+
control={control}
|
|
1697
|
+
name={`variants.${variant.id}.region.${region.id}.amount`}
|
|
1698
|
+
render={({ field }) => {
|
|
1699
|
+
return (
|
|
1700
|
+
<Cell
|
|
1701
|
+
symbol={meta.symbol_native}
|
|
1702
|
+
decimalScale={meta.decimal_digits}
|
|
1703
|
+
type="amount"
|
|
1704
|
+
variantId={variant.id}
|
|
1705
|
+
regionId={region.id}
|
|
1706
|
+
onRegisterCell={onRegisterCell}
|
|
1707
|
+
onUnregisterCell={onUnregisterCell}
|
|
1708
|
+
onDragToFillStart={onDragToFillStart}
|
|
1709
|
+
onCellMouseDown={onCellMouseDown}
|
|
1710
|
+
onCellOver={onCellOver}
|
|
1711
|
+
getCellState={getCellState}
|
|
1712
|
+
setIsEditing={setIsEditing}
|
|
1713
|
+
onNextRow={onNextRow}
|
|
1714
|
+
{...field}
|
|
1715
|
+
/>
|
|
1716
|
+
)
|
|
1717
|
+
}}
|
|
1718
|
+
/>
|
|
1719
|
+
)
|
|
1720
|
+
})}
|
|
1721
|
+
</tr>
|
|
1722
|
+
)
|
|
1723
|
+
})}
|
|
1724
|
+
</tbody>
|
|
1725
|
+
</table>
|
|
1726
|
+
</div>
|
|
1727
|
+
</div>
|
|
1728
|
+
)
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
const Cell = React.forwardRef<HTMLInputElement, CellProps>(
|
|
1732
|
+
(
|
|
1733
|
+
{
|
|
1734
|
+
value,
|
|
1735
|
+
name,
|
|
1736
|
+
type,
|
|
1737
|
+
onChange,
|
|
1738
|
+
onBlur,
|
|
1739
|
+
onRegisterCell,
|
|
1740
|
+
onUnregisterCell,
|
|
1741
|
+
onDragToFillStart,
|
|
1742
|
+
onCellMouseDown,
|
|
1743
|
+
onCellOver,
|
|
1744
|
+
getCellState,
|
|
1745
|
+
setIsEditing,
|
|
1746
|
+
onNextRow,
|
|
1747
|
+
symbol,
|
|
1748
|
+
decimalScale,
|
|
1749
|
+
variantId,
|
|
1750
|
+
regionId,
|
|
1751
|
+
currencyCode,
|
|
1752
|
+
},
|
|
1753
|
+
ref
|
|
1754
|
+
) => {
|
|
1755
|
+
const [localValue, setLocalValue] = React.useState<
|
|
1756
|
+
{ value?: string; float?: number } | undefined
|
|
1757
|
+
>(value ? { value, float: parseFloat(value) } : undefined)
|
|
1758
|
+
|
|
1759
|
+
const [isActive, setIsActive] = React.useState(false)
|
|
1760
|
+
|
|
1761
|
+
const [point, setPoint] = React.useState<Point | null>(null)
|
|
1762
|
+
|
|
1763
|
+
const cellRef = React.useRef<HTMLTableCellElement>(null)
|
|
1764
|
+
const inputRef = React.useRef<HTMLInputElement>(null)
|
|
1765
|
+
|
|
1766
|
+
React.useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(
|
|
1767
|
+
ref,
|
|
1768
|
+
() => inputRef.current
|
|
1769
|
+
)
|
|
1770
|
+
|
|
1771
|
+
const cellIndex = cellRef.current?.cellIndex
|
|
1772
|
+
const rowIndex = isParentRow(cellRef.current)
|
|
1773
|
+
? cellRef.current.parentElement.rowIndex
|
|
1774
|
+
: undefined
|
|
1775
|
+
|
|
1776
|
+
/**
|
|
1777
|
+
* If the managed value changes,
|
|
1778
|
+
* while the cell is not active, then
|
|
1779
|
+
* we want to update the local value.
|
|
1780
|
+
*/
|
|
1781
|
+
React.useEffect(() => {
|
|
1782
|
+
if (isActive) {
|
|
1783
|
+
return
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
setLocalValue(value ? { value, float: parseFloat(value) } : { value: "" })
|
|
1787
|
+
}, [value, isActive])
|
|
1788
|
+
|
|
1789
|
+
React.useEffect(() => {
|
|
1790
|
+
if (!cellIndex || !rowIndex) {
|
|
1791
|
+
return
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
const point = { col: cellIndex, row: rowIndex }
|
|
1795
|
+
|
|
1796
|
+
onRegisterCell(point)
|
|
1797
|
+
setPoint(point)
|
|
1798
|
+
|
|
1799
|
+
return () => {
|
|
1800
|
+
onUnregisterCell(point)
|
|
1801
|
+
}
|
|
1802
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1803
|
+
}, [cellIndex, rowIndex])
|
|
1804
|
+
|
|
1805
|
+
const { isAnchor, isSelected, borders } = getCellState(point)
|
|
1806
|
+
|
|
1807
|
+
React.useEffect(() => {
|
|
1808
|
+
if (!inputRef.current) {
|
|
1809
|
+
return
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
if (!isActive) {
|
|
1813
|
+
/**
|
|
1814
|
+
* If the user leaves a decimal separator as the last character,
|
|
1815
|
+
* then we need to manually remove it.
|
|
1816
|
+
*/
|
|
1817
|
+
const strippedValue =
|
|
1818
|
+
localValue?.value && localValue.value.endsWith("." || ",")
|
|
1819
|
+
? localValue.value.slice(0, -1)
|
|
1820
|
+
: localValue?.value
|
|
1821
|
+
|
|
1822
|
+
/**
|
|
1823
|
+
* react-currency-input-field passes undefined when the input is empty.
|
|
1824
|
+
* This conflicts with react-hook-form, which internally uses undefined
|
|
1825
|
+
* to indicate that the field should use its default value.
|
|
1826
|
+
*
|
|
1827
|
+
* To work around this, we convert undefined to an empty string.
|
|
1828
|
+
*/
|
|
1829
|
+
const formattedValue = strippedValue
|
|
1830
|
+
? formatValue({
|
|
1831
|
+
value: strippedValue.replace(/,/g, "."), // If the current locale uses commas as decimal separators, then we need to replace them with dots.
|
|
1832
|
+
decimalScale: decimalScale ?? 0,
|
|
1833
|
+
decimalSeparator: ".",
|
|
1834
|
+
disableGroupSeparators: true,
|
|
1835
|
+
})
|
|
1836
|
+
: ""
|
|
1837
|
+
|
|
1838
|
+
onChange(formattedValue)
|
|
1839
|
+
|
|
1840
|
+
inputRef.current.blur()
|
|
1841
|
+
return
|
|
1842
|
+
}
|
|
1843
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1844
|
+
}, [isActive, onChange])
|
|
1845
|
+
|
|
1846
|
+
React.useEffect(() => {
|
|
1847
|
+
if (!isAnchor) {
|
|
1848
|
+
setIsActive(false)
|
|
1849
|
+
setIsEditing(false)
|
|
1850
|
+
|
|
1851
|
+
inputRef.current?.blur()
|
|
1852
|
+
onBlur()
|
|
1853
|
+
}
|
|
1854
|
+
}, [isAnchor, onBlur, setIsEditing])
|
|
1855
|
+
|
|
1856
|
+
const onFocusInput = React.useCallback(() => {
|
|
1857
|
+
inputRef.current?.focus()
|
|
1858
|
+
|
|
1859
|
+
inputRef.current?.setSelectionRange(
|
|
1860
|
+
inputRef.current.value.length,
|
|
1861
|
+
inputRef.current.value.length
|
|
1862
|
+
)
|
|
1863
|
+
}, [])
|
|
1864
|
+
|
|
1865
|
+
const onMouseDown = React.useCallback(
|
|
1866
|
+
(e: React.MouseEvent) => {
|
|
1867
|
+
e.stopPropagation()
|
|
1868
|
+
e.preventDefault()
|
|
1869
|
+
|
|
1870
|
+
if (isActive) {
|
|
1871
|
+
/**
|
|
1872
|
+
* If the cell is active, then we don't want to
|
|
1873
|
+
* do anything.
|
|
1874
|
+
*/
|
|
1875
|
+
return
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
if (isAnchor) {
|
|
1879
|
+
/**
|
|
1880
|
+
* If the cell is the anchor, then we want to
|
|
1881
|
+
* toggle the active state on double click.
|
|
1882
|
+
* If not a double click, then we want to
|
|
1883
|
+
* do nothing.
|
|
1884
|
+
*/
|
|
1885
|
+
if (e.detail === 2) {
|
|
1886
|
+
setIsActive(true)
|
|
1887
|
+
setIsEditing(true)
|
|
1888
|
+
|
|
1889
|
+
onFocusInput()
|
|
1890
|
+
|
|
1891
|
+
return
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
onCellMouseDown(e)
|
|
1896
|
+
},
|
|
1897
|
+
[onCellMouseDown, setIsEditing, onFocusInput, isAnchor, isActive]
|
|
1898
|
+
)
|
|
1899
|
+
|
|
1900
|
+
const onEnter = React.useCallback(
|
|
1901
|
+
(_e: KeyboardEvent) => {
|
|
1902
|
+
if (!isAnchor) {
|
|
1903
|
+
return
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
if (isActive) {
|
|
1907
|
+
onNextRow()
|
|
1908
|
+
return
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
setIsActive(true)
|
|
1912
|
+
setIsEditing(true)
|
|
1913
|
+
|
|
1914
|
+
onFocusInput()
|
|
1915
|
+
},
|
|
1916
|
+
[isAnchor, isActive, onNextRow, setIsEditing, onFocusInput]
|
|
1917
|
+
)
|
|
1918
|
+
|
|
1919
|
+
const onSpace = React.useCallback(
|
|
1920
|
+
(e: KeyboardEvent) => {
|
|
1921
|
+
if (!isAnchor) {
|
|
1922
|
+
return
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
if (isActive) {
|
|
1926
|
+
return
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
e.stopPropagation()
|
|
1930
|
+
e.preventDefault()
|
|
1931
|
+
|
|
1932
|
+
setIsActive(true)
|
|
1933
|
+
setIsEditing(true)
|
|
1934
|
+
setLocalValue({
|
|
1935
|
+
value: "",
|
|
1936
|
+
})
|
|
1937
|
+
|
|
1938
|
+
inputRef.current?.focus()
|
|
1939
|
+
},
|
|
1940
|
+
[isAnchor, isActive, setLocalValue, setIsEditing]
|
|
1941
|
+
)
|
|
1942
|
+
|
|
1943
|
+
const onNumberKey = React.useCallback(
|
|
1944
|
+
(e: KeyboardEvent) => {
|
|
1945
|
+
if (!isAnchor) {
|
|
1946
|
+
return // This is not the anchor cell, so we don't want to do anything.
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
if (isActive) {
|
|
1950
|
+
// If the cell is active, then we don't want to hijack the event.
|
|
1951
|
+
return
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
e.stopPropagation()
|
|
1955
|
+
e.preventDefault()
|
|
1956
|
+
|
|
1957
|
+
setIsActive(true)
|
|
1958
|
+
setIsEditing(true)
|
|
1959
|
+
|
|
1960
|
+
const key = e.key
|
|
1961
|
+
setLocalValue({
|
|
1962
|
+
float: parseFloat(key),
|
|
1963
|
+
value: String(key),
|
|
1964
|
+
})
|
|
1965
|
+
|
|
1966
|
+
inputRef.current?.focus()
|
|
1967
|
+
},
|
|
1968
|
+
[isAnchor, isActive, setIsEditing]
|
|
1969
|
+
)
|
|
1970
|
+
|
|
1971
|
+
const onArrowKey = React.useCallback(
|
|
1972
|
+
(e: KeyboardEvent) => {
|
|
1973
|
+
if (!isActive || !inputRef.current) {
|
|
1974
|
+
return
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
const input = inputRef.current
|
|
1978
|
+
const currentPosition = input.selectionStart
|
|
1979
|
+
const textLength = input.value.length
|
|
1980
|
+
|
|
1981
|
+
if (currentPosition === null) {
|
|
1982
|
+
input.setSelectionRange(0, 0)
|
|
1983
|
+
return
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
switch (e.key) {
|
|
1987
|
+
case "ArrowUp":
|
|
1988
|
+
input.setSelectionRange(0, 0)
|
|
1989
|
+
break
|
|
1990
|
+
case "ArrowDown":
|
|
1991
|
+
input.setSelectionRange(textLength, textLength)
|
|
1992
|
+
break
|
|
1993
|
+
case "ArrowLeft":
|
|
1994
|
+
if (currentPosition === 0) {
|
|
1995
|
+
return
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
input.setSelectionRange(currentPosition - 1, currentPosition - 1)
|
|
1999
|
+
break
|
|
2000
|
+
case "ArrowRight":
|
|
2001
|
+
if (currentPosition === textLength) {
|
|
2002
|
+
return
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
input.setSelectionRange(currentPosition + 1, currentPosition + 1)
|
|
2006
|
+
break
|
|
2007
|
+
}
|
|
2008
|
+
},
|
|
2009
|
+
[isActive]
|
|
2010
|
+
)
|
|
2011
|
+
|
|
2012
|
+
const onEscape = React.useCallback(
|
|
2013
|
+
(e: KeyboardEvent) => {
|
|
2014
|
+
if (!isActive) {
|
|
2015
|
+
return
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
e.stopPropagation()
|
|
2019
|
+
e.preventDefault()
|
|
2020
|
+
|
|
2021
|
+
inputRef.current?.focus()
|
|
2022
|
+
setIsActive(false)
|
|
2023
|
+
|
|
2024
|
+
onBlur()
|
|
2025
|
+
|
|
2026
|
+
return
|
|
2027
|
+
},
|
|
2028
|
+
[isActive, onBlur]
|
|
2029
|
+
)
|
|
2030
|
+
|
|
2031
|
+
const onKeydown = React.useCallback(
|
|
2032
|
+
(e: KeyboardEvent) => {
|
|
2033
|
+
if (e.key === "Enter") {
|
|
2034
|
+
onEnter(e)
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
if (e.key === " ") {
|
|
2038
|
+
onSpace(e)
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
if (ARROW_KEYS.includes(e.key)) {
|
|
2042
|
+
onArrowKey(e)
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
if (!isNaN(parseInt(e.key))) {
|
|
2046
|
+
onNumberKey(e)
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
if (e.key === "Escape") {
|
|
2050
|
+
onEscape(e)
|
|
2051
|
+
}
|
|
2052
|
+
},
|
|
2053
|
+
[onEnter, onSpace, onArrowKey, onNumberKey, onEscape]
|
|
2054
|
+
)
|
|
2055
|
+
|
|
2056
|
+
React.useEffect(() => {
|
|
2057
|
+
document.addEventListener("keydown", onKeydown)
|
|
2058
|
+
|
|
2059
|
+
return () => {
|
|
2060
|
+
document.removeEventListener("keydown", onKeydown)
|
|
2061
|
+
}
|
|
2062
|
+
}, [onKeydown])
|
|
2063
|
+
|
|
2064
|
+
const onActiveAwareBlur = React.useCallback(() => {
|
|
2065
|
+
if (isActive) {
|
|
2066
|
+
setIsActive(false)
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
onBlur()
|
|
2070
|
+
}, [onBlur, isActive])
|
|
2071
|
+
|
|
2072
|
+
const onValueChange = (
|
|
2073
|
+
_value: string | undefined,
|
|
2074
|
+
_name: string | undefined,
|
|
2075
|
+
values: CurrencyInputOnChangeValues | undefined
|
|
2076
|
+
) => {
|
|
2077
|
+
setLocalValue(
|
|
2078
|
+
values ? { value: values.value, float: values.float! } : undefined
|
|
2079
|
+
)
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
const onFocus = React.useCallback((e: React.FocusEvent) => {
|
|
2083
|
+
e.stopPropagation()
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* When an input is focused, we want to ensure
|
|
2087
|
+
* that its parent cell is in view.
|
|
2088
|
+
*/
|
|
2089
|
+
cellRef.current?.scrollIntoView({ block: "nearest" })
|
|
2090
|
+
}, [])
|
|
2091
|
+
|
|
2092
|
+
return (
|
|
2093
|
+
<td
|
|
2094
|
+
ref={cellRef}
|
|
2095
|
+
className={clx(
|
|
2096
|
+
"relative h-[10] min-w-[220px] outline-none",
|
|
2097
|
+
{
|
|
2098
|
+
"!bg-ui-bg-highlight": isSelected && !isActive,
|
|
2099
|
+
},
|
|
2100
|
+
{
|
|
2101
|
+
"before:shadow-borders-active before:pointer-events-none before:absolute before:inset-0 before:z-50 before:content-['']":
|
|
2102
|
+
isAnchor && isActive,
|
|
2103
|
+
}
|
|
2104
|
+
)}
|
|
2105
|
+
onMouseDown={onMouseDown}
|
|
2106
|
+
onMouseOver={onCellOver}
|
|
2107
|
+
data-variant-id={variantId}
|
|
2108
|
+
data-region-id={regionId}
|
|
2109
|
+
data-currency-code={currencyCode}
|
|
2110
|
+
data-type={type}
|
|
2111
|
+
data-editable={true}
|
|
2112
|
+
data-row-index={rowIndex}
|
|
2113
|
+
data-col-index={cellIndex}
|
|
2114
|
+
aria-colindex={cellIndex}
|
|
2115
|
+
aria-rowindex={rowIndex}
|
|
2116
|
+
tabIndex={0}
|
|
2117
|
+
>
|
|
2118
|
+
<div className="flex items-center px-4 py-2.5">
|
|
2119
|
+
{symbol && (
|
|
2120
|
+
<span className="text-ui-fg-muted h-full w-fit">{symbol}</span>
|
|
2121
|
+
)}
|
|
2122
|
+
<AmountField
|
|
2123
|
+
ref={inputRef}
|
|
2124
|
+
allowNegativeValue={false}
|
|
2125
|
+
name={name}
|
|
2126
|
+
value={localValue?.value}
|
|
2127
|
+
onBlur={onActiveAwareBlur}
|
|
2128
|
+
onFocus={onFocus}
|
|
2129
|
+
onValueChange={onValueChange}
|
|
2130
|
+
decimalScale={isActive ? undefined : decimalScale}
|
|
2131
|
+
autoFocus={false}
|
|
2132
|
+
tabIndex={-1}
|
|
2133
|
+
placeholder="-"
|
|
2134
|
+
className={clx(
|
|
2135
|
+
"h-full flex-1 cursor-default bg-transparent text-right outline-none"
|
|
2136
|
+
)}
|
|
2137
|
+
/>
|
|
2138
|
+
</div>
|
|
2139
|
+
{borders.bottom && borders.right && (
|
|
2140
|
+
<div
|
|
2141
|
+
onMouseDown={onDragToFillStart}
|
|
2142
|
+
className="bg-ui-bg-interactive absolute -bottom-1 -right-1 z-50 h-2 w-2 cursor-crosshair rounded-full"
|
|
2143
|
+
/>
|
|
2144
|
+
)}
|
|
2145
|
+
</td>
|
|
2146
|
+
)
|
|
2147
|
+
}
|
|
2148
|
+
)
|
|
2149
|
+
Cell.displayName = "PriceListProductPricesForm.Cell"
|
|
2150
|
+
|
|
2151
|
+
export { PriceListProductPricesForm }
|