@cscfi/csc-ui 4.0.0-rc.3 → 4.0.0-rc.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.
@@ -52,9 +52,9 @@ type __VLS_Slots = {} & {
52
52
  declare const __VLS_base: import("vue").DefineComponent<CSubNavigationItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CSubNavigationItemProps> & Readonly<{}>, {
53
53
  value: string;
54
54
  loading: boolean;
55
+ active: boolean;
55
56
  href: string;
56
57
  target: string;
57
- active: boolean;
58
58
  collapsed: boolean;
59
59
  current: boolean;
60
60
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -3,13 +3,13 @@ export type { CAlertType } from './components/c-alert/CAlert.vue';
3
3
  export type { CAutocompleteFilter, CAutocompleteItem, CAutocompleteOption, CAutocompleteTexts, CAutocompleteValue, } from './components/c-autocomplete/CAutocomplete.vue';
4
4
  export type { CBreadcrumbTexts } from './components/c-breadcrumb/CBreadcrumb.vue';
5
5
  export type { CButtonGroupSize, CButtonGroupValue, } from './components/c-button-group/CButtonGroup.vue';
6
- export type { CButtonAppearance, CButtonSize, CButtonType, } from './components/c-button/CButton.vue';
6
+ export type { CButtonAppearance, CButtonSize, CButtonType, CButtonVariant, } from './components/c-button/CButton.vue';
7
7
  export type { CCardActionsAlign, CCardActionsJustify, } from './components/c-card-actions/CCardActions.vue';
8
8
  export type { CColorPickerFormat, CColorPickerSwatch, CColorPickerTexts, CColorPickerValue, } from './components/c-color-picker/CColorPicker.vue';
9
9
  export type { CDataTableAlign, CDataTableCellContent, CDataTableCellContext, CDataTableColumn, CDataTableColumnExpansion, CDataTableColumnPin, CDataTableExpandedContext, CDataTableFooterContext, CDataTableRow, CDataTableSelectionMode, CDataTableSort, CDataTableSortDirection, CDataTableTexts, } from './components/c-data-table/CDataTable.vue';
10
10
  export type { CDatePickerDisabledDate, CDatePickerRange, CDatePickerText, CDatePickerTexts, CDatePickerType, CDatePickerValue, CDatePickerWeekday, } from './components/c-date-picker/CDatePicker.vue';
11
11
  export type { CFileUploadContext, CFileUploadEntry, CFileUploadFunction, CFileUploadRejection, CFileUploadRejectReason, CFileUploadStatus, CFileUploadTexts, } from './components/c-file-upload/CFileUpload.vue';
12
- export type { CIconButtonAppearance, CIconButtonSize, } from './components/c-icon-button/CIconButton.vue';
12
+ export type { CIconButtonAppearance, CIconButtonSize, CIconButtonVariant, } from './components/c-icon-button/CIconButton.vue';
13
13
  export type { CLoginCardActionsAlign, CLoginCardActionsJustify, } from './components/c-login-card-actions/CLoginCardActions.vue';
14
14
  export type { CLoginCardBlendMode } from './components/c-login-card/CLoginCard.vue';
15
15
  export type { CMenuItemType } from './components/c-menu-item/CMenuItem.vue';
@@ -78,5 +78,12 @@ export declare function resetDefaults(tags?: CDefaultableTag[]): void;
78
78
  * still beats an app-wide `hideDetails: true`.
79
79
  *
80
80
  * const hideMessageResolved = appDefault('hideMessage', false, 'hideDetails');
81
+ *
82
+ * A replaced prop of another shape names a mapper fourth: it receives that
83
+ * prop's own instance value (an attribute string or a property) and returns
84
+ * the new prop's value, or undefined to fall through. Such a prop is not
85
+ * defaultable, so only the instance layer reads it.
86
+ *
87
+ * const variantResolved = appDefault('variant', 'primary', 'danger', dangerAsVariant);
81
88
  */
82
- export declare const useAppDefault: <T extends CDefaultableTag>(tag: T, props: object) => <K extends keyof Bucket<T> & string>(key: K, builtIn: Resolved<T, K>, replaces?: keyof Bucket<T> & string) => ComputedRef<Resolved<T, K>>;
89
+ export declare const useAppDefault: <T extends CDefaultableTag>(tag: T, props: object) => <K extends keyof Bucket<T> & string>(key: K, builtIn: Resolved<T, K>, replaces?: string, map?: (value: unknown) => Resolved<T, K> | undefined) => ComputedRef<Resolved<T, K>>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * `danger` read as a variant, the mapper `appDefault` takes for it: set →
3
+ * `danger`; unset or `"false"` → undefined, so the app default still applies.
4
+ */
5
+ export declare const dangerAsVariant: (value: unknown) => "danger" | undefined;
@@ -251,8 +251,8 @@ export interface CBreadcrumbItemElement extends Omit<HTMLElement, 'href' | 'targ
251
251
  /** Browsing context the link opens in; the same tab when unset */
252
252
  target?: string;
253
253
  }
254
- /** Buttons trigger actions — submitting a form, opening a modal, confirming a choice. Use one primary (filled, the default `appearance`) button per view; secondary actions use `appearance="outlined"`, `"ghost"` or `"text"`. */
255
- export interface CButtonElement extends Omit<HTMLElement, 'active' | 'appearance' | 'asTab' | 'danger' | 'disabled' | 'fit' | 'ghost' | 'href' | 'inverted' | 'loading' | 'noRadius' | 'noRipple' | 'outlined' | 'size' | 'target' | 'text' | 'type' | 'value'> {
254
+ /** 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"`. */
255
+ export interface CButtonElement extends Omit<HTMLElement, 'active' | 'appearance' | 'asTab' | 'danger' | 'disabled' | 'fit' | 'ghost' | 'href' | 'inverted' | 'loading' | 'noRadius' | 'noRipple' | 'outlined' | 'size' | 'target' | 'text' | 'type' | 'value' | 'variant'> {
256
256
  /**
257
257
  * Pressed (toggle) state — renders the selected look and sets
258
258
  * `aria-pressed`. Leave unset for regular action buttons: only a
@@ -267,8 +267,9 @@ export interface CButtonElement extends Omit<HTMLElement, 'active' | 'appearance
267
267
  */
268
268
  appearance?: 'filled' | 'ghost' | 'outlined' | 'text';
269
269
  /**
270
- * Danger look for a destructive action: the filled button in the error
271
- * colour; no effect on the `outlined`, `ghost` or `text` appearance.
270
+ * Danger look for a destructive action: the error colour.
271
+ *
272
+ * @deprecated Use `variant="danger"`.
272
273
  */
273
274
  danger?: boolean;
274
275
  /**
@@ -335,6 +336,12 @@ export interface CButtonElement extends Omit<HTMLElement, 'active' | 'appearance
335
336
  * of the `c-tab-item` panel it shows.
336
337
  */
337
338
  value?: number | string;
339
+ /**
340
+ * The button's colour, in every appearance: `primary` unless set (or
341
+ * changed app-wide), `secondary`, `success`, `info`, `warning`, or `danger`
342
+ * for a destructive action.
343
+ */
344
+ variant?: 'danger' | 'info' | 'primary' | 'secondary' | 'success' | 'warning';
338
345
  }
339
346
  /** Events dispatched by `<c-button-group>`. */
340
347
  export interface CButtonGroupElementEventMap {
@@ -973,7 +980,7 @@ export interface CIconElement extends Omit<HTMLElement, 'color' | 'path' | 'size
973
980
  size?: number;
974
981
  }
975
982
  /** 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. */
976
- export interface CIconButtonElement extends Omit<HTMLElement, 'appearance' | 'badge' | 'danger' | 'disabled' | 'ghost' | 'inverted' | 'loading' | 'outlined' | 'path' | 'size' | 'text'> {
983
+ export interface CIconButtonElement extends Omit<HTMLElement, 'appearance' | 'badge' | 'danger' | 'disabled' | 'ghost' | 'inverted' | 'loading' | 'outlined' | 'path' | 'size' | 'text' | 'variant'> {
977
984
  /**
978
985
  * The button's look: `filled` (unless set) for the main action; `outlined`
979
986
  * (a primary outline, no fill), `ghost` (a light primary tint) or `text`
@@ -986,8 +993,9 @@ export interface CIconButtonElement extends Omit<HTMLElement, 'appearance' | 'ba
986
993
  */
987
994
  badge?: null | number | string;
988
995
  /**
989
- * Danger look for a destructive action: the filled button in the error
990
- * colour; no effect on the `outlined`, `ghost` or `text` appearance.
996
+ * Danger look for a destructive action: the error colour.
997
+ *
998
+ * @deprecated Use `variant="danger"`.
991
999
  */
992
1000
  danger?: boolean;
993
1001
  /** Disable the button: it leaves the Tab order and ignores the pointer. */
@@ -1028,6 +1036,12 @@ export interface CIconButtonElement extends Omit<HTMLElement, 'appearance' | 'ba
1028
1036
  * @deprecated Use `appearance="text"`.
1029
1037
  */
1030
1038
  text?: boolean;
1039
+ /**
1040
+ * The button's colour, in every appearance: `primary` unless set (or
1041
+ * changed app-wide), `secondary`, `success`, `info`, `warning`, or `danger`
1042
+ * for a destructive action.
1043
+ */
1044
+ variant?: 'danger' | 'info' | 'primary' | 'secondary' | 'success' | 'warning';
1031
1045
  }
1032
1046
  /** A text link to another page or resource: a native `<a>` in the link colour, with an optional underline. */
1033
1047
  export interface CLinkElement extends Omit<HTMLElement, 'href' | 'target' | 'underline'> {
@@ -2691,10 +2705,12 @@ export interface CTreeSelectElement extends Omit<HTMLElement, 'allowBranch' | 'c
2691
2705
  export interface CAppDefaults {
2692
2706
  'c-autocomplete'?: Partial<Pick<CAutocompleteElement, 'hideDetails' | 'hideMessage' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
2693
2707
  'c-breadcrumb'?: Partial<Pick<CBreadcrumbElement, 'texts'>>;
2708
+ 'c-button'?: Partial<Pick<CButtonElement, 'variant'>>;
2694
2709
  'c-color-picker'?: Partial<Pick<CColorPickerElement, 'alpha' | 'format' | 'hideDetails' | 'hideMessage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
2695
2710
  'c-data-table'?: Partial<Pick<CDataTableElement, 'texts'>>;
2696
2711
  'c-date-picker'?: Partial<Pick<CDatePickerElement, 'firstDayOfWeek' | 'format' | 'hideDetails' | 'hideMessage' | 'labelOnTop' | 'shadow' | 'showToday' | 'showWeekNumbers' | 'size' | 'texts'>>;
2697
2712
  'c-file-upload'?: Partial<Pick<CFileUploadElement, 'compact' | 'hideDetails' | 'hideMessage' | 'size' | 'texts'>>;
2713
+ 'c-icon-button'?: Partial<Pick<CIconButtonElement, 'variant'>>;
2698
2714
  'c-navigation-button'?: Partial<Pick<CNavigationButtonElement, 'texts'>>;
2699
2715
  'c-number-field'?: Partial<Pick<CNumberFieldElement, 'decimalSeparator' | 'decimals' | 'fixedDecimals' | 'groupSeparator' | 'hideDetails' | 'hideMessage' | 'labelOnTop' | 'shadow' | 'size' | 'step' | 'texts'>>;
2700
2716
  'c-pagination'?: Partial<Pick<CPaginationElement, 'texts'>>;
@@ -2707,10 +2723,12 @@ export interface CAppDefaults {
2707
2723
  export declare const DEFAULTABLE_PROPS: {
2708
2724
  readonly 'c-autocomplete': readonly ["hideDetails", "hideMessage", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
2709
2725
  readonly 'c-breadcrumb': readonly ["texts"];
2726
+ readonly 'c-button': readonly ["variant"];
2710
2727
  readonly 'c-color-picker': readonly ["alpha", "format", "hideDetails", "hideMessage", "labelOnTop", "shadow", "size", "texts"];
2711
2728
  readonly 'c-data-table': readonly ["texts"];
2712
2729
  readonly 'c-date-picker': readonly ["firstDayOfWeek", "format", "hideDetails", "hideMessage", "labelOnTop", "shadow", "showToday", "showWeekNumbers", "size", "texts"];
2713
2730
  readonly 'c-file-upload': readonly ["compact", "hideDetails", "hideMessage", "size", "texts"];
2731
+ readonly 'c-icon-button': readonly ["variant"];
2714
2732
  readonly 'c-navigation-button': readonly ["texts"];
2715
2733
  readonly 'c-number-field': readonly ["decimalSeparator", "decimals", "fixedDecimals", "groupSeparator", "hideDetails", "hideMessage", "labelOnTop", "shadow", "size", "step", "texts"];
2716
2734
  readonly 'c-pagination': readonly ["texts"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cscfi/csc-ui",
3
- "version": "4.0.0-rc.3",
3
+ "version": "4.0.0-rc.4",
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",