@cscfi/csc-ui 4.0.0-rc.7 → 4.0.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.
@@ -1,8 +1,9 @@
1
1
  /**
2
- * The pure half of `c-file-upload` (ADR-0071): `accept` matching, the decimal
3
- * byte formatter, the file-type icon category, the name split that keeps an
4
- * extension visible, the upload-error wording rule and the screening of one
5
- * add into accepted and rejected files. No DOM — `files.node.spec.ts`.
2
+ * The pure half of `c-file-upload` (ADR-0071): `accept` matching, the media
3
+ * type an added file carries, the decimal byte formatter, the file-type icon
4
+ * category, the name split that keeps an extension visible, the upload-error
5
+ * wording rule and the screening of one add into accepted and rejected files.
6
+ * No DOM — `files.node.spec.ts`.
6
7
  */
7
8
  /** The icon family a file belongs to (decision 19 of `_plan/c-file-upload.md`). */
8
9
  export type FileCategory = 'archive' | 'audio' | 'code' | 'document' | 'generic' | 'image' | 'spreadsheet' | 'video';
@@ -18,6 +19,13 @@ export interface FileFacts {
18
19
  export type RejectReason = 'count' | 'duplicate' | 'folder' | 'size' | 'type';
19
20
  /** The file's media type, else the one its extension suggests, else `''`; lowercase. */
20
21
  export declare const mediaType: (file: Pick<FileFacts, "name" | "type">) => string;
22
+ /**
23
+ * The file typed by `mediaType`: the same `File` when the browser reported a
24
+ * type or the extension implies none, else a new `File` over the same bytes —
25
+ * so a `.pptx` Chrome on Windows reports untyped is sent as one, not as
26
+ * `application/octet-stream`.
27
+ */
28
+ export declare const withMediaType: (file: File) => File;
21
29
  /**
22
30
  * Whether a file passes an `accept` list in the native syntax — `.pdf`,
23
31
  * `image/*`, `application/json`, comma separated, case-insensitive. An empty
@@ -11,7 +11,12 @@ interface CIconProps {
11
11
  * @freeform SVG path data
12
12
  */
13
13
  path: string;
14
- /** Icon size in pixels. */
14
+ /**
15
+ * Icon size in pixels. Unset, the icon takes the size of the icon slot it
16
+ * sits in.
17
+ *
18
+ * @default 24
19
+ */
15
20
  size?: number;
16
21
  }
17
22
  declare const __VLS_export: import("vue").DefineComponent<CIconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CIconProps> & Readonly<{}>, {
@@ -96,9 +96,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CIconB
96
96
  outlined: boolean;
97
97
  size: CIconButtonSize;
98
98
  variant: CIconButtonVariant;
99
+ appearance: CIconButtonAppearance;
99
100
  disabled: boolean;
100
101
  loading: boolean;
101
- appearance: CIconButtonAppearance;
102
102
  danger: boolean;
103
103
  ghost: boolean;
104
104
  inverted: boolean;
@@ -39,7 +39,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CMenuI
39
39
  danger: boolean;
40
40
  checked: boolean;
41
41
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
42
- icon?: (props: {}) => any;
42
+ icon?: (props: {
43
+ class: string;
44
+ }) => any;
43
45
  } & {
44
46
  default?: (props: {}) => any;
45
47
  } & {
@@ -1,9 +1,43 @@
1
+ /**
2
+ * How the pill reads: `filled` paints the status tint, `outlined` keeps the
3
+ * ground and colours only the marker.
4
+ */
5
+ export type CStatusAppearance = 'filled' | 'outlined';
6
+ /**
7
+ * The symbol before the text: the status icon on a tinted halo, a dot in the
8
+ * status colour, or none.
9
+ */
10
+ export type CStatusMarker = 'dot' | 'icon' | 'none';
11
+ /** Size of the pill: 20px `small`, 24px `default` or 32px `large`. */
12
+ export type CStatusSize = 'default' | 'large' | 'small';
1
13
  /**
2
14
  * Status type of the pill. Each value paints the matching semantic status
3
15
  * colours; omitting the attribute renders the neutral grey pill.
4
16
  */
5
17
  export type CStatusType = 'error' | 'info' | 'success' | 'warning';
6
18
  interface CStatusProps {
19
+ /**
20
+ * `filled` (unless set, or changed app-wide) paints the status tint;
21
+ * `outlined` keeps the ground behind the pill and colours only the marker.
22
+ *
23
+ * @defaultable 'filled'
24
+ */
25
+ appearance?: CStatusAppearance;
26
+ /**
27
+ * The symbol before the text: `icon` (the status icon on a tinted halo),
28
+ * `dot`, or `none` (unless set, or changed app-wide). A slotted icon
29
+ * replaces it.
30
+ *
31
+ * @defaultable 'none'
32
+ */
33
+ marker?: CStatusMarker;
34
+ /**
35
+ * Size of the pill: `small`, `default` (unless set, or changed app-wide)
36
+ * or `large`.
37
+ *
38
+ * @defaultable 'default'
39
+ */
40
+ size?: CStatusSize;
7
41
  /**
8
42
  * The status family whose tint and ink paint the pill; without it the
9
43
  * pill is neutral grey.
@@ -12,7 +46,16 @@ interface CStatusProps {
12
46
  }
13
47
  declare const _default: typeof __VLS_export;
14
48
  export default _default;
15
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CStatusProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CStatusProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
49
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CStatusProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CStatusProps> & Readonly<{}>, {
50
+ marker: CStatusMarker;
51
+ type: CStatusType;
52
+ size: CStatusSize;
53
+ appearance: CStatusAppearance;
54
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
55
+ icon?: (props: {
56
+ class: string;
57
+ }) => any;
58
+ } & {
16
59
  default?: (props: {}) => any;
17
60
  }>;
18
61
  type __VLS_WithSlots<T, S> = T & {
@@ -19,7 +19,7 @@ export type { CNumberFieldTexts } from './components/c-number-field/CNumberField
19
19
  export type { CPaginationOptions, CPaginationSize, CPaginationTexts, } from './components/c-pagination/CPagination.vue';
20
20
  export type { CPopoverPosition } from './components/c-popover/CPopover.vue';
21
21
  export type { CSelectTexts, CSelectValue, } from './components/c-select/CSelect.vue';
22
- export type { CStatusType } from './components/c-status/CStatus.vue';
22
+ export type { CStatusAppearance, CStatusMarker, CStatusSize, CStatusType, } from './components/c-status/CStatus.vue';
23
23
  export type { CTabButtonsSize } from './components/c-tab-buttons/CTabButtons.vue';
24
24
  export type { CTabsJustify } from './components/c-tabs/CTabs.vue';
25
25
  export type { CTagSize } from './components/c-tag/CTag.vue';
@@ -0,0 +1,4 @@
1
+ /** A status type, as c-alert, c-toast and c-status spell it. */
2
+ type StatusType = 'error' | 'info' | 'success' | 'warning';
3
+ export declare const STATUS_ICONS: Readonly<Record<StatusType, string>>;
4
+ export {};
@@ -996,7 +996,10 @@ export interface CIconElement extends Omit<HTMLElement, 'color' | 'path' | 'size
996
996
  color?: string;
997
997
  /** Svg `path` `d` attribute value. */
998
998
  path: string;
999
- /** Icon size in pixels. */
999
+ /**
1000
+ * Icon size in pixels. Unset, the icon takes the size of the icon slot it
1001
+ * sits in.
1002
+ */
1000
1003
  size?: number;
1001
1004
  }
1002
1005
  /** 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. */
@@ -2004,7 +2007,23 @@ export interface CSpinnerElement extends Omit<HTMLElement, 'color' | 'size' | 't
2004
2007
  width?: number;
2005
2008
  }
