@coffer-org/web-ui 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -0
- package/dist/Markdown.d.ts +4 -0
- package/dist/Markdown.js +13 -0
- package/dist/MarkdownEditor.d.ts +6 -0
- package/dist/MarkdownEditor.js +83 -0
- package/dist/actions/ActionButton.d.ts +7 -0
- package/dist/actions/ActionButton.js +54 -0
- package/dist/actions/PopupBody.d.ts +4 -0
- package/dist/actions/PopupBody.js +8 -0
- package/dist/actions/TemplateHost.d.ts +4 -0
- package/dist/actions/TemplateHost.js +36 -0
- package/dist/actions/registry.d.ts +20 -0
- package/dist/actions/registry.js +9 -0
- package/dist/components/ExtendReasonInfo.d.ts +6 -0
- package/dist/components/ExtendReasonInfo.js +12 -0
- package/dist/components/FavoriteButton.d.ts +8 -0
- package/dist/components/FavoriteButton.js +7 -0
- package/dist/components/Icon.d.ts +6 -0
- package/dist/components/Icon.js +12 -0
- package/dist/components/PageBody.d.ts +4 -0
- package/dist/components/PageBody.js +4 -0
- package/dist/components/RecordInline.d.ts +8 -0
- package/dist/components/RecordInline.js +29 -0
- package/dist/components/SaveStatus.d.ts +1 -0
- package/dist/components/SaveStatus.js +11 -0
- package/dist/components/Toolbar.d.ts +5 -0
- package/dist/components/Toolbar.js +4 -0
- package/dist/components/icons/color.d.ts +2 -0
- package/dist/components/icons/color.js +10 -0
- package/dist/components/icons/flag.d.ts +2 -0
- package/dist/components/icons/flag.js +6 -0
- package/dist/components/icons/lucide.d.ts +2 -0
- package/dist/components/icons/lucide.js +111 -0
- package/dist/components/icons/registry.d.ts +4 -0
- package/dist/components/icons/registry.js +22 -0
- package/dist/components/icons/simple.d.ts +2 -0
- package/dist/components/icons/simple.js +15 -0
- package/dist/components/icons/tabler.d.ts +2 -0
- package/dist/components/icons/tabler.js +11 -0
- package/dist/components/ui/FieldLabel.d.ts +9 -0
- package/dist/components/ui/FieldLabel.js +4 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +19 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.js +33 -0
- package/dist/components/ui/calendar.d.ts +8 -0
- package/dist/components/ui/calendar.js +72 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/components/ui/card.js +16 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +8 -0
- package/dist/components/ui/chip-cls.d.ts +1 -0
- package/dist/components/ui/chip-cls.js +1 -0
- package/dist/components/ui/combobox.d.ts +24 -0
- package/dist/components/ui/combobox.js +58 -0
- package/dist/components/ui/confirm.d.ts +10 -0
- package/dist/components/ui/confirm.js +37 -0
- package/dist/components/ui/date-picker.d.ts +5 -0
- package/dist/components/ui/date-picker.js +16 -0
- package/dist/components/ui/dialog.d.ts +16 -0
- package/dist/components/ui/dialog.js +27 -0
- package/dist/components/ui/dropdown-menu.d.ts +15 -0
- package/dist/components/ui/dropdown-menu.js +18 -0
- package/dist/components/ui/input-group.d.ts +16 -0
- package/dist/components/ui/input-group.js +56 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +6 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.js +7 -0
- package/dist/components/ui/mask-input.d.ts +61 -0
- package/dist/components/ui/mask-input.js +1052 -0
- package/dist/components/ui/month-year-picker.d.ts +10 -0
- package/dist/components/ui/month-year-picker.js +46 -0
- package/dist/components/ui/option-icon.d.ts +15 -0
- package/dist/components/ui/option-icon.js +19 -0
- package/dist/components/ui/phone-input.d.ts +13 -0
- package/dist/components/ui/phone-input.js +53 -0
- package/dist/components/ui/popover.d.ts +11 -0
- package/dist/components/ui/popover.js +28 -0
- package/dist/components/ui/rating.d.ts +44 -0
- package/dist/components/ui/rating.js +501 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +11 -0
- package/dist/components/ui/select-combobox.d.ts +25 -0
- package/dist/components/ui/select-combobox.js +36 -0
- package/dist/components/ui/select.d.ts +13 -0
- package/dist/components/ui/select.js +24 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +7 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/switch.js +7 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +6 -0
- package/dist/components/ui/time-picker.d.ts +84 -0
- package/dist/components/ui/time-picker.js +1258 -0
- package/dist/components/visually-hidden-input.d.ts +10 -0
- package/dist/components/visually-hidden-input.js +96 -0
- package/dist/hooks/use-as-ref.d.ts +3 -0
- package/dist/hooks/use-as-ref.js +10 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +3 -0
- package/dist/hooks/use-isomorphic-layout-effect.js +3 -0
- package/dist/hooks/use-lazy-ref.d.ts +3 -0
- package/dist/hooks/use-lazy-ref.js +9 -0
- package/dist/hooks/use-media-query.d.ts +3 -0
- package/dist/hooks/use-media-query.js +26 -0
- package/dist/host-services.d.ts +47 -0
- package/dist/host-services.js +35 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +69 -0
- package/dist/layout.d.ts +29 -0
- package/dist/layout.js +323 -0
- package/dist/lib/cat-color.d.ts +1 -0
- package/dist/lib/cat-color.js +7 -0
- package/dist/lib/compose-refs.d.ts +5 -0
- package/dist/lib/compose-refs.js +38 -0
- package/dist/lib/date-format.d.ts +9 -0
- package/dist/lib/date-format.js +31 -0
- package/dist/lib/format.d.ts +14 -0
- package/dist/lib/format.js +34 -0
- package/dist/lib/json.d.ts +1 -0
- package/dist/lib/json.js +12 -0
- package/dist/lib/multi-value.d.ts +3 -0
- package/dist/lib/multi-value.js +22 -0
- package/dist/lib/record-option.d.ts +7 -0
- package/dist/lib/record-option.js +52 -0
- package/dist/lib/use-record-labels.d.ts +14 -0
- package/dist/lib/use-record-labels.js +130 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist/list-view.d.ts +26 -0
- package/dist/list-view.js +11 -0
- package/dist/markdown/blocks.d.ts +10 -0
- package/dist/markdown/blocks.js +57 -0
- package/dist/markdown/extensions.d.ts +6 -0
- package/dist/markdown/extensions.js +25 -0
- package/dist/markdown/slash.d.ts +23 -0
- package/dist/markdown/slash.js +27 -0
- package/dist/markdown/toolbar.d.ts +13 -0
- package/dist/markdown/toolbar.js +119 -0
- package/dist/plugin-ui.d.ts +43 -0
- package/dist/plugin-ui.js +37 -0
- package/dist/registry.d.ts +26 -0
- package/dist/registry.js +169 -0
- package/dist/render/blocks/accordion.d.ts +1 -0
- package/dist/render/blocks/accordion.js +15 -0
- package/dist/render/blocks/aside.d.ts +1 -0
- package/dist/render/blocks/aside.js +14 -0
- package/dist/render/blocks/balance.d.ts +1 -0
- package/dist/render/blocks/balance.js +14 -0
- package/dist/render/blocks/bento.d.ts +1 -0
- package/dist/render/blocks/bento.js +24 -0
- package/dist/render/blocks/block-shell.d.ts +15 -0
- package/dist/render/blocks/block-shell.js +20 -0
- package/dist/render/blocks/calendar.d.ts +1 -0
- package/dist/render/blocks/calendar.js +142 -0
- package/dist/render/blocks/callout.d.ts +1 -0
- package/dist/render/blocks/callout.js +21 -0
- package/dist/render/blocks/chart.d.ts +1 -0
- package/dist/render/blocks/chart.js +46 -0
- package/dist/render/blocks/compare.d.ts +1 -0
- package/dist/render/blocks/compare.js +16 -0
- package/dist/render/blocks/countdown.d.ts +1 -0
- package/dist/render/blocks/countdown.js +36 -0
- package/dist/render/blocks/deck.d.ts +1 -0
- package/dist/render/blocks/deck.js +29 -0
- package/dist/render/blocks/epigraph.d.ts +1 -0
- package/dist/render/blocks/epigraph.js +13 -0
- package/dist/render/blocks/facets.d.ts +1 -0
- package/dist/render/blocks/facets.js +23 -0
- package/dist/render/blocks/figure.d.ts +1 -0
- package/dist/render/blocks/figure.js +13 -0
- package/dist/render/blocks/grid.d.ts +1 -0
- package/dist/render/blocks/grid.js +21 -0
- package/dist/render/blocks/heatmap.d.ts +1 -0
- package/dist/render/blocks/heatmap.js +135 -0
- package/dist/render/blocks/idcard.d.ts +1 -0
- package/dist/render/blocks/idcard.js +30 -0
- package/dist/render/blocks/identity.d.ts +1 -0
- package/dist/render/blocks/identity.js +46 -0
- package/dist/render/blocks/index.d.ts +40 -0
- package/dist/render/blocks/index.js +40 -0
- package/dist/render/blocks/journal.d.ts +1 -0
- package/dist/render/blocks/journal.js +50 -0
- package/dist/render/blocks/ledger.d.ts +1 -0
- package/dist/render/blocks/ledger.js +23 -0
- package/dist/render/blocks/manifest.d.ts +1 -0
- package/dist/render/blocks/manifest.js +50 -0
- package/dist/render/blocks/masthead.d.ts +1 -0
- package/dist/render/blocks/masthead.js +15 -0
- package/dist/render/blocks/meter.d.ts +1 -0
- package/dist/render/blocks/meter.js +32 -0
- package/dist/render/blocks/nutrition.d.ts +1 -0
- package/dist/render/blocks/nutrition.js +27 -0
- package/dist/render/blocks/people.d.ts +1 -0
- package/dist/render/blocks/people.js +35 -0
- package/dist/render/blocks/plaque.d.ts +1 -0
- package/dist/render/blocks/plaque.js +15 -0
- package/dist/render/blocks/properties.d.ts +1 -0
- package/dist/render/blocks/properties.js +22 -0
- package/dist/render/blocks/prose.d.ts +1 -0
- package/dist/render/blocks/prose.js +17 -0
- package/dist/render/blocks/receipt.d.ts +1 -0
- package/dist/render/blocks/receipt.js +23 -0
- package/dist/render/blocks/registry.d.ts +16 -0
- package/dist/render/blocks/registry.js +7 -0
- package/dist/render/blocks/relation-source.d.ts +2 -0
- package/dist/render/blocks/relation-source.js +6 -0
- package/dist/render/blocks/route.d.ts +1 -0
- package/dist/render/blocks/route.js +23 -0
- package/dist/render/blocks/score.d.ts +1 -0
- package/dist/render/blocks/score.js +15 -0
- package/dist/render/blocks/series.d.ts +23 -0
- package/dist/render/blocks/series.js +57 -0
- package/dist/render/blocks/specimen.d.ts +1 -0
- package/dist/render/blocks/specimen.js +19 -0
- package/dist/render/blocks/split.d.ts +1 -0
- package/dist/render/blocks/split.js +15 -0
- package/dist/render/blocks/spread.d.ts +1 -0
- package/dist/render/blocks/spread.js +15 -0
- package/dist/render/blocks/stack.d.ts +1 -0
- package/dist/render/blocks/stack.js +15 -0
- package/dist/render/blocks/stats.d.ts +1 -0
- package/dist/render/blocks/stats.js +23 -0
- package/dist/render/blocks/status.d.ts +1 -0
- package/dist/render/blocks/status.js +18 -0
- package/dist/render/blocks/table.d.ts +11 -0
- package/dist/render/blocks/table.js +136 -0
- package/dist/render/blocks/tabs.d.ts +1 -0
- package/dist/render/blocks/tabs.js +17 -0
- package/dist/render/blocks/terminal.d.ts +1 -0
- package/dist/render/blocks/terminal.js +18 -0
- package/dist/render/blocks/timeline.d.ts +1 -0
- package/dist/render/blocks/timeline.js +31 -0
- package/dist/render/box.d.ts +5 -0
- package/dist/render/box.js +23 -0
- package/dist/render/chrome.d.ts +64 -0
- package/dist/render/chrome.js +92 -0
- package/dist/render/core/amount.d.ts +1 -0
- package/dist/render/core/amount.js +19 -0
- package/dist/render/core/attachment.d.ts +29 -0
- package/dist/render/core/attachment.js +102 -0
- package/dist/render/core/choice.d.ts +1 -0
- package/dist/render/core/choice.js +40 -0
- package/dist/render/core/composite.d.ts +1 -0
- package/dist/render/core/composite.js +132 -0
- package/dist/render/core/datetime.d.ts +2 -0
- package/dist/render/core/datetime.js +215 -0
- package/dist/render/core/dimensions.d.ts +1 -0
- package/dist/render/core/dimensions.js +44 -0
- package/dist/render/core/embed.d.ts +11 -0
- package/dist/render/core/embed.js +99 -0
- package/dist/render/core/file.d.ts +12 -0
- package/dist/render/core/file.js +238 -0
- package/dist/render/core/illustrated.d.ts +39 -0
- package/dist/render/core/illustrated.js +113 -0
- package/dist/render/core/index.d.ts +23 -0
- package/dist/render/core/index.js +23 -0
- package/dist/render/core/layout-elements.d.ts +1 -0
- package/dist/render/core/layout-elements.js +78 -0
- package/dist/render/core/localpath.d.ts +6 -0
- package/dist/render/core/localpath.js +73 -0
- package/dist/render/core/money.d.ts +1 -0
- package/dist/render/core/money.js +39 -0
- package/dist/render/core/number.d.ts +17 -0
- package/dist/render/core/number.js +104 -0
- package/dist/render/core/period.d.ts +1 -0
- package/dist/render/core/period.js +60 -0
- package/dist/render/core/range.d.ts +1 -0
- package/dist/render/core/range.js +55 -0
- package/dist/render/core/reminder.d.ts +2 -0
- package/dist/render/core/reminder.js +56 -0
- package/dist/render/core/source.d.ts +3 -0
- package/dist/render/core/source.js +65 -0
- package/dist/render/core/stepper.d.ts +1 -0
- package/dist/render/core/stepper.js +81 -0
- package/dist/render/core/storage-group.d.ts +1 -0
- package/dist/render/core/storage-group.js +30 -0
- package/dist/render/core/text.d.ts +15 -0
- package/dist/render/core/text.js +370 -0
- package/dist/render/core/tristate.d.ts +1 -0
- package/dist/render/core/tristate.js +42 -0
- package/dist/render/core/weight.d.ts +4 -0
- package/dist/render/core/weight.js +38 -0
- package/dist/render/dispatch.d.ts +12 -0
- package/dist/render/dispatch.js +53 -0
- package/dist/render/display-override.d.ts +25 -0
- package/dist/render/display-override.js +23 -0
- package/dist/render/editor-mode.d.ts +4 -0
- package/dist/render/editor-mode.js +11 -0
- package/dist/render/field-address.d.ts +14 -0
- package/dist/render/field-address.js +10 -0
- package/dist/render/field-errors.d.ts +8 -0
- package/dist/render/field-errors.js +25 -0
- package/dist/render/field-frame.d.ts +20 -0
- package/dist/render/field-frame.js +78 -0
- package/dist/render/field-scope.d.ts +8 -0
- package/dist/render/field-scope.js +25 -0
- package/dist/render/field-width.d.ts +7 -0
- package/dist/render/field-width.js +12 -0
- package/dist/render/form-types.d.ts +12 -0
- package/dist/render/form-types.js +1 -0
- package/dist/render/hybrid-scope.d.ts +5 -0
- package/dist/render/hybrid-scope.js +9 -0
- package/dist/render/image.d.ts +64 -0
- package/dist/render/image.js +322 -0
- package/dist/render/live-kind.d.ts +7 -0
- package/dist/render/live-kind.js +104 -0
- package/dist/render/markdown-view.d.ts +5 -0
- package/dist/render/markdown-view.js +17 -0
- package/dist/render/multi.d.ts +10 -0
- package/dist/render/multi.js +26 -0
- package/dist/render/multiple-chips.d.ts +24 -0
- package/dist/render/multiple-chips.js +18 -0
- package/dist/render/option-list.d.ts +15 -0
- package/dist/render/option-list.js +47 -0
- package/dist/render/option-value.d.ts +20 -0
- package/dist/render/option-value.js +41 -0
- package/dist/render/picker-scrim.d.ts +7 -0
- package/dist/render/picker-scrim.js +32 -0
- package/dist/render/picker-surface.d.ts +5 -0
- package/dist/render/picker-surface.js +9 -0
- package/dist/render/popover-field.d.ts +16 -0
- package/dist/render/popover-field.js +153 -0
- package/dist/render/record-save-ctx.d.ts +11 -0
- package/dist/render/record-save-ctx.js +41 -0
- package/dist/render/shared.d.ts +92 -0
- package/dist/render/shared.js +182 -0
- package/dist/render/slot.d.ts +45 -0
- package/dist/render/slot.js +194 -0
- package/dist/render/sort-rows.d.ts +3 -0
- package/dist/render/sort-rows.js +38 -0
- package/dist/render/use-collection-rows.d.ts +10 -0
- package/dist/render/use-collection-rows.js +11 -0
- package/dist/render/use-field-edit.d.ts +28 -0
- package/dist/render/use-field-edit.js +50 -0
- package/dist/render/use-file-upload.d.ts +10 -0
- package/dist/render/use-file-upload.js +35 -0
- package/dist/render/use-form-bridge.d.ts +21 -0
- package/dist/render/use-form-bridge.js +53 -0
- package/dist/render/use-hybrid.d.ts +2 -0
- package/dist/render/use-hybrid.js +5 -0
- package/dist/render/widgets/attachment-group.d.ts +1 -0
- package/dist/render/widgets/attachment-group.js +35 -0
- package/dist/render/widgets/checklist-content.d.ts +15 -0
- package/dist/render/widgets/checklist-content.js +12 -0
- package/dist/render/widgets/checklist-group.d.ts +11 -0
- package/dist/render/widgets/checklist-group.js +47 -0
- package/dist/render/widgets/checklist-row.d.ts +14 -0
- package/dist/render/widgets/checklist-row.js +14 -0
- package/dist/render/widgets/display.d.ts +33 -0
- package/dist/render/widgets/display.js +97 -0
- package/dist/render/widgets/edit.d.ts +63 -0
- package/dist/render/widgets/edit.js +283 -0
- package/dist/render/widgets/fixed-collection.d.ts +11 -0
- package/dist/render/widgets/fixed-collection.js +34 -0
- package/dist/render/widgets/flow-row.d.ts +14 -0
- package/dist/render/widgets/flow-row.js +27 -0
- package/dist/render/widgets/group-edit.d.ts +9 -0
- package/dist/render/widgets/group-edit.js +23 -0
- package/dist/render/widgets/group-field.d.ts +9 -0
- package/dist/render/widgets/group-field.js +42 -0
- package/dist/render/widgets/group-widgets.d.ts +2 -0
- package/dist/render/widgets/group-widgets.js +41 -0
- package/dist/render/widgets/group.d.ts +26 -0
- package/dist/render/widgets/group.js +139 -0
- package/dist/render/widgets/illustrated-group.d.ts +1 -0
- package/dist/render/widgets/illustrated-group.js +41 -0
- package/dist/render/widgets/table-group.d.ts +11 -0
- package/dist/render/widgets/table-group.js +58 -0
- package/dist/render/widgets/two-cell-group.d.ts +21 -0
- package/dist/render/widgets/two-cell-group.js +42 -0
- package/dist/render/widgets/url-widget.d.ts +7 -0
- package/dist/render/widgets/url-widget.js +15 -0
- package/dist/render/widgets/weekday-grid.d.ts +13 -0
- package/dist/render/widgets/weekday-grid.js +47 -0
- package/dist/render/write.d.ts +5 -0
- package/dist/render/write.js +14 -0
- package/dist/schema-registry.d.ts +6 -0
- package/dist/schema-registry.js +25 -0
- package/dist/site-links.d.ts +13 -0
- package/dist/site-links.js +18 -0
- package/dist/strip-markdown.d.ts +1 -0
- package/dist/strip-markdown.js +11 -0
- package/dist/theme.css +189 -0
- package/dist/types.d.ts +84 -0
- package/dist/types.js +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type InputValue = string[] | string;
|
|
3
|
+
interface VisuallyHiddenInputProps<T = InputValue> extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'checked' | 'onReset'> {
|
|
4
|
+
value?: T;
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
control: HTMLElement | null;
|
|
7
|
+
bubbles?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function VisuallyHiddenInput<T = InputValue>(props: VisuallyHiddenInputProps<T>): React.JSX.Element;
|
|
10
|
+
export { VisuallyHiddenInput };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
function VisuallyHiddenInput(props) {
|
|
5
|
+
const { control, value, checked, bubbles = true, type = 'hidden', style, ...inputProps } = props;
|
|
6
|
+
const isCheckInput = React.useMemo(() => type === 'checkbox' || type === 'radio' || type === 'switch', [type]);
|
|
7
|
+
const inputRef = React.useRef(null);
|
|
8
|
+
const prevValueRef = React.useRef({
|
|
9
|
+
value: isCheckInput ? checked : value,
|
|
10
|
+
previous: isCheckInput ? checked : value,
|
|
11
|
+
});
|
|
12
|
+
const prevValue = React.useMemo(() => {
|
|
13
|
+
const currentValue = isCheckInput ? checked : value;
|
|
14
|
+
if (prevValueRef.current.value !== currentValue) {
|
|
15
|
+
prevValueRef.current.previous = prevValueRef.current.value;
|
|
16
|
+
prevValueRef.current.value = currentValue;
|
|
17
|
+
}
|
|
18
|
+
return prevValueRef.current.previous;
|
|
19
|
+
}, [isCheckInput, value, checked]);
|
|
20
|
+
const [controlSize, setControlSize] = React.useState({});
|
|
21
|
+
React.useLayoutEffect(() => {
|
|
22
|
+
if (!control) {
|
|
23
|
+
setControlSize({});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
setControlSize({
|
|
27
|
+
width: control.offsetWidth,
|
|
28
|
+
height: control.offsetHeight,
|
|
29
|
+
});
|
|
30
|
+
if (typeof window === 'undefined')
|
|
31
|
+
return;
|
|
32
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
33
|
+
if (!Array.isArray(entries) || !entries.length)
|
|
34
|
+
return;
|
|
35
|
+
const entry = entries[0];
|
|
36
|
+
if (!entry)
|
|
37
|
+
return;
|
|
38
|
+
let width;
|
|
39
|
+
let height;
|
|
40
|
+
if ('borderBoxSize' in entry) {
|
|
41
|
+
const borderSizeEntry = entry.borderBoxSize;
|
|
42
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
43
|
+
width = borderSize.inlineSize;
|
|
44
|
+
height = borderSize.blockSize;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
width = control.offsetWidth;
|
|
48
|
+
height = control.offsetHeight;
|
|
49
|
+
}
|
|
50
|
+
setControlSize({ width, height });
|
|
51
|
+
});
|
|
52
|
+
resizeObserver.observe(control, { box: 'border-box' });
|
|
53
|
+
return () => {
|
|
54
|
+
resizeObserver.disconnect();
|
|
55
|
+
};
|
|
56
|
+
}, [control]);
|
|
57
|
+
React.useEffect(() => {
|
|
58
|
+
const input = inputRef.current;
|
|
59
|
+
if (!input)
|
|
60
|
+
return;
|
|
61
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
62
|
+
const propertyKey = isCheckInput ? 'checked' : 'value';
|
|
63
|
+
const eventType = isCheckInput ? 'click' : 'input';
|
|
64
|
+
const currentValue = isCheckInput ? checked : value;
|
|
65
|
+
const serializedCurrentValue = isCheckInput
|
|
66
|
+
? checked
|
|
67
|
+
: typeof value === 'object' && value !== null
|
|
68
|
+
? JSON.stringify(value)
|
|
69
|
+
: value;
|
|
70
|
+
const descriptor = Object.getOwnPropertyDescriptor(inputProto, propertyKey);
|
|
71
|
+
const setter = descriptor?.set;
|
|
72
|
+
if (prevValue !== currentValue && setter) {
|
|
73
|
+
const event = new Event(eventType, { bubbles });
|
|
74
|
+
setter.call(input, serializedCurrentValue);
|
|
75
|
+
input.dispatchEvent(event);
|
|
76
|
+
}
|
|
77
|
+
}, [prevValue, value, checked, bubbles, isCheckInput]);
|
|
78
|
+
const composedStyle = React.useMemo(() => {
|
|
79
|
+
return {
|
|
80
|
+
...style,
|
|
81
|
+
...(controlSize.width !== undefined && controlSize.height !== undefined ? controlSize : {}),
|
|
82
|
+
border: 0,
|
|
83
|
+
clip: 'rect(0 0 0 0)',
|
|
84
|
+
clipPath: 'inset(50%)',
|
|
85
|
+
height: '1px',
|
|
86
|
+
margin: '-1px',
|
|
87
|
+
overflow: 'hidden',
|
|
88
|
+
padding: 0,
|
|
89
|
+
position: 'absolute',
|
|
90
|
+
whiteSpace: 'nowrap',
|
|
91
|
+
width: '1px',
|
|
92
|
+
};
|
|
93
|
+
}, [style, controlSize]);
|
|
94
|
+
return (_jsx("input", { type: type, ...inputProps, ref: inputRef, "aria-hidden": isCheckInput, tabIndex: -1, defaultChecked: isCheckInput ? checked : undefined, style: composedStyle }));
|
|
95
|
+
}
|
|
96
|
+
export { VisuallyHiddenInput };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
3
|
+
function useAsRef(props) {
|
|
4
|
+
const ref = React.useRef(props);
|
|
5
|
+
useIsomorphicLayoutEffect(() => {
|
|
6
|
+
ref.current = props;
|
|
7
|
+
});
|
|
8
|
+
return ref;
|
|
9
|
+
}
|
|
10
|
+
export { useAsRef };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from 'react';
|
|
2
|
+
export function useMediaQuery(query, fallback = true) {
|
|
3
|
+
const subscribe = useCallback((onChange) => {
|
|
4
|
+
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
|
|
5
|
+
return () => { };
|
|
6
|
+
const mql = window.matchMedia(query);
|
|
7
|
+
mql.addEventListener('change', onChange);
|
|
8
|
+
return () => mql.removeEventListener('change', onChange);
|
|
9
|
+
}, [query]);
|
|
10
|
+
const snapshot = useCallback(() => {
|
|
11
|
+
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
|
|
12
|
+
return fallback;
|
|
13
|
+
return window.matchMedia(query).matches;
|
|
14
|
+
}, [query, fallback]);
|
|
15
|
+
return useSyncExternalStore(subscribe, snapshot, () => fallback);
|
|
16
|
+
}
|
|
17
|
+
export function breakpointPx(name, fallback) {
|
|
18
|
+
if (typeof window === 'undefined' || typeof getComputedStyle !== 'function')
|
|
19
|
+
return fallback;
|
|
20
|
+
const raw = getComputedStyle(document.documentElement).getPropertyValue(`--breakpoint-${name}`);
|
|
21
|
+
const n = Number.parseInt(raw.trim(), 10);
|
|
22
|
+
return Number.isFinite(n) && n > 0 ? n : fallback;
|
|
23
|
+
}
|
|
24
|
+
export function useMinWidth(name, fallback) {
|
|
25
|
+
return useMediaQuery(`(min-width: ${breakpointPx(name, fallback)}px)`, true);
|
|
26
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface ServerIssue {
|
|
2
|
+
field: string;
|
|
3
|
+
code: string;
|
|
4
|
+
params?: Record<string, unknown>;
|
|
5
|
+
path: (string | number)[];
|
|
6
|
+
}
|
|
7
|
+
export interface UploadedFile {
|
|
8
|
+
name: string;
|
|
9
|
+
mime?: string;
|
|
10
|
+
size?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface EmbedRec {
|
|
13
|
+
url: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
thumbnail?: string;
|
|
17
|
+
provider?: string;
|
|
18
|
+
type?: 'video' | 'rich' | 'photo' | 'link';
|
|
19
|
+
html?: string;
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface FsEntry {
|
|
24
|
+
name: string;
|
|
25
|
+
isDir: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const HOST_URL_SHAPES: {
|
|
28
|
+
readonly mediaUrl: (name: string) => string;
|
|
29
|
+
readonly uploadFile: "/api/upload";
|
|
30
|
+
readonly resolveEmbed: "/api/embed";
|
|
31
|
+
readonly listRecords: (library: string, shelf: string) => string;
|
|
32
|
+
readonly listDir: "/api/fs/list";
|
|
33
|
+
};
|
|
34
|
+
export interface HostServices {
|
|
35
|
+
mediaUrl(name: string): string;
|
|
36
|
+
uploadFile(file: File, onProgress?: (percent: number) => void): Promise<UploadedFile | null>;
|
|
37
|
+
resolveEmbed(url: string): Promise<EmbedRec | null>;
|
|
38
|
+
listRecords(library: string, shelf: string, filter?: Record<string, string>): Promise<Record<string, unknown>[]>;
|
|
39
|
+
listDir(path: string, exts?: string[]): Promise<FsEntry[]>;
|
|
40
|
+
}
|
|
41
|
+
export declare function registerHostServices(services: HostServices): void;
|
|
42
|
+
export declare function resetHostServices(): void;
|
|
43
|
+
export declare const mediaUrl: HostServices['mediaUrl'];
|
|
44
|
+
export declare const uploadFile: HostServices['uploadFile'];
|
|
45
|
+
export declare const resolveEmbed: HostServices['resolveEmbed'];
|
|
46
|
+
export declare const listRecords: HostServices['listRecords'];
|
|
47
|
+
export declare const listDir: HostServices['listDir'];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const HOST_URL_SHAPES = {
|
|
2
|
+
mediaUrl: (name) => `/uploads/${name}`,
|
|
3
|
+
uploadFile: '/api/upload',
|
|
4
|
+
resolveEmbed: '/api/embed',
|
|
5
|
+
listRecords: (library, shelf) => `/api/${library}/${shelf}`,
|
|
6
|
+
listDir: '/api/fs/list',
|
|
7
|
+
};
|
|
8
|
+
const MEMBERS = ['mediaUrl', 'uploadFile', 'resolveEmbed', 'listRecords', 'listDir'];
|
|
9
|
+
let host = null;
|
|
10
|
+
export function registerHostServices(services) {
|
|
11
|
+
if (!services || typeof services !== 'object') {
|
|
12
|
+
throw new Error('[web-ui] registerHostServices() needs an object of host services');
|
|
13
|
+
}
|
|
14
|
+
const missing = MEMBERS.filter((name) => typeof services[name] !== 'function');
|
|
15
|
+
if (missing.length) {
|
|
16
|
+
throw new Error(`[web-ui] registerHostServices() is missing ${missing.join(', ')} — ` +
|
|
17
|
+
`the host must supply every service the kit calls, not only the ones its own pages use`);
|
|
18
|
+
}
|
|
19
|
+
host = services;
|
|
20
|
+
}
|
|
21
|
+
export function resetHostServices() {
|
|
22
|
+
host = null;
|
|
23
|
+
}
|
|
24
|
+
function must() {
|
|
25
|
+
if (!host) {
|
|
26
|
+
throw new Error('[web-ui] host services are not registered — the application must call ' +
|
|
27
|
+
'registerHostServices() before the first render');
|
|
28
|
+
}
|
|
29
|
+
return host;
|
|
30
|
+
}
|
|
31
|
+
export const mediaUrl = (name) => must().mediaUrl(name);
|
|
32
|
+
export const uploadFile = (file, onProgress) => must().uploadFile(file, onProgress);
|
|
33
|
+
export const resolveEmbed = (url) => must().resolveEmbed(url);
|
|
34
|
+
export const listRecords = (library, shelf, filter) => must().listRecords(library, shelf, filter);
|
|
35
|
+
export const listDir = (path, exts) => must().listDir(path, exts);
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export * from './types.ts';
|
|
2
|
+
export * from './registry.ts';
|
|
3
|
+
export * from './schema-registry.ts';
|
|
4
|
+
export * from './host-services.ts';
|
|
5
|
+
export * from './list-view.ts';
|
|
6
|
+
export * from './plugin-ui.ts';
|
|
7
|
+
export * from './site-links.ts';
|
|
8
|
+
export * from './lib/utils.ts';
|
|
9
|
+
export * from './lib/date-format.ts';
|
|
10
|
+
export * from './hooks/use-as-ref.ts';
|
|
11
|
+
export * from './hooks/use-isomorphic-layout-effect.ts';
|
|
12
|
+
export * from './hooks/use-lazy-ref.ts';
|
|
13
|
+
export * from './components/Icon.tsx';
|
|
14
|
+
export * from './components/PageBody.tsx';
|
|
15
|
+
export * from './components/SaveStatus.tsx';
|
|
16
|
+
export * from './components/Toolbar.tsx';
|
|
17
|
+
export * from './components/FavoriteButton.tsx';
|
|
18
|
+
export * from './components/ExtendReasonInfo.tsx';
|
|
19
|
+
export * from './components/visually-hidden-input.tsx';
|
|
20
|
+
export * from './components/RecordInline.tsx';
|
|
21
|
+
export * from './components/ui/badge.tsx';
|
|
22
|
+
export * from './components/ui/button.tsx';
|
|
23
|
+
export * from './components/ui/calendar.tsx';
|
|
24
|
+
export * from './components/ui/card.tsx';
|
|
25
|
+
export * from './components/ui/checkbox.tsx';
|
|
26
|
+
export * from './components/ui/chip-cls.ts';
|
|
27
|
+
export * from './components/ui/confirm.tsx';
|
|
28
|
+
export * from './components/ui/date-picker.tsx';
|
|
29
|
+
export * from './components/ui/dialog.tsx';
|
|
30
|
+
export * from './components/ui/dropdown-menu.tsx';
|
|
31
|
+
export * from './components/ui/FieldLabel.tsx';
|
|
32
|
+
export * from './components/ui/input-group.tsx';
|
|
33
|
+
export * from './components/ui/input.tsx';
|
|
34
|
+
export * from './components/ui/label.tsx';
|
|
35
|
+
export * from './components/ui/mask-input.tsx';
|
|
36
|
+
export * from './components/ui/month-year-picker.tsx';
|
|
37
|
+
export * from './components/ui/option-icon.tsx';
|
|
38
|
+
export * from './components/ui/phone-input.tsx';
|
|
39
|
+
export * from './components/ui/popover.tsx';
|
|
40
|
+
export * from './components/ui/rating.tsx';
|
|
41
|
+
export * from './components/ui/scroll-area.tsx';
|
|
42
|
+
export * from './components/ui/select-combobox.tsx';
|
|
43
|
+
export * from './components/ui/select.tsx';
|
|
44
|
+
export * from './components/ui/separator.tsx';
|
|
45
|
+
export * from './components/ui/switch.tsx';
|
|
46
|
+
export * from './components/ui/textarea.tsx';
|
|
47
|
+
export * from './components/ui/time-picker.tsx';
|
|
48
|
+
export * from './render/option-list.tsx';
|
|
49
|
+
export * from './render/multiple-chips.tsx';
|
|
50
|
+
export * from './render/record-save-ctx.tsx';
|
|
51
|
+
export * from './layout.tsx';
|
|
52
|
+
export * from './lib/json.ts';
|
|
53
|
+
export * from './lib/multi-value.ts';
|
|
54
|
+
export * from './lib/use-record-labels.ts';
|
|
55
|
+
export * from './hooks/use-media-query.ts';
|
|
56
|
+
export * from './render/dispatch.tsx';
|
|
57
|
+
export { type Commit } from './render/write.ts';
|
|
58
|
+
export { type SlotHandle, useSlot, useSlotOptional, useSlotRender, useSlots, SlotProvider, SlotScope, Slot, SlotEditor, SlotValue, } from './render/slot.tsx';
|
|
59
|
+
export { DEFAULT_SECTION_ICON, PAGE_STACK, FieldLabel as RenderFieldLabel, FieldError } from './render/chrome.tsx';
|
|
60
|
+
export * from './render/field-errors.tsx';
|
|
61
|
+
export * from './render/field-frame.tsx';
|
|
62
|
+
export * from './render/form-types.ts';
|
|
63
|
+
export * from './render/hybrid-scope.tsx';
|
|
64
|
+
export * from './render/image.tsx';
|
|
65
|
+
export * from './render/picker-scrim.tsx';
|
|
66
|
+
export { hasValue, firstCoverKey, useTranslation, MultiTagInput } from './render/shared.tsx';
|
|
67
|
+
export * from './render/sort-rows.ts';
|
|
68
|
+
export * from './render/use-form-bridge.ts';
|
|
69
|
+
export * from './render/widgets/display.tsx';
|
|
70
|
+
export * from './actions/registry.ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./registry.js";
|
|
3
|
+
export * from "./schema-registry.js";
|
|
4
|
+
export * from "./host-services.js";
|
|
5
|
+
export * from "./list-view.js";
|
|
6
|
+
export * from "./plugin-ui.js";
|
|
7
|
+
export * from "./site-links.js";
|
|
8
|
+
export * from "./lib/utils.js";
|
|
9
|
+
export * from "./lib/date-format.js";
|
|
10
|
+
export * from "./hooks/use-as-ref.js";
|
|
11
|
+
export * from "./hooks/use-isomorphic-layout-effect.js";
|
|
12
|
+
export * from "./hooks/use-lazy-ref.js";
|
|
13
|
+
export * from "./components/Icon.js";
|
|
14
|
+
export * from "./components/PageBody.js";
|
|
15
|
+
export * from "./components/SaveStatus.js";
|
|
16
|
+
export * from "./components/Toolbar.js";
|
|
17
|
+
export * from "./components/FavoriteButton.js";
|
|
18
|
+
export * from "./components/ExtendReasonInfo.js";
|
|
19
|
+
export * from "./components/visually-hidden-input.js";
|
|
20
|
+
export * from "./components/RecordInline.js";
|
|
21
|
+
export * from "./components/ui/badge.js";
|
|
22
|
+
export * from "./components/ui/button.js";
|
|
23
|
+
export * from "./components/ui/calendar.js";
|
|
24
|
+
export * from "./components/ui/card.js";
|
|
25
|
+
export * from "./components/ui/checkbox.js";
|
|
26
|
+
export * from "./components/ui/chip-cls.js";
|
|
27
|
+
export * from "./components/ui/confirm.js";
|
|
28
|
+
export * from "./components/ui/date-picker.js";
|
|
29
|
+
export * from "./components/ui/dialog.js";
|
|
30
|
+
export * from "./components/ui/dropdown-menu.js";
|
|
31
|
+
export * from "./components/ui/FieldLabel.js";
|
|
32
|
+
export * from "./components/ui/input-group.js";
|
|
33
|
+
export * from "./components/ui/input.js";
|
|
34
|
+
export * from "./components/ui/label.js";
|
|
35
|
+
export * from "./components/ui/mask-input.js";
|
|
36
|
+
export * from "./components/ui/month-year-picker.js";
|
|
37
|
+
export * from "./components/ui/option-icon.js";
|
|
38
|
+
export * from "./components/ui/phone-input.js";
|
|
39
|
+
export * from "./components/ui/popover.js";
|
|
40
|
+
export * from "./components/ui/rating.js";
|
|
41
|
+
export * from "./components/ui/scroll-area.js";
|
|
42
|
+
export * from "./components/ui/select-combobox.js";
|
|
43
|
+
export * from "./components/ui/select.js";
|
|
44
|
+
export * from "./components/ui/separator.js";
|
|
45
|
+
export * from "./components/ui/switch.js";
|
|
46
|
+
export * from "./components/ui/textarea.js";
|
|
47
|
+
export * from "./components/ui/time-picker.js";
|
|
48
|
+
export * from "./render/option-list.js";
|
|
49
|
+
export * from "./render/multiple-chips.js";
|
|
50
|
+
export * from "./render/record-save-ctx.js";
|
|
51
|
+
export * from "./layout.js";
|
|
52
|
+
export * from "./lib/json.js";
|
|
53
|
+
export * from "./lib/multi-value.js";
|
|
54
|
+
export * from "./lib/use-record-labels.js";
|
|
55
|
+
export * from "./hooks/use-media-query.js";
|
|
56
|
+
export * from "./render/dispatch.js";
|
|
57
|
+
export { useSlot, useSlotOptional, useSlotRender, useSlots, SlotProvider, SlotScope, Slot, SlotEditor, SlotValue, } from "./render/slot.js";
|
|
58
|
+
export { DEFAULT_SECTION_ICON, PAGE_STACK, FieldLabel as RenderFieldLabel, FieldError } from "./render/chrome.js";
|
|
59
|
+
export * from "./render/field-errors.js";
|
|
60
|
+
export * from "./render/field-frame.js";
|
|
61
|
+
export * from "./render/form-types.js";
|
|
62
|
+
export * from "./render/hybrid-scope.js";
|
|
63
|
+
export * from "./render/image.js";
|
|
64
|
+
export * from "./render/picker-scrim.js";
|
|
65
|
+
export { hasValue, firstCoverKey, useTranslation, MultiTagInput } from "./render/shared.js";
|
|
66
|
+
export * from "./render/sort-rows.js";
|
|
67
|
+
export * from "./render/use-form-bridge.js";
|
|
68
|
+
export * from "./render/widgets/display.js";
|
|
69
|
+
export * from "./actions/registry.js";
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { FieldMeta, LayoutEl, ContainerNode } from '@coffer-org/sdk/fields';
|
|
3
|
+
import { type GroupTone } from './render/chrome.tsx';
|
|
4
|
+
import type { FormBridge } from './render/form-types.ts';
|
|
5
|
+
import type { FieldMode } from './types.ts';
|
|
6
|
+
export interface LayoutRenderCtx {
|
|
7
|
+
bridge?: FormBridge;
|
|
8
|
+
renderField?: (key: string, field: FieldMeta) => ReactNode | null;
|
|
9
|
+
renderGroup?: (key: string, group: ContainerNode) => ReactNode | null;
|
|
10
|
+
values?: Record<string, unknown>;
|
|
11
|
+
setValue?: (key: string, v: unknown) => void | Promise<string | undefined>;
|
|
12
|
+
isHidden?: (key: string) => boolean;
|
|
13
|
+
mode?: FieldMode;
|
|
14
|
+
}
|
|
15
|
+
export declare function SectionShell({ label, icon, labelAfter, children, rail, tone, }: {
|
|
16
|
+
label?: string;
|
|
17
|
+
icon?: string;
|
|
18
|
+
labelAfter?: ReactNode;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
rail?: boolean;
|
|
21
|
+
tone?: GroupTone;
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
export declare function LabelledDivider({ label }: {
|
|
24
|
+
label: string;
|
|
25
|
+
}): React.JSX.Element;
|
|
26
|
+
export declare function LayoutRenderer({ items, ctx }: {
|
|
27
|
+
items: LayoutEl[];
|
|
28
|
+
ctx: LayoutRenderCtx;
|
|
29
|
+
}): React.JSX.Element | null;
|