carbon-react 103.0.0 → 104.1.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.
- package/lib/components/badge/badge.style.d.ts +1 -1
- package/lib/components/badge/badge.style.js +3 -9
- package/lib/components/date/__internal__/date-formats/index.d.ts +8 -0
- package/lib/components/date/__internal__/date-formats/index.js +47 -0
- package/lib/components/date/__internal__/date-picker/date-picker.component.d.ts +3 -0
- package/lib/components/date/__internal__/date-picker/date-picker.component.js +154 -0
- package/lib/components/date/__internal__/date-picker/date-picker.d.ts +25 -0
- package/lib/components/date/{day-picker.style.d.ts → __internal__/date-picker/day-picker.style.d.ts} +0 -0
- package/lib/components/date/{day-picker.style.js → __internal__/date-picker/day-picker.style.js} +5 -1
- package/lib/components/date/__internal__/date-picker/index.d.ts +1 -0
- package/lib/{__internal__/date → components/date/__internal__/date-picker}/index.js +2 -2
- package/lib/components/date/{navbar → __internal__/navbar}/button.style.d.ts +0 -0
- package/lib/components/date/{navbar → __internal__/navbar}/button.style.js +1 -1
- package/lib/components/date/{navbar → __internal__/navbar}/index.d.ts +0 -0
- package/lib/components/date/{navbar → __internal__/navbar}/index.js +0 -0
- package/lib/components/date/{navbar → __internal__/navbar}/navbar.component.d.ts +0 -0
- package/lib/components/date/{navbar → __internal__/navbar}/navbar.component.js +10 -12
- package/lib/components/date/__internal__/navbar/navbar.d.ts +8 -0
- package/lib/components/date/{navbar → __internal__/navbar}/navbar.style.d.ts +0 -0
- package/lib/components/date/{navbar → __internal__/navbar}/navbar.style.js +1 -1
- package/lib/components/date/__internal__/utils.d.ts +19 -0
- package/lib/components/date/__internal__/utils.js +182 -0
- package/lib/components/date/{weekday → __internal__/weekday}/abbr.style.d.ts +0 -0
- package/lib/components/date/{weekday → __internal__/weekday}/abbr.style.js +0 -0
- package/lib/components/date/{weekday → __internal__/weekday}/index.d.ts +0 -0
- package/lib/components/date/{weekday → __internal__/weekday}/index.js +0 -0
- package/lib/components/date/{weekday → __internal__/weekday}/weekday.component.d.ts +0 -0
- package/lib/components/date/{weekday → __internal__/weekday}/weekday.component.js +0 -0
- package/lib/components/date/__internal__/weekday/weekday.d.ts +13 -0
- package/lib/components/date/{weekday → __internal__/weekday}/weekday.style.d.ts +0 -0
- package/lib/components/date/{weekday → __internal__/weekday}/weekday.style.js +1 -1
- package/lib/components/date/date.component.d.ts +27 -55
- package/lib/components/date/date.component.js +291 -661
- package/lib/components/date/date.d.ts +28 -20
- package/lib/components/date/date.style.js +3 -2
- package/lib/components/date/index.js +2 -10
- package/lib/components/date-range/date-range-context.d.ts +17 -0
- package/lib/components/date-range/date-range.component.d.ts +3 -5
- package/lib/components/date-range/date-range.component.js +123 -119
- package/lib/components/date-range/date-range.context.d.ts +3 -0
- package/lib/components/date-range/date-range.context.js +14 -0
- package/lib/components/date-range/date-range.d.ts +5 -7
- package/lib/components/date-range/date-range.style.js +1 -0
- package/lib/components/date-range/index.d.ts +1 -0
- package/lib/components/i18n-provider/i18n-provider.component.d.ts +1 -4
- package/lib/components/i18n-provider/i18n-provider.component.js +1 -4
- package/lib/components/progress-tracker/progress-tracker.component.d.ts +42 -11
- package/lib/components/progress-tracker/progress-tracker.component.js +35 -1
- package/lib/components/progress-tracker/progress-tracker.d.ts +13 -0
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.style.js +13 -23
- package/lib/locales/date-fns-locales/index.d.ts +1 -0
- package/lib/locales/date-fns-locales/index.js +18 -0
- package/lib/locales/en-gb.js +3 -4
- package/lib/locales/locale.d.ts +3 -4
- package/lib/locales/pl-pl.d.ts +1 -1
- package/lib/locales/pl-pl.js +5 -0
- package/lib/style/themes/aegean/aegean-theme.config.d.ts +1 -0
- package/lib/style/themes/aegean/aegean-theme.config.js +2 -1
- package/lib/style/themes/base/base-theme.config.d.ts +162 -93
- package/lib/style/themes/mint/mint-theme.config.d.ts +1 -0
- package/lib/style/themes/mint/mint-theme.config.js +2 -1
- package/lib/style/themes/sage/index.d.ts +162 -93
- package/package.json +7 -7
- package/lib/__internal__/date/date.d.ts +0 -34
- package/lib/__internal__/date/date.js +0 -216
- package/lib/__internal__/date/index.d.ts +0 -1
- package/lib/__spec_helper__/mock-date-helper.d.ts +0 -1
- package/lib/__spec_helper__/mock-date-helper.js +0 -37
- package/lib/components/date/date-picker.component.d.ts +0 -22
- package/lib/components/date/date-picker.component.js +0 -218
|
@@ -26,7 +26,8 @@ var _default = palette => {
|
|
|
26
26
|
return {
|
|
27
27
|
colorsActionMajor500: this.colors.primary,
|
|
28
28
|
colorsActionMajor600: this.colors.secondary,
|
|
29
|
-
colorsActionMajor150: this.colors.loadingBarBackground
|
|
29
|
+
colorsActionMajor150: this.colors.loadingBarBackground,
|
|
30
|
+
colorsBaseTheme: this.colors.primary
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -7,14 +7,69 @@ declare var _default: {
|
|
|
7
7
|
colorsYin030: string;
|
|
8
8
|
colorsYin055: string;
|
|
9
9
|
colorsYin065: string;
|
|
10
|
+
colorsYin075: string;
|
|
10
11
|
colorsYin090: string;
|
|
11
12
|
colorsYang100: string;
|
|
13
|
+
colorsYang080: string;
|
|
14
|
+
colorsGray850: string;
|
|
15
|
+
colorsGray900: string;
|
|
16
|
+
colorsGray1000: string;
|
|
17
|
+
colorsGray000: string;
|
|
12
18
|
colorsDisabled400: string;
|
|
13
19
|
colorsDisabled500: string;
|
|
14
20
|
colorsDisabled600: string;
|
|
15
21
|
colorsReadOnly400: string;
|
|
16
22
|
colorsReadOnly500: string;
|
|
17
23
|
colorsReadOnly600: string;
|
|
24
|
+
colorsComponentsMenuSpringStandard500: string;
|
|
25
|
+
colorsComponentsMenuSpringStandard600: string;
|
|
26
|
+
colorsComponentsMenuSpringStandard700: string;
|
|
27
|
+
colorsComponentsMenuSpringParent500: string;
|
|
28
|
+
colorsComponentsMenuSpringParent600: string;
|
|
29
|
+
colorsComponentsMenuSpringParent700: string;
|
|
30
|
+
colorsComponentsMenuSpringChild400: string;
|
|
31
|
+
colorsComponentsMenuSpringChild500: string;
|
|
32
|
+
colorsComponentsMenuSpringChild600: string;
|
|
33
|
+
colorsComponentsMenuSpringChildAlt500: string;
|
|
34
|
+
colorsComponentsMenuSpringChildAlt600: string;
|
|
35
|
+
colorsComponentsMenuSummerStandard500: string;
|
|
36
|
+
colorsComponentsMenuSummerStandard600: string;
|
|
37
|
+
colorsComponentsMenuSummerStandard700: string;
|
|
38
|
+
colorsComponentsMenuSummerParent500: string;
|
|
39
|
+
colorsComponentsMenuSummerParent600: string;
|
|
40
|
+
colorsComponentsMenuSummerParent700: string;
|
|
41
|
+
colorsComponentsMenuSummerChild400: string;
|
|
42
|
+
colorsComponentsMenuSummerChild500: string;
|
|
43
|
+
colorsComponentsMenuSummerChild600: string;
|
|
44
|
+
colorsComponentsMenuSummerChildAlt500: string;
|
|
45
|
+
colorsComponentsMenuSummerChildAlt600: string;
|
|
46
|
+
colorsComponentsMenuAutumnStandard500: string;
|
|
47
|
+
colorsComponentsMenuAutumnStandard600: string;
|
|
48
|
+
colorsComponentsMenuAutumnStandard700: string;
|
|
49
|
+
colorsComponentsMenuAutumnParent500: string;
|
|
50
|
+
colorsComponentsMenuAutumnParent600: string;
|
|
51
|
+
colorsComponentsMenuAutumnParent700: string;
|
|
52
|
+
colorsComponentsMenuAutumnChild400: string;
|
|
53
|
+
colorsComponentsMenuAutumnChild500: string;
|
|
54
|
+
colorsComponentsMenuAutumnChild600: string;
|
|
55
|
+
colorsComponentsMenuAutumnChildAlt500: string;
|
|
56
|
+
colorsComponentsMenuAutumnChildAlt600: string;
|
|
57
|
+
colorsComponentsMenuWinterStandard500: string;
|
|
58
|
+
colorsComponentsMenuWinterStandard600: string;
|
|
59
|
+
colorsComponentsMenuWinterStandard700: string;
|
|
60
|
+
colorsComponentsMenuWinterParent500: string;
|
|
61
|
+
colorsComponentsMenuWinterParent600: string;
|
|
62
|
+
colorsComponentsMenuWinterParent700: string;
|
|
63
|
+
colorsComponentsMenuWinterChild400: string;
|
|
64
|
+
colorsComponentsMenuWinterChild500: string;
|
|
65
|
+
colorsComponentsMenuWinterChild600: string;
|
|
66
|
+
colorsComponentsMenuWinterChildAlt500: string;
|
|
67
|
+
colorsComponentsMenuWinterChildAlt600: string;
|
|
68
|
+
colorsComponentsMenuYin100: string;
|
|
69
|
+
colorsComponentsMenuYin065: string;
|
|
70
|
+
colorsComponentsMenuYin090: string;
|
|
71
|
+
colorsComponentsMenuYang100: string;
|
|
72
|
+
colorsComponentsMenuYang080: string;
|
|
18
73
|
colorsComponentsNavigation500: string;
|
|
19
74
|
colorsComponentsNavigation600: string;
|
|
20
75
|
colorsComponentsNavigation700: string;
|
|
@@ -33,6 +88,7 @@ declare var _default: {
|
|
|
33
88
|
colorsUtilityMajor500: string;
|
|
34
89
|
colorsUtilityMajor800: string;
|
|
35
90
|
colorsUtilityMajor025: string;
|
|
91
|
+
colorsUtilityMajor040: string;
|
|
36
92
|
colorsUtilityMajor050: string;
|
|
37
93
|
colorsUtilityMajor075: string;
|
|
38
94
|
colorsUtilityMajorTransparent: string;
|
|
@@ -65,7 +121,9 @@ declare var _default: {
|
|
|
65
121
|
colorsActionMinor300: string;
|
|
66
122
|
colorsActionMinor400: string;
|
|
67
123
|
colorsActionMinor500: string;
|
|
124
|
+
colorsActionMinor550: string;
|
|
68
125
|
colorsActionMinor600: string;
|
|
126
|
+
colorsActionMinor850: string;
|
|
69
127
|
colorsActionMinor900: string;
|
|
70
128
|
colorsActionMinor025: string;
|
|
71
129
|
colorsActionMinor050: string;
|
|
@@ -186,6 +244,7 @@ declare var _default: {
|
|
|
186
244
|
fontSizes025: string;
|
|
187
245
|
fontSizes050: string;
|
|
188
246
|
boxShadow100: string;
|
|
247
|
+
boxShadow150: string;
|
|
189
248
|
boxShadow200: string;
|
|
190
249
|
boxShadow300: string;
|
|
191
250
|
boxShadow400: string;
|
|
@@ -201,100 +260,111 @@ declare var _default: {
|
|
|
201
260
|
fontFamiliesAndroid: string;
|
|
202
261
|
fontFamiliesOther: string;
|
|
203
262
|
borderRadiusCircle: string;
|
|
204
|
-
typographyAccordionTitleM:
|
|
205
|
-
typographyAccordionSubtitleM:
|
|
206
|
-
typographyAccordionParagraphM:
|
|
207
|
-
typographyActionPopoverMenuItemM:
|
|
208
|
-
typographyAnchorNavLabelM:
|
|
209
|
-
typographyBadgeLabelM:
|
|
210
|
-
typographyButtonLabelS:
|
|
211
|
-
typographyButtonLabelM:
|
|
212
|
-
typographyButtonLabelL:
|
|
213
|
-
typographyDialogTitleXs:
|
|
214
|
-
typographyDialogTitleS:
|
|
215
|
-
typographyDialogTitleMs:
|
|
216
|
-
typographyDialogTitleM:
|
|
217
|
-
typographyDialogTitleMl:
|
|
218
|
-
typographyDialogTitleL:
|
|
219
|
-
typographyDialogTitleXl:
|
|
220
|
-
typographyDialogParagraphXs:
|
|
221
|
-
typographyDialogParagraphS:
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
263
|
+
typographyAccordionTitleM: string;
|
|
264
|
+
typographyAccordionSubtitleM: string;
|
|
265
|
+
typographyAccordionParagraphM: string;
|
|
266
|
+
typographyActionPopoverMenuItemM: string;
|
|
267
|
+
typographyAnchorNavLabelM: string;
|
|
268
|
+
typographyBadgeLabelM: string;
|
|
269
|
+
typographyButtonLabelS: string;
|
|
270
|
+
typographyButtonLabelM: string;
|
|
271
|
+
typographyButtonLabelL: string;
|
|
272
|
+
typographyDialogTitleXs: string;
|
|
273
|
+
typographyDialogTitleS: string;
|
|
274
|
+
typographyDialogTitleMs: string;
|
|
275
|
+
typographyDialogTitleM: string;
|
|
276
|
+
typographyDialogTitleMl: string;
|
|
277
|
+
typographyDialogTitleL: string;
|
|
278
|
+
typographyDialogTitleXl: string;
|
|
279
|
+
typographyDialogParagraphXs: string;
|
|
280
|
+
typographyDialogParagraphS: string;
|
|
281
|
+
typographyDrawerTitleM: string;
|
|
282
|
+
typographyFlashTextM: string;
|
|
283
|
+
typographyFlashTextL: string;
|
|
284
|
+
typographyFormFieldLabelXs: string;
|
|
285
|
+
typographyFormFieldLabelS: string;
|
|
286
|
+
typographyFormFieldLabelM: string;
|
|
287
|
+
typographyFormFieldLabelL: string;
|
|
288
|
+
typographyFormFieldHintTextXs: string;
|
|
289
|
+
typographyFormFieldHintTextS: string;
|
|
290
|
+
typographyFormFieldHintTextM: string;
|
|
291
|
+
typographyFormFieldHintTextL: string;
|
|
292
|
+
typographyFormFieldErrorMessageXs: string;
|
|
293
|
+
typographyFormFieldErrorMessageS: string;
|
|
294
|
+
typographyFormFieldErrorMessageM: string;
|
|
295
|
+
typographyFormFieldErrorMessageL: string;
|
|
296
|
+
typographyFormFieldCautionMessageXs: string;
|
|
297
|
+
typographyFormFieldCautionMessageS: string;
|
|
298
|
+
typographyFormFieldCautionMessageM: string;
|
|
299
|
+
typographyFormFieldCautionMessageL: string;
|
|
300
|
+
typographyFormFieldInputTextXs: string;
|
|
301
|
+
typographyFormFieldInputTextS: string;
|
|
302
|
+
typographyFormFieldInputTextM: string;
|
|
303
|
+
typographyFormFieldInputTextL: string;
|
|
304
|
+
typographyFormFieldDropdownOptionsXs: string;
|
|
305
|
+
typographyFormFieldDropdownOptionsS: string;
|
|
306
|
+
typographyFormFieldDropdownOptionsM: string;
|
|
307
|
+
typographyFormFieldDropdownOptionsL: string;
|
|
308
|
+
typographyFormFieldSecondLabelXs: string;
|
|
309
|
+
typographyFormFieldSecondLabelS: string;
|
|
310
|
+
typographyFormFieldSecondLabelM: string;
|
|
311
|
+
typographyFormFieldSecondLabelL: string;
|
|
312
|
+
typographyFormFieldCharacterCountXs: string;
|
|
313
|
+
typographyFormFieldCharacterCountS: string;
|
|
314
|
+
typographyFormFieldCharacterCountM: string;
|
|
315
|
+
typographyFormFieldCharacterCountL: string;
|
|
316
|
+
typographyLinkTextM: string;
|
|
317
|
+
typographyLinkTextL: string;
|
|
318
|
+
typographyMenuLabelM: string;
|
|
319
|
+
typographyMenuSegmentTitleM: string;
|
|
320
|
+
typographyMessageHeadingM: string;
|
|
321
|
+
typographyMessageHeadingL: string;
|
|
322
|
+
typographyMessageTextM: string;
|
|
323
|
+
typographyMessageTextL: string;
|
|
324
|
+
typographyPillLabelS: string;
|
|
325
|
+
typographyPillLabelM: string;
|
|
326
|
+
typographyPillLabelL: string;
|
|
327
|
+
typographyPillLabelXl: string;
|
|
328
|
+
typographyProfileEmailXs: string;
|
|
329
|
+
typographyProfileEmailS: string;
|
|
330
|
+
typographyProfileEmailM: string;
|
|
331
|
+
typographyProfileEmailMl: string;
|
|
332
|
+
typographyProfileEmailL: string;
|
|
333
|
+
typographyProfileEmailXl: string;
|
|
334
|
+
typographyProfileEmailXxl: string;
|
|
335
|
+
typographyProfileInitialsXs: string;
|
|
336
|
+
typographyProfileInitialsS: string;
|
|
337
|
+
typographyProfileInitialsM: string;
|
|
338
|
+
typographyProfileInitialsMl: string;
|
|
339
|
+
typographyProfileInitialsL: string;
|
|
340
|
+
typographyProfileInitialsXl: string;
|
|
341
|
+
typographyProfileInitialsXxl: string;
|
|
342
|
+
typographyProfileNameXs: string;
|
|
343
|
+
typographyProfileNameS: string;
|
|
344
|
+
typographyProfileNameM: string;
|
|
345
|
+
typographyProfileNameMl: string;
|
|
346
|
+
typographyProfileNameL: string;
|
|
347
|
+
typographyProfileNameXl: string;
|
|
348
|
+
typographyProfileNameXxl: string;
|
|
349
|
+
typographyProgressTrackerValueLabelS: string;
|
|
350
|
+
typographyProgressTrackerValueLabelM: string;
|
|
351
|
+
typographyProgressTrackerValueLabelL: string;
|
|
352
|
+
typographySearchLabelM: string;
|
|
353
|
+
typographySidebarTitleS: string;
|
|
354
|
+
typographySidebarTitleM: string;
|
|
355
|
+
typographySidebarTitleL: string;
|
|
356
|
+
typographyStepFlowCompleteLabelM: string;
|
|
357
|
+
typographyStepFlowCurrentLabelM: string;
|
|
358
|
+
typographyStepFlowIncompleteLabelM: string;
|
|
359
|
+
typographySwitchOptionLabelM: string;
|
|
360
|
+
typographySwitchOptionLabelL: string;
|
|
361
|
+
typographyTableHeaderTextM: string;
|
|
362
|
+
typographyTableCellTextM: string;
|
|
363
|
+
typographyTooltipTextM: string;
|
|
364
|
+
typographyTooltipTextL: string;
|
|
296
365
|
opacity300: string;
|
|
297
366
|
opacity600: string;
|
|
367
|
+
opacity800: string;
|
|
298
368
|
};
|
|
299
369
|
name: string;
|
|
300
370
|
palette: import("../../palette").Palette & import("../base").ColorsWithHex & {
|
|
@@ -575,4 +645,3 @@ declare var _default: {
|
|
|
575
645
|
};
|
|
576
646
|
};
|
|
577
647
|
export default _default;
|
|
578
|
-
import tokens from "@sage/design-tokens/js/base/common";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "104.1.0",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"engineStrict": true,
|
|
6
6
|
"engines": {
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"start": "node ./scripts/check_node_version.js && start-storybook -p 9001 -s .assets -c .storybook",
|
|
17
17
|
"start:debug-theme": "cross-env STORYBOOK_DEBUG_THEME=true npm run start",
|
|
18
|
-
"test": "jest --config=./jest.conf.json",
|
|
19
|
-
"test-update": "jest --config=./jest.conf.json --updateSnapshot",
|
|
18
|
+
"test": "TZ=UTC jest --config=./jest.conf.json",
|
|
19
|
+
"test-update": "TZ=UTC jest --config=./jest.conf.json --updateSnapshot",
|
|
20
20
|
"test:cypress": "cypress open",
|
|
21
21
|
"cypress:react": "npx cypress open-ct",
|
|
22
22
|
"debug": "node --inspect ./node_modules/jest-cli/bin/jest --watch --config=./jest.conf.json",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"chromatic": "^6.0.5",
|
|
102
102
|
"commitizen": "^4.2.4",
|
|
103
103
|
"conventional-changelog-conventionalcommits": "^4.5.0",
|
|
104
|
-
"core-js": "^3.
|
|
104
|
+
"core-js": "^3.20.3",
|
|
105
105
|
"cpy-cli": "^3.1.1",
|
|
106
106
|
"cross-env": "^5.2.0",
|
|
107
107
|
"cypress": "^9.2.0",
|
|
@@ -155,21 +155,21 @@
|
|
|
155
155
|
"dependencies": {
|
|
156
156
|
"@octokit/rest": "^18.12.0",
|
|
157
157
|
"@popperjs/core": "^2.9.0",
|
|
158
|
-
"@sage/design-tokens": "^1.
|
|
158
|
+
"@sage/design-tokens": "^1.89.0",
|
|
159
159
|
"@styled-system/prop-types": "^5.1.5",
|
|
160
160
|
"@tippyjs/react": "^4.2.5",
|
|
161
161
|
"@types/styled-system": "^5.1.11",
|
|
162
162
|
"classnames": "~2.2.6",
|
|
163
163
|
"crypto-js": "~3.3.0",
|
|
164
|
+
"date-fns": "^2.26.0",
|
|
164
165
|
"dotenv": "^10.0.0",
|
|
165
166
|
"immutable": "~3.8.2",
|
|
166
167
|
"invariant": "^2.2.4",
|
|
167
168
|
"lodash": "^4.17.20",
|
|
168
|
-
"moment": "~2.20.1",
|
|
169
169
|
"node-fetch": "^2.6.1",
|
|
170
170
|
"polished": "^4.0.5",
|
|
171
171
|
"prop-types": "^15.7.2",
|
|
172
|
-
"react-day-picker": "~
|
|
172
|
+
"react-day-picker": "~7.4.10",
|
|
173
173
|
"react-dnd": "^10.0.2",
|
|
174
174
|
"react-dnd-html5-backend": "^10.0.2",
|
|
175
175
|
"react-is": "^17.0.2",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
interface Locale {
|
|
2
|
-
locale: string;
|
|
3
|
-
formats: string[];
|
|
4
|
-
format: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
interface FormatDateToCurrentLocaleArgs extends Locale {
|
|
8
|
-
value: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface IsValidDateArgs extends FormatDateToCurrentLocaleArgs {
|
|
12
|
-
options?: Record<string, unknown>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface FormatValueArgs extends IsValidDateArgs {
|
|
16
|
-
formatTo?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface WithinRangeArgs extends FormatDateToCurrentLocaleArgs {
|
|
20
|
-
limit: number;
|
|
21
|
-
units: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface DateHelper {
|
|
25
|
-
sanitizeDateInput: (value: string) => string;
|
|
26
|
-
isValidDate: (params: IsValidDateArgs) => boolean;
|
|
27
|
-
formatValue: (params: FormatValueArgs) => string;
|
|
28
|
-
stringToDate: (value: string) => Date;
|
|
29
|
-
formatDateString: (value: string, formatTo?: string) => string;
|
|
30
|
-
todayFormatted: (format?: string) => string;
|
|
31
|
-
weekdaysMinified: (locale: string) => string[];
|
|
32
|
-
withinRange: (params: WithinRangeArgs) => boolean;
|
|
33
|
-
formatDateToCurrentLocale: (params: FormatDateToCurrentLocaleArgs) => string;
|
|
34
|
-
}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _moment = _interopRequireDefault(require("moment"));
|
|
9
|
-
|
|
10
|
-
require("moment/min/locales");
|
|
11
|
-
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
const isoDateFormat = "YYYY-MM-DD";
|
|
17
|
-
/**
|
|
18
|
-
* DateHelper used to encapsulate the date parsing library into a single helper
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const DateHelper = {
|
|
22
|
-
/**
|
|
23
|
-
* Sanitizes all valid date separators ( . - 'whitespace' ) replacing them
|
|
24
|
-
* with a slash
|
|
25
|
-
*
|
|
26
|
-
* This allows us to compare against one separator in the i18n string. DD/MM/YYYY
|
|
27
|
-
*
|
|
28
|
-
* @method sanitizeDateInput
|
|
29
|
-
* @return {String} sanitized input
|
|
30
|
-
*/
|
|
31
|
-
sanitizeDateInput: value => {
|
|
32
|
-
if (!value) {
|
|
33
|
-
return "";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return value.replace(/[-.\s]/g, "/").toLowerCase();
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Determines if date is valid
|
|
41
|
-
*
|
|
42
|
-
* @param {String} value - value to validate
|
|
43
|
-
* @param {Object} options Override Moment JS options
|
|
44
|
-
* @return {Boolean}
|
|
45
|
-
*/
|
|
46
|
-
isValidDate: ({
|
|
47
|
-
value,
|
|
48
|
-
options = {},
|
|
49
|
-
locale,
|
|
50
|
-
formats,
|
|
51
|
-
format
|
|
52
|
-
}) => {
|
|
53
|
-
return DateHelper._parseDate({
|
|
54
|
-
value,
|
|
55
|
-
options,
|
|
56
|
-
locale,
|
|
57
|
-
formats,
|
|
58
|
-
format
|
|
59
|
-
}).isValid();
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Formats the given value to a specified format
|
|
64
|
-
*
|
|
65
|
-
* @method formatValue
|
|
66
|
-
* @param {String} val current value
|
|
67
|
-
* @param {String} formatTo Desired format
|
|
68
|
-
* @param {Object} options Override Moment JS options
|
|
69
|
-
* @return {String} formatted date
|
|
70
|
-
*/
|
|
71
|
-
formatValue: ({
|
|
72
|
-
value,
|
|
73
|
-
formatTo = isoDateFormat,
|
|
74
|
-
options = {},
|
|
75
|
-
locale,
|
|
76
|
-
formats,
|
|
77
|
-
format
|
|
78
|
-
}) => {
|
|
79
|
-
const date = DateHelper._parseDate({
|
|
80
|
-
value,
|
|
81
|
-
options,
|
|
82
|
-
locale,
|
|
83
|
-
formats,
|
|
84
|
-
format
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
return date.isValid() ? date.format(formatTo) : value;
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Convert a value such as '2017-08-23' into a Javascript Date object
|
|
92
|
-
*
|
|
93
|
-
* @method stringToDate
|
|
94
|
-
* @param {String} value current value e.g. 2017-08-23
|
|
95
|
-
* @return {Object} The Date object
|
|
96
|
-
*/
|
|
97
|
-
stringToDate: value => (0, _moment.default)(value).toDate(),
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Formats the given date string to the specified format
|
|
101
|
-
* Moment will not format the standard Javascript Date string format
|
|
102
|
-
*
|
|
103
|
-
* @method formatDateString
|
|
104
|
-
* @param {String} value current value e.g. Wed Aug 23 2017 12:00:00 GMT+0100 (BST)
|
|
105
|
-
* @param {String} formatTo Desired format e.g. YYYY-MM-DD
|
|
106
|
-
* @return {String} formatted date
|
|
107
|
-
*/
|
|
108
|
-
formatDateString: (value, formatTo = isoDateFormat) => {
|
|
109
|
-
return (0, _moment.default)(new Date(value).getTime()).format(formatTo);
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Returns todays date formatted
|
|
114
|
-
*
|
|
115
|
-
* @param {String} format - format of date
|
|
116
|
-
* @return {Moment}
|
|
117
|
-
*/
|
|
118
|
-
todayFormatted: (format = isoDateFormat) => {
|
|
119
|
-
return (0, _moment.default)().format(format);
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Returns an array of days of the week by locale minified
|
|
124
|
-
* Mo, Tu, We, Th, Fr, Sa, Su
|
|
125
|
-
*
|
|
126
|
-
* @param {String} locale - defaulted to I18n.locale
|
|
127
|
-
* @return {Array}
|
|
128
|
-
*/
|
|
129
|
-
weekdaysMinified: locale => {
|
|
130
|
-
return _moment.default.localeData(locale)._weekdaysMin;
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @param {String} value - the date to test
|
|
135
|
-
* @param {Number} limit - the upper and lower bounds
|
|
136
|
-
* @param {String} units - defaulted to days
|
|
137
|
-
* @return {Boolean}
|
|
138
|
-
*/
|
|
139
|
-
withinRange: ({
|
|
140
|
-
value,
|
|
141
|
-
limit,
|
|
142
|
-
units,
|
|
143
|
-
locale,
|
|
144
|
-
formats,
|
|
145
|
-
format
|
|
146
|
-
}) => {
|
|
147
|
-
const momentValue = DateHelper._parseDate({
|
|
148
|
-
value,
|
|
149
|
-
locale,
|
|
150
|
-
formats,
|
|
151
|
-
format
|
|
152
|
-
}),
|
|
153
|
-
today = (0, _moment.default)();
|
|
154
|
-
|
|
155
|
-
const difference = Math.abs(today.diff(momentValue, units));
|
|
156
|
-
return difference < limit;
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Default options to pass to moment js
|
|
161
|
-
*
|
|
162
|
-
* @private
|
|
163
|
-
* formats - given accepted formats
|
|
164
|
-
* locale - current locale
|
|
165
|
-
* strict - moment js strict mode
|
|
166
|
-
*/
|
|
167
|
-
_defaultMomentOptions: (locale, formats) => {
|
|
168
|
-
return {
|
|
169
|
-
locale,
|
|
170
|
-
formats,
|
|
171
|
-
strict: true
|
|
172
|
-
};
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Parses date into moment
|
|
177
|
-
* Note when sanitizing dates formats must contain '/' for separators
|
|
178
|
-
*
|
|
179
|
-
* @private
|
|
180
|
-
* @param {String} value - value to parse
|
|
181
|
-
* @param {Object} options Override Moment JS options
|
|
182
|
-
* @return {Moment}
|
|
183
|
-
*/
|
|
184
|
-
_parseDate({
|
|
185
|
-
value,
|
|
186
|
-
options,
|
|
187
|
-
locale,
|
|
188
|
-
formats = [],
|
|
189
|
-
format
|
|
190
|
-
}) {
|
|
191
|
-
const opts = (0, _lodash.merge)(DateHelper._defaultMomentOptions(locale, formats), options, {
|
|
192
|
-
locale,
|
|
193
|
-
formats,
|
|
194
|
-
format
|
|
195
|
-
});
|
|
196
|
-
return (0, _moment.default)(value, [format, isoDateFormat, ...opts.formats], opts.locale, opts.strict);
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
formatDateToCurrentLocale({
|
|
200
|
-
value,
|
|
201
|
-
locale,
|
|
202
|
-
formats,
|
|
203
|
-
format
|
|
204
|
-
}) {
|
|
205
|
-
return DateHelper.formatValue({
|
|
206
|
-
value,
|
|
207
|
-
formatTo: format,
|
|
208
|
-
locale,
|
|
209
|
-
formats,
|
|
210
|
-
format
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
};
|
|
215
|
-
var _default = DateHelper;
|
|
216
|
-
exports.default = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { "/home/runner/work/carbon/carbon/src/__internal__/date/date" as default } from "./date";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _moment = _interopRequireDefault(require("moment"));
|
|
4
|
-
|
|
5
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Replaces today date with specified in the argument of the "set" method.
|
|
9
|
-
* Ensures that the UTC time is returned regardless of the local time.
|
|
10
|
-
*/
|
|
11
|
-
jest.mock("../__internal__/date", () => {
|
|
12
|
-
const _DateHelper = jest.requireActual("../__internal__/date");
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
__esModule: true,
|
|
16
|
-
default: (() => {
|
|
17
|
-
const mockTodayDate = "1-1-2019";
|
|
18
|
-
const isoDateFormat = "YYYY-MM-DD";
|
|
19
|
-
const MockedDateHelper = { ..._DateHelper.default
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
MockedDateHelper._parseDate = (value, options) => _DateHelper.default._parseDate(value, options).utc();
|
|
23
|
-
|
|
24
|
-
MockedDateHelper.stringToDate = value => (0, _moment.default)(value).utc().toDate();
|
|
25
|
-
|
|
26
|
-
MockedDateHelper.todayFormatted = (format = isoDateFormat) => {
|
|
27
|
-
return (0, _moment.default)(mockTodayDate).utc().format(format);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
MockedDateHelper.formatDateString = (value, formatTo = isoDateFormat) => {
|
|
31
|
-
return (0, _moment.default)(new Date(value).getTime()).utc().format(formatTo);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return MockedDateHelper;
|
|
35
|
-
})()
|
|
36
|
-
};
|
|
37
|
-
});
|