@primer/components 0.0.0-202191916821 → 0.0.0-2021920152952
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 -17
- package/codemods/deprecateUtilityComponents.js +1 -1
- package/dist/browser.esm.js +768 -878
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +773 -883
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.js +1 -1
- package/lib/ActionList/List.d.ts +1 -2
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +1 -2
- package/lib/AnchoredOverlay/AnchoredOverlay.js +3 -11
- package/lib/BaseStyles.js +1 -1
- package/lib/BorderBox.js +1 -1
- package/lib/Button/ButtonInvisible.js +1 -1
- package/lib/Caret.js +2 -2
- package/lib/DatePicker/DatePicker.d.ts +47 -0
- package/lib/DatePicker/DatePicker.js +76 -0
- package/lib/DatePicker/DatePickerAnchor.d.ts +10 -0
- package/lib/DatePicker/DatePickerAnchor.js +83 -0
- package/lib/DatePicker/DatePickerPanel.d.ts +2 -0
- package/lib/DatePicker/DatePickerPanel.js +38 -0
- package/lib/DatePicker/Day.d.ts +13 -0
- package/lib/DatePicker/Day.js +136 -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 +51 -0
- package/lib/DatePicker/useDatePicker.js +133 -0
- package/lib/Dialog.js +1 -1
- package/lib/FilteredActionList/FilteredActionList.js +31 -5
- package/lib/Flash.js +16 -16
- package/lib/Label.js +1 -1
- package/lib/Overlay.d.ts +0 -1
- package/lib/Overlay.js +1 -3
- package/lib/ProgressBar.js +1 -1
- package/lib/SelectMenu/SelectMenu.d.ts +10 -10
- package/lib/StateLabel.js +19 -13
- package/lib/TextInput.d.ts +13 -5
- package/lib/TextInput.js +46 -4
- package/lib/hooks/useOpenAndCloseFocus.d.ts +1 -2
- package/lib/hooks/useOpenAndCloseFocus.js +2 -7
- package/lib/hooks/useOverlay.d.ts +1 -2
- package/lib/hooks/useOverlay.js +2 -4
- package/lib/index.d.ts +0 -6
- package/lib/index.js +0 -44
- package/lib/theme-preval.js +3105 -375
- package/lib/utils/testing.d.ts +493 -50
- package/{lib-esm/utils/types/AriaRole.d.ts → lib/utils/types.d.ts} +13 -0
- package/lib/utils/{types/AriaRole.js → types.js} +0 -0
- package/lib-esm/ActionList/Item.js +1 -1
- package/lib-esm/ActionList/List.d.ts +1 -2
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +1 -2
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +3 -11
- package/lib-esm/BaseStyles.js +1 -1
- package/lib-esm/BorderBox.js +1 -1
- package/lib-esm/Button/ButtonInvisible.js +1 -1
- package/lib-esm/Caret.js +2 -2
- package/lib-esm/DatePicker/DatePicker.d.ts +47 -0
- package/lib-esm/DatePicker/DatePicker.js +57 -0
- package/lib-esm/DatePicker/DatePickerAnchor.d.ts +10 -0
- package/lib-esm/DatePicker/DatePickerAnchor.js +59 -0
- package/lib-esm/DatePicker/DatePickerPanel.d.ts +2 -0
- package/lib-esm/DatePicker/DatePickerPanel.js +20 -0
- package/lib-esm/DatePicker/Day.d.ts +13 -0
- package/lib-esm/DatePicker/Day.js +113 -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 +51 -0
- package/lib-esm/DatePicker/useDatePicker.js +114 -0
- package/lib-esm/Dialog.js +1 -1
- package/lib-esm/FilteredActionList/FilteredActionList.js +31 -3
- package/lib-esm/Flash.js +16 -16
- package/lib-esm/Label.js +1 -1
- package/lib-esm/Overlay.d.ts +0 -1
- package/lib-esm/Overlay.js +1 -3
- package/lib-esm/ProgressBar.js +1 -1
- package/lib-esm/SelectMenu/SelectMenu.d.ts +10 -10
- package/lib-esm/StateLabel.js +19 -13
- package/lib-esm/TextInput.d.ts +13 -5
- package/lib-esm/TextInput.js +37 -4
- package/lib-esm/hooks/useOpenAndCloseFocus.d.ts +1 -2
- package/lib-esm/hooks/useOpenAndCloseFocus.js +2 -7
- package/lib-esm/hooks/useOverlay.d.ts +1 -2
- package/lib-esm/hooks/useOverlay.js +2 -4
- package/lib-esm/index.d.ts +0 -6
- package/lib-esm/index.js +0 -4
- package/lib-esm/theme-preval.js +3105 -375
- package/lib-esm/utils/testing.d.ts +493 -50
- package/{lib/utils/types/AriaRole.d.ts → lib-esm/utils/types.d.ts} +13 -0
- package/lib-esm/utils/{types/AriaRole.js → types.js} +0 -0
- package/package.json +4 -4
- package/lib/ActionList2/Description.d.ts +0 -5
- package/lib/ActionList2/Description.js +0 -45
- package/lib/ActionList2/Divider.d.ts +0 -8
- package/lib/ActionList2/Divider.js +0 -42
- package/lib/ActionList2/Group.d.ts +0 -8
- package/lib/ActionList2/Group.js +0 -39
- package/lib/ActionList2/Header.d.ts +0 -26
- package/lib/ActionList2/Header.js +0 -55
- package/lib/ActionList2/Item.d.ts +0 -52
- package/lib/ActionList2/Item.js +0 -171
- package/lib/ActionList2/List.d.ts +0 -18
- package/lib/ActionList2/List.js +0 -52
- package/lib/ActionList2/Selection.d.ts +0 -5
- package/lib/ActionList2/Selection.js +0 -67
- package/lib/ActionList2/Visuals.d.ts +0 -12
- package/lib/ActionList2/Visuals.js +0 -87
- package/lib/ActionList2/hacks.d.ts +0 -30
- package/lib/ActionList2/hacks.js +0 -38
- package/lib/ActionList2/index.d.ts +0 -26
- package/lib/ActionList2/index.js +0 -36
- package/lib/Autocomplete/Autocomplete.d.ts +0 -304
- package/lib/Autocomplete/Autocomplete.js +0 -145
- package/lib/Autocomplete/AutocompleteContext.d.ts +0 -17
- package/lib/Autocomplete/AutocompleteContext.js +0 -11
- package/lib/Autocomplete/AutocompleteInput.d.ts +0 -292
- package/lib/Autocomplete/AutocompleteInput.js +0 -157
- package/lib/Autocomplete/AutocompleteMenu.d.ts +0 -72
- package/lib/Autocomplete/AutocompleteMenu.js +0 -224
- package/lib/Autocomplete/AutocompleteOverlay.d.ts +0 -20
- package/lib/Autocomplete/AutocompleteOverlay.js +0 -80
- package/lib/Autocomplete/index.d.ts +0 -2
- package/lib/Autocomplete/index.js +0 -15
- package/lib/TextInputWithTokens.d.ts +0 -323
- package/lib/TextInputWithTokens.js +0 -245
- package/lib/Token/AvatarToken.d.ts +0 -7
- package/lib/Token/AvatarToken.js +0 -64
- package/lib/Token/IssueLabelToken.d.ts +0 -14
- package/lib/Token/IssueLabelToken.js +0 -144
- package/lib/Token/Token.d.ts +0 -15
- package/lib/Token/Token.js +0 -94
- package/lib/Token/TokenBase.d.ts +0 -31
- package/lib/Token/TokenBase.js +0 -108
- package/lib/Token/_RemoveTokenButton.d.ts +0 -12
- package/lib/Token/_RemoveTokenButton.js +0 -77
- package/lib/Token/_TokenTextContainer.d.ts +0 -3
- package/lib/Token/_TokenTextContainer.js +0 -17
- package/lib/Token/index.d.ts +0 -3
- package/lib/Token/index.js +0 -31
- package/lib/_TextInputWrapper.d.ts +0 -10
- package/lib/_TextInputWrapper.js +0 -51
- package/lib/_UnstyledTextInput.d.ts +0 -2
- package/lib/_UnstyledTextInput.js +0 -20
- package/lib/behaviors/scrollIntoViewingArea.d.ts +0 -1
- package/lib/behaviors/scrollIntoViewingArea.js +0 -39
- package/lib/utils/create-slots.d.ts +0 -15
- package/lib/utils/create-slots.js +0 -101
- package/lib/utils/types/ComponentProps.d.ts +0 -9
- package/lib/utils/types/ComponentProps.js +0 -1
- package/lib/utils/types/Flatten.d.ts +0 -4
- package/lib/utils/types/Flatten.js +0 -1
- package/lib/utils/types/MandateProps.d.ts +0 -3
- package/lib/utils/types/MandateProps.js +0 -1
- package/lib/utils/types/Merge.d.ts +0 -19
- package/lib/utils/types/Merge.js +0 -1
- package/lib/utils/types/index.d.ts +0 -5
- package/lib/utils/types/index.js +0 -70
- package/lib/utils/use-force-update.d.ts +0 -1
- package/lib/utils/use-force-update.js +0 -19
- package/lib-esm/ActionList2/Description.d.ts +0 -5
- package/lib-esm/ActionList2/Description.js +0 -30
- package/lib-esm/ActionList2/Divider.d.ts +0 -8
- package/lib-esm/ActionList2/Divider.js +0 -30
- package/lib-esm/ActionList2/Group.d.ts +0 -8
- package/lib-esm/ActionList2/Group.js +0 -29
- package/lib-esm/ActionList2/Header.d.ts +0 -26
- package/lib-esm/ActionList2/Header.js +0 -45
- package/lib-esm/ActionList2/Item.d.ts +0 -52
- package/lib-esm/ActionList2/Item.js +0 -172
- package/lib-esm/ActionList2/List.d.ts +0 -18
- package/lib-esm/ActionList2/List.js +0 -42
- package/lib-esm/ActionList2/Selection.d.ts +0 -5
- package/lib-esm/ActionList2/Selection.js +0 -50
- package/lib-esm/ActionList2/Visuals.d.ts +0 -12
- package/lib-esm/ActionList2/Visuals.js +0 -66
- package/lib-esm/ActionList2/hacks.d.ts +0 -30
- package/lib-esm/ActionList2/hacks.js +0 -30
- package/lib-esm/ActionList2/index.d.ts +0 -26
- package/lib-esm/ActionList2/index.js +0 -23
- package/lib-esm/Autocomplete/Autocomplete.d.ts +0 -304
- package/lib-esm/Autocomplete/Autocomplete.js +0 -123
- package/lib-esm/Autocomplete/AutocompleteContext.d.ts +0 -17
- package/lib-esm/Autocomplete/AutocompleteContext.js +0 -2
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +0 -292
- package/lib-esm/Autocomplete/AutocompleteInput.js +0 -138
- package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +0 -72
- package/lib-esm/Autocomplete/AutocompleteMenu.js +0 -205
- package/lib-esm/Autocomplete/AutocompleteOverlay.d.ts +0 -20
- package/lib-esm/Autocomplete/AutocompleteOverlay.js +0 -62
- package/lib-esm/Autocomplete/index.d.ts +0 -2
- package/lib-esm/Autocomplete/index.js +0 -1
- package/lib-esm/TextInputWithTokens.d.ts +0 -323
- package/lib-esm/TextInputWithTokens.js +0 -220
- package/lib-esm/Token/AvatarToken.d.ts +0 -7
- package/lib-esm/Token/AvatarToken.js +0 -43
- package/lib-esm/Token/IssueLabelToken.d.ts +0 -14
- package/lib-esm/Token/IssueLabelToken.js +0 -124
- package/lib-esm/Token/Token.d.ts +0 -15
- package/lib-esm/Token/Token.js +0 -73
- package/lib-esm/Token/TokenBase.d.ts +0 -31
- package/lib-esm/Token/TokenBase.js +0 -87
- package/lib-esm/Token/_RemoveTokenButton.d.ts +0 -12
- package/lib-esm/Token/_RemoveTokenButton.js +0 -60
- package/lib-esm/Token/_TokenTextContainer.d.ts +0 -3
- package/lib-esm/Token/_TokenTextContainer.js +0 -6
- package/lib-esm/Token/index.d.ts +0 -3
- package/lib-esm/Token/index.js +0 -3
- package/lib-esm/_TextInputWrapper.d.ts +0 -10
- package/lib-esm/_TextInputWrapper.js +0 -31
- package/lib-esm/_UnstyledTextInput.d.ts +0 -2
- package/lib-esm/_UnstyledTextInput.js +0 -7
- package/lib-esm/behaviors/scrollIntoViewingArea.d.ts +0 -1
- package/lib-esm/behaviors/scrollIntoViewingArea.js +0 -30
- package/lib-esm/utils/create-slots.d.ts +0 -15
- package/lib-esm/utils/create-slots.js +0 -80
- package/lib-esm/utils/types/ComponentProps.d.ts +0 -9
- package/lib-esm/utils/types/ComponentProps.js +0 -1
- package/lib-esm/utils/types/Flatten.d.ts +0 -4
- package/lib-esm/utils/types/Flatten.js +0 -1
- package/lib-esm/utils/types/MandateProps.d.ts +0 -3
- package/lib-esm/utils/types/MandateProps.js +0 -1
- package/lib-esm/utils/types/Merge.d.ts +0 -19
- package/lib-esm/utils/types/Merge.js +0 -1
- package/lib-esm/utils/types/index.d.ts +0 -5
- package/lib-esm/utils/types/index.js +0 -5
- package/lib-esm/utils/use-force-update.d.ts +0 -1
- package/lib-esm/utils/use-force-update.js +0 -6
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "DatePicker", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _DatePicker.DatePicker;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
|
13
|
+
var _DatePicker = require("./DatePicker");
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
export interface DatePickerConfiguration {
|
3
|
+
anchorStyle?: 'input' | 'full-date' | 'icon-only';
|
4
|
+
blockedDates?: Array<Date>;
|
5
|
+
confirmation?: boolean;
|
6
|
+
contiguousSelection?: boolean;
|
7
|
+
dimWeekends?: boolean;
|
8
|
+
minDate?: Date;
|
9
|
+
maxDate?: Date;
|
10
|
+
rangeIncrement?: number;
|
11
|
+
selection?: 'single' | 'multi' | 'range';
|
12
|
+
view?: '1-month' | '2-month';
|
13
|
+
}
|
14
|
+
declare type SingleSelection = {
|
15
|
+
date: Date;
|
16
|
+
};
|
17
|
+
declare type BaseRangeSelection = {
|
18
|
+
from: Date;
|
19
|
+
};
|
20
|
+
declare type RangeSelection = {
|
21
|
+
to: Date;
|
22
|
+
} & BaseRangeSelection;
|
23
|
+
declare type SoftRangeSelection = {
|
24
|
+
to?: Date;
|
25
|
+
} & BaseRangeSelection;
|
26
|
+
export interface DatePickerContext {
|
27
|
+
configuration: DatePickerConfiguration;
|
28
|
+
selection?: SingleSelection | Array<SingleSelection> | RangeSelection | null;
|
29
|
+
softSelection?: SingleSelection | SoftRangeSelection | null;
|
30
|
+
selectionActive?: boolean;
|
31
|
+
onSelection: (date: Date) => void;
|
32
|
+
onDayFocus: (date: Date) => void;
|
33
|
+
onDayBlur: () => void;
|
34
|
+
}
|
35
|
+
export declare const useDatePicker: (date?: Date | undefined) => {
|
36
|
+
blocked: boolean | undefined;
|
37
|
+
disabled: boolean;
|
38
|
+
selected: boolean | undefined;
|
39
|
+
configuration: DatePickerConfiguration;
|
40
|
+
selection?: SingleSelection | RangeSelection | SingleSelection[] | null | undefined;
|
41
|
+
softSelection?: SingleSelection | SoftRangeSelection | null | undefined;
|
42
|
+
selectionActive?: boolean | undefined;
|
43
|
+
onSelection: (date: Date) => void;
|
44
|
+
onDayFocus: (date: Date) => void;
|
45
|
+
onDayBlur: () => void;
|
46
|
+
};
|
47
|
+
export interface DatePickerProviderProps {
|
48
|
+
configuration?: DatePickerConfiguration;
|
49
|
+
}
|
50
|
+
export declare const DatePickerProvider: React.FC<DatePickerProviderProps>;
|
51
|
+
export {};
|
@@ -0,0 +1,133 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.DatePickerProvider = exports.useDatePicker = void 0;
|
7
|
+
|
8
|
+
var _dateFns = require("date-fns");
|
9
|
+
|
10
|
+
var _esm = require("date-fns/esm");
|
11
|
+
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
13
|
+
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
15
|
+
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
17
|
+
|
18
|
+
const DatePickerContext = /*#__PURE__*/(0, _react.createContext)(null);
|
19
|
+
|
20
|
+
const useDatePicker = date => {
|
21
|
+
const value = (0, _react.useContext)(DatePickerContext);
|
22
|
+
|
23
|
+
if (!value) {
|
24
|
+
throw new Error('useDatePicker must be used inside a DatePickerProvider');
|
25
|
+
}
|
26
|
+
|
27
|
+
let selected,
|
28
|
+
blocked,
|
29
|
+
disabled = false;
|
30
|
+
|
31
|
+
if (date) {
|
32
|
+
if (Array.isArray(value.selection)) {
|
33
|
+
selected = !!value.selection.find(d => (0, _dateFns.isEqual)(d.date, date));
|
34
|
+
} // Determine if date is blocked out
|
35
|
+
|
36
|
+
|
37
|
+
if (value.configuration.blockedDates) {
|
38
|
+
blocked = !!value.configuration.blockedDates.find(d => (0, _dateFns.isEqual)(d, date));
|
39
|
+
} // Determine if date is disabled
|
40
|
+
|
41
|
+
|
42
|
+
if (value.configuration.minDate || value.configuration.maxDate) {
|
43
|
+
disabled = (value.configuration.minDate ? (0, _esm.isBefore)(date, value.configuration.minDate) : false) || (value.configuration.maxDate ? (0, _esm.isAfter)(date, value.configuration.maxDate) : false);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
return { ...value,
|
48
|
+
blocked,
|
49
|
+
disabled,
|
50
|
+
selected
|
51
|
+
};
|
52
|
+
};
|
53
|
+
|
54
|
+
exports.useDatePicker = useDatePicker;
|
55
|
+
|
56
|
+
function isRangeSelection(selection) {
|
57
|
+
return !!selection.from;
|
58
|
+
}
|
59
|
+
|
60
|
+
const DatePickerProvider = ({
|
61
|
+
configuration,
|
62
|
+
children
|
63
|
+
}) => {
|
64
|
+
const [selection, setSelection] = (0, _react.useState)(null);
|
65
|
+
const [softSelection, setSoftSelection] = (0, _react.useState)(null);
|
66
|
+
const selectionHandler = (0, _react.useCallback)(date => {
|
67
|
+
if ((configuration === null || configuration === void 0 ? void 0 : configuration.selection) === 'single') {
|
68
|
+
setSelection({
|
69
|
+
date
|
70
|
+
});
|
71
|
+
} else if ((configuration === null || configuration === void 0 ? void 0 : configuration.selection) === 'range') {
|
72
|
+
if (softSelection && isRangeSelection(softSelection)) {
|
73
|
+
setSelection({
|
74
|
+
from: softSelection.from,
|
75
|
+
to: date
|
76
|
+
});
|
77
|
+
} else {
|
78
|
+
setSoftSelection({
|
79
|
+
from: date,
|
80
|
+
to: date
|
81
|
+
});
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}, [configuration === null || configuration === void 0 ? void 0 : configuration.selection, softSelection]);
|
85
|
+
const focusHnadler = (0, _react.useCallback)(date => {
|
86
|
+
if ((configuration === null || configuration === void 0 ? void 0 : configuration.selection) === 'single' || !softSelection) {
|
87
|
+
setSoftSelection({
|
88
|
+
date
|
89
|
+
});
|
90
|
+
}
|
91
|
+
|
92
|
+
if ((configuration === null || configuration === void 0 ? void 0 : configuration.selection) === 'range' && softSelection && isRangeSelection(softSelection)) {
|
93
|
+
setSoftSelection({ ...softSelection,
|
94
|
+
to: date
|
95
|
+
});
|
96
|
+
}
|
97
|
+
}, [configuration === null || configuration === void 0 ? void 0 : configuration.selection, softSelection]);
|
98
|
+
const blurHnadler = (0, _react.useCallback)(() => {
|
99
|
+
if ((configuration === null || configuration === void 0 ? void 0 : configuration.selection) === 'single' || !softSelection) {
|
100
|
+
setSoftSelection(null);
|
101
|
+
}
|
102
|
+
|
103
|
+
if ((configuration === null || configuration === void 0 ? void 0 : configuration.selection) === 'range' && softSelection && isRangeSelection(softSelection)) {
|
104
|
+
setSoftSelection({
|
105
|
+
from: softSelection.from
|
106
|
+
});
|
107
|
+
}
|
108
|
+
}, [configuration === null || configuration === void 0 ? void 0 : configuration.selection, softSelection]);
|
109
|
+
const datePickerCtx = (0, _react.useMemo)(() => {
|
110
|
+
return {
|
111
|
+
configuration: {
|
112
|
+
anchorStyle: 'full-date',
|
113
|
+
confirmation: false,
|
114
|
+
contiguousSelection: false,
|
115
|
+
dimWeekends: false,
|
116
|
+
selection: 'single',
|
117
|
+
view: '2-month',
|
118
|
+
...configuration
|
119
|
+
},
|
120
|
+
selectionActive: false,
|
121
|
+
selection,
|
122
|
+
onSelection: selectionHandler,
|
123
|
+
onDayFocus: focusHnadler,
|
124
|
+
onDayBlur: blurHnadler
|
125
|
+
};
|
126
|
+
}, [blurHnadler, configuration, focusHnadler, selection, selectionHandler]);
|
127
|
+
return /*#__PURE__*/_react.default.createElement(DatePickerContext.Provider, {
|
128
|
+
value: datePickerCtx
|
129
|
+
}, children);
|
130
|
+
};
|
131
|
+
|
132
|
+
exports.DatePickerProvider = DatePickerProvider;
|
133
|
+
DatePickerProvider.displayName = "DatePickerProvider";
|
package/lib/Dialog.js
CHANGED
@@ -122,7 +122,7 @@ const Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
122
122
|
}), children)) : null;
|
123
123
|
});
|
124
124
|
DialogHeader.defaultProps = {
|
125
|
-
backgroundColor: '
|
125
|
+
backgroundColor: 'bg.tertiary'
|
126
126
|
};
|
127
127
|
DialogHeader.propTypes = { ..._Box.default.propTypes
|
128
128
|
};
|
@@ -7,8 +7,6 @@ exports.FilteredActionList = FilteredActionList;
|
|
7
7
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
9
9
|
|
10
|
-
var _ssr = require("@react-aria/ssr");
|
11
|
-
|
12
10
|
var _TextInput = _interopRequireDefault(require("../TextInput"));
|
13
11
|
|
14
12
|
var _Box = _interopRequireDefault(require("../Box"));
|
@@ -29,7 +27,7 @@ var _useProvidedRefOrCreate = require("../hooks/useProvidedRefOrCreate");
|
|
29
27
|
|
30
28
|
var _useScrollFlash = _interopRequireDefault(require("../hooks/useScrollFlash"));
|
31
29
|
|
32
|
-
var
|
30
|
+
var _ssr = require("@react-aria/ssr");
|
33
31
|
|
34
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
35
33
|
|
@@ -39,6 +37,34 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
39
37
|
|
40
38
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
41
39
|
|
40
|
+
function scrollIntoViewingArea(child, container, margin = 8, behavior = 'smooth') {
|
41
|
+
const {
|
42
|
+
top: childTop,
|
43
|
+
bottom: childBottom
|
44
|
+
} = child.getBoundingClientRect();
|
45
|
+
const {
|
46
|
+
top: containerTop,
|
47
|
+
bottom: containerBottom
|
48
|
+
} = container.getBoundingClientRect();
|
49
|
+
const isChildTopAboveViewingArea = childTop < containerTop + margin;
|
50
|
+
const isChildBottomBelowViewingArea = childBottom > containerBottom - margin;
|
51
|
+
|
52
|
+
if (isChildTopAboveViewingArea) {
|
53
|
+
const scrollHeightToChildTop = childTop - containerTop + container.scrollTop;
|
54
|
+
container.scrollTo({
|
55
|
+
behavior,
|
56
|
+
top: scrollHeightToChildTop - margin
|
57
|
+
});
|
58
|
+
} else if (isChildBottomBelowViewingArea) {
|
59
|
+
const scrollHeightToChildBottom = childBottom - containerBottom + container.scrollTop;
|
60
|
+
container.scrollTo({
|
61
|
+
behavior,
|
62
|
+
top: scrollHeightToChildBottom + margin
|
63
|
+
});
|
64
|
+
} // either completely in view or outside viewing area on both ends, don't scroll
|
65
|
+
|
66
|
+
}
|
67
|
+
|
42
68
|
const StyledHeader = _styledComponents.default.div.withConfig({
|
43
69
|
displayName: "FilteredActionList__StyledHeader",
|
44
70
|
componentId: "yg3jkv-0"
|
@@ -86,7 +112,7 @@ function FilteredActionList({
|
|
86
112
|
activeDescendantRef.current = current;
|
87
113
|
|
88
114
|
if (current && scrollContainerRef.current && directlyActivated) {
|
89
|
-
|
115
|
+
scrollIntoViewingArea(current, scrollContainerRef.current);
|
90
116
|
}
|
91
117
|
}
|
92
118
|
}, [// List ref isn't set while loading. Need to re-bind focus zone when it changes
|
@@ -94,7 +120,7 @@ function FilteredActionList({
|
|
94
120
|
(0, _react.useEffect)(() => {
|
95
121
|
// if items changed, we want to instantly move active descendant into view
|
96
122
|
if (activeDescendantRef.current && scrollContainerRef.current) {
|
97
|
-
|
123
|
+
scrollIntoViewingArea(activeDescendantRef.current, scrollContainerRef.current, undefined, 'auto');
|
98
124
|
}
|
99
125
|
}, [items]);
|
100
126
|
(0, _useScrollFlash.default)(scrollContainerRef);
|
package/lib/Flash.js
CHANGED
@@ -18,35 +18,35 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
18
18
|
const variants = (0, _styledSystem.variant)({
|
19
19
|
variants: {
|
20
20
|
default: {
|
21
|
-
color: '
|
22
|
-
backgroundColor: '
|
23
|
-
borderColor: '
|
21
|
+
color: 'alert.info.text',
|
22
|
+
backgroundColor: 'alert.info.bg',
|
23
|
+
borderColor: 'alert.info.border',
|
24
24
|
svg: {
|
25
|
-
color: '
|
25
|
+
color: 'alert.info.icon'
|
26
26
|
}
|
27
27
|
},
|
28
28
|
success: {
|
29
|
-
color: '
|
30
|
-
backgroundColor: 'success.
|
31
|
-
borderColor: 'success.
|
29
|
+
color: 'alert.success.text',
|
30
|
+
backgroundColor: 'alert.success.bg',
|
31
|
+
borderColor: 'alert.success.border',
|
32
32
|
svg: {
|
33
|
-
color: 'success.
|
33
|
+
color: 'alert.success.icon'
|
34
34
|
}
|
35
35
|
},
|
36
36
|
danger: {
|
37
|
-
color: '
|
38
|
-
backgroundColor: '
|
39
|
-
borderColor: '
|
37
|
+
color: 'alert.error.text',
|
38
|
+
backgroundColor: 'alert.error.bg',
|
39
|
+
borderColor: 'alert.error.border',
|
40
40
|
svg: {
|
41
|
-
color: '
|
41
|
+
color: 'alert.error.icon'
|
42
42
|
}
|
43
43
|
},
|
44
44
|
warning: {
|
45
|
-
color: '
|
46
|
-
backgroundColor: '
|
47
|
-
borderColor: '
|
45
|
+
color: 'alert.warn.text',
|
46
|
+
backgroundColor: 'alert.warn.bg',
|
47
|
+
borderColor: 'alert.warn.border',
|
48
48
|
svg: {
|
49
|
-
color: '
|
49
|
+
color: 'alert.warn.icon'
|
50
50
|
}
|
51
51
|
}
|
52
52
|
}
|
package/lib/Label.js
CHANGED
@@ -52,7 +52,7 @@ const Label = _styledComponents.default.span.withConfig({
|
|
52
52
|
})(["display:inline-block;font-weight:", ";color:", ";border-radius:", ";&:hover{text-decoration:none;}", " ", " ", " ", " ", ""], (0, _constants.get)('fontWeights.semibold'), (0, _constants.get)('colors.fg.onEmphasis'), (0, _constants.get)('radii.3'), sizeVariant, _constants.COMMON, props => props.dropshadow ? 'box-shadow: inset 0 -1px 0 rgba(27, 31, 35, 0.12)' : '', props => props.outline ? outlineStyles : '', _sx.default);
|
53
53
|
|
54
54
|
Label.defaultProps = {
|
55
|
-
bg: '
|
55
|
+
bg: 'label.primary.border',
|
56
56
|
variant: 'medium'
|
57
57
|
};
|
58
58
|
var _default = Label;
|
package/lib/Overlay.d.ts
CHANGED
@@ -40,7 +40,6 @@ export declare type OverlayProps = {
|
|
40
40
|
top: number;
|
41
41
|
left: number;
|
42
42
|
portalContainerName?: string;
|
43
|
-
preventFocusOnOpen?: boolean;
|
44
43
|
} & Omit<ComponentProps<typeof StyledOverlay>, 'visibility' | keyof SystemPositionProps>;
|
45
44
|
/**
|
46
45
|
* An `Overlay` is a flexible floating surface, used to display transient content such as menus,
|
package/lib/Overlay.js
CHANGED
@@ -113,7 +113,6 @@ const Overlay = /*#__PURE__*/_react.default.forwardRef(({
|
|
113
113
|
left,
|
114
114
|
anchorSide,
|
115
115
|
portalContainerName,
|
116
|
-
preventFocusOnOpen,
|
117
116
|
...rest
|
118
117
|
}, forwardedRef) => {
|
119
118
|
const overlayRef = (0, _react.useRef)(null);
|
@@ -129,8 +128,7 @@ const Overlay = /*#__PURE__*/_react.default.forwardRef(({
|
|
129
128
|
onEscape,
|
130
129
|
ignoreClickRefs,
|
131
130
|
onClickOutside,
|
132
|
-
initialFocusRef
|
133
|
-
preventFocusOnOpen
|
131
|
+
initialFocusRef
|
134
132
|
});
|
135
133
|
(0, _react.useEffect)(() => {
|
136
134
|
var _combinedRef$current;
|
package/lib/ProgressBar.js
CHANGED
@@ -32,15 +32,7 @@ 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<
|
36
|
-
[x: string]: any;
|
37
|
-
[x: number]: any;
|
38
|
-
} & {
|
39
|
-
theme?: any;
|
40
|
-
} & {
|
41
|
-
as?: string | React.ComponentType<any> | undefined;
|
42
|
-
forwardedAs?: string | React.ComponentType<any> | undefined;
|
43
|
-
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
|
35
|
+
} & Pick<{
|
44
36
|
className?: string | undefined;
|
45
37
|
icon?: React.ComponentType<{
|
46
38
|
className?: string | undefined;
|
@@ -315,7 +307,15 @@ declare const _default: React.ForwardRefExoticComponent<Pick<SelectMenuInternalP
|
|
315
307
|
contrast?: boolean | undefined;
|
316
308
|
} & {
|
317
309
|
theme?: any;
|
318
|
-
}, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "sx" | "disabled" | "variant" | "contrast"
|
310
|
+
}, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "sx" | "disabled" | "variant" | "contrast"> & Omit<Pick<{
|
311
|
+
[x: string]: any;
|
312
|
+
[x: number]: any;
|
313
|
+
} & {
|
314
|
+
theme?: any;
|
315
|
+
} & {
|
316
|
+
as?: string | React.ComponentType<any> | undefined;
|
317
|
+
forwardedAs?: string | React.ComponentType<any> | undefined;
|
318
|
+
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast">, string | number | symbol> & React.RefAttributes<HTMLInputElement>, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
|
319
319
|
Footer: import("styled-components").StyledComponent<"footer", any, SystemCommonProps & SxProp, never>;
|
320
320
|
Item: React.ForwardRefExoticComponent<Pick<{
|
321
321
|
as?: React.ElementType<any> | undefined;
|
package/lib/StateLabel.js
CHANGED
@@ -35,28 +35,34 @@ const colorVariants = (0, _styledSystem.variant)({
|
|
35
35
|
prop: 'status',
|
36
36
|
variants: {
|
37
37
|
issueClosed: {
|
38
|
-
backgroundColor: '
|
39
|
-
color: '
|
38
|
+
backgroundColor: 'prState.closed.bg',
|
39
|
+
color: 'prState.closed.text',
|
40
|
+
borderColor: 'prState.closed.border'
|
40
41
|
},
|
41
42
|
pullClosed: {
|
42
|
-
backgroundColor: '
|
43
|
-
color: '
|
43
|
+
backgroundColor: 'prState.closed.bg',
|
44
|
+
color: 'prState.closed.text',
|
45
|
+
borderColor: 'prState.closed.border'
|
44
46
|
},
|
45
47
|
pullMerged: {
|
46
|
-
backgroundColor: '
|
47
|
-
color: '
|
48
|
+
backgroundColor: 'prState.merged.bg',
|
49
|
+
color: 'prState.merged.text',
|
50
|
+
borderColor: 'prState.merged.border'
|
48
51
|
},
|
49
52
|
issueOpened: {
|
50
|
-
backgroundColor: '
|
51
|
-
color: '
|
53
|
+
backgroundColor: 'prState.open.bg',
|
54
|
+
color: 'prState.open.text',
|
55
|
+
borderColor: 'prState.open.border'
|
52
56
|
},
|
53
57
|
pullOpened: {
|
54
|
-
backgroundColor: '
|
55
|
-
color: '
|
58
|
+
backgroundColor: 'prState.open.bg',
|
59
|
+
color: 'prState.open.text',
|
60
|
+
borderColor: 'prState.open.border'
|
56
61
|
},
|
57
62
|
draft: {
|
58
|
-
backgroundColor: '
|
59
|
-
color: '
|
63
|
+
backgroundColor: 'prState.draft.bg',
|
64
|
+
color: 'prState.draft.text',
|
65
|
+
borderColor: 'prState.draft.border'
|
60
66
|
}
|
61
67
|
}
|
62
68
|
});
|
@@ -79,7 +85,7 @@ const sizeVariants = (0, _styledSystem.variant)({
|
|
79
85
|
const StateLabelBase = _styledComponents.default.span.withConfig({
|
80
86
|
displayName: "StateLabel__StateLabelBase",
|
81
87
|
componentId: "k4pd9e-0"
|
82
|
-
})(["display:inline-flex;align-items:center;font-weight:", ";line-height:16px;color:", ";text-align:center;border-radius:", ";", ";", ";", ";", ";"], (0, _constants.get)('fontWeights.bold'), (0, _constants.get)('colors.canvas.default'), (0, _constants.get)('radii.3'), colorVariants, sizeVariants, _constants.COMMON, _sx.default);
|
88
|
+
})(["display:inline-flex;align-items:center;font-weight:", ";line-height:16px;color:", ";text-align:center;border-radius:", ";border-width:1px;border-style:solid;", ";", ";", ";", ";"], (0, _constants.get)('fontWeights.bold'), (0, _constants.get)('colors.canvas.default'), (0, _constants.get)('radii.3'), colorVariants, sizeVariants, _constants.COMMON, _sx.default);
|
83
89
|
|
84
90
|
function StateLabel({
|
85
91
|
children,
|
package/lib/TextInput.d.ts
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
3
|
-
import
|
4
|
-
import
|
2
|
+
import { MaxWidthProps, MinWidthProps, WidthProps } from 'styled-system';
|
3
|
+
import { SxProp } from './sx';
|
4
|
+
import { ComponentProps } from './utils/types';
|
5
|
+
declare const Input: import("styled-components").StyledComponent<"input", any, {}, never>;
|
6
|
+
declare const Wrapper: import("styled-components").StyledComponent<"span", any, {
|
7
|
+
disabled?: boolean | undefined;
|
8
|
+
hasIcon?: boolean | undefined;
|
9
|
+
block?: boolean | undefined;
|
10
|
+
contrast?: boolean | undefined;
|
11
|
+
variant?: "large" | "small" | undefined;
|
12
|
+
} & WidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Width<import("styled-system").TLengthStyledSystem>> & MinWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MinWidth<import("styled-system").TLengthStyledSystem>> & MaxWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>> & SxProp, never>;
|
5
13
|
declare type NonPassthroughProps = {
|
6
14
|
className?: string;
|
7
15
|
icon?: React.ComponentType<{
|
8
16
|
className?: string;
|
9
17
|
}>;
|
10
|
-
} & Pick<ComponentProps<typeof
|
11
|
-
declare type TextInputInternalProps =
|
18
|
+
} & Pick<ComponentProps<typeof Wrapper>, 'block' | 'contrast' | 'disabled' | 'sx' | 'theme' | 'width' | 'maxWidth' | 'minWidth' | 'variant'>;
|
19
|
+
declare type TextInputInternalProps = NonPassthroughProps & Omit<React.ComponentPropsWithoutRef<typeof Input>, keyof NonPassthroughProps>;
|
12
20
|
declare const TextInput: React.ForwardRefExoticComponent<Pick<TextInputInternalProps, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
|
13
21
|
export declare type TextInputProps = ComponentProps<typeof TextInput>;
|
14
22
|
export default TextInput;
|
package/lib/TextInput.js
CHANGED
@@ -9,14 +9,56 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
11
11
|
|
12
|
-
var
|
12
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
13
13
|
|
14
|
-
var
|
14
|
+
var _styledSystem = require("styled-system");
|
15
|
+
|
16
|
+
var _constants = require("./constants");
|
17
|
+
|
18
|
+
var _sx = _interopRequireDefault(require("./sx"));
|
19
|
+
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
21
|
+
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
15
23
|
|
16
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
25
|
|
18
26
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
19
27
|
|
28
|
+
const sizeVariants = (0, _styledSystem.variant)({
|
29
|
+
variants: {
|
30
|
+
small: {
|
31
|
+
minHeight: '28px',
|
32
|
+
px: 2,
|
33
|
+
py: '3px',
|
34
|
+
fontSize: 0,
|
35
|
+
lineHeight: '20px'
|
36
|
+
},
|
37
|
+
large: {
|
38
|
+
px: 2,
|
39
|
+
py: '10px',
|
40
|
+
fontSize: 3
|
41
|
+
}
|
42
|
+
}
|
43
|
+
});
|
44
|
+
|
45
|
+
const Input = _styledComponents.default.input.withConfig({
|
46
|
+
displayName: "TextInput__Input",
|
47
|
+
componentId: "sc-1apmpmt-0"
|
48
|
+
})(["border:0;font-size:inherit;font-family:inherit;background-color:transparent;-webkit-appearance:none;color:inherit;width:100%;&:focus{outline:0;}"]);
|
49
|
+
|
50
|
+
const Wrapper = _styledComponents.default.span.withConfig({
|
51
|
+
displayName: "TextInput__Wrapper",
|
52
|
+
componentId: "sc-1apmpmt-1"
|
53
|
+
})(["display:inline-flex;align-items:stretch;min-height:34px;font-size:", ";line-height:20px;color:", ";vertical-align:middle;background-repeat:no-repeat;background-position:right 8px center;border:1px solid ", ";border-radius:", ";outline:none;box-shadow:", ";", " .TextInput-icon{align-self:center;color:", ";margin:0 ", ";flex-shrink:0;}&:focus-within{border-color:", ";box-shadow:", ";}", " ", " ", " @media (min-width:", "){font-size:", ";}", " ", " ", " ", " ", ";"], (0, _constants.get)('fontSizes.1'), (0, _constants.get)('colors.fg.default'), (0, _constants.get)('colors.border.default'), (0, _constants.get)('radii.2'), (0, _constants.get)('shadows.primer.shadow.inset'), props => {
|
54
|
+
if (props.hasIcon) {
|
55
|
+
return (0, _styledComponents.css)(["padding:0;"]);
|
56
|
+
} else {
|
57
|
+
return (0, _styledComponents.css)(["padding:6px 12px;"]);
|
58
|
+
}
|
59
|
+
}, (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('space.2'), (0, _constants.get)('colors.accent.emphasis'), (0, _constants.get)('shadows.primer.shadow.focus'), props => props.contrast && (0, _styledComponents.css)(["background-color:", ";"], (0, _constants.get)('colors.canvas.inset')), props => props.disabled && (0, _styledComponents.css)(["color:", ";background-color:", ";border-color:", ";"], (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('colors.input.disabledBg'), (0, _constants.get)('colors.border.default')), props => props.block && (0, _styledComponents.css)(["display:block;width:100%;"]), (0, _constants.get)('breakpoints.1'), (0, _constants.get)('fontSizes.1'), _styledSystem.width, _styledSystem.minWidth, _styledSystem.maxWidth, sizeVariants, _sx.default); // Props that are not passed through to Input:
|
60
|
+
|
61
|
+
|
20
62
|
// using forwardRef is important so that other components (ex. SelectMenu) can autofocus the input
|
21
63
|
const TextInput = /*#__PURE__*/_react.default.forwardRef(({
|
22
64
|
icon: IconComponent,
|
@@ -34,7 +76,7 @@ const TextInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
34
76
|
}, ref) => {
|
35
77
|
// this class is necessary to style FilterSearch, plz no touchy!
|
36
78
|
const wrapperClasses = (0, _classnames.default)(className, 'TextInput-wrapper');
|
37
|
-
return /*#__PURE__*/_react.default.createElement(
|
79
|
+
return /*#__PURE__*/_react.default.createElement(Wrapper, {
|
38
80
|
block: block,
|
39
81
|
className: wrapperClasses,
|
40
82
|
contrast: contrast,
|
@@ -48,7 +90,7 @@ const TextInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
48
90
|
variant: variantProp
|
49
91
|
}, IconComponent && /*#__PURE__*/_react.default.createElement(IconComponent, {
|
50
92
|
className: "TextInput-icon"
|
51
|
-
}), /*#__PURE__*/_react.default.createElement(
|
93
|
+
}), /*#__PURE__*/_react.default.createElement(Input, _extends({
|
52
94
|
ref: ref,
|
53
95
|
disabled: disabled
|
54
96
|
}, inputProps)));
|
@@ -3,6 +3,5 @@ export declare type UseOpenAndCloseFocusSettings = {
|
|
3
3
|
initialFocusRef?: React.RefObject<HTMLElement>;
|
4
4
|
containerRef: React.RefObject<HTMLElement>;
|
5
5
|
returnFocusRef: React.RefObject<HTMLElement>;
|
6
|
-
preventFocusOnOpen?: boolean;
|
7
6
|
};
|
8
|
-
export declare function useOpenAndCloseFocus({ initialFocusRef, returnFocusRef, containerRef
|
7
|
+
export declare function useOpenAndCloseFocus({ initialFocusRef, returnFocusRef, containerRef }: UseOpenAndCloseFocusSettings): void;
|
@@ -12,14 +12,9 @@ var _iterateFocusableElements = require("../utils/iterateFocusableElements");
|
|
12
12
|
function useOpenAndCloseFocus({
|
13
13
|
initialFocusRef,
|
14
14
|
returnFocusRef,
|
15
|
-
containerRef
|
16
|
-
preventFocusOnOpen
|
15
|
+
containerRef
|
17
16
|
}) {
|
18
17
|
(0, _react.useEffect)(() => {
|
19
|
-
if (preventFocusOnOpen) {
|
20
|
-
return;
|
21
|
-
}
|
22
|
-
|
23
18
|
const returnRef = returnFocusRef.current;
|
24
19
|
|
25
20
|
if (initialFocusRef && initialFocusRef.current) {
|
@@ -32,5 +27,5 @@ function useOpenAndCloseFocus({
|
|
32
27
|
return function () {
|
33
28
|
returnRef === null || returnRef === void 0 ? void 0 : returnRef.focus();
|
34
29
|
};
|
35
|
-
}, [initialFocusRef, returnFocusRef, containerRef
|
30
|
+
}, [initialFocusRef, returnFocusRef, containerRef]);
|
36
31
|
}
|
@@ -7,9 +7,8 @@ export declare type UseOverlaySettings = {
|
|
7
7
|
onEscape: (e: KeyboardEvent) => void;
|
8
8
|
onClickOutside: (e: TouchOrMouseEvent) => void;
|
9
9
|
overlayRef?: React.RefObject<HTMLDivElement>;
|
10
|
-
preventFocusOnOpen?: boolean;
|
11
10
|
};
|
12
11
|
export declare type OverlayReturnProps = {
|
13
12
|
ref: React.RefObject<HTMLDivElement>;
|
14
13
|
};
|
15
|
-
export declare const useOverlay: ({ overlayRef: _overlayRef, returnFocusRef, initialFocusRef, onEscape, ignoreClickRefs, onClickOutside
|
14
|
+
export declare const useOverlay: ({ overlayRef: _overlayRef, returnFocusRef, initialFocusRef, onEscape, ignoreClickRefs, onClickOutside }: UseOverlaySettings) => OverlayReturnProps;
|
package/lib/hooks/useOverlay.js
CHANGED
@@ -19,15 +19,13 @@ const useOverlay = ({
|
|
19
19
|
initialFocusRef,
|
20
20
|
onEscape,
|
21
21
|
ignoreClickRefs,
|
22
|
-
onClickOutside
|
23
|
-
preventFocusOnOpen
|
22
|
+
onClickOutside
|
24
23
|
}) => {
|
25
24
|
const overlayRef = (0, _useProvidedRefOrCreate.useProvidedRefOrCreate)(_overlayRef);
|
26
25
|
(0, _useOpenAndCloseFocus.useOpenAndCloseFocus)({
|
27
26
|
containerRef: overlayRef,
|
28
27
|
returnFocusRef,
|
29
|
-
initialFocusRef
|
30
|
-
preventFocusOnOpen
|
28
|
+
initialFocusRef
|
31
29
|
});
|
32
30
|
(0, _useOnOutsideClick.useOnOutsideClick)({
|
33
31
|
containerRef: overlayRef,
|