@cscfi/csc-ui 4.0.0-alpha.3 → 4.0.0-alpha.4

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.
@@ -1,9 +1,14 @@
1
1
  /**
2
- * The alert types that render a status icon and carry that status's accent
3
- * colour.
2
+ * The alert types that carry a status family's accent colour; `default` uses
3
+ * the brand primary. Every type renders its status icon.
4
4
  */
5
5
  export type CAlertIconType = 'error' | 'info' | 'success' | 'warning';
6
6
  export interface CAlertProps {
7
+ /**
8
+ * Show a dismiss button. The alert only emits `dismiss` — removing it from
9
+ * the page stays the consumer's job.
10
+ */
11
+ dismissible?: boolean;
7
12
  /**
8
13
  * Type of the alert
9
14
  *
@@ -13,13 +18,15 @@ export interface CAlertProps {
13
18
  }
14
19
  /**
15
20
  * Type of the alert. `default` — equivalently, omitting the attribute —
16
- * renders the neutral box without a status icon.
21
+ * renders the brand-primary look; the four status types carry their status
22
+ * family's colours.
17
23
  */
18
24
  export type CAlertType = 'default' | CAlertIconType;
19
25
  declare const _default: typeof __VLS_export;
20
26
  export default _default;
21
27
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CAlertProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CAlertProps> & Readonly<{}>, {
22
28
  type: CAlertType;
29
+ dismissible: boolean;
23
30
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
24
31
  title?: (props: {}) => any;
25
32
  } & {
@@ -1,12 +1,12 @@
1
+ import type { CPlacement } from '../../types';
1
2
  interface CMenuProps {
2
3
  /** Distance from the trigger to the panel, in pixels. Defaults to `0`. */
3
4
  distance?: number | string;
4
5
  /** Whether the menu is open. Two-way: emits `change:open`. */
5
6
  open?: boolean;
6
7
  /** Preferred placement of the panel relative to the trigger. */
7
- position?: Placement;
8
+ position?: CPlacement;
8
9
  }
9
- type Placement = 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
10
10
  declare var __VLS_1: {}, __VLS_3: {};
11
11
  type __VLS_Slots = {} & {
12
12
  trigger?: (props: typeof __VLS_1) => any;
@@ -16,7 +16,7 @@ type __VLS_Slots = {} & {
16
16
  declare const __VLS_base: import("vue").DefineComponent<CMenuProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CMenuProps> & Readonly<{}>, {
17
17
  open: boolean;
18
18
  distance: number | string;
19
- position: Placement;
19
+ position: CPlacement;
20
20
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
21
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
22
22
  declare const _default: typeof __VLS_export;
@@ -1,8 +1,31 @@
1
1
  interface CMenuItemProps {
2
+ /**
3
+ * Marks the item as the currently selected choice: renders the trailing
4
+ * indicator icon and stamps `role="menuitemradio"` + `aria-checked`. Leave
5
+ * unset for regular command items — only a true/false value marks the item
6
+ * as a selectable choice. The state is consumer-owned: the menu emits
7
+ * `select` as usual and never toggles this itself. Distinct from the
8
+ * keyboard highlight (the `data-active` attribute the controlling menu
9
+ * moves between rows).
10
+ */
11
+ active?: boolean;
12
+ /**
13
+ * SVG path for the trailing indicator shown while `active`; defaults to a
14
+ * check mark.
15
+ *
16
+ * @freeform SVG path data
17
+ */
18
+ activeIcon?: string;
2
19
  /** Marks the action as destructive (renders in the error colour). */
3
20
  danger?: boolean;
4
21
  /** Disables the item — it is skipped by keyboard nav and emits no select. */
5
22
  disabled?: boolean;
23
+ /**
24
+ * SVG path for a leading icon rendered before the item's content.
25
+ *
26
+ * @freeform SVG path data
27
+ */
28
+ icon?: string;
6
29
  /**
7
30
  * Value reported in the menu's `select` event when this item is chosen.
8
31
  *
@@ -10,19 +33,22 @@ interface CMenuItemProps {
10
33
  */
11
34
  value?: string;
12
35
  }
13
- declare var __VLS_1: {}, __VLS_3: {};
36
+ declare var __VLS_6: {}, __VLS_13: {};
14
37
  type __VLS_Slots = {} & {
15
- default?: (props: typeof __VLS_1) => any;
38
+ default?: (props: typeof __VLS_6) => any;
16
39
  } & {
17
- submenu?: (props: typeof __VLS_3) => any;
40
+ submenu?: (props: typeof __VLS_13) => any;
18
41
  };
19
42
  declare const __VLS_base: import("vue").DefineComponent<CMenuItemProps, {
20
43
  closeSubmenu: () => void;
21
44
  openSubmenu: () => void;
22
45
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CMenuItemProps> & Readonly<{}>, {
46
+ icon: string;
23
47
  value: string;
24
48
  disabled: boolean;
49
+ active: boolean;
25
50
  danger: boolean;
51
+ activeIcon: string;
26
52
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
53
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
28
54
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,34 @@
1
+ import type { CPlacement } from '../../types';
2
+ export interface CPopoverProps {
3
+ /** Distance from the trigger to the panel, in pixels. Defaults to `0`. */
4
+ distance?: number | string;
5
+ /**
6
+ * Heading rendered at the top of the panel, doubling as its accessible
7
+ * name. Without it, set `aria-label` on the host. Named `heading`, not
8
+ * `title`: a `title` attribute on the host would trigger the browser's
9
+ * native tooltip and collides with `HTMLElement.title`.
10
+ * @freeform
11
+ */
12
+ heading?: string;
13
+ /** Whether the popover is open. Two-way: emits `change:open`. */
14
+ open?: boolean;
15
+ /** Preferred placement of the panel relative to the trigger. */
16
+ position?: CPlacement;
17
+ }
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
20
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CPopoverProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CPopoverProps> & Readonly<{}>, {
21
+ heading: string;
22
+ open: boolean;
23
+ distance: number | string;
24
+ position: CPlacement;
25
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
26
+ trigger?: (props: {}) => any;
27
+ } & {
28
+ default?: (props: {}) => any;
29
+ }>;
30
+ type __VLS_WithSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -1,20 +1,11 @@
1
1
  interface CRadioProps {
2
- /**
3
- * Set option as checked
4
- *
5
- * @seeded from csc-ui — verify
6
- */
7
- checked?: boolean;
8
2
  /**
9
3
  * Disable the radio button
10
- *
11
- * @seeded from csc-ui — verify
12
4
  */
13
5
  disabled?: boolean;
14
6
  /**
15
7
  * Radio button value
16
8
  *
17
- * @seeded from csc-ui — verify
18
9
  * @freeform
19
10
  */
20
11
  value?: string;
@@ -26,7 +17,6 @@ type __VLS_Slots = {} & {
26
17
  declare const __VLS_base: import("vue").DefineComponent<CRadioProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CRadioProps> & Readonly<{}>, {
27
18
  value: string;
28
19
  disabled: boolean;
29
- checked: boolean;
30
20
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
21
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
32
22
  declare const _default: typeof __VLS_export;
@@ -1,8 +1,6 @@
1
1
  interface CRadioGroupProps {
2
2
  /**
3
3
  * Disable the radio group
4
- *
5
- * @seeded from csc-ui — verify
6
4
  */
7
5
  disabled?: boolean;
8
6
  /**
@@ -13,88 +11,52 @@ interface CRadioGroupProps {
13
11
  errorMessage?: string;
14
12
  /**
15
13
  * Hide the hint and error messages
16
- *
17
- * @seeded from csc-ui — verify
18
14
  */
19
15
  hideDetails?: boolean;
20
16
  /**
21
17
  * Hint text for the input
22
18
  *
23
- * @seeded from csc-ui — verify
24
19
  * @freeform
25
20
  */
26
21
  hint?: string;
27
- /**
28
- * Id of the element
29
- *
30
- * @seeded from csc-ui — verify
31
- * @freeform
32
- */
33
- hostId?: string;
34
22
  /**
35
23
  * Display radio buttons inline
36
- *
37
- * @seeded from csc-ui — verify
38
24
  */
39
25
  inline?: boolean;
40
- /**
41
- * Radio group items
42
- *
43
- * @seeded from csc-ui — verify
44
- */
45
- items?: RadioItem[];
46
26
  /**
47
27
  * Label of the radio group
48
28
  *
49
- * @seeded from csc-ui — verify
50
29
  * @freeform
51
30
  */
52
31
  label?: string;
53
32
  /**
54
33
  * Set as required
55
- *
56
- * @seeded from csc-ui — verify
57
34
  */
58
35
  required?: boolean;
59
- /**
60
- * Return the whole item object
61
- *
62
- * @seeded from csc-ui — verify
63
- */
64
- returnObject?: boolean;
65
36
  /**
66
37
  * Set the validity of the input
67
- *
68
- * @seeded from csc-ui — verify
69
38
  */
70
39
  valid?: boolean;
71
40
  /**
72
- * Value of the radio group
73
- *
74
- * @seeded from csc-ui — verify
41
+ * Value of the radio group; matched against each radio's `value` by strict
42
+ * string equality
75
43
  */
76
- value?: null | number | RadioItem | string;
77
- }
78
- interface RadioItem {
79
- disabled?: boolean;
80
- name: string;
81
- value: number | string;
44
+ value?: null | string;
82
45
  }
83
- declare var __VLS_7: {};
46
+ declare var __VLS_7: {}, __VLS_9: {};
84
47
  type __VLS_Slots = {} & {
85
- default?: (props: typeof __VLS_7) => any;
48
+ label?: (props: typeof __VLS_7) => any;
49
+ } & {
50
+ default?: (props: typeof __VLS_9) => any;
86
51
  };
87
52
  declare const __VLS_base: import("vue").DefineComponent<CRadioGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CRadioGroupProps> & Readonly<{}>, {
88
53
  label: string;
89
- value: null | number | RadioItem | string;
54
+ value: null | string;
90
55
  disabled: boolean;
91
56
  errorMessage: string;
92
57
  hideDetails: boolean;
93
58
  hint: string;
94
- hostId: string;
95
- items: RadioItem[];
96
59
  required: boolean;
97
- returnObject: boolean;
98
60
  valid: boolean;
99
61
  inline: boolean;
100
62
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,39 @@
1
+ import type { CPlacement } from '../../types';
2
+ export interface CTooltipProps {
3
+ /**
4
+ * Delay before the tooltip shows on hover, in milliseconds. Keyboard focus
5
+ * shows the tooltip immediately, regardless of this value. Defaults to
6
+ * `400`.
7
+ */
8
+ delay?: number | string;
9
+ /** Distance from the trigger to the tooltip, in pixels. Defaults to `4`. */
10
+ distance?: number | string;
11
+ /** Whether the tooltip is open. Two-way: emits `change:open`. */
12
+ open?: boolean;
13
+ /** Preferred placement of the tooltip relative to the trigger. */
14
+ position?: CPlacement;
15
+ /**
16
+ * The tooltip text. Overridden by the `content` slot when that is
17
+ * populated.
18
+ * @freeform
19
+ */
20
+ text?: string;
21
+ }
22
+ declare const _default: typeof __VLS_export;
23
+ export default _default;
24
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CTooltipProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CTooltipProps> & Readonly<{}>, {
25
+ text: string;
26
+ open: boolean;
27
+ distance: number | string;
28
+ position: CPlacement;
29
+ delay: number | string;
30
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
31
+ trigger?: (props: {}) => any;
32
+ } & {
33
+ content?: (props: {}) => any;
34
+ }>;
35
+ type __VLS_WithSlots<T, S> = T & {
36
+ new (): {
37
+ $slots: S;
38
+ };
39
+ };
@@ -8,6 +8,7 @@ export type { CIconButtonProps, CIconButtonSize, } from './components/c-icon-but
8
8
  export type { CLoginCardActionsAlign, CLoginCardActionsJustify, CLoginCardActionsProps, } from './components/c-login-card-actions/CLoginCardActions.vue';
9
9
  export type { CLoginCardBlendMode, CLoginCardProps, } from './components/c-login-card/CLoginCard.vue';
10
10
  export type { CPaginationOptions, CPaginationProps, CPaginationSize, } from './components/c-pagination/CPagination.vue';
11
+ export type { CPopoverProps } from './components/c-popover/CPopover.vue';
11
12
  export type { CStatusProps, CStatusType, } from './components/c-status/CStatus.vue';
12
13
  export type { CTabButtonsProps, CTabButtonsSize, } from './components/c-tab-buttons/CTabButtons.vue';
13
14
  export type { CTabsJustify, CTabsProps } from './components/c-tabs/CTabs.vue';
@@ -16,10 +17,11 @@ export type { CTagsProps, CTagsSize } from './components/c-tags/CTags.vue';
16
17
  export type { CTextFieldAutocapitalize, CTextFieldProps, CTextFieldType, } from './components/c-text-field/CTextField.vue';
17
18
  export type { CToastProps } from './components/c-toast/CToast.vue';
18
19
  export type { CToastsHorizontal, CToastsProps, CToastsVertical, } from './components/c-toasts/CToasts.vue';
20
+ export type { CTooltipProps } from './components/c-tooltip/CTooltip.vue';
19
21
  export type * from './tag-name-map';
20
22
  export { applyTheme, resetTheme, themeToCss } from './theme/applyTheme';
21
23
  export type { Family, ThemeSeeds } from './theme/applyTheme';
22
- export type { CFieldSize, CSelectItem, CToastMessage, CToastType, } from './types';
24
+ export type { CFieldSize, CPlacement, CSelectItem, CToastMessage, CToastType, } from './types';
23
25
  export { h } from 'vue';
24
26
  export type { VNode, VNodeChild } from 'vue';
25
27
  /**
@@ -0,0 +1,21 @@
1
+ interface FieldMessageProps {
2
+ /** Consumer-supplied text shown in place of the hint while invalid. */
3
+ errorMessage?: string;
4
+ /** Suppress the whole message area (no reserved height either). */
5
+ hideDetails?: boolean;
6
+ /** Neutral helper text shown while valid (or when no error message is supplied). */
7
+ hint?: string;
8
+ /** Part name stamped on the message area (`message` unless the host reserves it). */
9
+ part?: string;
10
+ /** Host control's validity; `false` switches to the error message when one is supplied. */
11
+ valid?: boolean;
12
+ }
13
+ declare const __VLS_export: import("vue").DefineComponent<FieldMessageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FieldMessageProps> & Readonly<{}>, {
14
+ part: string;
15
+ errorMessage: string;
16
+ hideDetails: boolean;
17
+ hint: string;
18
+ valid: boolean;
19
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import type { CPlacement } from '../types';
2
+ /**
3
+ * `CPlacement` → CSS `position-area`, shared by the anchor-positioned overlay
4
+ * components (`c-menu`, `c-tooltip`, `c-popover`; ADR-0008). Native flip/shift
5
+ * comes from each component's `position-try-fallbacks` escape-hatch rule.
6
+ */
7
+ export declare const POSITION_AREA: Record<CPlacement, string>;
8
+ /**
9
+ * The logical axis of a placement's side — the axis the trigger→panel gap
10
+ * margin is applied on (both sides, so the gap survives the position-try
11
+ * flip fallbacks).
12
+ */
13
+ export declare const placementAxis: (position: CPlacement) => "block" | "inline";
@@ -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
- export interface CAlertElement extends Omit<HTMLElement, 'type'> {
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,36 @@ 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
+ }
866
925
  export interface CProgressBarElement extends Omit<HTMLElement, 'hideDetails' | 'indeterminate' | 'label' | 'singleLine' | 'value'> {
867
926
  /** Hide the percentage display */
868
927
  hideDetails?: boolean;
@@ -875,33 +934,44 @@ export interface CProgressBarElement extends Omit<HTMLElement, 'hideDetails' | '
875
934
  /** Progress bar value in percentage (0 to 100) */
876
935
  value?: number;
877
936
  }
878
- export interface CRadioElement extends Omit<HTMLElement, 'checked' | 'disabled' | 'value'> {
879
- /** Set option as checked */
880
- checked?: boolean;
937
+ /** Events dispatched by `<c-radio>`. */
938
+ export interface CRadioElementEventMap {
939
+ /**
940
+ * Fired when the radio is selected by the user, carrying its `value`.
941
+ * Bubbles composed so the parent `<c-radio-group>` — whose shadow root a
942
+ * light-DOM event never enters — catches it on its host; a consumer
943
+ * listening on the group hears it too, with the radio as `target`.
944
+ */
945
+ change: CustomEvent<string>;
946
+ }
947
+ /** A single radio option inside a `c-radio-group`: a native radio input whose default slot is its clickable, announced label. */
948
+ export interface CRadioElement extends Omit<HTMLElement, 'disabled' | 'value'> {
881
949
  /** Disable the radio button */
882
950
  disabled?: boolean;
883
951
  /** Radio button value */
884
952
  value?: string;
953
+ addEventListener<K extends keyof CRadioElementEventMap>(type: K, listener: (this: CRadioElement, ev: CRadioElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
954
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
955
+ removeEventListener<K extends keyof CRadioElementEventMap>(type: K, listener: (this: CRadioElement, ev: CRadioElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
956
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
885
957
  }
886
958
  /** Events dispatched by `<c-radio-group>`. */
887
959
  export interface CRadioGroupElementEventMap {
888
- /**
889
- * Fired when a radio option is selected, carrying the selected item's
890
- * value — or the whole item object when `return-object` is set.
891
- */
892
- changeValue: CustomEvent<number | RadioItem | string>;
960
+ /** Fired when a radio is selected, carrying the selected radio's value. */
961
+ changeValue: CustomEvent<string>;
893
962
  /**
894
963
  * Native bubbling input event fired on selection so a plain Vue `v-model`
895
964
  * works without the `v-control` directive. No detail.
896
965
  */
897
966
  input: CustomEvent<void>;
898
967
  /**
899
- * v-model contract event fired on selection, carrying the selected item's
900
- * value — or the whole item object when `return-object` is set.
968
+ * v-model contract event fired on selection, carrying the selected radio's
969
+ * value.
901
970
  */
902
- 'update:value': CustomEvent<number | RadioItem | string>;
971
+ 'update:value': CustomEvent<string>;
903
972
  }
904
- export interface CRadioGroupElement extends Omit<HTMLElement, 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'hostId' | 'inline' | 'items' | 'label' | 'required' | 'returnObject' | 'valid' | 'value'> {
973
+ /** 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. */
974
+ export interface CRadioGroupElement extends Omit<HTMLElement, 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'inline' | 'label' | 'required' | 'valid' | 'value'> {
905
975
  /** Disable the radio group */
906
976
  disabled?: boolean;
907
977
  /** Error message shown in place of the hint while the group is invalid */
@@ -910,22 +980,19 @@ export interface CRadioGroupElement extends Omit<HTMLElement, 'disabled' | 'erro
910
980
  hideDetails?: boolean;
911
981
  /** Hint text for the input */
912
982
  hint?: string;
913
- /** Id of the element */
914
- hostId?: string;
915
983
  /** Display radio buttons inline */
916
984
  inline?: boolean;
917
- /** Radio group items */
918
- items?: RadioItem[];
919
985
  /** Label of the radio group */
920
986
  label?: string;
921
987
  /** Set as required */
922
988
  required?: boolean;
923
- /** Return the whole item object */
924
- returnObject?: boolean;
925
989
  /** Set the validity of the input */
926
990
  valid?: boolean;
927
- /** Value of the radio group */
928
- value?: null | number | RadioItem | string;
991
+ /**
992
+ * Value of the radio group; matched against each radio's `value` by strict
993
+ * string equality
994
+ */
995
+ value?: null | string;
929
996
  addEventListener<K extends keyof CRadioGroupElementEventMap>(type: K, listener: (this: CRadioGroupElement, ev: CRadioGroupElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
930
997
  addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
931
998
  removeEventListener<K extends keyof CRadioGroupElementEventMap>(type: K, listener: (this: CRadioGroupElement, ev: CRadioGroupElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
@@ -1466,6 +1533,40 @@ export interface CToastsElement extends Omit<HTMLElement, 'absolute' | 'horizont
1466
1533
  }
1467
1534
  export interface CToolbarElement extends HTMLElement {
1468
1535
  }
1536
+ /** Events dispatched by `<c-tooltip>`. */
1537
+ export interface CTooltipElementEventMap {
1538
+ /**
1539
+ * Fired whenever the tooltip shows or hides, carrying the new open state.
1540
+ * Named `change:open`, not `update:open`: Vue's runtime silently drops
1541
+ * `onUpdate:*` listeners on custom elements (`isModelListener`), so a
1542
+ * template `@update:open` would never be attached.
1543
+ */
1544
+ 'change:open': CustomEvent<boolean>;
1545
+ }
1546
+ /** A non-interactive text hint shown when its trigger is hovered or keyboard-focused, floating in the top layer on the inverted surface tier. */
1547
+ export interface CTooltipElement extends Omit<HTMLElement, 'delay' | 'distance' | 'open' | 'position' | 'text'> {
1548
+ /**
1549
+ * Delay before the tooltip shows on hover, in milliseconds. Keyboard focus
1550
+ * shows the tooltip immediately, regardless of this value. Defaults to
1551
+ * `400`.
1552
+ */
1553
+ delay?: number | string;
1554
+ /** Distance from the trigger to the tooltip, in pixels. Defaults to `4`. */
1555
+ distance?: number | string;
1556
+ /** Whether the tooltip is open. Two-way: emits `change:open`. */
1557
+ open?: boolean;
1558
+ /** Preferred placement of the tooltip relative to the trigger. */
1559
+ position?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
1560
+ /**
1561
+ * The tooltip text. Overridden by the `content` slot when that is
1562
+ * populated.
1563
+ */
1564
+ text?: string;
1565
+ addEventListener<K extends keyof CTooltipElementEventMap>(type: K, listener: (this: CTooltipElement, ev: CTooltipElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
1566
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1567
+ removeEventListener<K extends keyof CTooltipElementEventMap>(type: K, listener: (this: CTooltipElement, ev: CTooltipElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
1568
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1569
+ }
1469
1570
  declare global {
1470
1571
  interface HTMLElementTagNameMap {
1471
1572
  'c-accordion': CAccordionElement;
@@ -1510,6 +1611,7 @@ declare global {
1510
1611
  'c-otp-input': COtpInputElement;
1511
1612
  'c-page': CPageElement;
1512
1613
  'c-pagination': CPaginationElement;
1614
+ 'c-popover': CPopoverElement;
1513
1615
  'c-progress-bar': CProgressBarElement;
1514
1616
  'c-radio': CRadioElement;
1515
1617
  'c-radio-group': CRadioGroupElement;
@@ -1536,6 +1638,7 @@ declare global {
1536
1638
  'c-toast': CToastElement;
1537
1639
  'c-toasts': CToastsElement;
1538
1640
  'c-toolbar': CToolbarElement;
1641
+ 'c-tooltip': CTooltipElement;
1539
1642
  }
1540
1643
  }
1541
1644
  export {};
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cscfi/csc-ui",
3
- "version": "4.0.0-alpha.3",
3
+ "version": "4.0.0-alpha.4",
4
4
  "description": "Vue 3-based replacement for @cscfi/csc-ui — same custom element tag names, Vue v-model contract.",
5
5
  "type": "module",
6
6
  "main": "./dist/csc-ui.js",