@cscfi/csc-ui 4.0.0-rc.5 → 4.0.0-rc.6

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.
@@ -2380,6 +2380,15 @@
2380
2380
  "typeAlias": "CButtonVariant",
2381
2381
  "defaultable": true
2382
2382
  }
2383
+ },
2384
+ {
2385
+ "kind": "method",
2386
+ "name": "focus",
2387
+ "privacy": "public",
2388
+ "description": "Focus its button — its link under `href`, or the slotted button — as\n`focus()` does on a native button: the element renders no box of its own to\ntake it.",
2389
+ "csc": {
2390
+ "signature": "(options?: FocusOptions): void"
2391
+ }
2383
2392
  }
2384
2393
  ],
2385
2394
  "slots": [
@@ -6361,6 +6370,15 @@
6361
6370
  "typeAlias": "CIconButtonVariant",
6362
6371
  "defaultable": true
6363
6372
  }
6373
+ },
6374
+ {
6375
+ "kind": "method",
6376
+ "name": "focus",
6377
+ "privacy": "public",
6378
+ "description": "Focus its button, as `focus()` does on a native button: the element renders\nno box of its own to take it.",
6379
+ "csc": {
6380
+ "signature": "(options?: FocusOptions): void"
6381
+ }
6364
6382
  }
6365
6383
  ],
6366
6384
  "slots": [
@@ -125,6 +125,9 @@ platform; with a slotted button, the page's own `<button>` is the control and
125
125
  `root` only paints. When only an icon is slotted, provide an accessible name on the
126
126
  host, e.g. `aria-label="Close"`.
127
127
 
128
+ The element's `focus()` focuses that control, as on a native button, so a
129
+ page can move focus to it and a menu or popover returns focus to it.
130
+
128
131
  ## Customization
129
132
 
130
133
  Restyle via CSS parts from your own stylesheet:
@@ -74,6 +74,7 @@ element ids (`aria-controls`, `aria-describedby`, …) give the button the
74
74
  elements the ids name in your page. Without an `aria-label` the button is named only by
75
75
  the text in its content, which is usually nothing or the badge count; visually
76
76
  hidden slotted text also names it, and keeps naming it while `loading`.
77
+ The element's `focus()` focuses the inner button, as on a native button.
77
78
 
78
79
  To show the name to sighted users too, put the button in a `c-tooltip`'s
79
80
  `trigger` slot. The tooltip text is announced as a description, so the
@@ -213,7 +213,7 @@
213
213
  },
