@cscfi/csc-ui 4.0.0-alpha.9 → 4.0.0-rc.2

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.
Files changed (203) hide show
  1. package/README.md +36 -2
  2. package/dist/csc-ui.js +22771 -14908
  3. package/dist/custom-elements.json +8943 -5632
  4. package/dist/docs/c-accordion/usage.md +60 -0
  5. package/dist/docs/c-accordion-item/usage.md +1 -0
  6. package/dist/docs/c-alert/usage.md +5 -5
  7. package/dist/docs/c-autocomplete/usage.md +156 -0
  8. package/dist/docs/c-badge/usage.md +50 -0
  9. package/dist/docs/c-breadcrumb/usage.md +104 -0
  10. package/dist/docs/c-breadcrumb-item/usage.md +1 -0
  11. package/dist/docs/c-button/usage.md +13 -0
  12. package/dist/docs/c-button-group/usage.md +16 -2
  13. package/dist/docs/c-card/usage.md +55 -0
  14. package/dist/docs/c-card-actions/usage.md +1 -0
  15. package/dist/docs/c-card-content/usage.md +1 -0
  16. package/dist/docs/c-card-title/usage.md +3 -0
  17. package/dist/docs/c-checkbox/usage.md +37 -5
  18. package/dist/docs/c-color-picker/usage.md +160 -0
  19. package/dist/docs/c-csc-logo/usage.md +25 -0
  20. package/dist/docs/c-data-table/usage.md +180 -0
  21. package/dist/docs/c-date-picker/usage.md +224 -0
  22. package/dist/docs/c-divider/usage.md +36 -0
  23. package/dist/docs/c-file-upload/usage.md +189 -0
  24. package/dist/docs/c-icon/usage.md +51 -0
  25. package/dist/docs/c-icon-button/usage.md +80 -0
  26. package/dist/docs/c-link/usage.md +45 -1
  27. package/dist/docs/c-list/usage.md +50 -0
  28. package/dist/docs/c-list-item/usage.md +1 -0
  29. package/dist/docs/c-list-item-title/usage.md +1 -0
  30. package/dist/docs/c-loader/usage.md +52 -1
  31. package/dist/docs/c-login-button/usage.md +1 -0
  32. package/dist/docs/c-login-buttons/usage.md +48 -0
  33. package/dist/docs/c-login-card/usage.md +45 -0
  34. package/dist/docs/c-login-card-actions/usage.md +1 -0
  35. package/dist/docs/c-login-card-content/usage.md +1 -0
  36. package/dist/docs/c-login-card-title/usage.md +3 -0
  37. package/dist/docs/c-main/usage.md +21 -1
  38. package/dist/docs/c-menu/usage.md +15 -0
  39. package/dist/docs/c-menu-item/usage.md +11 -0
  40. package/dist/docs/c-message/usage.md +56 -0
  41. package/dist/docs/c-modal/usage.md +18 -12
  42. package/dist/docs/c-navigation-button/usage.md +32 -0
  43. package/dist/docs/c-number-field/usage.md +114 -0
  44. package/dist/docs/c-option/usage.md +1 -0
  45. package/dist/docs/c-option-value/usage.md +1 -0
  46. package/dist/docs/c-otp-input/usage.md +95 -0
  47. package/dist/docs/c-page/usage.md +44 -0
  48. package/dist/docs/c-pagination/usage.md +69 -0
  49. package/dist/docs/c-popover/usage.md +1 -1
  50. package/dist/docs/c-progress-bar/usage.md +1 -1
  51. package/dist/docs/c-progress-circle/usage.md +1 -1
  52. package/dist/docs/c-radio/usage.md +9 -6
  53. package/dist/docs/c-radio-group/usage.md +5 -6
  54. package/dist/docs/c-select/usage.md +131 -0
  55. package/dist/docs/c-side-navigation/usage.md +70 -0
  56. package/dist/docs/c-side-navigation-item/usage.md +1 -0
  57. package/dist/docs/c-side-navigation-title/usage.md +1 -0
  58. package/dist/docs/c-slider/usage.md +78 -0
  59. package/dist/docs/c-spinner/usage.md +1 -1
  60. package/dist/docs/c-status/usage.md +46 -0
  61. package/dist/docs/c-step/usage.md +1 -0
  62. package/dist/docs/c-steps/usage.md +35 -0
  63. package/dist/docs/c-sub-navigation-item/usage.md +1 -0
  64. package/dist/docs/c-switch/usage.md +10 -3
  65. package/dist/docs/c-tab/usage.md +1 -0
  66. package/dist/docs/c-tab-buttons/usage.md +15 -0
  67. package/dist/docs/c-tab-item/usage.md +1 -0
  68. package/dist/docs/c-tab-items/usage.md +1 -0
  69. package/dist/docs/c-table/usage.md +1 -1
  70. package/dist/docs/c-tabs/usage.md +77 -0
  71. package/dist/docs/c-tag/usage.md +1 -0
  72. package/dist/docs/c-tags/usage.md +85 -0
  73. package/dist/docs/c-text-field/usage.md +109 -0
  74. package/dist/docs/c-time-picker/usage.md +170 -0
  75. package/dist/docs/c-toasts/usage.md +27 -3
  76. package/dist/docs/c-toolbar/usage.md +17 -0
  77. package/dist/docs/c-tree-select/usage.md +156 -0
  78. package/dist/floating-ui.dom-DvzxEaDJ.js +1292 -0
  79. package/dist/styles/css/tailwind-theme.css +2 -1
  80. package/dist/styles/css/tokens.css +609 -178
  81. package/dist/vscode.css-custom-data.json +556 -99
  82. package/dist/vscode.html-custom-data.json +1050 -480
  83. package/dist/web-types.json +3303 -1707
  84. package/dist-types/components/c-accordion/CAccordion.vue.d.ts +21 -25
  85. package/dist-types/components/c-accordion-item/CAccordionItem.vue.d.ts +13 -12
  86. package/dist-types/components/c-alert/CAlert.vue.d.ts +12 -17
  87. package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +124 -31
  88. package/dist-types/components/c-breadcrumb/CBreadcrumb.vue.d.ts +35 -0
  89. package/dist-types/components/c-breadcrumb/fit.d.ts +29 -0
  90. package/dist-types/components/c-breadcrumb-item/CBreadcrumbItem.vue.d.ts +31 -0
  91. package/dist-types/components/c-button/CButton.vue.d.ts +52 -63
  92. package/dist-types/components/c-button-group/CButtonGroup.vue.d.ts +16 -14
  93. package/dist-types/components/c-card/CCard.vue.d.ts +2 -3
  94. package/dist-types/components/c-card-actions/CCardActions.vue.d.ts +5 -7
  95. package/dist-types/components/c-card-title/CCardTitle.vue.d.ts +11 -1
  96. package/dist-types/components/c-checkbox/CCheckbox.vue.d.ts +33 -52
  97. package/dist-types/components/c-color-picker/CColorPicker.vue.d.ts +189 -0
  98. package/dist-types/components/c-color-picker/colors.d.ts +66 -0
  99. package/dist-types/components/c-csc-logo/CCscLogo.vue.d.ts +1 -3
  100. package/dist-types/components/c-data-table/CDataTable.vue.d.ts +75 -51
  101. package/dist-types/components/c-date-picker/CDatePicker.vue.d.ts +277 -0
  102. package/dist-types/components/c-date-picker/dates.d.ts +119 -0
  103. package/dist-types/components/c-dropdown/CDropdown.vue.d.ts +51 -8
  104. package/dist-types/components/c-file-upload/CFileUpload.vue.d.ts +204 -0
  105. package/dist-types/components/c-file-upload/files.d.ts +99 -0
  106. package/dist-types/components/c-icon-button/CIconButton.vue.d.ts +23 -36
  107. package/dist-types/components/c-input/CInput.vue.d.ts +21 -43
  108. package/dist-types/components/c-link/CLink.vue.d.ts +6 -14
  109. package/dist-types/components/c-list/CList.vue.d.ts +4 -6
  110. package/dist-types/components/c-list-item/CListItem.vue.d.ts +14 -19
  111. package/dist-types/components/c-list-item-title/CListItemTitle.vue.d.ts +3 -2
  112. package/dist-types/components/c-loader/CLoader.vue.d.ts +13 -29
  113. package/dist-types/components/c-login-button/CLoginButton.vue.d.ts +9 -9
  114. package/dist-types/components/c-login-card/CLoginCard.vue.d.ts +11 -16
  115. package/dist-types/components/c-login-card-actions/CLoginCardActions.vue.d.ts +5 -7
  116. package/dist-types/components/c-login-card-title/CLoginCardTitle.vue.d.ts +11 -1
  117. package/dist-types/components/c-main/CMain.vue.d.ts +12 -5
  118. package/dist-types/components/c-menu/CMenu.vue.d.ts +17 -16
  119. package/dist-types/components/c-menu-item/CMenuItem.vue.d.ts +27 -35
  120. package/dist-types/components/c-message/CMessage.vue.d.ts +5 -15
  121. package/dist-types/components/c-modal/CModal.vue.d.ts +3 -3
  122. package/dist-types/components/c-navigation-button/CNavigationButton.vue.d.ts +20 -1
  123. package/dist-types/components/c-number-field/CNumberField.vue.d.ts +169 -0
  124. package/dist-types/components/c-number-field/numbers.d.ts +58 -0
  125. package/dist-types/components/c-option/COption.vue.d.ts +1 -1
  126. package/dist-types/components/c-otp-input/COtpInput.vue.d.ts +16 -30
  127. package/dist-types/components/c-page/CPage.vue.d.ts +2 -3
  128. package/dist-types/components/c-pagination/CPagination.vue.d.ts +56 -26
  129. package/dist-types/components/c-popover/CPopover.vue.d.ts +11 -7
  130. package/dist-types/components/c-progress-bar/CProgressBar.vue.d.ts +10 -14
  131. package/dist-types/components/c-progress-circle/CProgressCircle.vue.d.ts +7 -7
  132. package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +11 -8
  133. package/dist-types/components/c-select/CSelect.vue.d.ts +119 -35
  134. package/dist-types/components/c-side-navigation/CSideNavigation.vue.d.ts +10 -18
  135. package/dist-types/components/c-side-navigation-item/CSideNavigationItem.vue.d.ts +22 -14
  136. package/dist-types/components/c-slider/CSlider.vue.d.ts +29 -73
  137. package/dist-types/components/c-spinner/CSpinner.vue.d.ts +4 -8
  138. package/dist-types/components/c-status/CStatus.vue.d.ts +8 -9
  139. package/dist-types/components/c-step/CStep.vue.d.ts +6 -4
  140. package/dist-types/components/c-steps/CSteps.vue.d.ts +3 -7
  141. package/dist-types/components/c-sub-navigation-item/CSubNavigationItem.vue.d.ts +23 -17
  142. package/dist-types/components/c-switch/CSwitch.vue.d.ts +17 -30
  143. package/dist-types/components/c-tab/CTab.vue.d.ts +11 -28
  144. package/dist-types/components/c-tab-buttons/CTabButtons.vue.d.ts +11 -13
  145. package/dist-types/components/c-tab-item/CTabItem.vue.d.ts +4 -5
  146. package/dist-types/components/c-tab-items/CTabItems.vue.d.ts +5 -4
  147. package/dist-types/components/c-table/CTable.vue.d.ts +7 -7
  148. package/dist-types/components/c-tabs/CTabs.vue.d.ts +13 -20
  149. package/dist-types/components/c-tag/CTag.vue.d.ts +22 -21
  150. package/dist-types/components/c-tags/CTags.vue.d.ts +9 -10
  151. package/dist-types/components/c-text-field/CTextField.vue.d.ts +74 -77
  152. package/dist-types/components/c-time-picker/CTimePicker.vue.d.ts +205 -0
  153. package/dist-types/components/c-time-picker/times.d.ts +82 -0
  154. package/dist-types/components/c-toast/CToast.vue.d.ts +3 -4
  155. package/dist-types/components/c-toast/swipe.d.ts +40 -0
  156. package/dist-types/components/c-toasts/CToasts.vue.d.ts +14 -16
  157. package/dist-types/components/c-toolbar/CToolbar.vue.d.ts +10 -1
  158. package/dist-types/components/c-tooltip/CTooltip.vue.d.ts +12 -8
  159. package/dist-types/components/c-tree-select/CTreeSelect.vue.d.ts +257 -0
  160. package/dist-types/index.d.ts +41 -32
  161. package/dist-types/registry.d.ts +9 -0
  162. package/dist-types/shared/FieldMessage.vue.d.ts +8 -5
  163. package/dist-types/shared/PanelHeadingRow.vue.d.ts +13 -0
  164. package/dist-types/shared/SelectionIndicator.vue.d.ts +21 -0
  165. package/dist-types/shared/TypedField.vue.d.ts +48 -0
  166. package/dist-types/shared/appDefaults.d.ts +75 -0
  167. package/dist-types/shared/defineElement.d.ts +1 -0
  168. package/dist-types/shared/inputMask.d.ts +106 -0
  169. package/dist-types/shared/lightDismiss.d.ts +35 -0
  170. package/dist-types/shared/modalStack.d.ts +4 -3
  171. package/dist-types/shared/navigationDrawer.d.ts +4 -0
  172. package/dist-types/shared/optionLabel.d.ts +18 -0
  173. package/dist-types/shared/pageLock.d.ts +26 -0
  174. package/dist-types/shared/peekCap.d.ts +35 -0
  175. package/dist-types/shared/popoverChain.d.ts +13 -10
  176. package/dist-types/shared/positionArea.d.ts +9 -4
  177. package/dist-types/shared/reducedMotion.d.ts +10 -0
  178. package/dist-types/shared/selectAll.d.ts +29 -0
  179. package/dist-types/shared/splitMatches.d.ts +18 -0
  180. package/dist-types/shared/useAnchoredPanel.d.ts +107 -0
  181. package/dist-types/shared/useControlAttrs.d.ts +8 -0
  182. package/dist-types/shared/useDesignatedTrigger.d.ts +5 -4
  183. package/dist-types/shared/useFallbackPosition.d.ts +71 -0
  184. package/dist-types/shared/useHostEmit.d.ts +38 -0
  185. package/dist-types/shared/useIdReferences.d.ts +39 -0
  186. package/dist-types/shared/useKeyboardModality.d.ts +7 -0
  187. package/dist-types/shared/useNarrowViewport.d.ts +19 -0
  188. package/dist-types/shared/useScrollStrip.d.ts +39 -0
  189. package/dist-types/shared/useStatusAnnouncer.d.ts +33 -0
  190. package/dist-types/shared/useTypedField.d.ts +108 -0
  191. package/dist-types/shared/valueEvents.d.ts +41 -0
  192. package/dist-types/shared/visualViewport.d.ts +51 -0
  193. package/dist-types/tag-name-map.d.ts +1572 -672
  194. package/dist-types/theme/applyTheme.d.ts +6 -6
  195. package/dist-types/theme/chart-data.d.ts +51 -0
  196. package/dist-types/theme/ramp.d.ts +38 -0
  197. package/dist-types/theme/themeMode.d.ts +51 -0
  198. package/dist-types/types.d.ts +7 -11
  199. package/package.json +32 -21
  200. package/dist/css-anchor-positioning-fn-RTxo68pt.js +0 -6447
  201. package/dist/docs/c-toast/usage.md +0 -1
  202. package/dist-types/shared/anchorPolyfill.d.ts +0 -24
  203. package/dist-types/shared/emitModelValue.d.ts +0 -37
