@commmerce/ui 1.0.0-rc.4 → 1.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.
Files changed (103) hide show
  1. package/LICENSE.md +152 -17
  2. package/README.md +2 -3
  3. package/THIRD_PARTY_NOTICES.txt +175 -0
  4. package/dist/base.d.ts +5 -0
  5. package/dist/base.js +10 -0
  6. package/dist/calendar.d.ts +95 -0
  7. package/dist/calendar.js +280 -0
  8. package/dist/cdn.js +721 -477
  9. package/dist/components/accordion.js +2 -2
  10. package/dist/components/action-bar.d.ts +12 -2
  11. package/dist/components/action-bar.js +10 -5
  12. package/dist/components/action-menu.d.ts +17 -4
  13. package/dist/components/action-menu.js +8 -5
  14. package/dist/components/app-card.d.ts +24 -2
  15. package/dist/components/app-card.js +25 -10
  16. package/dist/components/banner.d.ts +2 -2
  17. package/dist/components/banner.js +4 -3
  18. package/dist/components/bottom-navigation.d.ts +16 -4
  19. package/dist/components/bottom-navigation.js +10 -7
  20. package/dist/components/bottom-sheet.d.ts +4 -1
  21. package/dist/components/bottom-sheet.js +2 -2
  22. package/dist/components/checkbox.d.ts +12 -2
  23. package/dist/components/checkbox.js +7 -2
  24. package/dist/components/combobox.d.ts +186 -0
  25. package/dist/components/combobox.js +521 -0
  26. package/dist/components/comment.d.ts +27 -9
  27. package/dist/components/comment.js +14 -13
  28. package/dist/components/data-table.d.ts +14 -2
  29. package/dist/components/data-table.js +31 -10
  30. package/dist/components/date-picker.d.ts +179 -0
  31. package/dist/components/date-picker.js +336 -0
  32. package/dist/components/date-range-picker.d.ts +251 -0
  33. package/dist/components/date-range-picker.js +484 -0
  34. package/dist/components/file-upload.d.ts +30 -4
  35. package/dist/components/file-upload.js +37 -17
  36. package/dist/components/filter-panel.d.ts +29 -6
  37. package/dist/components/filter-panel.js +16 -14
  38. package/dist/components/flash-offer-bar.d.ts +18 -4
  39. package/dist/components/flash-offer-bar.js +13 -8
  40. package/dist/components/header-bar.d.ts +20 -4
  41. package/dist/components/header-bar.js +20 -13
  42. package/dist/components/icon.d.ts +7 -0
  43. package/dist/components/icon.js +9 -1
  44. package/dist/components/link-tabs.d.ts +16 -4
  45. package/dist/components/link-tabs.js +10 -7
  46. package/dist/components/mobile-menu.d.ts +19 -4
  47. package/dist/components/mobile-menu.js +16 -10
  48. package/dist/components/modal.d.ts +4 -1
  49. package/dist/components/nested-list.d.ts +22 -3
  50. package/dist/components/nested-list.js +25 -12
  51. package/dist/components/notification-panel.d.ts +26 -5
  52. package/dist/components/notification-panel.js +17 -11
  53. package/dist/components/option-group.d.ts +12 -2
  54. package/dist/components/option-group.js +13 -7
  55. package/dist/components/page-header.d.ts +18 -2
  56. package/dist/components/page-header.js +23 -10
  57. package/dist/components/pagination.d.ts +27 -4
  58. package/dist/components/pagination.js +28 -16
  59. package/dist/components/progress-bar.d.ts +12 -2
  60. package/dist/components/progress-bar.js +9 -4
  61. package/dist/components/radio.d.ts +12 -1
  62. package/dist/components/radio.js +12 -6
  63. package/dist/components/report-tile.d.ts +12 -1
  64. package/dist/components/report-tile.js +9 -4
  65. package/dist/components/resource-list.d.ts +36 -5
  66. package/dist/components/resource-list.js +50 -23
  67. package/dist/components/save-bar.d.ts +23 -6
  68. package/dist/components/save-bar.js +14 -12
  69. package/dist/components/search.d.ts +28 -7
  70. package/dist/components/search.js +18 -13
  71. package/dist/components/select.d.ts +12 -2
  72. package/dist/components/select.js +9 -4
  73. package/dist/components/side-navigation.d.ts +16 -4
  74. package/dist/components/side-navigation.js +16 -12
  75. package/dist/components/side-panel.d.ts +5 -2
  76. package/dist/components/side-panel.js +5 -3
  77. package/dist/components/skeleton-display.d.ts +6 -4
  78. package/dist/components/skeleton-display.js +4 -5
  79. package/dist/components/smart-tip.d.ts +25 -6
  80. package/dist/components/smart-tip.js +18 -12
  81. package/dist/components/spinner.d.ts +4 -3
  82. package/dist/components/spinner.js +5 -6
  83. package/dist/components/status-tabs.d.ts +12 -2
  84. package/dist/components/status-tabs.js +14 -8
  85. package/dist/components/table-header.d.ts +15 -2
  86. package/dist/components/table-header.js +13 -5
  87. package/dist/components/tag.d.ts +12 -2
  88. package/dist/components/tag.js +9 -4
  89. package/dist/components/text-field.d.ts +12 -2
  90. package/dist/components/text-field.js +9 -4
  91. package/dist/components/thumbnail.d.ts +12 -2
  92. package/dist/components/thumbnail.js +8 -3
  93. package/dist/components/toast.d.ts +14 -3
  94. package/dist/components/toast.js +20 -9
  95. package/dist/components/toggle.js +2 -0
  96. package/dist/custom-elements.json +16477 -6434
  97. package/dist/index.d.ts +7 -1
  98. package/dist/index.js +5 -1
  99. package/dist/localize.d.ts +130 -0
  100. package/dist/localize.js +232 -0
  101. package/dist/overlay.d.ts +8 -4
  102. package/dist/overlay.js +9 -12
  103. package/package.json +5 -4
