@primer/components 0.0.0-2021919202426 → 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 -19
- package/codemods/deprecateUtilityComponents.js +1 -1
- package/dist/browser.esm.js +768 -879
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +773 -884
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.js +4 -4
- 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/Button.js +1 -1
- package/lib/Button/ButtonInvisible.js +1 -1
- package/lib/Button/ButtonTableList.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/Pagination/Pagination.js +1 -1
- 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 -5
- package/lib/index.js +0 -36
- 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 +4 -4
- 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/Button.js +1 -1
- package/lib-esm/Button/ButtonInvisible.js +1 -1
- package/lib-esm/Button/ButtonTableList.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/Pagination/Pagination.js +1 -1
- 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 -5
- package/lib-esm/index.js +0 -3
- 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/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 -327
- package/lib/TextInputWithTokens.js +0 -298
- 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/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-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 -327
- package/lib-esm/TextInputWithTokens.js +0 -272
- 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/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
@@ -0,0 +1,114 @@
|
|
1
|
+
import { isEqual } from 'date-fns';
|
2
|
+
import { isAfter, isBefore } from 'date-fns/esm';
|
3
|
+
import React, { createContext, useCallback, useContext, useMemo, useState } from 'react';
|
4
|
+
const DatePickerContext = /*#__PURE__*/createContext(null);
|
5
|
+
export const useDatePicker = date => {
|
6
|
+
const value = useContext(DatePickerContext);
|
7
|
+
|
8
|
+
if (!value) {
|
9
|
+
throw new Error('useDatePicker must be used inside a DatePickerProvider');
|
10
|
+
}
|
11
|
+
|
12
|
+
let selected,
|
13
|
+
blocked,
|
14
|
+
disabled = false;
|
15
|
+
|
16
|
+
if (date) {
|
17
|
+
if (Array.isArray(value.selection)) {
|
18
|
+
selected = !!value.selection.find(d => isEqual(d.date, date));
|
19
|
+
} // Determine if date is blocked out
|
20
|
+
|
21
|
+
|
22
|
+
if (value.configuration.blockedDates) {
|
23
|
+
blocked = !!value.configuration.blockedDates.find(d => isEqual(d, date));
|
24
|
+
} // Determine if date is disabled
|
25
|
+
|
26
|
+
|
27
|
+
if (value.configuration.minDate || value.configuration.maxDate) {
|
28
|
+
disabled = (value.configuration.minDate ? isBefore(date, value.configuration.minDate) : false) || (value.configuration.maxDate ? isAfter(date, value.configuration.maxDate) : false);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
return { ...value,
|
33
|
+
blocked,
|
34
|
+
disabled,
|
35
|
+
selected
|
36
|
+
};
|
37
|
+
};
|
38
|
+
|
39
|
+
function isRangeSelection(selection) {
|
40
|
+
return !!selection.from;
|
41
|
+
}
|
42
|
+
|
43
|
+
export const DatePickerProvider = ({
|
44
|
+
configuration,
|
45
|
+
children
|
46
|
+
}) => {
|
47
|
+
const [selection, setSelection] = useState(null);
|
48
|
+
const [softSelection, setSoftSelection] = useState(null);
|
49
|
+
const selectionHandler = useCallback(date => {
|
50
|
+
if ((configuration === null || configuration === void 0 ? void 0 : configuration.selection) === 'single') {
|
51
|
+
setSelection({
|
52
|
+
date
|
53
|
+
});
|
54
|
+
} else if ((configuration === null || configuration === void 0 ? void 0 : configuration.selection) === 'range') {
|
55
|
+
if (softSelection && isRangeSelection(softSelection)) {
|
56
|
+
setSelection({
|
57
|
+
from: softSelection.from,
|
58
|
+
to: date
|
59
|
+
});
|
60
|
+
} else {
|
61
|
+
setSoftSelection({
|
62
|
+
from: date,
|
63
|
+
to: date
|
64
|
+
});
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}, [configuration === null || configuration === void 0 ? void 0 : configuration.selection, softSelection]);
|
68
|
+
const focusHnadler = useCallback(date => {
|
69
|
+
if ((configuration === null || configuration === void 0 ? void 0 : configuration.selection) === 'single' || !softSelection) {
|
70
|
+
setSoftSelection({
|
71
|
+
date
|
72
|
+
});
|
73
|
+
}
|
74
|
+
|
75
|
+
if ((configuration === null || configuration === void 0 ? void 0 : configuration.selection) === 'range' && softSelection && isRangeSelection(softSelection)) {
|
76
|
+
setSoftSelection({ ...softSelection,
|
77
|
+
to: date
|
78
|
+
});
|
79
|
+
}
|
80
|
+
}, [configuration === null || configuration === void 0 ? void 0 : configuration.selection, softSelection]);
|
81
|
+
const blurHnadler = useCallback(() => {
|
82
|
+
if ((configuration === null || configuration === void 0 ? void 0 : configuration.selection) === 'single' || !softSelection) {
|
83
|
+
setSoftSelection(null);
|
84
|
+
}
|
85
|
+
|
86
|
+
if ((configuration === null || configuration === void 0 ? void 0 : configuration.selection) === 'range' && softSelection && isRangeSelection(softSelection)) {
|
87
|
+
setSoftSelection({
|
88
|
+
from: softSelection.from
|
89
|
+
});
|
90
|
+
}
|
91
|
+
}, [configuration === null || configuration === void 0 ? void 0 : configuration.selection, softSelection]);
|
92
|
+
const datePickerCtx = useMemo(() => {
|
93
|
+
return {
|
94
|
+
configuration: {
|
95
|
+
anchorStyle: 'full-date',
|
96
|
+
confirmation: false,
|
97
|
+
contiguousSelection: false,
|
98
|
+
dimWeekends: false,
|
99
|
+
selection: 'single',
|
100
|
+
view: '2-month',
|
101
|
+
...configuration
|
102
|
+
},
|
103
|
+
selectionActive: false,
|
104
|
+
selection,
|
105
|
+
onSelection: selectionHandler,
|
106
|
+
onDayFocus: focusHnadler,
|
107
|
+
onDayBlur: blurHnadler
|
108
|
+
};
|
109
|
+
}, [blurHnadler, configuration, focusHnadler, selection, selectionHandler]);
|
110
|
+
return /*#__PURE__*/React.createElement(DatePickerContext.Provider, {
|
111
|
+
value: datePickerCtx
|
112
|
+
}, children);
|
113
|
+
};
|
114
|
+
DatePickerProvider.displayName = "DatePickerProvider";
|
package/lib-esm/Dialog.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
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); }
|
2
2
|
|
3
3
|
import React, { useCallback, useEffect, useRef } from 'react';
|
4
|
-
import { useSSRSafeId } from '@react-aria/ssr';
|
5
4
|
import TextInput from '../TextInput';
|
6
5
|
import Box from '../Box';
|
7
6
|
import { ActionList } from '../ActionList';
|
@@ -12,7 +11,36 @@ import styled from 'styled-components';
|
|
12
11
|
import { get } from '../constants';
|
13
12
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate';
|
14
13
|
import useScrollFlash from '../hooks/useScrollFlash';
|
15
|
-
import {
|
14
|
+
import { useSSRSafeId } from '@react-aria/ssr';
|
15
|
+
|
16
|
+
function scrollIntoViewingArea(child, container, margin = 8, behavior = 'smooth') {
|
17
|
+
const {
|
18
|
+
top: childTop,
|
19
|
+
bottom: childBottom
|
20
|
+
} = child.getBoundingClientRect();
|
21
|
+
const {
|
22
|
+
top: containerTop,
|
23
|
+
bottom: containerBottom
|
24
|
+
} = container.getBoundingClientRect();
|
25
|
+
const isChildTopAboveViewingArea = childTop < containerTop + margin;
|
26
|
+
const isChildBottomBelowViewingArea = childBottom > containerBottom - margin;
|
27
|
+
|
28
|
+
if (isChildTopAboveViewingArea) {
|
29
|
+
const scrollHeightToChildTop = childTop - containerTop + container.scrollTop;
|
30
|
+
container.scrollTo({
|
31
|
+
behavior,
|
32
|
+
top: scrollHeightToChildTop - margin
|
33
|
+
});
|
34
|
+
} else if (isChildBottomBelowViewingArea) {
|
35
|
+
const scrollHeightToChildBottom = childBottom - containerBottom + container.scrollTop;
|
36
|
+
container.scrollTo({
|
37
|
+
behavior,
|
38
|
+
top: scrollHeightToChildBottom + margin
|
39
|
+
});
|
40
|
+
} // either completely in view or outside viewing area on both ends, don't scroll
|
41
|
+
|
42
|
+
}
|
43
|
+
|
16
44
|
const StyledHeader = styled.div.withConfig({
|
17
45
|
displayName: "FilteredActionList__StyledHeader",
|
18
46
|
componentId: "yg3jkv-0"
|
@@ -67,7 +95,7 @@ export function FilteredActionList({
|
|
67
95
|
useEffect(() => {
|
68
96
|
// if items changed, we want to instantly move active descendant into view
|
69
97
|
if (activeDescendantRef.current && scrollContainerRef.current) {
|
70
|
-
scrollIntoViewingArea(activeDescendantRef.current, scrollContainerRef.current,
|
98
|
+
scrollIntoViewingArea(activeDescendantRef.current, scrollContainerRef.current, undefined, 'auto');
|
71
99
|
}
|
72
100
|
}, [items]);
|
73
101
|
useScrollFlash(scrollContainerRef);
|
package/lib-esm/Flash.js
CHANGED
@@ -5,35 +5,35 @@ import sx from './sx';
|
|
5
5
|
const variants = variant({
|
6
6
|
variants: {
|
7
7
|
default: {
|
8
|
-
color: '
|
9
|
-
backgroundColor: '
|
10
|
-
borderColor: '
|
8
|
+
color: 'alert.info.text',
|
9
|
+
backgroundColor: 'alert.info.bg',
|
10
|
+
borderColor: 'alert.info.border',
|
11
11
|
svg: {
|
12
|
-
color: '
|
12
|
+
color: 'alert.info.icon'
|
13
13
|
}
|
14
14
|
},
|
15
15
|
success: {
|
16
|
-
color: '
|
17
|
-
backgroundColor: 'success.
|
18
|
-
borderColor: 'success.
|
16
|
+
color: 'alert.success.text',
|
17
|
+
backgroundColor: 'alert.success.bg',
|
18
|
+
borderColor: 'alert.success.border',
|
19
19
|
svg: {
|
20
|
-
color: 'success.
|
20
|
+
color: 'alert.success.icon'
|
21
21
|
}
|
22
22
|
},
|
23
23
|
danger: {
|
24
|
-
color: '
|
25
|
-
backgroundColor: '
|
26
|
-
borderColor: '
|
24
|
+
color: 'alert.error.text',
|
25
|
+
backgroundColor: 'alert.error.bg',
|
26
|
+
borderColor: 'alert.error.border',
|
27
27
|
svg: {
|
28
|
-
color: '
|
28
|
+
color: 'alert.error.icon'
|
29
29
|
}
|
30
30
|
},
|
31
31
|
warning: {
|
32
|
-
color: '
|
33
|
-
backgroundColor: '
|
34
|
-
borderColor: '
|
32
|
+
color: 'alert.warn.text',
|
33
|
+
backgroundColor: 'alert.warn.bg',
|
34
|
+
borderColor: 'alert.warn.border',
|
35
35
|
svg: {
|
36
|
-
color: '
|
36
|
+
color: 'alert.warn.icon'
|
37
37
|
}
|
38
38
|
}
|
39
39
|
}
|
package/lib-esm/Label.js
CHANGED
@@ -33,7 +33,7 @@ const Label = styled.span.withConfig({
|
|
33
33
|
componentId: "sc-1t3ykp0-0"
|
34
34
|
})(["display:inline-block;font-weight:", ";color:", ";border-radius:", ";&:hover{text-decoration:none;}", " ", " ", " ", " ", ""], get('fontWeights.semibold'), get('colors.fg.onEmphasis'), get('radii.3'), sizeVariant, COMMON, props => props.dropshadow ? 'box-shadow: inset 0 -1px 0 rgba(27, 31, 35, 0.12)' : '', props => props.outline ? outlineStyles : '', sx);
|
35
35
|
Label.defaultProps = {
|
36
|
-
bg: '
|
36
|
+
bg: 'label.primary.border',
|
37
37
|
variant: 'medium'
|
38
38
|
};
|
39
39
|
export default Label;
|
package/lib-esm/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-esm/Overlay.js
CHANGED
@@ -92,7 +92,6 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
92
92
|
left,
|
93
93
|
anchorSide,
|
94
94
|
portalContainerName,
|
95
|
-
preventFocusOnOpen,
|
96
95
|
...rest
|
97
96
|
}, forwardedRef) => {
|
98
97
|
const overlayRef = useRef(null);
|
@@ -108,8 +107,7 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
108
107
|
onEscape,
|
109
108
|
ignoreClickRefs,
|
110
109
|
onClickOutside,
|
111
|
-
initialFocusRef
|
112
|
-
preventFocusOnOpen
|
110
|
+
initialFocusRef
|
113
111
|
});
|
114
112
|
useEffect(() => {
|
115
113
|
var _combinedRef$current;
|
@@ -9,7 +9,7 @@ import { buildComponentData, buildPaginationModel } from './model';
|
|
9
9
|
const Page = styled.a.withConfig({
|
10
10
|
displayName: "Pagination__Page",
|
11
11
|
componentId: "b80nss-0"
|
12
|
-
})(["display:inline-block;min-width:32px;padding:5px 10px;font-style:normal;line-height:20px;color:", ";text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;text-decoration:none;margin-right:", ";&:last-child{margin-right:0;}border:", " solid transparent;border-radius:", ";transition:border-color 0.2s cubic-bezier(0.3,0,0.5,1);&:hover,&:focus{text-decoration:none;border-color:", ";outline:0;transition-duration:0.1s;}&:active{border-color:", ";}&[rel='prev'],&[rel='next']{color:", ";}&[aria-current],&[aria-current]:hover{color:", ";background-color:", ";border-color:transparent;}&[aria-disabled],&[aria-disabled]:hover{color:", ";cursor:default;border-color:transparent;}@supports (clip-path:polygon(50% 0,100% 50%,50% 100%)){&[rel='prev']::before,&[rel='next']::after{display:inline-block;width:16px;height:16px;vertical-align:text-bottom;content:'';background-color:currentColor;}&[rel='prev']::before{margin-right:", ";clip-path:polygon( 9.8px 12.8px,8.7px 12.8px,4.5px 8.5px,4.5px 7.5px,8.7px 3.2px,9.8px 4.3px,6.1px 8px,9.8px 11.7px,9.8px 12.8px );}&[rel='next']::after{margin-left:", ";clip-path:polygon( 6.2px 3.2px,7.3px 3.2px,11.5px 7.5px,11.5px 8.5px,7.3px 12.8px,6.2px 11.7px,9.9px 8px,6.2px 4.3px,6.2px 3.2px );}}", ";"], get('colors.fg.default'), get('space.1'), get('borderWidths.1'), get('radii.2'), get('colors.border.default'), get('colors.border.muted'), get('colors.accent.fg'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.
|
12
|
+
})(["display:inline-block;min-width:32px;padding:5px 10px;font-style:normal;line-height:20px;color:", ";text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;text-decoration:none;margin-right:", ";&:last-child{margin-right:0;}border:", " solid transparent;border-radius:", ";transition:border-color 0.2s cubic-bezier(0.3,0,0.5,1);&:hover,&:focus{text-decoration:none;border-color:", ";outline:0;transition-duration:0.1s;}&:active{border-color:", ";}&[rel='prev'],&[rel='next']{color:", ";}&[aria-current],&[aria-current]:hover{color:", ";background-color:", ";border-color:transparent;}&[aria-disabled],&[aria-disabled]:hover{color:", ";cursor:default;border-color:transparent;}@supports (clip-path:polygon(50% 0,100% 50%,50% 100%)){&[rel='prev']::before,&[rel='next']::after{display:inline-block;width:16px;height:16px;vertical-align:text-bottom;content:'';background-color:currentColor;}&[rel='prev']::before{margin-right:", ";clip-path:polygon( 9.8px 12.8px,8.7px 12.8px,4.5px 8.5px,4.5px 7.5px,8.7px 3.2px,9.8px 4.3px,6.1px 8px,9.8px 11.7px,9.8px 12.8px );}&[rel='next']::after{margin-left:", ";clip-path:polygon( 6.2px 3.2px,7.3px 3.2px,11.5px 7.5px,11.5px 8.5px,7.3px 12.8px,6.2px 11.7px,9.9px 8px,6.2px 4.3px,6.2px 3.2px );}}", ";"], get('colors.fg.default'), get('space.1'), get('borderWidths.1'), get('radii.2'), get('colors.border.default'), get('colors.border.muted'), get('colors.accent.fg'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.fg.muted'), get('space.1'), get('space.1'), COMMON);
|
13
13
|
|
14
14
|
function usePaginationPages({
|
15
15
|
theme,
|
package/lib-esm/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-esm/StateLabel.js
CHANGED
@@ -19,28 +19,34 @@ const colorVariants = variant({
|
|
19
19
|
prop: 'status',
|
20
20
|
variants: {
|
21
21
|
issueClosed: {
|
22
|
-
backgroundColor: '
|
23
|
-
color: '
|
22
|
+
backgroundColor: 'prState.closed.bg',
|
23
|
+
color: 'prState.closed.text',
|
24
|
+
borderColor: 'prState.closed.border'
|
24
25
|
},
|
25
26
|
pullClosed: {
|
26
|
-
backgroundColor: '
|
27
|
-
color: '
|
27
|
+
backgroundColor: 'prState.closed.bg',
|
28
|
+
color: 'prState.closed.text',
|
29
|
+
borderColor: 'prState.closed.border'
|
28
30
|
},
|
29
31
|
pullMerged: {
|
30
|
-
backgroundColor: '
|
31
|
-
color: '
|
32
|
+
backgroundColor: 'prState.merged.bg',
|
33
|
+
color: 'prState.merged.text',
|
34
|
+
borderColor: 'prState.merged.border'
|
32
35
|
},
|
33
36
|
issueOpened: {
|
34
|
-
backgroundColor: '
|
35
|
-
color: '
|
37
|
+
backgroundColor: 'prState.open.bg',
|
38
|
+
color: 'prState.open.text',
|
39
|
+
borderColor: 'prState.open.border'
|
36
40
|
},
|
37
41
|
pullOpened: {
|
38
|
-
backgroundColor: '
|
39
|
-
color: '
|
42
|
+
backgroundColor: 'prState.open.bg',
|
43
|
+
color: 'prState.open.text',
|
44
|
+
borderColor: 'prState.open.border'
|
40
45
|
},
|
41
46
|
draft: {
|
42
|
-
backgroundColor: '
|
43
|
-
color: '
|
47
|
+
backgroundColor: 'prState.draft.bg',
|
48
|
+
color: 'prState.draft.text',
|
49
|
+
borderColor: 'prState.draft.border'
|
44
50
|
}
|
45
51
|
}
|
46
52
|
});
|
@@ -62,7 +68,7 @@ const sizeVariants = variant({
|
|
62
68
|
const StateLabelBase = styled.span.withConfig({
|
63
69
|
displayName: "StateLabel__StateLabelBase",
|
64
70
|
componentId: "k4pd9e-0"
|
65
|
-
})(["display:inline-flex;align-items:center;font-weight:", ";line-height:16px;color:", ";text-align:center;border-radius:", ";", ";", ";", ";", ";"], get('fontWeights.bold'), get('colors.canvas.default'), get('radii.3'), colorVariants, sizeVariants, COMMON, sx);
|
71
|
+
})(["display:inline-flex;align-items:center;font-weight:", ";line-height:16px;color:", ";text-align:center;border-radius:", ";border-width:1px;border-style:solid;", ";", ";", ";", ";"], get('fontWeights.bold'), get('colors.canvas.default'), get('radii.3'), colorVariants, sizeVariants, COMMON, sx);
|
66
72
|
|
67
73
|
function StateLabel({
|
68
74
|
children,
|
package/lib-esm/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-esm/TextInput.js
CHANGED
@@ -2,8 +2,41 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
2
2
|
|
3
3
|
import classnames from 'classnames';
|
4
4
|
import React from 'react';
|
5
|
-
import
|
6
|
-
import
|
5
|
+
import styled, { css } from 'styled-components';
|
6
|
+
import { maxWidth, minWidth, variant, width } from 'styled-system';
|
7
|
+
import { get } from './constants';
|
8
|
+
import sx from './sx';
|
9
|
+
const sizeVariants = variant({
|
10
|
+
variants: {
|
11
|
+
small: {
|
12
|
+
minHeight: '28px',
|
13
|
+
px: 2,
|
14
|
+
py: '3px',
|
15
|
+
fontSize: 0,
|
16
|
+
lineHeight: '20px'
|
17
|
+
},
|
18
|
+
large: {
|
19
|
+
px: 2,
|
20
|
+
py: '10px',
|
21
|
+
fontSize: 3
|
22
|
+
}
|
23
|
+
}
|
24
|
+
});
|
25
|
+
const Input = styled.input.withConfig({
|
26
|
+
displayName: "TextInput__Input",
|
27
|
+
componentId: "sc-1apmpmt-0"
|
28
|
+
})(["border:0;font-size:inherit;font-family:inherit;background-color:transparent;-webkit-appearance:none;color:inherit;width:100%;&:focus{outline:0;}"]);
|
29
|
+
const Wrapper = styled.span.withConfig({
|
30
|
+
displayName: "TextInput__Wrapper",
|
31
|
+
componentId: "sc-1apmpmt-1"
|
32
|
+
})(["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:", ";}", " ", " ", " ", " ", ";"], get('fontSizes.1'), get('colors.fg.default'), get('colors.border.default'), get('radii.2'), get('shadows.primer.shadow.inset'), props => {
|
33
|
+
if (props.hasIcon) {
|
34
|
+
return css(["padding:0;"]);
|
35
|
+
} else {
|
36
|
+
return css(["padding:6px 12px;"]);
|
37
|
+
}
|
38
|
+
}, get('colors.fg.muted'), get('space.2'), get('colors.accent.emphasis'), get('shadows.primer.shadow.focus'), props => props.contrast && css(["background-color:", ";"], get('colors.canvas.inset')), props => props.disabled && css(["color:", ";background-color:", ";border-color:", ";"], get('colors.fg.muted'), get('colors.input.disabledBg'), get('colors.border.default')), props => props.block && css(["display:block;width:100%;"]), get('breakpoints.1'), get('fontSizes.1'), width, minWidth, maxWidth, sizeVariants, sx); // Props that are not passed through to Input:
|
39
|
+
|
7
40
|
// using forwardRef is important so that other components (ex. SelectMenu) can autofocus the input
|
8
41
|
const TextInput = /*#__PURE__*/React.forwardRef(({
|
9
42
|
icon: IconComponent,
|
@@ -21,7 +54,7 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
21
54
|
}, ref) => {
|
22
55
|
// this class is necessary to style FilterSearch, plz no touchy!
|
23
56
|
const wrapperClasses = classnames(className, 'TextInput-wrapper');
|
24
|
-
return /*#__PURE__*/React.createElement(
|
57
|
+
return /*#__PURE__*/React.createElement(Wrapper, {
|
25
58
|
block: block,
|
26
59
|
className: wrapperClasses,
|
27
60
|
contrast: contrast,
|
@@ -35,7 +68,7 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
35
68
|
variant: variantProp
|
36
69
|
}, IconComponent && /*#__PURE__*/React.createElement(IconComponent, {
|
37
70
|
className: "TextInput-icon"
|
38
|
-
}), /*#__PURE__*/React.createElement(
|
71
|
+
}), /*#__PURE__*/React.createElement(Input, _extends({
|
39
72
|
ref: ref,
|
40
73
|
disabled: disabled
|
41
74
|
}, 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;
|
@@ -3,14 +3,9 @@ import { iterateFocusableElements } from '../utils/iterateFocusableElements';
|
|
3
3
|
export function useOpenAndCloseFocus({
|
4
4
|
initialFocusRef,
|
5
5
|
returnFocusRef,
|
6
|
-
containerRef
|
7
|
-
preventFocusOnOpen
|
6
|
+
containerRef
|
8
7
|
}) {
|
9
8
|
useEffect(() => {
|
10
|
-
if (preventFocusOnOpen) {
|
11
|
-
return;
|
12
|
-
}
|
13
|
-
|
14
9
|
const returnRef = returnFocusRef.current;
|
15
10
|
|
16
11
|
if (initialFocusRef && initialFocusRef.current) {
|
@@ -23,5 +18,5 @@ export function useOpenAndCloseFocus({
|
|
23
18
|
return function () {
|
24
19
|
returnRef === null || returnRef === void 0 ? void 0 : returnRef.focus();
|
25
20
|
};
|
26
|
-
}, [initialFocusRef, returnFocusRef, containerRef
|
21
|
+
}, [initialFocusRef, returnFocusRef, containerRef]);
|
27
22
|
}
|
@@ -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;
|
@@ -8,15 +8,13 @@ export const useOverlay = ({
|
|
8
8
|
initialFocusRef,
|
9
9
|
onEscape,
|
10
10
|
ignoreClickRefs,
|
11
|
-
onClickOutside
|
12
|
-
preventFocusOnOpen
|
11
|
+
onClickOutside
|
13
12
|
}) => {
|
14
13
|
const overlayRef = useProvidedRefOrCreate(_overlayRef);
|
15
14
|
useOpenAndCloseFocus({
|
16
15
|
containerRef: overlayRef,
|
17
16
|
returnFocusRef,
|
18
|
-
initialFocusRef
|
19
|
-
preventFocusOnOpen
|
17
|
+
initialFocusRef
|
20
18
|
});
|
21
19
|
useOnOutsideClick({
|
22
20
|
containerRef: overlayRef,
|
package/lib-esm/index.d.ts
CHANGED
@@ -24,8 +24,6 @@ export { useConfirm } from './Dialog/ConfirmationDialog';
|
|
24
24
|
export { ActionList } from './ActionList';
|
25
25
|
export { ActionMenu } from './ActionMenu';
|
26
26
|
export type { ActionMenuProps } from './ActionMenu';
|
27
|
-
export { default as Autocomplete } from './Autocomplete';
|
28
|
-
export type { AutocompleteMenuProps, AutocompleteInputProps, AutocompleteOverlayProps } from './Autocomplete';
|
29
27
|
export { default as Avatar } from './Avatar';
|
30
28
|
export type { AvatarProps } from './Avatar';
|
31
29
|
export { default as AvatarPair } from './AvatarPair';
|
@@ -100,13 +98,10 @@ export { default as TabNav } from './TabNav';
|
|
100
98
|
export type { TabNavProps, TabNavLinkProps } from './TabNav';
|
101
99
|
export { default as TextInput } from './TextInput';
|
102
100
|
export type { TextInputProps } from './TextInput';
|
103
|
-
export { default as TextInputWithTokens } from './TextInputWithTokens';
|
104
|
-
export type { TextInputWithTokensProps } from './TextInputWithTokens';
|
105
101
|
export { default as Text } from './Text';
|
106
102
|
export type { TextProps } from './Text';
|
107
103
|
export { default as Timeline } from './Timeline';
|
108
104
|
export type { TimelineProps, TimelineBadgeProps, TimelineBodyProps, TimelineBreakProps, TimelineItemsProps } from './Timeline';
|
109
|
-
export { default as Token, IssueLabelToken, AvatarToken } from './Token';
|
110
105
|
export { default as Tooltip } from './Tooltip';
|
111
106
|
export type { TooltipProps } from './Tooltip';
|
112
107
|
export { default as Truncate } from './Truncate';
|
package/lib-esm/index.js
CHANGED
@@ -19,7 +19,6 @@ export { useConfirm } from './Dialog/ConfirmationDialog'; // Components
|
|
19
19
|
|
20
20
|
export { ActionList } from './ActionList';
|
21
21
|
export { ActionMenu } from './ActionMenu';
|
22
|
-
export { default as Autocomplete } from './Autocomplete';
|
23
22
|
export { default as Avatar } from './Avatar';
|
24
23
|
export { default as AvatarPair } from './AvatarPair';
|
25
24
|
export { default as AvatarStack } from './AvatarStack';
|
@@ -62,10 +61,8 @@ export { default as StyledOcticon } from './StyledOcticon';
|
|
62
61
|
export { default as SubNav } from './SubNav';
|
63
62
|
export { default as TabNav } from './TabNav';
|
64
63
|
export { default as TextInput } from './TextInput';
|
65
|
-
export { default as TextInputWithTokens } from './TextInputWithTokens';
|
66
64
|
export { default as Text } from './Text';
|
67
65
|
export { default as Timeline } from './Timeline';
|
68
|
-
export { default as Token, IssueLabelToken, AvatarToken } from './Token';
|
69
66
|
export { default as Tooltip } from './Tooltip';
|
70
67
|
export { default as Truncate } from './Truncate';
|
71
68
|
export { default as UnderlineNav } from './UnderlineNav';
|