@@ -0,0 +1,66 @@
1
+ /** One editable channel of the **channel editor**. */
2
+ export type ColorChannel = 'a' | 'b' | 'c' | 'g' | 'h' | 'l' | 'r';
3
+ /** The CSS syntax a colour is spelled in (CONTEXT.md "Notation"). */
4
+ export type ColorNotation = 'hex' | 'oklch' | 'rgb';
5
+ /** The panel's position: hue 0–360, saturation and brightness 0–100, unrounded. */
6
+ export interface Hsv {
7
+ h: number;
8
+ s: number;
9
+ v: number;
10
+ }
11
+ /** A colour as the picker holds it: 8-bit sRGB channels and 8-bit alpha. */
12
+ export interface Rgba {
13
+ a: number;
14
+ b: number;
15
+ g: number;
16
+ r: number;
17
+ }
18
+ /**
19
+ * Text as a colour — any CSS colour culori parses, or a hex without its `#`
20
+ * — gamut-mapped into sRGB; `null` when it names none. Without `alpha` the
21
+ * colour comes back opaque.
22
+ */
23
+ export declare const readColor: (text: string, alpha: boolean) => null | Rgba;
24
+ /** Whether a value is a string naming a colour. */
25
+ export declare const isColor: (value: unknown) => value is string;
26
+ export declare const sameColor: (a: null | Rgba, b: null | Rgba) => boolean;
27
+ /** The L, C and H texts of a colour's `oklch()` spelling. */
28
+ export interface OklchParts {
29
+ c: string;
30
+ h: string;
31
+ l: string;
32
+ }
33
+ /**
34
+ * The fewest decimals per channel — L and C up to four, H up to two — whose
35
+ * `oklch()` reads back to the same sRGB bytes (ADR-0069). A colour with no
36
+ * chroma spells its hue `0`.
37
+ */
38
+ export declare const oklchParts: (c: Rgba) => OklchParts;
39
+ /** A colour in a notation: `#rrggbb[aa]`, `rgb(R G B[ / a])`, `oklch(L C H[ / a])`. */
40
+ export declare const spell: (c: Rgba, notation: ColorNotation) => string;
41
+ /** A CSS colour to paint with: the hex spelling, alpha included. */
42
+ export declare const toCss: (c: Rgba) => string;
43
+ /** A panel position as bytes, with the given alpha byte. */
44
+ export declare const fromHsv: (hsv: Hsv, a: number) => Rgba;
45
+ /**
46
+ * The panel position of a colour. A position that already lands on the same
47
+ * bytes is kept, so a step the bytes cannot show leaves the thumb where it
48
+ * went; a grey keeps the previous hue, black the previous saturation too.
49
+ */
50
+ export declare const toHsv: (c: Rgba, prev?: Hsv | null) => Hsv;
51
+ /** Each channel's range and nudge step; Shift nudges ten steps. */
52
+ export declare const CHANNEL_RANGE: Record<ColorChannel, {
53
+ max: number;
54
+ min: number;
55
+ step: number;
56
+ }>;
57
+ /** The channels a notation's editor shows, alpha aside. */
58
+ export declare const NOTATION_CHANNELS: Record<Exclude<ColorNotation, 'hex'>, ColorChannel[]>;
59
+ /** A channel's text in the editor — what the value spells for it. */
60
+ export declare const channelText: (c: Rgba, key: ColorChannel) => string;
61
+ /** The colour with one channel set, clamped to its range (and mapped into sRGB). */
62
+ export declare const withChannel: (c: Rgba, key: ColorChannel, n: number) => Rgba;
63
+ /** A typed channel text read into the colour; `null` when it is no number. */
64
+ export declare const readChannel: (c: Rgba, key: ColorChannel, text: string) => null | Rgba;
65
+ /** The colour one nudge (or ten, `big`) away along a channel. */
66
+ export declare const nudgeChannel: (c: Rgba, key: ColorChannel, direction: -1 | 1, big?: boolean) => Rgba;
@@ -1,8 +1,6 @@
1
1
  interface CCscLogoProps {
2
2
  /**
3
- * Logo width in pixels
4
- *
5
- * @seeded from csc-ui — verify
3
+ * Logo width in pixels; the height follows the logo's proportions.
6
4
  */
7
5
  width?: number;
8
6
  }
