@bettercms-ai/kit 0.1.1 → 1.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/_virtual/_rolldown/runtime.js +13 -0
- package/adapters/icons.d.ts +15 -0
- package/adapters/icons.js +27 -0
- package/adapters/icons.js.map +1 -0
- package/adapters/lossy.d.ts +267 -0
- package/adapters/lossy.js +233 -0
- package/adapters/lossy.js.map +1 -0
- package/adapters/prod-types.d.ts +468 -0
- package/adapters/prod-types.js +646 -0
- package/adapters/prod-types.js.map +1 -0
- package/adapters/schema.d.ts +115 -0
- package/adapters/schema.js +2203 -0
- package/adapters/schema.js.map +1 -0
- package/adapters/values.d.ts +200 -0
- package/adapters/values.js +553 -0
- package/adapters/values.js.map +1 -0
- package/brand/logo.d.ts +17 -0
- package/brand/logo.js +9 -0
- package/brand/logo.js.map +1 -0
- package/context.d.ts +269 -0
- package/context.js +214 -0
- package/context.js.map +1 -0
- package/controls/button.d.ts +58 -0
- package/controls/button.js +507 -0
- package/controls/button.js.map +1 -0
- package/controls/c1.d.ts +11 -0
- package/controls/c1.js +24 -0
- package/controls/c1.js.map +1 -0
- package/controls/c2.d.ts +10 -0
- package/controls/c2.js +19 -0
- package/controls/c2.js.map +1 -0
- package/controls/choice.d.ts +39 -0
- package/controls/choice.js +410 -0
- package/controls/choice.js.map +1 -0
- package/controls/code-register.d.ts +1 -0
- package/controls/code-register.js +8 -0
- package/controls/code-register.js.map +1 -0
- package/controls/code.d.ts +42 -0
- package/controls/code.js +396 -0
- package/controls/code.js.map +1 -0
- package/controls/color.d.ts +5 -0
- package/controls/color.js +130 -0
- package/controls/color.js.map +1 -0
- package/controls/component-services.d.ts +114 -0
- package/controls/date-register.d.ts +1 -0
- package/controls/date-register.js +9 -0
- package/controls/date-register.js.map +1 -0
- package/controls/date-zone.d.ts +104 -0
- package/controls/date-zone.js +272 -0
- package/controls/date-zone.js.map +1 -0
- package/controls/date.d.ts +7 -0
- package/controls/date.js +458 -0
- package/controls/date.js.map +1 -0
- package/controls/form-picker-register.d.ts +1 -0
- package/controls/form-picker-register.js +19 -0
- package/controls/form-picker-register.js.map +1 -0
- package/controls/form-picker.d.ts +43 -0
- package/controls/form-picker.js +83 -0
- package/controls/form-picker.js.map +1 -0
- package/controls/icon-register.d.ts +1 -0
- package/controls/icon-register.js +8 -0
- package/controls/icon-register.js.map +1 -0
- package/controls/icon.d.ts +38 -0
- package/controls/icon.js +355 -0
- package/controls/icon.js.map +1 -0
- package/controls/index.d.ts +5 -0
- package/controls/index.js +37 -0
- package/controls/index.js.map +1 -0
- package/controls/json-register.d.ts +1 -0
- package/controls/json-register.js +8 -0
- package/controls/json-register.js.map +1 -0
- package/controls/json.d.ts +2 -0
- package/controls/json.js +72 -0
- package/controls/json.js.map +1 -0
- package/controls/link.d.ts +260 -0
- package/controls/link.js +1186 -0
- package/controls/link.js.map +1 -0
- package/controls/location-register.d.ts +1 -0
- package/controls/location-register.js +8 -0
- package/controls/location-register.js.map +1 -0
- package/controls/location.d.ts +16 -0
- package/controls/location.js +197 -0
- package/controls/location.js.map +1 -0
- package/controls/media-register.d.ts +1 -0
- package/controls/media-register.js +12 -0
- package/controls/media-register.js.map +1 -0
- package/controls/media-services.d.ts +40 -0
- package/controls/media.d.ts +73 -0
- package/controls/media.js +1076 -0
- package/controls/media.js.map +1 -0
- package/controls/number.d.ts +22 -0
- package/controls/number.js +195 -0
- package/controls/number.js.map +1 -0
- package/controls/reference-register.d.ts +1 -0
- package/controls/reference-register.js +10 -0
- package/controls/reference-register.js.map +1 -0
- package/controls/reference-services.d.ts +54 -0
- package/controls/reference.d.ts +23 -0
- package/controls/reference.js +761 -0
- package/controls/reference.js.map +1 -0
- package/controls/rich-text/blocks.d.ts +28 -0
- package/controls/rich-text/blocks.js +1532 -0
- package/controls/rich-text/blocks.js.map +1 -0
- package/controls/rich-text/catalog.d.ts +98 -0
- package/controls/rich-text/catalog.js +613 -0
- package/controls/rich-text/catalog.js.map +1 -0
- package/controls/rich-text/codec.d.ts +56 -0
- package/controls/rich-text/codec.js +32 -0
- package/controls/rich-text/codec.js.map +1 -0
- package/controls/rich-text/component-card.d.ts +14 -0
- package/controls/rich-text/component-card.js +706 -0
- package/controls/rich-text/component-card.js.map +1 -0
- package/controls/rich-text/control.d.ts +21 -0
- package/controls/rich-text/control.js +254 -0
- package/controls/rich-text/control.js.map +1 -0
- package/controls/rich-text/dom.d.ts +190 -0
- package/controls/rich-text/dom.js +690 -0
- package/controls/rich-text/dom.js.map +1 -0
- package/controls/rich-text/editor.d.ts +50 -0
- package/controls/rich-text/editor.js +1530 -0
- package/controls/rich-text/editor.js.map +1 -0
- package/controls/rich-text/floating.d.ts +23 -0
- package/controls/rich-text/floating.js +137 -0
- package/controls/rich-text/floating.js.map +1 -0
- package/controls/rich-text/index.d.ts +1 -0
- package/controls/rich-text/index.js +12 -0
- package/controls/rich-text/index.js.map +1 -0
- package/controls/rich-text/link-form.d.ts +13 -0
- package/controls/rich-text/link-form.js +111 -0
- package/controls/rich-text/link-form.js.map +1 -0
- package/controls/rich-text/markdown.d.ts +6 -0
- package/controls/rich-text/markdown.js +179 -0
- package/controls/rich-text/markdown.js.map +1 -0
- package/controls/rich-text/ops.d.ts +35 -0
- package/controls/rich-text/ops.js +314 -0
- package/controls/rich-text/ops.js.map +1 -0
- package/controls/rich-text/toolbar.d.ts +85 -0
- package/controls/rich-text/toolbar.js +338 -0
- package/controls/rich-text/toolbar.js.map +1 -0
- package/controls/scale.d.ts +56 -0
- package/controls/scale.js +563 -0
- package/controls/scale.js.map +1 -0
- package/controls/slot-register.d.ts +1 -0
- package/controls/slot-register.js +16 -0
- package/controls/slot-register.js.map +1 -0
- package/controls/slot-services.d.ts +97 -0
- package/controls/slot-services.js +38 -0
- package/controls/slot-services.js.map +1 -0
- package/controls/slot.d.ts +33 -0
- package/controls/slot.js +348 -0
- package/controls/slot.js.map +1 -0
- package/controls/table/index.d.ts +1 -0
- package/controls/table/index.js +12 -0
- package/controls/table/index.js.map +1 -0
- package/controls/table/prod.d.ts +21 -0
- package/controls/table/prod.js +79 -0
- package/controls/table/prod.js.map +1 -0
- package/controls/table/refs.d.ts +50 -0
- package/controls/table/refs.js +68 -0
- package/controls/table/refs.js.map +1 -0
- package/controls/table/stored.d.ts +15 -0
- package/controls/table/stored.js +44 -0
- package/controls/table/stored.js.map +1 -0
- package/controls/table/table-editor.d.ts +103 -0
- package/controls/table/table-editor.js +2722 -0
- package/controls/table/table-editor.js.map +1 -0
- package/controls/table/table-link.d.ts +24 -0
- package/controls/table/table-link.js +180 -0
- package/controls/table/table-link.js.map +1 -0
- package/controls/table/table.d.ts +9 -0
- package/controls/table/table.js +103 -0
- package/controls/table/table.js.map +1 -0
- package/controls/text.d.ts +17 -0
- package/controls/text.js +287 -0
- package/controls/text.js.map +1 -0
- package/engine/array.d.ts +101 -0
- package/engine/array.js +893 -0
- package/engine/array.js.map +1 -0
- package/engine/bits.d.ts +24 -0
- package/engine/bits.js +60 -0
- package/engine/bits.js.map +1 -0
- package/engine/breadcrumb.d.ts +45 -0
- package/engine/breadcrumb.js +87 -0
- package/engine/breadcrumb.js.map +1 -0
- package/engine/expand.d.ts +68 -0
- package/engine/expand.js +170 -0
- package/engine/expand.js.map +1 -0
- package/engine/field-list.d.ts +20 -0
- package/engine/field-list.js +19 -0
- package/engine/field-list.js.map +1 -0
- package/engine/field-shell.d.ts +49 -0
- package/engine/field-shell.js +860 -0
- package/engine/field-shell.js.map +1 -0
- package/engine/frame.d.ts +120 -0
- package/engine/frame.js +599 -0
- package/engine/frame.js.map +1 -0
- package/engine/group-summary.d.ts +4 -0
- package/engine/group-summary.js +66 -0
- package/engine/group-summary.js.map +1 -0
- package/engine/grouping.d.ts +224 -0
- package/engine/grouping.js +824 -0
- package/engine/grouping.js.map +1 -0
- package/engine/item-list.d.ts +89 -0
- package/engine/item-list.js +703 -0
- package/engine/item-list.js.map +1 -0
- package/engine/kit-field.d.ts +72 -0
- package/engine/kit-field.js +523 -0
- package/engine/kit-field.js.map +1 -0
- package/engine/schema-form.d.ts +91 -0
- package/engine/schema-form.js +320 -0
- package/engine/schema-form.js.map +1 -0
- package/engine/slot.d.ts +13 -0
- package/engine/slot.js +226 -0
- package/engine/slot.js.map +1 -0
- package/index.d.ts +46 -0
- package/index.js +55 -0
- package/index.js.map +1 -0
- package/kit.css +56 -0
- package/lib/cn.d.ts +4 -0
- package/lib/cn.js +53 -0
- package/lib/cn.js.map +1 -0
- package/lib/columns.d.ts +14 -0
- package/lib/columns.js +27 -0
- package/lib/columns.js.map +1 -0
- package/lib/frames.d.ts +36 -0
- package/lib/frames.js +214 -0
- package/lib/frames.js.map +1 -0
- package/lib/icons.d.ts +16 -0
- package/lib/icons.js +172 -0
- package/lib/icons.js.map +1 -0
- package/lib/path.d.ts +29 -0
- package/lib/path.js +64 -0
- package/lib/path.js.map +1 -0
- package/lib/schema.d.ts +49 -0
- package/lib/schema.js +287 -0
- package/lib/schema.js.map +1 -0
- package/lib/utils.d.ts +7 -0
- package/lib/utils.js +37 -0
- package/lib/utils.js.map +1 -0
- package/lib/validate.d.ts +20 -0
- package/lib/validate.js +150 -0
- package/lib/validate.js.map +1 -0
- package/package.json +31 -59
- package/schema/adapters.d.ts +28 -0
- package/schema/adapters.js +493 -0
- package/schema/adapters.js.map +1 -0
- package/schema/help.d.ts +25 -0
- package/schema/help.js +54 -0
- package/schema/help.js.map +1 -0
- package/schema/scale.d.ts +69 -0
- package/schema/scale.js +250 -0
- package/schema/scale.js.map +1 -0
- package/schema/sources.d.ts +103 -0
- package/schema/sources.js +65 -0
- package/schema/sources.js.map +1 -0
- package/schema/table.d.ts +319 -0
- package/schema/table.js +1198 -0
- package/schema/table.js.map +1 -0
- package/schema/types.d.ts +269 -0
- package/schema/types.js +14 -0
- package/schema/types.js.map +1 -0
- package/types.d.ts +17 -0
- package/ui/action-tray.d.ts +54 -0
- package/ui/action-tray.js +153 -0
- package/ui/action-tray.js.map +1 -0
- package/ui/button.d.ts +57 -0
- package/ui/button.js +202 -0
- package/ui/button.js.map +1 -0
- package/ui/choice-switch.d.ts +36 -0
- package/ui/choice-switch.js +57 -0
- package/ui/choice-switch.js.map +1 -0
- package/ui/controls.d.ts +83 -0
- package/ui/controls.js +319 -0
- package/ui/controls.js.map +1 -0
- package/ui/display.d.ts +156 -0
- package/ui/display.js +444 -0
- package/ui/display.js.map +1 -0
- package/ui/expanded-editor-modal.d.ts +26 -0
- package/ui/expanded-editor-modal.js +140 -0
- package/ui/expanded-editor-modal.js.map +1 -0
- package/ui/field-context.d.ts +12 -0
- package/ui/field-context.js +23 -0
- package/ui/field-context.js.map +1 -0
- package/ui/floating-panel.d.ts +152 -0
- package/ui/floating-panel.js +912 -0
- package/ui/floating-panel.js.map +1 -0
- package/ui/index.d.ts +12 -0
- package/ui/index.js +13 -0
- package/ui/input.d.ts +78 -0
- package/ui/input.js +250 -0
- package/ui/input.js.map +1 -0
- package/ui/mode-bar.d.ts +31 -0
- package/ui/mode-bar.js +65 -0
- package/ui/mode-bar.js.map +1 -0
- package/ui/overlay.d.ts +123 -0
- package/ui/overlay.js +378 -0
- package/ui/overlay.js.map +1 -0
- package/ui/path-crumbs.d.ts +90 -0
- package/ui/path-crumbs.js +532 -0
- package/ui/path-crumbs.js.map +1 -0
- package/ui/presence.d.ts +16 -0
- package/ui/presence.js +65 -0
- package/ui/presence.js.map +1 -0
- package/ui/select.d.ts +66 -0
- package/ui/select.js +405 -0
- package/ui/select.js.map +1 -0
- package/ui/shortcut-hint.d.ts +14 -0
- package/ui/shortcut-hint.js +35 -0
- package/ui/shortcut-hint.js.map +1 -0
- package/ui/surfaces.d.ts +23 -0
- package/ui/surfaces.js +26 -0
- package/ui/surfaces.js.map +1 -0
- package/ui/tooltip-root.d.ts +12 -0
- package/ui/tooltip-root.js +76 -0
- package/ui/tooltip-root.js.map +1 -0
- package/ui/variants.d.ts +15 -0
- package/ui/variants.js +14 -0
- package/ui/variants.js.map +1 -0
- package/LICENSE +0 -21
- package/README.md +0 -27
- 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.d.ts +0 -3140
- package/dist/index.js +0 -2036
- package/dist/index.mjs +0 -2044
- package/dist/theme.d.mts +0 -1506
- package/dist/theme.d.ts +0 -1506
- package/dist/theme.js +0 -4126
- 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 @@
|
|
|
1
|
+
{"version":3,"file":"table-link.js","names":[],"sources":["../../../src/kit/controls/table/table-link.tsx"],"sourcesContent":["/**\n * A link cell's address (BE TableLink `{ label, href, newTab?, rel? }`): the address, \"Open in a new tab\" and the\n * relationship search engines read. V2 opened its global link panel (controls/link.tsx LinkPopoverBody); that panel is the\n * link lane's, so the table carries this one, writing the same four keys the backend takes and nothing else.\n *\n * Refusals are named before anything is written: a script address (javascript:, data:, vbscript:) is refused here\n * exactly as the backend refuses it (`link_value_invalid`).\n */\nimport * as React from \"react\";\nimport { IconLink } from \"@tabler/icons-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../../ui/button\";\nimport { Input } from \"../../ui/input\";\nimport { Switch } from \"../../ui/controls\";\nimport { Select } from \"../../ui/select\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/overlay\";\nimport type { TableLink } from \"../../schema/table\";\n\nexport const LINK_RELS: { value: NonNullable<TableLink[\"rel\"]>; label: string }[] = [\n { value: \"follow\", label: \"Follow (default)\" },\n { value: \"nofollow\", label: \"Don't vouch for it (nofollow)\" },\n { value: \"sponsored\", label: \"Paid or sponsored\" },\n { value: \"ugc\", label: \"Written by visitors\" },\n];\n\n/** BE link-value.ts isScriptHref: what no link may hold. */\nexport const isScriptHref = (href: string) => /^\\s*(javascript|data|vbscript):/i.test(href.replace(/[\\p{Cc}\\s]+/gu, \"\"));\nexport const hrefProblem = (href: string) => (isScriptHref(href) ? \"Script links (javascript:, data:, vbscript:) aren't allowed.\" : null);\n\n/** The stored link with only the keys it uses: `newTab` only when on, `rel` only when not the default. */\nexport function tableLink(label: string, href: string, newTab?: boolean, rel?: TableLink[\"rel\"]): TableLink {\n return { label, href, ...(newTab ? { newTab: true } : {}), ...(rel && rel !== \"follow\" ? { rel } : {}) };\n}\n\n/** Address + options, as one popover body (the spreadsheet's link button) or inline (a row's link cell). */\nexport function LinkAddressEditor({\n link,\n onSave,\n onCancel,\n autoFocus,\n}: {\n link: TableLink;\n onSave: (next: TableLink) => void;\n onCancel?: () => void;\n autoFocus?: boolean;\n}) {\n const [href, setHref] = React.useState(link.href);\n const [newTab, setNewTab] = React.useState(!!link.newTab);\n const [rel, setRel] = React.useState<NonNullable<TableLink[\"rel\"]>>(link.rel ?? \"follow\");\n const id = React.useId();\n const problem = hrefProblem(href);\n const save = () => !problem && onSave(tableLink(link.label, href.trim(), newTab, rel));\n return (\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex flex-col gap-1.5\">\n <label htmlFor={`${id}-href`} className=\"text-kit-xs font-medium text-kit-fg-2\">Address</label>\n <Input\n id={`${id}-href`}\n size=\"sm\"\n autoFocus={autoFocus}\n value={href}\n placeholder=\"https://… or /pricing\"\n aria-invalid={problem ? true : undefined}\n aria-describedby={problem ? `${id}-problem` : undefined}\n onChange={(e) => setHref(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") { e.preventDefault(); save(); }\n }}\n />\n {problem ? <p id={`${id}-problem`} role=\"alert\" className=\"text-kit-xs text-kit-danger-fg\">{problem}</p> : null}\n </div>\n <div className=\"flex min-h-8 items-center justify-between gap-2 text-kit-sm text-kit-fg-2\">\n <span aria-hidden>Open in a new tab</span>\n <Switch size=\"sm\" checked={newTab} onCheckedChange={setNewTab} aria-label=\"Open in a new tab\" />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <span id={`${id}-rel`} className=\"text-kit-xs font-medium text-kit-fg-2\">Search engines</span>\n <Select aria-label=\"Search engines\" size=\"sm\" value={rel} onValueChange={(v) => setRel(v as typeof rel)} options={LINK_RELS} />\n </div>\n <div className=\"flex items-center justify-end gap-1.5\">\n {link.href ? (\n <Button size=\"sm\" variant=\"ghost\" className=\"mr-auto text-kit-fg-2\" onClick={() => onSave(tableLink(link.label, \"\"))}>\n Remove link\n </Button>\n ) : null}\n {onCancel ? (\n <Button size=\"sm\" variant=\"ghost\" onClick={onCancel}>\n Cancel\n </Button>\n ) : null}\n <Button size=\"sm\" variant=\"primary\" disabled={!!problem} onClick={save}>\n Save\n </Button>\n </div>\n </div>\n );\n}\n\n/** The small link button beside a link cell's words: opens the address editor. */\nexport function LinkAddressButton({ link, onSave, readOnly, className }: { link: TableLink; onSave: (l: TableLink) => void; readOnly?: boolean; className?: string }) {\n const [open, setOpen] = React.useState(false);\n if (readOnly && !link.href) return null;\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n disabled={readOnly}\n tabIndex={-1}\n aria-label={link.href ? `Link: ${link.href}` : \"Add a link address\"}\n className={cn(\n \"flex size-5 shrink-0 items-center justify-center rounded-kit-sm text-kit-fg-4 outline-none hover:bg-kit-hover hover:text-kit-fg\",\n link.href && \"text-kit-fg-2\",\n className,\n )}\n >\n <IconLink className=\"size-3.5\" stroke={1.75} />\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-[320px] p-3\">\n <LinkAddressEditor\n link={link}\n autoFocus\n onCancel={() => setOpen(false)}\n onSave={(l) => {\n onSave(l);\n setOpen(false);\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAa,YAAuE;CAClF;EAAE,OAAO;EAAU,OAAO;EAAoB;CAC9C;EAAE,OAAO;EAAY,OAAO;EAAiC;CAC7D;EAAE,OAAO;EAAa,OAAO;EAAqB;CAClD;EAAE,OAAO;EAAO,OAAO;EAAuB;CAC/C;;AAGD,IAAa,gBAAgB,SAAiB,mCAAmC,KAAK,KAAK,QAAQ,iBAAiB,GAAG,CAAC;AACxH,IAAa,eAAe,SAAkB,aAAa,KAAK,GAAG,iEAAiE;;AAGpI,SAAgB,UAAU,OAAe,MAAc,QAAkB,KAAmC;AAC1G,QAAO;EAAE;EAAO;EAAM,GAAI,SAAS,EAAE,QAAQ,MAAM,GAAG,EAAE;EAAG,GAAI,OAAO,QAAQ,WAAW,EAAE,KAAK,GAAG,EAAE;EAAG;;;AAI1G,SAAgB,kBAAkB,EAChC,MACA,QACA,UACA,aAMC;CACD,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK,KAAK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AAS;KAAa,CAAA,CAC3H;;GACN,qBAAC,OAAD;IAAK,WAAU;cAAf;KACG,KAAK,OACJ,oBAAC,QAAD;MAAQ,MAAK;MAAK,SAAQ;MAAQ,WAAU;MAAwB,eAAe,OAAO,UAAU,KAAK,OAAO,GAAG,CAAC;gBAAE;MAE7G,CAAA,GACP;KACH,WACC,oBAAC,QAAD;MAAQ,MAAK;MAAK,SAAQ;MAAQ,SAAS;gBAAU;MAE5C,CAAA,GACP;KACJ,oBAAC,QAAD;MAAQ,MAAK;MAAK,SAAQ;MAAU,UAAU,CAAC,CAAC;MAAS,SAAS;gBAAM;MAE/D,CAAA;KACL;;GACF;;;;AAKV,SAAgB,kBAAkB,EAAE,MAAM,QAAQ,UAAU,aAA0G;CACpK,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,MAAM;AAC7C,KAAI,YAAY,CAAC,KAAK,KAAM,QAAO;AACnC,QACE,qBAAC,SAAD;EAAe;EAAM,cAAc;YAAnC,CACE,oBAAC,gBAAD;GACE,UAAU;GACV,UAAU;GACV,cAAY,KAAK,OAAO,SAAS,KAAK,SAAS;GAC/C,WAAW,GACT,mIACA,KAAK,QAAQ,iBACb,UACD;aAED,oBAAC,UAAD;IAAU,WAAU;IAAW,QAAQ;IAAQ,CAAA;GAChC,CAAA,EACjB,oBAAC,gBAAD;GAAgB,OAAM;GAAM,WAAU;aACpC,oBAAC,mBAAD;IACQ;IACN,WAAA;IACA,gBAAgB,QAAQ,MAAM;IAC9B,SAAS,MAAM;AACb,YAAO,EAAE;AACT,aAAQ,MAAM;;IAEhB,CAAA;GACa,CAAA,CACT"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Frame } from "../../lib/frames";
|
|
2
|
+
import type { ControlProps } from "../../types";
|
|
3
|
+
/** Label-row action of a table field (KitField ACTIONS.table): the one way into the full-screen spreadsheet (D49). */
|
|
4
|
+
export declare function TableFullScreenAction({ path }: Pick<ControlProps, "path">): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function TableControl({ field, value, onChange, readOnly, path }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
/** The body of a drilled table row or column frame (FrameView draws the standard header above it): FrameSlots.TableFrame. */
|
|
7
|
+
export declare function TableFrame({ frame }: {
|
|
8
|
+
frame: Frame;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { pathKey } from "../../lib/path.js";
|
|
2
|
+
import { resolveFieldAccess, useForm, useKitEnv } from "../../context.js";
|
|
3
|
+
import { GENERAL_TABLE, emptyTable, isTableValue, normalizeTable } from "../../schema/table.js";
|
|
4
|
+
import { TableEditor, TableFullScreenButton, TableItemEditor } from "./table-editor.js";
|
|
5
|
+
import { storedTable } from "./stored.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region src/kit/controls/table/table.tsx
|
|
9
|
+
/**
|
|
10
|
+
* TABLE control (CPO D42, D50, D52; port of V2 kit/controls/table.tsx): the `table` field type (a content-model `table`
|
|
11
|
+
* field, or a component `table` prop with `config.mode: "data"`) edits like any nested array, with no container of its
|
|
12
|
+
* own: Title, Columns, Rows (groups live in the row list), Note under the table, and a collapsed Table settings that
|
|
13
|
+
* offers only what `field.table.settings` allows (no `table` options = a general table, everything offered). A row or a
|
|
14
|
+
* column drills through the form's own navigation (TableFrame), so the breadcrumb and frame header are the ones every
|
|
15
|
+
* FAQ or feature item uses. The ⤢ button in the field's label row (TableFullScreenAction) opens the spreadsheet in the
|
|
16
|
+
* expanded-editor modal (D49).
|
|
17
|
+
*
|
|
18
|
+
* Value: `TableValue` (schema/table.ts), written in the exact shape the backend stores (stored.ts): keys the editor
|
|
19
|
+
* fills in for itself are never written back unless the person changed them.
|
|
20
|
+
*/
|
|
21
|
+
var fullKey = null;
|
|
22
|
+
var subs = /* @__PURE__ */ new Set();
|
|
23
|
+
var setFullKey = (k) => {
|
|
24
|
+
fullKey = k;
|
|
25
|
+
subs.forEach((f) => f());
|
|
26
|
+
};
|
|
27
|
+
var subscribe = (f) => (subs.add(f), () => void subs.delete(f));
|
|
28
|
+
var useFullOpen = (k) => React.useSyncExternalStore(subscribe, () => fullKey === k, () => false);
|
|
29
|
+
var fullKeyOf = (docId, path) => `${docId}:${pathKey(path)}`;
|
|
30
|
+
/** Label-row action of a table field (KitField ACTIONS.table): the one way into the full-screen spreadsheet (D49). */
|
|
31
|
+
function TableFullScreenAction({ path }) {
|
|
32
|
+
const env = useKitEnv();
|
|
33
|
+
return /* @__PURE__ */ jsx(TableFullScreenButton, {
|
|
34
|
+
className: "-my-1",
|
|
35
|
+
onOpen: () => setFullKey(fullKeyOf(env.docId, path))
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function TableControl({ field, value, onChange, readOnly, path }) {
|
|
39
|
+
const env = useKitEnv();
|
|
40
|
+
const form = useForm();
|
|
41
|
+
const t = React.useMemo(() => isTableValue(value) ? normalizeTable(value) : null, [value]);
|
|
42
|
+
const fallback = React.useMemo(() => isTableValue(field.initialValue) ? normalizeTable(field.initialValue) : emptyTable(), [field.initialValue]);
|
|
43
|
+
const key = fullKeyOf(env.docId, path);
|
|
44
|
+
const full = useFullOpen(key);
|
|
45
|
+
React.useEffect(() => () => void (fullKey === key && setFullKey(null)), [key]);
|
|
46
|
+
const host = React.useRef(null);
|
|
47
|
+
const nav = React.useMemo(() => form?.canNavigate ? {
|
|
48
|
+
id: key,
|
|
49
|
+
basePath: path,
|
|
50
|
+
open: (kind, i) => form.navigate([
|
|
51
|
+
...path,
|
|
52
|
+
kind,
|
|
53
|
+
i
|
|
54
|
+
])
|
|
55
|
+
} : void 0, [
|
|
56
|
+
form,
|
|
57
|
+
key,
|
|
58
|
+
path
|
|
59
|
+
]);
|
|
60
|
+
return /* @__PURE__ */ jsx("div", {
|
|
61
|
+
ref: host,
|
|
62
|
+
className: "min-w-0",
|
|
63
|
+
"data-kit-control": "table",
|
|
64
|
+
children: /* @__PURE__ */ jsx(TableEditor, {
|
|
65
|
+
value: t ?? fallback,
|
|
66
|
+
onChange: (next) => onChange(storedTable(next, value)),
|
|
67
|
+
readOnly,
|
|
68
|
+
options: field.table ?? GENERAL_TABLE,
|
|
69
|
+
developer: env.can("schema.manage"),
|
|
70
|
+
label: field.title,
|
|
71
|
+
parentTitle: env.docTitle,
|
|
72
|
+
nav,
|
|
73
|
+
fullScreen: {
|
|
74
|
+
open: full,
|
|
75
|
+
onOpenChange: (o) => setFullKey(o ? key : null),
|
|
76
|
+
returnFocus: () => host.current?.closest("[data-field-key]")?.querySelector("button[aria-label=\"Edit in full screen\"]") ?? null
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** The body of a drilled table row or column frame (FrameView draws the standard header above it): FrameSlots.TableFrame. */
|
|
82
|
+
function TableFrame({ frame }) {
|
|
83
|
+
const form = useForm();
|
|
84
|
+
const env = useKitEnv();
|
|
85
|
+
const it = frame.item;
|
|
86
|
+
const field = frame.field;
|
|
87
|
+
const tablePath = it.arrayPath.slice(0, -1);
|
|
88
|
+
const raw = form.getAt(tablePath);
|
|
89
|
+
const readOnly = resolveFieldAccess(field, env).readOnly;
|
|
90
|
+
return /* @__PURE__ */ jsx(TableItemEditor, {
|
|
91
|
+
kind: frame.kind === "tableRow" ? "row" : "column",
|
|
92
|
+
index: it.index,
|
|
93
|
+
value: normalizeTable(raw),
|
|
94
|
+
onChange: (next) => form.setAt(tablePath, storedTable(next, raw)),
|
|
95
|
+
options: field.table ?? GENERAL_TABLE,
|
|
96
|
+
developer: env.can("schema.manage"),
|
|
97
|
+
readOnly
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { TableControl, TableFrame, TableFullScreenAction };
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","names":[],"sources":["../../../src/kit/controls/table/table.tsx"],"sourcesContent":["/**\n * TABLE control (CPO D42, D50, D52; port of V2 kit/controls/table.tsx): the `table` field type (a content-model `table`\n * field, or a component `table` prop with `config.mode: \"data\"`) edits like any nested array, with no container of its\n * own: Title, Columns, Rows (groups live in the row list), Note under the table, and a collapsed Table settings that\n * offers only what `field.table.settings` allows (no `table` options = a general table, everything offered). A row or a\n * column drills through the form's own navigation (TableFrame), so the breadcrumb and frame header are the ones every\n * FAQ or feature item uses. The ⤢ button in the field's label row (TableFullScreenAction) opens the spreadsheet in the\n * expanded-editor modal (D49).\n *\n * Value: `TableValue` (schema/table.ts), written in the exact shape the backend stores (stored.ts): keys the editor\n * fills in for itself are never written back unless the person changed them.\n */\nimport * as React from \"react\";\nimport { resolveFieldAccess, useForm, useKitEnv } from \"../../context\";\nimport type { Frame } from \"../../lib/frames\";\nimport { pathKey } from \"../../lib/path\";\nimport type { FieldPath } from \"../../schema/types\";\nimport { GENERAL_TABLE, emptyTable, isTableValue, normalizeTable, type TableValue } from \"../../schema/table\";\nimport type { ControlProps } from \"../../types\";\nimport { TableEditor, TableFullScreenButton, TableItemEditor } from \"./table-editor\";\nimport { storedTable } from \"./stored\";\n\n/* Which table field has its spreadsheet open (the label-row button and the control share it). */\nlet fullKey: string | null = null;\nconst subs = new Set<() => void>();\nconst setFullKey = (k: string | null) => {\n fullKey = k;\n subs.forEach((f) => f());\n};\nconst subscribe = (f: () => void) => (subs.add(f), () => void subs.delete(f));\nconst useFullOpen = (k: string) => React.useSyncExternalStore(subscribe, () => fullKey === k, () => false);\nconst fullKeyOf = (docId: string, path: FieldPath) => `${docId}:${pathKey(path)}`;\n\n/** Label-row action of a table field (KitField ACTIONS.table): the one way into the full-screen spreadsheet (D49). */\nexport function TableFullScreenAction({ path }: Pick<ControlProps, \"path\">) {\n const env = useKitEnv();\n return <TableFullScreenButton className=\"-my-1\" onOpen={() => setFullKey(fullKeyOf(env.docId, path))} />;\n}\n\nexport function TableControl({ field, value, onChange, readOnly, path }: ControlProps) {\n const env = useKitEnv();\n const form = useForm();\n const t = React.useMemo(() => (isTableValue(value) ? normalizeTable(value) : null), [value]);\n // no value yet: the field's default table, else an empty 3 × 2 one (nothing is written until the person edits it)\n const fallback = React.useMemo(() => (isTableValue(field.initialValue) ? normalizeTable(field.initialValue) : emptyTable()), [field.initialValue]);\n const key = fullKeyOf(env.docId, path);\n const full = useFullOpen(key);\n // the spreadsheet belongs to this mount: a dock closed with it open must not reopen it on the next visit\n React.useEffect(() => () => void (fullKey === key && setFullKey(null)), [key]);\n const host = React.useRef<HTMLDivElement>(null);\n const nav = React.useMemo(\n () => (form?.canNavigate ? { id: key, basePath: path, open: (kind: \"rows\" | \"columns\", i: number) => form.navigate([...path, kind, i]) } : undefined),\n [form, key, path],\n );\n return (\n <div ref={host} className=\"min-w-0\" data-kit-control=\"table\">\n <TableEditor\n value={t ?? fallback}\n onChange={(next: TableValue) => onChange(storedTable(next, value))}\n readOnly={readOnly}\n options={field.table ?? GENERAL_TABLE}\n developer={env.can(\"schema.manage\")}\n label={field.title}\n parentTitle={env.docTitle}\n nav={nav}\n fullScreen={{\n open: full,\n onOpenChange: (o) => setFullKey(o ? key : null),\n returnFocus: () => host.current?.closest(\"[data-field-key]\")?.querySelector<HTMLElement>('button[aria-label=\"Edit in full screen\"]') ?? null,\n }}\n />\n </div>\n );\n}\n\n/** The body of a drilled table row or column frame (FrameView draws the standard header above it): FrameSlots.TableFrame. */\nexport function TableFrame({ frame }: { frame: Frame }) {\n const form = useForm()!;\n const env = useKitEnv();\n const it = frame.item!;\n const field = frame.field!;\n const tablePath = it.arrayPath.slice(0, -1);\n const raw = form.getAt(tablePath);\n const readOnly = resolveFieldAccess(field, env).readOnly;\n return (\n <TableItemEditor\n kind={frame.kind === \"tableRow\" ? \"row\" : \"column\"}\n index={it.index}\n value={normalizeTable(raw)}\n onChange={(next) => form.setAt(tablePath, storedTable(next, raw))}\n options={field.table ?? GENERAL_TABLE}\n developer={env.can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3I;EAAC;EAAM;EAAK;EAAK,CAClB;AACD,QACE,oBAAC,OAAD;EAAK,KAAK;EAAM,WAAU;EAAU,oBAAiB;YACnD,oBAAC,aAAD;GACE,OAAO,KAAK;GACZ,WAAW,SAAqB,SAAS,YAAY,MAAM,MAAM,CAAC;GACxD;GACV,SAAS,MAAM,SAAS;GACxB,WAAW,IAAI,IAAI,gBAAgB;GACnC,OAAO,MAAM;GACb,aAAa,IAAI;GACZ;GACL,YAAY;IACV,MAAM;IACN,eAAe,MAAM,WAAW,IAAI,MAAM,KAAK;IAC/C,mBAAmB,KAAK,SAAS,QAAQ,mBAAmB,EAAE,cAA2B,6CAA2C,IAAI;IACzI;GACD,CAAA;EACE,CAAA;;;AAKV,SAAgB,WAAW,EAAE,SAA2B;CACtD,MAAM,OAAO,SAAS;CACtB,MAAM,MAAM,WAAW;CACvB,MAAM,KAAK,MAAM;CACjB,MAAM,QAAQ,MAAM;CACpB,MAAM,YAAY,GAAG,UAAU,MAAM,GAAG,GAAG;CAC3C,MAAM,MAAM,KAAK,MAAM,UAAU;CACjC,MAAM,WAAW,mBAAmB,OAAO,IAAI,CAAC;AAChD,QACE,oBAAC,iBAAD;EACE,MAAM,MAAM,SAAS,aAAa,QAAQ;EAC1C,OAAO,GAAG;EACV,OAAO,eAAe,IAAI;EAC1B,WAAW,SAAS,KAAK,MAAM,WAAW,YAAY,MAAM,IAAI,CAAC;EACjE,SAAS,MAAM,SAAS;EACxB,WAAW,IAAI,IAAI,gBAAgB;EACzB;EACV,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ControlProps } from "../types";
|
|
2
|
+
export declare const str: (v: unknown) => string;
|
|
3
|
+
/** border-only focus (no halo) for text entry; `[&_input]` reaches the input inside an Input with leading/trailing */
|
|
4
|
+
export declare const TEXT_FOCUS = "focus:shadow-none focus-visible:shadow-none [&_input]:focus:shadow-none";
|
|
5
|
+
export declare function StringControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function TextControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function EmailControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function UrlControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
/** The text a slug follows: the first title-like sibling, else the document title. */
|
|
10
|
+
export declare function slugSource(parent: Record<string, unknown> | undefined, docTitle?: string): string;
|
|
11
|
+
/** What a keystroke may leave in a slug: lowercase letters, digits and hyphens (spaces become hyphens). */
|
|
12
|
+
export declare const slugTyping: (s: string) => string;
|
|
13
|
+
/** The stored slug: no leading, trailing or doubled hyphens (the backend's pattern). */
|
|
14
|
+
export declare const slugTidy: (s: string) => string;
|
|
15
|
+
/** Label-row "Generate" for slug fields (ACTIONS.slug; prod: ghost button in the label row). */
|
|
16
|
+
export declare function SlugGenerate({ parent, value, onChange, readOnly }: Pick<ControlProps, "parent" | "value" | "onChange" | "readOnly">): import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
export declare function SlugControl({ value, onChange, readOnly, id, invalid, parent, path, onBlur }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
package/controls/text.js
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { useForm, useKitEnv, useKitServices } from "../context.js";
|
|
3
|
+
import { Button, IconButton } from "../ui/button.js";
|
|
4
|
+
import { Tooltip } from "../ui/overlay.js";
|
|
5
|
+
import { plainText } from "../lib/schema.js";
|
|
6
|
+
import { Input, Textarea } from "../ui/input.js";
|
|
7
|
+
import { slugify } from "../lib/utils.js";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { IconAlertTriangle, IconExternalLink, IconMail, IconWorld } from "@tabler/icons-react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
//#region src/kit/controls/text.tsx
|
|
12
|
+
/**
|
|
13
|
+
* TEXT — string · text · email · url · slug (V2 HEAD 9829bf1 kit/controls/text.tsx, DESIGN §8.2–8.3).
|
|
14
|
+
* Founder rule: text grows to show its whole value, never clipped. Text entry gets NO focus ring or halo — the border
|
|
15
|
+
* steps rest → hover → focus on the box only (prod CPO-069).
|
|
16
|
+
*
|
|
17
|
+
* Stored shapes (prod): string / longtext / email / slug / url (text + inputType "url") all store a plain string.
|
|
18
|
+
* Slug keeps the backend's `^[a-z0-9]+(?:-[a-z0-9]+)*$`: keystrokes are filtered, and the stray hyphens typing leaves
|
|
19
|
+
* (a trailing "-" before the next word) are tidied on blur.
|
|
20
|
+
*/
|
|
21
|
+
var str = (v) => typeof v === "string" ? v : v == null ? "" : String(v);
|
|
22
|
+
/** border-only focus (no halo) for text entry; `[&_input]` reaches the input inside an Input with leading/trailing */
|
|
23
|
+
var TEXT_FOCUS = "focus:shadow-none focus-visible:shadow-none [&_input]:focus:shadow-none";
|
|
24
|
+
function StringControl({ field, value, onChange, readOnly, id, invalid, onBlur }) {
|
|
25
|
+
const { variant } = useKitEnv();
|
|
26
|
+
return /* @__PURE__ */ jsx(Textarea, {
|
|
27
|
+
id,
|
|
28
|
+
rows: 1,
|
|
29
|
+
value: str(value),
|
|
30
|
+
readOnly,
|
|
31
|
+
"aria-invalid": invalid,
|
|
32
|
+
placeholder: field.placeholder,
|
|
33
|
+
onBlur,
|
|
34
|
+
onKeyDown: (e) => e.key === "Enter" && e.preventDefault(),
|
|
35
|
+
onChange: (e) => onChange(e.target.value.replace(/\r?\n/g, " ")),
|
|
36
|
+
className: cn(TEXT_FOCUS, "min-h-8 py-1.5 leading-5", variant === "document" && "min-h-9 py-2")
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function TextControl({ field, value, onChange, readOnly, id, invalid, onBlur }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(Textarea, {
|
|
41
|
+
id,
|
|
42
|
+
rows: field.rows ?? 3,
|
|
43
|
+
value: str(value),
|
|
44
|
+
readOnly,
|
|
45
|
+
"aria-invalid": invalid,
|
|
46
|
+
placeholder: field.placeholder,
|
|
47
|
+
onBlur,
|
|
48
|
+
onChange: (e) => onChange(e.target.value),
|
|
49
|
+
className: cn(TEXT_FOCUS, "leading-5")
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function EmailControl({ field, value, onChange, readOnly, id, invalid, onBlur }) {
|
|
53
|
+
const { variant } = useKitEnv();
|
|
54
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
55
|
+
id,
|
|
56
|
+
size: variant === "document" ? "lg" : "md",
|
|
57
|
+
type: "email",
|
|
58
|
+
value: str(value),
|
|
59
|
+
readOnly,
|
|
60
|
+
"aria-invalid": invalid,
|
|
61
|
+
onBlur,
|
|
62
|
+
placeholder: field.placeholder ?? "name@company.com",
|
|
63
|
+
leading: /* @__PURE__ */ jsx(IconMail, { stroke: 1.5 }),
|
|
64
|
+
onChange: (e) => onChange(e.target.value.trim()),
|
|
65
|
+
className: TEXT_FOCUS
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function UrlControl({ field, value, onChange, readOnly, id, invalid, onBlur }) {
|
|
69
|
+
const v = str(value);
|
|
70
|
+
const { variant } = useKitEnv();
|
|
71
|
+
const open = /^https?:\/\/\S+/.test(v);
|
|
72
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
73
|
+
id,
|
|
74
|
+
size: variant === "document" ? "lg" : "md",
|
|
75
|
+
value: v,
|
|
76
|
+
readOnly,
|
|
77
|
+
"aria-invalid": invalid,
|
|
78
|
+
onBlur,
|
|
79
|
+
placeholder: field.placeholder ?? "https://example.com",
|
|
80
|
+
onChange: (e) => onChange(e.target.value.trim()),
|
|
81
|
+
leading: /* @__PURE__ */ jsx(IconWorld, { stroke: 1.5 }),
|
|
82
|
+
className: cn(TEXT_FOCUS, "[&_input]:text-kit-accent-fg"),
|
|
83
|
+
trailing: open ? /* @__PURE__ */ jsx(Tooltip, {
|
|
84
|
+
content: "Open link in a new tab",
|
|
85
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
86
|
+
type: "button",
|
|
87
|
+
"aria-label": "Open link",
|
|
88
|
+
className: "pointer-events-auto flex rounded-kit-md p-0.5 hover:bg-kit-selected hover:text-kit-fg",
|
|
89
|
+
onClick: () => window.open(v, "_blank", "noopener"),
|
|
90
|
+
children: /* @__PURE__ */ jsx(IconExternalLink, {
|
|
91
|
+
className: "size-4",
|
|
92
|
+
stroke: 1.5
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
}) : void 0
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
var TITLE_KEYS = [
|
|
99
|
+
"title",
|
|
100
|
+
"name",
|
|
101
|
+
"heading",
|
|
102
|
+
"question",
|
|
103
|
+
"label"
|
|
104
|
+
];
|
|
105
|
+
/** The text a slug follows: the first title-like sibling, else the document title. */
|
|
106
|
+
function slugSource(parent, docTitle) {
|
|
107
|
+
for (const k of TITLE_KEYS) {
|
|
108
|
+
const t = plainText(parent?.[k]);
|
|
109
|
+
if (t) return t;
|
|
110
|
+
}
|
|
111
|
+
return docTitle ?? "";
|
|
112
|
+
}
|
|
113
|
+
/** What a keystroke may leave in a slug: lowercase letters, digits and hyphens (spaces become hyphens). */
|
|
114
|
+
var slugTyping = (s) => s.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
|
115
|
+
/** The stored slug: no leading, trailing or doubled hyphens (the backend's pattern). */
|
|
116
|
+
var slugTidy = (s) => slugTyping(s).replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
117
|
+
/** Label-row "Generate" for slug fields (ACTIONS.slug; prod: ghost button in the label row). */
|
|
118
|
+
function SlugGenerate({ parent, value, onChange, readOnly }) {
|
|
119
|
+
const { docTitle } = useKitEnv();
|
|
120
|
+
const src = slugSource(parent, docTitle);
|
|
121
|
+
if (readOnly || !src) return null;
|
|
122
|
+
const next = slugify(src);
|
|
123
|
+
if (!next) return null;
|
|
124
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
125
|
+
content: `Generate from “${src.length > 32 ? `${src.slice(0, 30)}…` : src}”`,
|
|
126
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
127
|
+
size: "xs",
|
|
128
|
+
variant: "ghost",
|
|
129
|
+
className: "h-5 px-1.5 text-kit-xs text-kit-fg-2",
|
|
130
|
+
disabled: next === value,
|
|
131
|
+
onClick: () => onChange(next),
|
|
132
|
+
children: "Generate"
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function SlugControl({ value, onChange, readOnly, id, invalid, parent, path, onBlur }) {
|
|
137
|
+
const v = str(value);
|
|
138
|
+
const env = useKitEnv();
|
|
139
|
+
const form = useForm();
|
|
140
|
+
const { toast } = useKitServices();
|
|
141
|
+
const src = slugSource(parent, env.docTitle);
|
|
142
|
+
const following = React.useRef(env.isPublished === false && (v === "" || v === slugify(src)));
|
|
143
|
+
const seenSrc = React.useRef(src);
|
|
144
|
+
React.useEffect(() => {
|
|
145
|
+
if (seenSrc.current === src) return;
|
|
146
|
+
seenSrc.current = src;
|
|
147
|
+
if (!following.current || readOnly) return;
|
|
148
|
+
const next = slugify(src);
|
|
149
|
+
if (next && next !== v) onChange(next);
|
|
150
|
+
}, [src]);
|
|
151
|
+
const live = form?.hasPublished ? str(form.publishedAt(path)) : env.isPublished ? str(form?.baselineAt(path) ?? "") : "";
|
|
152
|
+
const [confirmed, setConfirmed] = React.useState(null);
|
|
153
|
+
const changedLive = !!live && live !== v && confirmed !== v;
|
|
154
|
+
const host = env.urlPrefix?.replace(/^https?:\/\//, "");
|
|
155
|
+
const url = host ? `https://${host}${v}` : "";
|
|
156
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
157
|
+
className: "flex flex-col gap-1.5",
|
|
158
|
+
children: [
|
|
159
|
+
/* @__PURE__ */ jsx(Input, {
|
|
160
|
+
id,
|
|
161
|
+
value: v,
|
|
162
|
+
readOnly,
|
|
163
|
+
"aria-invalid": invalid,
|
|
164
|
+
placeholder: "empty-is-the-home-page",
|
|
165
|
+
className: cn(TEXT_FOCUS, "font-kit-mono"),
|
|
166
|
+
onChange: (e) => {
|
|
167
|
+
following.current = false;
|
|
168
|
+
onChange(slugTyping(e.target.value));
|
|
169
|
+
},
|
|
170
|
+
onBlur: () => {
|
|
171
|
+
const tidy = slugTidy(v);
|
|
172
|
+
if (tidy !== v) onChange(tidy);
|
|
173
|
+
onBlur?.();
|
|
174
|
+
}
|
|
175
|
+
}),
|
|
176
|
+
changedLive ? /* @__PURE__ */ jsxs("div", {
|
|
177
|
+
role: "status",
|
|
178
|
+
className: "flex flex-col gap-2 rounded-kit-md border border-kit-warning-line bg-kit-warning-soft px-3 py-2.5 text-kit-sm",
|
|
179
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
180
|
+
className: "flex items-start gap-1.5 text-kit-warning-fg",
|
|
181
|
+
children: [/* @__PURE__ */ jsx(IconAlertTriangle, {
|
|
182
|
+
className: "mt-0.5 size-4 shrink-0",
|
|
183
|
+
stroke: 1.5
|
|
184
|
+
}), /* @__PURE__ */ jsxs("span", { children: [
|
|
185
|
+
"The old address ",
|
|
186
|
+
/* @__PURE__ */ jsxs("span", {
|
|
187
|
+
className: "font-kit-mono",
|
|
188
|
+
children: ["/", live]
|
|
189
|
+
}),
|
|
190
|
+
" will stop working."
|
|
191
|
+
] })]
|
|
192
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
193
|
+
className: "flex gap-1.5",
|
|
194
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
195
|
+
size: "xs",
|
|
196
|
+
variant: "primary",
|
|
197
|
+
onClick: () => {
|
|
198
|
+
setConfirmed(v);
|
|
199
|
+
toast?.success("New address kept", { description: `/${live} will return “Not found”` });
|
|
200
|
+
},
|
|
201
|
+
children: "Use the new address"
|
|
202
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
203
|
+
size: "xs",
|
|
204
|
+
variant: "ghost",
|
|
205
|
+
onClick: () => {
|
|
206
|
+
following.current = false;
|
|
207
|
+
onChange(live);
|
|
208
|
+
},
|
|
209
|
+
children: "Keep the old slug"
|
|
210
|
+
})]
|
|
211
|
+
})]
|
|
212
|
+
}) : null,
|
|
213
|
+
url && host ? /* @__PURE__ */ jsx(AddressLine, {
|
|
214
|
+
url,
|
|
215
|
+
domain: host.replace(/\/.*$/, ""),
|
|
216
|
+
status: env.isPublished === void 0 ? void 0 : env.isPublished ? {
|
|
217
|
+
live: true,
|
|
218
|
+
label: "Live"
|
|
219
|
+
} : {
|
|
220
|
+
live: false,
|
|
221
|
+
label: "Not live yet"
|
|
222
|
+
},
|
|
223
|
+
onCopy: () => {
|
|
224
|
+
navigator.clipboard?.writeText(url).then(() => toast?.success("Address copied", { description: url }), () => toast?.("Couldn't copy the address", { description: "The browser blocked clipboard access." }));
|
|
225
|
+
},
|
|
226
|
+
children: env.isPublished ? /* @__PURE__ */ jsx(IconButton, {
|
|
227
|
+
size: "xs",
|
|
228
|
+
label: "Open live",
|
|
229
|
+
onClick: () => window.open(url, "_blank", "noopener"),
|
|
230
|
+
children: /* @__PURE__ */ jsx(IconExternalLink, { stroke: 1.5 })
|
|
231
|
+
}) : null
|
|
232
|
+
}) : null
|
|
233
|
+
]
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function splitTail(display) {
|
|
237
|
+
const cut = display.indexOf("/") >= 0 ? display.lastIndexOf("/") : -1;
|
|
238
|
+
let tail = cut > 0 ? display.slice(cut) : "";
|
|
239
|
+
if (tail.length > 18) tail = tail.slice(-14);
|
|
240
|
+
return [display.slice(0, display.length - tail.length), tail];
|
|
241
|
+
}
|
|
242
|
+
function AddressLine({ url, domain, status, onCopy, children }) {
|
|
243
|
+
const display = url.replace(/^https?:\/\//, "");
|
|
244
|
+
const [head, tail] = splitTail(display);
|
|
245
|
+
const domainPart = head.startsWith(domain) ? domain : "";
|
|
246
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
247
|
+
className: "flex h-6 min-w-0 items-center gap-2",
|
|
248
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
249
|
+
content: /* @__PURE__ */ jsx("span", {
|
|
250
|
+
className: "font-kit-mono",
|
|
251
|
+
children: display
|
|
252
|
+
}),
|
|
253
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
254
|
+
type: "button",
|
|
255
|
+
onClick: onCopy,
|
|
256
|
+
"aria-label": `Copy address ${url}`,
|
|
257
|
+
className: "-ml-1 flex h-6 min-w-0 items-center rounded-kit-md px-1 font-kit-mono text-kit-xs text-kit-fg-2 transition-colors hover:bg-kit-hover hover:text-kit-fg",
|
|
258
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
259
|
+
className: "min-w-0 truncate",
|
|
260
|
+
children: [domainPart ? /* @__PURE__ */ jsx("span", {
|
|
261
|
+
className: "text-kit-fg-3",
|
|
262
|
+
children: domainPart
|
|
263
|
+
}) : null, head.slice(domainPart.length)]
|
|
264
|
+
}), tail ? /* @__PURE__ */ jsx("span", {
|
|
265
|
+
className: "shrink-0 whitespace-pre",
|
|
266
|
+
children: tail
|
|
267
|
+
}) : null]
|
|
268
|
+
})
|
|
269
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
270
|
+
className: "ml-auto flex shrink-0 items-center gap-1.5",
|
|
271
|
+
children: [status ? /* @__PURE__ */ jsxs("span", {
|
|
272
|
+
className: "mr-0.5 inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap text-kit-xs text-kit-fg-2",
|
|
273
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
274
|
+
"aria-hidden": true,
|
|
275
|
+
className: cn("size-1.5 shrink-0 rounded-full", status.live ? "bg-kit-success" : "bg-kit-fg-4")
|
|
276
|
+
}), status.label]
|
|
277
|
+
}) : null, children ? /* @__PURE__ */ jsx("span", {
|
|
278
|
+
className: "flex items-center gap-0.5",
|
|
279
|
+
children
|
|
280
|
+
}) : null]
|
|
281
|
+
})]
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
//#endregion
|
|
285
|
+
export { EmailControl, SlugControl, SlugGenerate, StringControl, TEXT_FOCUS, TextControl, UrlControl, str };
|
|
286
|
+
|
|
287
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../../src/kit/controls/text.tsx"],"sourcesContent":["/**\n * TEXT — string · text · email · url · slug (V2 HEAD 9829bf1 kit/controls/text.tsx, DESIGN §8.2–8.3).\n * Founder rule: text grows to show its whole value, never clipped. Text entry gets NO focus ring or halo — the border\n * steps rest → hover → focus on the box only (prod CPO-069).\n *\n * Stored shapes (prod): string / longtext / email / slug / url (text + inputType \"url\") all store a plain string.\n * Slug keeps the backend's `^[a-z0-9]+(?:-[a-z0-9]+)*$`: keystrokes are filtered, and the stray hyphens typing leaves\n * (a trailing \"-\" before the next word) are tidied on blur.\n */\nimport * as React from \"react\";\nimport { IconAlertTriangle, IconExternalLink, IconMail, IconWorld } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { slugify } from \"../lib/utils\";\nimport { plainText } from \"../lib/schema\";\nimport { useForm, useKitEnv, useKitServices } from \"../context\";\nimport { Button, IconButton } from \"../ui/button\";\nimport { Input, Textarea } from \"../ui/input\";\nimport { Tooltip } from \"../ui/overlay\";\nimport type { ControlProps } from \"../types\";\n\nexport const str = (v: unknown) => (typeof v === \"string\" ? v : v == null ? \"\" : String(v));\n/** border-only focus (no halo) for text entry; `[&_input]` reaches the input inside an Input with leading/trailing */\nexport const TEXT_FOCUS = \"focus:shadow-none focus-visible:shadow-none [&_input]:focus:shadow-none\";\n\nexport function StringControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const { variant } = useKitEnv();\n return (\n <Textarea\n id={id}\n rows={1}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onKeyDown={(e) => e.key === \"Enter\" && e.preventDefault()}\n onChange={(e) => onChange(e.target.value.replace(/\\r?\\n/g, \" \"))}\n className={cn(TEXT_FOCUS, \"min-h-8 py-1.5 leading-5\", variant === \"document\" && \"min-h-9 py-2\")}\n />\n );\n}\n\nexport function TextControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n return (\n <Textarea\n id={id}\n rows={field.rows ?? 3}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onChange={(e) => onChange(e.target.value)}\n className={cn(TEXT_FOCUS, \"leading-5\")}\n />\n );\n}\n\nexport function EmailControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const { variant } = useKitEnv();\n return (\n <Input\n id={id}\n size={variant === \"document\" ? \"lg\" : \"md\"}\n type=\"email\"\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n onBlur={onBlur}\n placeholder={field.placeholder ?? \"name@company.com\"}\n leading={<IconMail stroke={1.5} />}\n onChange={(e) => onChange(e.target.value.trim())}\n className={TEXT_FOCUS}\n />\n );\n}\n\nexport function UrlControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const v = str(value);\n const { variant } = useKitEnv();\n const open = /^https?:\\/\\/\\S+/.test(v);\n return (\n <Input\n id={id}\n size={variant === \"document\" ? \"lg\" : \"md\"}\n value={v}\n readOnly={readOnly}\n aria-invalid={invalid}\n onBlur={onBlur}\n placeholder={field.placeholder ?? \"https://example.com\"}\n onChange={(e) => onChange(e.target.value.trim())}\n leading={<IconWorld stroke={1.5} />}\n className={cn(TEXT_FOCUS, \"[&_input]:text-kit-accent-fg\")}\n trailing={\n open ? (\n <Tooltip content=\"Open link in a new tab\">\n <button\n type=\"button\"\n aria-label=\"Open link\"\n className=\"pointer-events-auto flex rounded-kit-md p-0.5 hover:bg-kit-selected hover:text-kit-fg\"\n onClick={() => window.open(v, \"_blank\", \"noopener\")}\n >\n <IconExternalLink className=\"size-4\" stroke={1.5} />\n </button>\n </Tooltip>\n ) : undefined\n }\n />\n );\n}\n\n/* ── Slug ──────────────────────────────────────────────────────────── */\nconst TITLE_KEYS = [\"title\", \"name\", \"heading\", \"question\", \"label\"];\n/** The text a slug follows: the first title-like sibling, else the document title. */\nexport function slugSource(parent: Record<string, unknown> | undefined, docTitle?: string) {\n for (const k of TITLE_KEYS) {\n const t = plainText(parent?.[k]);\n if (t) return t;\n }\n return docTitle ?? \"\";\n}\n/** What a keystroke may leave in a slug: lowercase letters, digits and hyphens (spaces become hyphens). */\nexport const slugTyping = (s: string) => s.toLowerCase().replace(/\\s+/g, \"-\").replace(/[^a-z0-9-]/g, \"\");\n/** The stored slug: no leading, trailing or doubled hyphens (the backend's pattern). */\nexport const slugTidy = (s: string) => slugTyping(s).replace(/-+/g, \"-\").replace(/^-|-$/g, \"\");\n\n/** Label-row \"Generate\" for slug fields (ACTIONS.slug; prod: ghost button in the label row). */\nexport function SlugGenerate({ parent, value, onChange, readOnly }: Pick<ControlProps, \"parent\" | \"value\" | \"onChange\" | \"readOnly\">) {\n const { docTitle } = useKitEnv();\n const src = slugSource(parent, docTitle);\n if (readOnly || !src) return null;\n const next = slugify(src);\n if (!next) return null;\n return (\n <Tooltip content={`Generate from “${src.length > 32 ? `${src.slice(0, 30)}…` : src}”`}>\n <Button size=\"xs\" variant=\"ghost\" className=\"h-5 px-1.5 text-kit-xs text-kit-fg-2\" disabled={next === value} onClick={() => onChange(next)}>\n Generate\n </Button>\n </Tooltip>\n );\n}\n\nexport function SlugControl({ value, onChange, readOnly, id, invalid, parent, path, onBlur }: ControlProps) {\n const v = str(value);\n const env = useKitEnv();\n const form = useForm();\n const { toast } = useKitServices();\n const src = slugSource(parent, env.docTitle);\n /* Follows the title until someone edits it (CPO-087), only when the host says the document was never published:\n a host that cannot tell (the dock) leaves isPublished undefined and the slug never changes on its own. It reacts\n to a title edit, never to mounting, so opening a form writes nothing. */\n const following = React.useRef(env.isPublished === false && (v === \"\" || v === slugify(src)));\n const seenSrc = React.useRef(src);\n React.useEffect(() => {\n if (seenSrc.current === src) return;\n seenSrc.current = src;\n if (!following.current || readOnly) return;\n const next = slugify(src);\n if (next && next !== v) onChange(next);\n }, [src]); // eslint-disable-line react-hooks/exhaustive-deps\n\n /* the address the site serves today: the published value, else (published doc, no published copy) the mount value */\n const live = form?.hasPublished ? str(form.publishedAt(path)) : env.isPublished ? str(form?.baselineAt(path) ?? \"\") : \"\";\n const [confirmed, setConfirmed] = React.useState<string | null>(null);\n const changedLive = !!live && live !== v && confirmed !== v;\n const host = env.urlPrefix?.replace(/^https?:\\/\\//, \"\");\n const url = host ? `https://${host}${v}` : \"\";\n\n return (\n <div className=\"flex flex-col gap-1.5\">\n <Input\n id={id}\n value={v}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder=\"empty-is-the-home-page\"\n className={cn(TEXT_FOCUS, \"font-kit-mono\")}\n onChange={(e) => {\n following.current = false;\n onChange(slugTyping(e.target.value));\n }}\n onBlur={() => {\n const tidy = slugTidy(v);\n if (tidy !== v) onChange(tidy);\n onBlur?.();\n }}\n />\n {changedLive ? (\n <div role=\"status\" className=\"flex flex-col gap-2 rounded-kit-md border border-kit-warning-line bg-kit-warning-soft px-3 py-2.5 text-kit-sm\">\n <p className=\"flex items-start gap-1.5 text-kit-warning-fg\">\n <IconAlertTriangle className=\"mt-0.5 size-4 shrink-0\" stroke={1.5} />\n <span>\n The old address <span className=\"font-kit-mono\">/{live}</span> will stop working.\n </span>\n </p>\n <div className=\"flex gap-1.5\">\n <Button\n size=\"xs\"\n variant=\"primary\"\n onClick={() => {\n setConfirmed(v);\n toast?.success(\"New address kept\", { description: `/${live} will return “Not found”` });\n }}\n >\n Use the new address\n </Button>\n <Button\n size=\"xs\"\n variant=\"ghost\"\n onClick={() => {\n following.current = false;\n onChange(live);\n }}\n >\n Keep the old slug\n </Button>\n </div>\n </div>\n ) : null}\n {url && host ? (\n <AddressLine\n url={url}\n domain={host.replace(/\\/.*$/, \"\")}\n status={env.isPublished === undefined ? undefined : env.isPublished ? { live: true, label: \"Live\" } : { live: false, label: \"Not live yet\" }}\n onCopy={() => {\n void navigator.clipboard?.writeText(url).then(\n () => toast?.success(\"Address copied\", { description: url }),\n () => toast?.(\"Couldn't copy the address\", { description: \"The browser blocked clipboard access.\" }),\n );\n }}\n >\n {env.isPublished ? (\n <IconButton size=\"xs\" label=\"Open live\" onClick={() => window.open(url, \"_blank\", \"noopener\")}>\n <IconExternalLink stroke={1.5} />\n </IconButton>\n ) : null}\n </AddressLine>\n ) : null}\n </div>\n );\n}\n\n/* V2 features/hosting/address-line.tsx (D66): one calm line under the slug — the mono URL (middle-truncated so the slug\n end stays; full URL in the tooltip; copies on click) · the live state as a dot and a word · trailing icon buttons. */\nfunction splitTail(display: string): [string, string] {\n const cut = display.indexOf(\"/\") >= 0 ? display.lastIndexOf(\"/\") : -1;\n let tail = cut > 0 ? display.slice(cut) : \"\";\n if (tail.length > 18) tail = tail.slice(-14);\n return [display.slice(0, display.length - tail.length), tail];\n}\n\nfunction AddressLine({ url, domain, status, onCopy, children }: { url: string; domain: string; status?: { live: boolean; label: string }; onCopy: () => void; children?: React.ReactNode }) {\n const display = url.replace(/^https?:\\/\\//, \"\");\n const [head, tail] = splitTail(display);\n const domainPart = head.startsWith(domain) ? domain : \"\";\n return (\n <div className=\"flex h-6 min-w-0 items-center gap-2\">\n <Tooltip content={<span className=\"font-kit-mono\">{display}</span>}>\n <button\n type=\"button\"\n onClick={onCopy}\n aria-label={`Copy address ${url}`}\n className=\"-ml-1 flex h-6 min-w-0 items-center rounded-kit-md px-1 font-kit-mono text-kit-xs text-kit-fg-2 transition-colors hover:bg-kit-hover hover:text-kit-fg\"\n >\n <span className=\"min-w-0 truncate\">\n {domainPart ? <span className=\"text-kit-fg-3\">{domainPart}</span> : null}\n {head.slice(domainPart.length)}\n </span>\n {tail ? <span className=\"shrink-0 whitespace-pre\">{tail}</span> : null}\n </button>\n </Tooltip>\n <span className=\"ml-auto flex shrink-0 items-center gap-1.5\">\n {status ? (\n <span className=\"mr-0.5 inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap text-kit-xs text-kit-fg-2\">\n <span aria-hidden className={cn(\"size-1.5 shrink-0 rounded-full\", status.live ? \"bg-kit-success\" : \"bg-kit-fg-4\")} />\n {status.label}\n </span>\n ) : null}\n {children ? <span className=\"flex items-center gap-0.5\">{children}</span> : null}\n </span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,IAAa,OAAO,MAAgB,OAAO,MAAM,WAAW,IAAI,KAAK,OAAO,KAAK,OAAO,EAAE;;AAE1F,IAAa,aAAa;AAE1B,SAAgB,cAAc,EAAE,OAAO,OAAO,UAAU,UAAU,IAAI,SAAS,UAAwB;CACrG,MAAM,EAAE,YAAY,WAAW;AAC/B,QACE,oBAAC,UAAD;EACM;EACJ,MAAM;EACN,OAAO,IAAI,MAAM;EACP;EACV,gBAAc;EACd,aAAa,MAAM;EACX;EACR,YAAY,MAAM,EAAE,QAAQ,WAAW,EAAE,gBAAgB;EACzD,WAAW,MAAM,SAAS,EAAE,OAAO,MAAM,QAAQ,UAAU,IAAI,CAAC;EAChE,WAAW,GAAG,YAAY,4BAA4B,YAAY,cAAc,eAAe;EAC/F,CAAA;;AAIN,SAAgB,YAAY,EAAE,OAAO,OAAO,UAAU,UAAU,IAAI,SAAS,UAAwB;AACnG,QACE,oBAAC,UAAD;EACM;EACJ,MAAM,MAAM,QAAQ;EACpB,OAAO,IAAI,MAAM;EACP;EACV,gBAAc;EACd,aAAa,MAAM;EACX;EACR,WAAW,MAAM,SAAS,EAAE,OAAO,MAAM;EACzC,WAAW,GAAG,YAAY,YAAY;EACtC,CAAA;;AAIN,SAAgB,aAAa,EAAE,OAAO,OAAO,UAAU,UAAU,IAAI,SAAS,UAAwB;CACpG,MAAM,EAAE,YAAY,WAAW;AAC/B,QAC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,OAAO,CACzB;QACN,OAAO,oBAAC,QAAD;KAAM,WAAU;eAA2B;KAAY,CAAA,GAAG,KAC3D;;GACD,CAAA,EACV,qBAAC,QAAD;GAAM,WAAU;aAAhB,CACG,SACC,qBAAC,QAAD;IAAM,WAAU;cAAhB,CACE,oBAAC,QAAD;KAAM,eAAA;KAAY,WAAW,GAAG,kCAAkC,OAAO,OAAO,mBAAmB,cAAc;KAAI,CAAA,EACpH,OAAO,MACH;QACL,MACH,WAAW,oBAAC,QAAD;IAAM,WAAU;IAA6B;IAAgB,CAAA,GAAG,KACvE;KACH"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ARRAYS — compact PREVIEW ROWS that rest closed (CPO D8 + production; V2 HEAD 9829bf1 kit/engine/array.tsx): grip ·
|
|
3
|
+
* thumb · title + subtitle · validation dot · presence · always-visible ⋯ (Move up/down, Duplicate, Add above/below,
|
|
4
|
+
* Remove). Opening a row follows ONE rule (CPO D43): ≤3 simple fields expand inline, else it drills in (`openMode`
|
|
5
|
+
* overrides). Reorder by drag with layout animation; delete with an Undo toast; "Add {noun}" (a type menu when several
|
|
6
|
+
* item types); min/max honoured.
|
|
7
|
+
* Arrays of primitives render as a gallery (images), reference chips, or — for text, numbers and URLs — the ITEM LIST
|
|
8
|
+
* (CPO D47): one input per row, no drill. Arrays of one-field objects (`[{ text }]`) use the same item list. Small
|
|
9
|
+
* objects with an `included` / `isIncluded` switch get that switch as a check on the row itself.
|
|
10
|
+
*
|
|
11
|
+
* Host wiring (RowsHostContext): a drill row calls `drill(path)` (the frame push); without one it falls back to
|
|
12
|
+
* `form.navigate` while the form draws frames (`form.canNavigate`), else drill rows are inert (no button, no ›).
|
|
13
|
+
* Dialog items render the host's `NestedForm` (V2 kit-field NestedForm: its own navigation stack); without one the
|
|
14
|
+
* dialog shows the item's FieldList.
|
|
15
|
+
*
|
|
16
|
+
* Kit deviations from V2: sorting is `useDragReorder` (no @dnd-kit in the kit; it keeps dnd-kit's pointer and keyboard
|
|
17
|
+
* sensor semantics: Space / Enter picks up, arrows move, Space / Enter drops as one write, Escape cancels; the table editor's cross-list drag via
|
|
18
|
+
* `sortableId` is not ported); toasts come from KitServices (absent → silent); the gallery and reference-chip controls come from
|
|
19
|
+
* ARRAY_CONTROLS (registered by the controls lane); a host that never registered them edits the raw list (FallbackControl).
|
|
20
|
+
*/
|
|
21
|
+
import * as React from "react";
|
|
22
|
+
import type { ComponentType } from "react";
|
|
23
|
+
import type { FieldPath, FieldSchema } from "../schema/types";
|
|
24
|
+
import type { ControlProps } from "../types";
|
|
25
|
+
import { itemOpenMode, type Preview } from "../lib/schema";
|
|
26
|
+
/** V2 kit-field NestedForm's props: a dialog's own SchemaForm over `fields`, writing into the parent form at `path`. */
|
|
27
|
+
export interface NestedFormProps {
|
|
28
|
+
fields: FieldSchema[];
|
|
29
|
+
title: string;
|
|
30
|
+
icon?: string;
|
|
31
|
+
path: FieldPath;
|
|
32
|
+
navRef?: React.Ref<{
|
|
33
|
+
back: () => boolean;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
export interface RowsHost {
|
|
37
|
+
/** Push a frame for an item / block path (F7b frames). Default: `form.navigate` while `form.canNavigate`. */
|
|
38
|
+
drill?: (path: FieldPath) => void;
|
|
39
|
+
/** Dialog-mode items: V2's NestedForm (own navigation stack). Default: the item's FieldList. */
|
|
40
|
+
NestedForm?: ComponentType<NestedFormProps>;
|
|
41
|
+
}
|
|
42
|
+
export declare const RowsHostContext: React.Context<RowsHost>;
|
|
43
|
+
/** The frame push for a drill row, or undefined when nothing can draw the frame (the row is then inert). */
|
|
44
|
+
export declare function useDrill(): ((path: FieldPath) => void) | undefined;
|
|
45
|
+
/** Primitive-array controls V2 imports from controls/media (GalleryControl) and controls/reference (ReferencesControl). */
|
|
46
|
+
export declare const ARRAY_CONTROLS: {
|
|
47
|
+
gallery?: ComponentType<ControlProps>;
|
|
48
|
+
references?: ComponentType<ControlProps>;
|
|
49
|
+
};
|
|
50
|
+
export declare function ArrayField({ field, path }: {
|
|
51
|
+
field: FieldSchema;
|
|
52
|
+
path: FieldPath;
|
|
53
|
+
parent?: Record<string, unknown>;
|
|
54
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
export declare const rowToggleField: (s?: FieldSchema) => FieldSchema | undefined;
|
|
56
|
+
export interface RowModel {
|
|
57
|
+
id: string;
|
|
58
|
+
index: number;
|
|
59
|
+
item: unknown;
|
|
60
|
+
preview: Preview;
|
|
61
|
+
path: FieldPath;
|
|
62
|
+
chip?: string;
|
|
63
|
+
extra?: string;
|
|
64
|
+
/** an included-style switch that is OFF: the title reads muted */
|
|
65
|
+
dim?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/** Shared list operations (arrays and slots). Remove shows an Undo toast; add can drill into the new item. */
|
|
68
|
+
export declare function useListOps(field: FieldSchema, _path: FieldPath, list: unknown[], write: (next: unknown[]) => void, afterAdd?: (index: number) => void): {
|
|
69
|
+
atMax: boolean;
|
|
70
|
+
atMin: boolean;
|
|
71
|
+
add: (item: unknown, at?: number) => void;
|
|
72
|
+
duplicate: (i: number) => void;
|
|
73
|
+
move: (i: number, d: -1 | 1) => void;
|
|
74
|
+
reorder: (from: number, to: number) => void;
|
|
75
|
+
remove: (i: number, title: string) => void;
|
|
76
|
+
insertBlank: (at: number) => void;
|
|
77
|
+
};
|
|
78
|
+
export type ListOps = ReturnType<typeof useListOps>;
|
|
79
|
+
/** The row list used by arrays AND slots. Without `onOpen` the rows are inert (a drill nothing can draw yet). */
|
|
80
|
+
export declare function RowList({ field, rows, readOnly, layout, mode, openId, onOpen, onCloseInline, ops, renderInline, emptyLabel, addButton, leading, rowToggle, dialogNav, menuExtra, }: {
|
|
81
|
+
dialogNav?: React.RefObject<{
|
|
82
|
+
back: () => boolean;
|
|
83
|
+
} | null>;
|
|
84
|
+
field: FieldSchema;
|
|
85
|
+
rows: RowModel[];
|
|
86
|
+
readOnly: boolean;
|
|
87
|
+
layout: "list" | "grid";
|
|
88
|
+
mode: ReturnType<typeof itemOpenMode>;
|
|
89
|
+
openId: string | null;
|
|
90
|
+
onOpen?: (r: RowModel) => void;
|
|
91
|
+
onCloseInline: () => void;
|
|
92
|
+
ops: ListOps;
|
|
93
|
+
renderInline: (r: RowModel) => React.ReactNode;
|
|
94
|
+
emptyLabel: string;
|
|
95
|
+
addButton: React.ReactNode;
|
|
96
|
+
leading?: (r: RowModel) => React.ReactNode;
|
|
97
|
+
/** a control BEFORE the title button (never inside it): the included check of feature rows */
|
|
98
|
+
rowToggle?: (r: RowModel) => React.ReactNode;
|
|
99
|
+
/** extra items in a row's ⋯ menu, above Remove (a table row's "Move to group") */
|
|
100
|
+
menuExtra?: (r: RowModel) => React.ReactNode;
|
|
101
|
+
}): import("react/jsx-runtime").JSX.Element;
|