@primer/components 0.0.0-2021922191125 → 0.0.0-2021922204627
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/CHANGELOG.md +1 -1
- package/dist/browser.esm.js +3 -3
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +28 -28
- package/dist/browser.umd.js.map +1 -1
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
- package/lib/Autocomplete/Autocomplete.d.ts +4 -2
- package/lib/Autocomplete/AutocompleteInput.d.ts +4 -2
- package/lib/DatePicker/DatePicker.d.ts +48 -0
- package/lib/DatePicker/DatePicker.js +82 -0
- package/lib/DatePicker/DatePickerAnchor.d.ts +5 -0
- package/lib/DatePicker/DatePickerAnchor.js +88 -0
- package/lib/DatePicker/DatePickerOverlay.d.ts +3 -0
- package/lib/DatePicker/DatePickerOverlay.js +39 -0
- package/lib/DatePicker/DatePickerPanel.d.ts +2 -0
- package/lib/DatePicker/DatePickerPanel.js +43 -0
- package/lib/DatePicker/Day.d.ts +14 -0
- package/lib/DatePicker/Day.js +173 -0
- package/lib/DatePicker/Month.d.ts +9 -0
- package/lib/DatePicker/Month.js +97 -0
- package/lib/DatePicker/index.d.ts +2 -0
- package/lib/DatePicker/index.js +13 -0
- package/lib/DatePicker/useDatePicker.d.ts +69 -0
- package/lib/DatePicker/useDatePicker.js +336 -0
- package/lib/SelectMenu/SelectMenu.d.ts +4 -2
- package/lib/TextInputWithTokens.d.ts +4 -2
- package/lib/TextInputWithTokens.js +12 -25
- package/lib/theme-preval.js +2 -2
- package/lib/utils/testing.d.ts +1 -1
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
- package/lib-esm/Autocomplete/Autocomplete.d.ts +4 -2
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +4 -2
- package/lib-esm/DatePicker/DatePicker.d.ts +48 -0
- package/lib-esm/DatePicker/DatePicker.js +65 -0
- package/lib-esm/DatePicker/DatePickerAnchor.d.ts +5 -0
- package/lib-esm/DatePicker/DatePickerAnchor.js +63 -0
- package/lib-esm/DatePicker/DatePickerOverlay.d.ts +3 -0
- package/lib-esm/DatePicker/DatePickerOverlay.js +24 -0
- package/lib-esm/DatePicker/DatePickerPanel.d.ts +2 -0
- package/lib-esm/DatePicker/DatePickerPanel.js +24 -0
- package/lib-esm/DatePicker/Day.d.ts +14 -0
- package/lib-esm/DatePicker/Day.js +150 -0
- package/lib-esm/DatePicker/Month.d.ts +9 -0
- package/lib-esm/DatePicker/Month.js +74 -0
- package/lib-esm/DatePicker/index.d.ts +2 -0
- package/lib-esm/DatePicker/index.js +1 -0
- package/lib-esm/DatePicker/useDatePicker.d.ts +69 -0
- package/lib-esm/DatePicker/useDatePicker.js +308 -0
- package/lib-esm/SelectMenu/SelectMenu.d.ts +4 -2
- package/lib-esm/TextInputWithTokens.d.ts +4 -2
- package/lib-esm/TextInputWithTokens.js +13 -25
- package/lib-esm/theme-preval.js +2 -2
- package/lib-esm/utils/testing.d.ts +1 -1
- package/package.json +9 -8
@@ -0,0 +1,308 @@
|
|
1
|
+
import { format, isEqual, isAfter, isBefore } from 'date-fns';
|
2
|
+
import deepmerge from 'deepmerge';
|
3
|
+
import React, { createContext, useCallback, useContext, useMemo, useEffect, useState } from 'react';
|
4
|
+
const DatePickerContext = /*#__PURE__*/createContext(null);
|
5
|
+
|
6
|
+
const useDatePicker = date => {
|
7
|
+
const value = useContext(DatePickerContext);
|
8
|
+
|
9
|
+
if (!value) {
|
10
|
+
throw new Error('useDatePicker must be used inside a DatePickerProvider');
|
11
|
+
}
|
12
|
+
|
13
|
+
let selected = false;
|
14
|
+
let blocked,
|
15
|
+
disabled = false;
|
16
|
+
|
17
|
+
if (date) {
|
18
|
+
if (value.selection) {
|
19
|
+
if (isMultiSelection(value.selection)) {
|
20
|
+
selected = !!value.selection.find(d => isEqual(d, date));
|
21
|
+
} else if (isRangeSelection(value.selection)) {
|
22
|
+
if (isEqual(date, value.selection.from)) {
|
23
|
+
selected = 'start';
|
24
|
+
} else if (value.selection.to && isEqual(date, value.selection.to)) {
|
25
|
+
selected = 'end';
|
26
|
+
} else if (isAfter(date, value.selection.from) && value.selection.to && isBefore(date, value.selection.to)) {
|
27
|
+
selected = 'middle';
|
28
|
+
} else {
|
29
|
+
selected = false;
|
30
|
+
}
|
31
|
+
} else {
|
32
|
+
selected = isEqual(date, value.selection);
|
33
|
+
}
|
34
|
+
} // Determine if date is blocked out
|
35
|
+
|
36
|
+
|
37
|
+
if (value.configuration.blockedDates) {
|
38
|
+
blocked = !!value.configuration.blockedDates.find(d => isEqual(d, date));
|
39
|
+
} // Determine if date is disabled
|
40
|
+
|
41
|
+
|
42
|
+
if (value.configuration.minDate || value.configuration.maxDate) {
|
43
|
+
disabled = (value.configuration.minDate ? isBefore(date, value.configuration.minDate) : false) || (value.configuration.maxDate ? isAfter(date, value.configuration.maxDate) : false);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
return { ...value,
|
48
|
+
blocked,
|
49
|
+
disabled,
|
50
|
+
selected
|
51
|
+
};
|
52
|
+
};
|
53
|
+
|
54
|
+
export default useDatePicker;
|
55
|
+
export function isSingleSelection(selection) {
|
56
|
+
return selection instanceof Date;
|
57
|
+
}
|
58
|
+
export function isMultiSelection(selection) {
|
59
|
+
return Array.isArray(selection);
|
60
|
+
}
|
61
|
+
export function isRangeSelection(selection) {
|
62
|
+
return !!selection.from;
|
63
|
+
}
|
64
|
+
export function isStringRangeSelection(selection) {
|
65
|
+
return !!selection.from;
|
66
|
+
}
|
67
|
+
|
68
|
+
function parseSelection(selection, variant) {
|
69
|
+
if (!selection) return;
|
70
|
+
|
71
|
+
if (variant === 'multi') {
|
72
|
+
if (isMultiSelection(selection)) {
|
73
|
+
const parsedSelection = [];
|
74
|
+
|
75
|
+
for (const d of selection) {
|
76
|
+
parsedSelection.push(new Date(new Date(d).toDateString()));
|
77
|
+
}
|
78
|
+
|
79
|
+
return parsedSelection.sort((a, b) => a.getTime() - b.getTime());
|
80
|
+
} else if (selection instanceof Date) {
|
81
|
+
return [new Date(new Date(selection).toDateString())];
|
82
|
+
} else if (isRangeSelection(selection)) {
|
83
|
+
const parsedSelection = [];
|
84
|
+
parsedSelection.push(new Date(new Date(selection.from).toDateString()));
|
85
|
+
|
86
|
+
if (selection.to) {
|
87
|
+
parsedSelection.push(new Date(new Date(selection.to).toDateString()));
|
88
|
+
}
|
89
|
+
|
90
|
+
return parsedSelection.sort((a, b) => a.getTime() - b.getTime());
|
91
|
+
}
|
92
|
+
} else if (variant === 'range') {
|
93
|
+
if (isRangeSelection(selection)) {
|
94
|
+
return {
|
95
|
+
from: new Date(new Date(selection.from).toDateString()),
|
96
|
+
to: selection.to ? new Date(new Date(selection.to).toDateString()) : null
|
97
|
+
};
|
98
|
+
} else if (isMultiSelection(selection)) {
|
99
|
+
return {
|
100
|
+
from: new Date(new Date(selection[0]).toDateString()),
|
101
|
+
to: selection[1] ? new Date(new Date(selection[1]).toDateString()) : null
|
102
|
+
};
|
103
|
+
} else if (selection instanceof Date) {
|
104
|
+
return {
|
105
|
+
from: new Date(new Date(selection).toDateString()),
|
106
|
+
to: null
|
107
|
+
};
|
108
|
+
}
|
109
|
+
} else {
|
110
|
+
if (selection instanceof Date) {
|
111
|
+
return new Date(new Date(selection).toDateString());
|
112
|
+
} else if (isMultiSelection(selection)) {
|
113
|
+
return new Date(new Date(selection[0]).toDateString());
|
114
|
+
} else if (isRangeSelection(selection)) {
|
115
|
+
return new Date(new Date(selection.from).toDateString());
|
116
|
+
} else {
|
117
|
+
return;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
const defaultConfiguration = {
|
123
|
+
anchorVariant: 'button',
|
124
|
+
confirmation: false,
|
125
|
+
contiguousSelection: false,
|
126
|
+
dimWeekends: false,
|
127
|
+
placeholder: 'Select a Date...',
|
128
|
+
selection: 'single',
|
129
|
+
view: '2-month'
|
130
|
+
};
|
131
|
+
export const DatePickerProvider = ({
|
132
|
+
configuration: externalConfig = {},
|
133
|
+
children,
|
134
|
+
closePicker,
|
135
|
+
value
|
136
|
+
}) => {
|
137
|
+
const [configuration, setConfiguration] = useState(deepmerge(defaultConfiguration, externalConfig));
|
138
|
+
const [previousSelection, setPreviousSelection] = useState(parseSelection(value, configuration.selection));
|
139
|
+
const [selection, setSelection] = useState(parseSelection(value, configuration.selection));
|
140
|
+
const [hoverRange, setHoverRange] = useState(null);
|
141
|
+
useEffect(() => {
|
142
|
+
setConfiguration(deepmerge(defaultConfiguration, externalConfig));
|
143
|
+
setSelection(parseSelection(selection, configuration.selection)); // Don't want this to run every time selection gets updated
|
144
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
145
|
+
}, [configuration.selection, externalConfig]);
|
146
|
+
const getFormattedDate = useMemo(() => {
|
147
|
+
if (!selection) {
|
148
|
+
return configuration.placeholder;
|
149
|
+
}
|
150
|
+
|
151
|
+
let template = 'MMM d';
|
152
|
+
|
153
|
+
if (configuration.dateFormat) {
|
154
|
+
switch (configuration.dateFormat) {
|
155
|
+
case 'short':
|
156
|
+
template = 'MMM d';
|
157
|
+
break;
|
158
|
+
|
159
|
+
case 'long':
|
160
|
+
template = 'MMM d, yyyy';
|
161
|
+
break;
|
162
|
+
|
163
|
+
default:
|
164
|
+
template = configuration.dateFormat;
|
165
|
+
break;
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
169
|
+
switch (configuration.selection) {
|
170
|
+
case 'single':
|
171
|
+
{
|
172
|
+
if (selection instanceof Date) {
|
173
|
+
return format(selection, template);
|
174
|
+
} else if (Array.isArray(selection)) {
|
175
|
+
return format(selection[0], template);
|
176
|
+
} else if (isRangeSelection(selection)) {
|
177
|
+
return format(selection.from, template);
|
178
|
+
} else {
|
179
|
+
return 'Invalid Selection';
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
case 'multi':
|
184
|
+
{
|
185
|
+
if (Array.isArray(selection)) {
|
186
|
+
if (selection.length > 3) return `${selection.length} Selected`;
|
187
|
+
const formatted = selection.map(d => format(d, template)).join(', ');
|
188
|
+
return formatted;
|
189
|
+
} else if (selection instanceof Date) {
|
190
|
+
return [selection].map(d => format(d, template)).join(', ');
|
191
|
+
} else if (isRangeSelection(selection)) {
|
192
|
+
return [selection.to, selection.from].map(d => d ? format(d, template) : '').join(', ');
|
193
|
+
} else {
|
194
|
+
return 'Invalid Selection';
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
case 'range':
|
199
|
+
{
|
200
|
+
if (isRangeSelection(selection)) {
|
201
|
+
return Object.entries(selection).map(([_, date]) => date ? format(date, template) : '').join(' - ');
|
202
|
+
} else if (selection instanceof Date) {
|
203
|
+
return Object.entries({
|
204
|
+
from: selection,
|
205
|
+
to: null
|
206
|
+
}).map(([_, date]) => date ? format(date, template) : '').join(' - ');
|
207
|
+
} else if (Array.isArray(selection)) {
|
208
|
+
return Object.entries({
|
209
|
+
from: selection[0],
|
210
|
+
to: selection[1]
|
211
|
+
}) // to date can still be null
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
213
|
+
.map(([_, date]) => date ? format(date, template) : '').join(' - ');
|
214
|
+
} else {
|
215
|
+
return 'Invalid Selection';
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
default:
|
220
|
+
{
|
221
|
+
return 'Invalid Configuration';
|
222
|
+
}
|
223
|
+
}
|
224
|
+
}, [configuration.dateFormat, configuration.placeholder, configuration.selection, selection]);
|
225
|
+
const handleSave = useCallback(updatedSelection => {
|
226
|
+
setPreviousSelection(updatedSelection);
|
227
|
+
closePicker === null || closePicker === void 0 ? void 0 : closePicker();
|
228
|
+
}, [closePicker]);
|
229
|
+
const selectionHandler = useCallback(date => {
|
230
|
+
if (configuration.selection === 'multi') {
|
231
|
+
const selections = [...selection];
|
232
|
+
const existingIndex = selections.findIndex(s => isEqual(s, date));
|
233
|
+
|
234
|
+
if (existingIndex > -1) {
|
235
|
+
selections.splice(existingIndex, 1);
|
236
|
+
setSelection(selections.sort((a, b) => a.getTime() - b.getTime()));
|
237
|
+
} else {
|
238
|
+
setSelection([...selections, date].sort((a, b) => a.getTime() - b.getTime()));
|
239
|
+
}
|
240
|
+
} else if (configuration.selection === 'range') {
|
241
|
+
if (selection && isRangeSelection(selection) && !selection.to) {
|
242
|
+
const updatedSelection = isBefore(date, selection.from) ? {
|
243
|
+
from: date,
|
244
|
+
to: selection.from
|
245
|
+
} : {
|
246
|
+
from: selection.from,
|
247
|
+
to: date
|
248
|
+
};
|
249
|
+
setSelection(updatedSelection);
|
250
|
+
|
251
|
+
if (!configuration.confirmation) {
|
252
|
+
handleSave(updatedSelection);
|
253
|
+
}
|
254
|
+
} else {
|
255
|
+
setSelection({
|
256
|
+
from: date,
|
257
|
+
to: null
|
258
|
+
});
|
259
|
+
}
|
260
|
+
} else {
|
261
|
+
setSelection(date);
|
262
|
+
|
263
|
+
if (!configuration.confirmation) {
|
264
|
+
handleSave(date);
|
265
|
+
}
|
266
|
+
}
|
267
|
+
}, [configuration.confirmation, configuration.selection, handleSave, selection]);
|
268
|
+
const focusHnadler = useCallback(date => {
|
269
|
+
if (!selection) return;
|
270
|
+
|
271
|
+
if (configuration.selection === 'range' && isRangeSelection(selection)) {
|
272
|
+
setHoverRange(isBefore(date, selection.from) ? {
|
273
|
+
from: date,
|
274
|
+
to: selection.from
|
275
|
+
} : {
|
276
|
+
from: selection.from,
|
277
|
+
to: date
|
278
|
+
});
|
279
|
+
}
|
280
|
+
}, [configuration.selection, selection]);
|
281
|
+
const blurHnadler = useCallback(date => {
|
282
|
+
if (!selection || !hoverRange) return;
|
283
|
+
|
284
|
+
if (configuration.selection === 'range' && isRangeSelection(selection) && (hoverRange.from === date || hoverRange.to === date)) {
|
285
|
+
setHoverRange(null);
|
286
|
+
}
|
287
|
+
}, [configuration.selection, hoverRange, selection]);
|
288
|
+
const revertValue = useCallback(() => {
|
289
|
+
setSelection(previousSelection);
|
290
|
+
}, [previousSelection]);
|
291
|
+
const datePickerCtx = useMemo(() => {
|
292
|
+
return {
|
293
|
+
configuration,
|
294
|
+
disabled: false,
|
295
|
+
formattedDate: getFormattedDate,
|
296
|
+
onDayBlur: blurHnadler,
|
297
|
+
onDayFocus: focusHnadler,
|
298
|
+
onSelection: selectionHandler,
|
299
|
+
revertValue,
|
300
|
+
selectionActive: false,
|
301
|
+
selection
|
302
|
+
};
|
303
|
+
}, [blurHnadler, configuration, focusHnadler, getFormattedDate, revertValue, selection, selectionHandler]);
|
304
|
+
return /*#__PURE__*/React.createElement(DatePickerContext.Provider, {
|
305
|
+
value: datePickerCtx
|
306
|
+
}, children);
|
307
|
+
};
|
308
|
+
DatePickerProvider.displayName = "DatePickerProvider";
|
@@ -32,12 +32,14 @@ declare const _default: React.ForwardRefExoticComponent<Pick<SelectMenuInternalP
|
|
32
32
|
Divider: import("styled-components").StyledComponent<"div", any, SystemCommonProps & SxProp, never>;
|
33
33
|
Filter: React.ForwardRefExoticComponent<Pick<{
|
34
34
|
value?: string | undefined;
|
35
|
-
} & Pick<Omit<Pick<{
|
35
|
+
} & Pick<Omit<Pick<({
|
36
36
|
[x: string]: any;
|
37
37
|
[x: number]: any;
|
38
38
|
} & {
|
39
39
|
theme?: any;
|
40
|
-
} & {
|
40
|
+
} & ({} | {
|
41
|
+
children?: React.ReactNode;
|
42
|
+
})) & {
|
41
43
|
as?: string | React.ComponentType<any> | undefined;
|
42
44
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
43
45
|
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
|
@@ -32,12 +32,14 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
32
32
|
* Whether the remove buttons should be rendered in the tokens
|
33
33
|
*/
|
34
34
|
hideTokenRemoveButtons?: boolean | undefined;
|
35
|
-
} & Pick<Omit<Pick<{
|
35
|
+
} & Pick<Omit<Pick<({
|
36
36
|
[x: string]: any;
|
37
37
|
[x: number]: any;
|
38
38
|
} & {
|
39
39
|
theme?: any;
|
40
|
-
} & {
|
40
|
+
} & ({} | {
|
41
|
+
children?: React.ReactNode;
|
42
|
+
})) & {
|
41
43
|
as?: string | React.ComponentType<any> | undefined;
|
42
44
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
43
45
|
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
|
@@ -9,8 +9,7 @@ import Token from './Token/Token';
|
|
9
9
|
import { useProvidedRefOrCreate } from './hooks';
|
10
10
|
import UnstyledTextInput from './_UnstyledTextInput';
|
11
11
|
import TextInputWrapper from './_TextInputWrapper';
|
12
|
-
import Box from './Box';
|
13
|
-
import { isFocusable } from './utils/iterateFocusableElements'; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
12
|
+
import Box from './Box'; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
14
13
|
|
15
14
|
// using forwardRef is important so that other components (ex. Autocomplete) can use the ref
|
16
15
|
function TextInputWithTokensInnerComponent({
|
@@ -77,25 +76,14 @@ function TextInputWithTokensInnerComponent({
|
|
77
76
|
}, [selectedTokenIndex]);
|
78
77
|
|
79
78
|
const handleTokenRemove = tokenId => {
|
80
|
-
onTokenRemove(tokenId);
|
79
|
+
onTokenRemove(tokenId);
|
81
80
|
|
82
|
-
|
83
|
-
var _containerRef$current2
|
81
|
+
if (selectedTokenIndex) {
|
82
|
+
var _containerRef$current2;
|
84
83
|
|
85
|
-
const nextElementToFocus = (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.children[selectedTokenIndex
|
86
|
-
|
87
|
-
|
88
|
-
const firstFocusable = nextElementToFocus && isFocusable(nextElementToFocus) ? nextElementToFocus : Array.from(((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.children) || []).find(el => isFocusable(el));
|
89
|
-
|
90
|
-
if (firstFocusable) {
|
91
|
-
firstFocusable.focus();
|
92
|
-
} else {
|
93
|
-
var _ref$current;
|
94
|
-
|
95
|
-
// if there are no tokens left, focus the input
|
96
|
-
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
97
|
-
}
|
98
|
-
}, 0);
|
84
|
+
const nextElementToFocus = (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.children[selectedTokenIndex];
|
85
|
+
nextElementToFocus.focus();
|
86
|
+
}
|
99
87
|
};
|
100
88
|
|
101
89
|
const handleTokenFocus = tokenIndex => () => {
|
@@ -108,9 +96,9 @@ function TextInputWithTokensInnerComponent({
|
|
108
96
|
|
109
97
|
const handleTokenKeyUp = e => {
|
110
98
|
if (e.key === 'Escape') {
|
111
|
-
var _ref$
|
99
|
+
var _ref$current;
|
112
100
|
|
113
|
-
(_ref$
|
101
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
114
102
|
}
|
115
103
|
};
|
116
104
|
|
@@ -120,13 +108,13 @@ function TextInputWithTokensInnerComponent({
|
|
120
108
|
};
|
121
109
|
|
122
110
|
const handleInputKeyDown = e => {
|
123
|
-
var _ref$
|
111
|
+
var _ref$current2;
|
124
112
|
|
125
113
|
if (onKeyDown) {
|
126
114
|
onKeyDown(e);
|
127
115
|
}
|
128
116
|
|
129
|
-
if ((_ref$
|
117
|
+
if ((_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && _ref$current2.value) {
|
130
118
|
return;
|
131
119
|
}
|
132
120
|
|
@@ -147,9 +135,9 @@ function TextInputWithTokensInnerComponent({
|
|
147
135
|
|
148
136
|
|
149
137
|
setTimeout(() => {
|
150
|
-
var _ref$
|
138
|
+
var _ref$current3;
|
151
139
|
|
152
|
-
(_ref$
|
140
|
+
(_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.select();
|
153
141
|
}, 0);
|
154
142
|
}
|
155
143
|
};
|
package/lib-esm/theme-preval.js
CHANGED
@@ -515,7 +515,7 @@ module.exports = {
|
|
515
515
|
}
|
516
516
|
}
|
517
517
|
},
|
518
|
-
"
|
518
|
+
"light_colorblind": {
|
519
519
|
"colors": {
|
520
520
|
"canvasDefaultTransparent": "rgba(255,255,255,0)",
|
521
521
|
"marketingIcon": {
|
@@ -2456,7 +2456,7 @@ module.exports = {
|
|
2456
2456
|
}
|
2457
2457
|
}
|
2458
2458
|
},
|
2459
|
-
"
|
2459
|
+
"dark_colorblind": {
|
2460
2460
|
"colors": {
|
2461
2461
|
"canvasDefaultTransparent": "rgba(13,17,23,0)",
|
2462
2462
|
"marketingIcon": {
|
@@ -53,7 +53,7 @@ export declare function render(component: React.ReactElement, theme?: {
|
|
53
53
|
xlarge: string;
|
54
54
|
};
|
55
55
|
space: string[];
|
56
|
-
colorSchemes: Record<"light" | "
|
56
|
+
colorSchemes: Record<"light" | "light_colorblind" | "dark" | "dark_dimmed" | "dark_high_contrast" | "dark_colorblind", Record<"colors" | "shadows", Partial<{
|
57
57
|
canvasDefaultTransparent: string;
|
58
58
|
marketingIcon: {
|
59
59
|
primary: string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@primer/components",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-2021922204627",
|
4
4
|
"description": "Primer react components",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "lib-esm/index.js",
|
@@ -43,20 +43,16 @@
|
|
43
43
|
"author": "GitHub, Inc.",
|
44
44
|
"license": "MIT",
|
45
45
|
"dependencies": {
|
46
|
-
"@primer/octicons-react": "^
|
47
|
-
"@primer/primitives": "
|
46
|
+
"@primer/octicons-react": "^16.1.0",
|
47
|
+
"@primer/primitives": "6.0.0",
|
48
48
|
"@radix-ui/react-polymorphic": "0.0.14",
|
49
49
|
"@react-aria/ssr": "3.1.0",
|
50
50
|
"@styled-system/css": "5.1.5",
|
51
51
|
"@styled-system/props": "5.1.5",
|
52
52
|
"@styled-system/theme-get": "5.1.2",
|
53
|
-
"@types/history": "4.7.8",
|
54
|
-
"@types/styled-components": "5.1.11",
|
55
|
-
"@types/styled-system": "5.1.12",
|
56
|
-
"@types/styled-system__css": "5.0.16",
|
57
|
-
"@types/styled-system__theme-get": "5.0.1",
|
58
53
|
"classnames": "2.3.1",
|
59
54
|
"color2k": "1.2.4",
|
55
|
+
"date-fns": "2.25.0",
|
60
56
|
"deepmerge": "4.2.2",
|
61
57
|
"focus-visible": "5.2.0",
|
62
58
|
"styled-system": "5.1.5"
|
@@ -85,6 +81,11 @@
|
|
85
81
|
"@testing-library/react": "11.2.7",
|
86
82
|
"@testing-library/react-hooks": "7.0.2",
|
87
83
|
"@testing-library/user-event": "13.1.9",
|
84
|
+
"@types/history": "4.7.9",
|
85
|
+
"@types/styled-components": "5.1.15",
|
86
|
+
"@types/styled-system": "5.1.13",
|
87
|
+
"@types/styled-system__css": "5.0.16",
|
88
|
+
"@types/styled-system__theme-get": "5.0.1",
|
88
89
|
"@types/chroma-js": "2.1.3",
|
89
90
|
"@types/enzyme": "3.10.9",
|
90
91
|
"@types/jest": "26.0.23",
|