@@ -87,7 +87,62 @@ export interface CDataTableFooterContext {
87
87
  /** The rows currently rendered (the visible page). */
88
88
  rows: CDataTableRow[];
89
89
  }
90
- export interface CDataTableProps {
90
+ /** A single data row — the consumer's own plain domain object. */
91
+ export type CDataTableRow = Record<string, unknown>;
92
+ /** Row selection mode. Unset means rows are not selectable. */
93
+ export type CDataTableSelectionMode = 'multiple' | 'single';
94
+ /** The table's atomic sorting state. */
95
+ export interface CDataTableSort {
96
+ /** `key` of the sorted column. */
97
+ column: string;
98
+ /** Direction the column is sorted in. */
99
+ direction: CDataTableSortDirection;
100
+ }
101
+ /** Sorting direction of a column. */
102
+ export type CDataTableSortDirection = 'asc' | 'desc';
103
+ /**
104
+ * UI texts, shallow-merged over the English defaults. Static labels are
105
+ * strings; count-interpolated ones are functions.
106
+ */
107
+ export interface CDataTableTexts {
108
+ /** Banner text when every (filtered) row is selected. */
109
+ allSelected?: (count: number) => string;
110
+ /** Label of the banner action clearing the whole selection. */
111
+ clearSelection?: string;
112
+ /**
113
+ * Accessible label of a row's expansion toggle: a function of the row's
114
+ * value in the first visible column, or one string for every row.
115
+ */
116
+ expandRow?: ((row: string) => string) | string;
117
+ /** Text shown when the table is empty while `loading`. */
118
+ loading?: string;
119
+ /** The pagination's next-page button; see `CPaginationTexts`. */
120
+ nextPage?: string;
121
+ /** Text shown when there are no rows (unless the `empty` slot is used). */
122
+ noData?: string;
123
+ /** The pagination's page buttons; see `CPaginationTexts`. */
124
+ page?: (page: number, pageCount: number) => string;
125
+ /** Banner text when the visible page is fully selected. */
126
+ pageSelected?: (count: number) => string;
127
+ /** The pagination's page-size menu label; see `CPaginationTexts`. */
128
+ pageSize?: string;
129
+ /** The pagination's landmark name; see `CPaginationTexts`. */
130
+ pagination?: string;
131
+ /** The pagination's previous-page button; see `CPaginationTexts`. */
132
+ previousPage?: string;
133
+ /** The pagination's range of items shown; see `CPaginationTexts`. */
134
+ range?: (start: number, end: number, count: number) => string;
135
+ /** Label of the banner action selecting all (filtered) rows. */
136
+ selectAllRows?: (count: number) => string;
137
+ /** Accessible label of the header select-all checkbox. */
138
+ selectPage?: string;
139
+ /**
140
+ * Accessible label of a row's selection checkbox: a function of the row's
141
+ * value in the first visible column, or one string for every row.
142
+ */
143
+ selectRow?: ((row: string) => string) | string;
144
+ }
145
+ interface CDataTableProps {
91
146
  /**
92
147
  * Move overflowing `expansion: 'auto'` columns into the expansion row
93
148
  * (rightmost first) instead of scrolling horizontally.
@@ -107,16 +162,9 @@ export interface CDataTableProps {
107
162
  /**
108
163
  * The server owns sorting, pagination and filtering: the table renders
109
164
  * `data` verbatim and only emits the state-change events. Requires
110
- * `itemCount` for the pager; disables the select-all banner and `filter`.
165
+ * `itemCount` for the pager; disables the select-all banner and `query`.
111
166
  */
112
167
  external?: boolean;
113
- /**
114
- * Filter rows client-side against this string (all columns). Ignored when
115
- * `external` is set.
116
- *
117
- * @freeform
118
- */
119
- filter?: string;
120
168
  /**
121
169
  * Return a stable id for a row. Falls back to the row's index — supply
122
170
  * this whenever selection/expansion is used with `external` data.
@@ -135,6 +183,13 @@ export interface CDataTableProps {
135
183
  pageSize?: number;
136
184
  /** Options for the pager's page-size menu. */
137
185
  pageSizes?: number[];
186
+ /**
187
+ * The query rows are filtered by client-side, matched against every column.
188
+ * Ignored when `external` is set.
189
+ *
190
+ * @freeform
191
+ */
192
+ query?: string;
138
193
  /** Ids of the selected rows (optionally controlled). */
139
194
  selected?: string[];
140
195
  /** Row selection mode. Unset means rows are not selectable. */
@@ -147,53 +202,22 @@ export interface CDataTableProps {
147
202
  stickyFooter?: boolean;
148
203
  /** Keep the header row visible while the table scrolls vertically. */
149
204
  stickyHeader?: boolean;
150
- /** UI text overrides (i18n), merged over the English defaults. */
205
+ /**
206
+ * UI text overrides (i18n), merged over the English defaults.
207
+ *
208
+ * @defaultable {}
209
+ */
151
210
  texts?: CDataTableTexts;
152
211
  }
153
- /** A single data row — the consumer's own plain domain object. */
154
- export type CDataTableRow = Record<string, unknown>;
155
- /** Row selection mode. Unset means rows are not selectable. */
156
- export type CDataTableSelectionMode = 'multiple' | 'single';
157
- /** The table's atomic sorting state. */
158
- export interface CDataTableSort {
159
- /** `key` of the sorted column. */
160
- column: string;
161
- /** Direction the column is sorted in. */
162
- direction: CDataTableSortDirection;
163
- }
164
- /** Sorting direction of a column. */
165
- export type CDataTableSortDirection = 'asc' | 'desc';
166
- /**
167
- * UI texts, shallow-merged over the English defaults. Static labels are
168
- * strings; count-interpolated ones are functions.
169
- */
170
- export interface CDataTableTexts {
171
- /** Banner text when every (filtered) row is selected. */
172
- allSelected?: (count: number) => string;
173
- /** Label of the banner action clearing the whole selection. */
174
- clearSelection?: string;
175
- /** Accessible label of a row's expansion toggle. */
176
- expandRow?: string;
177
- /** Text shown when the table is empty while `loading`. */
178
- loading?: string;
179
- /** Text shown when there are no rows (unless the `empty` slot is used). */
180
- noData?: string;
181
- /** Banner text when the visible page is fully selected. */
182
- pageSelected?: (count: number) => string;
183
- /** Label of the banner action selecting all (filtered) rows. */
184
- selectAllItems?: (count: number) => string;
185
- /** Accessible label of the header select-all checkbox. */
186
- selectPage?: string;
187
- /** Accessible label of a row's selection checkbox. */
188
- selectRow?: string;
189
- }
190
212
  declare const _default: typeof __VLS_export;
191
213
  export default _default;
192
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CDataTableProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CDataTableProps> & Readonly<{}>, {
214
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CDataTableProps, {
215
+ selectedRows: import("vue").ComputedRef<CDataTableRow[]>;
216
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CDataTableProps> & Readonly<{}>, {
193
217
  data: CDataTableRow[];
194
- filter: string;
195
- expanded: string[];
196
218
  sort: CDataTableSort | null;
219
+ expanded: string[];
220
+ texts: CDataTableTexts;
197
221
  external: boolean;
198
222
  loading: boolean;
199
223
  autohide: boolean;
@@ -204,12 +228,12 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CDataT
204
228
  page: number;
205
229
  pageSize: number;
206
230
  pageSizes: number[];
231
+ query: string;
207
232
  selected: string[];
208
233
  selection: CDataTableSelectionMode;
209
234
  singleExpansion: boolean;
210
235
  stickyFooter: boolean;
211
236
  stickyHeader: boolean;
212
- texts: CDataTableTexts;
213
237
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
214
238
  caption?: (props: {}) => any;
215
239
  } & {
@@ -0,0 +1,277 @@
1
+ import type { CFieldSize } from '../../types';
2
+ /** One entry of `disabled-dates`: an ISO date, or an inclusive `{ start, end }` span of them. */
3
+ export type CDatePickerDisabledDate = {
4
+ end: string;
5
+ start: string;
6
+ } | string;
7
+ /** A date range: ISO `YYYY-MM-DD` ends (`YYYY-MM` under `type="month"`), either of which may be `null` while only one is typed. */
8
+ export interface CDatePickerRange {
9
+ /** The last day of the range, inclusive. */
10
+ end: null | string;
11
+ /** The first day of the range. */
12
+ start: null | string;
13
+ }
14
+ /**
15
+ * The text committed from the field, as typed: a string, or both ends'
16
+ * texts under `range`.
17
+ */
18
+ export type CDatePickerText = {
19
+ end: string;
20
+ start: string;
21
+ } | string;
22
+ /**
23
+ * UI texts of `c-date-picker`, merged key by key over the names `Intl`
24
+ * gives for the page's `lang` and the English defaults. Weekday arrays are
25
+ * indexed like `Date.getDay()`: Sunday first.
26
+ */
27
+ export interface CDatePickerTexts {
28
+ /** Accessible name of the dialog when the field has no label. */
29
+ chooseDate?: string;
30
+ /** Accessible label of the clear button. */
31
+ clearSelection?: string;
32
+ /** Accessible label of the close button in the fullscreen panel (narrow viewports). */
33
+ closePanel?: string;
34
+ /** A day's accessible name in the grid; receives the ISO date. */
35
+ date?: (iso: string) => string;
36
+ /** Label of the Done button in the fullscreen panel (narrow viewports). */
37
+ done?: string;
38
+ /** Accessible name of the end input under `range`. */
39
+ end?: string;
40
+ /** Label of the end's month step under `type="month"` and `range`; also the end input's name there. */
41
+ endMonth?: string;
42
+ /** Label of the end's year step under `type="month"` and `range`. */
43
+ endYear?: string;
44
+ /** Label of the month step under `type="month"`. */
45
+ month?: string;
46
+ /** Twelve month names, January first. */
47
+ months?: string[];
48
+ /** Twelve short month names, January first — shown on the month button. */
49
+ monthsShort?: string[];
50
+ /** Accessible label of the next-month arrow. */
51
+ nextMonth?: string;
52
+ /** Accessible label of the next-year arrow. */
53
+ nextYear?: string;
54
+ /** Accessible label of the calendar button. */
55
+ openCalendar?: string;
56
+ /** Announcement once a range's first day is picked; receives that day's name. */
57
+ pendingStart?: (date: string) => string;
58
+ /** Accessible label of the previous-month arrow. */
59
+ previousMonth?: string;
60
+ /** Accessible label of the previous-year arrow. */
61
+ previousYear?: string;
62
+ /** Accessible label of the month button and the month list. */
63
+ selectMonth?: string;
64
+ /** Accessible label of the year button and the year list. */
65
+ selectYear?: string;
66
+ /** Accessible name of the start input under `range`. */
67
+ start?: string;
68
+ /** Label of the start's month step under `type="month"` and `range`; also the start input's name there. */
69
+ startMonth?: string;
70
+ /** Label of the start's year step under `type="month"` and `range`. */
71
+ startYear?: string;
72
+ /** Label of the Today button under `type="month"`. */
73
+ thisMonth?: string;
74
+ /** Label of the Today button (`show-today`). */
75
+ today?: string;
76
+ /** Appended to the accessible name of a day that cannot be picked. */
77
+ unavailable?: string;
78
+ /** Seven weekday names, Sunday first. */
79
+ weekdays?: string[];
80
+ /** Seven short weekday names, Sunday first — the grid's column heads. */
81
+ weekdaysShort?: string[];
82
+ /** Accessible name of the week-number column. */
83
+ weekNumber?: string;
84
+ /** Label of the year step under `type="month"`. */
85
+ year?: string;
86
+ }
87
+ /** What `c-date-picker` picks: a calendar date, or a year and a month (ADR-0063). */
88
+ export type CDatePickerType = 'date' | 'month';
89
+ /**
90
+ * Value of `c-date-picker`: an ISO `YYYY-MM-DD` string (`YYYY-MM` under
91
+ * `type="month"`), a {@link CDatePickerRange} under `range`, or `null` when
92
+ * empty.
93
+ */
94
+ export type CDatePickerValue = CDatePickerRange | null | string;
95
+ /** A day of the week numbered like `Date.getDay()`: 0 = Sunday … 6 = Saturday. */
96
+ export type CDatePickerWeekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
97
+ interface CDatePickerProps {
98
+ /**
99
+ * Make the value clearable
100
+ */
101
+ clearable?: boolean;
102
+ /**
103
+ * Disable the field
104
+ */
105
+ disabled?: boolean;
106
+ /**
107
+ * Dates that cannot be picked: ISO dates and inclusive `{ start, end }`
108
+ * spans. Arrays have no attribute form — bind as a DOM property
109
+ */
110
+ disabledDates?: CDatePickerDisabledDate[];
111
+ /**
112
+ * Error message shown in place of the hint while the field is invalid
113
+ *
114
+ * @freeform
115
+ */
116
+ errorMessage?: string;
117
+ /**
118
+ * First day of the week in the calendar, numbered like `Date.getDay()`:
119
+ * 0 = Sunday, 1 = Monday … 6 = Saturday
120
+ *
121
+ * @defaultable 1
122
+ */
123
+ firstDayOfWeek?: CDatePickerWeekday;
124
+ /**
125
+ * How dates are shown and read from typing: a pattern of the tokens `d`,
126
+ * `dd`, `M`, `MM` and `yyyy` with any separators, e.g. `yyyy-MM-dd`
127
+ *
128
+ * @defaultable 'dd.MM.yyyy'
129
+ * @freeform
130
+ */
131
+ format?: string;
132
+ /**
133
+ * Hide the hint and error messages
134
+ *
135
+ * @defaultable false
136
+ */
137
+ hideDetails?: boolean;
138
+ /**
139
+ * Hint text for the field
140
+ *
141
+ * @freeform
142
+ */
143
+ hint?: string;
144
+ /**
145
+ * Show the control as invalid: its `error-message`, when set, replaces the
146
+ * hint, and the control is marked `aria-invalid`.
147
+ */
148
+ invalid?: boolean;
149
+ /**
150
+ * Predicate for dates that cannot be picked (weekends, say); receives an
151
+ * ISO date. Functions have no attribute form — bind as a DOM property
152
+ */
153
+ isDateDisabled?: (iso: string) => boolean;
154
+ /**
155
+ * Element label
156
+ *
157
+ * @freeform
158
+ */
159
+ label?: string;
160
+ /**
161
+ * Label on top of the field
162
+ *
163
+ * @defaultable false
164
+ */
165
+ labelOnTop?: boolean;
166
+ /**
167
+ * The latest date that can be picked or typed, as an ISO date; also bounds
168
+ * the calendar's navigation
169
+ *
170
+ * @freeform
171
+ */
172
+ max?: string;
173
+ /**
174
+ * The earliest date that can be picked or typed, as an ISO date; also
175
+ * bounds the calendar's navigation
176
+ *
177
+ * @freeform
178
+ */
179
+ min?: string;
180
+ /**
181
+ * Input field name
182
+ *
183
+ * @freeform
184
+ */
185
+ name?: string;
186
+ /**
187
+ * Placeholder of the input; the `format` pattern when empty
188
+ *
189
+ * @freeform
190
+ */
191
+ placeholder?: string;
192
+ /**
193
+ * Pick a range: the value becomes `{ start, end }` and the field holds two
194
+ * inputs
195
+ */
196
+ range?: boolean;
197
+ /**
198
+ * Set the field as required
199
+ */
200
+ required?: boolean;
201
+ /**
202
+ * Shadow variant
203
+ *
204
+ * @defaultable false
205
+ */
206
+ shadow?: boolean;
207
+ /**
208
+ * Show a Today button under the calendar that picks today ("This month"
209
+ * under `type="month"`)
210
+ *
211
+ * @defaultable false
212
+ */
213
+ showToday?: boolean;
214
+ /**
215
+ * Show ISO 8601 week numbers beside the calendar rows (meaningful with a
216
+ * Monday week start)
217
+ *
218
+ * @defaultable false
219
+ */
220
+ showWeekNumbers?: boolean;
221
+ /**
222
+ * Field height: the 52px default (the shared control height) or the 36px `small` box
223
+ *
224
+ * @defaultable 'default'
225
+ */
226
+ size?: CFieldSize;
227
+ /**
228
+ * UI text overrides (i18n), merged over the names `Intl` gives for the
229
+ * page's `lang` and the English defaults. Objects have no attribute form —
230
+ * bind as a DOM property
231
+ *
232
+ * @defaultable {}
233
+ */
234
+ texts?: CDatePickerTexts;
235
+ /**
236
+ * What the field picks: a calendar date, or a year and a month
237
+ * (`'YYYY-MM'`)
238
+ */
239
+ type?: CDatePickerType;
240
+ /**
241
+ * The date as an ISO `YYYY-MM-DD` string (an ISO `YYYY-MM` month under
242
+ * `type="month"`), or `{ start, end }` under `range`; `null` when empty
243
+ */
244
+ value?: CDatePickerValue;
245
+ }
246
+ declare const _default: typeof __VLS_export;
247
+ export default _default;
248
+ declare const __VLS_export: import("vue").DefineComponent<CDatePickerProps, {
249
+ badInput: import("vue").ComputedRef<boolean>;
250
+ focus: (options?: FocusOptions) => void;
251
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CDatePickerProps> & Readonly<{}>, {
252
+ label: string;
253
+ invalid: boolean;
254
+ name: string;
255
+ value: CDatePickerValue;
256
+ type: CDatePickerType;
257
+ size: CFieldSize;
258
+ texts: CDatePickerTexts;
259
+ hideDetails: boolean;
260
+ labelOnTop: boolean;
261
+ shadow: boolean;
262
+ format: string;
263
+ firstDayOfWeek: CDatePickerWeekday;
264
+ showToday: boolean;
265
+ showWeekNumbers: boolean;
266
+ clearable: boolean;
267
+ disabled: boolean;
268
+ errorMessage: string;
269
+ hint: string;
270
+ placeholder: string;
271
+ required: boolean;
272
+ disabledDates: CDatePickerDisabledDate[];
273
+ isDateDisabled: (iso: string) => boolean;
274
+ max: string;
275
+ min: string;
276
+ range: boolean;
277
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Calendar-date helpers for `c-date-picker` (ADR-0057). Pure functions over
3
+ * ISO `YYYY-MM-DD` strings: no local `Date` is ever constructed, so no
4
+ * timezone can shift a day. Arithmetic goes through `Date.UTC`.
5
+ */
6
+ import type { MaskSlot } from '../../shared/inputMask';
7
+ import type { CDatePickerDisabledDate } from './CDatePicker.vue';
8
+ /** A calendar date split into its parts; `m` is 1–12. */
9
+ export interface CDatePickerYmd {
10
+ d: number;
11
+ m: number;
12
+ y: number;
13
+ }
14
+ export declare const daysInMonth: (y: number, m: number) => number;
15
+ export declare const toIso: ({ d, m, y }: CDatePickerYmd) => string;
16
+ /** The parts of a well-formed, real ISO calendar date; `null` otherwise. */
17
+ export declare const fromIso: (iso: unknown) => CDatePickerYmd | null;
18
+ export declare const isIso: (iso: unknown) => iso is string;
19
+ /** 0 = Sunday … 6 = Saturday, like `Date.getDay()`. */
20
+ export declare const dayOfWeek: (iso: string) => number;
21
+ export declare const addDays: (iso: string, days: number) => string;
22
+ /** Move by whole months, clamping the day to the target month's length. */
23
+ export declare const addMonths: (iso: string, months: number) => string;
24
+ /** The ISO 8601 week number (weeks start on Monday; week 1 holds the year's first Thursday). */
25
+ export declare const isoWeek: (iso: string) => number;
26
+ /**
27
+ * The ISO week number of one grid row: the week of the row's Thursday,
28
+ * which holds most of the row's days under any week start. It depends on
29
+ * the row's dates alone, so a week split across two months carries the
30
+ * same number in both. `''` for a row with no dates.
31
+ */
32
+ export declare const rowWeek: (row: readonly (null | string)[], firstDayOfWeek: number) => "" | number;
33
+ /** `YYYY-MM` of a date. */
34
+ export declare const monthOf: (iso: string) => string;
35
+ /** The first day of the month `YYYY-MM`. */
36
+ export declare const firstOfMonth: (month: string) => string;
37
+ /** Today in the browser's local calendar, as ISO. */
38
+ export declare const todayIso: () => string;
39
+ /**
40
+ * The weeks of a month as rows of seven days starting on `firstDayOfWeek`
41
+ * (0 = Sunday). Days of the neighbouring months are `null`. As many rows as
42
+ * the month spans — four to six — so the calendar is as tall as its month.
43
+ */
44
+ export declare const monthMatrix: (month: string, firstDayOfWeek: number) => (null | string)[][];
45
+ /**
46
+ * Whether `pattern` is usable: exactly one day, one month and one year
47
+ * token. Anything else falls back to the built-in pattern.
48
+ */
49
+ export declare const isValidPattern: (pattern: string) => boolean;
50
+ export declare const formatDate: (iso: string, pattern: string) => string;
51
+ /**
52
+ * Read typed text against a pattern (ADR-0057). Lenient: a day or month
53
+ * takes one or two digits whatever its token, and any run of `.`, `/`, `-`
54
+ * or spaces separates the fields; the year must have four digits. Returns
55
+ * the ISO date, or `null` when the text names no real date.
56
+ */
57
+ export declare const parseDate: (text: string, pattern: string) => null | string;
58
+ /**
59
+ * The input mask typing follows under a pattern (ADR-0059): a day or month
60
+ * takes one or two digits whatever its token, closing early on a typed
61
+ * separator or on a first digit no two-digit value starts with (a day 4–9,
62
+ * a month 2–9); the year takes four. A separator of the pattern also accepts
63
+ * any of `. / - space` typed in its place and shows as the pattern's own.
64
+ */
65
+ export declare const compileDateMask: (pattern: string) => MaskSlot[];
66
+ /** A well-formed ISO `YYYY-MM` month. */
67
+ export declare const isIsoMonth: (month: unknown) => month is string;
68
+ /** The month an ISO month or ISO date names; `null` for anything else. */
69
+ export declare const toMonth: (value: unknown) => null | string;
70
+ /** Whether `pattern` is a usable month pattern: one month and one year token, no day. */
71
+ export declare const isValidMonthPattern: (pattern: string) => boolean;
72
+ /**
73
+ * The month pattern of a date pattern: the day token goes, with the
74
+ * separator after it — or before it when the day comes last (`dd.MM.yyyy` →
75
+ * `MM.yyyy`, `yyyy-MM-dd` → `yyyy-MM`). A pattern that is already a month
76
+ * pattern is kept; anything else falls back to `MM.yyyy`.
77
+ */
78
+ export declare const monthPattern: (pattern: string) => string;
79
+ export declare const formatMonth: (month: string, pattern: string) => string;
80
+ /** Read typed text against a month pattern, as leniently as `parseDate`. */
81
+ export declare const parseMonth: (text: string, pattern: string) => null | string;
82
+ export interface CDatePickerDisabling {
83
+ isDateDisabled?: (iso: string) => boolean;
84
+ list?: readonly CDatePickerDisabledDate[];
85
+ max?: null | string;
86
+ min?: null | string;
87
+ }
88
+ /** Outside `min` / `max`: unreachable, not merely unpickable. */
89
+ export declare const isOutOfRange: (iso: string, { max, min }: CDatePickerDisabling) => boolean;
90
+ /** Disabled when `min`/`max`, the list or the predicate says so (ADR-0057). */
91
+ export declare const isDisabledDate: (iso: string, rules: CDatePickerDisabling) => boolean;
92
+ /** Outside `min` / `max` read by their months (ADR-0063). */
93
+ export declare const isMonthOutOfRange: (month: string, { max, min }: CDatePickerDisabling) => boolean;
94
+ /**
95
+ * A month is disabled when it is out of range, or when the list and the
96
+ * predicate rule out every one of its days (ADR-0063). Stops at the first
97
+ * enabled day, so a sparse predicate costs one call a month.
98
+ */
99
+ export declare const isDisabledMonth: (month: string, rules: CDatePickerDisabling) => boolean;
100
+ /**
101
+ * Month mode's month step (ADR-0063): month `m` (1–12) is out when it is
102
+ * disabled in every year of `[from, to]`, so no pick leads to an empty year
103
+ * step. Stops at the first year that takes it.
104
+ */
105
+ export declare const isMonthDisabledEverywhere: (m: number, [from, to]: readonly number[], rules: CDatePickerDisabling) => boolean;
106
+ /** The name texts `Intl` can supply for a language. */
107
+ export interface CDatePickerIntlNames {
108
+ date: (iso: string) => string;
109
+ months: string[];
110
+ monthsShort: string[];
111
+ weekdays: string[];
112
+ weekdaysShort: string[];
113
+ }
114
+ /**
115
+ * Month and weekday names for `lang` from `Intl.DateTimeFormat` — the
116
+ * fallback under `texts` (ADR-0057). Weekday arrays are indexed like
117
+ * `Date.getDay()` (0 = Sunday). `null` without a language or without `Intl`.
118
+ */
119
+ export declare const intlNames: (lang: string) => CDatePickerIntlNames | null;