2006
2009
  /** A status pill: a short word naming the state of a record, such as Active, Pending or Failed, tinted with the colours of its status type. */
2007
- export interface CStatusElement extends Omit<HTMLElement, 'type'> {
2010
+ export interface CStatusElement extends Omit<HTMLElement, 'appearance' | 'marker' | 'size' | 'type'> {
2011
+ /**
2012
+ * `filled` (unless set, or changed app-wide) paints the status tint;
2013
+ * `outlined` keeps the ground behind the pill and colours only the marker.
2014
+ */
2015
+ appearance?: 'filled' | 'outlined';
2016
+ /**
2017
+ * The symbol before the text: `icon` (the status icon on a tinted halo),
2018
+ * `dot`, or `none` (unless set, or changed app-wide). A slotted icon
2019
+ * replaces it.
2020
+ */
2021
+ marker?: 'dot' | 'icon' | 'none';
2022
+ /**
2023
+ * Size of the pill: `small`, `default` (unless set, or changed app-wide)
2024
+ * or `large`.
2025
+ */
2026
+ size?: 'default' | 'large' | 'small';
2008
2027
  /**
2009
2028
  * The status family whose tint and ink paint the pill; without it the
2010
2029
  * pill is neutral grey.
@@ -2755,6 +2774,7 @@ export interface CAppDefaults {
2755
2774
  'c-number-field'?: Partial<Pick<CNumberFieldElement, 'decimalSeparator' | 'decimals' | 'fixedDecimals' | 'groupSeparator' | 'hideDetails' | 'hideMessage' | 'labelOnTop' | 'shadow' | 'size' | 'step' | 'texts'>>;
2756
2775
  'c-pagination'?: Partial<Pick<CPaginationElement, 'texts'>>;
2757
2776
  'c-select'?: Partial<Pick<CSelectElement, 'hideDetails' | 'hideMessage' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
2777
+ 'c-status'?: Partial<Pick<CStatusElement, 'appearance' | 'marker' | 'size'>>;
2758
2778
  'c-text-field'?: Partial<Pick<CTextFieldElement, 'hideDetails' | 'hideMessage' | 'labelOnTop' | 'shadow' | 'size'>>;
2759
2779
  'c-time-picker'?: Partial<Pick<CTimePickerElement, 'format' | 'hideDetails' | 'hideMessage' | 'labelOnTop' | 'shadow' | 'showNow' | 'size' | 'texts'>>;
2760
2780
  'c-tree-select'?: Partial<Pick<CTreeSelectElement, 'hideDetails' | 'hideMessage' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
@@ -2773,6 +2793,7 @@ export declare const DEFAULTABLE_PROPS: {
2773
2793
  readonly 'c-number-field': readonly ["decimalSeparator", "decimals", "fixedDecimals", "groupSeparator", "hideDetails", "hideMessage", "labelOnTop", "shadow", "size", "step", "texts"];
2774
2794
  readonly 'c-pagination': readonly ["texts"];
2775
2795
  readonly 'c-select': readonly ["hideDetails", "hideMessage", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
2796
+ readonly 'c-status': readonly ["appearance", "marker", "size"];
2776
2797
  readonly 'c-text-field': readonly ["hideDetails", "hideMessage", "labelOnTop", "shadow", "size"];
2777
2798
  readonly 'c-time-picker': readonly ["format", "hideDetails", "hideMessage", "labelOnTop", "shadow", "showNow", "size", "texts"];
2778
2799
  readonly 'c-tree-select': readonly ["hideDetails", "hideMessage", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cscfi/csc-ui",
3
- "version": "4.0.0-rc.7",
3
+ "version": "4.0.0",
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",