@bettercms-ai/kit 0.1.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -16
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/adapters/dock-values.d.ts +28 -0
- package/dist/adapters/dock-values.js +41 -0
- package/dist/adapters/dock-values.js.map +1 -0
- package/dist/adapters/icons.d.ts +15 -0
- package/dist/adapters/icons.js +27 -0
- package/dist/adapters/icons.js.map +1 -0
- package/dist/adapters/lossy.d.ts +326 -0
- package/dist/adapters/lossy.js +414 -0
- package/dist/adapters/lossy.js.map +1 -0
- package/dist/adapters/prod-types.d.ts +546 -0
- package/dist/adapters/prod-types.js +714 -0
- package/dist/adapters/prod-types.js.map +1 -0
- package/dist/adapters/schema.d.ts +154 -0
- package/dist/adapters/schema.js +3020 -0
- package/dist/adapters/schema.js.map +1 -0
- package/dist/adapters/values.d.ts +221 -0
- package/dist/adapters/values.js +623 -0
- package/dist/adapters/values.js.map +1 -0
- package/dist/brand/logo.d.ts +17 -0
- package/dist/brand/logo.js +96 -0
- package/dist/brand/logo.js.map +1 -0
- package/dist/context.d.ts +359 -0
- package/dist/context.js +217 -0
- package/dist/context.js.map +1 -0
- package/dist/controls/button.d.ts +72 -0
- package/dist/controls/button.js +578 -0
- package/dist/controls/button.js.map +1 -0
- package/dist/controls/c1.d.ts +11 -0
- package/dist/controls/c1.js +24 -0
- package/dist/controls/c1.js.map +1 -0
- package/dist/controls/c2.d.ts +10 -0
- package/dist/controls/c2.js +19 -0
- package/dist/controls/c2.js.map +1 -0
- package/dist/controls/choice.d.ts +44 -0
- package/dist/controls/choice.js +463 -0
- package/dist/controls/choice.js.map +1 -0
- package/dist/controls/code-register.d.ts +1 -0
- package/dist/controls/code-register.js +8 -0
- package/dist/controls/code-register.js.map +1 -0
- package/dist/controls/code.d.ts +42 -0
- package/dist/controls/code.js +397 -0
- package/dist/controls/code.js.map +1 -0
- package/dist/controls/color.d.ts +5 -0
- package/dist/controls/color.js +130 -0
- package/dist/controls/color.js.map +1 -0
- package/dist/controls/component-services.d.ts +156 -0
- package/dist/controls/component-services.js +7 -0
- package/dist/controls/component-services.js.map +1 -0
- package/dist/controls/date-register.d.ts +1 -0
- package/dist/controls/date-register.js +9 -0
- package/dist/controls/date-register.js.map +1 -0
- package/dist/controls/date-zone.d.ts +104 -0
- package/dist/controls/date-zone.js +278 -0
- package/dist/controls/date-zone.js.map +1 -0
- package/dist/controls/date.d.ts +7 -0
- package/dist/controls/date.js +466 -0
- package/dist/controls/date.js.map +1 -0
- package/dist/controls/form-picker-register.d.ts +1 -0
- package/dist/controls/form-picker-register.js +19 -0
- package/dist/controls/form-picker-register.js.map +1 -0
- package/dist/controls/form-picker.d.ts +43 -0
- package/dist/controls/form-picker.js +85 -0
- package/dist/controls/form-picker.js.map +1 -0
- package/dist/controls/icon-register.d.ts +1 -0
- package/dist/controls/icon-register.js +8 -0
- package/dist/controls/icon-register.js.map +1 -0
- package/dist/controls/icon.d.ts +40 -0
- package/dist/controls/icon.js +360 -0
- package/dist/controls/icon.js.map +1 -0
- package/dist/controls/index.d.ts +5 -0
- package/dist/controls/index.js +38 -0
- package/dist/controls/index.js.map +1 -0
- package/dist/controls/json-register.d.ts +1 -0
- package/dist/controls/json-register.js +8 -0
- package/dist/controls/json-register.js.map +1 -0
- package/dist/controls/json.d.ts +2 -0
- package/dist/controls/json.js +82 -0
- package/dist/controls/json.js.map +1 -0
- package/dist/controls/link.d.ts +260 -0
- package/dist/controls/link.js +1186 -0
- package/dist/controls/link.js.map +1 -0
- package/dist/controls/location-register.d.ts +1 -0
- package/dist/controls/location-register.js +8 -0
- package/dist/controls/location-register.js.map +1 -0
- package/dist/controls/location.d.ts +16 -0
- package/dist/controls/location.js +221 -0
- package/dist/controls/location.js.map +1 -0
- package/dist/controls/media-register.d.ts +1 -0
- package/dist/controls/media-register.js +12 -0
- package/dist/controls/media-register.js.map +1 -0
- package/dist/controls/media-services.d.ts +46 -0
- package/dist/controls/media-services.js +0 -0
- package/dist/controls/media.d.ts +104 -0
- package/dist/controls/media.js +1396 -0
- package/dist/controls/media.js.map +1 -0
- package/dist/controls/number.d.ts +22 -0
- package/dist/controls/number.js +196 -0
- package/dist/controls/number.js.map +1 -0
- package/dist/controls/reference-register.d.ts +1 -0
- package/dist/controls/reference-register.js +10 -0
- package/dist/controls/reference-register.js.map +1 -0
- package/dist/controls/reference-services.d.ts +58 -0
- package/dist/controls/reference-services.js +0 -0
- package/dist/controls/reference.d.ts +23 -0
- package/dist/controls/reference.js +777 -0
- package/dist/controls/reference.js.map +1 -0
- package/dist/controls/rich-text/blocks.d.ts +49 -0
- package/dist/controls/rich-text/blocks.js +1859 -0
- package/dist/controls/rich-text/blocks.js.map +1 -0
- package/dist/controls/rich-text/catalog.d.ts +101 -0
- package/dist/controls/rich-text/catalog.js +623 -0
- package/dist/controls/rich-text/catalog.js.map +1 -0
- package/dist/controls/rich-text/codec.d.ts +64 -0
- package/dist/controls/rich-text/codec.js +34 -0
- package/dist/controls/rich-text/codec.js.map +1 -0
- package/dist/controls/rich-text/component-card.d.ts +14 -0
- package/dist/controls/rich-text/component-card.js +1024 -0
- package/dist/controls/rich-text/component-card.js.map +1 -0
- package/dist/controls/rich-text/component-panel.d.ts +47 -0
- package/dist/controls/rich-text/component-panel.js +141 -0
- package/dist/controls/rich-text/component-panel.js.map +1 -0
- package/dist/controls/rich-text/control.d.ts +20 -0
- package/dist/controls/rich-text/control.js +296 -0
- package/dist/controls/rich-text/control.js.map +1 -0
- package/dist/controls/rich-text/dom.d.ts +233 -0
- package/dist/controls/rich-text/dom.js +1019 -0
- package/dist/controls/rich-text/dom.js.map +1 -0
- package/dist/controls/rich-text/editor.d.ts +57 -0
- package/dist/controls/rich-text/editor.js +1630 -0
- package/dist/controls/rich-text/editor.js.map +1 -0
- package/dist/controls/rich-text/floating.d.ts +28 -0
- package/dist/controls/rich-text/floating.js +154 -0
- package/dist/controls/rich-text/floating.js.map +1 -0
- package/dist/controls/rich-text/index.d.ts +1 -0
- package/dist/controls/rich-text/index.js +12 -0
- package/dist/controls/rich-text/index.js.map +1 -0
- package/dist/controls/rich-text/link-form.d.ts +13 -0
- package/dist/controls/rich-text/link-form.js +147 -0
- package/dist/controls/rich-text/link-form.js.map +1 -0
- package/dist/controls/rich-text/markdown.d.ts +6 -0
- package/dist/controls/rich-text/markdown.js +181 -0
- package/dist/controls/rich-text/markdown.js.map +1 -0
- package/dist/controls/rich-text/ops.d.ts +35 -0
- package/dist/controls/rich-text/ops.js +316 -0
- package/dist/controls/rich-text/ops.js.map +1 -0
- package/dist/controls/rich-text/plain.d.ts +17 -0
- package/dist/controls/rich-text/plain.js +44 -0
- package/dist/controls/rich-text/plain.js.map +1 -0
- package/dist/controls/rich-text/toolbar.d.ts +89 -0
- package/dist/controls/rich-text/toolbar.js +343 -0
- package/dist/controls/rich-text/toolbar.js.map +1 -0
- package/dist/controls/scale.d.ts +56 -0
- package/dist/controls/scale.js +563 -0
- package/dist/controls/scale.js.map +1 -0
- package/dist/controls/slot-register.d.ts +1 -0
- package/dist/controls/slot-register.js +16 -0
- package/dist/controls/slot-register.js.map +1 -0
- package/dist/controls/slot-services.d.ts +122 -0
- package/dist/controls/slot-services.js +155 -0
- package/dist/controls/slot-services.js.map +1 -0
- package/dist/controls/slot.d.ts +33 -0
- package/dist/controls/slot.js +366 -0
- package/dist/controls/slot.js.map +1 -0
- package/dist/controls/table/index.d.ts +1 -0
- package/dist/controls/table/index.js +12 -0
- package/dist/controls/table/index.js.map +1 -0
- package/dist/controls/table/prod.d.ts +21 -0
- package/dist/controls/table/prod.js +79 -0
- package/dist/controls/table/prod.js.map +1 -0
- package/dist/controls/table/refs.d.ts +50 -0
- package/dist/controls/table/refs.js +79 -0
- package/dist/controls/table/refs.js.map +1 -0
- package/dist/controls/table/stored.d.ts +15 -0
- package/dist/controls/table/stored.js +44 -0
- package/dist/controls/table/stored.js.map +1 -0
- package/dist/controls/table/table-editor.d.ts +103 -0
- package/dist/controls/table/table-editor.js +2725 -0
- package/dist/controls/table/table-editor.js.map +1 -0
- package/dist/controls/table/table-link.d.ts +24 -0
- package/dist/controls/table/table-link.js +180 -0
- package/dist/controls/table/table-link.js.map +1 -0
- package/dist/controls/table/table.d.ts +9 -0
- package/dist/controls/table/table.js +103 -0
- package/dist/controls/table/table.js.map +1 -0
- package/dist/controls/text.d.ts +17 -0
- package/dist/controls/text.js +322 -0
- package/dist/controls/text.js.map +1 -0
- package/dist/controls/unknown-value.d.ts +17 -0
- package/dist/controls/unknown-value.js +66 -0
- package/dist/controls/unknown-value.js.map +1 -0
- package/dist/core/core.d.ts +63 -0
- package/dist/core/core.js +171 -0
- package/dist/core/core.js.map +1 -0
- package/dist/core/facets.d.ts +347 -0
- package/dist/core/facets.js +334 -0
- package/dist/core/facets.js.map +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +3 -0
- package/dist/engine/array.d.ts +101 -0
- package/dist/engine/array.js +906 -0
- package/dist/engine/array.js.map +1 -0
- package/dist/engine/bits.d.ts +24 -0
- package/dist/engine/bits.js +60 -0
- package/dist/engine/bits.js.map +1 -0
- package/dist/engine/breadcrumb.d.ts +45 -0
- package/dist/engine/breadcrumb.js +63 -0
- package/dist/engine/breadcrumb.js.map +1 -0
- package/dist/engine/expand.d.ts +66 -0
- package/dist/engine/expand.js +153 -0
- package/dist/engine/expand.js.map +1 -0
- package/dist/engine/field-list.d.ts +20 -0
- package/dist/engine/field-list.js +19 -0
- package/dist/engine/field-list.js.map +1 -0
- package/dist/engine/field-shell.d.ts +49 -0
- package/dist/engine/field-shell.js +988 -0
- package/dist/engine/field-shell.js.map +1 -0
- package/dist/engine/frame.d.ts +122 -0
- package/dist/engine/frame.js +601 -0
- package/dist/engine/frame.js.map +1 -0
- package/dist/engine/group-summary.d.ts +5 -0
- package/dist/engine/group-summary.js +70 -0
- package/dist/engine/group-summary.js.map +1 -0
- package/dist/engine/grouping.d.ts +238 -0
- package/dist/engine/grouping.js +996 -0
- package/dist/engine/grouping.js.map +1 -0
- package/dist/engine/item-list.d.ts +99 -0
- package/dist/engine/item-list.js +725 -0
- package/dist/engine/item-list.js.map +1 -0
- package/dist/engine/kit-field.d.ts +72 -0
- package/dist/engine/kit-field.js +558 -0
- package/dist/engine/kit-field.js.map +1 -0
- package/dist/engine/schema-form.d.ts +116 -0
- package/dist/engine/schema-form.js +462 -0
- package/dist/engine/schema-form.js.map +1 -0
- package/dist/engine/slot.d.ts +13 -0
- package/dist/engine/slot.js +216 -0
- package/dist/engine/slot.js.map +1 -0
- package/dist/index.d.ts +45 -3139
- package/dist/index.js +47 -2036
- package/dist/index.js.map +1 -0
- package/dist/kit.css +75 -0
- package/dist/lib/cn.d.ts +4 -0
- package/dist/lib/cn.js +56 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/columns.d.ts +14 -0
- package/dist/lib/columns.js +30 -0
- package/dist/lib/columns.js.map +1 -0
- package/dist/lib/frames.d.ts +36 -0
- package/dist/lib/frames.js +214 -0
- package/dist/lib/frames.js.map +1 -0
- package/dist/lib/icon-image.d.ts +10 -0
- package/dist/lib/icon-image.js +8 -0
- package/dist/lib/icon-image.js.map +1 -0
- package/dist/lib/icons.d.ts +16 -0
- package/dist/lib/icons.js +173 -0
- package/dist/lib/icons.js.map +1 -0
- package/dist/lib/input-modality.d.ts +11 -0
- package/dist/lib/input-modality.js +47 -0
- package/dist/lib/input-modality.js.map +1 -0
- package/dist/lib/key-event.d.ts +11 -0
- package/dist/lib/key-event.js +16 -0
- package/dist/lib/key-event.js.map +1 -0
- package/dist/lib/path.d.ts +29 -0
- package/dist/lib/path.js +66 -0
- package/dist/lib/path.js.map +1 -0
- package/dist/lib/schema.d.ts +80 -0
- package/dist/lib/schema.js +384 -0
- package/dist/lib/schema.js.map +1 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.js +37 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/validate.d.ts +30 -0
- package/dist/lib/validate.js +224 -0
- package/dist/lib/validate.js.map +1 -0
- package/dist/library/analysis.d.ts +23 -0
- package/dist/library/analysis.js +160 -0
- package/dist/library/analysis.js.map +1 -0
- package/dist/library/catalog.d.ts +57 -0
- package/dist/library/catalog.js +307 -0
- package/dist/library/catalog.js.map +1 -0
- package/dist/library/coreNotes.d.ts +8 -0
- package/dist/library/coreNotes.js +111 -0
- package/dist/library/coreNotes.js.map +1 -0
- package/dist/library/coverage.d.ts +40 -0
- package/dist/library/coverage.js +59 -0
- package/dist/library/coverage.js.map +1 -0
- package/dist/library/entries/advanced.entries.d.ts +2 -0
- package/dist/library/entries/advanced.entries.js +6579 -0
- package/dist/library/entries/advanced.entries.js.map +1 -0
- package/dist/library/entries/commerce.entries.d.ts +2 -0
- package/dist/library/entries/commerce.entries.js +4140 -0
- package/dist/library/entries/commerce.entries.js.map +1 -0
- package/dist/library/entries/company.entries.d.ts +2 -0
- package/dist/library/entries/company.entries.js +2731 -0
- package/dist/library/entries/company.entries.js.map +1 -0
- package/dist/library/entries/conversion.entries.d.ts +2 -0
- package/dist/library/entries/conversion.entries.js +3707 -0
- package/dist/library/entries/conversion.entries.js.map +1 -0
- package/dist/library/entries/data.entries.d.ts +7 -0
- package/dist/library/entries/data.entries.js +4613 -0
- package/dist/library/entries/data.entries.js.map +1 -0
- package/dist/library/entries/events.entries.d.ts +2 -0
- package/dist/library/entries/events.entries.js +3428 -0
- package/dist/library/entries/events.entries.js.map +1 -0
- package/dist/library/entries/features.entries.d.ts +2 -0
- package/dist/library/entries/features.entries.js +3157 -0
- package/dist/library/entries/features.entries.js.map +1 -0
- package/dist/library/entries/heroes.entries.d.ts +2 -0
- package/dist/library/entries/heroes.entries.js +3401 -0
- package/dist/library/entries/heroes.entries.js.map +1 -0
- package/dist/library/entries/index.d.ts +3 -0
- package/dist/library/entries/index.js +35 -0
- package/dist/library/entries/index.js.map +1 -0
- package/dist/library/entries/listings.entries.d.ts +2 -0
- package/dist/library/entries/listings.entries.js +2976 -0
- package/dist/library/entries/listings.entries.js.map +1 -0
- package/dist/library/entries/longform.entries.d.ts +2 -0
- package/dist/library/entries/longform.entries.js +4227 -0
- package/dist/library/entries/longform.entries.js.map +1 -0
- package/dist/library/entries/media.entries.d.ts +2 -0
- package/dist/library/entries/media.entries.js +2781 -0
- package/dist/library/entries/media.entries.js.map +1 -0
- package/dist/library/entries/navigation.entries.d.ts +2 -0
- package/dist/library/entries/navigation.entries.js +4011 -0
- package/dist/library/entries/navigation.entries.js.map +1 -0
- package/dist/library/entries/pricing.entries.d.ts +2 -0
- package/dist/library/entries/pricing.entries.js +2383 -0
- package/dist/library/entries/pricing.entries.js.map +1 -0
- package/dist/library/entries/social-proof.entries.d.ts +2 -0
- package/dist/library/entries/social-proof.entries.js +2297 -0
- package/dist/library/entries/social-proof.entries.js.map +1 -0
- package/dist/library/examples/bento.d.ts +92 -0
- package/dist/library/examples/bento.js +201 -0
- package/dist/library/examples/bento.js.map +1 -0
- package/dist/library/examples/blocks.d.ts +14 -0
- package/dist/library/examples/blocks.js +313 -0
- package/dist/library/examples/blocks.js.map +1 -0
- package/dist/library/examples/faq.d.ts +28 -0
- package/dist/library/examples/faq.js +230 -0
- package/dist/library/examples/faq.js.map +1 -0
- package/dist/library/examples/hero.d.ts +43 -0
- package/dist/library/examples/hero.js +222 -0
- package/dist/library/examples/hero.js.map +1 -0
- package/dist/library/examples/index.d.ts +36 -0
- package/dist/library/examples/index.js +109 -0
- package/dist/library/examples/index.js.map +1 -0
- package/dist/library/examples/journalStory.d.ts +93 -0
- package/dist/library/examples/journalStory.js +338 -0
- package/dist/library/examples/journalStory.js.map +1 -0
- package/dist/library/examples/megaMenu.d.ts +134 -0
- package/dist/library/examples/megaMenu.js +442 -0
- package/dist/library/examples/megaMenu.js.map +1 -0
- package/dist/library/examples/pricing.d.ts +103 -0
- package/dist/library/examples/pricing.js +479 -0
- package/dist/library/examples/pricing.js.map +1 -0
- package/dist/library/examples/tabs.d.ts +87 -0
- package/dist/library/examples/tabs.js +180 -0
- package/dist/library/examples/tabs.js.map +1 -0
- package/dist/library/export.d.ts +42 -0
- package/dist/library/export.js +80 -0
- package/dist/library/export.js.map +1 -0
- package/dist/library/index.d.ts +13 -0
- package/dist/library/index.js +6 -0
- package/dist/library/kit-catalog.json +1510 -0
- package/dist/library/types.d.ts +42 -0
- package/dist/library/types.js +0 -0
- package/dist/schema/adapters.d.ts +28 -0
- package/dist/schema/adapters.js +492 -0
- package/dist/schema/adapters.js.map +1 -0
- package/dist/schema/help.d.ts +27 -0
- package/dist/schema/help.js +56 -0
- package/dist/schema/help.js.map +1 -0
- package/dist/schema/scale.d.ts +69 -0
- package/dist/schema/scale.js +250 -0
- package/dist/schema/scale.js.map +1 -0
- package/dist/schema/sources.d.ts +103 -0
- package/dist/schema/sources.js +65 -0
- package/dist/schema/sources.js.map +1 -0
- package/dist/schema/table.d.ts +319 -0
- package/dist/schema/table.js +1199 -0
- package/dist/schema/table.js.map +1 -0
- package/dist/schema/types.d.ts +297 -0
- package/dist/schema/types.js +14 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/table/table-view.d.ts +14 -0
- package/dist/table/table-view.js +140 -0
- package/dist/table/table-view.js.map +1 -0
- package/dist/table/table.css +73 -0
- package/dist/testing/corpus.d.ts +63 -0
- package/dist/testing/corpus.js +129 -0
- package/dist/testing/corpus.js.map +1 -0
- package/dist/testing/test-form.d.ts +11 -0
- package/dist/testing/test-form.js +38 -0
- package/dist/testing/test-form.js.map +1 -0
- package/dist/theme.css +345 -0
- package/dist/theme.d.ts +20 -1504
- package/dist/theme.js +43 -4126
- package/dist/theme.js.map +1 -0
- package/dist/tokens.css +542 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.js +0 -0
- package/dist/ui/action-tray.d.ts +54 -0
- package/dist/ui/action-tray.js +154 -0
- package/dist/ui/action-tray.js.map +1 -0
- package/dist/ui/autocomplete.d.ts +30 -0
- package/dist/ui/autocomplete.js +139 -0
- package/dist/ui/autocomplete.js.map +1 -0
- package/dist/ui/button.d.ts +57 -0
- package/dist/ui/button.js +201 -0
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/choice-switch.d.ts +36 -0
- package/dist/ui/choice-switch.js +57 -0
- package/dist/ui/choice-switch.js.map +1 -0
- package/dist/ui/controls.d.ts +83 -0
- package/dist/ui/controls.js +331 -0
- package/dist/ui/controls.js.map +1 -0
- package/dist/ui/display.d.ts +163 -0
- package/dist/ui/display.js +455 -0
- package/dist/ui/display.js.map +1 -0
- package/dist/ui/expanded-editor-modal.d.ts +26 -0
- package/dist/ui/expanded-editor-modal.js +140 -0
- package/dist/ui/expanded-editor-modal.js.map +1 -0
- package/dist/ui/field-context.d.ts +12 -0
- package/dist/ui/field-context.js +23 -0
- package/dist/ui/field-context.js.map +1 -0
- package/dist/ui/floating-panel.d.ts +152 -0
- package/dist/ui/floating-panel.js +928 -0
- package/dist/ui/floating-panel.js.map +1 -0
- package/dist/ui/index.d.ts +16 -0
- package/dist/ui/index.js +18 -0
- package/dist/ui/input.d.ts +78 -0
- package/dist/ui/input.js +250 -0
- package/dist/ui/input.js.map +1 -0
- package/dist/ui/mode-bar.d.ts +31 -0
- package/dist/ui/mode-bar.js +65 -0
- package/dist/ui/mode-bar.js.map +1 -0
- package/dist/ui/overlay.d.ts +195 -0
- package/dist/ui/overlay.js +697 -0
- package/dist/ui/overlay.js.map +1 -0
- package/dist/ui/path-crumbs.d.ts +90 -0
- package/dist/ui/path-crumbs.js +566 -0
- package/dist/ui/path-crumbs.js.map +1 -0
- package/dist/ui/presence.d.ts +16 -0
- package/dist/ui/presence.js +65 -0
- package/dist/ui/presence.js.map +1 -0
- package/dist/ui/select.d.ts +66 -0
- package/dist/ui/select.js +407 -0
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/shortcut-hint.d.ts +14 -0
- package/dist/ui/shortcut-hint.js +35 -0
- package/dist/ui/shortcut-hint.js.map +1 -0
- package/dist/ui/spinner.d.ts +24 -0
- package/dist/ui/spinner.js +42 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/split-button.d.ts +32 -0
- package/dist/ui/split-button.js +60 -0
- package/dist/ui/split-button.js.map +1 -0
- package/dist/ui/surfaces.d.ts +23 -0
- package/dist/ui/surfaces.js +26 -0
- package/dist/ui/surfaces.js.map +1 -0
- package/dist/ui/tab.d.ts +38 -0
- package/dist/ui/tab.js +87 -0
- package/dist/ui/tab.js.map +1 -0
- package/dist/ui/toast.d.ts +20 -0
- package/dist/ui/toast.js +115 -0
- package/dist/ui/toast.js.map +1 -0
- package/dist/ui/tooltip-root.d.ts +13 -0
- package/dist/ui/tooltip-root.js +77 -0
- package/dist/ui/tooltip-root.js.map +1 -0
- package/dist/ui/variants.d.ts +15 -0
- package/dist/ui/variants.js +14 -0
- package/dist/ui/variants.js.map +1 -0
- package/package.json +76 -50
- package/LICENSE +0 -21
- package/dist/_chunks-cjs/_visual-editing.js +0 -5898
- package/dist/_chunks-cjs/refractor.js +0 -22
- package/dist/_chunks-es/_visual-editing.mjs +0 -5904
- package/dist/_chunks-es/refractor.mjs +0 -25
- package/dist/_color.d.mts +0 -119
- package/dist/_color.d.ts +0 -119
- package/dist/_color.js +0 -1412
- package/dist/_color.mjs +0 -1411
- package/dist/_visual-editing.d.mts +0 -1126
- package/dist/_visual-editing.d.ts +0 -1126
- package/dist/_visual-editing.js +0 -30
- package/dist/_visual-editing.mjs +0 -30
- package/dist/index.d.mts +0 -3140
- package/dist/index.mjs +0 -2044
- package/dist/theme.d.mts +0 -1506
- package/dist/theme.mjs +0 -4126
- package/exports/_visual-editing.ts +0 -31
- package/exports/index.ts +0 -1
- package/exports/theme.ts +0 -1
- package/src/color/index.d.mts +0 -119
- package/src/color/index.mjs +0 -1411
- package/src/core/__workshop__/constants.ts +0 -293
- package/src/core/_compat.ts +0 -264
- package/src/core/components/autocomplete/__mocks__/apiStore.ts +0 -49
- package/src/core/components/autocomplete/__mocks__/countries.ts +0 -245
- package/src/core/components/autocomplete/__workshop__/async.tsx +0 -156
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -137
- package/src/core/components/autocomplete/__workshop__/custom.tsx +0 -89
- package/src/core/components/autocomplete/__workshop__/example.tsx +0 -79
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -36
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +0 -294
- package/src/core/components/autocomplete/__workshop__/index.ts +0 -39
- package/src/core/components/autocomplete/__workshop__/types.ts +0 -4
- package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -39
- package/src/core/components/autocomplete/autocomplete.tsx +0 -767
- package/src/core/components/autocomplete/autocompleteOption.tsx +0 -45
- package/src/core/components/autocomplete/autocompleteReducer.ts +0 -47
- package/src/core/components/autocomplete/constants.ts +0 -28
- package/src/core/components/autocomplete/index.ts +0 -2
- package/src/core/components/autocomplete/types.ts +0 -108
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +0 -62
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -14
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -18
- package/src/core/components/breadcrumbs/breadcrumbs.test.tsx +0 -51
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +0 -133
- package/src/core/components/breadcrumbs/index.ts +0 -1
- package/src/core/components/dialog/__workshop__/activate.tsx +0 -134
- package/src/core/components/dialog/__workshop__/autoFocus.tsx +0 -29
- package/src/core/components/dialog/__workshop__/index.ts +0 -19
- package/src/core/components/dialog/__workshop__/layering.tsx +0 -41
- package/src/core/components/dialog/__workshop__/nested.tsx +0 -72
- package/src/core/components/dialog/__workshop__/onScroll.tsx +0 -39
- package/src/core/components/dialog/__workshop__/panes.tsx +0 -82
- package/src/core/components/dialog/__workshop__/position.tsx +0 -30
- package/src/core/components/dialog/__workshop__/props.tsx +0 -75
- package/src/core/components/dialog/__workshop__/provider.tsx +0 -11
- package/src/core/components/dialog/__workshop__/wrapped.tsx +0 -76
- package/src/core/components/dialog/dialog.tsx +0 -430
- package/src/core/components/dialog/dialogContext.ts +0 -20
- package/src/core/components/dialog/dialogProvider.tsx +0 -35
- package/src/core/components/dialog/index.ts +0 -4
- package/src/core/components/dialog/styles.ts +0 -77
- package/src/core/components/dialog/useDialog.ts +0 -11
- package/src/core/components/hotkeys/__workshop__/index.ts +0 -14
- package/src/core/components/hotkeys/__workshop__/plain.tsx +0 -9
- package/src/core/components/hotkeys/hotkeys.test.tsx +0 -42
- package/src/core/components/hotkeys/hotkeys.tsx +0 -66
- package/src/core/components/hotkeys/index.ts +0 -1
- package/src/core/components/index.ts +0 -9
- package/src/core/components/menu/__workshop__/asComponent.tsx +0 -45
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +0 -51
- package/src/core/components/menu/__workshop__/closableMenuButton.tsx +0 -46
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +0 -134
- package/src/core/components/menu/__workshop__/customMenuItem.tsx +0 -45
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +0 -39
- package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +0 -40
- package/src/core/components/menu/__workshop__/groups.tsx +0 -156
- package/src/core/components/menu/__workshop__/index.ts +0 -89
- package/src/core/components/menu/__workshop__/menuButton.tsx +0 -80
- package/src/core/components/menu/__workshop__/menuGroupRight.tsx +0 -58
- package/src/core/components/menu/__workshop__/nestedMenu.tsx +0 -22
- package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +0 -41
- package/src/core/components/menu/__workshop__/selectedItem.tsx +0 -69
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +0 -47
- package/src/core/components/menu/__workshop__/tones.tsx +0 -25
- package/src/core/components/menu/__workshop__/withoutArrow.tsx +0 -32
- package/src/core/components/menu/helpers.ts +0 -82
- package/src/core/components/menu/index.ts +0 -5
- package/src/core/components/menu/menu.spacing.test.tsx +0 -63
- package/src/core/components/menu/menu.test.tsx +0 -125
- package/src/core/components/menu/menu.tsx +0 -178
- package/src/core/components/menu/menuButton.tsx +0 -268
- package/src/core/components/menu/menuContext.ts +0 -18
- package/src/core/components/menu/menuDivider.ts +0 -23
- package/src/core/components/menu/menuGroup.spacing.test.tsx +0 -63
- package/src/core/components/menu/menuGroup.tsx +0 -233
- package/src/core/components/menu/menuItem.spacing.test.tsx +0 -59
- package/src/core/components/menu/menuItem.tsx +0 -197
- package/src/core/components/menu/useMenu.ts +0 -21
- package/src/core/components/menu/useMenuController.ts +0 -231
- package/src/core/components/skeleton/__workshop__/delay.tsx +0 -70
- package/src/core/components/skeleton/__workshop__/index.ts +0 -11
- package/src/core/components/skeleton/__workshop__/skeleton.tsx +0 -64
- package/src/core/components/skeleton/index.ts +0 -2
- package/src/core/components/skeleton/skeleton.tsx +0 -57
- package/src/core/components/skeleton/styles.ts +0 -50
- package/src/core/components/skeleton/textSkeleton.tsx +0 -122
- package/src/core/components/tab/__workshop__/example.tsx +0 -79
- package/src/core/components/tab/__workshop__/index.ts +0 -14
- package/src/core/components/tab/index.ts +0 -3
- package/src/core/components/tab/tab.tsx +0 -101
- package/src/core/components/tab/tabList.test.tsx +0 -48
- package/src/core/components/tab/tabList.tsx +0 -70
- package/src/core/components/tab/tabPanel.tsx +0 -39
- package/src/core/components/toast/__workshop__/hook.tsx +0 -71
- package/src/core/components/toast/__workshop__/index.ts +0 -19
- package/src/core/components/toast/__workshop__/toast.tsx +0 -26
- package/src/core/components/toast/index.ts +0 -4
- package/src/core/components/toast/styles.ts +0 -77
- package/src/core/components/toast/toast.test.tsx +0 -101
- package/src/core/components/toast/toast.tsx +0 -198
- package/src/core/components/toast/toastContext.ts +0 -7
- package/src/core/components/toast/toastLayer.tsx +0 -51
- package/src/core/components/toast/toastProvider.tsx +0 -113
- package/src/core/components/toast/toastState.ts +0 -6
- package/src/core/components/toast/types.ts +0 -26
- package/src/core/components/toast/useToast.ts +0 -25
- package/src/core/components/tree/__workshop__/basic.perf.ts +0 -19
- package/src/core/components/tree/__workshop__/basic.tsx +0 -105
- package/src/core/components/tree/__workshop__/index.ts +0 -21
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +0 -84
- package/src/core/components/tree/helpers.ts +0 -105
- package/src/core/components/tree/index.ts +0 -4
- package/src/core/components/tree/style.ts +0 -105
- package/src/core/components/tree/tree.test.tsx +0 -55
- package/src/core/components/tree/tree.tsx +0 -240
- package/src/core/components/tree/treeContext.ts +0 -10
- package/src/core/components/tree/treeGroup.tsx +0 -28
- package/src/core/components/tree/treeItem.test.tsx +0 -65
- package/src/core/components/tree/treeItem.tsx +0 -224
- package/src/core/components/tree/types.ts +0 -25
- package/src/core/components/tree/useTree.ts +0 -17
- package/src/core/constants.ts +0 -79
- package/src/core/helpers/animation.ts +0 -27
- package/src/core/helpers/element.ts +0 -55
- package/src/core/helpers/focus.ts +0 -100
- package/src/core/helpers/index.ts +0 -4
- package/src/core/helpers/scroll.ts +0 -15
- package/src/core/hooks/index.ts +0 -12
- package/src/core/hooks/useArrayProp.ts +0 -17
- package/src/core/hooks/useClickOutside.test.tsx +0 -482
- package/src/core/hooks/useClickOutside.ts +0 -118
- package/src/core/hooks/useClickOutsideEvent.test.tsx +0 -115
- package/src/core/hooks/useClickOutsideEvent.ts +0 -73
- package/src/core/hooks/useCustomValidity.ts +0 -13
- package/src/core/hooks/useDelayed.test.ts +0 -88
- package/src/core/hooks/useDelayedState.ts +0 -36
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -32
- package/src/core/hooks/useElementRect/__workshop__/index.ts +0 -14
- package/src/core/hooks/useElementRect/index.ts +0 -1
- package/src/core/hooks/useElementRect/useElementRect.ts +0 -13
- package/src/core/hooks/useElementSize.ts +0 -19
- package/src/core/hooks/useForwardedRef.ts +0 -19
- package/src/core/hooks/useGlobalKeyDown.ts +0 -24
- package/src/core/hooks/useIsomorphicEffect.ts +0 -7
- package/src/core/hooks/useMatchMedia.ts +0 -28
- package/src/core/hooks/useMediaIndex/__workshop__/index.ts +0 -14
- package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +0 -14
- package/src/core/hooks/useMediaIndex/index.ts +0 -1
- package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +0 -36
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +0 -102
- package/src/core/hooks/useMounted.ts +0 -15
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -56
- package/src/core/hooks/usePrefersDark.test.tsx +0 -19
- package/src/core/hooks/usePrefersDark.ts +0 -16
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -56
- package/src/core/hooks/usePrefersReducedMotion.test.tsx +0 -19
- package/src/core/hooks/usePrefersReducedMotion.ts +0 -16
- package/src/core/index.ts +0 -10
- package/src/core/lib/createGlobalScopedContext.ts +0 -36
- package/src/core/lib/globalScope.ts +0 -19
- package/src/core/lib/isRecord.ts +0 -3
- package/src/core/middleware/origin.ts +0 -47
- package/src/core/observers/elementSizeObserver.ts +0 -116
- package/src/core/observers/index.ts +0 -2
- package/src/core/observers/resizeObserver.ts +0 -9
- package/src/core/primitives/_selectable/index.ts +0 -1
- package/src/core/primitives/_selectable/selectable.tsx +0 -15
- package/src/core/primitives/_selectable/style.ts +0 -115
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +0 -14
- package/src/core/primitives/avatar/__workshop__/index.ts +0 -29
- package/src/core/primitives/avatar/__workshop__/stack.tsx +0 -25
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +0 -63
- package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -70
- package/src/core/primitives/avatar/avatar.tsx +0 -200
- package/src/core/primitives/avatar/avatarCounter.tsx +0 -91
- package/src/core/primitives/avatar/avatarStack.tsx +0 -100
- package/src/core/primitives/avatar/index.ts +0 -4
- package/src/core/primitives/avatar/styles.ts +0 -167
- package/src/core/primitives/avatar/types.ts +0 -17
- package/src/core/primitives/badge/__workshop__/index.ts +0 -19
- package/src/core/primitives/badge/__workshop__/props.tsx +0 -30
- package/src/core/primitives/badge/__workshop__/tones.tsx +0 -21
- package/src/core/primitives/badge/badge.test.tsx +0 -16
- package/src/core/primitives/badge/badge.tsx +0 -70
- package/src/core/primitives/badge/index.ts +0 -1
- package/src/core/primitives/badge/styles.ts +0 -20
- package/src/core/primitives/badge/types.ts +0 -8
- package/src/core/primitives/box/__workshop__/asComponent.tsx +0 -31
- package/src/core/primitives/box/__workshop__/index.ts +0 -24
- package/src/core/primitives/box/__workshop__/props.tsx +0 -20
- package/src/core/primitives/box/__workshop__/responsive.tsx +0 -20
- package/src/core/primitives/box/box.test.tsx +0 -142
- package/src/core/primitives/box/box.tsx +0 -154
- package/src/core/primitives/box/index.ts +0 -1
- package/src/core/primitives/button/__workshop__/custom.tsx +0 -51
- package/src/core/primitives/button/__workshop__/customIcons.tsx +0 -30
- package/src/core/primitives/button/__workshop__/disabled.tsx +0 -74
- package/src/core/primitives/button/__workshop__/index.ts +0 -59
- package/src/core/primitives/button/__workshop__/labelUploadButton.tsx +0 -36
- package/src/core/primitives/button/__workshop__/mixedChildren.tsx +0 -12
- package/src/core/primitives/button/__workshop__/props.tsx +0 -55
- package/src/core/primitives/button/__workshop__/stacked.tsx +0 -58
- package/src/core/primitives/button/__workshop__/styled1.tsx +0 -17
- package/src/core/primitives/button/__workshop__/styled2.tsx +0 -19
- package/src/core/primitives/button/__workshop__/uploadButton.tsx +0 -28
- package/src/core/primitives/button/button.test.tsx +0 -82
- package/src/core/primitives/button/button.tsx +0 -210
- package/src/core/primitives/button/index.ts +0 -1
- package/src/core/primitives/button/styles.ts +0 -117
- package/src/core/primitives/card/__workshop__/allTones.tsx +0 -25
- package/src/core/primitives/card/__workshop__/asButton.tsx +0 -107
- package/src/core/primitives/card/__workshop__/asComponent.tsx +0 -27
- package/src/core/primitives/card/__workshop__/checkered.tsx +0 -26
- package/src/core/primitives/card/__workshop__/index.ts +0 -18
- package/src/core/primitives/card/__workshop__/interactive.tsx +0 -30
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +0 -80
- package/src/core/primitives/card/__workshop__/props.tsx +0 -53
- package/src/core/primitives/card/__workshop__/selected.tsx +0 -94
- package/src/core/primitives/card/__workshop__/styled.tsx +0 -14
- package/src/core/primitives/card/card.tsx +0 -128
- package/src/core/primitives/card/index.ts +0 -2
- package/src/core/primitives/card/styles.ts +0 -147
- package/src/core/primitives/card/types.ts +0 -11
- package/src/core/primitives/checkbox/__workshop__/example.tsx +0 -25
- package/src/core/primitives/checkbox/__workshop__/index.ts +0 -13
- package/src/core/primitives/checkbox/__workshop__/props.tsx +0 -33
- package/src/core/primitives/checkbox/__workshop__/readOnly.tsx +0 -16
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +0 -28
- package/src/core/primitives/checkbox/checkbox.tsx +0 -73
- package/src/core/primitives/checkbox/index.ts +0 -1
- package/src/core/primitives/checkbox/styles.ts +0 -128
- package/src/core/primitives/code/__workshop__/index.ts +0 -19
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/code/__workshop__/props.tsx +0 -21
- package/src/core/primitives/code/code.tsx +0 -55
- package/src/core/primitives/code/index.ts +0 -1
- package/src/core/primitives/code/refractor.tsx +0 -20
- package/src/core/primitives/code/styles.ts +0 -77
- package/src/core/primitives/container/__workshop__/example.tsx +0 -20
- package/src/core/primitives/container/__workshop__/index.ts +0 -8
- package/src/core/primitives/container/container.tsx +0 -54
- package/src/core/primitives/container/index.ts +0 -2
- package/src/core/primitives/container/styles.ts +0 -23
- package/src/core/primitives/container/types.ts +0 -6
- package/src/core/primitives/flex/__workshop__/example.tsx +0 -34
- package/src/core/primitives/flex/__workshop__/gap.tsx +0 -25
- package/src/core/primitives/flex/__workshop__/index.ts +0 -11
- package/src/core/primitives/flex/flex.tsx +0 -64
- package/src/core/primitives/flex/index.ts +0 -1
- package/src/core/primitives/grid/__workshop__/index.ts +0 -10
- package/src/core/primitives/grid/__workshop__/responsive.tsx +0 -54
- package/src/core/primitives/grid/grid.test.tsx +0 -80
- package/src/core/primitives/grid/grid.tsx +0 -74
- package/src/core/primitives/grid/index.ts +0 -1
- package/src/core/primitives/heading/__workshop__/index.ts +0 -19
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +0 -54
- package/src/core/primitives/heading/__workshop__/plain.tsx +0 -32
- package/src/core/primitives/heading/heading.tsx +0 -88
- package/src/core/primitives/heading/index.ts +0 -1
- package/src/core/primitives/heading/styles.ts +0 -64
- package/src/core/primitives/heading/types.ts +0 -7
- package/src/core/primitives/index.ts +0 -27
- package/src/core/primitives/inline/__workshop__/index.ts +0 -8
- package/src/core/primitives/inline/__workshop__/plain.tsx +0 -27
- package/src/core/primitives/inline/index.ts +0 -1
- package/src/core/primitives/inline/inline.test.tsx +0 -51
- package/src/core/primitives/inline/inline.tsx +0 -63
- package/src/core/primitives/inline/styles.ts +0 -32
- package/src/core/primitives/inline/types.ts +0 -6
- package/src/core/primitives/kbd/__workshop__/index.ts +0 -8
- package/src/core/primitives/kbd/__workshop__/plain.tsx +0 -9
- package/src/core/primitives/kbd/index.ts +0 -1
- package/src/core/primitives/kbd/kbd.tsx +0 -69
- package/src/core/primitives/label/__workshop__/index.ts +0 -19
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/label/__workshop__/plain.tsx +0 -24
- package/src/core/primitives/label/index.ts +0 -1
- package/src/core/primitives/label/label.tsx +0 -87
- package/src/core/primitives/label/styles.ts +0 -45
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +0 -77
- package/src/core/primitives/popover/__workshop__/MarginsStory.tsx +0 -31
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -32
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +0 -71
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -71
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +0 -89
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +0 -97
- package/src/core/primitives/popover/__workshop__/index.ts +0 -49
- package/src/core/primitives/popover/constants.ts +0 -22
- package/src/core/primitives/popover/floating-ui/size.ts +0 -99
- package/src/core/primitives/popover/helpers.ts +0 -31
- package/src/core/primitives/popover/index.ts +0 -2
- package/src/core/primitives/popover/popover.tsx +0 -511
- package/src/core/primitives/popover/popoverCard.tsx +0 -166
- package/src/core/primitives/popover/types.ts +0 -7
- package/src/core/primitives/radio/__workshop__/example.tsx +0 -63
- package/src/core/primitives/radio/__workshop__/index.ts +0 -11
- package/src/core/primitives/radio/__workshop__/plain.tsx +0 -28
- package/src/core/primitives/radio/index.ts +0 -1
- package/src/core/primitives/radio/radio.tsx +0 -51
- package/src/core/primitives/radio/styles.ts +0 -117
- package/src/core/primitives/select/__workshop__/index.ts +0 -11
- package/src/core/primitives/select/__workshop__/plain.tsx +0 -27
- package/src/core/primitives/select/__workshop__/readOnly.tsx +0 -23
- package/src/core/primitives/select/index.ts +0 -1
- package/src/core/primitives/select/select.test.tsx +0 -52
- package/src/core/primitives/select/select.tsx +0 -94
- package/src/core/primitives/select/styles.ts +0 -166
- package/src/core/primitives/spinner/__workshop__/Props.tsx +0 -15
- package/src/core/primitives/spinner/__workshop__/index.ts +0 -14
- package/src/core/primitives/spinner/index.ts +0 -1
- package/src/core/primitives/spinner/spinner.tsx +0 -46
- package/src/core/primitives/stack/__workshop__/index.ts +0 -14
- package/src/core/primitives/stack/__workshop__/plain.tsx +0 -32
- package/src/core/primitives/stack/index.ts +0 -1
- package/src/core/primitives/stack/stack.test.tsx +0 -57
- package/src/core/primitives/stack/stack.tsx +0 -57
- package/src/core/primitives/stack/styles.ts +0 -32
- package/src/core/primitives/switch/__workshop__/example.tsx +0 -23
- package/src/core/primitives/switch/__workshop__/index.ts +0 -11
- package/src/core/primitives/switch/__workshop__/props.tsx +0 -21
- package/src/core/primitives/switch/index.ts +0 -1
- package/src/core/primitives/switch/styles.ts +0 -173
- package/src/core/primitives/switch/switch.tsx +0 -68
- package/src/core/primitives/text/__workshop__/colored.tsx +0 -30
- package/src/core/primitives/text/__workshop__/example.tsx +0 -39
- package/src/core/primitives/text/__workshop__/index.ts +0 -24
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/text/index.ts +0 -1
- package/src/core/primitives/text/styles.ts +0 -74
- package/src/core/primitives/text/text.tsx +0 -89
- package/src/core/primitives/textArea/__workshop__/index.ts +0 -14
- package/src/core/primitives/textArea/__workshop__/plain.tsx +0 -50
- package/src/core/primitives/textArea/index.ts +0 -1
- package/src/core/primitives/textArea/textArea.tsx +0 -120
- package/src/core/primitives/textInput/__workshop__/clearButton.tsx +0 -30
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +0 -17
- package/src/core/primitives/textInput/__workshop__/index.ts +0 -44
- package/src/core/primitives/textInput/__workshop__/plain.tsx +0 -98
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +0 -9
- package/src/core/primitives/textInput/__workshop__/states.tsx +0 -53
- package/src/core/primitives/textInput/__workshop__/tones.tsx +0 -277
- package/src/core/primitives/textInput/__workshop__/typed.tsx +0 -23
- package/src/core/primitives/textInput/index.ts +0 -1
- package/src/core/primitives/textInput/textInput.test.tsx +0 -48
- package/src/core/primitives/textInput/textInput.tsx +0 -395
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +0 -102
- package/src/core/primitives/tooltip/__workshop__/index.ts +0 -29
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -74
- package/src/core/primitives/tooltip/__workshop__/props.tsx +0 -107
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -86
- package/src/core/primitives/tooltip/constants.ts +0 -23
- package/src/core/primitives/tooltip/index.ts +0 -2
- package/src/core/primitives/tooltip/tooltip.test.tsx +0 -452
- package/src/core/primitives/tooltip/tooltip.tsx +0 -495
- package/src/core/primitives/tooltip/tooltipCard.tsx +0 -109
- package/src/core/primitives/tooltip/tooltipDelayGroup/index.ts +0 -4
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +0 -11
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +0 -57
- package/src/core/primitives/tooltip/tooltipDelayGroup/types.ts +0 -10
- package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +0 -13
- package/src/core/primitives/types.ts +0 -179
- package/src/core/styles/border/borderStyle.ts +0 -56
- package/src/core/styles/border/index.ts +0 -2
- package/src/core/styles/border/types.ts +0 -10
- package/src/core/styles/box/boxStyle.ts +0 -69
- package/src/core/styles/box/index.ts +0 -2
- package/src/core/styles/box/types.ts +0 -11
- package/src/core/styles/card/_cardColorStyle.ts +0 -108
- package/src/core/styles/card/index.ts +0 -1
- package/src/core/styles/flex/flexItemStyle.ts +0 -27
- package/src/core/styles/flex/flexStyle.ts +0 -70
- package/src/core/styles/flex/index.ts +0 -3
- package/src/core/styles/flex/types.ts +0 -25
- package/src/core/styles/focusRing/index.ts +0 -25
- package/src/core/styles/font/codeFontStyle.ts +0 -13
- package/src/core/styles/font/headingFontStyle.ts +0 -13
- package/src/core/styles/font/index.ts +0 -6
- package/src/core/styles/font/labelFontStyle.ts +0 -13
- package/src/core/styles/font/responsiveFont.ts +0 -103
- package/src/core/styles/font/textAlignStyle.ts +0 -19
- package/src/core/styles/font/textFontStyle.ts +0 -13
- package/src/core/styles/font/types.ts +0 -35
- package/src/core/styles/grid/gridItemStyle.ts +0 -82
- package/src/core/styles/grid/gridStyle.ts +0 -108
- package/src/core/styles/grid/index.ts +0 -3
- package/src/core/styles/grid/types.ts +0 -37
- package/src/core/styles/helpers.ts +0 -72
- package/src/core/styles/index.ts +0 -5
- package/src/core/styles/input/index.ts +0 -2
- package/src/core/styles/input/responsiveInputPaddingStyle.ts +0 -78
- package/src/core/styles/input/textInputStyle.ts +0 -263
- package/src/core/styles/internal.ts +0 -12
- package/src/core/styles/margin/index.ts +0 -2
- package/src/core/styles/margin/marginStyle.ts +0 -21
- package/src/core/styles/margin/marginsStyle.test.ts +0 -33
- package/src/core/styles/margin/types.ts +0 -9
- package/src/core/styles/padding/index.ts +0 -2
- package/src/core/styles/padding/paddingStyle.test.ts +0 -33
- package/src/core/styles/padding/paddingStyle.ts +0 -21
- package/src/core/styles/padding/types.ts +0 -12
- package/src/core/styles/radius/index.ts +0 -2
- package/src/core/styles/radius/radiusStyle.ts +0 -23
- package/src/core/styles/radius/types.ts +0 -8
- package/src/core/styles/shadow/index.ts +0 -2
- package/src/core/styles/shadow/shadowStyle.ts +0 -29
- package/src/core/styles/shadow/types.ts +0 -6
- package/src/core/styles/types.ts +0 -8
- package/src/core/theme/__workshop__/build/Root.tsx +0 -367
- package/src/core/theme/__workshop__/build/helpers.ts +0 -46
- package/src/core/theme/__workshop__/build/story.tsx +0 -465
- package/src/core/theme/__workshop__/canvas.tsx +0 -352
- package/src/core/theme/__workshop__/color.tsx +0 -62
- package/src/core/theme/__workshop__/debug/story.tsx +0 -408
- package/src/core/theme/__workshop__/index.ts +0 -39
- package/src/core/theme/__workshop__/layer.tsx +0 -78
- package/src/core/theme/__workshop__/nestedProvider.tsx +0 -15
- package/src/core/theme/index.ts +0 -5
- package/src/core/theme/theme.test.tsx +0 -73
- package/src/core/theme/themeColorProvider.tsx +0 -29
- package/src/core/theme/themeContext.ts +0 -10
- package/src/core/theme/themeProvider.tsx +0 -62
- package/src/core/theme/types.ts +0 -12
- package/src/core/theme/useRootTheme.ts +0 -17
- package/src/core/theme/useTheme.ts +0 -16
- package/src/core/types/avatar.ts +0 -14
- package/src/core/types/badge.ts +0 -12
- package/src/core/types/box.ts +0 -19
- package/src/core/types/button.ts +0 -21
- package/src/core/types/card.ts +0 -6
- package/src/core/types/component.ts +0 -32
- package/src/core/types/dialog.ts +0 -4
- package/src/core/types/flex.ts +0 -30
- package/src/core/types/grid.ts +0 -14
- package/src/core/types/gridItem.ts +0 -29
- package/src/core/types/index.ts +0 -15
- package/src/core/types/placement.ts +0 -18
- package/src/core/types/popover.ts +0 -4
- package/src/core/types/radius.ts +0 -4
- package/src/core/types/selectable.ts +0 -6
- package/src/core/types/text.ts +0 -4
- package/src/core/utils/arrow/arrow.tsx +0 -123
- package/src/core/utils/arrow/cmds.ts +0 -91
- package/src/core/utils/arrow/index.ts +0 -1
- package/src/core/utils/boundaryElement/__workshop__/index.ts +0 -14
- package/src/core/utils/boundaryElement/__workshop__/plain.tsx +0 -19
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -100
- package/src/core/utils/boundaryElement/boundaryElementContext.ts +0 -7
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +0 -24
- package/src/core/utils/boundaryElement/index.ts +0 -3
- package/src/core/utils/boundaryElement/types.ts +0 -7
- package/src/core/utils/boundaryElement/useBoundaryElement.ts +0 -26
- package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +0 -21
- package/src/core/utils/conditionalWrapper/index.ts +0 -1
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +0 -30
- package/src/core/utils/elementQuery/__workshop__/index.ts +0 -14
- package/src/core/utils/elementQuery/elementQuery.tsx +0 -53
- package/src/core/utils/elementQuery/helpers.ts +0 -27
- package/src/core/utils/elementQuery/index.ts +0 -1
- package/src/core/utils/errorBoundary.tsx +0 -48
- package/src/core/utils/getElementRef.ts +0 -26
- package/src/core/utils/index.ts +0 -9
- package/src/core/utils/layer/__workshop__/_debug.tsx +0 -17
- package/src/core/utils/layer/__workshop__/index.ts +0 -24
- package/src/core/utils/layer/__workshop__/multipleRoots.tsx +0 -49
- package/src/core/utils/layer/__workshop__/nested.tsx +0 -98
- package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +0 -13
- package/src/core/utils/layer/getLayerContext.test.ts +0 -30
- package/src/core/utils/layer/getLayerContext.ts +0 -21
- package/src/core/utils/layer/index.ts +0 -4
- package/src/core/utils/layer/layer.test.tsx +0 -108
- package/src/core/utils/layer/layer.tsx +0 -98
- package/src/core/utils/layer/layerContext.ts +0 -7
- package/src/core/utils/layer/layerProvider.tsx +0 -111
- package/src/core/utils/layer/types.ts +0 -9
- package/src/core/utils/layer/useLayer.ts +0 -26
- package/src/core/utils/portal/__workshop__/index.ts +0 -14
- package/src/core/utils/portal/__workshop__/named.tsx +0 -63
- package/src/core/utils/portal/index.ts +0 -4
- package/src/core/utils/portal/portal.test.tsx +0 -103
- package/src/core/utils/portal/portal.ts +0 -32
- package/src/core/utils/portal/portalContext.ts +0 -31
- package/src/core/utils/portal/portalProvider.tsx +0 -47
- package/src/core/utils/portal/types.ts +0 -9
- package/src/core/utils/portal/usePortal.ts +0 -25
- package/src/core/utils/spanWithTextOverflow.tsx +0 -10
- package/src/core/utils/srOnly/index.ts +0 -1
- package/src/core/utils/srOnly/srOnly.tsx +0 -36
- package/src/core/utils/virtualList/__workshop__/changingProps.tsx +0 -36
- package/src/core/utils/virtualList/__workshop__/elementScroll.tsx +0 -24
- package/src/core/utils/virtualList/__workshop__/index.ts +0 -29
- package/src/core/utils/virtualList/__workshop__/infiniteList.tsx +0 -48
- package/src/core/utils/virtualList/__workshop__/windowScrolll.tsx +0 -22
- package/src/core/utils/virtualList/index.ts +0 -1
- package/src/core/utils/virtualList/virtualList.tsx +0 -200
- package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +0 -76
- package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +0 -54
- package/src/theme/build/_deprecated/color/button/createButtonModes.ts +0 -22
- package/src/theme/build/_deprecated/color/button/createButtonTones.ts +0 -55
- package/src/theme/build/_deprecated/color/card/createCardStates.ts +0 -60
- package/src/theme/build/_deprecated/color/color.test.ts +0 -63
- package/src/theme/build/_deprecated/color/defaults.ts +0 -390
- package/src/theme/build/_deprecated/color/factory.ts +0 -142
- package/src/theme/build/_deprecated/color/index.ts +0 -1
- package/src/theme/build/_deprecated/color/input/createInputModes.ts +0 -81
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +0 -54
- package/src/theme/build/_deprecated/color/spot/createSpot.ts +0 -20
- package/src/theme/build/buildColorTheme.test.ts +0 -183
- package/src/theme/build/buildColorTheme.ts +0 -499
- package/src/theme/build/buildTheme.test.ts +0 -87
- package/src/theme/build/buildTheme.ts +0 -36
- package/src/theme/build/colorToken/colorToken.ts +0 -19
- package/src/theme/build/colorToken/compileColorToken.ts +0 -21
- package/src/theme/build/colorToken/index.ts +0 -2
- package/src/theme/build/colorToken/types.ts +0 -6
- package/src/theme/build/index.ts +0 -3
- package/src/theme/build/lib/color-fns/blend/index.ts +0 -3
- package/src/theme/build/lib/color-fns/blend/mix.ts +0 -21
- package/src/theme/build/lib/color-fns/blend/multiply.ts +0 -18
- package/src/theme/build/lib/color-fns/blend/screen.ts +0 -18
- package/src/theme/build/lib/color-fns/color-fns.test.ts +0 -68
- package/src/theme/build/lib/color-fns/contrastRatio.ts +0 -31
- package/src/theme/build/lib/color-fns/convert.ts +0 -150
- package/src/theme/build/lib/color-fns/index.ts +0 -6
- package/src/theme/build/lib/color-fns/parse.ts +0 -60
- package/src/theme/build/lib/color-fns/rgba.ts +0 -10
- package/src/theme/build/lib/color-fns/types.ts +0 -28
- package/src/theme/build/lib/isRecord.ts +0 -3
- package/src/theme/build/lib/lazy.ts +0 -30
- package/src/theme/build/lib/utils.ts +0 -19
- package/src/theme/build/merge.ts +0 -26
- package/src/theme/build/mixThemeColor.test.ts +0 -21
- package/src/theme/build/mixThemeColor.ts +0 -53
- package/src/theme/build/renderColorTheme.ts +0 -532
- package/src/theme/build/renderColorValue.ts +0 -85
- package/src/theme/build/resolveColorTokens.ts +0 -268
- package/src/theme/build/theme.test.ts +0 -27
- package/src/theme/config/helpers.ts +0 -55
- package/src/theme/config/index.ts +0 -4
- package/src/theme/config/system.ts +0 -115
- package/src/theme/config/tokens/color/index.ts +0 -1
- package/src/theme/config/tokens/color/types.ts +0 -133
- package/src/theme/config/tokens/index.ts +0 -4
- package/src/theme/config/tokens/parseTokenKey.test.ts +0 -64
- package/src/theme/config/tokens/parseTokenKey.ts +0 -67
- package/src/theme/config/tokens/parseTokenValue.test.ts +0 -42
- package/src/theme/config/tokens/parseTokenValue.ts +0 -133
- package/src/theme/config/tokens/types.ts +0 -53
- package/src/theme/config/types.ts +0 -46
- package/src/theme/defaults/colorPalette.ts +0 -5
- package/src/theme/defaults/colorTokens.ts +0 -648
- package/src/theme/defaults/config.ts +0 -84
- package/src/theme/defaults/fonts.ts +0 -227
- package/src/theme/getScopedTheme.ts +0 -98
- package/src/theme/index.ts +0 -5
- package/src/theme/system/avatar.ts +0 -14
- package/src/theme/system/color/_constants.ts +0 -45
- package/src/theme/system/color/_helpers.ts +0 -24
- package/src/theme/system/color/_system.ts +0 -40
- package/src/theme/system/color/avatar.ts +0 -15
- package/src/theme/system/color/badge.ts +0 -16
- package/src/theme/system/color/button.ts +0 -17
- package/src/theme/system/color/color.ts +0 -34
- package/src/theme/system/color/index.ts +0 -13
- package/src/theme/system/color/input.ts +0 -25
- package/src/theme/system/color/kbd.ts +0 -8
- package/src/theme/system/color/selectable.ts +0 -12
- package/src/theme/system/color/shadow.ts +0 -7
- package/src/theme/system/color/state.ts +0 -43
- package/src/theme/system/color/syntax.ts +0 -41
- package/src/theme/system/css.ts +0 -14
- package/src/theme/system/focusRing.ts +0 -7
- package/src/theme/system/font.ts +0 -52
- package/src/theme/system/index.ts +0 -11
- package/src/theme/system/input.ts +0 -33
- package/src/theme/system/layer.ts +0 -8
- package/src/theme/system/shadow.ts +0 -19
- package/src/theme/system/styles.ts +0 -13
- package/src/theme/system/theme.ts +0 -138
- package/src/theme/system/v0/avatar.ts +0 -10
- package/src/theme/system/v0/color/_generic.ts +0 -35
- package/src/theme/system/v0/color/_system.ts +0 -17
- package/src/theme/system/v0/color/base.ts +0 -21
- package/src/theme/system/v0/color/button.ts +0 -42
- package/src/theme/system/v0/color/card.ts +0 -19
- package/src/theme/system/v0/color/color.ts +0 -40
- package/src/theme/system/v0/color/index.ts +0 -11
- package/src/theme/system/v0/color/input.ts +0 -34
- package/src/theme/system/v0/color/muted.ts +0 -26
- package/src/theme/system/v0/color/selectable.ts +0 -31
- package/src/theme/system/v0/color/solid.ts +0 -26
- package/src/theme/system/v0/color/spot.ts +0 -13
- package/src/theme/system/v0/index.ts +0 -3
- package/src/theme/system/v0/input.ts +0 -23
- package/src/theme/versioning/getTheme_v2.ts +0 -57
- package/src/theme/versioning/index.ts +0 -5
- package/src/theme/versioning/is_v0.ts +0 -6
- package/src/theme/versioning/is_v2.ts +0 -6
- package/src/theme/versioning/themeColor_v0_v2.ts +0 -243
- package/src/theme/versioning/themeColor_v2_v2_9.ts +0 -49
- package/src/theme/versioning/v0_v2.ts +0 -94
- package/src/theme/versioning/v2_v0.ts +0 -135
|
@@ -0,0 +1,725 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { useForm, useKitServices } from "../context.js";
|
|
3
|
+
import { newKey, pathKey } from "../lib/path.js";
|
|
4
|
+
import { Button } from "../ui/button.js";
|
|
5
|
+
import { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger } from "../ui/overlay.js";
|
|
6
|
+
import { itemNoun } from "../lib/schema.js";
|
|
7
|
+
import { Textarea } from "../ui/input.js";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { IconArrowDown, IconArrowUp, IconCopy, IconDots, IconGripVertical, IconLock, IconPlus, IconTrash } from "@tabler/icons-react";
|
|
11
|
+
import { useReducedMotion } from "framer-motion";
|
|
12
|
+
//#region src/engine/item-list.tsx
|
|
13
|
+
/**
|
|
14
|
+
* ITEM LIST — arrays of one line each (CPO D47): feature lists, bullets, "what's included", key points
|
|
15
|
+
* (V2 HEAD 9829bf1 kit/engine/item-list.tsx).
|
|
16
|
+
* Each item is a row you type into directly: grip · auto-growing input (founder rule: the whole text shows) · ⋯.
|
|
17
|
+
* No drill frame, no expand. Keyboard: Enter adds the next item, Backspace on an empty row removes it, a multi-line
|
|
18
|
+
* paste becomes several items, ⌥↑ / ⌥↓ move the row, ↑ / ↓ at the edges of the text step between rows. None of these
|
|
19
|
+
* keys are printed on screen (D44); they live in aria labels and the ⋯ menu.
|
|
20
|
+
*
|
|
21
|
+
* Works for arrays of primitives (string / text / url / email / number) AND arrays of one-field objects
|
|
22
|
+
* (`[{ _key, text }]`), which read and write that one field and keep their `_key`.
|
|
23
|
+
*
|
|
24
|
+
* Kit deviation: V2 sorts with @dnd-kit, which is not on the kit's package allow-list. `useDragReorder` below is the
|
|
25
|
+
* kit's sortable: pointer drag on the grip (4px activation, siblings slide out of the way like dnd-kit's vertical
|
|
26
|
+
* strategy), and dnd-kit's KeyboardSensor + sortableKeyboardCoordinates on a focused grip: Space / Enter picks the row
|
|
27
|
+
* up, the arrow keys move it (siblings slide, nothing is written yet), Space / Enter / Tab drops it as ONE reorder
|
|
28
|
+
* (one undo step), Escape puts it back. `sort.a11y` is dnd-kit's accessibility markup (hidden instructions + a visually
|
|
29
|
+
* hidden `role="status"` live region), rendered where V2's DndContext rendered it: right after the sortable children.
|
|
30
|
+
*/
|
|
31
|
+
/** V2 controls/text TEXT_FOCUS: a list row's input shows the field focus border only, no ring shadow. */
|
|
32
|
+
var TEXT_FOCUS = "focus:shadow-none focus-visible:shadow-none";
|
|
33
|
+
var EASE = "cubic-bezier(0.22, 1, 0.36, 1)";
|
|
34
|
+
var cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
35
|
+
/** "- Net-30", "• Net-30", "1. Net-30", "[x] Net-30" → "Net-30" */
|
|
36
|
+
var stripBullet = (s) => s.replace(/^\s*(?:[-*•‣◦▪–—]|\d+[.)]|\[[ xX]\])\s+/, "").trim();
|
|
37
|
+
var move = (list, from, to) => {
|
|
38
|
+
const next = list.slice();
|
|
39
|
+
const [it] = next.splice(from, 1);
|
|
40
|
+
next.splice(to, 0, it);
|
|
41
|
+
return next;
|
|
42
|
+
};
|
|
43
|
+
/** dnd-kit's arrayMove, for callers that reorder lists. */
|
|
44
|
+
var arrayMove = move;
|
|
45
|
+
function toValue(kind, text) {
|
|
46
|
+
if (kind === "number") {
|
|
47
|
+
const t = text.trim();
|
|
48
|
+
if (!t) return null;
|
|
49
|
+
const n = Number(t.replace(/,/g, ""));
|
|
50
|
+
return Number.isFinite(n) ? n : void 0;
|
|
51
|
+
}
|
|
52
|
+
return kind === "url" || kind === "email" ? text.trim() : text;
|
|
53
|
+
}
|
|
54
|
+
var AT_REST = { transition: "transform 0ms linear" };
|
|
55
|
+
/** Tiles on the first row of a grid at pick-up (↑ / ↓ jump by this many, like sortableKeyboardCoordinates). */
|
|
56
|
+
var columns = (rects) => {
|
|
57
|
+
const top = rects[0]?.top;
|
|
58
|
+
return top == null ? 1 : Math.max(1, rects.filter((r) => r?.top === top).length);
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Sortable rows by id. `register(id)` goes on the element that moves, `handle(id)` on its grip. Pointer: drag past
|
|
62
|
+
* `distance` px to pick up; the row follows the pointer, siblings slide (list axis by one row, grid into the
|
|
63
|
+
* neighbour's rect), the drop commits ONE reorder.
|
|
64
|
+
* Keyboard on the grip (dnd-kit KeyboardSensor): Space / Enter picks up; ↑ / ↓ (← / → too in a grid, where ↑ / ↓ jump
|
|
65
|
+
* a row of tiles) move it one slot; Space / Enter / Tab drops it as ONE reorder; Escape (or leaving the grip) cancels
|
|
66
|
+
* with nothing written. Focus stays on the grip.
|
|
67
|
+
*/
|
|
68
|
+
function useDragReorder(ids, onReorder, { axis = "y", disabled = false, distance = 4, rest = "dnd" } = {}) {
|
|
69
|
+
const [drag, setDrag] = React.useState(null);
|
|
70
|
+
const [announcement, setOwnAnnouncement] = React.useState("");
|
|
71
|
+
const ownId = React.useId();
|
|
72
|
+
const shared = React.useContext(SharedSortContext);
|
|
73
|
+
const describedBy = shared?.id ?? ownId;
|
|
74
|
+
const setAnnouncement = shared?.announce ?? setOwnAnnouncement;
|
|
75
|
+
const glide = useReducedMotion() ? "none" : `transform 200ms ${EASE}`;
|
|
76
|
+
const els = React.useRef(/* @__PURE__ */ new Map());
|
|
77
|
+
const grips = React.useRef(/* @__PURE__ */ new Map());
|
|
78
|
+
const refocus = React.useRef(null);
|
|
79
|
+
const kb = React.useRef(null);
|
|
80
|
+
const setKb = (s) => {
|
|
81
|
+
kb.current = s;
|
|
82
|
+
setDrag(s);
|
|
83
|
+
};
|
|
84
|
+
const latest = React.useRef({
|
|
85
|
+
ids,
|
|
86
|
+
onReorder
|
|
87
|
+
});
|
|
88
|
+
latest.current = {
|
|
89
|
+
ids,
|
|
90
|
+
onReorder
|
|
91
|
+
};
|
|
92
|
+
React.useLayoutEffect(() => {
|
|
93
|
+
const id = refocus.current;
|
|
94
|
+
if (!id) return;
|
|
95
|
+
refocus.current = null;
|
|
96
|
+
const g = grips.current.get(id);
|
|
97
|
+
if (g && document.activeElement !== g) g.focus();
|
|
98
|
+
});
|
|
99
|
+
const register = (id) => (el) => {
|
|
100
|
+
if (el) els.current.set(id, el);
|
|
101
|
+
else els.current.delete(id);
|
|
102
|
+
};
|
|
103
|
+
const onPointerDown = (id) => (e) => {
|
|
104
|
+
if (disabled || e.button !== 0 || kb.current) return;
|
|
105
|
+
e.stopPropagation();
|
|
106
|
+
const from = latest.current.ids.indexOf(id);
|
|
107
|
+
if (from < 0) return;
|
|
108
|
+
const x0 = e.clientX;
|
|
109
|
+
const y0 = e.clientY;
|
|
110
|
+
let rects = [];
|
|
111
|
+
let state = null;
|
|
112
|
+
const userSelect = document.body.style.userSelect;
|
|
113
|
+
const onMove = (ev) => {
|
|
114
|
+
const dx = ev.clientX - x0;
|
|
115
|
+
const dy = ev.clientY - y0;
|
|
116
|
+
if (!state) {
|
|
117
|
+
if (Math.hypot(dx, dy) < distance) return;
|
|
118
|
+
rects = latest.current.ids.map((k) => els.current.get(k)?.getBoundingClientRect());
|
|
119
|
+
const r = rects[from];
|
|
120
|
+
const next = rects[from + 1] ?? rects[from - 1];
|
|
121
|
+
const gap = r && next ? Math.max(0, next.top > r.top ? next.top - r.bottom : r.top - next.bottom) : 0;
|
|
122
|
+
state = {
|
|
123
|
+
id,
|
|
124
|
+
from,
|
|
125
|
+
over: from,
|
|
126
|
+
dx,
|
|
127
|
+
dy,
|
|
128
|
+
shift: (r?.height ?? 0) + gap,
|
|
129
|
+
rects
|
|
130
|
+
};
|
|
131
|
+
document.body.style.userSelect = "none";
|
|
132
|
+
setAnnouncement(`Picked up item ${from + 1} of ${latest.current.ids.length}.`);
|
|
133
|
+
}
|
|
134
|
+
const hit = rects.findIndex((r) => r && ev.clientY >= r.top && ev.clientY <= r.bottom && (axis === "y" || ev.clientX >= r.left && ev.clientX <= r.right));
|
|
135
|
+
state = {
|
|
136
|
+
...state,
|
|
137
|
+
dx,
|
|
138
|
+
dy,
|
|
139
|
+
over: hit >= 0 ? hit : state.over
|
|
140
|
+
};
|
|
141
|
+
setDrag(state);
|
|
142
|
+
};
|
|
143
|
+
const end = (commit) => {
|
|
144
|
+
window.removeEventListener("pointermove", onMove);
|
|
145
|
+
window.removeEventListener("pointerup", onUp);
|
|
146
|
+
window.removeEventListener("pointercancel", onCancel);
|
|
147
|
+
document.body.style.userSelect = userSelect;
|
|
148
|
+
const s = state;
|
|
149
|
+
setDrag(null);
|
|
150
|
+
if (!s) return;
|
|
151
|
+
const swallow = (ce) => {
|
|
152
|
+
ce.stopPropagation();
|
|
153
|
+
ce.preventDefault();
|
|
154
|
+
};
|
|
155
|
+
window.addEventListener("click", swallow, {
|
|
156
|
+
capture: true,
|
|
157
|
+
once: true
|
|
158
|
+
});
|
|
159
|
+
window.setTimeout(() => window.removeEventListener("click", swallow, { capture: true }), 0);
|
|
160
|
+
if (commit && s.over !== s.from) latest.current.onReorder(s.from, s.over);
|
|
161
|
+
setAnnouncement(commit ? `Item dropped at position ${s.over + 1} of ${latest.current.ids.length}.` : `Dragging was cancelled. Item ${s.from + 1} was dropped.`);
|
|
162
|
+
};
|
|
163
|
+
const onUp = () => end(true);
|
|
164
|
+
const onCancel = () => end(false);
|
|
165
|
+
window.addEventListener("pointermove", onMove);
|
|
166
|
+
window.addEventListener("pointerup", onUp);
|
|
167
|
+
window.addEventListener("pointercancel", onCancel);
|
|
168
|
+
};
|
|
169
|
+
/** where the picked-up row sits over slot `over` (the sortable strategies' target rect) */
|
|
170
|
+
const offset = (s, over) => {
|
|
171
|
+
const a = s.rects[s.from];
|
|
172
|
+
const b = s.rects[over];
|
|
173
|
+
if (!a || !b || over === s.from) return {
|
|
174
|
+
dx: 0,
|
|
175
|
+
dy: 0
|
|
176
|
+
};
|
|
177
|
+
if (axis === "grid") return {
|
|
178
|
+
dx: b.left - a.left,
|
|
179
|
+
dy: b.top - a.top
|
|
180
|
+
};
|
|
181
|
+
return {
|
|
182
|
+
dx: 0,
|
|
183
|
+
dy: over > s.from ? b.bottom - a.bottom : b.top - a.top
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
const onKeyDown = (id) => (e) => {
|
|
187
|
+
if (disabled || e.nativeEvent.isComposing) return;
|
|
188
|
+
const { ids: list, onReorder: commit } = latest.current;
|
|
189
|
+
const n = list.length;
|
|
190
|
+
const s = kb.current;
|
|
191
|
+
if (!s) {
|
|
192
|
+
if (e.key !== " " && e.key !== "Enter") return;
|
|
193
|
+
const from = list.indexOf(id);
|
|
194
|
+
if (from < 0 || drag) return;
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
e.stopPropagation();
|
|
197
|
+
const rects = list.map((k) => els.current.get(k)?.getBoundingClientRect());
|
|
198
|
+
const r = rects[from];
|
|
199
|
+
const next = rects[from + 1] ?? rects[from - 1];
|
|
200
|
+
const gap = r && next ? Math.max(0, next.top > r.top ? next.top - r.bottom : r.top - next.bottom) : 0;
|
|
201
|
+
setKb({
|
|
202
|
+
id,
|
|
203
|
+
from,
|
|
204
|
+
over: from,
|
|
205
|
+
dx: 0,
|
|
206
|
+
dy: 0,
|
|
207
|
+
shift: (r?.height ?? 0) + gap,
|
|
208
|
+
rects,
|
|
209
|
+
keyboard: true
|
|
210
|
+
});
|
|
211
|
+
setAnnouncement(`Picked up item ${from + 1} of ${n}.`);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (s.id !== id) return;
|
|
215
|
+
if (e.key === " " || e.key === "Enter" || e.key === "Tab") {
|
|
216
|
+
if (e.key !== "Tab") {
|
|
217
|
+
e.preventDefault();
|
|
218
|
+
refocus.current = id;
|
|
219
|
+
}
|
|
220
|
+
e.stopPropagation();
|
|
221
|
+
setKb(null);
|
|
222
|
+
if (list[s.from] !== id) return setAnnouncement(`The list changed while moving. Item ${s.from + 1} was not moved.`);
|
|
223
|
+
if (s.over !== s.from) commit(s.from, s.over);
|
|
224
|
+
setAnnouncement(`Item dropped at position ${s.over + 1} of ${n}.`);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (e.key === "Escape") {
|
|
228
|
+
e.preventDefault();
|
|
229
|
+
e.stopPropagation();
|
|
230
|
+
refocus.current = id;
|
|
231
|
+
setKb(null);
|
|
232
|
+
setAnnouncement(`Dragging was cancelled. Item ${s.from + 1} was dropped.`);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const rowStep = axis === "grid" ? columns(s.rects) : 1;
|
|
236
|
+
const step = e.key === "ArrowDown" ? rowStep : e.key === "ArrowUp" ? -rowStep : axis === "grid" && e.key === "ArrowRight" ? 1 : axis === "grid" && e.key === "ArrowLeft" ? -1 : 0;
|
|
237
|
+
if (!step) return;
|
|
238
|
+
e.preventDefault();
|
|
239
|
+
e.stopPropagation();
|
|
240
|
+
const to = s.over + step;
|
|
241
|
+
if (to < 0 || to >= n) return;
|
|
242
|
+
setKb({
|
|
243
|
+
...s,
|
|
244
|
+
over: to,
|
|
245
|
+
...offset(s, to)
|
|
246
|
+
});
|
|
247
|
+
setAnnouncement(`Item moved to position ${to + 1} of ${n}.`);
|
|
248
|
+
};
|
|
249
|
+
const onBlur = (id) => () => {
|
|
250
|
+
const s = kb.current;
|
|
251
|
+
if (!s || s.id !== id) return;
|
|
252
|
+
setKb(null);
|
|
253
|
+
setAnnouncement(`Dragging was cancelled. Item ${s.from + 1} was dropped.`);
|
|
254
|
+
};
|
|
255
|
+
const handle = (id) => ({
|
|
256
|
+
ref: (el) => {
|
|
257
|
+
if (el) grips.current.set(id, el);
|
|
258
|
+
else grips.current.delete(id);
|
|
259
|
+
},
|
|
260
|
+
onPointerDown: onPointerDown(id),
|
|
261
|
+
onKeyDown: onKeyDown(id),
|
|
262
|
+
onBlur: onBlur(id),
|
|
263
|
+
role: "button",
|
|
264
|
+
"aria-pressed": drag?.id === id ? true : void 0,
|
|
265
|
+
"aria-roledescription": "sortable",
|
|
266
|
+
"aria-describedby": describedBy,
|
|
267
|
+
"data-drag-handle": id
|
|
268
|
+
});
|
|
269
|
+
const style = (id) => {
|
|
270
|
+
if (!drag) return rest === "dnd" ? AT_REST : void 0;
|
|
271
|
+
if (id === drag.id) return {
|
|
272
|
+
transform: `translate3d(${axis === "grid" ? drag.dx : 0}px, ${drag.dy}px, 0)`,
|
|
273
|
+
zIndex: 10,
|
|
274
|
+
position: "relative",
|
|
275
|
+
transition: drag.keyboard ? glide : "none"
|
|
276
|
+
};
|
|
277
|
+
const i = ids.indexOf(id);
|
|
278
|
+
const { from, over, shift } = drag;
|
|
279
|
+
if (axis === "grid") {
|
|
280
|
+
const to = from < over && i > from && i <= over ? i - 1 : from > over && i >= over && i < from ? i + 1 : i;
|
|
281
|
+
const a = drag.rects[i];
|
|
282
|
+
const b = drag.rects[to];
|
|
283
|
+
return {
|
|
284
|
+
transform: to !== i && a && b ? `translate3d(${b.left - a.left}px, ${b.top - a.top}px, 0)` : void 0,
|
|
285
|
+
transition: glide
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
const dy = from < over && i > from && i <= over ? -shift : from > over && i >= over && i < from ? shift : 0;
|
|
289
|
+
return {
|
|
290
|
+
transform: dy ? `translate3d(0, ${dy}px, 0)` : void 0,
|
|
291
|
+
transition: glide
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
const a11y = shared ? null : /* @__PURE__ */ jsx(SortAnnouncer, {
|
|
295
|
+
id: describedBy,
|
|
296
|
+
announcement
|
|
297
|
+
});
|
|
298
|
+
return {
|
|
299
|
+
register,
|
|
300
|
+
handle,
|
|
301
|
+
style,
|
|
302
|
+
active: drag?.id ?? null,
|
|
303
|
+
over: drag ? ids[drag.over] ?? null : null,
|
|
304
|
+
a11y
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
var SharedSortContext = React.createContext(null);
|
|
308
|
+
/**
|
|
309
|
+
* One announcer for several sortable lists, as V2 has where ONE DndContext wraps them (a table's row groups): the
|
|
310
|
+
* lists under `SharedSortProvider value={value}` describe their grips with its instructions and announce into its live region, and `a11y`
|
|
311
|
+
* renders once where V2's DndContext rendered it (after its children).
|
|
312
|
+
*/
|
|
313
|
+
function useSharedSort() {
|
|
314
|
+
const [announcement, setAnnouncement] = React.useState("");
|
|
315
|
+
const id = React.useId();
|
|
316
|
+
return {
|
|
317
|
+
value: React.useMemo(() => ({
|
|
318
|
+
id,
|
|
319
|
+
announce: setAnnouncement
|
|
320
|
+
}), [id]),
|
|
321
|
+
a11y: /* @__PURE__ */ jsx(SortAnnouncer, {
|
|
322
|
+
id,
|
|
323
|
+
announcement
|
|
324
|
+
})
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
var SharedSortProvider = SharedSortContext.Provider;
|
|
328
|
+
var LIVE_REGION = {
|
|
329
|
+
position: "fixed",
|
|
330
|
+
top: 0,
|
|
331
|
+
left: 0,
|
|
332
|
+
width: 1,
|
|
333
|
+
height: 1,
|
|
334
|
+
margin: -1,
|
|
335
|
+
border: 0,
|
|
336
|
+
padding: 0,
|
|
337
|
+
overflow: "hidden",
|
|
338
|
+
clip: "rect(0 0 0 0)",
|
|
339
|
+
clipPath: "inset(100%)",
|
|
340
|
+
whiteSpace: "nowrap"
|
|
341
|
+
};
|
|
342
|
+
/**
|
|
343
|
+
* dnd-kit's <Accessibility> (V2 got it from every DndContext): the drag instructions (display: none, named by each
|
|
344
|
+
* handle's aria-describedby) and an assertive `role="status"` live region with the last move. Like dnd-kit it renders
|
|
345
|
+
* only after mount.
|
|
346
|
+
*/
|
|
347
|
+
function SortAnnouncer({ id, announcement }) {
|
|
348
|
+
const [mounted, setMounted] = React.useState(false);
|
|
349
|
+
React.useEffect(() => setMounted(true), []);
|
|
350
|
+
if (!mounted) return null;
|
|
351
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
352
|
+
id,
|
|
353
|
+
style: { display: "none" },
|
|
354
|
+
children: "To pick up a draggable item, press the space bar or enter. While dragging, use the arrow keys to move the item. Press space or enter again to drop the item in its new position, or press escape to cancel."
|
|
355
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
356
|
+
style: LIVE_REGION,
|
|
357
|
+
role: "status",
|
|
358
|
+
"aria-live": "assertive",
|
|
359
|
+
"aria-atomic": true,
|
|
360
|
+
children: announcement
|
|
361
|
+
})] });
|
|
362
|
+
}
|
|
363
|
+
/** Keys for list items that have none (primitives): stable across our own edits, regenerated on outside changes. */
|
|
364
|
+
function useRowKeys(list, keyOf) {
|
|
365
|
+
const local = React.useRef([]);
|
|
366
|
+
if (keyOf) return {
|
|
367
|
+
keys: list.map((it, i) => keyOf(it) ?? `i${i}`),
|
|
368
|
+
set: (_) => {}
|
|
369
|
+
};
|
|
370
|
+
if (local.current.length !== list.length) {
|
|
371
|
+
const next = local.current.slice(0, list.length);
|
|
372
|
+
while (next.length < list.length) next.push(newKey());
|
|
373
|
+
local.current = next;
|
|
374
|
+
}
|
|
375
|
+
return {
|
|
376
|
+
keys: local.current,
|
|
377
|
+
set: (k) => local.current = k
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
function ItemList({ field, path, list, readOnly, adapter, inputId }) {
|
|
381
|
+
const form = useForm();
|
|
382
|
+
const { toast } = useKitServices();
|
|
383
|
+
const { min, max } = field.validation ?? {};
|
|
384
|
+
const noun = itemNoun(field);
|
|
385
|
+
const { keys, set: setKeys } = useRowKeys(list, adapter.keyOf);
|
|
386
|
+
const inputs = React.useRef(/* @__PURE__ */ new Map());
|
|
387
|
+
const addRef = React.useRef(null);
|
|
388
|
+
const focusReq = React.useRef(null);
|
|
389
|
+
const atMax = max != null && list.length >= max;
|
|
390
|
+
const atMin = min != null && list.length <= min;
|
|
391
|
+
React.useLayoutEffect(() => {
|
|
392
|
+
const req = focusReq.current;
|
|
393
|
+
if (!req) return;
|
|
394
|
+
const el = inputs.current.get(req.key);
|
|
395
|
+
if (!el) return;
|
|
396
|
+
focusReq.current = null;
|
|
397
|
+
el.focus({ preventScroll: false });
|
|
398
|
+
const at = req.caret === "start" ? 0 : req.caret === "end" ? el.value.length : Math.min(req.caret, el.value.length);
|
|
399
|
+
el.setSelectionRange(at, at);
|
|
400
|
+
el.scrollIntoView?.({ block: "nearest" });
|
|
401
|
+
});
|
|
402
|
+
const commit = (next, nextKeys) => {
|
|
403
|
+
setKeys(nextKeys);
|
|
404
|
+
form.setAt(path, next);
|
|
405
|
+
};
|
|
406
|
+
const limitToast = () => toast?.("Limit reached", { description: `${field.title} allows ${max} at most.` });
|
|
407
|
+
/** Insert `values` after row i (and optionally replace row i itself in the same write). */
|
|
408
|
+
const insertAfter = (i, values, caret = "end", current) => {
|
|
409
|
+
const room = max == null ? values.length : Math.max(0, max - list.length);
|
|
410
|
+
if (room === 0) return limitToast();
|
|
411
|
+
const take = values.slice(0, room);
|
|
412
|
+
if (take.length < values.length) toast?.("Some lines were left out", { description: `${field.title} allows ${max} at most, so ${values.length - take.length} didn't fit.` });
|
|
413
|
+
const items = take.map((v) => adapter.write(v));
|
|
414
|
+
const newKeys = items.map((it) => adapter.keyOf?.(it) ?? newKey());
|
|
415
|
+
const head = current === void 0 ? list.slice(0, i + 1) : [...list.slice(0, i), current];
|
|
416
|
+
commit([
|
|
417
|
+
...head,
|
|
418
|
+
...items,
|
|
419
|
+
...list.slice(i + 1)
|
|
420
|
+
], [
|
|
421
|
+
...keys.slice(0, i + 1),
|
|
422
|
+
...newKeys,
|
|
423
|
+
...keys.slice(i + 1)
|
|
424
|
+
]);
|
|
425
|
+
focusReq.current = {
|
|
426
|
+
key: newKeys[newKeys.length - 1],
|
|
427
|
+
caret
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
const add = () => {
|
|
431
|
+
if (atMax) return limitToast();
|
|
432
|
+
insertAfter(list.length - 1, [adapter.kind === "number" ? null : ""]);
|
|
433
|
+
};
|
|
434
|
+
const removeAt = (i, opts = {}) => {
|
|
435
|
+
if (atMin) return toast?.(`At least ${min} required`, { description: `${field.title} needs ${min} or more.` });
|
|
436
|
+
const prevList = list;
|
|
437
|
+
const prevKeys = keys;
|
|
438
|
+
commit(list.filter((_, j) => j !== i), keys.filter((_, j) => j !== i));
|
|
439
|
+
if (opts.focus !== "none") {
|
|
440
|
+
const target = i > 0 ? keys[i - 1] : keys[i + 1];
|
|
441
|
+
if (target) focusReq.current = {
|
|
442
|
+
key: target,
|
|
443
|
+
caret: i > 0 ? "end" : "start"
|
|
444
|
+
};
|
|
445
|
+
else window.setTimeout(() => addRef.current?.focus(), 0);
|
|
446
|
+
}
|
|
447
|
+
if (opts.undo) {
|
|
448
|
+
const text = adapter.read(prevList[i]);
|
|
449
|
+
toast?.(text ? `“${text.length > 40 ? `${text.slice(0, 38)}…` : text}” removed` : `${cap(noun)} removed`, {
|
|
450
|
+
action: {
|
|
451
|
+
label: "Undo",
|
|
452
|
+
onClick: () => commit(prevList, prevKeys)
|
|
453
|
+
},
|
|
454
|
+
duration: 1e4
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
const moveRow = (i, d, keepFocus = false) => {
|
|
459
|
+
const to = i + d;
|
|
460
|
+
if (to < 0 || to >= list.length) return;
|
|
461
|
+
const caret = inputs.current.get(keys[i])?.selectionStart ?? "end";
|
|
462
|
+
commit(move(list, i, to), move(keys, i, to));
|
|
463
|
+
if (keepFocus) focusReq.current = {
|
|
464
|
+
key: keys[i],
|
|
465
|
+
caret
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
const duplicate = (i) => {
|
|
469
|
+
if (atMax) return limitToast();
|
|
470
|
+
insertAfter(i, [toValue(adapter.kind, adapter.read(list[i])) ?? adapter.read(list[i])]);
|
|
471
|
+
};
|
|
472
|
+
const focusRow = (i, caret) => {
|
|
473
|
+
const el = inputs.current.get(keys[i]);
|
|
474
|
+
if (!el) return;
|
|
475
|
+
el.focus();
|
|
476
|
+
const at = caret === "start" ? 0 : el.value.length;
|
|
477
|
+
el.setSelectionRange(at, at);
|
|
478
|
+
};
|
|
479
|
+
const orderLocked = !!field.orderLocked;
|
|
480
|
+
const sort = useDragReorder(keys, (from, to) => commit(move(list, from, to), move(keys, from, to)), {
|
|
481
|
+
disabled: readOnly || orderLocked,
|
|
482
|
+
rest: "none"
|
|
483
|
+
});
|
|
484
|
+
const n = list.length;
|
|
485
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
486
|
+
className: "flex flex-col gap-1.5",
|
|
487
|
+
children: [n ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("ul", {
|
|
488
|
+
className: "flex flex-col gap-1.5",
|
|
489
|
+
"aria-label": field.title,
|
|
490
|
+
children: list.map((item, i) => /* @__PURE__ */ jsx(ItemRow, {
|
|
491
|
+
rowKey: keys[i],
|
|
492
|
+
sort,
|
|
493
|
+
index: i,
|
|
494
|
+
count: n,
|
|
495
|
+
noun,
|
|
496
|
+
item,
|
|
497
|
+
adapter,
|
|
498
|
+
readOnly,
|
|
499
|
+
orderLocked,
|
|
500
|
+
fieldKey: pathKey([...path, ...adapter.valuePath(i)]),
|
|
501
|
+
invalid: !!form.visibleIssue(pathKey([...path, ...adapter.valuePath(i)])),
|
|
502
|
+
inputId: i === 0 ? inputId : void 0,
|
|
503
|
+
canAdd: !atMax,
|
|
504
|
+
canRemove: !atMin,
|
|
505
|
+
min,
|
|
506
|
+
register: (el) => el ? inputs.current.set(keys[i], el) : inputs.current.delete(keys[i]),
|
|
507
|
+
onChange: (v) => form.setAt([...path, i], adapter.write(v, item)),
|
|
508
|
+
onBlur: () => form.touch(pathKey([...path, ...adapter.valuePath(i)])),
|
|
509
|
+
onEnter: (caretAtStart) => {
|
|
510
|
+
if (!adapter.read(item).trim() && i === n - 1) return;
|
|
511
|
+
if (atMax) return limitToast();
|
|
512
|
+
if (caretAtStart && adapter.read(item)) {
|
|
513
|
+
const k = adapter.write(adapter.kind === "number" ? null : "");
|
|
514
|
+
const nk = adapter.keyOf?.(k) ?? newKey();
|
|
515
|
+
commit([
|
|
516
|
+
...list.slice(0, i),
|
|
517
|
+
k,
|
|
518
|
+
...list.slice(i)
|
|
519
|
+
], [
|
|
520
|
+
...keys.slice(0, i),
|
|
521
|
+
nk,
|
|
522
|
+
...keys.slice(i)
|
|
523
|
+
]);
|
|
524
|
+
focusReq.current = {
|
|
525
|
+
key: keys[i],
|
|
526
|
+
caret: "start"
|
|
527
|
+
};
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
insertAfter(i, [adapter.kind === "number" ? null : ""]);
|
|
531
|
+
},
|
|
532
|
+
onBackspaceEmpty: () => removeAt(i, { focus: "prev" }),
|
|
533
|
+
onPasteLines: (first, rest, caret) => {
|
|
534
|
+
const items = rest.map((t) => toValue(adapter.kind, t)).filter((v) => v !== void 0);
|
|
535
|
+
const current = adapter.write(toValue(adapter.kind, first) ?? first, item);
|
|
536
|
+
if (items.length && !atMax) insertAfter(i, items, "end", current);
|
|
537
|
+
else {
|
|
538
|
+
if (items.length) limitToast();
|
|
539
|
+
form.setAt([...path, i], current);
|
|
540
|
+
focusReq.current = {
|
|
541
|
+
key: keys[i],
|
|
542
|
+
caret
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
onMove: (d) => moveRow(i, d, true),
|
|
547
|
+
onStep: (d) => {
|
|
548
|
+
const j = i + d;
|
|
549
|
+
if (j >= 0 && j < n) focusRow(j, d < 0 ? "end" : "start");
|
|
550
|
+
},
|
|
551
|
+
onDuplicate: () => duplicate(i),
|
|
552
|
+
onRemove: () => removeAt(i, { undo: true }),
|
|
553
|
+
onMenuMove: (d) => moveRow(i, d)
|
|
554
|
+
}, keys[i]))
|
|
555
|
+
}), sort.a11y] }) : null, readOnly ? n ? null : /* @__PURE__ */ jsx("span", {
|
|
556
|
+
className: "text-kit-sm text-kit-fg-3",
|
|
557
|
+
children: "Nothing here yet."
|
|
558
|
+
}) : /* @__PURE__ */ jsxs(Button, {
|
|
559
|
+
ref: addRef,
|
|
560
|
+
size: "sm",
|
|
561
|
+
variant: "ghost",
|
|
562
|
+
className: "-ml-1 self-start text-kit-fg-2",
|
|
563
|
+
leftIcon: /* @__PURE__ */ jsx(IconPlus, { stroke: 1.5 }),
|
|
564
|
+
disabled: atMax,
|
|
565
|
+
onClick: add,
|
|
566
|
+
children: ["Add ", noun]
|
|
567
|
+
})]
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
function ItemRow({ rowKey, sort, index, count, noun, item, adapter, readOnly, orderLocked, fieldKey, invalid, inputId, canAdd, canRemove, min, register, onChange, onBlur, onEnter, onBackspaceEmpty, onPasteLines, onMove, onStep, onDuplicate, onRemove, onMenuMove }) {
|
|
571
|
+
const isDragging = sort.active === rowKey;
|
|
572
|
+
const text = adapter.read(item);
|
|
573
|
+
const [draft, setDraft] = React.useState(null);
|
|
574
|
+
const shown = draft ?? text;
|
|
575
|
+
const label = `${cap(noun)} ${index + 1} of ${count}`;
|
|
576
|
+
const name = text ? `“${text.length > 32 ? `${text.slice(0, 30)}…` : text}”` : `${noun} ${index + 1}`;
|
|
577
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
578
|
+
ref: sort.register(rowKey),
|
|
579
|
+
style: sort.style(rowKey),
|
|
580
|
+
"data-field-key": fieldKey,
|
|
581
|
+
className: cn("group/il relative flex items-start gap-1", isDragging && "z-10 rounded-kit-md bg-kit-surface shadow-kit-lg"),
|
|
582
|
+
children: [
|
|
583
|
+
readOnly ? null : orderLocked ? /* @__PURE__ */ jsx(OrderLockSlot, { className: "mt-1.5" }) : /* @__PURE__ */ jsx("button", {
|
|
584
|
+
type: "button",
|
|
585
|
+
"aria-label": `Reorder ${name}`,
|
|
586
|
+
...sort.handle(rowKey),
|
|
587
|
+
className: "relative mt-1.5 flex h-5 w-4 shrink-0 cursor-grab touch-none items-center justify-center rounded-kit-sm text-kit-fg-4 transition-colors before:absolute before:-inset-1.5 hover:text-kit-fg-2 active:cursor-grabbing",
|
|
588
|
+
children: /* @__PURE__ */ jsx(IconGripVertical, {
|
|
589
|
+
className: "size-3.5",
|
|
590
|
+
stroke: 1.5
|
|
591
|
+
})
|
|
592
|
+
}),
|
|
593
|
+
/* @__PURE__ */ jsx("div", {
|
|
594
|
+
className: "min-w-0 flex-1",
|
|
595
|
+
children: /* @__PURE__ */ jsx(Textarea, {
|
|
596
|
+
ref: register,
|
|
597
|
+
id: inputId,
|
|
598
|
+
rows: 1,
|
|
599
|
+
value: shown,
|
|
600
|
+
readOnly,
|
|
601
|
+
"aria-label": label,
|
|
602
|
+
"aria-invalid": invalid || void 0,
|
|
603
|
+
placeholder: adapter.placeholder ?? cap(noun),
|
|
604
|
+
inputMode: adapter.kind === "number" ? "decimal" : adapter.kind === "url" ? "url" : adapter.kind === "email" ? "email" : void 0,
|
|
605
|
+
spellCheck: adapter.kind === "text",
|
|
606
|
+
onBlur: () => {
|
|
607
|
+
setDraft(null);
|
|
608
|
+
onBlur();
|
|
609
|
+
},
|
|
610
|
+
onChange: (e) => {
|
|
611
|
+
const raw = e.target.value.replace(/\r?\n/g, " ");
|
|
612
|
+
if (adapter.kind === "number") {
|
|
613
|
+
setDraft(raw);
|
|
614
|
+
const v = toValue("number", raw);
|
|
615
|
+
if (v !== void 0) onChange(v);
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
onChange(toValue(adapter.kind, raw));
|
|
619
|
+
},
|
|
620
|
+
onPaste: (e) => {
|
|
621
|
+
if (readOnly) return;
|
|
622
|
+
const clip = e.clipboardData.getData("text/plain");
|
|
623
|
+
if (!/\r?\n/.test(clip.trim())) return;
|
|
624
|
+
const lines = clip.split(/\r?\n/).map(stripBullet).filter(Boolean);
|
|
625
|
+
if (lines.length < 2) return;
|
|
626
|
+
e.preventDefault();
|
|
627
|
+
const el = e.currentTarget;
|
|
628
|
+
const before = el.value.slice(0, el.selectionStart);
|
|
629
|
+
const after = el.value.slice(el.selectionEnd);
|
|
630
|
+
const rest = lines.slice(1);
|
|
631
|
+
rest[rest.length - 1] = `${rest[rest.length - 1]}${after}`;
|
|
632
|
+
onPasteLines(`${before}${lines[0]}`, rest, before.length + lines[0].length);
|
|
633
|
+
},
|
|
634
|
+
onKeyDown: (e) => {
|
|
635
|
+
if (readOnly || e.nativeEvent.isComposing) return;
|
|
636
|
+
const el = e.currentTarget;
|
|
637
|
+
const atStart = el.selectionStart === 0 && el.selectionEnd === 0;
|
|
638
|
+
const atEnd = el.selectionStart === el.value.length && el.selectionEnd === el.value.length;
|
|
639
|
+
if (e.key === "Enter" && !e.shiftKey && !e.metaKey && !e.ctrlKey) {
|
|
640
|
+
e.preventDefault();
|
|
641
|
+
onEnter(atStart && el.value.length > 0);
|
|
642
|
+
} else if (e.key === "Backspace" && !el.value && canRemove) {
|
|
643
|
+
e.preventDefault();
|
|
644
|
+
onBackspaceEmpty();
|
|
645
|
+
} else if (e.altKey && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
646
|
+
e.preventDefault();
|
|
647
|
+
if (!orderLocked) onMove(e.key === "ArrowUp" ? -1 : 1);
|
|
648
|
+
} else if (e.key === "ArrowUp" && atStart && !e.shiftKey) {
|
|
649
|
+
if (index > 0) {
|
|
650
|
+
e.preventDefault();
|
|
651
|
+
onStep(-1);
|
|
652
|
+
}
|
|
653
|
+
} else if (e.key === "ArrowDown" && atEnd && !e.shiftKey) {
|
|
654
|
+
if (index < count - 1) {
|
|
655
|
+
e.preventDefault();
|
|
656
|
+
onStep(1);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
className: cn(TEXT_FOCUS, "min-h-8 py-1.5 leading-5")
|
|
661
|
+
})
|
|
662
|
+
}),
|
|
663
|
+
readOnly ? null : /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
664
|
+
"aria-label": `${cap(noun)} ${index + 1} actions`,
|
|
665
|
+
className: "mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-kit-md text-kit-fg-4 transition-colors hover:bg-kit-hover hover:text-kit-fg group-focus-within/il:text-kit-fg-3 group-hover/il:text-kit-fg-3 data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg",
|
|
666
|
+
children: /* @__PURE__ */ jsx(IconDots, {
|
|
667
|
+
className: "size-4",
|
|
668
|
+
stroke: 1.5
|
|
669
|
+
})
|
|
670
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
671
|
+
align: "end",
|
|
672
|
+
className: "w-48",
|
|
673
|
+
children: [
|
|
674
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
675
|
+
icon: /* @__PURE__ */ jsx(IconCopy, { stroke: 1.5 }),
|
|
676
|
+
disabled: !canAdd,
|
|
677
|
+
onClick: onDuplicate,
|
|
678
|
+
children: canAdd ? "Duplicate" : "Duplicate · limit reached"
|
|
679
|
+
}),
|
|
680
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
681
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
682
|
+
icon: /* @__PURE__ */ jsx(IconArrowUp, { stroke: 1.5 }),
|
|
683
|
+
disabled: orderLocked || index === 0,
|
|
684
|
+
shortcut: "⌥↑",
|
|
685
|
+
onClick: () => onMenuMove(-1),
|
|
686
|
+
children: "Move up"
|
|
687
|
+
}),
|
|
688
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
689
|
+
icon: /* @__PURE__ */ jsx(IconArrowDown, { stroke: 1.5 }),
|
|
690
|
+
disabled: orderLocked || index === count - 1,
|
|
691
|
+
shortcut: "⌥↓",
|
|
692
|
+
onClick: () => onMenuMove(1),
|
|
693
|
+
children: "Move down"
|
|
694
|
+
}),
|
|
695
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
696
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
697
|
+
danger: true,
|
|
698
|
+
icon: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 }),
|
|
699
|
+
disabled: !canRemove,
|
|
700
|
+
onClick: onRemove,
|
|
701
|
+
children: canRemove ? "Delete" : `Delete · at least ${min} required`
|
|
702
|
+
})
|
|
703
|
+
]
|
|
704
|
+
})] })
|
|
705
|
+
]
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* The grip slot of a list whose order the site's code sets (identity rule 36): V2 content/editor/page-sections.tsx:155,
|
|
710
|
+
* a lock where the grip was, not interactive.
|
|
711
|
+
*/
|
|
712
|
+
function OrderLockSlot({ className }) {
|
|
713
|
+
return /* @__PURE__ */ jsx("span", {
|
|
714
|
+
"data-order-locked": "",
|
|
715
|
+
className: cn("flex w-5 shrink-0 justify-center text-kit-fg-4", className),
|
|
716
|
+
children: /* @__PURE__ */ jsx(IconLock, {
|
|
717
|
+
className: "size-3.5",
|
|
718
|
+
stroke: 1.5
|
|
719
|
+
})
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
//#endregion
|
|
723
|
+
export { ItemList, OrderLockSlot, SharedSortProvider, arrayMove, useDragReorder, useSharedSort };
|
|
724
|
+
|
|
725
|
+
//# sourceMappingURL=item-list.js.map
|