@cscfi/csc-ui 4.0.0-alpha.3 → 4.0.0-alpha.31
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/dist/csc-ui.js +14305 -8019
- package/dist/custom-elements.json +8952 -4605
- package/dist/docs/c-alert/usage.md +24 -0
- package/dist/docs/c-autocomplete/usage.md +152 -0
- package/dist/docs/c-breadcrumb/usage.md +104 -0
- package/dist/docs/c-breadcrumb-item/usage.md +1 -0
- package/dist/docs/c-button-group/usage.md +14 -1
- package/dist/docs/c-checkbox/usage.md +53 -0
- package/dist/docs/c-date-picker/usage.md +224 -0
- package/dist/docs/c-main/usage.md +21 -1
- package/dist/docs/c-menu/usage.md +15 -0
- package/dist/docs/c-menu-item/usage.md +6 -0
- package/dist/docs/c-number-field/usage.md +112 -0
- package/dist/docs/c-option-value/usage.md +1 -0
- package/dist/docs/c-popover/usage.md +33 -0
- package/dist/docs/c-progress-bar/usage.md +23 -0
- package/dist/docs/c-progress-circle/usage.md +25 -0
- package/dist/docs/c-radio/usage.md +45 -0
- package/dist/docs/c-radio-group/usage.md +67 -0
- package/dist/docs/c-select/usage.md +127 -0
- package/dist/docs/c-side-navigation/usage.md +21 -0
- package/dist/docs/c-spinner/usage.md +21 -0
- package/dist/docs/c-switch/usage.md +36 -0
- package/dist/docs/c-tab-buttons/usage.md +7 -0
- package/dist/docs/c-table/usage.md +14 -0
- package/dist/docs/c-text-field/usage.md +106 -0
- package/dist/docs/c-time-picker/usage.md +170 -0
- package/dist/docs/c-toolbar/usage.md +17 -0
- package/dist/docs/c-tooltip/usage.md +30 -0
- package/dist/docs/c-tree-select/usage.md +156 -0
- package/dist/floating-ui.dom-DvzxEaDJ.js +1292 -0
- package/dist/styles/css/tailwind-theme.css +33 -0
- package/dist/styles/css/tokens.css +719 -197
- package/dist/vscode.css-custom-data.json +474 -20
- package/dist/vscode.html-custom-data.json +659 -57
- package/dist/web-types.json +2813 -697
- package/dist-types/components/c-alert/CAlert.vue.d.ts +18 -4
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +118 -21
- package/dist-types/components/c-breadcrumb/CBreadcrumb.vue.d.ts +35 -0
- package/dist-types/components/c-breadcrumb/fit.d.ts +29 -0
- package/dist-types/components/c-breadcrumb-item/CBreadcrumbItem.vue.d.ts +31 -0
- package/dist-types/components/c-button/CButton.vue.d.ts +4 -4
- package/dist-types/components/c-button-group/CButtonGroup.vue.d.ts +1 -1
- package/dist-types/components/c-checkbox/CCheckbox.vue.d.ts +3 -3
- package/dist-types/components/c-data-table/CDataTable.vue.d.ts +6 -2
- package/dist-types/components/c-date-picker/CDatePicker.vue.d.ts +282 -0
- package/dist-types/components/c-date-picker/dates.d.ts +119 -0
- package/dist-types/components/c-dropdown/CDropdown.vue.d.ts +50 -7
- package/dist-types/components/c-icon-button/CIconButton.vue.d.ts +1 -1
- package/dist-types/components/c-input/CInput.vue.d.ts +6 -6
- package/dist-types/components/c-list-item/CListItem.vue.d.ts +1 -1
- package/dist-types/components/c-main/CMain.vue.d.ts +10 -2
- package/dist-types/components/c-menu/CMenu.vue.d.ts +13 -3
- package/dist-types/components/c-menu-item/CMenuItem.vue.d.ts +30 -3
- package/dist-types/components/c-number-field/CNumberField.vue.d.ts +174 -0
- package/dist-types/components/c-number-field/numbers.d.ts +58 -0
- package/dist-types/components/c-otp-input/COtpInput.vue.d.ts +1 -1
- package/dist-types/components/c-pagination/CPagination.vue.d.ts +1 -1
- package/dist-types/components/c-popover/CPopover.vue.d.ts +43 -0
- package/dist-types/components/c-progress-circle/CProgressCircle.vue.d.ts +32 -0
- package/dist-types/components/c-radio/CRadio.vue.d.ts +7 -11
- package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +10 -48
- package/dist-types/components/c-select/CSelect.vue.d.ts +115 -27
- package/dist-types/components/c-side-navigation/CSideNavigation.vue.d.ts +1 -1
- package/dist-types/components/c-side-navigation-item/CSideNavigationItem.vue.d.ts +1 -1
- package/dist-types/components/c-slider/CSlider.vue.d.ts +3 -3
- package/dist-types/components/c-sub-navigation-item/CSubNavigationItem.vue.d.ts +1 -1
- package/dist-types/components/c-tab-buttons/CTabButtons.vue.d.ts +1 -1
- package/dist-types/components/c-table/CTable.vue.d.ts +11 -1
- package/dist-types/components/c-table/injectTableStyles.d.ts +1 -0
- package/dist-types/components/c-tag/CTag.vue.d.ts +7 -0
- package/dist-types/components/c-tags/CTags.vue.d.ts +1 -1
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +27 -10
- package/dist-types/components/c-time-picker/CTimePicker.vue.d.ts +210 -0
- package/dist-types/components/c-time-picker/times.d.ts +82 -0
- package/dist-types/components/c-toasts/CToasts.vue.d.ts +1 -1
- package/dist-types/components/c-toolbar/CToolbar.vue.d.ts +10 -1
- package/dist-types/components/c-tooltip/CTooltip.vue.d.ts +49 -0
- package/dist-types/components/c-tree-select/CTreeSelect.vue.d.ts +261 -0
- package/dist-types/index.d.ts +19 -2
- package/dist-types/shared/FieldMessage.vue.d.ts +21 -0
- package/dist-types/shared/PanelHeadingRow.vue.d.ts +13 -0
- package/dist-types/shared/SelectionIndicator.vue.d.ts +21 -0
- package/dist-types/shared/TypedField.vue.d.ts +46 -0
- package/dist-types/shared/appDefaults.d.ts +75 -0
- package/dist-types/shared/defineElement.d.ts +1 -0
- package/dist-types/shared/inputMask.d.ts +106 -0
- package/dist-types/shared/lightDismiss.d.ts +35 -0
- package/dist-types/shared/modalStack.d.ts +4 -3
- package/dist-types/shared/optionLabel.d.ts +18 -0
- package/dist-types/shared/pageLock.d.ts +26 -0
- package/dist-types/shared/peekCap.d.ts +35 -0
- package/dist-types/shared/popoverChain.d.ts +65 -0
- package/dist-types/shared/positionArea.d.ts +13 -0
- package/dist-types/shared/reducedMotion.d.ts +10 -0
- package/dist-types/shared/selectAll.d.ts +29 -0
- package/dist-types/shared/splitMatches.d.ts +18 -0
- package/dist-types/shared/useAnchoredPanel.d.ts +102 -0
- package/dist-types/shared/useDesignatedTrigger.d.ts +41 -0
- package/dist-types/shared/useFallbackPosition.d.ts +63 -0
- package/dist-types/shared/useHostStates.d.ts +25 -0
- package/dist-types/shared/useKeyboardModality.d.ts +7 -0
- package/dist-types/shared/useNarrowViewport.d.ts +19 -0
- package/dist-types/shared/useScrollStrip.d.ts +39 -0
- package/dist-types/shared/useStatusAnnouncer.d.ts +33 -0
- package/dist-types/shared/useTypedField.d.ts +103 -0
- package/dist-types/shared/visualViewport.d.ts +51 -0
- package/dist-types/tag-name-map.d.ts +769 -54
- package/dist-types/theme/chart-data.d.ts +51 -0
- package/dist-types/theme/ramp.d.ts +38 -0
- package/dist-types/theme/themeMode.d.ts +51 -0
- package/dist-types/types.d.ts +7 -0
- package/package.json +21 -9
- package/dist/css-anchor-positioning-fn-RTxo68pt.js +0 -6447
- package/dist-types/shared/anchorPolyfill.d.ts +0 -24
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The typed half of a picker whose value field holds editable text
|
|
3
|
+
* (ADR-0057, ADR-0058, ADR-0059): one input, or a start and an end input in
|
|
4
|
+
* one field box under `range`. Text is masked while typed and read by the
|
|
5
|
+
* codec only on Enter or blur; text that names no usable value is kept as
|
|
6
|
+
* typed and flags **bad input** (CONTEXT.md). Programmatic values re-sync the
|
|
7
|
+
* text and never emit; commits emit through `emitModelChange`.
|
|
8
|
+
*
|
|
9
|
+
* Generic over the value's codec, so `c-date-picker` and `c-time-picker`
|
|
10
|
+
* share one commit model. The anatomy lives in `TypedField.vue`, which binds
|
|
11
|
+
* the element refs returned here.
|
|
12
|
+
*/
|
|
13
|
+
import { type Ref } from 'vue';
|
|
14
|
+
import { type MaskSlot } from './inputMask';
|
|
15
|
+
export type TypedFieldEnd = 'end' | 'start';
|
|
16
|
+
export interface TypedFieldEnds {
|
|
17
|
+
end: null | string;
|
|
18
|
+
start: null | string;
|
|
19
|
+
}
|
|
20
|
+
/** The text committed from the field, as typed: both ends' texts under `range`. */
|
|
21
|
+
export type TypedFieldText = {
|
|
22
|
+
end: string;
|
|
23
|
+
start: string;
|
|
24
|
+
} | string;
|
|
25
|
+
export interface TypedFieldCodec {
|
|
26
|
+
/** The committed value shown as text under `pattern`. */
|
|
27
|
+
format(value: string, pattern: string): string;
|
|
28
|
+
/** Whether a value set from outside is one this field holds (anything else is "no value"). */
|
|
29
|
+
isValue(value: unknown): value is string;
|
|
30
|
+
/** A parsed value that can still not be committed (disabled, out of range) — bad input. */
|
|
31
|
+
isUsable(value: string): boolean;
|
|
32
|
+
/** Typed text read under `pattern`; `null` when it names no value. */
|
|
33
|
+
parse(text: string, pattern: string): null | string;
|
|
34
|
+
}
|
|
35
|
+
export interface UseTypedFieldOptions {
|
|
36
|
+
codec: TypedFieldCodec;
|
|
37
|
+
/** The custom element host: the model events dispatch from it. */
|
|
38
|
+
host: HTMLElement | null;
|
|
39
|
+
/** The field label (props.label). */
|
|
40
|
+
label: () => string;
|
|
41
|
+
/** Whether the label rests on top of the field (the resolved app default). */
|
|
42
|
+
labelOnTop: Readonly<Ref<boolean>>;
|
|
43
|
+
/** The typing mask derived from `pattern`. */
|
|
44
|
+
mask: Readonly<Ref<MaskSlot[]>>;
|
|
45
|
+
/** The end inputs' accessible names under `range`. */
|
|
46
|
+
names: () => {
|
|
47
|
+
end: string;
|
|
48
|
+
start: string;
|
|
49
|
+
};
|
|
50
|
+
/** Fired on every commit of typed text, as typed — the host's `change:text`. */
|
|
51
|
+
onTextCommit: (text: TypedFieldText) => void;
|
|
52
|
+
/** Alt+↓ in an input, after committing its text: open the panel. */
|
|
53
|
+
onOpenRequest: () => void;
|
|
54
|
+
/** The display and parse pattern. */
|
|
55
|
+
pattern: Readonly<Ref<string>>;
|
|
56
|
+
/** The consumer's placeholder (props.placeholder). */
|
|
57
|
+
placeholder: () => string;
|
|
58
|
+
/** Whether the field holds a start and an end. */
|
|
59
|
+
range: Readonly<Ref<boolean>>;
|
|
60
|
+
/** What a committed range with its start after its end becomes: swapped, or kept as typed. */
|
|
61
|
+
reversed: 'keep' | 'swap';
|
|
62
|
+
/** The host's `value` prop. */
|
|
63
|
+
value: () => unknown;
|
|
64
|
+
}
|
|
65
|
+
export declare const useTypedField: (options: UseTypedFieldOptions) => {
|
|
66
|
+
anchor: import("vue").ShallowRef<HTMLElement | null, HTMLElement | null>;
|
|
67
|
+
badEnd: Ref<boolean, boolean>;
|
|
68
|
+
badInput: import("vue").ComputedRef<boolean>;
|
|
69
|
+
badStart: Ref<boolean, boolean>;
|
|
70
|
+
commitAll: () => void;
|
|
71
|
+
commitText: (end: TypedFieldEnd) => void;
|
|
72
|
+
commitValue: (next: TypedFieldEnds) => void;
|
|
73
|
+
endInput: import("vue").ShallowRef<HTMLInputElement | null, HTMLInputElement | null>;
|
|
74
|
+
endText: Ref<string, string>;
|
|
75
|
+
ends: Ref<{
|
|
76
|
+
end: null | string;
|
|
77
|
+
start: null | string;
|
|
78
|
+
}, TypedFieldEnds | {
|
|
79
|
+
end: null | string;
|
|
80
|
+
start: null | string;
|
|
81
|
+
}>;
|
|
82
|
+
field: import("vue").ShallowRef<HTMLElement | null, HTMLElement | null>;
|
|
83
|
+
focused: Ref<boolean, boolean>;
|
|
84
|
+
hasContent: import("vue").ComputedRef<boolean>;
|
|
85
|
+
hasText: import("vue").ComputedRef<boolean>;
|
|
86
|
+
inputLabel: (end: TypedFieldEnd) => string | undefined;
|
|
87
|
+
inputOf: (end: TypedFieldEnd) => HTMLInputElement | null;
|
|
88
|
+
lastInput: Ref<TypedFieldEnd, TypedFieldEnd>;
|
|
89
|
+
onClear: (event?: Event) => void;
|
|
90
|
+
onFocusOut: (event: FocusEvent) => void;
|
|
91
|
+
onKeyDown: (end: TypedFieldEnd, event: KeyboardEvent) => void;
|
|
92
|
+
onTextInput: (end: TypedFieldEnd, event: Event) => void;
|
|
93
|
+
placeholder: import("vue").ComputedRef<string | undefined>;
|
|
94
|
+
range: Readonly<Ref<boolean, boolean>>;
|
|
95
|
+
showSeparator: import("vue").ComputedRef<boolean>;
|
|
96
|
+
startInput: import("vue").ShallowRef<HTMLInputElement | null, HTMLInputElement | null>;
|
|
97
|
+
startText: Ref<string, string>;
|
|
98
|
+
startWidth: import("vue").ComputedRef<{
|
|
99
|
+
width: string;
|
|
100
|
+
} | undefined>;
|
|
101
|
+
};
|
|
102
|
+
/** The state `TypedField.vue` renders. */
|
|
103
|
+
export type TypedField = ReturnType<typeof useTypedField>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual viewport tracking for the **fullscreen panel** (CONTEXT.md,
|
|
3
|
+
* ADR-0050). Two layers. The *surface* — the panel element itself,
|
|
4
|
+
* `position: fixed; inset: 0` — spans the layout viewport, which the
|
|
5
|
+
* on-screen keyboard overlays but never shrinks, so it covers everything
|
|
6
|
+
* visible whatever the keyboard does. The *content box* inside it (heading
|
|
7
|
+
* row, search input, list) follows `visualViewport` — the only API that sees
|
|
8
|
+
* the iOS keyboard — so it ends above the keyboard. A late or wrong box then
|
|
9
|
+
* shows more surface, never the page. Both fullscreen implementations (the
|
|
10
|
+
* anchored-panel composable and `c-dropdown`'s dialog) go through this one
|
|
11
|
+
* helper while they are open.
|
|
12
|
+
*/
|
|
13
|
+
/** Stop following the visual viewport. Idempotent. */
|
|
14
|
+
export type StopTracking = () => void;
|
|
15
|
+
/** The visible box, in CSS px relative to the layout viewport. */
|
|
16
|
+
export interface ViewportBox {
|
|
17
|
+
height: number;
|
|
18
|
+
left: number;
|
|
19
|
+
top: number;
|
|
20
|
+
width: number;
|
|
21
|
+
}
|
|
22
|
+
/** The current visual viewport box; `null` where the API is missing (then the content box fills the surface). */
|
|
23
|
+
export declare const readVisualViewport: () => null | ViewportBox;
|
|
24
|
+
/**
|
|
25
|
+
* Report the visual viewport's box now and on every resize / scroll of it
|
|
26
|
+
* (the keyboard opening and closing, the address bar collapsing, the browser
|
|
27
|
+
* panning a focused input into view). With no API the callback runs once
|
|
28
|
+
* with `null` and nothing is listened to.
|
|
29
|
+
*/
|
|
30
|
+
export declare const trackVisualViewport: (onBox: (box: null | ViewportBox) => void) => StopTracking;
|
|
31
|
+
/**
|
|
32
|
+
* Inline declarations that make a top-layer element the surface: the layout
|
|
33
|
+
* viewport's box. Overrides the UA popover / dialog defaults (`inset: 0` is
|
|
34
|
+
* theirs too, but with fit-content sizing and auto margins).
|
|
35
|
+
*/
|
|
36
|
+
export declare const FULLSCREEN_SURFACE_STYLE = "position:fixed;inset:0;margin:0;width:auto;height:auto;";
|
|
37
|
+
/**
|
|
38
|
+
* Inline declarations placing the content box inside the surface on the
|
|
39
|
+
* visual viewport's box; with no box (no API) it fills the surface.
|
|
40
|
+
*/
|
|
41
|
+
export declare const contentBoxStyle: (box: null | ViewportBox) => string;
|
|
42
|
+
/**
|
|
43
|
+
* `FULLSCREEN_SURFACE_STYLE` written straight onto an element's inline style,
|
|
44
|
+
* for a surface whose placement is imperative (`c-dropdown`'s dialog). Margins
|
|
45
|
+
* are left to its classes.
|
|
46
|
+
*/
|
|
47
|
+
export declare const applyFullscreenSurface: (el: HTMLElement) => void;
|
|
48
|
+
/** `contentBoxStyle(box)` written straight onto an element's inline style. */
|
|
49
|
+
export declare const applyContentBox: (el: HTMLElement, box: null | ViewportBox) => void;
|
|
50
|
+
/** Remove exactly what `applyContentBox` set. */
|
|
51
|
+
export declare const clearContentBox: (el: HTMLElement) => void;
|