@@ -0,0 +1,251 @@
1
+ import { type PropertyValues } from 'lit';
2
+ import { CmLocalizedElement } from '../localize.js';
3
+ import './icon.js';
4
+ declare const strings: {
5
+ /** Calendar button while the range is not set. */
6
+ choose: string;
7
+ chooseFor: string;
8
+ /** Calendar button once set. `{start}` and `{end}` are full dates. */
9
+ change: string;
10
+ changeFor: string;
11
+ /** Accessible name of the calendar popup. */
12
+ dialog: string;
13
+ previousMonth: string;
14
+ nextMonth: string;
15
+ /** Accessible names of the two inputs. */
16
+ start: string;
17
+ end: string;
18
+ /** Accessible name of the list of preset ranges. */
19
+ presets: string;
20
+ /** Line under the calendar while picking. */
21
+ chooseStart: string;
22
+ chooseEnd: string;
23
+ /** Added to the start and end days' accessible names. */
24
+ startNote: string;
25
+ endNote: string;
26
+ patternDay: string;
27
+ patternMonth: string;
28
+ patternYear: string;
29
+ badStart: string;
30
+ badEnd: string;
31
+ required: string;
32
+ endBeforeStart: string;
33
+ rangeUnderflow: string;
34
+ rangeOverflow: string;
35
+ unavailable: string;
36
+ /** Preset labels. */
37
+ today: string;
38
+ yesterday: string;
39
+ last7Days: string;
40
+ last30Days: string;
41
+ last90Days: string;
42
+ thisMonth: string;
43
+ lastMonth: string;
44
+ };
45
+ declare module '../localize.js' {
46
+ interface CmStrings {
47
+ dateRangePicker: typeof strings;
48
+ }
49
+ }
50
+ /** Built-in preset ranges. Each ends today except `yesterday` and `last-month`. */
51
+ export type DateRangePresetKey = 'today' | 'yesterday' | 'last-7-days' | 'last-30-days' | 'last-90-days' | 'this-month' | 'last-month';
52
+ /** A custom preset: a label and ISO start and end dates. */
53
+ export interface DateRangePreset {
54
+ label: string;
55
+ start: string;
56
+ end: string;
57
+ }
58
+ /**
59
+ * Resolves a preset key or object to a label and ISO dates (relative to today). Unknown keys return null.
60
+ * `label` translates a key's label (it gets the key in camelCase, e.g. `last7Days`); English otherwise.
61
+ */
62
+ export declare function resolvePreset(p: DateRangePresetKey | DateRangePreset, today?: Date, label?: (key: string) => string): DateRangePreset | null;
63
+ /**
64
+ * Date range field for report and order filters: type a start and end date or pick them in a calendar, or choose
65
+ * a preset range such as "Last 7 days". The calendar is the same APG date picker grid as `cm-date-picker`: the first
66
+ * date picked is the start, the second the end. Participates in native forms: submits `<name>-start` and
67
+ * `<name>-end` (or `start-name` / `end-name`) as ISO `yyyy-mm-dd`.
68
+ * @element cm-date-range-picker
69
+ * @fires change - When the range changes: both dates picked, a preset chosen, or a typed date committed.
70
+ * @fires input - Same moment as `change`.
71
+ * @csspart box - The bordered box around the two inputs and the calendar button.
72
+ * @csspart calendar - The month grid.
73
+ * @csspart presets - The list of preset ranges.
74
+ */
75
+ export declare class CmDateRangePicker extends CmLocalizedElement {
76
+ #private;
77
+ static formAssociated: boolean;
78
+ static shadowRootOptions: {
79
+ delegatesFocus: boolean;
80
+ mode: ShadowRootMode;
81
+ serializable?: boolean;
82
+ slotAssignment?: SlotAssignmentMode;
83
+ };
84
+ static properties: {
85
+ label: {};
86
+ helpText: {
87
+ attribute: string;
88
+ };
89
+ error: {
90
+ reflect: boolean;
91
+ };
92
+ name: {
93
+ reflect: boolean;
94
+ };
95
+ startName: {
96
+ attribute: string;
97
+ };
98
+ endName: {
99
+ attribute: string;
100
+ };
101
+ start: {};
102
+ end: {};
103
+ min: {};
104
+ max: {};
105
+ locale: {
106
+ noAccessor: boolean;
107
+ };
108
+ firstDayOfWeek: {
109
+ type: NumberConstructor;
110
+ attribute: string;
111
+ };
112
+ disabledDates: {
113
+ attribute: string;
114
+ converter: {
115
+ fromAttribute: (v: string | null) => string[];
116
+ toAttribute: (v: unknown) => unknown;
117
+ };
118
+ };
119
+ isDateDisabled: {
120
+ attribute: boolean;
121
+ };
122
+ presets: {
123
+ converter: {
124
+ fromAttribute: (v: string | null) => string[];
125
+ toAttribute: (v: unknown) => unknown;
126
+ };
127
+ };
128
+ startLabel: {
129
+ attribute: string;
130
+ string: string;
131
+ };
132
+ endLabel: {
133
+ attribute: string;
134
+ string: string;
135
+ };
136
+ required: {
137
+ type: BooleanConstructor;
138
+ reflect: boolean;
139
+ };
140
+ disabled: {
141
+ type: BooleanConstructor;
142
+ reflect: boolean;
143
+ };
144
+ open: {
145
+ type: BooleanConstructor;
146
+ reflect: boolean;
147
+ };
148
+ size: {
149
+ reflect: boolean;
150
+ };
151
+ _startText: {
152
+ state: boolean;
153
+ };
154
+ _endText: {
155
+ state: boolean;
156
+ };
157
+ _focus: {
158
+ state: boolean;
159
+ };
160
+ _draftStart: {
161
+ state: boolean;
162
+ };
163
+ _draftEnd: {
164
+ state: boolean;
165
+ };
166
+ _hover: {
167
+ state: boolean;
168
+ };
169
+ };
170
+ /** Visible label above the box, e.g. "Order date". Required for accessibility unless the element has an aria-label. */
171
+ label: string;
172
+ /** One sentence under the box in text-tertiary. */
173
+ helpText: string;
174
+ /** Error message; turns the border critical and sets aria-invalid. */
175
+ error: string;
176
+ /** Form field name. The range is submitted as `<name>-start` and `<name>-end` unless `start-name` / `end-name` are set. */
177
+ name: string;
178
+ /** Form entry name for the start date (instead of `<name>-start`). `name` must still be set for the form to include the field. */
179
+ startName: string;
180
+ /** Form entry name for the end date (instead of `<name>-end`). */
181
+ endName: string;
182
+ /** Start of the range, ISO `yyyy-mm-dd`; empty when not set. */
183
+ start: string;
184
+ /** End of the range, ISO `yyyy-mm-dd`; empty when not set. */
185
+ end: string;
186
+ /** Earliest date that can be chosen, ISO `yyyy-mm-dd`. */
187
+ min: string;
188
+ /** Latest date that can be chosen, ISO `yyyy-mm-dd`. For reports, usually today. */
189
+ max: string;
190
+ /**
191
+ * BCP 47 language for month and weekday names and the typed date order. Empty: the same language as every other
192
+ * component (`configure({ locale })`, else the nearest `lang` attribute, else the browser's).
193
+ */
194
+ get locale(): string;
195
+ set locale(v: string);
196
+ /** First column of the calendar: 0 = Sunday, 1 = Monday … 6 = Saturday. Defaults to the locale's custom where known, else Sunday. */
197
+ firstDayOfWeek?: number;
198
+ /** Dates that can't be chosen, as ISO strings. In HTML, a comma- or space-separated list. */
199
+ disabledDates: string[];
200
+ /** Function that returns true for dates that can't be chosen. Property only. */
201
+ isDateDisabled?: (date: string) => boolean;
202
+ /**
203
+ * Preset ranges shown beside the calendar: keys (`today`, `yesterday`, `last-7-days`, `last-30-days`, `last-90-days`,
204
+ * `this-month`, `last-month`) or `{ label, start, end }` objects. In HTML, a space-separated list of keys.
205
+ */
206
+ presets: Array<DateRangePresetKey | DateRangePreset>;
207
+ /** Accessible name of the start input. Default: the built-in string `start` ("Start date"). */
208
+ startLabel: string;
209
+ /** Accessible name of the end input. Default: the built-in string `end` ("End date"). */
210
+ endLabel: string;
211
+ /** The form will not submit until both dates are set. */
212
+ required: boolean;
213
+ /** Blocks interaction. Also set by a disabled `<fieldset>`. */
214
+ disabled: boolean;
215
+ /** Whether the calendar is showing. */
216
+ open: boolean;
217
+ /** `small`: 12px label, 14px values (filter panels). */
218
+ size: 'default' | 'small';
219
+ _startText: string;
220
+ _endText: string;
221
+ _focus: Date;
222
+ _draftStart: string;
223
+ _draftEnd: string;
224
+ _hover: Date | null;
225
+ static styles: import("lit").CSSResult[];
226
+ connectedCallback(): void;
227
+ disconnectedCallback(): void;
228
+ get form(): HTMLFormElement | null;
229
+ get validity(): ValidityState;
230
+ get validationMessage(): string;
231
+ checkValidity(): boolean;
232
+ reportValidity(): boolean;
233
+ formResetCallback(): void;
234
+ formDisabledCallback(d: boolean): void;
235
+ formStateRestoreCallback(state: string): void;
236
+ /** Opens the calendar. */
237
+ show(): void;
238
+ /** Closes the calendar without changing the range. */
239
+ close(): void;
240
+ /** True when a date can't be chosen (outside min/max, in `disabledDates` or refused by `isDateDisabled`). */
241
+ isUnavailable(iso: string): boolean;
242
+ willUpdate(changed: PropertyValues): void;
243
+ updated(): void;
244
+ render(): import("lit-html").TemplateResult<1>;
245
+ }
246
+ declare global {
247
+ interface HTMLElementTagNameMap {
248
+ 'cm-date-range-picker': CmDateRangePicker;
249
+ }
250
+ }
251
+ export {};