214
214
  {
215
215
  "name": "c-button",
216
- "description": "Buttons trigger actions — submitting a form, opening a modal, confirming a choice. Use one filled button (the default `appearance`) per view for its main action; other actions use `appearance=\"outlined\"`, `\"ghost\"` or `\"text\"`.\n---\n\n\n### **Slots:**\n - **default** - Button label content, or a slotted `<button>` (ADR-0085):\nthe page's own native button, which a password manager reading the form's\nsubmit button finds. Its own `type`, `disabled`, `name`, `value` and\n`form` apply; the element paints its look.\n- **icon** - Leading icon, vertically centered before the label.\n- **description** - Secondary text rendered below the label.\n\n### **CSS Parts:**\n - **root** - The native `<button>` / `<a>` element carrying the visual styling.\n- **content** - Layout wrapper for the label, icon and description.\n- **description** - Wrapper of the `description` slot.",
216
+ "description": "Buttons trigger actions — submitting a form, opening a modal, confirming a choice. Use one filled button (the default `appearance`) per view for its main action; other actions use `appearance=\"outlined\"`, `\"ghost\"` or `\"text\"`.\n---\n\n\n### **Methods:**\n - **focus()** - Focus its button — its link under `href`, or the slotted button — as\n`focus()` does on a native button: the element renders no box of its own to\ntake it.\n\n### **Slots:**\n - **default** - Button label content, or a slotted `<button>` (ADR-0085):\nthe page's own native button, which a password manager reading the form's\nsubmit button finds. Its own `type`, `disabled`, `name`, `value` and\n`form` apply; the element paints its look.\n- **icon** - Leading icon, vertically centered before the label.\n- **description** - Secondary text rendered below the label.\n\n### **CSS Parts:**\n - **root** - The native `<button>` / `<a>` element carrying the visual styling.\n- **content** - Layout wrapper for the label, icon and description.\n- **description** - Wrapper of the `description` slot.",
217
217
  "attributes": [
218
218
  {
219
219
  "name": "active",
@@ -908,7 +908,7 @@
908
908
  },
909
909
  {
910
910
  "name": "c-icon-button",
911
- "description": "An icon-only button: a round native button that shows a single icon and takes its accessible name from an `aria-label` on the element.\n---\n\n\n### **Slots:**\n - **default** - The icon: a `c-icon` or an `<svg>`; it wins over `path`\n\n### **CSS Parts:**\n - **root** - The native `<button>` element carrying the visual styling\n- **content** - Inner wrapper around the slotted icon or loading spinner\n- **badge** - The count bubble at the button's top-right corner, shown by `badge`",
911
+ "description": "An icon-only button: a round native button that shows a single icon and takes its accessible name from an `aria-label` on the element.\n---\n\n\n### **Methods:**\n - **focus()** - Focus its button, as `focus()` does on a native button: the element renders\nno box of its own to take it.\n\n### **Slots:**\n - **default** - The icon: a `c-icon` or an `<svg>`; it wins over `path`\n\n### **CSS Parts:**\n - **root** - The native `<button>` element carrying the visual styling\n- **content** - Inner wrapper around the slotted icon or loading spinner\n- **badge** - The count bubble at the button's top-right corner, shown by `badge`",
912
912
  "attributes": [
913
913
  {
914
914
  "name": "appearance",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@cscfi/csc-ui",
4
- "version": "4.0.0-rc.5",
4
+ "version": "4.0.0-rc.6",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -694,7 +694,7 @@
694
694
  },
695
695
  {
696
696
  "name": "c-button",
697
- "description": "Buttons trigger actions — submitting a form, opening a modal, confirming a choice. Use one filled button (the default `appearance`) per view for its main action; other actions use `appearance=\"outlined\"`, `\"ghost\"` or `\"text\"`.\n---\n\n\n### **Slots:**\n - **default** - Button label content, or a slotted `<button>` (ADR-0085):\nthe page's own native button, which a password manager reading the form's\nsubmit button finds. Its own `type`, `disabled`, `name`, `value` and\n`form` apply; the element paints its look.\n- **icon** - Leading icon, vertically centered before the label.\n- **description** - Secondary text rendered below the label.\n\n### **CSS Parts:**\n - **root** - The native `<button>` / `<a>` element carrying the visual styling.\n- **content** - Layout wrapper for the label, icon and description.\n- **description** - Wrapper of the `description` slot.",
697
+ "description": "Buttons trigger actions — submitting a form, opening a modal, confirming a choice. Use one filled button (the default `appearance`) per view for its main action; other actions use `appearance=\"outlined\"`, `\"ghost\"` or `\"text\"`.\n---\n\n\n### **Methods:**\n - **focus()** - Focus its button — its link under `href`, or the slotted button — as\n`focus()` does on a native button: the element renders no box of its own to\ntake it.\n\n### **Slots:**\n - **default** - Button label content, or a slotted `<button>` (ADR-0085):\nthe page's own native button, which a password manager reading the form's\nsubmit button finds. Its own `type`, `disabled`, `name`, `value` and\n`form` apply; the element paints its look.\n- **icon** - Leading icon, vertically centered before the label.\n- **description** - Secondary text rendered below the label.\n\n### **CSS Parts:**\n - **root** - The native `<button>` / `<a>` element carrying the visual styling.\n- **content** - Layout wrapper for the label, icon and description.\n- **description** - Wrapper of the `description` slot.",
698
698
  "doc-url": "",
699
699
  "attributes": [
700
700
  {
@@ -2802,7 +2802,7 @@
2802
2802
  },
2803
2803
  {
2804
2804
  "name": "c-icon-button",
2805
- "description": "An icon-only button: a round native button that shows a single icon and takes its accessible name from an `aria-label` on the element.\n---\n\n\n### **Slots:**\n - **default** - The icon: a `c-icon` or an `<svg>`; it wins over `path`\n\n### **CSS Parts:**\n - **root** - The native `<button>` element carrying the visual styling\n- **content** - Inner wrapper around the slotted icon or loading spinner\n- **badge** - The count bubble at the button's top-right corner, shown by `badge`",
2805
+ "description": "An icon-only button: a round native button that shows a single icon and takes its accessible name from an `aria-label` on the element.\n---\n\n\n### **Methods:**\n - **focus()** - Focus its button, as `focus()` does on a native button: the element renders\nno box of its own to take it.\n\n### **Slots:**\n - **default** - The icon: a `c-icon` or an `<svg>`; it wins over `path`\n\n### **CSS Parts:**\n - **root** - The native `<button>` element carrying the visual styling\n- **content** - Inner wrapper around the slotted icon or loading spinner\n- **badge** - The count bubble at the button's top-right corner, shown by `badge`",
2806
2806
  "doc-url": "",
2807
2807
  "attributes": [
2808
2808
  {
@@ -135,7 +135,9 @@ interface CButtonProps {
135
135
  }
136
136
  declare const _default: typeof __VLS_export;
137
137
  export default _default;
138
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CButtonProps> & Readonly<{}>, {
138
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CButtonProps, {
139
+ focus: (options?: FocusOptions) => void;
140
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CButtonProps> & Readonly<{}>, {
139
141
  text: boolean;
140
142
  outlined: boolean;
141
143
  value: number | string;
@@ -88,7 +88,9 @@ interface CIconButtonProps {
88
88
  }
89
89
  declare const _default: typeof __VLS_export;
90
90
  export default _default;
91
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CIconButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CIconButtonProps> & Readonly<{}>, {
91
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CIconButtonProps, {
92
+ focus: (options?: FocusOptions) => void;
93
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CIconButtonProps> & Readonly<{}>, {
92
94
  path: string;
93
95
  text: boolean;
94
96
  outlined: boolean;
@@ -345,6 +345,12 @@ export interface CButtonElement extends Omit<HTMLElement, 'active' | 'appearance
345
345
  * for a destructive action.
346
346
  */
347
347
  variant?: 'danger' | 'info' | 'primary' | 'secondary' | 'success' | 'warning';
348
+ /**
349
+ * Focus its button — its link under `href`, or the slotted button — as
350
+ * `focus()` does on a native button: the element renders no box of its own to
351
+ * take it.
352
+ */
353
+ focus(options?: FocusOptions): void;
348
354
  }
349
355
  /** Events dispatched by `<c-button-group>`. */
350
356
  export interface CButtonGroupElementEventMap {
@@ -1056,6 +1062,11 @@ export interface CIconButtonElement extends Omit<HTMLElement, 'appearance' | 'ba
1056
1062
  * for a destructive action.
1057
1063
  */
1058
1064
  variant?: 'danger' | 'info' | 'primary' | 'secondary' | 'success' | 'warning';
1065
+ /**
1066
+ * Focus its button, as `focus()` does on a native button: the element renders
1067
+ * no box of its own to take it.
1068
+ */
1069
+ focus(options?: FocusOptions): void;
1059
1070
  }
1060
1071
  /** A text link to another page or resource: a native `<a>` in the link colour, with an optional underline. */
1061
1072
  export interface CLinkElement extends Omit<HTMLElement, 'href' | 'target' | 'underline'> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cscfi/csc-ui",
3
- "version": "4.0.0-rc.5",
3
+ "version": "4.0.0-rc.6",
4
4
  "description": "The CSC Design System's components as native custom elements: one set of c-* tags for plain HTML, Vue, React and Angular.",
5
5
  "type": "module",
6
6
  "main": "./dist/csc-ui.js",