@godxjp/ui 6.0.0 → 6.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/dist/app/index.d.ts +140 -0
- package/dist/app/index.js +38 -0
- package/dist/app.prop-IobwLwaM.d.ts +90 -0
- package/dist/checkbox-NkFkqsQ8.d.ts +13 -0
- package/dist/chunk-2XW7J3EI.js +226 -0
- package/dist/chunk-3F2AKYRD.js +416 -0
- package/dist/chunk-3KPEZ5CF.js +37 -0
- package/dist/chunk-3UGU5TYP.js +89 -0
- package/{src/props/registry.ts → dist/chunk-6RA3KSVK.js} +118 -133
- package/dist/chunk-7NZFVD24.js +122 -0
- package/dist/chunk-7PWBC4BY.js +25 -0
- package/dist/chunk-7S7MYFXE.js +61 -0
- package/dist/chunk-7WRZG2IG.js +71 -0
- package/dist/chunk-B775Y6BE.js +1 -0
- package/dist/chunk-BHV2FUOA.js +111 -0
- package/dist/chunk-BI3HERR7.js +70 -0
- package/dist/chunk-BPSKQUL2.js +68 -0
- package/dist/chunk-CDWPQ5RP.js +187 -0
- package/dist/chunk-CP2LET6N.js +244 -0
- package/dist/chunk-CQBADMFG.js +20 -0
- package/dist/chunk-CRERCLIZ.js +33 -0
- package/dist/chunk-DU6ZYZRP.js +238 -0
- package/dist/chunk-DY5C44UP.js +55 -0
- package/dist/chunk-E4HJNQ62.js +117 -0
- package/dist/chunk-E76QIYSY.js +93 -0
- package/dist/chunk-F7PG4OEV.js +37 -0
- package/dist/chunk-GDSVW62T.js +171 -0
- package/dist/chunk-H2FHJOLU.js +178 -0
- package/dist/chunk-HJEBRCXL.js +55 -0
- package/dist/chunk-ICM6XBST.js +16 -0
- package/{src/components/data-entry/calendar.tsx → dist/chunk-IK7I3ABN.js} +33 -35
- package/dist/chunk-L6J44O74.js +144 -0
- package/dist/chunk-LDSLS6HE.js +1 -0
- package/dist/chunk-LVNUHUEZ.js +191 -0
- package/dist/chunk-M64MVRLS.js +92 -0
- package/dist/chunk-NGQW3KEM.js +402 -0
- package/dist/chunk-NZ4FOC5N.js +559 -0
- package/dist/chunk-PIIRNAXA.js +26 -0
- package/dist/chunk-S66TJXJU.js +33 -0
- package/dist/chunk-SMLKNECP.js +133 -0
- package/dist/chunk-TAHBM3F2.js +66 -0
- package/dist/chunk-TO33OY4L.js +150 -0
- package/dist/chunk-TO7URV7U.js +51 -0
- package/dist/chunk-TOO5AEKL.js +81 -0
- package/dist/chunk-U3GHAOIJ.js +299 -0
- package/dist/chunk-U7N2A7A3.js +9 -0
- package/dist/chunk-UX634MYF.js +123 -0
- package/dist/chunk-V6UWJKZF.js +28 -0
- package/{src/components/data-entry/input.tsx → dist/chunk-VOHTRR5X.js} +18 -16
- package/dist/chunk-WRFKVUPW.js +332 -0
- package/dist/chunk-WXW43RK5.js +24 -0
- package/{src/components/navigation/tabs.tsx → dist/chunk-XG7XDYIM.js} +46 -53
- package/dist/chunk-YFCQKO3B.js +842 -0
- package/dist/chunk-ZDWXGWLY.js +73 -0
- package/dist/chunk-ZLK5SPT6.js +11 -0
- package/dist/chunk-ZS6DTAM2.js +31 -0
- package/dist/chunk-ZT5UEUBO.js +1 -0
- package/dist/components/admin/index.d.ts +80 -0
- package/dist/components/admin/index.js +38 -0
- package/dist/components/data-display/badge.d.ts +12 -0
- package/dist/components/data-display/badge.js +3 -0
- package/dist/components/data-display/card.d.ts +87 -0
- package/dist/components/data-display/card.js +2 -0
- package/dist/components/data-display/index.d.ts +72 -0
- package/dist/components/data-display/index.js +89 -0
- package/dist/components/data-display/popover.d.ts +13 -0
- package/dist/components/data-display/popover.js +2 -0
- package/dist/components/data-display/scroll-area.d.ts +7 -0
- package/dist/components/data-display/scroll-area.js +2 -0
- package/dist/components/data-display/table.d.ts +10 -0
- package/dist/components/data-display/table.js +3 -0
- package/dist/components/data-entry/autocomplete.d.ts +16 -0
- package/dist/components/data-entry/autocomplete.js +8 -0
- package/dist/components/data-entry/calendar.d.ts +16 -0
- package/dist/components/data-entry/calendar.js +4 -0
- package/dist/components/data-entry/cascader.d.ts +32 -0
- package/dist/components/data-entry/cascader.js +13 -0
- package/dist/components/data-entry/checkbox.d.ts +13 -0
- package/dist/components/data-entry/checkbox.js +4 -0
- package/dist/components/data-entry/color-picker.d.ts +16 -0
- package/dist/components/data-entry/color-picker.js +6 -0
- package/dist/components/data-entry/command.d.ts +69 -0
- package/dist/components/data-entry/command.js +3 -0
- package/dist/components/data-entry/date-picker.d.ts +16 -0
- package/dist/components/data-entry/date-picker.js +8 -0
- package/dist/components/data-entry/date-range-picker.d.ts +16 -0
- package/dist/components/data-entry/date-range-picker.js +8 -0
- package/dist/components/data-entry/index.d.ts +53 -0
- package/dist/components/data-entry/index.js +152 -0
- package/dist/components/data-entry/input.d.ts +6 -0
- package/dist/components/data-entry/input.js +2 -0
- package/dist/components/data-entry/label.d.ts +8 -0
- package/dist/components/data-entry/label.js +2 -0
- package/dist/components/data-entry/radio.d.ts +24 -0
- package/dist/components/data-entry/radio.js +4 -0
- package/dist/components/data-entry/select.d.ts +18 -0
- package/dist/components/data-entry/select.js +3 -0
- package/dist/components/data-entry/slider.d.ts +16 -0
- package/dist/components/data-entry/slider.js +2 -0
- package/dist/components/data-entry/switch.d.ts +17 -0
- package/dist/components/data-entry/switch.js +2 -0
- package/dist/components/data-entry/textarea.d.ts +6 -0
- package/dist/components/data-entry/textarea.js +3 -0
- package/dist/components/data-entry/time-picker.d.ts +16 -0
- package/dist/components/data-entry/time-picker.js +7 -0
- package/dist/components/data-entry/transfer.d.ts +17 -0
- package/dist/components/data-entry/transfer.js +11 -0
- package/dist/components/data-entry/tree-select.d.ts +26 -0
- package/dist/components/data-entry/tree-select.js +13 -0
- package/dist/components/data-entry/upload.d.ts +42 -0
- package/dist/components/data-entry/upload.js +11 -0
- package/dist/components/feedback/alert.d.ts +60 -0
- package/dist/components/feedback/alert.js +7 -0
- package/dist/components/feedback/dialog.d.ts +64 -0
- package/dist/components/feedback/dialog.js +7 -0
- package/dist/components/feedback/index.d.ts +16 -0
- package/dist/components/feedback/index.js +14 -0
- package/dist/components/feedback/sheet.d.ts +24 -0
- package/dist/components/feedback/sheet.js +2 -0
- package/dist/components/feedback/sonner.d.ts +6 -0
- package/dist/components/feedback/sonner.js +1 -0
- package/dist/components/general/button.d.ts +20 -0
- package/dist/components/general/button.js +2 -0
- package/dist/components/general/index.d.ts +6 -0
- package/dist/components/general/index.js +2 -0
- package/dist/components/layout/index.d.ts +71 -0
- package/dist/components/layout/index.js +5 -0
- package/dist/components/navigation/dropdown-menu.d.ts +28 -0
- package/dist/components/navigation/dropdown-menu.js +2 -0
- package/dist/components/navigation/index.d.ts +32 -0
- package/dist/components/navigation/index.js +12 -0
- package/dist/components/navigation/pagination.d.ts +11 -0
- package/dist/components/navigation/pagination.js +7 -0
- package/dist/components/navigation/steps.d.ts +12 -0
- package/dist/components/navigation/steps.js +3 -0
- package/dist/components/navigation/tabs-items.d.ts +12 -0
- package/dist/components/navigation/tabs-items.js +3 -0
- package/dist/components/navigation/tabs.d.ts +12 -0
- package/dist/components/navigation/tabs.js +2 -0
- package/dist/components/query/index.d.ts +43 -0
- package/dist/components/query/index.js +8 -0
- package/dist/components/ui/index.d.ts +57 -0
- package/dist/components/ui/index.js +37 -0
- package/{src/props/vocabulary/content.prop.ts → dist/content.prop-D1Dd3TAc.d.ts} +16 -20
- package/dist/data-display.prop-DNTAzmDy.d.ts +58 -0
- package/dist/data-entry.prop-BEGA1lTq.d.ts +323 -0
- package/dist/data-table-D1u_rKLK.d.ts +83 -0
- package/dist/data.prop-BVvfKC_g.d.ts +41 -0
- package/dist/feedback.prop-BmxUlpAW.d.ts +64 -0
- package/dist/filter-bar-B7OGFO9S.d.ts +10 -0
- package/dist/form/index.d.ts +21 -0
- package/dist/form/index.js +4 -0
- package/dist/form.prop-BHgpuFFm.d.ts +41 -0
- package/dist/format-date-ByyZoqI5.d.ts +51 -0
- package/dist/general.prop-D7brMPNL.d.ts +16 -0
- package/dist/i18n/index.d.ts +217 -0
- package/dist/i18n/index.js +2 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +39 -0
- package/dist/inline-C5u6ptJV.d.ts +10 -0
- package/dist/interaction.prop-Cdn7wOtq.d.ts +25 -0
- package/{src/props/vocabulary/layout.prop.ts → dist/layout.prop-4TCNvyQZ.d.ts} +9 -14
- package/dist/layout.prop-C795F0qg.d.ts +112 -0
- package/dist/lib/datetime/index.d.ts +31 -0
- package/dist/lib/datetime/index.js +1 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +1 -0
- package/dist/navigation.prop-DpZqcXey.d.ts +78 -0
- package/dist/navigation.prop-DxBiClEH.d.ts +20 -0
- package/dist/props/components/index.d.ts +27 -0
- package/dist/props/components/index.js +1 -0
- package/dist/props/index.d.ts +28 -0
- package/dist/props/index.js +3 -0
- package/dist/props/registry.d.ts +649 -0
- package/dist/props/registry.js +1 -0
- package/dist/props/vocabulary/index.d.ts +7 -0
- package/dist/props/vocabulary/index.js +1 -0
- package/dist/query.prop-hIPrk2zI.d.ts +71 -0
- package/dist/search-input-uP01rY1L.d.ts +22 -0
- package/dist/shared.prop-BNRJc9K0.d.ts +45 -0
- package/dist/types-mvzYGrma.d.ts +37 -0
- package/dist/use-toast-Dol5bdY3.d.ts +34 -0
- package/package.json +233 -67
- package/src/app/__tests__/app-provider.test.tsx +0 -232
- package/src/app/__tests__/date-format-labels.test.ts +0 -36
- package/src/app/__tests__/date-formats.test.ts +0 -44
- package/src/app/__tests__/timezones.test.ts +0 -65
- package/src/app/app-provider.tsx +0 -227
- package/src/app/date-format-labels.ts +0 -21
- package/src/app/date-formats.ts +0 -30
- package/src/app/index.ts +0 -40
- package/src/app/locales.ts +0 -32
- package/src/app/request-headers.ts +0 -31
- package/src/app/storage.ts +0 -44
- package/src/app/time-format-labels.ts +0 -19
- package/src/app/time-formats.ts +0 -15
- package/src/app/timezones.ts +0 -208
- package/src/app/types.ts +0 -39
- package/src/app/use-formatting.ts +0 -47
- package/src/components/__tests__/accessibility-primitives.test.tsx +0 -65
- package/src/components/__tests__/docs-parity.test.ts +0 -41
- package/src/components/__tests__/shadcn-release-guardrails.test.ts +0 -71
- package/src/components/__tests__/theme-axes-integration.test.tsx +0 -242
- package/src/components/admin/index.ts +0 -76
- package/src/components/data-display/__tests__/card-table.test.tsx +0 -328
- package/src/components/data-display/__tests__/data-display.test.tsx +0 -73
- package/src/components/data-display/__tests__/data-table.test.tsx +0 -84
- package/src/components/data-display/__tests__/popover.test.tsx +0 -92
- package/src/components/data-display/__tests__/scroll-area-collapsible.test.tsx +0 -66
- package/src/components/data-display/badge.tsx +0 -27
- package/src/components/data-display/card.tsx +0 -194
- package/src/components/data-display/code-badge.tsx +0 -28
- package/src/components/data-display/collapsible.tsx +0 -5
- package/src/components/data-display/data-table.tsx +0 -476
- package/src/components/data-display/empty-state.tsx +0 -22
- package/src/components/data-display/index.ts +0 -41
- package/src/components/data-display/key-value-grid.tsx +0 -46
- package/src/components/data-display/popover.tsx +0 -62
- package/src/components/data-display/progress-meter.tsx +0 -20
- package/src/components/data-display/scan-panel.tsx +0 -16
- package/src/components/data-display/scroll-area.tsx +0 -42
- package/src/components/data-display/status-badge.tsx +0 -83
- package/src/components/data-display/table.tsx +0 -59
- package/src/components/data-display/timeline.tsx +0 -42
- package/src/components/data-display/tree-list.tsx +0 -42
- package/src/components/data-entry/__fixtures__/tree-options.ts +0 -80
- package/src/components/data-entry/__tests__/cascader-tree-transfer.test.tsx +0 -417
- package/src/components/data-entry/__tests__/checkbox-group.test.tsx +0 -40
- package/src/components/data-entry/__tests__/checkbox.test.tsx +0 -20
- package/src/components/data-entry/__tests__/date-autocomplete.test.tsx +0 -94
- package/src/components/data-entry/__tests__/form-field.test.tsx +0 -49
- package/src/components/data-entry/__tests__/input-textarea.test.tsx +0 -38
- package/src/components/data-entry/__tests__/label-select.test.tsx +0 -62
- package/src/components/data-entry/__tests__/pickers.test.tsx +0 -74
- package/src/components/data-entry/__tests__/radio.test.tsx +0 -46
- package/src/components/data-entry/__tests__/search-input.test.tsx +0 -32
- package/src/components/data-entry/__tests__/switch-field.test.tsx +0 -52
- package/src/components/data-entry/__tests__/upload.test.tsx +0 -125
- package/src/components/data-entry/autocomplete.tsx +0 -91
- package/src/components/data-entry/cascader.tsx +0 -305
- package/src/components/data-entry/checkbox-group.tsx +0 -90
- package/src/components/data-entry/checkbox.tsx +0 -30
- package/src/components/data-entry/choice-field.tsx +0 -27
- package/src/components/data-entry/choice-option.ts +0 -20
- package/src/components/data-entry/color-picker.tsx +0 -75
- package/src/components/data-entry/command.tsx +0 -56
- package/src/components/data-entry/country-select.tsx +0 -88
- package/src/components/data-entry/date-picker.tsx +0 -69
- package/src/components/data-entry/date-range-picker.tsx +0 -75
- package/src/components/data-entry/form-field.tsx +0 -59
- package/src/components/data-entry/index.ts +0 -62
- package/src/components/data-entry/label.tsx +0 -25
- package/src/components/data-entry/radio.tsx +0 -109
- package/src/components/data-entry/search-input.tsx +0 -103
- package/src/components/data-entry/select.tsx +0 -149
- package/src/components/data-entry/slider.tsx +0 -38
- package/src/components/data-entry/switch-field.tsx +0 -91
- package/src/components/data-entry/switch.tsx +0 -24
- package/src/components/data-entry/textarea.tsx +0 -12
- package/src/components/data-entry/time-picker.tsx +0 -214
- package/src/components/data-entry/transfer.tsx +0 -231
- package/src/components/data-entry/tree-select-strategy.ts +0 -6
- package/src/components/data-entry/tree-select.tsx +0 -279
- package/src/components/data-entry/tree-utils.ts +0 -221
- package/src/components/data-entry/upload-crop-dialog.tsx +0 -109
- package/src/components/data-entry/upload-types.ts +0 -86
- package/src/components/data-entry/upload.tsx +0 -498
- package/src/components/data-entry/use-upload-draft.ts +0 -93
- package/src/components/feedback/__tests__/alert.test.tsx +0 -127
- package/src/components/feedback/__tests__/dialog.test.tsx +0 -290
- package/src/components/feedback/__tests__/sheet.test.tsx +0 -94
- package/src/components/feedback/__tests__/skeleton.test.tsx +0 -25
- package/src/components/feedback/__tests__/toast.test.tsx +0 -52
- package/src/components/feedback/alert.tsx +0 -167
- package/src/components/feedback/dialog.tsx +0 -325
- package/src/components/feedback/index.ts +0 -53
- package/src/components/feedback/sheet.tsx +0 -130
- package/src/components/feedback/skeleton.tsx +0 -95
- package/src/components/feedback/sonner.tsx +0 -54
- package/src/components/feedback/toaster.tsx +0 -1
- package/src/components/feedback/use-toast.ts +0 -62
- package/src/components/general/__tests__/button.test.tsx +0 -71
- package/src/components/general/button.tsx +0 -61
- package/src/components/general/index.ts +0 -2
- package/src/components/layout/__tests__/page-container.test.tsx +0 -69
- package/src/components/layout/__tests__/page-inset.test.tsx +0 -14
- package/src/components/layout/__tests__/stack-inline.test.tsx +0 -39
- package/src/components/layout/app-shell.tsx +0 -42
- package/src/components/layout/breadcrumb.tsx +0 -35
- package/src/components/layout/index.ts +0 -31
- package/src/components/layout/inline.tsx +0 -13
- package/src/components/layout/menu.tsx +0 -34
- package/src/components/layout/mobile-frame.tsx +0 -57
- package/src/components/layout/page-container.tsx +0 -81
- package/src/components/layout/page-inset.tsx +0 -16
- package/src/components/layout/responsive-grid.tsx +0 -14
- package/src/components/layout/shell-app.tsx +0 -30
- package/src/components/layout/sidebar.tsx +0 -98
- package/src/components/layout/split-pane.tsx +0 -16
- package/src/components/layout/stack.tsx +0 -13
- package/src/components/layout/topbar.tsx +0 -108
- package/src/components/navigation/__tests__/app-pickers.test.tsx +0 -118
- package/src/components/navigation/__tests__/dropdown-menu.test.tsx +0 -104
- package/src/components/navigation/__tests__/navigation.test.tsx +0 -61
- package/src/components/navigation/__tests__/pagination-steps-tabs.test.tsx +0 -76
- package/src/components/navigation/date-format-picker.tsx +0 -55
- package/src/components/navigation/dropdown-menu.tsx +0 -190
- package/src/components/navigation/filter-bar.tsx +0 -38
- package/src/components/navigation/index.ts +0 -28
- package/src/components/navigation/locale-picker.tsx +0 -49
- package/src/components/navigation/page-header.tsx +0 -50
- package/src/components/navigation/pagination-utils.ts +0 -35
- package/src/components/navigation/pagination.tsx +0 -168
- package/src/components/navigation/steps.tsx +0 -163
- package/src/components/navigation/tabs-items.tsx +0 -69
- package/src/components/navigation/time-format-picker.tsx +0 -55
- package/src/components/navigation/timezone-picker.tsx +0 -63
- package/src/components/query/__tests__/data-state.test.tsx +0 -214
- package/src/components/query/__tests__/infinite-prefetch.test.tsx +0 -105
- package/src/components/query/__tests__/query-helpers.test.tsx +0 -61
- package/src/components/query/data-state.tsx +0 -58
- package/src/components/query/index.ts +0 -10
- package/src/components/query/infinite-query-state.tsx +0 -99
- package/src/components/query/mutation-feedback.tsx +0 -31
- package/src/components/query/prefetch-link.tsx +0 -45
- package/src/components/query/query-refetch-button.tsx +0 -41
- package/src/components/ui/alert-dialog.tsx +0 -1
- package/src/components/ui/alert.tsx +0 -1
- package/src/components/ui/autocomplete.tsx +0 -1
- package/src/components/ui/badge.tsx +0 -1
- package/src/components/ui/button.tsx +0 -1
- package/src/components/ui/calendar.tsx +0 -1
- package/src/components/ui/card.tsx +0 -1
- package/src/components/ui/checkbox.tsx +0 -1
- package/src/components/ui/color-picker.tsx +0 -1
- package/src/components/ui/command.tsx +0 -1
- package/src/components/ui/date-picker.tsx +0 -1
- package/src/components/ui/date-range-picker.tsx +0 -1
- package/src/components/ui/dialog.tsx +0 -1
- package/src/components/ui/dropdown-menu.tsx +0 -1
- package/src/components/ui/index.tsx +0 -31
- package/src/components/ui/input.tsx +0 -1
- package/src/components/ui/label.tsx +0 -1
- package/src/components/ui/pagination.tsx +0 -1
- package/src/components/ui/popover.tsx +0 -1
- package/src/components/ui/radio.tsx +0 -1
- package/src/components/ui/scroll-area.tsx +0 -1
- package/src/components/ui/select.tsx +0 -1
- package/src/components/ui/sheet.tsx +0 -1
- package/src/components/ui/slider.tsx +0 -1
- package/src/components/ui/sonner.tsx +0 -1
- package/src/components/ui/switch.tsx +0 -1
- package/src/components/ui/table.tsx +0 -1
- package/src/components/ui/tabs-items.tsx +0 -1
- package/src/components/ui/tabs.tsx +0 -1
- package/src/components/ui/textarea.tsx +0 -1
- package/src/components/ui/time-picker.tsx +0 -1
- package/src/components/ui/upload.tsx +0 -1
- package/src/form/__tests__/use-zod-form.test.tsx +0 -97
- package/src/form/form-field-control.tsx +0 -44
- package/src/form/form-root.tsx +0 -29
- package/src/form/index.ts +0 -7
- package/src/form/use-zod-form.ts +0 -29
- package/src/i18n/__tests__/translate.test.ts +0 -23
- package/src/i18n/index.ts +0 -9
- package/src/i18n/messages/en.json +0 -171
- package/src/i18n/messages/ja.json +0 -171
- package/src/i18n/messages/vi.json +0 -171
- package/src/i18n/translate.ts +0 -74
- package/src/i18n/use-translation.ts +0 -53
- package/src/index.ts +0 -3
- package/src/lib/__tests__/control-styles.test.ts +0 -78
- package/src/lib/__tests__/datetime.test.ts +0 -77
- package/src/lib/__tests__/format-date.test.ts +0 -97
- package/src/lib/__tests__/format.test.ts +0 -62
- package/src/lib/__tests__/theme-tokens-audit.test.ts +0 -176
- package/src/lib/__tests__/theme-tokens-css.test.ts +0 -118
- package/src/lib/__tests__/token-governance.test.ts +0 -191
- package/src/lib/__tests__/variants.test.ts +0 -18
- package/src/lib/control-styles.ts +0 -33
- package/src/lib/datetime/detect.ts +0 -25
- package/src/lib/datetime/format-date.ts +0 -100
- package/src/lib/datetime/format.ts +0 -140
- package/src/lib/datetime/index.ts +0 -25
- package/src/lib/datetime/parse.ts +0 -51
- package/src/lib/datetime/sync.ts +0 -48
- package/src/lib/format.ts +0 -114
- package/src/lib/hooks.ts +0 -54
- package/src/lib/utils.ts +0 -6
- package/src/lib/variants.ts +0 -40
- package/src/props/components/app.prop.ts +0 -99
- package/src/props/components/data-display.prop.ts +0 -73
- package/src/props/components/data-entry.prop.ts +0 -334
- package/src/props/components/feedback.prop.ts +0 -80
- package/src/props/components/form.prop.ts +0 -46
- package/src/props/components/general.prop.ts +0 -18
- package/src/props/components/index.ts +0 -99
- package/src/props/components/layout.prop.ts +0 -130
- package/src/props/components/navigation.prop.ts +0 -88
- package/src/props/components/query.prop.ts +0 -94
- package/src/props/index.ts +0 -17
- package/src/props/vocabulary/data.prop.ts +0 -46
- package/src/props/vocabulary/index.ts +0 -73
- package/src/props/vocabulary/interaction.prop.ts +0 -42
- package/src/props/vocabulary/navigation.prop.ts +0 -19
- package/src/props/vocabulary/shared.prop.ts +0 -59
- package/src/test/__tests__/render-loop-guard.test.tsx +0 -38
- package/src/test/jest-dom.d.ts +0 -4
- package/src/test/render-loop-guard.tsx +0 -50
- package/src/test/render.tsx +0 -29
- package/src/test/theme-globals.test.ts +0 -77
- package/src/test/theme-globals.ts +0 -134
- package/src/test/theme-test-utils.tsx +0 -67
- /package/{src → dist}/styles/alert-layout.css +0 -0
- /package/{src → dist}/styles/badge-layout.css +0 -0
- /package/{src → dist}/styles/card-layout.css +0 -0
- /package/{src → dist}/styles/control.css +0 -0
- /package/{src → dist}/styles/data-display-layout.css +0 -0
- /package/{src → dist}/styles/density.css +0 -0
- /package/{src → dist}/styles/dialog-layout.css +0 -0
- /package/{src → dist}/styles/index.css +0 -0
- /package/{src → dist}/styles/layout.css +0 -0
- /package/{src → dist}/styles/shell-layout.css +0 -0
- /package/{src → dist}/styles/table-layout.css +0 -0
- /package/{src → dist}/theme/example.service.css +0 -0
- /package/{src → dist}/tokens/base.css +0 -0
- /package/{src → dist}/tokens/foundation.css +0 -0
- /package/{src → dist}/tokens/primitives/badge.css +0 -0
- /package/{src → dist}/tokens/primitives/card.css +0 -0
- /package/{src → dist}/tokens/primitives/control.css +0 -0
- /package/{src → dist}/tokens/primitives/feedback.css +0 -0
- /package/{src → dist}/tokens/primitives/layout.css +0 -0
- /package/{src → dist}/tokens/primitives/navigation.css +0 -0
- /package/{src → dist}/tokens/primitives/table.css +0 -0
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
import { Slider } from './chunk-CRERCLIZ.js';
|
|
2
|
+
import { controlIconClass } from './chunk-ICM6XBST.js';
|
|
3
|
+
import { formatBytes } from './chunk-7S7MYFXE.js';
|
|
4
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './chunk-DU6ZYZRP.js';
|
|
5
|
+
import { Button } from './chunk-HJEBRCXL.js';
|
|
6
|
+
import { useTranslation } from './chunk-3F2AKYRD.js';
|
|
7
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
8
|
+
import * as React2 from 'react';
|
|
9
|
+
import { Upload as Upload$1, ImagePlus, Camera, Trash2, RotateCcw, X } from 'lucide-react';
|
|
10
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
|
+
|
|
12
|
+
function UploadCropDialog({ open, onOpenChange, file, onConfirm }) {
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
const [scale, setScale] = React2.useState(1.2);
|
|
15
|
+
const [src, setSrc] = React2.useState(null);
|
|
16
|
+
const imgRef = React2.useRef(null);
|
|
17
|
+
React2.useEffect(() => {
|
|
18
|
+
if (!file) {
|
|
19
|
+
setSrc(null);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const url = URL.createObjectURL(file);
|
|
23
|
+
setSrc(url);
|
|
24
|
+
return () => URL.revokeObjectURL(url);
|
|
25
|
+
}, [file]);
|
|
26
|
+
const handleConfirm = async () => {
|
|
27
|
+
const img = imgRef.current;
|
|
28
|
+
if (!img || !file) return;
|
|
29
|
+
const size = 256;
|
|
30
|
+
const canvas = document.createElement("canvas");
|
|
31
|
+
canvas.width = size;
|
|
32
|
+
canvas.height = size;
|
|
33
|
+
const ctx = canvas.getContext("2d");
|
|
34
|
+
if (!ctx) return;
|
|
35
|
+
const iw = img.naturalWidth;
|
|
36
|
+
const ih = img.naturalHeight;
|
|
37
|
+
const side = Math.min(iw, ih) / scale;
|
|
38
|
+
const sx = (iw - side) / 2;
|
|
39
|
+
const sy = (ih - side) / 2;
|
|
40
|
+
ctx.drawImage(img, sx, sy, side, side, 0, 0, size, size);
|
|
41
|
+
const blob = await new Promise(
|
|
42
|
+
(resolve) => canvas.toBlob(resolve, "image/jpeg", 0.92)
|
|
43
|
+
);
|
|
44
|
+
if (!blob) return;
|
|
45
|
+
const cropped = new File([blob], file.name.replace(/\.\w+$/, "") + ".jpg", {
|
|
46
|
+
type: "image/jpeg"
|
|
47
|
+
});
|
|
48
|
+
onConfirm(cropped);
|
|
49
|
+
onOpenChange(false);
|
|
50
|
+
};
|
|
51
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-sm", children: [
|
|
52
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t("dataEntry.upload.cropTitle") }) }),
|
|
53
|
+
/* @__PURE__ */ jsxs("div", { className: "ui-stack-sm", children: [
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: cn(
|
|
58
|
+
"bg-muted relative mx-auto size-48 overflow-hidden rounded-full border",
|
|
59
|
+
"flex items-center justify-center"
|
|
60
|
+
),
|
|
61
|
+
children: src ? /* @__PURE__ */ jsx(
|
|
62
|
+
"img",
|
|
63
|
+
{
|
|
64
|
+
ref: imgRef,
|
|
65
|
+
src,
|
|
66
|
+
alt: "",
|
|
67
|
+
className: "size-full object-cover transition-transform duration-150",
|
|
68
|
+
style: { transform: `scale(${scale})` }
|
|
69
|
+
}
|
|
70
|
+
) : null
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsxs("div", { className: "ui-stack-xs px-2", children: [
|
|
74
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: t("dataEntry.upload.cropZoom") }),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
Slider,
|
|
77
|
+
{
|
|
78
|
+
min: 1,
|
|
79
|
+
max: 2.5,
|
|
80
|
+
step: 0.05,
|
|
81
|
+
value: [scale],
|
|
82
|
+
onValueChange: (v) => setScale(v[0] ?? 1),
|
|
83
|
+
"aria-label": t("dataEntry.upload.cropZoom")
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] })
|
|
87
|
+
] }),
|
|
88
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
89
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => onOpenChange(false), children: t("common.cancel") }),
|
|
90
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => void handleConfirm(), children: t("dataEntry.upload.cropConfirm") })
|
|
91
|
+
] })
|
|
92
|
+
] }) });
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// src/components/data-entry/upload-types.ts
|
|
96
|
+
function createUploadItem(file, partial) {
|
|
97
|
+
const previewUrl = file.type.startsWith("image/") ? URL.createObjectURL(file) : void 0;
|
|
98
|
+
return {
|
|
99
|
+
uid: partial?.uid ?? crypto.randomUUID(),
|
|
100
|
+
name: file.name,
|
|
101
|
+
size: file.size,
|
|
102
|
+
mimeType: file.type,
|
|
103
|
+
previewUrl,
|
|
104
|
+
status: "idle",
|
|
105
|
+
file,
|
|
106
|
+
...partial
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function revokePreviewUrl(item) {
|
|
110
|
+
if (item?.previewUrl?.startsWith("blob:")) URL.revokeObjectURL(item.previewUrl);
|
|
111
|
+
}
|
|
112
|
+
function collectUploadCommitActions(items) {
|
|
113
|
+
const deleteMediaIds = [];
|
|
114
|
+
const promoteMediaIds = [];
|
|
115
|
+
for (const item of items) {
|
|
116
|
+
if (item.pendingDelete && item.mediaId) {
|
|
117
|
+
deleteMediaIds.push(item.mediaId);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (item.pendingReplace && item.replacesMediaId) {
|
|
121
|
+
deleteMediaIds.push(item.replacesMediaId);
|
|
122
|
+
}
|
|
123
|
+
if (item.mediaId && !item.pendingDelete && item.status !== "error") {
|
|
124
|
+
promoteMediaIds.push(item.mediaId);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
deleteMediaIds: [...new Set(deleteMediaIds)],
|
|
129
|
+
promoteMediaIds: [...new Set(promoteMediaIds)]
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function useUploadDraft({ value, onChange }) {
|
|
133
|
+
const [baseline, setBaseline] = React2.useState(value ?? null);
|
|
134
|
+
React2.useEffect(() => {
|
|
135
|
+
if (value && !value.pendingDelete && !value.pendingReplace && value.mediaId) {
|
|
136
|
+
setBaseline(value);
|
|
137
|
+
}
|
|
138
|
+
}, [value]);
|
|
139
|
+
const markRemove = React2.useCallback(() => {
|
|
140
|
+
if (!value) return;
|
|
141
|
+
onChange?.({ ...value, pendingDelete: true, pendingReplace: false, status: "removed" });
|
|
142
|
+
}, [onChange, value]);
|
|
143
|
+
const undoRemove = React2.useCallback(() => {
|
|
144
|
+
if (!baseline) {
|
|
145
|
+
onChange?.(null);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
onChange?.({ ...baseline, pendingDelete: false, pendingReplace: false, status: "done" });
|
|
149
|
+
}, [baseline, onChange]);
|
|
150
|
+
const stageReplace = React2.useCallback(
|
|
151
|
+
(file) => {
|
|
152
|
+
revokePreviewUrl(value);
|
|
153
|
+
const next = createUploadItem(file, {
|
|
154
|
+
pendingReplace: Boolean(value?.mediaId),
|
|
155
|
+
replacesMediaId: value?.mediaId,
|
|
156
|
+
status: "idle"
|
|
157
|
+
});
|
|
158
|
+
onChange?.({ ...next, pendingDelete: false });
|
|
159
|
+
},
|
|
160
|
+
[onChange, value]
|
|
161
|
+
);
|
|
162
|
+
const undoReplace = React2.useCallback(() => {
|
|
163
|
+
revokePreviewUrl(value);
|
|
164
|
+
onChange?.(baseline ? { ...baseline, pendingReplace: false, pendingDelete: false } : null);
|
|
165
|
+
}, [baseline, onChange, value]);
|
|
166
|
+
const getCommitActions = React2.useCallback(() => {
|
|
167
|
+
if (!value) return { deleteMediaIds: [], promoteMediaIds: [] };
|
|
168
|
+
const deleteMediaIds = [];
|
|
169
|
+
if (value.pendingDelete && value.mediaId) deleteMediaIds.push(value.mediaId);
|
|
170
|
+
if (value.pendingReplace && value.replacesMediaId) deleteMediaIds.push(value.replacesMediaId);
|
|
171
|
+
const promoteMediaIds = value.mediaId && !value.pendingDelete && value.status !== "error" ? [value.mediaId] : [];
|
|
172
|
+
return {
|
|
173
|
+
deleteMediaIds: [...new Set(deleteMediaIds)],
|
|
174
|
+
promoteMediaIds: [...new Set(promoteMediaIds)]
|
|
175
|
+
};
|
|
176
|
+
}, [value]);
|
|
177
|
+
const state = React2.useMemo(
|
|
178
|
+
() => ({
|
|
179
|
+
display: value ?? null,
|
|
180
|
+
baseline,
|
|
181
|
+
canUndoRemove: Boolean(value?.pendingDelete),
|
|
182
|
+
canUndoReplace: Boolean(value?.pendingReplace)
|
|
183
|
+
}),
|
|
184
|
+
[baseline, value]
|
|
185
|
+
);
|
|
186
|
+
return { state, markRemove, undoRemove, stageReplace, undoReplace, getCommitActions };
|
|
187
|
+
}
|
|
188
|
+
function defaultAcceptForVariant(variant) {
|
|
189
|
+
if (variant === "avatar" || variant === "avatar-crop" || variant === "picture" || variant === "picture-card") {
|
|
190
|
+
return "image/*";
|
|
191
|
+
}
|
|
192
|
+
return void 0;
|
|
193
|
+
}
|
|
194
|
+
function defaultMaxCount(variant) {
|
|
195
|
+
if (variant === "avatar" || variant === "avatar-crop" || variant === "picture") return 1;
|
|
196
|
+
return void 0;
|
|
197
|
+
}
|
|
198
|
+
function fileMatchesAccept(file, accept) {
|
|
199
|
+
if (!accept) return true;
|
|
200
|
+
return accept.split(",").some((rule) => {
|
|
201
|
+
const trimmed = rule.trim();
|
|
202
|
+
if (trimmed.endsWith("/*")) return file.type.startsWith(trimmed.slice(0, -1));
|
|
203
|
+
return file.type === trimmed || file.name.endsWith(trimmed);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
function useUploadList(controlled, defaultValue, onChange) {
|
|
207
|
+
const [internal, setInternal] = React2.useState(defaultValue ?? []);
|
|
208
|
+
const items = controlled ?? internal;
|
|
209
|
+
const setItems = React2.useCallback(
|
|
210
|
+
(next) => {
|
|
211
|
+
const resolved = typeof next === "function" ? next(items) : next;
|
|
212
|
+
if (controlled === void 0) setInternal(resolved);
|
|
213
|
+
onChange?.(resolved);
|
|
214
|
+
},
|
|
215
|
+
[controlled, items, onChange]
|
|
216
|
+
);
|
|
217
|
+
return [items, setItems];
|
|
218
|
+
}
|
|
219
|
+
async function runUpload(file, item, onUpload, setItems) {
|
|
220
|
+
const uid = item.uid;
|
|
221
|
+
setItems((prev) => prev.map((it) => it.uid === uid ? { ...it, status: "uploading" } : it));
|
|
222
|
+
try {
|
|
223
|
+
const result = await onUpload(file, item);
|
|
224
|
+
setItems(
|
|
225
|
+
(prev) => prev.map(
|
|
226
|
+
(it) => it.uid === uid ? {
|
|
227
|
+
...it,
|
|
228
|
+
status: "done",
|
|
229
|
+
mediaId: result.mediaId,
|
|
230
|
+
previewUrl: result.previewUrl ?? it.previewUrl,
|
|
231
|
+
file: void 0
|
|
232
|
+
} : it
|
|
233
|
+
)
|
|
234
|
+
);
|
|
235
|
+
} catch (err) {
|
|
236
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
237
|
+
setItems(
|
|
238
|
+
(prev) => prev.map((it) => it.uid === uid ? { ...it, status: "error", error: message } : it)
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function Upload({
|
|
243
|
+
variant = "dropzone",
|
|
244
|
+
value,
|
|
245
|
+
defaultValue,
|
|
246
|
+
onChange,
|
|
247
|
+
accept: acceptProp,
|
|
248
|
+
multiple: multipleProp,
|
|
249
|
+
maxCount: maxCountProp,
|
|
250
|
+
maxSizeBytes,
|
|
251
|
+
disabled,
|
|
252
|
+
removable = true,
|
|
253
|
+
onUpload,
|
|
254
|
+
className,
|
|
255
|
+
children
|
|
256
|
+
}) {
|
|
257
|
+
const { t } = useTranslation();
|
|
258
|
+
const accept = acceptProp ?? defaultAcceptForVariant(variant);
|
|
259
|
+
const maxCount = maxCountProp ?? defaultMaxCount(variant);
|
|
260
|
+
const multiple = multipleProp ?? (maxCount === 1 ? false : true);
|
|
261
|
+
const inputRef = React2.useRef(null);
|
|
262
|
+
const [dragActive, setDragActive] = React2.useState(false);
|
|
263
|
+
const [cropFile, setCropFile] = React2.useState(null);
|
|
264
|
+
const [items, setItems] = useUploadList(value, defaultValue, onChange);
|
|
265
|
+
const isSingleAvatar = variant === "avatar" || variant === "avatar-crop" || variant === "picture" && maxCount === 1;
|
|
266
|
+
const singleItem = isSingleAvatar ? items[0] ?? null : null;
|
|
267
|
+
const draft = useUploadDraft({
|
|
268
|
+
value: singleItem,
|
|
269
|
+
onChange: (next) => {
|
|
270
|
+
setItems(next ? [next] : []);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
const pickFiles = (fileList) => {
|
|
274
|
+
if (!fileList?.length || disabled) return;
|
|
275
|
+
const slotsLeft = maxCount != null ? Math.max(0, maxCount - items.length) : fileList.length;
|
|
276
|
+
const candidates = Array.from(fileList).slice(0, multiple ? slotsLeft || fileList.length : 1);
|
|
277
|
+
for (const file of candidates) {
|
|
278
|
+
if (!fileMatchesAccept(file, accept)) continue;
|
|
279
|
+
if (maxSizeBytes != null && file.size > maxSizeBytes) continue;
|
|
280
|
+
if (variant === "avatar-crop") {
|
|
281
|
+
setCropFile(file);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (isSingleAvatar) {
|
|
285
|
+
const baseline = items[0];
|
|
286
|
+
const item3 = createUploadItem(file, {
|
|
287
|
+
pendingReplace: Boolean(baseline?.mediaId),
|
|
288
|
+
replacesMediaId: baseline?.mediaId
|
|
289
|
+
});
|
|
290
|
+
setItems([item3]);
|
|
291
|
+
if (onUpload) void runUpload(file, item3, onUpload, setItems);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const item2 = createUploadItem(file);
|
|
295
|
+
setItems((prev) => [...prev, item2]);
|
|
296
|
+
if (onUpload) void runUpload(file, item2, onUpload, setItems);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
const removeItem = (uid) => {
|
|
300
|
+
if (isSingleAvatar) {
|
|
301
|
+
draft.markRemove();
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
setItems((prev) => {
|
|
305
|
+
const target = prev.find((it) => it.uid === uid);
|
|
306
|
+
revokePreviewUrl(target);
|
|
307
|
+
return prev.filter((it) => it.uid !== uid);
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
const hiddenInput = /* @__PURE__ */ jsx(
|
|
311
|
+
"input",
|
|
312
|
+
{
|
|
313
|
+
ref: inputRef,
|
|
314
|
+
type: "file",
|
|
315
|
+
className: "sr-only",
|
|
316
|
+
accept,
|
|
317
|
+
multiple: multiple && !isSingleAvatar,
|
|
318
|
+
disabled,
|
|
319
|
+
onChange: (e) => {
|
|
320
|
+
pickFiles(e.target.files);
|
|
321
|
+
e.target.value = "";
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
);
|
|
325
|
+
const openPicker = () => {
|
|
326
|
+
if (!disabled) inputRef.current?.click();
|
|
327
|
+
};
|
|
328
|
+
if (variant === "dropzone") {
|
|
329
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("ui-stack-sm", className), children: [
|
|
330
|
+
hiddenInput,
|
|
331
|
+
/* @__PURE__ */ jsxs(
|
|
332
|
+
"div",
|
|
333
|
+
{
|
|
334
|
+
role: "button",
|
|
335
|
+
tabIndex: disabled ? -1 : 0,
|
|
336
|
+
"aria-disabled": disabled,
|
|
337
|
+
"aria-label": t("dataEntry.upload.dropzoneLabel"),
|
|
338
|
+
onClick: openPicker,
|
|
339
|
+
onKeyDown: (e) => {
|
|
340
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
341
|
+
e.preventDefault();
|
|
342
|
+
openPicker();
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
onDragOver: (e) => {
|
|
346
|
+
e.preventDefault();
|
|
347
|
+
setDragActive(true);
|
|
348
|
+
},
|
|
349
|
+
onDragLeave: () => setDragActive(false),
|
|
350
|
+
onDrop: (e) => {
|
|
351
|
+
e.preventDefault();
|
|
352
|
+
setDragActive(false);
|
|
353
|
+
pickFiles(e.dataTransfer.files);
|
|
354
|
+
},
|
|
355
|
+
className: cn(
|
|
356
|
+
"cursor-pointer rounded-lg border-2 border-dashed p-10 text-center transition-colors",
|
|
357
|
+
dragActive ? "border-primary bg-primary/5" : "border-border hover:border-primary/50",
|
|
358
|
+
disabled && "pointer-events-none opacity-50"
|
|
359
|
+
),
|
|
360
|
+
children: [
|
|
361
|
+
/* @__PURE__ */ jsx(Upload$1, { className: "text-muted-foreground mx-auto size-10", "aria-hidden": "true" }),
|
|
362
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-sm", children: t("dataEntry.upload.dropzoneHint") }),
|
|
363
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: t("dataEntry.upload.dropzoneMeta") })
|
|
364
|
+
]
|
|
365
|
+
}
|
|
366
|
+
),
|
|
367
|
+
items.length > 0 && /* @__PURE__ */ jsx(UploadFileList, { items, onRemove: removable ? removeItem : void 0 })
|
|
368
|
+
] });
|
|
369
|
+
}
|
|
370
|
+
if (variant === "button") {
|
|
371
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("ui-stack-sm", className), children: [
|
|
372
|
+
hiddenInput,
|
|
373
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled, onClick: openPicker, children: [
|
|
374
|
+
/* @__PURE__ */ jsx(Upload$1, { className: "mr-2 size-4", "aria-hidden": "true" }),
|
|
375
|
+
children ?? t("dataEntry.upload.buttonLabel")
|
|
376
|
+
] }),
|
|
377
|
+
items.length > 0 && /* @__PURE__ */ jsx(UploadFileList, { items, onRemove: removable ? removeItem : void 0 })
|
|
378
|
+
] });
|
|
379
|
+
}
|
|
380
|
+
if (variant === "picture-card") {
|
|
381
|
+
const canAdd = maxCount == null || items.length < maxCount;
|
|
382
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-wrap gap-3", className), children: [
|
|
383
|
+
hiddenInput,
|
|
384
|
+
items.map((item2) => /* @__PURE__ */ jsx(
|
|
385
|
+
UploadPictureCard,
|
|
386
|
+
{
|
|
387
|
+
item: item2,
|
|
388
|
+
onRemove: removable ? () => removeItem(item2.uid) : void 0
|
|
389
|
+
},
|
|
390
|
+
item2.uid
|
|
391
|
+
)),
|
|
392
|
+
canAdd && /* @__PURE__ */ jsxs(
|
|
393
|
+
"button",
|
|
394
|
+
{
|
|
395
|
+
type: "button",
|
|
396
|
+
disabled,
|
|
397
|
+
onClick: openPicker,
|
|
398
|
+
className: cn(
|
|
399
|
+
"flex size-24 flex-col items-center justify-center rounded-md border border-dashed",
|
|
400
|
+
"text-muted-foreground hover:border-primary hover:text-primary transition-colors",
|
|
401
|
+
disabled && "pointer-events-none opacity-50"
|
|
402
|
+
),
|
|
403
|
+
"aria-label": t("dataEntry.upload.addImage"),
|
|
404
|
+
children: [
|
|
405
|
+
/* @__PURE__ */ jsx(ImagePlus, { className: "size-6", "aria-hidden": "true" }),
|
|
406
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1 text-xs", children: t("dataEntry.upload.addImage") })
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
)
|
|
410
|
+
] });
|
|
411
|
+
}
|
|
412
|
+
if (variant === "picture") {
|
|
413
|
+
const item2 = draft.state.display;
|
|
414
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("ui-stack-sm max-w-xs", className), children: [
|
|
415
|
+
hiddenInput,
|
|
416
|
+
item2?.previewUrl && !item2.pendingDelete ? /* @__PURE__ */ jsxs("div", { className: "relative overflow-hidden rounded-md border", children: [
|
|
417
|
+
/* @__PURE__ */ jsx("img", { src: item2.previewUrl, alt: "", className: "max-h-48 w-full object-cover" }),
|
|
418
|
+
item2.status === "uploading" && /* @__PURE__ */ jsx("div", { className: "bg-background/70 absolute inset-0 flex items-center justify-center text-sm", children: t("dataEntry.upload.uploading") }),
|
|
419
|
+
item2.pendingReplace && /* @__PURE__ */ jsx("div", { className: "bg-warning text-warning-foreground absolute top-2 left-2 rounded px-2 py-0.5 text-xs", children: t("dataEntry.upload.pendingReplace") })
|
|
420
|
+
] }) : /* @__PURE__ */ jsxs(
|
|
421
|
+
"button",
|
|
422
|
+
{
|
|
423
|
+
type: "button",
|
|
424
|
+
disabled,
|
|
425
|
+
onClick: openPicker,
|
|
426
|
+
className: "text-muted-foreground hover:border-primary flex h-32 w-full flex-col items-center justify-center rounded-md border border-dashed",
|
|
427
|
+
children: [
|
|
428
|
+
/* @__PURE__ */ jsx(ImagePlus, { className: controlIconClass, "aria-hidden": "true" }),
|
|
429
|
+
/* @__PURE__ */ jsx("span", { className: "mt-2 text-sm", children: t("dataEntry.upload.addImage") })
|
|
430
|
+
]
|
|
431
|
+
}
|
|
432
|
+
),
|
|
433
|
+
/* @__PURE__ */ jsx(UploadDraftActions, { draft, disabled, onPick: openPicker })
|
|
434
|
+
] });
|
|
435
|
+
}
|
|
436
|
+
const item = draft.state.display;
|
|
437
|
+
const showPlaceholder = !item?.previewUrl || item.pendingDelete;
|
|
438
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("ui-stack-sm items-start", className), children: [
|
|
439
|
+
hiddenInput,
|
|
440
|
+
/* @__PURE__ */ jsx(
|
|
441
|
+
UploadCropDialog,
|
|
442
|
+
{
|
|
443
|
+
open: variant === "avatar-crop" && cropFile != null,
|
|
444
|
+
onOpenChange: (open) => !open && setCropFile(null),
|
|
445
|
+
file: cropFile,
|
|
446
|
+
onConfirm: (cropped) => {
|
|
447
|
+
const baseline = items[0];
|
|
448
|
+
const item2 = createUploadItem(cropped, {
|
|
449
|
+
pendingReplace: Boolean(baseline?.mediaId),
|
|
450
|
+
replacesMediaId: baseline?.mediaId
|
|
451
|
+
});
|
|
452
|
+
setItems([item2]);
|
|
453
|
+
setCropFile(null);
|
|
454
|
+
if (onUpload) void runUpload(cropped, item2, onUpload, setItems);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
),
|
|
458
|
+
/* @__PURE__ */ jsxs("div", { className: "relative inline-block", children: [
|
|
459
|
+
/* @__PURE__ */ jsxs(
|
|
460
|
+
"button",
|
|
461
|
+
{
|
|
462
|
+
type: "button",
|
|
463
|
+
disabled,
|
|
464
|
+
onClick: openPicker,
|
|
465
|
+
className: cn(
|
|
466
|
+
"border-border bg-muted relative size-24 overflow-hidden rounded-full border-2",
|
|
467
|
+
"focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none",
|
|
468
|
+
item?.pendingDelete && "opacity-40",
|
|
469
|
+
disabled && "pointer-events-none opacity-50"
|
|
470
|
+
),
|
|
471
|
+
"aria-label": t("dataEntry.upload.avatarLabel"),
|
|
472
|
+
children: [
|
|
473
|
+
!showPlaceholder && item?.previewUrl ? /* @__PURE__ */ jsx("img", { src: item.previewUrl, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground flex size-full items-center justify-center", children: /* @__PURE__ */ jsx(Camera, { className: controlIconClass, "aria-hidden": "true" }) }),
|
|
474
|
+
!disabled && /* @__PURE__ */ jsx("span", { className: "absolute inset-x-0 bottom-0 bg-black/50 py-1 text-center text-[10px] text-white", children: t("dataEntry.upload.change") })
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
),
|
|
478
|
+
removable && item && !item.pendingDelete && /* @__PURE__ */ jsx(
|
|
479
|
+
"button",
|
|
480
|
+
{
|
|
481
|
+
type: "button",
|
|
482
|
+
disabled,
|
|
483
|
+
onClick: () => draft.markRemove(),
|
|
484
|
+
className: "bg-background hover:bg-destructive hover:text-destructive-foreground absolute -top-1 -right-1 rounded-full border p-1 shadow-sm",
|
|
485
|
+
"aria-label": t("dataEntry.upload.removeAvatar"),
|
|
486
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5", "aria-hidden": "true" })
|
|
487
|
+
}
|
|
488
|
+
)
|
|
489
|
+
] }),
|
|
490
|
+
/* @__PURE__ */ jsx(UploadDraftActions, { draft, disabled, onPick: openPicker })
|
|
491
|
+
] });
|
|
492
|
+
}
|
|
493
|
+
function UploadDraftActions({
|
|
494
|
+
draft,
|
|
495
|
+
disabled,
|
|
496
|
+
onPick
|
|
497
|
+
}) {
|
|
498
|
+
const { t } = useTranslation();
|
|
499
|
+
const { state, undoRemove, undoReplace } = draft;
|
|
500
|
+
if (state.canUndoRemove) {
|
|
501
|
+
return /* @__PURE__ */ jsxs("div", { className: "border-destructive/40 bg-destructive/5 flex flex-wrap items-center gap-2 rounded-md border border-dashed px-3 py-2 text-sm", children: [
|
|
502
|
+
/* @__PURE__ */ jsx("span", { className: "text-destructive", children: t("dataEntry.upload.markedForDelete") }),
|
|
503
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", variant: "outline", disabled, onClick: undoRemove, children: [
|
|
504
|
+
/* @__PURE__ */ jsx(RotateCcw, { className: "mr-1 size-3.5", "aria-hidden": "true" }),
|
|
505
|
+
t("dataEntry.upload.undo")
|
|
506
|
+
] })
|
|
507
|
+
] });
|
|
508
|
+
}
|
|
509
|
+
if (state.canUndoReplace) {
|
|
510
|
+
return /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex flex-wrap items-center gap-2 text-sm", children: [
|
|
511
|
+
/* @__PURE__ */ jsx("span", { children: t("dataEntry.upload.pendingReplaceHint") }),
|
|
512
|
+
/* @__PURE__ */ jsx(Button, { type: "button", size: "sm", variant: "ghost", disabled, onClick: undoReplace, children: t("dataEntry.upload.undo") }),
|
|
513
|
+
/* @__PURE__ */ jsx(Button, { type: "button", size: "sm", variant: "outline", disabled, onClick: onPick, children: t("dataEntry.upload.change") })
|
|
514
|
+
] });
|
|
515
|
+
}
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
function UploadPictureCard({ item, onRemove }) {
|
|
519
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-muted relative size-24 overflow-hidden rounded-md border", children: [
|
|
520
|
+
item.previewUrl ? /* @__PURE__ */ jsx("img", { src: item.previewUrl, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsx("div", { className: "text-muted-foreground flex size-full items-center justify-center text-xs", children: "\u2026" }),
|
|
521
|
+
item.status === "uploading" && /* @__PURE__ */ jsx("div", { className: "bg-background/70 absolute inset-0 flex items-center justify-center text-xs", children: "\u2026" }),
|
|
522
|
+
onRemove && /* @__PURE__ */ jsx(
|
|
523
|
+
"button",
|
|
524
|
+
{
|
|
525
|
+
type: "button",
|
|
526
|
+
onClick: onRemove,
|
|
527
|
+
className: "bg-background/90 hover:bg-destructive hover:text-destructive-foreground absolute top-1 right-1 rounded-full p-0.5 shadow",
|
|
528
|
+
"aria-label": "Remove",
|
|
529
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-3.5", "aria-hidden": "true" })
|
|
530
|
+
}
|
|
531
|
+
)
|
|
532
|
+
] });
|
|
533
|
+
}
|
|
534
|
+
function UploadFileList({
|
|
535
|
+
items,
|
|
536
|
+
onRemove
|
|
537
|
+
}) {
|
|
538
|
+
return /* @__PURE__ */ jsx("ul", { className: "ui-stack-xs", children: items.map((item) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3 rounded-md border px-3 py-2 text-sm", children: [
|
|
539
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
540
|
+
/* @__PURE__ */ jsx("div", { className: "truncate font-medium", children: item.name }),
|
|
541
|
+
/* @__PURE__ */ jsxs("div", { className: "text-muted-foreground text-xs", children: [
|
|
542
|
+
formatBytes(item.size),
|
|
543
|
+
item.status === "uploading" && " \xB7 \u2026",
|
|
544
|
+
item.status === "error" && item.error && /* @__PURE__ */ jsxs("span", { className: "text-destructive", children: [
|
|
545
|
+
" \xB7 ",
|
|
546
|
+
item.error
|
|
547
|
+
] }),
|
|
548
|
+
item.mediaId && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
549
|
+
" \xB7 ",
|
|
550
|
+
item.mediaId.slice(0, 8),
|
|
551
|
+
"\u2026"
|
|
552
|
+
] })
|
|
553
|
+
] })
|
|
554
|
+
] }),
|
|
555
|
+
onRemove && /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", variant: "ghost", onClick: () => onRemove(item.uid), children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" }) })
|
|
556
|
+
] }, item.uid)) });
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
export { Upload, collectUploadCommitActions, createUploadItem, useUploadDraft };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { toneWarningClass, toneSuccessClass } from './chunk-ICM6XBST.js';
|
|
2
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var badgeVariants = cva(
|
|
7
|
+
"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "border-transparent bg-primary text-primary-foreground",
|
|
12
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
13
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground",
|
|
14
|
+
outline: "text-foreground",
|
|
15
|
+
success: cn("border-transparent", toneSuccessClass),
|
|
16
|
+
warning: cn("border-transparent", toneWarningClass)
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: { variant: "default" }
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
function Badge({ className, variant, ...props }) {
|
|
23
|
+
return /* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Badge };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// src/lib/variants.ts
|
|
5
|
+
var densityClass = {
|
|
6
|
+
compact: "ui-density-compact",
|
|
7
|
+
default: "ui-density-default",
|
|
8
|
+
comfortable: "ui-density-comfortable"
|
|
9
|
+
};
|
|
10
|
+
var pageContainerVariantClass = {
|
|
11
|
+
default: void 0,
|
|
12
|
+
narrow: "ui-page-container--narrow",
|
|
13
|
+
flush: "ui-page-container--flush",
|
|
14
|
+
ghost: "ui-page-container--ghost"
|
|
15
|
+
};
|
|
16
|
+
var stackGapClass = {
|
|
17
|
+
xs: "ui-stack-xs",
|
|
18
|
+
sm: "ui-stack-sm",
|
|
19
|
+
md: "ui-stack-md",
|
|
20
|
+
lg: "ui-stack-lg",
|
|
21
|
+
xl: "ui-stack-xl"
|
|
22
|
+
};
|
|
23
|
+
var inlineGapClass = {
|
|
24
|
+
xs: "ui-inline-xs",
|
|
25
|
+
sm: "ui-inline-sm",
|
|
26
|
+
md: "ui-inline-md",
|
|
27
|
+
lg: "ui-inline-lg"
|
|
28
|
+
};
|
|
29
|
+
function Inline({ gap = "sm", className, children, ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsx("div", { className: cn(inlineGapClass[gap], className), ...props, children });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { Inline, densityClass, pageContainerVariantClass, stackGapClass };
|