@kjun-ui/react 0.21.0 → 0.22.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 +19 -5
- package/dist/index.cjs +8405 -3740
- package/dist/index.js +8199 -3512
- package/dist/styles.css +2610 -454
- package/dist/types/packages/react/src/actions.d.cts +21 -16
- package/dist/types/packages/react/src/actions.d.ts +21 -16
- package/dist/types/packages/react/src/app-navigation.d.cts +6 -2
- package/dist/types/packages/react/src/app-navigation.d.ts +6 -2
- package/dist/types/packages/react/src/avatar-group.d.cts +36 -0
- package/dist/types/packages/react/src/avatar-group.d.ts +36 -0
- package/dist/types/packages/react/src/button.d.cts +14 -6
- package/dist/types/packages/react/src/button.d.ts +14 -6
- package/dist/types/packages/react/src/calendar.d.cts +6 -2
- package/dist/types/packages/react/src/calendar.d.ts +6 -2
- package/dist/types/packages/react/src/card.d.cts +10 -3
- package/dist/types/packages/react/src/card.d.ts +10 -3
- package/dist/types/packages/react/src/carousel.d.cts +8 -1
- package/dist/types/packages/react/src/carousel.d.ts +8 -1
- package/dist/types/packages/react/src/choice-controls.d.cts +99 -0
- package/dist/types/packages/react/src/choice-controls.d.ts +99 -0
- package/dist/types/packages/react/src/collapse.d.cts +4 -1
- package/dist/types/packages/react/src/collapse.d.ts +4 -1
- package/dist/types/packages/react/src/color-picker.d.cts +8 -1
- package/dist/types/packages/react/src/color-picker.d.ts +8 -1
- package/dist/types/packages/react/src/combobox.d.cts +18 -5
- package/dist/types/packages/react/src/combobox.d.ts +18 -5
- package/dist/types/packages/react/src/controls.d.cts +7 -74
- package/dist/types/packages/react/src/controls.d.ts +7 -74
- package/dist/types/packages/react/src/data-state.d.cts +19 -6
- package/dist/types/packages/react/src/data-state.d.ts +19 -6
- package/dist/types/packages/react/src/date-picker.d.cts +8 -2
- package/dist/types/packages/react/src/date-picker.d.ts +8 -2
- package/dist/types/packages/react/src/display.d.cts +26 -6
- package/dist/types/packages/react/src/display.d.ts +26 -6
- package/dist/types/packages/react/src/drawer.d.cts +11 -2
- package/dist/types/packages/react/src/drawer.d.ts +11 -2
- package/dist/types/packages/react/src/dropdown.d.cts +19 -5
- package/dist/types/packages/react/src/dropdown.d.ts +19 -5
- package/dist/types/packages/react/src/event-calendar.d.cts +47 -0
- package/dist/types/packages/react/src/event-calendar.d.ts +47 -0
- package/dist/types/packages/react/src/fab.d.cts +2 -0
- package/dist/types/packages/react/src/fab.d.ts +2 -0
- package/dist/types/packages/react/src/file-upload-row.d.cts +23 -0
- package/dist/types/packages/react/src/file-upload-row.d.ts +23 -0
- package/dist/types/packages/react/src/file-upload.d.cts +38 -0
- package/dist/types/packages/react/src/file-upload.d.ts +38 -0
- package/dist/types/packages/react/src/financial-display.d.cts +32 -11
- package/dist/types/packages/react/src/financial-display.d.ts +32 -11
- package/dist/types/packages/react/src/floating-panel.d.cts +6 -2
- package/dist/types/packages/react/src/floating-panel.d.ts +6 -2
- package/dist/types/packages/react/src/index.d.cts +12 -1
- package/dist/types/packages/react/src/index.d.ts +12 -1
- package/dist/types/packages/react/src/input.d.cts +14 -1
- package/dist/types/packages/react/src/input.d.ts +14 -1
- package/dist/types/packages/react/src/kpi-hero.d.cts +2 -0
- package/dist/types/packages/react/src/kpi-hero.d.ts +2 -0
- package/dist/types/packages/react/src/kpi-row.d.cts +5 -0
- package/dist/types/packages/react/src/kpi-row.d.ts +5 -0
- package/dist/types/packages/react/src/layout-primitives.d.cts +71 -139
- package/dist/types/packages/react/src/layout-primitives.d.ts +71 -139
- package/dist/types/packages/react/src/list-context.d.cts +2 -1
- package/dist/types/packages/react/src/list-context.d.ts +2 -1
- package/dist/types/packages/react/src/list.d.cts +39 -8
- package/dist/types/packages/react/src/list.d.ts +39 -8
- package/dist/types/packages/react/src/market-model.d.cts +13 -1
- package/dist/types/packages/react/src/market-model.d.ts +13 -1
- package/dist/types/packages/react/src/market-parts.d.cts +9 -0
- package/dist/types/packages/react/src/market-parts.d.ts +9 -0
- package/dist/types/packages/react/src/market-skeleton.d.cts +7 -1
- package/dist/types/packages/react/src/market-skeleton.d.ts +7 -1
- package/dist/types/packages/react/src/media.d.cts +6 -2
- package/dist/types/packages/react/src/media.d.ts +6 -2
- package/dist/types/packages/react/src/modal.d.cts +11 -2
- package/dist/types/packages/react/src/modal.d.ts +11 -2
- package/dist/types/packages/react/src/navigation.d.cts +34 -5
- package/dist/types/packages/react/src/navigation.d.ts +34 -5
- package/dist/types/packages/react/src/number-display.d.cts +8 -5
- package/dist/types/packages/react/src/number-display.d.ts +8 -5
- package/dist/types/packages/react/src/number-input.d.cts +28 -0
- package/dist/types/packages/react/src/number-input.d.ts +28 -0
- package/dist/types/packages/react/src/popover.d.cts +5 -2
- package/dist/types/packages/react/src/popover.d.ts +5 -2
- package/dist/types/packages/react/src/pressable.d.cts +17 -0
- package/dist/types/packages/react/src/pressable.d.ts +17 -0
- package/dist/types/packages/react/src/quantity-stepper.d.cts +3 -1
- package/dist/types/packages/react/src/quantity-stepper.d.ts +3 -1
- package/dist/types/packages/react/src/range-input.d.cts +15 -3
- package/dist/types/packages/react/src/range-input.d.ts +15 -3
- package/dist/types/packages/react/src/search-input.d.cts +6 -3
- package/dist/types/packages/react/src/search-input.d.ts +6 -3
- package/dist/types/packages/react/src/select-control.d.cts +7 -2
- package/dist/types/packages/react/src/select-control.d.ts +7 -2
- package/dist/types/packages/react/src/side-navigation-layout.d.cts +47 -0
- package/dist/types/packages/react/src/side-navigation-layout.d.ts +47 -0
- package/dist/types/packages/react/src/side-navigation.d.cts +74 -0
- package/dist/types/packages/react/src/side-navigation.d.ts +74 -0
- package/dist/types/packages/react/src/skeletons.d.cts +18 -3
- package/dist/types/packages/react/src/skeletons.d.ts +18 -3
- package/dist/types/packages/react/src/spinner-glyph.d.cts +8 -0
- package/dist/types/packages/react/src/spinner-glyph.d.ts +8 -0
- package/dist/types/packages/react/src/split-pane.d.cts +18 -5
- package/dist/types/packages/react/src/split-pane.d.ts +18 -5
- package/dist/types/packages/react/src/stacked-bar.d.cts +3 -1
- package/dist/types/packages/react/src/stacked-bar.d.ts +3 -1
- package/dist/types/packages/react/src/steps.d.cts +26 -0
- package/dist/types/packages/react/src/steps.d.ts +26 -0
- package/dist/types/packages/react/src/table-cards.d.cts +4 -12
- package/dist/types/packages/react/src/table-cards.d.ts +4 -12
- package/dist/types/packages/react/src/table-grid.d.cts +3 -7
- package/dist/types/packages/react/src/table-grid.d.ts +3 -7
- package/dist/types/packages/react/src/table-groups.d.cts +5 -0
- package/dist/types/packages/react/src/table-groups.d.ts +5 -0
- package/dist/types/packages/react/src/table-list.d.cts +2 -9
- package/dist/types/packages/react/src/table-list.d.ts +2 -9
- package/dist/types/packages/react/src/table-model.d.cts +6 -2
- package/dist/types/packages/react/src/table-model.d.ts +6 -2
- package/dist/types/packages/react/src/tabs.d.cts +3 -1
- package/dist/types/packages/react/src/tabs.d.ts +3 -1
- package/dist/types/packages/react/src/textarea.d.cts +6 -3
- package/dist/types/packages/react/src/textarea.d.ts +6 -3
- package/dist/types/packages/react/src/tiles.d.cts +18 -0
- package/dist/types/packages/react/src/tiles.d.ts +18 -0
- package/dist/types/packages/react/src/time-picker.d.cts +12 -2
- package/dist/types/packages/react/src/time-picker.d.ts +12 -2
- package/dist/types/packages/react/src/time-wheel.d.cts +18 -0
- package/dist/types/packages/react/src/time-wheel.d.ts +18 -0
- package/dist/types/packages/react/src/use-filter-scroll.d.cts +5 -0
- package/dist/types/packages/react/src/use-filter-scroll.d.ts +5 -0
- package/dist/types/shared/package-runtime/accordion-state.d.cts +2 -0
- package/dist/types/shared/package-runtime/accordion-state.d.ts +2 -0
- package/dist/types/shared/package-runtime/action-size.d.cts +4 -0
- package/dist/types/shared/package-runtime/action-size.d.ts +4 -0
- package/dist/types/shared/package-runtime/alert-actions.d.cts +7 -0
- package/dist/types/shared/package-runtime/alert-actions.d.ts +7 -0
- package/dist/types/shared/package-runtime/alert-exit.d.cts +6 -0
- package/dist/types/shared/package-runtime/alert-exit.d.ts +6 -0
- package/dist/types/shared/package-runtime/alert-live.d.cts +2 -0
- package/dist/types/shared/package-runtime/alert-live.d.ts +2 -0
- package/dist/types/shared/package-runtime/avatar-group.d.cts +18 -0
- package/dist/types/shared/package-runtime/avatar-group.d.ts +18 -0
- package/dist/types/shared/package-runtime/badge-tone.d.cts +8 -2
- package/dist/types/shared/package-runtime/badge-tone.d.ts +8 -2
- package/dist/types/shared/package-runtime/bottom-bar.d.cts +1 -1
- package/dist/types/shared/package-runtime/bottom-bar.d.ts +1 -1
- package/dist/types/shared/package-runtime/bottom-navigation.d.cts +5 -0
- package/dist/types/shared/package-runtime/bottom-navigation.d.ts +5 -0
- package/dist/types/shared/package-runtime/calendar.d.cts +21 -7
- package/dist/types/shared/package-runtime/calendar.d.ts +21 -7
- package/dist/types/shared/package-runtime/card-layout.d.cts +8 -0
- package/dist/types/shared/package-runtime/card-layout.d.ts +8 -0
- package/dist/types/shared/package-runtime/carousel-scroll.d.cts +2 -0
- package/dist/types/shared/package-runtime/carousel-scroll.d.ts +2 -0
- package/dist/types/shared/package-runtime/carousel.d.cts +12 -2
- package/dist/types/shared/package-runtime/carousel.d.ts +12 -2
- package/dist/types/shared/package-runtime/chart-skeleton.d.cts +1 -1
- package/dist/types/shared/package-runtime/chart-skeleton.d.ts +1 -1
- package/dist/types/shared/package-runtime/clipboard.d.cts +6 -0
- package/dist/types/shared/package-runtime/clipboard.d.ts +6 -0
- package/dist/types/shared/package-runtime/combobox-options.d.cts +13 -0
- package/dist/types/shared/package-runtime/combobox-options.d.ts +13 -0
- package/dist/types/shared/package-runtime/combobox.d.cts +3 -1
- package/dist/types/shared/package-runtime/combobox.d.ts +3 -1
- package/dist/types/shared/package-runtime/copy-button.d.cts +11 -0
- package/dist/types/shared/package-runtime/copy-button.d.ts +11 -0
- package/dist/types/shared/package-runtime/data-cells.d.cts +36 -0
- package/dist/types/shared/package-runtime/data-cells.d.ts +36 -0
- package/dist/types/shared/package-runtime/development.d.cts +4 -0
- package/dist/types/shared/package-runtime/development.d.ts +4 -0
- package/dist/types/shared/package-runtime/distribution.d.cts +36 -1
- package/dist/types/shared/package-runtime/distribution.d.ts +36 -1
- package/dist/types/shared/package-runtime/drawer-geometry.d.cts +7 -0
- package/dist/types/shared/package-runtime/drawer-geometry.d.ts +7 -0
- package/dist/types/shared/package-runtime/event-calendar.d.cts +81 -0
- package/dist/types/shared/package-runtime/event-calendar.d.ts +81 -0
- package/dist/types/shared/package-runtime/external-link.d.cts +4 -0
- package/dist/types/shared/package-runtime/external-link.d.ts +4 -0
- package/dist/types/shared/package-runtime/file-upload.d.cts +128 -0
- package/dist/types/shared/package-runtime/file-upload.d.ts +128 -0
- package/dist/types/shared/package-runtime/filter-scroll.d.cts +5 -0
- package/dist/types/shared/package-runtime/filter-scroll.d.ts +5 -0
- package/dist/types/shared/package-runtime/filter-value.d.cts +2 -0
- package/dist/types/shared/package-runtime/filter-value.d.ts +2 -0
- package/dist/types/shared/package-runtime/input-field.d.cts +23 -0
- package/dist/types/shared/package-runtime/input-field.d.ts +23 -0
- package/dist/types/shared/package-runtime/input-variant.d.cts +7 -0
- package/dist/types/shared/package-runtime/input-variant.d.ts +7 -0
- package/dist/types/shared/package-runtime/kpi.d.cts +13 -0
- package/dist/types/shared/package-runtime/kpi.d.ts +13 -0
- package/dist/types/shared/package-runtime/layout-primitives.d.cts +115 -6
- package/dist/types/shared/package-runtime/layout-primitives.d.ts +115 -6
- package/dist/types/shared/package-runtime/list-row.d.cts +43 -6
- package/dist/types/shared/package-runtime/list-row.d.ts +43 -6
- package/dist/types/shared/package-runtime/market-layout.d.cts +3 -1
- package/dist/types/shared/package-runtime/market-layout.d.ts +3 -1
- package/dist/types/shared/package-runtime/market-query.d.cts +6 -0
- package/dist/types/shared/package-runtime/market-query.d.ts +6 -0
- package/dist/types/shared/package-runtime/market-table.d.cts +32 -0
- package/dist/types/shared/package-runtime/market-table.d.ts +32 -0
- package/dist/types/shared/package-runtime/menu-button.d.cts +4 -0
- package/dist/types/shared/package-runtime/menu-button.d.ts +4 -0
- package/dist/types/shared/package-runtime/messages/ko.d.cts +74 -1
- package/dist/types/shared/package-runtime/messages/ko.d.ts +74 -1
- package/dist/types/shared/package-runtime/messages-context.d.cts +66 -1
- package/dist/types/shared/package-runtime/messages-context.d.ts +66 -1
- package/dist/types/shared/package-runtime/minimum-loading.d.cts +3 -0
- package/dist/types/shared/package-runtime/minimum-loading.d.ts +3 -0
- package/dist/types/shared/package-runtime/modal-geometry.d.cts +15 -0
- package/dist/types/shared/package-runtime/modal-geometry.d.ts +15 -0
- package/dist/types/shared/package-runtime/navigation.d.cts +9 -2
- package/dist/types/shared/package-runtime/navigation.d.ts +9 -2
- package/dist/types/shared/package-runtime/nested-controls.d.cts +7 -0
- package/dist/types/shared/package-runtime/nested-controls.d.ts +7 -0
- package/dist/types/shared/package-runtime/number-input.d.cts +63 -0
- package/dist/types/shared/package-runtime/number-input.d.ts +63 -0
- package/dist/types/shared/package-runtime/options.d.cts +25 -5
- package/dist/types/shared/package-runtime/options.d.ts +25 -5
- package/dist/types/shared/package-runtime/pagination.d.cts +12 -0
- package/dist/types/shared/package-runtime/pagination.d.ts +12 -0
- package/dist/types/shared/package-runtime/press-repeat.d.cts +13 -0
- package/dist/types/shared/package-runtime/press-repeat.d.ts +13 -0
- package/dist/types/shared/package-runtime/progress-circle.d.cts +5 -0
- package/dist/types/shared/package-runtime/progress-circle.d.ts +5 -0
- package/dist/types/shared/package-runtime/progress-marker.d.cts +7 -0
- package/dist/types/shared/package-runtime/progress-marker.d.ts +7 -0
- package/dist/types/shared/package-runtime/select-trigger.d.cts +23 -0
- package/dist/types/shared/package-runtime/select-trigger.d.ts +23 -0
- package/dist/types/shared/package-runtime/sheet-drag.d.cts +24 -0
- package/dist/types/shared/package-runtime/sheet-drag.d.ts +24 -0
- package/dist/types/shared/package-runtime/side-navigation-keys.d.cts +23 -0
- package/dist/types/shared/package-runtime/side-navigation-keys.d.ts +23 -0
- package/dist/types/shared/package-runtime/side-navigation-scroll.d.cts +7 -0
- package/dist/types/shared/package-runtime/side-navigation-scroll.d.ts +7 -0
- package/dist/types/shared/package-runtime/side-navigation.d.cts +277 -0
- package/dist/types/shared/package-runtime/side-navigation.d.ts +277 -0
- package/dist/types/shared/package-runtime/signed-number.d.cts +33 -0
- package/dist/types/shared/package-runtime/signed-number.d.ts +33 -0
- package/dist/types/shared/package-runtime/skeleton-text.d.cts +4 -0
- package/dist/types/shared/package-runtime/skeleton-text.d.ts +4 -0
- package/dist/types/shared/package-runtime/slider-view.d.cts +17 -2
- package/dist/types/shared/package-runtime/slider-view.d.ts +17 -2
- package/dist/types/shared/package-runtime/sparkline.d.cts +8 -4
- package/dist/types/shared/package-runtime/sparkline.d.ts +8 -4
- package/dist/types/shared/package-runtime/spinner-geometry.d.cts +14 -0
- package/dist/types/shared/package-runtime/spinner-geometry.d.ts +14 -0
- package/dist/types/shared/package-runtime/split-pane.d.cts +40 -1
- package/dist/types/shared/package-runtime/split-pane.d.ts +40 -1
- package/dist/types/shared/package-runtime/steps.d.cts +37 -0
- package/dist/types/shared/package-runtime/steps.d.ts +37 -0
- package/dist/types/shared/package-runtime/tab-keyboard.d.cts +6 -0
- package/dist/types/shared/package-runtime/tab-keyboard.d.ts +6 -0
- package/dist/types/shared/package-runtime/table-columns.d.cts +8 -0
- package/dist/types/shared/package-runtime/table-columns.d.ts +8 -0
- package/dist/types/shared/package-runtime/table-model.d.cts +23 -3
- package/dist/types/shared/package-runtime/table-model.d.ts +23 -3
- package/dist/types/shared/package-runtime/table-presentation.d.cts +11 -2
- package/dist/types/shared/package-runtime/table-presentation.d.ts +11 -2
- package/dist/types/shared/package-runtime/table.d.cts +15 -2
- package/dist/types/shared/package-runtime/table.d.ts +15 -2
- package/dist/types/shared/package-runtime/textarea.d.cts +6 -4
- package/dist/types/shared/package-runtime/textarea.d.ts +6 -4
- package/dist/types/shared/package-runtime/tiles-children.d.cts +7 -0
- package/dist/types/shared/package-runtime/tiles-children.d.ts +7 -0
- package/dist/types/shared/package-runtime/tiles.d.cts +18 -0
- package/dist/types/shared/package-runtime/tiles.d.ts +18 -0
- package/dist/types/shared/package-runtime/time-segments.d.cts +24 -0
- package/dist/types/shared/package-runtime/time-segments.d.ts +24 -0
- package/dist/types/shared/package-runtime/time-wheel.d.cts +54 -0
- package/dist/types/shared/package-runtime/time-wheel.d.ts +54 -0
- package/dist/types/shared/package-runtime/trailing-overflow.d.cts +1 -0
- package/dist/types/shared/package-runtime/trailing-overflow.d.ts +1 -0
- package/dist/types/shared/package-runtime/use-color-picker.d.cts +3 -0
- package/dist/types/shared/package-runtime/use-color-picker.d.ts +3 -0
- package/dist/types/shared/package-runtime/use-copy-feedback.d.cts +10 -0
- package/dist/types/shared/package-runtime/use-copy-feedback.d.ts +10 -0
- package/dist/types/shared/package-runtime/use-open-state.d.cts +5 -0
- package/dist/types/shared/package-runtime/use-open-state.d.ts +5 -0
- package/dist/types/shared/package-runtime/use-pending-action.d.cts +6 -0
- package/dist/types/shared/package-runtime/use-pending-action.d.ts +6 -0
- package/dist/types/shared/package-runtime/use-side-navigation-state.d.cts +25 -0
- package/dist/types/shared/package-runtime/use-side-navigation-state.d.ts +25 -0
- package/dist/types/shared/package-runtime/use-slide.d.cts +3 -0
- package/dist/types/shared/package-runtime/use-slide.d.ts +3 -0
- package/package.json +3 -3
- package/dist/types/packages/react/src/compound-control.d.cts +0 -1
- package/dist/types/packages/react/src/compound-control.d.ts +0 -1
- package/dist/types/shared/package-runtime/center-option.d.cts +0 -1
- package/dist/types/shared/package-runtime/center-option.d.ts +0 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { KjunMessages } from "./messages/index.cjs";
|
|
2
|
+
export type KjunUploadStatus = "queued" | "uploading" | "done" | "error";
|
|
3
|
+
export interface KjunUploadFile {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
/** Bytes. */
|
|
7
|
+
size: number;
|
|
8
|
+
status: KjunUploadStatus;
|
|
9
|
+
/** 0–100 while uploading; leave it out for an indeterminate bar. */
|
|
10
|
+
progress?: number;
|
|
11
|
+
/** Text shown on a failed row; the default message is used without it. */
|
|
12
|
+
error?: string;
|
|
13
|
+
/** Image thumbnail; the extension is shown without it. */
|
|
14
|
+
previewUrl?: string;
|
|
15
|
+
type?: string;
|
|
16
|
+
}
|
|
17
|
+
export type KjunRejectReason = "type" | "size" | "count";
|
|
18
|
+
export interface KjunRejectedFile<T> {
|
|
19
|
+
file: T;
|
|
20
|
+
reason: KjunRejectReason;
|
|
21
|
+
}
|
|
22
|
+
/** What a Native picker returns; Web hands over File objects instead. */
|
|
23
|
+
export interface KjunPickedFile {
|
|
24
|
+
name: string;
|
|
25
|
+
size: number;
|
|
26
|
+
type?: string;
|
|
27
|
+
uri?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface UploadLimits {
|
|
30
|
+
accept?: string;
|
|
31
|
+
maxSize?: number;
|
|
32
|
+
maxFiles?: number;
|
|
33
|
+
multiple?: boolean;
|
|
34
|
+
current: number;
|
|
35
|
+
}
|
|
36
|
+
export type DragVerdict = "ok" | "type" | "count" | "unknown";
|
|
37
|
+
/** The <input accept> rules: ".ext" by name, "type/*" and "type/sub" by MIME. An empty accept takes anything. */
|
|
38
|
+
export declare function matchesAccept(name: string, type: string | undefined, accept?: string): boolean;
|
|
39
|
+
/** Free places: one in single-file mode (the pick replaces the file), unlimited without maxFiles. */
|
|
40
|
+
export declare function uploadRoom({ maxFiles, multiple, current }: UploadLimits): number;
|
|
41
|
+
/** Checks type, then size, then fills the free places in order; the rest are rejected as count. */
|
|
42
|
+
export declare function screenFiles<T extends {
|
|
43
|
+
name: string;
|
|
44
|
+
size: number;
|
|
45
|
+
type?: string;
|
|
46
|
+
}>(files: T[], limits: UploadLimits): {
|
|
47
|
+
accepted: T[];
|
|
48
|
+
rejected: KjunRejectedFile<T>[];
|
|
49
|
+
};
|
|
50
|
+
/** What a drag can tell before the drop: the number of files and, in some browsers, their MIME types. Never size. */
|
|
51
|
+
export declare function dragVerdict(items: {
|
|
52
|
+
kind: string;
|
|
53
|
+
type: string;
|
|
54
|
+
}[], limits: UploadLimits): {
|
|
55
|
+
verdict: DragVerdict;
|
|
56
|
+
count: number;
|
|
57
|
+
room: number;
|
|
58
|
+
};
|
|
59
|
+
/** Middle truncation: the head may be cut, the tail (last 4 stem characters and the extension) always shows. */
|
|
60
|
+
export declare function splitFileName(name: string): {
|
|
61
|
+
head: string;
|
|
62
|
+
tail: string;
|
|
63
|
+
};
|
|
64
|
+
/** Thumbnail text for a file without a preview: the extension in capitals, at most 4 letters. */
|
|
65
|
+
export declare function extensionLabel(name: string, _type?: string): string;
|
|
66
|
+
/** 1024 steps; one decimal under 100, none from 100 up; no space before the unit. */
|
|
67
|
+
export declare function formatBytes(bytes: number, intl?: string): string;
|
|
68
|
+
export declare function clampProgress(progress: number | undefined): number | undefined;
|
|
69
|
+
export declare function uploadSummary(files: {
|
|
70
|
+
status: KjunUploadStatus;
|
|
71
|
+
}[]): {
|
|
72
|
+
total: number;
|
|
73
|
+
done: number;
|
|
74
|
+
failed: number;
|
|
75
|
+
uploading: number;
|
|
76
|
+
queued: number;
|
|
77
|
+
};
|
|
78
|
+
/** Rows that just became done or failed, for the live region. The first render (no previous state) announces nothing. */
|
|
79
|
+
export declare function uploadTransitions(prev: Record<string, KjunUploadStatus>, files: KjunUploadFile[]): {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
status: "done" | "error";
|
|
83
|
+
}[];
|
|
84
|
+
export declare const uploadStatuses: (files: KjunUploadFile[]) => Record<string, KjunUploadStatus>;
|
|
85
|
+
/** After a row is removed, focus the next row, else the previous one; null means the add button. */
|
|
86
|
+
export declare function focusAfterRemove(ids: string[], removed: string): string | null;
|
|
87
|
+
/** ".pdf,image/png,video/*" → labels ["PDF","PNG"], groups ["video"]; groups are named by the messages. */
|
|
88
|
+
export declare function acceptLabels(accept?: string): {
|
|
89
|
+
labels: string[];
|
|
90
|
+
groups: string[];
|
|
91
|
+
};
|
|
92
|
+
export type KjunUploadSize = "md" | "compact";
|
|
93
|
+
export type KjunUploadTrigger = "area" | "button";
|
|
94
|
+
export type KjunUploadLayout = "list" | "grid";
|
|
95
|
+
export type DragState = {
|
|
96
|
+
verdict: DragVerdict;
|
|
97
|
+
count: number;
|
|
98
|
+
room: number;
|
|
99
|
+
} | null;
|
|
100
|
+
/** How many rejected files are listed by name; the rest fold into one "n more" line. */
|
|
101
|
+
export declare const REJECTION_LINES = 3;
|
|
102
|
+
/** The rejection notice (and its announcement): the first three by name, then one "n more" line. */
|
|
103
|
+
export declare function rejectionLines<T extends {
|
|
104
|
+
name: string;
|
|
105
|
+
}>(m: KjunMessages, list: KjunRejectedFile<T>[], sizeText?: string): string[];
|
|
106
|
+
/** A drag that cannot add anything: a refused type, or no room left at all. */
|
|
107
|
+
export declare const dragBlocked: (drag: DragState) => boolean;
|
|
108
|
+
/** What the zone (empty) or the veil (filled) says and shows while files are dragged over the card. */
|
|
109
|
+
export declare function dragCopy(m: KjunMessages, drag: DragState, types: string, maxFiles?: number): {
|
|
110
|
+
title: string;
|
|
111
|
+
hint: string;
|
|
112
|
+
icon: string;
|
|
113
|
+
blocked: boolean;
|
|
114
|
+
} | null;
|
|
115
|
+
/** The allowed types in words: extensions and exact MIME in capitals, wildcard groups named by the messages. */
|
|
116
|
+
export declare function acceptText(m: KjunMessages, accept?: string): string;
|
|
117
|
+
/** The row's × cancels a file still waiting or uploading and removes one that finished or failed. */
|
|
118
|
+
export declare const removeLabel: (m: KjunMessages, file: {
|
|
119
|
+
name: string;
|
|
120
|
+
status: KjunUploadStatus;
|
|
121
|
+
}) => string;
|
|
122
|
+
/** A tile's name for assistive tech: the file name, then its state in words. */
|
|
123
|
+
export declare function tileLabel(m: KjunMessages, file: KjunUploadFile): string;
|
|
124
|
+
/** Grid columns that keep every tile at least `min` wide, and the tile width that fills the row. */
|
|
125
|
+
export declare function gridColumns(width: number, min: number, gap: number): {
|
|
126
|
+
columns: number;
|
|
127
|
+
tile: number;
|
|
128
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { KjunMessages } from "./messages/index.js";
|
|
2
|
+
export type KjunUploadStatus = "queued" | "uploading" | "done" | "error";
|
|
3
|
+
export interface KjunUploadFile {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
/** Bytes. */
|
|
7
|
+
size: number;
|
|
8
|
+
status: KjunUploadStatus;
|
|
9
|
+
/** 0–100 while uploading; leave it out for an indeterminate bar. */
|
|
10
|
+
progress?: number;
|
|
11
|
+
/** Text shown on a failed row; the default message is used without it. */
|
|
12
|
+
error?: string;
|
|
13
|
+
/** Image thumbnail; the extension is shown without it. */
|
|
14
|
+
previewUrl?: string;
|
|
15
|
+
type?: string;
|
|
16
|
+
}
|
|
17
|
+
export type KjunRejectReason = "type" | "size" | "count";
|
|
18
|
+
export interface KjunRejectedFile<T> {
|
|
19
|
+
file: T;
|
|
20
|
+
reason: KjunRejectReason;
|
|
21
|
+
}
|
|
22
|
+
/** What a Native picker returns; Web hands over File objects instead. */
|
|
23
|
+
export interface KjunPickedFile {
|
|
24
|
+
name: string;
|
|
25
|
+
size: number;
|
|
26
|
+
type?: string;
|
|
27
|
+
uri?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface UploadLimits {
|
|
30
|
+
accept?: string;
|
|
31
|
+
maxSize?: number;
|
|
32
|
+
maxFiles?: number;
|
|
33
|
+
multiple?: boolean;
|
|
34
|
+
current: number;
|
|
35
|
+
}
|
|
36
|
+
export type DragVerdict = "ok" | "type" | "count" | "unknown";
|
|
37
|
+
/** The <input accept> rules: ".ext" by name, "type/*" and "type/sub" by MIME. An empty accept takes anything. */
|
|
38
|
+
export declare function matchesAccept(name: string, type: string | undefined, accept?: string): boolean;
|
|
39
|
+
/** Free places: one in single-file mode (the pick replaces the file), unlimited without maxFiles. */
|
|
40
|
+
export declare function uploadRoom({ maxFiles, multiple, current }: UploadLimits): number;
|
|
41
|
+
/** Checks type, then size, then fills the free places in order; the rest are rejected as count. */
|
|
42
|
+
export declare function screenFiles<T extends {
|
|
43
|
+
name: string;
|
|
44
|
+
size: number;
|
|
45
|
+
type?: string;
|
|
46
|
+
}>(files: T[], limits: UploadLimits): {
|
|
47
|
+
accepted: T[];
|
|
48
|
+
rejected: KjunRejectedFile<T>[];
|
|
49
|
+
};
|
|
50
|
+
/** What a drag can tell before the drop: the number of files and, in some browsers, their MIME types. Never size. */
|
|
51
|
+
export declare function dragVerdict(items: {
|
|
52
|
+
kind: string;
|
|
53
|
+
type: string;
|
|
54
|
+
}[], limits: UploadLimits): {
|
|
55
|
+
verdict: DragVerdict;
|
|
56
|
+
count: number;
|
|
57
|
+
room: number;
|
|
58
|
+
};
|
|
59
|
+
/** Middle truncation: the head may be cut, the tail (last 4 stem characters and the extension) always shows. */
|
|
60
|
+
export declare function splitFileName(name: string): {
|
|
61
|
+
head: string;
|
|
62
|
+
tail: string;
|
|
63
|
+
};
|
|
64
|
+
/** Thumbnail text for a file without a preview: the extension in capitals, at most 4 letters. */
|
|
65
|
+
export declare function extensionLabel(name: string, _type?: string): string;
|
|
66
|
+
/** 1024 steps; one decimal under 100, none from 100 up; no space before the unit. */
|
|
67
|
+
export declare function formatBytes(bytes: number, intl?: string): string;
|
|
68
|
+
export declare function clampProgress(progress: number | undefined): number | undefined;
|
|
69
|
+
export declare function uploadSummary(files: {
|
|
70
|
+
status: KjunUploadStatus;
|
|
71
|
+
}[]): {
|
|
72
|
+
total: number;
|
|
73
|
+
done: number;
|
|
74
|
+
failed: number;
|
|
75
|
+
uploading: number;
|
|
76
|
+
queued: number;
|
|
77
|
+
};
|
|
78
|
+
/** Rows that just became done or failed, for the live region. The first render (no previous state) announces nothing. */
|
|
79
|
+
export declare function uploadTransitions(prev: Record<string, KjunUploadStatus>, files: KjunUploadFile[]): {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
status: "done" | "error";
|
|
83
|
+
}[];
|
|
84
|
+
export declare const uploadStatuses: (files: KjunUploadFile[]) => Record<string, KjunUploadStatus>;
|
|
85
|
+
/** After a row is removed, focus the next row, else the previous one; null means the add button. */
|
|
86
|
+
export declare function focusAfterRemove(ids: string[], removed: string): string | null;
|
|
87
|
+
/** ".pdf,image/png,video/*" → labels ["PDF","PNG"], groups ["video"]; groups are named by the messages. */
|
|
88
|
+
export declare function acceptLabels(accept?: string): {
|
|
89
|
+
labels: string[];
|
|
90
|
+
groups: string[];
|
|
91
|
+
};
|
|
92
|
+
export type KjunUploadSize = "md" | "compact";
|
|
93
|
+
export type KjunUploadTrigger = "area" | "button";
|
|
94
|
+
export type KjunUploadLayout = "list" | "grid";
|
|
95
|
+
export type DragState = {
|
|
96
|
+
verdict: DragVerdict;
|
|
97
|
+
count: number;
|
|
98
|
+
room: number;
|
|
99
|
+
} | null;
|
|
100
|
+
/** How many rejected files are listed by name; the rest fold into one "n more" line. */
|
|
101
|
+
export declare const REJECTION_LINES = 3;
|
|
102
|
+
/** The rejection notice (and its announcement): the first three by name, then one "n more" line. */
|
|
103
|
+
export declare function rejectionLines<T extends {
|
|
104
|
+
name: string;
|
|
105
|
+
}>(m: KjunMessages, list: KjunRejectedFile<T>[], sizeText?: string): string[];
|
|
106
|
+
/** A drag that cannot add anything: a refused type, or no room left at all. */
|
|
107
|
+
export declare const dragBlocked: (drag: DragState) => boolean;
|
|
108
|
+
/** What the zone (empty) or the veil (filled) says and shows while files are dragged over the card. */
|
|
109
|
+
export declare function dragCopy(m: KjunMessages, drag: DragState, types: string, maxFiles?: number): {
|
|
110
|
+
title: string;
|
|
111
|
+
hint: string;
|
|
112
|
+
icon: string;
|
|
113
|
+
blocked: boolean;
|
|
114
|
+
} | null;
|
|
115
|
+
/** The allowed types in words: extensions and exact MIME in capitals, wildcard groups named by the messages. */
|
|
116
|
+
export declare function acceptText(m: KjunMessages, accept?: string): string;
|
|
117
|
+
/** The row's × cancels a file still waiting or uploading and removes one that finished or failed. */
|
|
118
|
+
export declare const removeLabel: (m: KjunMessages, file: {
|
|
119
|
+
name: string;
|
|
120
|
+
status: KjunUploadStatus;
|
|
121
|
+
}) => string;
|
|
122
|
+
/** A tile's name for assistive tech: the file name, then its state in words. */
|
|
123
|
+
export declare function tileLabel(m: KjunMessages, file: KjunUploadFile): string;
|
|
124
|
+
/** Grid columns that keep every tile at least `min` wide, and the tile width that fills the row. */
|
|
125
|
+
export declare function gridColumns(width: number, min: number, gap: number): {
|
|
126
|
+
columns: number;
|
|
127
|
+
tile: number;
|
|
128
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** A field holds a value when it is not empty; the number 0 is a value. */
|
|
2
|
+
export declare const inputHasValue: (value: string | number | null | undefined) => boolean;
|
|
3
|
+
/** The clear button shows only while there is a value the person can remove. */
|
|
4
|
+
export declare const inputShowsClear: ({ clearable, value, disabled, readOnly }: {
|
|
5
|
+
clearable?: boolean;
|
|
6
|
+
value: string | number | null | undefined;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
}) => boolean;
|
|
10
|
+
/** A password field the person can reveal: the type it renders with and whether the reveal button shows. */
|
|
11
|
+
export declare function inputReveal(type: string | undefined, revealable: boolean | undefined, revealed: boolean): {
|
|
12
|
+
active: boolean;
|
|
13
|
+
type: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
/** Input's character count follows Textarea's: "length/maxLength", over the limit reads as an error. */
|
|
16
|
+
export declare function inputCount(value: string | number | null | undefined, maxLength?: number): {
|
|
17
|
+
remaining: number | null;
|
|
18
|
+
length: number;
|
|
19
|
+
text: string;
|
|
20
|
+
over: boolean;
|
|
21
|
+
};
|
|
22
|
+
/** How long a remote search waits after the last keystroke before it asks loadOptions (ms). */
|
|
23
|
+
export declare const searchLoadDelay = 300;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** A field holds a value when it is not empty; the number 0 is a value. */
|
|
2
|
+
export declare const inputHasValue: (value: string | number | null | undefined) => boolean;
|
|
3
|
+
/** The clear button shows only while there is a value the person can remove. */
|
|
4
|
+
export declare const inputShowsClear: ({ clearable, value, disabled, readOnly }: {
|
|
5
|
+
clearable?: boolean;
|
|
6
|
+
value: string | number | null | undefined;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
}) => boolean;
|
|
10
|
+
/** A password field the person can reveal: the type it renders with and whether the reveal button shows. */
|
|
11
|
+
export declare function inputReveal(type: string | undefined, revealable: boolean | undefined, revealed: boolean): {
|
|
12
|
+
active: boolean;
|
|
13
|
+
type: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
/** Input's character count follows Textarea's: "length/maxLength", over the limit reads as an error. */
|
|
16
|
+
export declare function inputCount(value: string | number | null | undefined, maxLength?: number): {
|
|
17
|
+
remaining: number | null;
|
|
18
|
+
length: number;
|
|
19
|
+
text: string;
|
|
20
|
+
over: boolean;
|
|
21
|
+
};
|
|
22
|
+
/** How long a remote search waits after the last keystroke before it asks loadOptions (ms). */
|
|
23
|
+
export declare const searchLoadDelay = 300;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** "plain" drops the field surface: text edited in place, such as a document title or a note body. */
|
|
2
|
+
export type InputVariant = "default" | "plain";
|
|
3
|
+
/** The side inset and side border of a field. A plain field has neither, so its text lines up with the text around it. */
|
|
4
|
+
export declare function inputEdge(variant: InputVariant | undefined, padding: number): {
|
|
5
|
+
padding: number;
|
|
6
|
+
border: number;
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** "plain" drops the field surface: text edited in place, such as a document title or a note body. */
|
|
2
|
+
export type InputVariant = "default" | "plain";
|
|
3
|
+
/** The side inset and side border of a field. A plain field has neither, so its text lines up with the text around it. */
|
|
4
|
+
export declare function inputEdge(variant: InputVariant | undefined, padding: number): {
|
|
5
|
+
padding: number;
|
|
6
|
+
border: number;
|
|
7
|
+
};
|
|
@@ -73,6 +73,19 @@ export declare function kpiSummaryLayout(items: {
|
|
|
73
73
|
secondary: boolean[];
|
|
74
74
|
lastFull: number;
|
|
75
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* The phone grid of a KpiRow outside the summary (two columns, or size="sm" wrapping in two): which column each
|
|
78
|
+
* cell takes and whether it starts below the first line. A mobileFull cell takes the whole line, and so does a cell
|
|
79
|
+
* left alone on its line (the last one, or one before a full cell), so no half cell stays empty. Web and Native
|
|
80
|
+
* draw the same dividers from it: a left line on the second column (not for sm), a top line below the first line.
|
|
81
|
+
*/
|
|
82
|
+
export declare function kpiGridLayout(items: {
|
|
83
|
+
mobileFull?: boolean;
|
|
84
|
+
}[]): {
|
|
85
|
+
column: number;
|
|
86
|
+
full: boolean;
|
|
87
|
+
top: boolean;
|
|
88
|
+
}[];
|
|
76
89
|
/** A row badge is KjunBadge's tone: neutral is the secondary badge. */
|
|
77
90
|
export declare const kpiBadgeVariant: (variant?: KpiBadgeVariant) => BadgeVariant;
|
|
78
91
|
export declare const kpiBadgeRoles: (variant?: KpiBadgeVariant) => BadgeToneRoles;
|
|
@@ -73,6 +73,19 @@ export declare function kpiSummaryLayout(items: {
|
|
|
73
73
|
secondary: boolean[];
|
|
74
74
|
lastFull: number;
|
|
75
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* The phone grid of a KpiRow outside the summary (two columns, or size="sm" wrapping in two): which column each
|
|
78
|
+
* cell takes and whether it starts below the first line. A mobileFull cell takes the whole line, and so does a cell
|
|
79
|
+
* left alone on its line (the last one, or one before a full cell), so no half cell stays empty. Web and Native
|
|
80
|
+
* draw the same dividers from it: a left line on the second column (not for sm), a top line below the first line.
|
|
81
|
+
*/
|
|
82
|
+
export declare function kpiGridLayout(items: {
|
|
83
|
+
mobileFull?: boolean;
|
|
84
|
+
}[]): {
|
|
85
|
+
column: number;
|
|
86
|
+
full: boolean;
|
|
87
|
+
top: boolean;
|
|
88
|
+
}[];
|
|
76
89
|
/** A row badge is KjunBadge's tone: neutral is the secondary badge. */
|
|
77
90
|
export declare const kpiBadgeVariant: (variant?: KpiBadgeVariant) => BadgeVariant;
|
|
78
91
|
export declare const kpiBadgeRoles: (variant?: KpiBadgeVariant) => BadgeToneRoles;
|
|
@@ -1,15 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
1
|
+
/** "inherit" takes the size, line height and weight of the text around it, for a part of a sentence. */
|
|
2
|
+
export type TextVariant = "pageTitle" | "sectionTitle" | "cardTitle" | "bodyLg" | "body" | "bodyLong" | "label" | "labelStrong" | "meta" | "caption" | "captionStrong" | "numberSm" | "numberMd" | "numberLg" | "displaySm" | "displayMd" | "displayLg" | "inherit";
|
|
3
|
+
/** onBrand·onDanger·onSuccess·onWarning are text on a surface filled with that color; inverse is the older name of onBrand. */
|
|
4
|
+
export type TextTone = "default" | "secondary" | "tertiary" | "disabled" | "brand" | "danger" | "success" | "warning" | "info" | "inverse" | "onBrand" | "onDanger" | "onSuccess" | "onWarning";
|
|
3
5
|
export type TextAlign = "start" | "center" | "end";
|
|
4
|
-
export type TextTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div";
|
|
5
|
-
export type
|
|
6
|
+
export type TextTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "dt" | "dd" | "li" | "label" | "legend" | "figcaption" | "time" | "strong" | "em";
|
|
7
|
+
export type TextDecoration = "lineThrough";
|
|
8
|
+
/** space.stack (xs 4 · sm 8 · smMd 12 · md 16 · lg 24) and space.section (sectionSm 32 · sectionMd 48 · sectionLg 64). */
|
|
9
|
+
export type StackGap = "none" | "xs" | "sm" | "smMd" | "md" | "lg" | "sectionSm" | "sectionMd" | "sectionLg";
|
|
10
|
+
/** Earlier spellings of the section steps; they still work and warn once in development. */
|
|
11
|
+
export type LegacyStackGap = "section-sm" | "section-md" | "section-lg";
|
|
12
|
+
/** The breakpoints a responsive value can change at: tokens.responsive.stackCompact·stackMedium·stackWide (640·768·1024 wide and up). */
|
|
13
|
+
export type StackBreakpoint = "compact" | "medium" | "wide";
|
|
14
|
+
/** One value, or a value per width: base below compact, then each named breakpoint and wider. */
|
|
15
|
+
export type Responsive<T> = T | ({
|
|
16
|
+
base?: T;
|
|
17
|
+
} & Partial<Record<StackBreakpoint, T>>);
|
|
18
|
+
export type StackGapValue = Responsive<StackGap | LegacyStackGap>;
|
|
6
19
|
export type StackAlign = "stretch" | "start" | "center" | "end";
|
|
20
|
+
export type StackJustify = "start" | "center" | "end" | "between";
|
|
21
|
+
/** Web only. ul and ol drop the list's bullets and indent; their children should be li. */
|
|
22
|
+
export type StackTag = "div" | "section" | "ul" | "ol" | "nav" | "header" | "footer" | "main" | "article" | "aside" | "form" | "fieldset";
|
|
23
|
+
/** column stacks children, row lines them up; Stack starts as column and Inline as row. */
|
|
24
|
+
export type FlexDirection = "column" | "row";
|
|
25
|
+
export type DirectionValue = Responsive<FlexDirection>;
|
|
26
|
+
/** space.inset: sm 12 · md 16 · lg 24. */
|
|
27
|
+
export type InsetStep = "none" | "sm" | "md" | "lg";
|
|
28
|
+
export type PaddingValue = Responsive<InsetStep>;
|
|
29
|
+
/** true or "full" is a hairline across the stack, "inset" starts it after dividerInset, "strong" is a band for sections. */
|
|
30
|
+
export type StackDivider = boolean | "full" | "inset" | "strong";
|
|
31
|
+
/** viewport follows the screen width (CSS media queries, right on the first paint); container measures the element itself. */
|
|
32
|
+
export type ResponsiveBasis = "viewport" | "container";
|
|
7
33
|
export type InlineGap = "none" | "xs" | "sm" | "md" | "lg";
|
|
34
|
+
export type InlineGapValue = Responsive<InlineGap>;
|
|
8
35
|
export type InlineAlign = "start" | "center" | "end" | "baseline" | "stretch";
|
|
9
36
|
export type InlineJustify = "start" | "center" | "end" | "between";
|
|
37
|
+
/** align and justify also take a value per width, like gap: { base: "stretch", medium: "center" }. */
|
|
38
|
+
export type StackAlignValue = Responsive<StackAlign>;
|
|
39
|
+
export type InlineAlignValue = Responsive<InlineAlign>;
|
|
40
|
+
export type JustifyValue = Responsive<StackJustify>;
|
|
41
|
+
/** The space between the wrapped lines of an Inline: space.stack (xs 4 · sm 8 · smMd 12 · md 16 · lg 24). */
|
|
42
|
+
export type InlineRowGap = "none" | "xs" | "sm" | "smMd" | "md" | "lg";
|
|
43
|
+
export type InlineRowGapValue = Responsive<InlineRowGap>;
|
|
10
44
|
export declare const titleVariants: readonly TextVariant[];
|
|
11
|
-
/** The .kjun-type-* role class (pageTitle → kjun-type-page-title). */
|
|
45
|
+
/** The .kjun-type-* role class (pageTitle → kjun-type-page-title); inherit has its own class and no role. */
|
|
12
46
|
export declare const textTypeClass: (variant: TextVariant) => string;
|
|
13
|
-
/** Document tag when the app gives no `as`: titles are headings, numbers are inline, the rest are paragraphs. */
|
|
47
|
+
/** Document tag when the app gives no `as`: titles are headings, numbers and inherit are inline, the rest are paragraphs. */
|
|
14
48
|
export declare const defaultTextTag: (variant: TextVariant) => TextTag;
|
|
15
49
|
export declare const isNumericVariant: (variant: TextVariant) => boolean;
|
|
50
|
+
/** data-tone value (onDanger → on-danger); the default tone sets no attribute. */
|
|
51
|
+
export declare const textToneAttribute: (tone: TextTone) => string | undefined;
|
|
52
|
+
/** Whole line count of 1 or more, or undefined: 0, a fraction below 1, NaN and negatives do not clamp. */
|
|
53
|
+
export declare const clampLines: (maxLines: number | undefined) => number | undefined;
|
|
54
|
+
/** Web: whether a clamped text hides lines (its content is taller than the clamped box). */
|
|
55
|
+
export declare const clampOverflows: (element: {
|
|
56
|
+
scrollHeight: number;
|
|
57
|
+
clientHeight: number;
|
|
58
|
+
}) => boolean;
|
|
59
|
+
export declare const stackBreakpoints: readonly StackBreakpoint[];
|
|
60
|
+
/** A responsive value as its steps: base (the fallback when absent) and any breakpoint the app named. */
|
|
61
|
+
export type Steps<T> = {
|
|
62
|
+
base: T;
|
|
63
|
+
} & Partial<Record<StackBreakpoint, T>>;
|
|
64
|
+
export declare function responsiveSteps<T>(value: Responsive<T> | undefined, fallback: T): Steps<T>;
|
|
65
|
+
/** The step that applies at a width: the widest breakpoint the width reaches wins over base. */
|
|
66
|
+
export declare function stepAt<T>(steps: Steps<T>, width: number, breakpoints: Record<StackBreakpoint, number>): T;
|
|
67
|
+
/** sectionSm for the earlier section-sm spelling, with one development warning. */
|
|
68
|
+
export declare function stackGapName(step: StackGap | LegacyStackGap): StackGap;
|
|
69
|
+
/** A gap as its steps: base (md when absent) and any breakpoint the app named, in the current spelling. */
|
|
70
|
+
export declare function stackGapSteps(gap: StackGapValue | undefined): Steps<StackGap>;
|
|
71
|
+
/** The step that applies at a width, given the breakpoint widths (Native reads the window; Web uses media queries). */
|
|
72
|
+
export declare function stackGapAt(gap: StackGapValue | undefined, width: number, breakpoints: Record<StackBreakpoint, number>): StackGap;
|
|
73
|
+
/** Whether a stack's tag is a list, so its divider is an li too. */
|
|
74
|
+
export declare const isStackList: (tag: StackTag | undefined) => tag is "ol" | "ul";
|
|
75
|
+
/** "full" for true, the variant for a string, undefined when off. */
|
|
76
|
+
export declare const dividerVariant: (divider: StackDivider | undefined) => "full" | "inset" | "strong" | undefined;
|
|
77
|
+
/** Puts a separator between neighbouring children; none next to a spacer, which already parts them. */
|
|
78
|
+
export declare function interleave<T>(items: readonly T[], isSpacer: (item: T) => boolean, separator: (index: number) => T): T[];
|
|
79
|
+
/** The CSS value of a stack gap step: a space.stack or space.section token variable. */
|
|
80
|
+
export declare const stackGapCss: (step: StackGap) => string;
|
|
81
|
+
export declare const inlineGapCss: (step: InlineGap) => string;
|
|
82
|
+
export declare const insetCss: (step: InsetStep) => string;
|
|
83
|
+
/** CSS values of the alignment names; the same names map to flex values on Native. */
|
|
84
|
+
export declare const crossAxisCss: {
|
|
85
|
+
readonly stretch: "stretch";
|
|
86
|
+
readonly start: "flex-start";
|
|
87
|
+
readonly center: "center";
|
|
88
|
+
readonly end: "flex-end";
|
|
89
|
+
readonly baseline: "baseline";
|
|
90
|
+
};
|
|
91
|
+
export declare const mainAxisCss: {
|
|
92
|
+
readonly start: "flex-start";
|
|
93
|
+
readonly center: "center";
|
|
94
|
+
readonly end: "flex-end";
|
|
95
|
+
readonly between: "space-between";
|
|
96
|
+
};
|
|
97
|
+
/** How a content-width control (button, badge, chip…) sits under an alignment: its own width under stretch, the parent's alignment otherwise. */
|
|
98
|
+
export declare const intrinsicSelf: (align: StackAlign | InlineAlign) => "auto" | "flex-start";
|
|
99
|
+
export interface FlexLayoutInput {
|
|
100
|
+
kind: "stack" | "inline";
|
|
101
|
+
gap?: StackGapValue | InlineGapValue;
|
|
102
|
+
direction?: DirectionValue;
|
|
103
|
+
padding?: PaddingValue;
|
|
104
|
+
paddingX?: PaddingValue;
|
|
105
|
+
paddingY?: PaddingValue;
|
|
106
|
+
dividerInset?: InsetStep;
|
|
107
|
+
align?: StackAlignValue | InlineAlignValue;
|
|
108
|
+
justify?: JustifyValue;
|
|
109
|
+
/** Inline only: the space between wrapped lines; absent, the lines keep the gap. */
|
|
110
|
+
rowGap?: InlineRowGapValue;
|
|
111
|
+
/** The measured width for responsive="container"; every responsive value then resolves to one step. */
|
|
112
|
+
width?: number;
|
|
113
|
+
breakpoints?: Record<StackBreakpoint, number>;
|
|
114
|
+
}
|
|
115
|
+
type Attrs = Record<string, string | undefined>;
|
|
116
|
+
/** Web attributes and style variables for a Stack or Inline: data-* names the steps (and turns on the breakpoint rules),
|
|
117
|
+
* --_kjun-flex-* holds the token variable of each step. */
|
|
118
|
+
export declare function flexLayout(input: FlexLayoutInput): {
|
|
119
|
+
attrs: Attrs;
|
|
120
|
+
vars: Record<string, string>;
|
|
121
|
+
};
|
|
122
|
+
/** Whether any value changes with the width, so container mode has something to measure. */
|
|
123
|
+
export declare const isResponsive: (...values: unknown[]) => boolean;
|
|
124
|
+
export {};
|