@cscfi/csc-ui 4.0.0-alpha.3 → 4.0.0-alpha.5
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 +6238 -5865
- package/dist/custom-elements.json +655 -99
- package/dist/docs/c-popover/usage.md +25 -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 +27 -0
- package/dist/docs/c-radio-group/usage.md +67 -0
- package/dist/docs/c-spinner/usage.md +21 -0
- package/dist/docs/c-tooltip/usage.md +28 -0
- package/dist/styles/css/tailwind-theme.css +30 -0
- package/dist/styles/css/tokens.css +90 -13
- package/dist/vscode.css-custom-data.json +69 -10
- package/dist/vscode.html-custom-data.json +134 -18
- package/dist/web-types.json +383 -73
- package/dist-types/components/c-alert/CAlert.vue.d.ts +10 -3
- package/dist-types/components/c-menu/CMenu.vue.d.ts +3 -3
- package/dist-types/components/c-menu-item/CMenuItem.vue.d.ts +29 -3
- package/dist-types/components/c-popover/CPopover.vue.d.ts +34 -0
- package/dist-types/components/c-progress-circle/CProgressCircle.vue.d.ts +32 -0
- package/dist-types/components/c-radio/CRadio.vue.d.ts +0 -10
- package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +8 -46
- package/dist-types/components/c-tooltip/CTooltip.vue.d.ts +39 -0
- package/dist-types/index.d.ts +4 -1
- package/dist-types/shared/FieldMessage.vue.d.ts +21 -0
- package/dist-types/shared/positionArea.d.ts +13 -0
- package/dist-types/tag-name-map.d.ts +145 -27
- package/dist-types/types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -21,11 +21,6 @@ type DropdownItem = {
|
|
|
21
21
|
selected?: boolean;
|
|
22
22
|
value: number | string;
|
|
23
23
|
};
|
|
24
|
-
interface RadioItem {
|
|
25
|
-
disabled?: boolean;
|
|
26
|
-
name: string;
|
|
27
|
-
value: number | string;
|
|
28
|
-
}
|
|
29
24
|
/** Events dispatched by `<c-accordion>`. */
|
|
30
25
|
export interface CAccordionElementEventMap {
|
|
31
26
|
/**
|
|
@@ -92,9 +87,26 @@ export interface CAccordionItemElement extends Omit<HTMLElement, 'collapsable' |
|
|
|
92
87
|
removeEventListener<K extends keyof CAccordionItemElementEventMap>(type: K, listener: (this: CAccordionItemElement, ev: CAccordionItemElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
93
88
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
94
89
|
}
|
|
95
|
-
|
|
90
|
+
/** Events dispatched by `<c-alert>`. */
|
|
91
|
+
export interface CAlertElementEventMap {
|
|
92
|
+
/**
|
|
93
|
+
* Fired when the dismiss button is pressed. The alert does not hide
|
|
94
|
+
* itself — the consumer owns removal.
|
|
95
|
+
*/
|
|
96
|
+
dismiss: CustomEvent<void>;
|
|
97
|
+
}
|
|
98
|
+
export interface CAlertElement extends Omit<HTMLElement, 'dismissible' | 'type'> {
|
|
99
|
+
/**
|
|
100
|
+
* Show a dismiss button. The alert only emits `dismiss` — removing it from
|
|
101
|
+
* the page stays the consumer's job.
|
|
102
|
+
*/
|
|
103
|
+
dismissible?: boolean;
|
|
96
104
|
/** Type of the alert */
|
|
97
105
|
type?: 'default' | 'error' | 'info' | 'success' | 'warning';
|
|
106
|
+
addEventListener<K extends keyof CAlertElementEventMap>(type: K, listener: (this: CAlertElement, ev: CAlertElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
107
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
108
|
+
removeEventListener<K extends keyof CAlertElementEventMap>(type: K, listener: (this: CAlertElement, ev: CAlertElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
109
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
98
110
|
}
|
|
99
111
|
/** Events dispatched by `<c-autocomplete>`. */
|
|
100
112
|
export interface CAutocompleteElementEventMap {
|
|
@@ -697,11 +709,28 @@ export interface CMenuElement extends Omit<HTMLElement, 'distance' | 'open' | 'p
|
|
|
697
709
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
698
710
|
}
|
|
699
711
|
/** A single command in a `c-menu`. */
|
|
700
|
-
export interface CMenuItemElement extends Omit<HTMLElement, 'danger' | 'disabled' | 'value'> {
|
|
712
|
+
export interface CMenuItemElement extends Omit<HTMLElement, 'active' | 'activeIcon' | 'danger' | 'disabled' | 'icon' | 'value'> {
|
|
713
|
+
/**
|
|
714
|
+
* Marks the item as the currently selected choice: renders the trailing
|
|
715
|
+
* indicator icon and stamps `role="menuitemradio"` + `aria-checked`. Leave
|
|
716
|
+
* unset for regular command items — only a true/false value marks the item
|
|
717
|
+
* as a selectable choice. The state is consumer-owned: the menu emits
|
|
718
|
+
* `select` as usual and never toggles this itself. Distinct from the
|
|
719
|
+
* keyboard highlight (the `data-active` attribute the controlling menu
|
|
720
|
+
* moves between rows).
|
|
721
|
+
*/
|
|
722
|
+
active?: boolean;
|
|
723
|
+
/**
|
|
724
|
+
* SVG path for the trailing indicator shown while `active`; defaults to a
|
|
725
|
+
* check mark.
|
|
726
|
+
*/
|
|
727
|
+
activeIcon?: string;
|
|
701
728
|
/** Marks the action as destructive (renders in the error colour). */
|
|
702
729
|
danger?: boolean;
|
|
703
730
|
/** Disables the item — it is skipped by keyboard nav and emits no select. */
|
|
704
731
|
disabled?: boolean;
|
|
732
|
+
/** SVG path for a leading icon rendered before the item's content. */
|
|
733
|
+
icon?: string;
|
|
705
734
|
/** Value reported in the menu's `select` event when this item is chosen. */
|
|
706
735
|
value?: string;
|
|
707
736
|
closeSubmenu(): void;
|
|
@@ -863,6 +892,37 @@ export interface CPaginationElement extends Omit<HTMLElement, 'hideDetails' | 'h
|
|
|
863
892
|
removeEventListener<K extends keyof CPaginationElementEventMap>(type: K, listener: (this: CPaginationElement, ev: CPaginationElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
864
893
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
865
894
|
}
|
|
895
|
+
/** Events dispatched by `<c-popover>`. */
|
|
896
|
+
export interface CPopoverElementEventMap {
|
|
897
|
+
/**
|
|
898
|
+
* Fired whenever the popover opens or closes, carrying the new open state.
|
|
899
|
+
* Named `change:open`, not `update:open`: Vue's runtime silently drops
|
|
900
|
+
* `onUpdate:*` listeners on custom elements (`isModelListener`), so a
|
|
901
|
+
* template `@update:open` would never be attached.
|
|
902
|
+
*/
|
|
903
|
+
'change:open': CustomEvent<boolean>;
|
|
904
|
+
}
|
|
905
|
+
/** A click-opened, non-modal surface anchored to its trigger, floating in the top layer; its content may be interactive. */
|
|
906
|
+
export interface CPopoverElement extends Omit<HTMLElement, 'distance' | 'heading' | 'open' | 'position'> {
|
|
907
|
+
/** Distance from the trigger to the panel, in pixels. Defaults to `0`. */
|
|
908
|
+
distance?: number | string;
|
|
909
|
+
/**
|
|
910
|
+
* Heading rendered at the top of the panel, doubling as its accessible
|
|
911
|
+
* name. Without it, set `aria-label` on the host. Named `heading`, not
|
|
912
|
+
* `title`: a `title` attribute on the host would trigger the browser's
|
|
913
|
+
* native tooltip and collides with `HTMLElement.title`.
|
|
914
|
+
*/
|
|
915
|
+
heading?: string;
|
|
916
|
+
/** Whether the popover is open. Two-way: emits `change:open`. */
|
|
917
|
+
open?: boolean;
|
|
918
|
+
/** Preferred placement of the panel relative to the trigger. */
|
|
919
|
+
position?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
920
|
+
addEventListener<K extends keyof CPopoverElementEventMap>(type: K, listener: (this: CPopoverElement, ev: CPopoverElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
921
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
922
|
+
removeEventListener<K extends keyof CPopoverElementEventMap>(type: K, listener: (this: CPopoverElement, ev: CPopoverElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
923
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
924
|
+
}
|
|
925
|
+
/** A horizontal progress bar that fills a track to a known completion percentage, with an optional details line showing the value and a label. */
|
|
866
926
|
export interface CProgressBarElement extends Omit<HTMLElement, 'hideDetails' | 'indeterminate' | 'label' | 'singleLine' | 'value'> {
|
|
867
927
|
/** Hide the percentage display */
|
|
868
928
|
hideDetails?: boolean;
|
|
@@ -875,33 +935,56 @@ export interface CProgressBarElement extends Omit<HTMLElement, 'hideDetails' | '
|
|
|
875
935
|
/** Progress bar value in percentage (0 to 100) */
|
|
876
936
|
value?: number;
|
|
877
937
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
938
|
+
/** A circular progress indicator that draws a known completion percentage as an arc around a track — the circular counterpart of `c-progress-bar`. */
|
|
939
|
+
export interface CProgressCircleElement extends Omit<HTMLElement, 'size' | 'value' | 'width'> {
|
|
940
|
+
/** Diameter of the circle in pixels */
|
|
941
|
+
size?: number;
|
|
942
|
+
/** Progress value in percentage (0 to 100) */
|
|
943
|
+
value?: number;
|
|
944
|
+
/**
|
|
945
|
+
* Stroke width of the track in pixels; the value arc draws at half this
|
|
946
|
+
* width, inset within the track
|
|
947
|
+
*/
|
|
948
|
+
width?: number;
|
|
949
|
+
}
|
|
950
|
+
/** Events dispatched by `<c-radio>`. */
|
|
951
|
+
export interface CRadioElementEventMap {
|
|
952
|
+
/**
|
|
953
|
+
* Fired when the radio is selected by the user, carrying its `value`.
|
|
954
|
+
* Bubbles composed so the parent `<c-radio-group>` — whose shadow root a
|
|
955
|
+
* light-DOM event never enters — catches it on its host; a consumer
|
|
956
|
+
* listening on the group hears it too, with the radio as `target`.
|
|
957
|
+
*/
|
|
958
|
+
change: CustomEvent<string>;
|
|
959
|
+
}
|
|
960
|
+
/** A single radio option inside a `c-radio-group`: a native radio input whose default slot is its clickable, announced label. */
|
|
961
|
+
export interface CRadioElement extends Omit<HTMLElement, 'disabled' | 'value'> {
|
|
881
962
|
/** Disable the radio button */
|
|
882
963
|
disabled?: boolean;
|
|
883
964
|
/** Radio button value */
|
|
884
965
|
value?: string;
|
|
966
|
+
addEventListener<K extends keyof CRadioElementEventMap>(type: K, listener: (this: CRadioElement, ev: CRadioElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
967
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
968
|
+
removeEventListener<K extends keyof CRadioElementEventMap>(type: K, listener: (this: CRadioElement, ev: CRadioElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
969
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
885
970
|
}
|
|
886
971
|
/** Events dispatched by `<c-radio-group>`. */
|
|
887
972
|
export interface CRadioGroupElementEventMap {
|
|
888
|
-
/**
|
|
889
|
-
|
|
890
|
-
* value — or the whole item object when `return-object` is set.
|
|
891
|
-
*/
|
|
892
|
-
changeValue: CustomEvent<number | RadioItem | string>;
|
|
973
|
+
/** Fired when a radio is selected, carrying the selected radio's value. */
|
|
974
|
+
changeValue: CustomEvent<string>;
|
|
893
975
|
/**
|
|
894
976
|
* Native bubbling input event fired on selection so a plain Vue `v-model`
|
|
895
977
|
* works without the `v-control` directive. No detail.
|
|
896
978
|
*/
|
|
897
979
|
input: CustomEvent<void>;
|
|
898
980
|
/**
|
|
899
|
-
* v-model contract event fired on selection, carrying the selected
|
|
900
|
-
* value
|
|
981
|
+
* v-model contract event fired on selection, carrying the selected radio's
|
|
982
|
+
* value.
|
|
901
983
|
*/
|
|
902
|
-
'update:value': CustomEvent<
|
|
984
|
+
'update:value': CustomEvent<string>;
|
|
903
985
|
}
|
|
904
|
-
|
|
986
|
+
/** A radio group is a set of mutually exclusive choices where exactly one can be selected, authored as slotted `c-radio` children. Give the group a `label` so the choice it represents is named for every user, and a `hint` describing how to answer. */
|
|
987
|
+
export interface CRadioGroupElement extends Omit<HTMLElement, 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'inline' | 'label' | 'required' | 'valid' | 'value'> {
|
|
905
988
|
/** Disable the radio group */
|
|
906
989
|
disabled?: boolean;
|
|
907
990
|
/** Error message shown in place of the hint while the group is invalid */
|
|
@@ -910,22 +993,19 @@ export interface CRadioGroupElement extends Omit<HTMLElement, 'disabled' | 'erro
|
|
|
910
993
|
hideDetails?: boolean;
|
|
911
994
|
/** Hint text for the input */
|
|
912
995
|
hint?: string;
|
|
913
|
-
/** Id of the element */
|
|
914
|
-
hostId?: string;
|
|
915
996
|
/** Display radio buttons inline */
|
|
916
997
|
inline?: boolean;
|
|
917
|
-
/** Radio group items */
|
|
918
|
-
items?: RadioItem[];
|
|
919
998
|
/** Label of the radio group */
|
|
920
999
|
label?: string;
|
|
921
1000
|
/** Set as required */
|
|
922
1001
|
required?: boolean;
|
|
923
|
-
/** Return the whole item object */
|
|
924
|
-
returnObject?: boolean;
|
|
925
1002
|
/** Set the validity of the input */
|
|
926
1003
|
valid?: boolean;
|
|
927
|
-
/**
|
|
928
|
-
|
|
1004
|
+
/**
|
|
1005
|
+
* Value of the radio group; matched against each radio's `value` by strict
|
|
1006
|
+
* string equality
|
|
1007
|
+
*/
|
|
1008
|
+
value?: null | string;
|
|
929
1009
|
addEventListener<K extends keyof CRadioGroupElementEventMap>(type: K, listener: (this: CRadioGroupElement, ev: CRadioGroupElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
930
1010
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
931
1011
|
removeEventListener<K extends keyof CRadioGroupElementEventMap>(type: K, listener: (this: CRadioGroupElement, ev: CRadioGroupElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
@@ -1102,6 +1182,7 @@ export interface CSliderElement extends Omit<HTMLElement, 'ariaLabelInternal' |
|
|
|
1102
1182
|
removeEventListener<K extends keyof CSliderElementEventMap>(type: K, listener: (this: CSliderElement, ev: CSliderElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
1103
1183
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1104
1184
|
}
|
|
1185
|
+
/** A circular indeterminate activity indicator — pure motion with no value, for waits of unknown duration. */
|
|
1105
1186
|
export interface CSpinnerElement extends Omit<HTMLElement, 'color' | 'size' | 'width'> {
|
|
1106
1187
|
/** Color of the spinner */
|
|
1107
1188
|
color?: string;
|
|
@@ -1466,6 +1547,40 @@ export interface CToastsElement extends Omit<HTMLElement, 'absolute' | 'horizont
|
|
|
1466
1547
|
}
|
|
1467
1548
|
export interface CToolbarElement extends HTMLElement {
|
|
1468
1549
|
}
|
|
1550
|
+
/** Events dispatched by `<c-tooltip>`. */
|
|
1551
|
+
export interface CTooltipElementEventMap {
|
|
1552
|
+
/**
|
|
1553
|
+
* Fired whenever the tooltip shows or hides, carrying the new open state.
|
|
1554
|
+
* Named `change:open`, not `update:open`: Vue's runtime silently drops
|
|
1555
|
+
* `onUpdate:*` listeners on custom elements (`isModelListener`), so a
|
|
1556
|
+
* template `@update:open` would never be attached.
|
|
1557
|
+
*/
|
|
1558
|
+
'change:open': CustomEvent<boolean>;
|
|
1559
|
+
}
|
|
1560
|
+
/** A non-interactive text hint shown when its trigger is hovered or keyboard-focused, floating in the top layer on the inverted surface tier. */
|
|
1561
|
+
export interface CTooltipElement extends Omit<HTMLElement, 'delay' | 'distance' | 'open' | 'position' | 'text'> {
|
|
1562
|
+
/**
|
|
1563
|
+
* Delay before the tooltip shows on hover, in milliseconds. Keyboard focus
|
|
1564
|
+
* shows the tooltip immediately, regardless of this value. Defaults to
|
|
1565
|
+
* `400`.
|
|
1566
|
+
*/
|
|
1567
|
+
delay?: number | string;
|
|
1568
|
+
/** Distance from the trigger to the tooltip, in pixels. Defaults to `4`. */
|
|
1569
|
+
distance?: number | string;
|
|
1570
|
+
/** Whether the tooltip is open. Two-way: emits `change:open`. */
|
|
1571
|
+
open?: boolean;
|
|
1572
|
+
/** Preferred placement of the tooltip relative to the trigger. */
|
|
1573
|
+
position?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
1574
|
+
/**
|
|
1575
|
+
* The tooltip text. Overridden by the `content` slot when that is
|
|
1576
|
+
* populated.
|
|
1577
|
+
*/
|
|
1578
|
+
text?: string;
|
|
1579
|
+
addEventListener<K extends keyof CTooltipElementEventMap>(type: K, listener: (this: CTooltipElement, ev: CTooltipElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
1580
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1581
|
+
removeEventListener<K extends keyof CTooltipElementEventMap>(type: K, listener: (this: CTooltipElement, ev: CTooltipElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
1582
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1583
|
+
}
|
|
1469
1584
|
declare global {
|
|
1470
1585
|
interface HTMLElementTagNameMap {
|
|
1471
1586
|
'c-accordion': CAccordionElement;
|
|
@@ -1510,7 +1625,9 @@ declare global {
|
|
|
1510
1625
|
'c-otp-input': COtpInputElement;
|
|
1511
1626
|
'c-page': CPageElement;
|
|
1512
1627
|
'c-pagination': CPaginationElement;
|
|
1628
|
+
'c-popover': CPopoverElement;
|
|
1513
1629
|
'c-progress-bar': CProgressBarElement;
|
|
1630
|
+
'c-progress-circle': CProgressCircleElement;
|
|
1514
1631
|
'c-radio': CRadioElement;
|
|
1515
1632
|
'c-radio-group': CRadioGroupElement;
|
|
1516
1633
|
'c-select': CSelectElement;
|
|
@@ -1536,6 +1653,7 @@ declare global {
|
|
|
1536
1653
|
'c-toast': CToastElement;
|
|
1537
1654
|
'c-toasts': CToastsElement;
|
|
1538
1655
|
'c-toolbar': CToolbarElement;
|
|
1656
|
+
'c-tooltip': CTooltipElement;
|
|
1539
1657
|
}
|
|
1540
1658
|
}
|
|
1541
1659
|
export {};
|
package/dist-types/types.d.ts
CHANGED
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
* the wrapping control (`c-select`) into `c-input`.
|
|
13
13
|
*/
|
|
14
14
|
export type CFieldSize = 'default' | 'small';
|
|
15
|
+
/**
|
|
16
|
+
* Preferred placement of a floating panel relative to its anchor, shared by
|
|
17
|
+
* the anchor-positioned overlay components (`c-menu`, `c-tooltip`,
|
|
18
|
+
* `c-popover`). The side names the panel's position; `-start`/`-end` align
|
|
19
|
+
* the panel's edge with the anchor's on the cross axis.
|
|
20
|
+
*/
|
|
21
|
+
export type CPlacement = 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
15
22
|
/**
|
|
16
23
|
* A selectable item for the value-selection components (`c-select`,
|
|
17
24
|
* `c-autocomplete`) when options are supplied via the `items` prop instead of
|
package/package.json
CHANGED