@krizaka/ui 3.64.1 → 3.66.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 +3 -0
- package/dist/account-menu.d.ts +7 -3
- package/dist/account-menu.js +14 -10
- package/dist/account-menu.js.map +1 -1
- package/dist/account-settings.js +1 -1
- package/dist/action-bar.js +1 -1
- package/dist/app-frame/server.d.ts +123 -0
- package/dist/app-frame/server.js +109 -0
- package/dist/app-frame/server.js.map +1 -0
- package/dist/app-frame.d.ts +210 -0
- package/dist/app-frame.js +220 -0
- package/dist/app-frame.js.map +1 -0
- package/dist/app-header/search.js +1 -1
- package/dist/app-header.d.ts +3 -3
- package/dist/app-shell.js +1 -1
- package/dist/argument-card.js +2 -2
- package/dist/audio-player.js +1 -1
- package/dist/{chunk-5QEXOGO2.js → chunk-6BMKLAZ7.js} +1 -1
- package/dist/{chunk-XCBVFMNV.js.map → chunk-6BMKLAZ7.js.map} +1 -1
- package/dist/{chunk-SHBYNQFS.js → chunk-7DYZTEE3.js} +1 -1
- package/dist/{chunk-SHBYNQFS.js.map → chunk-7DYZTEE3.js.map} +1 -1
- package/dist/{chunk-YCZ7N6Q6.js → chunk-7MQNG35Q.js} +2 -2
- package/dist/{chunk-XCBVFMNV.js → chunk-C57KK5VB.js} +7 -2
- package/dist/chunk-C57KK5VB.js.map +1 -0
- package/dist/{chunk-VB7MWE2N.js → chunk-DSDFXPL6.js} +2 -2
- package/dist/{chunk-P7GZR5CU.js → chunk-GFRUTPGG.js} +1 -1
- package/dist/{chunk-P7GZR5CU.js.map → chunk-GFRUTPGG.js.map} +1 -1
- package/dist/{chunk-4GQH27IT.js → chunk-GW5EI7MI.js} +2 -2
- package/dist/{chunk-F6JTHPHE.js → chunk-I6EOLPSH.js} +2 -2
- package/dist/chunk-NG6G6V5E.js +33 -0
- package/dist/{chunk-5QEXOGO2.js.map → chunk-NG6G6V5E.js.map} +1 -1
- package/dist/{chunk-CPA5CF35.js → chunk-PGBF3UBX.js} +1 -1
- package/dist/{chunk-CPA5CF35.js.map → chunk-PGBF3UBX.js.map} +1 -1
- package/dist/{chunk-BG5APGX6.js → chunk-Q5DYWQ6S.js} +4 -4
- package/dist/{chunk-RCKXJEDQ.js → chunk-ST5P5HNI.js} +2 -2
- package/dist/code-block.js +1 -1
- package/dist/collection-switcher.d.ts +68 -0
- package/dist/collection-switcher.js +131 -0
- package/dist/collection-switcher.js.map +1 -0
- package/dist/combobox.js +2 -2
- package/dist/cover-hero.js +1 -1
- package/dist/data-table.js +4 -4
- package/dist/date-picker.js +1 -1
- package/dist/decision-list.js +1 -1
- package/dist/default-avatar-D9kiSFNB.d.ts +26 -0
- package/dist/desktop-window.d.ts +223 -0
- package/dist/desktop-window.js +261 -0
- package/dist/desktop-window.js.map +1 -0
- package/dist/docs-layout.js +1 -1
- package/dist/entity-header.d.ts +92 -0
- package/dist/entity-header.js +165 -0
- package/dist/entity-header.js.map +1 -0
- package/dist/file-upload.d.ts +2 -2
- package/dist/file-upload.js +1 -1
- package/dist/filter-bar.d.ts +3 -3
- package/dist/filter-bar.js +2 -2
- package/dist/genui.js +4 -4
- package/dist/language-switch.d.ts +9 -9
- package/dist/link-card.js +2 -2
- package/dist/list.js +1 -1
- package/dist/media-capture.js +1 -1
- package/dist/native.d.ts +337 -4
- package/dist/native.js +2841 -2111
- package/dist/native.js.map +1 -1
- package/dist/opening-hours.js +1 -1
- package/dist/page-hero.js +1 -1
- package/dist/pagination.js +1 -1
- package/dist/photo-grid.js +1 -1
- package/dist/pricing-page.js.map +1 -1
- package/dist/qr-code.d.ts +42 -0
- package/dist/qr-code.js +350 -0
- package/dist/qr-code.js.map +1 -0
- package/dist/radio-group.js +1 -1
- package/dist/rail-nav.js +1 -1
- package/dist/retro-tv.js +2 -2
- package/dist/search-field.js +2 -2
- package/dist/service-card.js +1 -1
- package/dist/shop-composer.js +1 -1
- package/dist/shop-composer.js.map +1 -1
- package/dist/site-cahier.js +1 -1
- package/dist/status-chip.js +1 -1
- package/dist/tag-input.js +2 -2
- package/dist/terminal-replay.js +1 -1
- package/dist/theme.d.ts +3 -1
- package/dist/theme.js +4 -0
- package/dist/theme.js.map +1 -1
- package/dist/tree-view.js +1 -1
- package/dist/video-player.js +2 -2
- package/dist/virtual.d.ts +3 -3
- package/package.json +91 -6
- package/registry/account-menu.json +22 -8
- package/registry/account-settings.json +2 -2
- package/registry/achievement.json +1 -1
- package/registry/action-bar.json +2 -2
- package/registry/activity-feed.json +1 -1
- package/registry/agenda.json +1 -1
- package/registry/alert.json +1 -1
- package/registry/analysis-report.json +1 -1
- package/registry/anatomy-plate.json +1 -1
- package/registry/app-frame.json +564 -0
- package/registry/app-header.json +2 -2
- package/registry/app-shell.json +2 -2
- package/registry/argument-card.json +2 -2
- package/registry/audio-player.json +2 -2
- package/registry/auth-layout.json +1 -1
- package/registry/avatar.json +1 -1
- package/registry/badge.json +1 -1
- package/registry/bird-plate.json +1 -1
- package/registry/button.json +1 -1
- package/registry/captcha.json +1 -1
- package/registry/card-grid.json +1 -1
- package/registry/card.json +1 -1
- package/registry/catalogue-page.json +1 -1
- package/registry/changelog-page.json +1 -1
- package/registry/chapter.json +1 -1
- package/registry/chat.json +1 -1
- package/registry/checkbox.json +1 -1
- package/registry/chip-link.json +1 -1
- package/registry/chip-row.json +1 -1
- package/registry/chip.json +1 -1
- package/registry/choice-grid.json +1 -1
- package/registry/code-block.json +2 -2
- package/registry/collection-switcher.json +436 -0
- package/registry/combobox.json +2 -2
- package/registry/command.json +1 -1
- package/registry/comparison-table.json +1 -1
- package/registry/component-page.json +1 -1
- package/registry/confirm-button.json +1 -1
- package/registry/contact-page.json +1 -1
- package/registry/continue-prompt.json +1 -1
- package/registry/countdown.json +1 -1
- package/registry/cover-hero.json +2 -2
- package/registry/cta-panel.json +1 -1
- package/registry/dashboard-layout.json +1 -1
- package/registry/data-table.json +2 -2
- package/registry/date-picker.json +4 -4
- package/registry/decision-list.json +2 -2
- package/registry/description-list.json +1 -1
- package/registry/desktop-window.json +407 -0
- package/registry/detail-layout.json +1 -1
- package/registry/dialog.json +1 -1
- package/registry/docs-article-page.json +1 -1
- package/registry/docs-hub-page.json +1 -1
- package/registry/docs-layout.json +2 -2
- package/registry/docs-nav.json +1 -1
- package/registry/document-viewer.json +1 -1
- package/registry/doodle.json +1 -1
- package/registry/drop-overlay.json +1 -1
- package/registry/dropdown-menu.json +1 -1
- package/registry/elephant.json +2 -2
- package/registry/embed-facade.json +1 -1
- package/registry/empty-state.json +1 -1
- package/registry/engine-flow.json +1 -1
- package/registry/entity-header.json +502 -0
- package/registry/environment-notice.json +1 -1
- package/registry/error-page.json +1 -1
- package/registry/examples/app-frame/admin.d.ts +4 -0
- package/registry/examples/app-frame/admin.js +32 -0
- package/registry/examples/app-frame/admin.tsx +33 -0
- package/registry/examples/app-frame/app.d.ts +4 -0
- package/registry/examples/app-frame/app.js +53 -0
- package/registry/examples/app-frame/app.tsx +56 -0
- package/registry/examples/collection-switcher/entity.d.ts +4 -0
- package/registry/examples/collection-switcher/entity.js +17 -0
- package/registry/examples/collection-switcher/entity.tsx +13 -0
- package/registry/examples/collection-switcher/list.d.ts +4 -0
- package/registry/examples/collection-switcher/list.js +32 -0
- package/registry/examples/collection-switcher/list.tsx +27 -0
- package/registry/examples/collection-switcher/native/list.d.ts +4 -0
- package/registry/examples/collection-switcher/native/list.dark.png +0 -0
- package/registry/examples/collection-switcher/native/list.js +18 -0
- package/registry/examples/collection-switcher/native/list.light.png +0 -0
- package/registry/examples/collection-switcher/native/list.tsx +14 -0
- package/registry/examples/collection-switcher/tree.d.ts +4 -0
- package/registry/examples/collection-switcher/tree.js +19 -0
- package/registry/examples/collection-switcher/tree.tsx +15 -0
- package/registry/examples/desktop-window/library.d.ts +4 -0
- package/registry/examples/desktop-window/library.js +49 -0
- package/registry/examples/desktop-window/library.tsx +58 -0
- package/registry/examples/entity-header/basic.d.ts +4 -0
- package/registry/examples/entity-header/basic.js +31 -0
- package/registry/examples/entity-header/basic.tsx +25 -0
- package/registry/examples/entity-header/native/basic.d.ts +4 -0
- package/registry/examples/entity-header/native/basic.dark.png +0 -0
- package/registry/examples/entity-header/native/basic.js +17 -0
- package/registry/examples/entity-header/native/basic.light.png +0 -0
- package/registry/examples/entity-header/native/basic.tsx +12 -0
- package/registry/examples/form-flow/native/signup.d.ts +4 -0
- package/registry/examples/form-flow/native/signup.dark.png +0 -0
- package/registry/examples/form-flow/native/signup.js +26 -0
- package/registry/examples/form-flow/native/signup.light.png +0 -0
- package/registry/examples/form-flow/native/signup.tsx +23 -0
- package/registry/examples/grid/native/columns.d.ts +4 -0
- package/registry/examples/grid/native/columns.dark.png +0 -0
- package/registry/examples/grid/native/columns.js +23 -0
- package/registry/examples/grid/native/columns.light.png +0 -0
- package/registry/examples/grid/native/columns.tsx +20 -0
- package/registry/examples/grid/native/photos.d.ts +4 -0
- package/registry/examples/grid/native/photos.dark.png +0 -0
- package/registry/examples/grid/native/photos.js +14 -0
- package/registry/examples/grid/native/photos.light.png +0 -0
- package/registry/examples/grid/native/photos.tsx +18 -0
- package/registry/examples/grid/native/stats.d.ts +4 -0
- package/registry/examples/grid/native/stats.dark.png +0 -0
- package/registry/examples/grid/native/stats.js +22 -0
- package/registry/examples/grid/native/stats.light.png +0 -0
- package/registry/examples/grid/native/stats.tsx +24 -0
- package/registry/examples/list-detail/native/inbox.d.ts +4 -0
- package/registry/examples/list-detail/native/inbox.dark.png +0 -0
- package/registry/examples/list-detail/native/inbox.js +35 -0
- package/registry/examples/list-detail/native/inbox.light.png +0 -0
- package/registry/examples/list-detail/native/inbox.tsx +35 -0
- package/registry/examples/qr-code/basic.d.ts +4 -0
- package/registry/examples/qr-code/basic.js +11 -0
- package/registry/examples/qr-code/basic.tsx +6 -0
- package/registry/examples/qr-code/calendar-feed.d.ts +4 -0
- package/registry/examples/qr-code/calendar-feed.js +24 -0
- package/registry/examples/qr-code/calendar-feed.tsx +18 -0
- package/registry/examples/qr-code/native/calendar-feed.d.ts +4 -0
- package/registry/examples/qr-code/native/calendar-feed.dark.png +0 -0
- package/registry/examples/qr-code/native/calendar-feed.js +25 -0
- package/registry/examples/qr-code/native/calendar-feed.light.png +0 -0
- package/registry/examples/qr-code/native/calendar-feed.tsx +19 -0
- package/registry/examples/screen/native/dashboard.d.ts +4 -0
- package/registry/examples/screen/native/dashboard.dark.png +0 -0
- package/registry/examples/screen/native/dashboard.js +48 -0
- package/registry/examples/screen/native/dashboard.light.png +0 -0
- package/registry/examples/screen/native/dashboard.tsx +52 -0
- package/registry/examples/screen/native/settings-home.d.ts +4 -0
- package/registry/examples/screen/native/settings-home.dark.png +0 -0
- package/registry/examples/screen/native/settings-home.js +26 -0
- package/registry/examples/screen/native/settings-home.light.png +0 -0
- package/registry/examples/screen/native/settings-home.tsx +25 -0
- package/registry/examples/shop/hero-tv.js +1 -1
- package/registry/examples/shop/hero-tv.tsx +1 -1
- package/registry/examples/state-screen/native/empty.d.ts +4 -0
- package/registry/examples/state-screen/native/empty.dark.png +0 -0
- package/registry/examples/state-screen/native/empty.js +12 -0
- package/registry/examples/state-screen/native/empty.light.png +0 -0
- package/registry/examples/state-screen/native/empty.tsx +11 -0
- package/registry/examples/state-screen/native/error.d.ts +4 -0
- package/registry/examples/state-screen/native/error.dark.png +0 -0
- package/registry/examples/state-screen/native/error.js +21 -0
- package/registry/examples/state-screen/native/error.light.png +0 -0
- package/registry/examples/state-screen/native/error.tsx +17 -0
- package/registry/examples/state-screen/native/offline.d.ts +4 -0
- package/registry/examples/state-screen/native/offline.dark.png +0 -0
- package/registry/examples/state-screen/native/offline.js +15 -0
- package/registry/examples/state-screen/native/offline.light.png +0 -0
- package/registry/examples/state-screen/native/offline.tsx +12 -0
- package/registry/field.json +1 -1
- package/registry/file-upload.json +2 -2
- package/registry/filter-bar.json +2 -2
- package/registry/flock.json +1 -1
- package/registry/footnote.json +1 -1
- package/registry/force-update-screen.json +1 -1
- package/registry/form-flow.json +152 -0
- package/registry/form.json +1 -1
- package/registry/gallery-page.json +1 -1
- package/registry/genui.json +1 -1
- package/registry/glossary-term.json +1 -1
- package/registry/glossary.json +1 -1
- package/registry/glow-card.json +1 -1
- package/registry/goal-gauge.json +1 -1
- package/registry/grade-stamp.json +1 -1
- package/registry/grid.json +262 -0
- package/registry/how-it-works-page.json +1 -1
- package/registry/image-cropper.json +1 -1
- package/registry/index.json +408 -12
- package/registry/iso.json +1 -1
- package/registry/kanban.json +1 -1
- package/registry/kbd.json +1 -1
- package/registry/kind-config-editor.json +1 -1
- package/registry/kpi-explained.json +1 -1
- package/registry/landing-page.json +1 -1
- package/registry/landscape.json +1 -1
- package/registry/language-switch.json +1 -1
- package/registry/legal-page.json +1 -1
- package/registry/link-card.json +2 -2
- package/registry/list-detail.json +188 -0
- package/registry/list.json +2 -2
- package/registry/loader.json +1 -1
- package/registry/longform-page.json +1 -1
- package/registry/maintenance-screen.json +1 -1
- package/registry/map.json +2 -2
- package/registry/margin-layout.json +1 -1
- package/registry/markdown.json +1 -1
- package/registry/marketing-layout.json +1 -1
- package/registry/marquee.json +1 -1
- package/registry/mascot-quote.json +1 -1
- package/registry/mascot-state.json +1 -1
- package/registry/mascots.json +1 -1
- package/registry/match-dialog.json +1 -1
- package/registry/media-capture.json +2 -2
- package/registry/media-gallery.json +1 -1
- package/registry/media-grid.json +1 -1
- package/registry/meta-row.json +1 -1
- package/registry/meter.json +1 -1
- package/registry/nav-bar.json +2 -2
- package/registry/next-actions.json +1 -1
- package/registry/notification-preferences.json +1 -1
- package/registry/number-ticker.json +1 -1
- package/registry/onboarding.json +3 -0
- package/registry/opening-hours.json +2 -2
- package/registry/page-header.json +1 -1
- package/registry/page-hero.json +2 -2
- package/registry/page-index.json +1 -1
- package/registry/page.json +1 -1
- package/registry/pagination.json +2 -2
- package/registry/photo-grid.json +2 -2
- package/registry/pointer-light.json +1 -1
- package/registry/popover.json +1 -1
- package/registry/pricing-page.json +2 -2
- package/registry/product-page.json +1 -1
- package/registry/profile-card.json +1 -1
- package/registry/progress.json +1 -1
- package/registry/promise-card.json +1 -1
- package/registry/qr-code.json +343 -0
- package/registry/quota-meter.json +1 -1
- package/registry/radio-group.json +2 -2
- package/registry/rail-nav.json +3 -3
- package/registry/recipes.json +1 -1
- package/registry/retro-tv.json +1 -1
- package/registry/reviews.json +1 -1
- package/registry/router.json +1 -1
- package/registry/screen.json +68 -4
- package/registry/scroll-stage.json +1 -1
- package/registry/search-field.json +2 -2
- package/registry/section-backdrop.json +1 -1
- package/registry/separator.json +1 -1
- package/registry/service-card.json +2 -2
- package/registry/settings-layout.json +5 -2
- package/registry/shop-composer.json +2 -2
- package/registry/shop.json +3 -3
- package/registry/showcase.json +1 -1
- package/registry/signature.json +1 -1
- package/registry/site-cahier.json +1 -1
- package/registry/site-footer.json +4 -4
- package/registry/sites.json +1 -1
- package/registry/skeleton.json +1 -1
- package/registry/skip-link.json +1 -1
- package/registry/slider.json +1 -1
- package/registry/slot-picker.json +1 -1
- package/registry/slot.json +1 -1
- package/registry/specimen-tag.json +1 -1
- package/registry/speed-lines.json +1 -1
- package/registry/spinner.json +1 -1
- package/registry/split-view.json +1 -1
- package/registry/stage-banner.json +1 -1
- package/registry/stat.json +1 -1
- package/registry/state-screen.json +224 -0
- package/registry/status-chip.json +2 -2
- package/registry/status-page.json +1 -1
- package/registry/step-progress.json +1 -1
- package/registry/step-showcase.json +1 -1
- package/registry/stepper.json +1 -1
- package/registry/sticky-action.json +1 -1
- package/registry/stuck.json +1 -1
- package/registry/swipe-deck.json +1 -1
- package/registry/switch.json +1 -1
- package/registry/tabs.json +1 -1
- package/registry/tag-input.json +1 -1
- package/registry/tag-selector.json +1 -1
- package/registry/taped-photo.json +1 -1
- package/registry/terminal-replay.json +2 -2
- package/registry/text-style.json +1 -1
- package/registry/theme.json +3 -3
- package/registry/toast.json +1 -1
- package/registry/toc.json +1 -1
- package/registry/tooltip.json +1 -1
- package/registry/tree-view.json +2 -2
- package/registry/update-prompt.json +1 -1
- package/registry/upload-queue.json +1 -1
- package/registry/usage.json +1 -1
- package/registry/verified-badge.json +1 -1
- package/registry/versus-card.json +1 -1
- package/registry/vertical-video.json +1 -1
- package/registry/video-player.json +2 -2
- package/registry/video-trimmer.json +1 -1
- package/registry/virtual.json +1 -1
- package/registry/wall.json +1 -1
- package/registry/waveform.json +1 -1
- /package/dist/{chunk-YCZ7N6Q6.js.map → chunk-7MQNG35Q.js.map} +0 -0
- /package/dist/{chunk-VB7MWE2N.js.map → chunk-DSDFXPL6.js.map} +0 -0
- /package/dist/{chunk-4GQH27IT.js.map → chunk-GW5EI7MI.js.map} +0 -0
- /package/dist/{chunk-F6JTHPHE.js.map → chunk-I6EOLPSH.js.map} +0 -0
- /package/dist/{chunk-BG5APGX6.js.map → chunk-Q5DYWQ6S.js.map} +0 -0
- /package/dist/{chunk-RCKXJEDQ.js.map → chunk-ST5P5HNI.js.map} +0 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Marker, OrganizeCode } from '@krizaka/organize/contract';
|
|
3
|
+
import { D as DefaultAvatar, a as DefaultAvatarEntityKind } from './default-avatar-D9kiSFNB.js';
|
|
4
|
+
|
|
5
|
+
/** The refusals a header knows how to say: the product passes the words (translated) for the codes it can get. */
|
|
6
|
+
type EntityRefusals = Partial<Record<OrganizeCode, string>>;
|
|
7
|
+
/** The entity's picture: an address, or one of Krizaka's default pictures. */
|
|
8
|
+
type EntityAvatar = {
|
|
9
|
+
src?: string | null;
|
|
10
|
+
defaultAvatar?: DefaultAvatar;
|
|
11
|
+
fallback?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/** One picture to choose from (the shape of `AvatarPicker`'s options). */
|
|
14
|
+
type EntityAvatarOption = {
|
|
15
|
+
/** The value of the choice. */
|
|
16
|
+
id: string;
|
|
17
|
+
/** Its name for assistive technology, passed translated. */
|
|
18
|
+
label: string;
|
|
19
|
+
/** A picture's address; otherwise `defaultAvatar` draws one of the family's pictures. */
|
|
20
|
+
src?: string;
|
|
21
|
+
/** One of Krizaka's default pictures. */
|
|
22
|
+
defaultAvatar?: DefaultAvatar;
|
|
23
|
+
/** What this picture is of. */
|
|
24
|
+
kind?: DefaultAvatarEntityKind;
|
|
25
|
+
};
|
|
26
|
+
type EntityTag = {
|
|
27
|
+
id: string;
|
|
28
|
+
label: string;
|
|
29
|
+
marker: Marker;
|
|
30
|
+
};
|
|
31
|
+
/** The props both platforms take: plain data, the editing callbacks, the refusals. */
|
|
32
|
+
type EntityHeaderBase = {
|
|
33
|
+
/** The entity's name. */
|
|
34
|
+
name: string;
|
|
35
|
+
/** Makes the name editable in place: called with the trimmed new name. Throw (or reject with) an error carrying a `code` to show its refusal. */
|
|
36
|
+
onNameChange?: (name: string) => void | Promise<void>;
|
|
37
|
+
/** What editing the name does (“Rename the collection”), passed translated: the field's name, and the button's after the visible name. */
|
|
38
|
+
nameLabel?: string;
|
|
39
|
+
/** One line under the name. */
|
|
40
|
+
description?: string;
|
|
41
|
+
/** Makes the description editable in place. Same contract as `onNameChange`. */
|
|
42
|
+
onDescriptionChange?: (description: string) => void | Promise<void>;
|
|
43
|
+
/** What editing the description does (“Edit the description”), passed translated: the field's name, and the button's after the visible text. */
|
|
44
|
+
descriptionLabel?: string;
|
|
45
|
+
/** Shown when there is no description and it is editable (“Add a description”), passed translated. */
|
|
46
|
+
descriptionPlaceholder?: string;
|
|
47
|
+
/** The picture. */
|
|
48
|
+
avatar?: EntityAvatar;
|
|
49
|
+
/** The entity's tags. */
|
|
50
|
+
tags?: readonly EntityTag[];
|
|
51
|
+
/** A refusal to say now (the last answer of the server), by its code. */
|
|
52
|
+
refusal?: {
|
|
53
|
+
code: OrganizeCode;
|
|
54
|
+
} | null;
|
|
55
|
+
/** The messages by refusal code: `NAME_TAKEN`, `AVATAR_NOT_ALLOWED`, `DEFAULT_COLLECTION`, … A code with no message says nothing. */
|
|
56
|
+
refusals?: EntityRefusals;
|
|
57
|
+
/** After the text: the actions of the entity (a menu, a button). */
|
|
58
|
+
actions?: React.ReactNode;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
type EntityHeaderProps = EntityHeaderBase & {
|
|
62
|
+
/** Makes the picture changeable: a button over it opens the library's `AvatarPicker`. */
|
|
63
|
+
avatarPicker?: {
|
|
64
|
+
/** The picker's accessible name (“Profile picture”), passed translated. */
|
|
65
|
+
label: string;
|
|
66
|
+
/** What the pictures are of: `folder`, `organisation`, `shop`, `person`. */
|
|
67
|
+
kind?: EntityAvatarOption["kind"];
|
|
68
|
+
/** The pictures to choose from. */
|
|
69
|
+
options: readonly EntityAvatarOption[];
|
|
70
|
+
/** Adds a « no picture » tile first, with these words, passed translated. */
|
|
71
|
+
noneLabel?: string;
|
|
72
|
+
/** The chosen id. */
|
|
73
|
+
value?: string;
|
|
74
|
+
/** The viewer chooses another picture. */
|
|
75
|
+
onValueChange?: (id: string) => void;
|
|
76
|
+
/** The accessible name of the picture's button (“Change the picture”), passed translated. */
|
|
77
|
+
triggerLabel: string;
|
|
78
|
+
};
|
|
79
|
+
/** The accessible name of the tags' list (“Tags”), passed translated. */
|
|
80
|
+
tagsLabel?: string;
|
|
81
|
+
/** Lets the viewer remove a tag: each `TagChip` gets a remove button. Without it the tags are read-only labels. */
|
|
82
|
+
onTagRemove?: (id: string) => void;
|
|
83
|
+
/** The remove button's accessible name for a tag (“Remove Seasonal”), passed translated. */
|
|
84
|
+
tagRemoveLabel?: (label: string) => string;
|
|
85
|
+
/** Classes merged last, on the header. */
|
|
86
|
+
className?: string;
|
|
87
|
+
};
|
|
88
|
+
/** The head of an entity: picture, name and description editable in place, tags, a refusal said in words, actions. */
|
|
89
|
+
declare function EntityHeader({ name, onNameChange, nameLabel, description, onDescriptionChange, descriptionLabel, descriptionPlaceholder, avatar, avatarPicker, tags, tagsLabel, onTagRemove, tagRemoveLabel, refusal, refusals, actions, className, }: EntityHeaderProps): React.JSX.Element;
|
|
90
|
+
|
|
91
|
+
export { EntityHeader };
|
|
92
|
+
export type { EntityHeaderProps, EntityRefusals, EntityTag };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
PencilGlyph
|
|
4
|
+
} from "./chunk-NG6G6V5E.js";
|
|
5
|
+
|
|
6
|
+
// src/entity-header/entity-header.tsx
|
|
7
|
+
import { AvatarPicker } from "@krizaka/ui/account-settings";
|
|
8
|
+
import { Avatar } from "@krizaka/ui/avatar";
|
|
9
|
+
import { TagChip, TagMarker } from "@krizaka/ui/chip";
|
|
10
|
+
import { cn } from "@krizaka/ui/cn";
|
|
11
|
+
import { Popover } from "@krizaka/ui/popover";
|
|
12
|
+
import * as React2 from "react";
|
|
13
|
+
|
|
14
|
+
// src/entity-header/shared.ts
|
|
15
|
+
import * as React from "react";
|
|
16
|
+
function refusalCode(error) {
|
|
17
|
+
const code = typeof error === "object" && error !== null ? error.code : void 0;
|
|
18
|
+
return typeof code === "string" ? code : void 0;
|
|
19
|
+
}
|
|
20
|
+
var editName = (visible, placeholder, label) => `${visible || placeholder || ""} (${label})`.trim();
|
|
21
|
+
function useEditable(value, onCommit, onRefusal, required) {
|
|
22
|
+
const [editing, setEditing] = React.useState(false);
|
|
23
|
+
const [draft, setDraft] = React.useState(value);
|
|
24
|
+
const [pending, setPending] = React.useState(false);
|
|
25
|
+
const open = () => {
|
|
26
|
+
setDraft(value);
|
|
27
|
+
setEditing(true);
|
|
28
|
+
};
|
|
29
|
+
const stop = () => {
|
|
30
|
+
setEditing(false);
|
|
31
|
+
setDraft(value);
|
|
32
|
+
};
|
|
33
|
+
const commit = async () => {
|
|
34
|
+
if (pending) return;
|
|
35
|
+
const next = draft.trim();
|
|
36
|
+
if (!onCommit || next === value || required && next === "") return stop();
|
|
37
|
+
setPending(true);
|
|
38
|
+
try {
|
|
39
|
+
await onCommit(next);
|
|
40
|
+
onRefusal(void 0);
|
|
41
|
+
setEditing(false);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
onRefusal(refusalCode(error));
|
|
44
|
+
} finally {
|
|
45
|
+
setPending(false);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return { editing, draft, setDraft, pending, open, stop, commit };
|
|
49
|
+
}
|
|
50
|
+
function useRefusal(refusal, refusals) {
|
|
51
|
+
const [local, setLocal] = React.useState();
|
|
52
|
+
const code = local ?? refusal?.code;
|
|
53
|
+
return { message: code ? refusals?.[code] : void 0, setLocal };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/entity-header/entity-header.tsx
|
|
57
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
58
|
+
function Editable({ value, label, placeholder, onCommit, onRefusal, className, inputClassName, required, multiline }) {
|
|
59
|
+
const { editing, draft, setDraft, pending, open, stop, commit } = useEditable(value, onCommit, onRefusal, required);
|
|
60
|
+
const input = React2.useRef(null);
|
|
61
|
+
React2.useEffect(() => {
|
|
62
|
+
if (editing) input.current?.focus();
|
|
63
|
+
}, [editing, pending]);
|
|
64
|
+
if (!onCommit) return value ? /* @__PURE__ */ jsx("p", { className, children: value }) : null;
|
|
65
|
+
if (!editing) {
|
|
66
|
+
return /* @__PURE__ */ jsxs(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
type: "button",
|
|
70
|
+
"aria-label": editName(value, placeholder, label),
|
|
71
|
+
onClick: open,
|
|
72
|
+
className: cn(className, "group/edit -mx-1 inline-flex max-w-full items-center gap-2 rounded-md px-1 text-start hover:bg-surface-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"),
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx("span", { className: cn("min-w-0 truncate", !value && "text-fg-muted"), children: value || placeholder }),
|
|
75
|
+
/* @__PURE__ */ jsx(PencilGlyph, { "aria-hidden": true, className: "h-3.5 w-3.5 shrink-0 text-fg-muted opacity-0 group-hover/edit:opacity-100 group-focus-visible/edit:opacity-100 [@media(hover:none)]:opacity-100" })
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
const shared = {
|
|
81
|
+
ref: input,
|
|
82
|
+
value: draft,
|
|
83
|
+
"aria-label": label,
|
|
84
|
+
disabled: pending,
|
|
85
|
+
onChange: (event) => setDraft(event.target.value),
|
|
86
|
+
onBlur: () => void commit(),
|
|
87
|
+
onKeyDown: (event) => {
|
|
88
|
+
if (event.key === "Escape") {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
stop();
|
|
91
|
+
} else if (event.key === "Enter" && !(multiline && event.shiftKey)) {
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
void commit();
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
className: cn(inputClassName, "w-full rounded-md border border-border-control bg-surface-1 px-2 py-1 outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring")
|
|
97
|
+
};
|
|
98
|
+
return multiline ? /* @__PURE__ */ jsx("textarea", { rows: 2, ...shared }) : /* @__PURE__ */ jsx("input", { type: "text", ...shared });
|
|
99
|
+
}
|
|
100
|
+
function EntityHeader({
|
|
101
|
+
name,
|
|
102
|
+
onNameChange,
|
|
103
|
+
nameLabel = name,
|
|
104
|
+
description,
|
|
105
|
+
onDescriptionChange,
|
|
106
|
+
descriptionLabel = "Description",
|
|
107
|
+
descriptionPlaceholder,
|
|
108
|
+
avatar,
|
|
109
|
+
avatarPicker,
|
|
110
|
+
tags,
|
|
111
|
+
tagsLabel,
|
|
112
|
+
onTagRemove,
|
|
113
|
+
tagRemoveLabel,
|
|
114
|
+
refusal,
|
|
115
|
+
refusals,
|
|
116
|
+
actions,
|
|
117
|
+
className
|
|
118
|
+
}) {
|
|
119
|
+
const { message, setLocal } = useRefusal(refusal, refusals);
|
|
120
|
+
const picture = /* @__PURE__ */ jsx(Avatar, { size: "xl", alt: "", ...avatar });
|
|
121
|
+
const errorId = React2.useId();
|
|
122
|
+
return /* @__PURE__ */ jsxs("header", { className: cn("flex flex-wrap items-start gap-4", className), "data-entity-header": true, children: [
|
|
123
|
+
avatarPicker ? /* @__PURE__ */ jsxs(Popover.Root, { children: [
|
|
124
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": avatarPicker.triggerLabel, className: "shrink-0 rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", children: picture }) }),
|
|
125
|
+
/* @__PURE__ */ jsx(Popover.Content, { className: "w-80", align: "start", children: /* @__PURE__ */ jsx(AvatarPicker, { ...avatarPicker, dense: true }) })
|
|
126
|
+
] }) : avatar ? /* @__PURE__ */ jsx("span", { className: "shrink-0", children: picture }) : null,
|
|
127
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
128
|
+
/* @__PURE__ */ jsx("h1", { className: "m-0 min-w-0 text-xl font-semibold text-fg-title", children: /* @__PURE__ */ jsx(
|
|
129
|
+
Editable,
|
|
130
|
+
{
|
|
131
|
+
value: name,
|
|
132
|
+
label: nameLabel,
|
|
133
|
+
onCommit: onNameChange,
|
|
134
|
+
onRefusal: setLocal,
|
|
135
|
+
className: "text-xl font-semibold text-fg-title",
|
|
136
|
+
inputClassName: "text-xl font-semibold text-fg-title",
|
|
137
|
+
required: true
|
|
138
|
+
}
|
|
139
|
+
) }),
|
|
140
|
+
description || onDescriptionChange ? /* @__PURE__ */ jsx(
|
|
141
|
+
Editable,
|
|
142
|
+
{
|
|
143
|
+
value: description ?? "",
|
|
144
|
+
label: descriptionLabel,
|
|
145
|
+
placeholder: descriptionPlaceholder,
|
|
146
|
+
onCommit: onDescriptionChange,
|
|
147
|
+
onRefusal: setLocal,
|
|
148
|
+
className: "text-sm text-fg-secondary",
|
|
149
|
+
inputClassName: "text-sm text-fg-secondary",
|
|
150
|
+
multiline: true
|
|
151
|
+
}
|
|
152
|
+
) : null,
|
|
153
|
+
tags?.length ? /* @__PURE__ */ jsx("ul", { "aria-label": tagsLabel, className: "m-0 mt-1 flex list-none flex-wrap gap-1.5 p-0", children: tags.map((tag) => /* @__PURE__ */ jsx("li", { children: onTagRemove ? /* @__PURE__ */ jsx(TagChip, { marker: tag.marker, removable: true, removeLabel: tagRemoveLabel?.(tag.label) ?? tag.label, onRemove: () => onTagRemove(tag.id), children: tag.label }) : /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 rounded-full border border-border-default px-2.5 py-0.5 text-xs text-fg", children: [
|
|
154
|
+
/* @__PURE__ */ jsx(TagMarker, { marker: tag.marker }),
|
|
155
|
+
tag.label
|
|
156
|
+
] }) }, tag.id)) }) : null,
|
|
157
|
+
message ? /* @__PURE__ */ jsx("p", { id: errorId, role: "alert", className: "m-0 text-sm text-danger-text", children: message }) : null
|
|
158
|
+
] }),
|
|
159
|
+
actions ? /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-2", children: actions }) : null
|
|
160
|
+
] });
|
|
161
|
+
}
|
|
162
|
+
export {
|
|
163
|
+
EntityHeader
|
|
164
|
+
};
|
|
165
|
+
//# sourceMappingURL=entity-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/entity-header/entity-header.tsx","../src/entity-header/shared.ts"],"sourcesContent":["// Client (inline editing, the avatar popover). The head of an entity — a collection, a shop, a studio: its picture, its\n// name and description edited where they are read, its tags. Plain data in (the shapes of `@krizaka/organize/contract`),\n// a refusal `code` out, mapped to the message the product passes.\nimport { AvatarPicker } from \"@krizaka/ui/account-settings\";\nimport { Avatar } from \"@krizaka/ui/avatar\";\nimport { TagChip, TagMarker } from \"@krizaka/ui/chip\";\nimport { cn } from \"@krizaka/ui/cn\";\nimport { Popover } from \"@krizaka/ui/popover\";\nimport * as React from \"react\";\n\nimport { PencilGlyph } from \"../glyphs\";\nimport { type EditableBase, editName, type EntityAvatarOption, type EntityHeaderBase, type EntityRefusals, type EntityTag, useEditable, useRefusal } from \"./shared\";\n\nexport type { EntityRefusals, EntityTag };\n\nexport type EntityHeaderProps = EntityHeaderBase & {\n /** Makes the picture changeable: a button over it opens the library's `AvatarPicker`. */\n avatarPicker?: {\n /** The picker's accessible name (“Profile picture”), passed translated. */\n label: string;\n /** What the pictures are of: `folder`, `organisation`, `shop`, `person`. */\n kind?: EntityAvatarOption[\"kind\"];\n /** The pictures to choose from. */\n options: readonly EntityAvatarOption[];\n /** Adds a « no picture » tile first, with these words, passed translated. */\n noneLabel?: string;\n /** The chosen id. */\n value?: string;\n /** The viewer chooses another picture. */\n onValueChange?: (id: string) => void;\n /** The accessible name of the picture's button (“Change the picture”), passed translated. */\n triggerLabel: string;\n };\n /** The accessible name of the tags' list (“Tags”), passed translated. */\n tagsLabel?: string;\n /** Lets the viewer remove a tag: each `TagChip` gets a remove button. Without it the tags are read-only labels. */\n onTagRemove?: (id: string) => void;\n /** The remove button's accessible name for a tag (“Remove Seasonal”), passed translated. */\n tagRemoveLabel?: (label: string) => string;\n /** Classes merged last, on the header. */\n className?: string;\n};\n\ntype EditableProps = EditableBase & { className: string; inputClassName: string; multiline?: boolean };\n\n/** Text that reads as text and edits in place: Enter saves, Escape gives it back, leaving the field saves. */\nfunction Editable({ value, label, placeholder, onCommit, onRefusal, className, inputClassName, required, multiline }: EditableProps) {\n const { editing, draft, setDraft, pending, open, stop, commit } = useEditable(value, onCommit, onRefusal, required);\n const input = React.useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n React.useEffect(() => {\n if (editing) input.current?.focus();\n }, [editing, pending]);\n if (!onCommit) return value ? <p className={className}>{value}</p> : null;\n\n if (!editing) {\n return (\n <button\n type=\"button\"\n aria-label={editName(value, placeholder, label)}\n onClick={open}\n className={cn(className, \"group/edit -mx-1 inline-flex max-w-full items-center gap-2 rounded-md px-1 text-start hover:bg-surface-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\")}\n >\n <span className={cn(\"min-w-0 truncate\", !value && \"text-fg-muted\")}>{value || placeholder}</span>\n <PencilGlyph aria-hidden className=\"h-3.5 w-3.5 shrink-0 text-fg-muted opacity-0 group-hover/edit:opacity-100 group-focus-visible/edit:opacity-100 [@media(hover:none)]:opacity-100\" />\n </button>\n );\n }\n const shared = {\n ref: input as never,\n value: draft,\n \"aria-label\": label,\n disabled: pending,\n onChange: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => setDraft(event.target.value),\n onBlur: () => void commit(),\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n stop();\n } else if (event.key === \"Enter\" && !(multiline && event.shiftKey)) {\n event.preventDefault();\n void commit();\n }\n },\n className: cn(inputClassName, \"w-full rounded-md border border-border-control bg-surface-1 px-2 py-1 outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring\"),\n };\n return multiline ? <textarea rows={2} {...shared} /> : <input type=\"text\" {...shared} />;\n}\n\n/** The head of an entity: picture, name and description editable in place, tags, a refusal said in words, actions. */\nexport function EntityHeader({\n name,\n onNameChange,\n nameLabel = name,\n description,\n onDescriptionChange,\n descriptionLabel = \"Description\",\n descriptionPlaceholder,\n avatar,\n avatarPicker,\n tags,\n tagsLabel,\n onTagRemove,\n tagRemoveLabel,\n refusal,\n refusals,\n actions,\n className,\n}: EntityHeaderProps) {\n const { message, setLocal } = useRefusal(refusal, refusals);\n const picture = <Avatar size=\"xl\" alt=\"\" {...avatar} />;\n const errorId = React.useId();\n\n return (\n <header className={cn(\"flex flex-wrap items-start gap-4\", className)} data-entity-header>\n {avatarPicker ? (\n <Popover.Root>\n <Popover.Trigger asChild>\n <button type=\"button\" aria-label={avatarPicker.triggerLabel} className=\"shrink-0 rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\">\n {picture}\n </button>\n </Popover.Trigger>\n <Popover.Content className=\"w-80\" align=\"start\">\n <AvatarPicker {...avatarPicker} dense />\n </Popover.Content>\n </Popover.Root>\n ) : avatar ? (\n <span className=\"shrink-0\">{picture}</span>\n ) : null}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <h1 className=\"m-0 min-w-0 text-xl font-semibold text-fg-title\">\n <Editable\n value={name}\n label={nameLabel}\n onCommit={onNameChange}\n onRefusal={setLocal}\n className=\"text-xl font-semibold text-fg-title\"\n inputClassName=\"text-xl font-semibold text-fg-title\"\n required\n />\n </h1>\n {description || onDescriptionChange ? (\n <Editable\n value={description ?? \"\"}\n label={descriptionLabel}\n placeholder={descriptionPlaceholder}\n onCommit={onDescriptionChange}\n onRefusal={setLocal}\n className=\"text-sm text-fg-secondary\"\n inputClassName=\"text-sm text-fg-secondary\"\n multiline\n />\n ) : null}\n {tags?.length ? (\n <ul aria-label={tagsLabel} className=\"m-0 mt-1 flex list-none flex-wrap gap-1.5 p-0\">\n {tags.map((tag) => (\n <li key={tag.id}>\n {onTagRemove ? (\n <TagChip marker={tag.marker} removable removeLabel={tagRemoveLabel?.(tag.label) ?? tag.label} onRemove={() => onTagRemove(tag.id)}>\n {tag.label}\n </TagChip>\n ) : (\n <span className=\"inline-flex items-center gap-1.5 rounded-full border border-border-default px-2.5 py-0.5 text-xs text-fg\">\n <TagMarker marker={tag.marker} />\n {tag.label}\n </span>\n )}\n </li>\n ))}\n </ul>\n ) : null}\n {message ? (\n <p id={errorId} role=\"alert\" className=\"m-0 text-sm text-danger-text\">\n {message}\n </p>\n ) : null}\n </div>\n {actions ? <div className=\"flex shrink-0 items-center gap-2\">{actions}</div> : null}\n </header>\n );\n}\n","// What the web and the native EntityHeader share: plain data, the refusal vocabulary, the code of a thrown refusal.\n// No component and no web import, so the native bundle never reaches the web files.\nimport type { Marker, OrganizeCode } from \"@krizaka/organize/contract\";\nimport * as React from \"react\";\n\nimport type { DefaultAvatar, DefaultAvatarEntityKind } from \"../avatar/default-avatar\";\n\n/** The refusals a header knows how to say: the product passes the words (translated) for the codes it can get. */\nexport type EntityRefusals = Partial<Record<OrganizeCode, string>>;\n\n/** The entity's picture: an address, or one of Krizaka's default pictures. */\nexport type EntityAvatar = { src?: string | null; defaultAvatar?: DefaultAvatar; fallback?: React.ReactNode };\n\n/** One picture to choose from (the shape of `AvatarPicker`'s options). */\nexport type EntityAvatarOption = {\n /** The value of the choice. */\n id: string;\n /** Its name for assistive technology, passed translated. */\n label: string;\n /** A picture's address; otherwise `defaultAvatar` draws one of the family's pictures. */\n src?: string;\n /** One of Krizaka's default pictures. */\n defaultAvatar?: DefaultAvatar;\n /** What this picture is of. */\n kind?: DefaultAvatarEntityKind;\n};\n\nexport type EntityTag = { id: string; label: string; marker: Marker };\n\n/** The refusal `code` carried by a thrown error (an `OrganizeError`, or any error with a string `code`). */\nexport function refusalCode(error: unknown): OrganizeCode | undefined {\n const code = typeof error === \"object\" && error !== null ? (error as { code?: unknown }).code : undefined;\n return typeof code === \"string\" ? (code as OrganizeCode) : undefined;\n}\n\n/** The props both platforms take: plain data, the editing callbacks, the refusals. */\nexport type EntityHeaderBase = {\n /** The entity's name. */\n name: string;\n /** Makes the name editable in place: called with the trimmed new name. Throw (or reject with) an error carrying a `code` to show its refusal. */\n onNameChange?: (name: string) => void | Promise<void>;\n /** What editing the name does (“Rename the collection”), passed translated: the field's name, and the button's after the visible name. */\n nameLabel?: string;\n /** One line under the name. */\n description?: string;\n /** Makes the description editable in place. Same contract as `onNameChange`. */\n onDescriptionChange?: (description: string) => void | Promise<void>;\n /** What editing the description does (“Edit the description”), passed translated: the field's name, and the button's after the visible text. */\n descriptionLabel?: string;\n /** Shown when there is no description and it is editable (“Add a description”), passed translated. */\n descriptionPlaceholder?: string;\n /** The picture. */\n avatar?: EntityAvatar;\n /** The entity's tags. */\n tags?: readonly EntityTag[];\n /** A refusal to say now (the last answer of the server), by its code. */\n refusal?: { code: OrganizeCode } | null;\n /** The messages by refusal code: `NAME_TAKEN`, `AVATAR_NOT_ALLOWED`, `DEFAULT_COLLECTION`, … A code with no message says nothing. */\n refusals?: EntityRefusals;\n /** After the text: the actions of the entity (a menu, a button). */\n actions?: React.ReactNode;\n};\n\n/** The text a button label reads: the visible text first, then what the button does (the accessible name contains the visible text). */\nexport const editName = (visible: string, placeholder: string | undefined, label: string) => `${visible || placeholder || \"\"} (${label})`.trim();\n\n/**\n * The state of a field edited in place: Enter or blur saves (a trimmed text, never an empty one when `required`),\n * Escape gives the text back, a thrown refusal keeps the field open and is reported by its code.\n */\nexport function useEditable(value: string, onCommit: ((value: string) => void | Promise<void>) | undefined, onRefusal: (code: OrganizeCode | undefined) => void, required?: boolean) {\n const [editing, setEditing] = React.useState(false);\n const [draft, setDraft] = React.useState(value);\n const [pending, setPending] = React.useState(false);\n const open = () => {\n setDraft(value);\n setEditing(true);\n };\n const stop = () => {\n setEditing(false);\n setDraft(value);\n };\n const commit = async () => {\n if (pending) return;\n const next = draft.trim();\n if (!onCommit || next === value || (required && next === \"\")) return stop();\n setPending(true);\n try {\n await onCommit(next);\n onRefusal(undefined);\n setEditing(false);\n } catch (error) {\n onRefusal(refusalCode(error));\n } finally {\n setPending(false);\n }\n };\n return { editing, draft, setDraft, pending, open, stop, commit };\n}\n\n/** The refusal to say: the one a save just raised, else the one the page passes, in the product's words (none when it has none). */\nexport function useRefusal(refusal: EntityHeaderBase[\"refusal\"], refusals: EntityRefusals | undefined) {\n const [local, setLocal] = React.useState<OrganizeCode | undefined>();\n const code = local ?? refusal?.code;\n return { message: code ? refusals?.[code] : undefined, setLocal };\n}\n\n/** The props of a field edited in place, on both platforms. */\nexport type EditableBase = {\n value: string;\n label: string;\n placeholder?: string;\n onCommit?: (value: string) => void | Promise<void>;\n onRefusal: (code: OrganizeCode | undefined) => void;\n required?: boolean;\n};\n"],"mappings":";;;;;;AAGA,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AACvB,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU;AACnB,SAAS,eAAe;AACxB,YAAYA,YAAW;;;ACLvB,YAAY,WAAW;AA2BhB,SAAS,YAAY,OAA0C;AACpE,QAAM,OAAO,OAAO,UAAU,YAAY,UAAU,OAAQ,MAA6B,OAAO;AAChG,SAAO,OAAO,SAAS,WAAY,OAAwB;AAC7D;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B,IAAI,KAAK,KAAK,IAAI,OAAO,UAAU,MAAM,YAAY,IAAI,EAAE,GAC7H,cAAI,OACP,IAEA,qBAAC,UAAK,WAAU,4GACd;AAAA,4BAAC,aAAU,QAAQ,IAAI,QAAQ;AAAA,QAC9B,IAAI;AAAA,SACP,KATK,IAAI,EAWb,CACD,GACH,IACE;AAAA,MACH,UACC,oBAAC,OAAE,IAAI,SAAS,MAAK,SAAQ,WAAU,gCACpC,mBACH,IACE;AAAA,OACN;AAAA,IACC,UAAU,oBAAC,SAAI,WAAU,oCAAoC,mBAAQ,IAAS;AAAA,KACjF;AAEJ;","names":["React"]}
|
package/dist/file-upload.d.ts
CHANGED
|
@@ -240,8 +240,8 @@ declare function useUploadQueue(options: UploadQueueOptions): {
|
|
|
240
240
|
items: UploadItem[];
|
|
241
241
|
add: (files: readonly File[]) => void;
|
|
242
242
|
pause: (id: string) => void;
|
|
243
|
-
resume:
|
|
244
|
-
retry:
|
|
243
|
+
resume: (id: string) => void;
|
|
244
|
+
retry: (id: string) => void;
|
|
245
245
|
cancel: (id: string) => void;
|
|
246
246
|
remove: (id: string) => void;
|
|
247
247
|
};
|
package/dist/file-upload.js
CHANGED
package/dist/filter-bar.d.ts
CHANGED
|
@@ -74,12 +74,12 @@ declare function SavedViews({ views, current, modified, onSelect, onSave, onRena
|
|
|
74
74
|
declare const filterBar: tailwind_variants.TVReturnType<{
|
|
75
75
|
[key: string]: {
|
|
76
76
|
[key: string]: tailwind_variants.ClassValue | {
|
|
77
|
+
count?: tailwind_variants.ClassValue;
|
|
77
78
|
root?: tailwind_variants.ClassValue;
|
|
78
79
|
controls?: tailwind_variants.ClassValue;
|
|
79
80
|
active?: tailwind_variants.ClassValue;
|
|
80
81
|
clear?: tailwind_variants.ClassValue;
|
|
81
82
|
results?: tailwind_variants.ClassValue;
|
|
82
|
-
count?: tailwind_variants.ClassValue;
|
|
83
83
|
optionCount?: tailwind_variants.ClassValue;
|
|
84
84
|
trigger?: tailwind_variants.ClassValue;
|
|
85
85
|
};
|
|
@@ -87,12 +87,12 @@ declare const filterBar: tailwind_variants.TVReturnType<{
|
|
|
87
87
|
} | {
|
|
88
88
|
[x: string]: {
|
|
89
89
|
[x: string]: tailwind_variants.ClassValue | {
|
|
90
|
+
count?: tailwind_variants.ClassValue;
|
|
90
91
|
root?: tailwind_variants.ClassValue;
|
|
91
92
|
controls?: tailwind_variants.ClassValue;
|
|
92
93
|
active?: tailwind_variants.ClassValue;
|
|
93
94
|
clear?: tailwind_variants.ClassValue;
|
|
94
95
|
results?: tailwind_variants.ClassValue;
|
|
95
|
-
count?: tailwind_variants.ClassValue;
|
|
96
96
|
optionCount?: tailwind_variants.ClassValue;
|
|
97
97
|
trigger?: tailwind_variants.ClassValue;
|
|
98
98
|
};
|
|
@@ -109,12 +109,12 @@ declare const filterBar: tailwind_variants.TVReturnType<{
|
|
|
109
109
|
}, undefined, {
|
|
110
110
|
[key: string]: {
|
|
111
111
|
[key: string]: tailwind_variants.ClassValue | {
|
|
112
|
+
count?: tailwind_variants.ClassValue;
|
|
112
113
|
root?: tailwind_variants.ClassValue;
|
|
113
114
|
controls?: tailwind_variants.ClassValue;
|
|
114
115
|
active?: tailwind_variants.ClassValue;
|
|
115
116
|
clear?: tailwind_variants.ClassValue;
|
|
116
117
|
results?: tailwind_variants.ClassValue;
|
|
117
|
-
count?: tailwind_variants.ClassValue;
|
|
118
118
|
optionCount?: tailwind_variants.ClassValue;
|
|
119
119
|
trigger?: tailwind_variants.ClassValue;
|
|
120
120
|
};
|
package/dist/filter-bar.js
CHANGED
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
readFilterParams,
|
|
8
8
|
savedViewsLabels,
|
|
9
9
|
writeFilterParams
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-I6EOLPSH.js";
|
|
11
11
|
import "./chunk-UYGUSYIC.js";
|
|
12
12
|
import "./chunk-D3T54RSL.js";
|
|
13
13
|
import "./chunk-J3NC6ER4.js";
|
|
14
14
|
import "./chunk-NSLXEDIS.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-PGBF3UBX.js";
|
|
16
16
|
export {
|
|
17
17
|
FilterBar,
|
|
18
18
|
FilterMenu,
|
package/dist/genui.js
CHANGED
|
@@ -7,22 +7,22 @@ import {
|
|
|
7
7
|
} from "./chunk-YKOLME7R.js";
|
|
8
8
|
import {
|
|
9
9
|
DataTable
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-Q5DYWQ6S.js";
|
|
11
11
|
import "./chunk-3X3OF4TI.js";
|
|
12
12
|
import "./chunk-JXLDUDTD.js";
|
|
13
13
|
import "./chunk-M3GEYLMR.js";
|
|
14
14
|
import "./chunk-KVDB4GXV.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-I6EOLPSH.js";
|
|
16
16
|
import "./chunk-UYGUSYIC.js";
|
|
17
17
|
import "./chunk-D3T54RSL.js";
|
|
18
18
|
import "./chunk-J3NC6ER4.js";
|
|
19
19
|
import {
|
|
20
20
|
cn
|
|
21
21
|
} from "./chunk-NSLXEDIS.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-DSDFXPL6.js";
|
|
23
23
|
import "./chunk-ZIXB33X7.js";
|
|
24
24
|
import "./chunk-FZBWEDQI.js";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-PGBF3UBX.js";
|
|
26
26
|
|
|
27
27
|
// src/genui/catalog.tsx
|
|
28
28
|
import { formatCompact, formatMoney, formatNumber, formatPercent } from "@krizaka/intl";
|
|
@@ -20,28 +20,28 @@ declare function languagesFor(path: string, locales?: readonly string[]): Langua
|
|
|
20
20
|
declare const languageSwitch: tailwind_variants.TVReturnType<{
|
|
21
21
|
[key: string]: {
|
|
22
22
|
[key: string]: tailwind_variants.ClassValue | {
|
|
23
|
-
root?: tailwind_variants.ClassValue;
|
|
24
|
-
glyph?: tailwind_variants.ClassValue;
|
|
25
23
|
panel?: tailwind_variants.ClassValue;
|
|
24
|
+
root?: tailwind_variants.ClassValue;
|
|
25
|
+
item?: tailwind_variants.ClassValue;
|
|
26
26
|
heading?: tailwind_variants.ClassValue;
|
|
27
|
+
glyph?: tailwind_variants.ClassValue;
|
|
27
28
|
check?: tailwind_variants.ClassValue;
|
|
28
29
|
inline?: tailwind_variants.ClassValue;
|
|
29
30
|
trigger?: tailwind_variants.ClassValue;
|
|
30
|
-
item?: tailwind_variants.ClassValue;
|
|
31
31
|
inlineLink?: tailwind_variants.ClassValue;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
} | {
|
|
35
35
|
[x: string]: {
|
|
36
36
|
[x: string]: tailwind_variants.ClassValue | {
|
|
37
|
-
root?: tailwind_variants.ClassValue;
|
|
38
|
-
glyph?: tailwind_variants.ClassValue;
|
|
39
37
|
panel?: tailwind_variants.ClassValue;
|
|
38
|
+
root?: tailwind_variants.ClassValue;
|
|
39
|
+
item?: tailwind_variants.ClassValue;
|
|
40
40
|
heading?: tailwind_variants.ClassValue;
|
|
41
|
+
glyph?: tailwind_variants.ClassValue;
|
|
41
42
|
check?: tailwind_variants.ClassValue;
|
|
42
43
|
inline?: tailwind_variants.ClassValue;
|
|
43
44
|
trigger?: tailwind_variants.ClassValue;
|
|
44
|
-
item?: tailwind_variants.ClassValue;
|
|
45
45
|
inlineLink?: tailwind_variants.ClassValue;
|
|
46
46
|
};
|
|
47
47
|
};
|
|
@@ -58,14 +58,14 @@ declare const languageSwitch: tailwind_variants.TVReturnType<{
|
|
|
58
58
|
}, undefined, {
|
|
59
59
|
[key: string]: {
|
|
60
60
|
[key: string]: tailwind_variants.ClassValue | {
|
|
61
|
-
root?: tailwind_variants.ClassValue;
|
|
62
|
-
glyph?: tailwind_variants.ClassValue;
|
|
63
61
|
panel?: tailwind_variants.ClassValue;
|
|
62
|
+
root?: tailwind_variants.ClassValue;
|
|
63
|
+
item?: tailwind_variants.ClassValue;
|
|
64
64
|
heading?: tailwind_variants.ClassValue;
|
|
65
|
+
glyph?: tailwind_variants.ClassValue;
|
|
65
66
|
check?: tailwind_variants.ClassValue;
|
|
66
67
|
inline?: tailwind_variants.ClassValue;
|
|
67
68
|
trigger?: tailwind_variants.ClassValue;
|
|
68
|
-
item?: tailwind_variants.ClassValue;
|
|
69
69
|
inlineLink?: tailwind_variants.ClassValue;
|
|
70
70
|
};
|
|
71
71
|
};
|
package/dist/link-card.js
CHANGED
package/dist/list.js
CHANGED