@primer/components 0.0.0-2021104181937 → 0.0.0-2021104225742
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 +5 -1
- package/dist/browser.esm.js +4 -7
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +29 -32
- package/dist/browser.umd.js.map +1 -1
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +2 -4
- package/lib/Autocomplete/Autocomplete.d.ts +2 -4
- package/lib/Autocomplete/AutocompleteInput.d.ts +2 -4
- package/lib/Button/Button.js +1 -1
- package/lib/SelectMenu/SelectMenu.d.ts +2 -4
- package/lib/TextInputWithTokens.d.ts +2 -4
- package/lib/Truncate.d.ts +1 -2
- package/lib/Truncate.js +1 -3
- package/lib/hooks/useResizeObserver.d.ts +1 -1
- package/lib/hooks/useResizeObserver.js +1 -1
- package/lib/theme-preval.js +2 -2
- package/lib/utils/testing.d.ts +1 -1
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +2 -4
- package/lib-esm/Autocomplete/Autocomplete.d.ts +2 -4
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +2 -4
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/SelectMenu/SelectMenu.d.ts +2 -4
- package/lib-esm/TextInputWithTokens.d.ts +2 -4
- package/lib-esm/Truncate.d.ts +1 -2
- package/lib-esm/Truncate.js +1 -2
- package/lib-esm/hooks/useResizeObserver.d.ts +1 -1
- package/lib-esm/hooks/useResizeObserver.js +1 -1
- package/lib-esm/theme-preval.js +2 -2
- package/lib-esm/utils/testing.d.ts +1 -1
- package/package.json +8 -9
- package/lib/DatePicker/DatePicker.d.ts +0 -52
- package/lib/DatePicker/DatePicker.js +0 -109
- package/lib/DatePicker/DatePickerAnchor.d.ts +0 -5
- package/lib/DatePicker/DatePickerAnchor.js +0 -202
- package/lib/DatePicker/DatePickerOverlay.d.ts +0 -3
- package/lib/DatePicker/DatePickerOverlay.js +0 -55
- package/lib/DatePicker/DatePickerPanel.d.ts +0 -2
- package/lib/DatePicker/DatePickerPanel.js +0 -363
- package/lib/DatePicker/Day.d.ts +0 -15
- package/lib/DatePicker/Day.js +0 -204
- package/lib/DatePicker/Month.d.ts +0 -8
- package/lib/DatePicker/Month.js +0 -122
- package/lib/DatePicker/dateParser.d.ts +0 -12
- package/lib/DatePicker/dateParser.js +0 -193
- package/lib/DatePicker/index.d.ts +0 -2
- package/lib/DatePicker/index.js +0 -13
- package/lib/DatePicker/useDatePicker.d.ts +0 -107
- package/lib/DatePicker/useDatePicker.js +0 -561
- package/lib/hooks/useDebounce.d.ts +0 -2
- package/lib/hooks/useDebounce.js +0 -24
- package/lib-esm/DatePicker/DatePicker.d.ts +0 -52
- package/lib-esm/DatePicker/DatePicker.js +0 -92
- package/lib-esm/DatePicker/DatePickerAnchor.d.ts +0 -5
- package/lib-esm/DatePicker/DatePickerAnchor.js +0 -174
- package/lib-esm/DatePicker/DatePickerOverlay.d.ts +0 -3
- package/lib-esm/DatePicker/DatePickerOverlay.js +0 -40
- package/lib-esm/DatePicker/DatePickerPanel.d.ts +0 -2
- package/lib-esm/DatePicker/DatePickerPanel.js +0 -332
- package/lib-esm/DatePicker/Day.d.ts +0 -15
- package/lib-esm/DatePicker/Day.js +0 -180
- package/lib-esm/DatePicker/Month.d.ts +0 -8
- package/lib-esm/DatePicker/Month.js +0 -98
- package/lib-esm/DatePicker/dateParser.d.ts +0 -12
- package/lib-esm/DatePicker/dateParser.js +0 -179
- package/lib-esm/DatePicker/index.d.ts +0 -2
- package/lib-esm/DatePicker/index.js +0 -1
- package/lib-esm/DatePicker/useDatePicker.d.ts +0 -107
- package/lib-esm/DatePicker/useDatePicker.js +0 -526
- package/lib-esm/hooks/useDebounce.d.ts +0 -2
- package/lib-esm/hooks/useDebounce.js +0 -16
@@ -26,8 +26,6 @@ interface AnchoredOverlayPropsWithoutAnchor {
|
|
26
26
|
*/
|
27
27
|
anchorRef: React.RefObject<HTMLElement>;
|
28
28
|
}
|
29
|
-
export declare type OverlayOpenGesture = 'anchor-click' | 'anchor-key-press';
|
30
|
-
export declare type OverlayCloseGesture = 'anchor-click' | 'click-outside' | 'escape';
|
31
29
|
export declare type AnchoredOverlayWrapperAnchorProps = Partial<AnchoredOverlayPropsWithAnchor> | AnchoredOverlayPropsWithoutAnchor;
|
32
30
|
interface AnchoredOverlayBaseProps extends Pick<OverlayProps, 'height' | 'width'> {
|
33
31
|
/**
|
@@ -37,11 +35,11 @@ interface AnchoredOverlayBaseProps extends Pick<OverlayProps, 'height' | 'width'
|
|
37
35
|
/**
|
38
36
|
* A callback which is called whenever the overlay is currently closed and an "open gesture" is detected.
|
39
37
|
*/
|
40
|
-
onOpen?: (gesture:
|
38
|
+
onOpen?: (gesture: 'anchor-click' | 'anchor-key-press') => unknown;
|
41
39
|
/**
|
42
40
|
* A callback which is called whenever the overlay is currently open and a "close gesture" is detected.
|
43
41
|
*/
|
44
|
-
onClose?: (gesture:
|
42
|
+
onClose?: (gesture: 'anchor-click' | 'click-outside' | 'escape') => unknown;
|
45
43
|
/**
|
46
44
|
* Props to be spread on the internal `Overlay` component.
|
47
45
|
*/
|
@@ -12,14 +12,12 @@ export type { AutocompleteOverlayProps } from './AutocompleteOverlay';
|
|
12
12
|
declare const _default: React.FC<{
|
13
13
|
id?: string | undefined;
|
14
14
|
}> & {
|
15
|
-
Input: import("@radix-ui/react-polymorphic").ForwardRefComponent<React.ForwardRefExoticComponent<Pick<Omit<Pick<
|
15
|
+
Input: import("@radix-ui/react-polymorphic").ForwardRefComponent<React.ForwardRefExoticComponent<Pick<Omit<Pick<{
|
16
16
|
[x: string]: any;
|
17
17
|
[x: number]: any;
|
18
18
|
} & {
|
19
19
|
theme?: any;
|
20
|
-
} &
|
21
|
-
children?: React.ReactNode;
|
22
|
-
})) & {
|
20
|
+
} & {
|
23
21
|
as?: string | React.ComponentType<any> | undefined;
|
24
22
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
25
23
|
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
|
@@ -4,14 +4,12 @@ import { ComponentProps } from '../utils/types';
|
|
4
4
|
declare type InternalAutocompleteInputProps = {
|
5
5
|
as?: React.ComponentType<any>;
|
6
6
|
};
|
7
|
-
declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRefExoticComponent<Pick<Omit<Pick<
|
7
|
+
declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRefExoticComponent<Pick<Omit<Pick<{
|
8
8
|
[x: string]: any;
|
9
9
|
[x: number]: any;
|
10
10
|
} & {
|
11
11
|
theme?: any;
|
12
|
-
} &
|
13
|
-
children?: React.ReactNode;
|
14
|
-
})) & {
|
12
|
+
} & {
|
15
13
|
as?: string | React.ComponentType<any> | undefined;
|
16
14
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
17
15
|
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
|
package/lib/Button/Button.js
CHANGED
@@ -22,6 +22,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
22
22
|
const Button = (0, _styledComponents.default)(_ButtonBase.default).withConfig({
|
23
23
|
displayName: "Button",
|
24
24
|
componentId: "xjtz72-0"
|
25
|
-
})(["color:", ";background-color:", ";border:1px solid ", ";box-shadow:", ",", ";&:hover{background-color:", ";border-color:", ";}&:focus{border-color:", ";box-shadow:", ";}&:active{background-color:", ";box-shadow:", ";}&:disabled{color:", ";background-color:", ";border-color:", ";
|
25
|
+
})(["color:", ";background-color:", ";border:1px solid ", ";box-shadow:", ",", "};&:hover{background-color:", ";border-color:", ";}&:focus{border-color:", ";box-shadow:", ";}&:active{background-color:", ";box-shadow:", ";}&:disabled{color:", ";background-color:", ";border-color:", ";}", ";", ";"], (0, _constants.get)('colors.btn.text'), (0, _constants.get)('colors.btn.bg'), (0, _constants.get)('colors.btn.border'), (0, _constants.get)('shadows.btn.shadow'), (0, _constants.get)('shadows.btn.insetShadow'), (0, _constants.get)('colors.btn.hoverBg'), (0, _constants.get)('colors.btn.hoverBorder'), (0, _constants.get)('colors.btn.focusBorder'), (0, _constants.get)('shadows.btn.focusShadow'), (0, _constants.get)('colors.btn.selectedBg'), (0, _constants.get)('shadows.btn.shadowActive'), (0, _constants.get)('colors.primer.fg.disabled'), (0, _constants.get)('colors.btn.bg'), (0, _constants.get)('colors.btn.border'), _ButtonBase.buttonSystemProps, _sx.default);
|
26
26
|
var _default = Button;
|
27
27
|
exports.default = _default;
|
@@ -32,14 +32,12 @@ 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
|
-
} &
|
41
|
-
children?: React.ReactNode;
|
42
|
-
})) & {
|
40
|
+
} & {
|
43
41
|
as?: string | React.ComponentType<any> | undefined;
|
44
42
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
45
43
|
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
|
@@ -36,14 +36,12 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
36
36
|
* The number of tokens to display before truncating
|
37
37
|
*/
|
38
38
|
visibleTokenCount?: number | undefined;
|
39
|
-
} & Pick<Omit<Pick<
|
39
|
+
} & Pick<Omit<Pick<{
|
40
40
|
[x: string]: any;
|
41
41
|
[x: number]: any;
|
42
42
|
} & {
|
43
43
|
theme?: any;
|
44
|
-
} &
|
45
|
-
children?: React.ReactNode;
|
46
|
-
})) & {
|
44
|
+
} & {
|
47
45
|
as?: string | React.ComponentType<any> | undefined;
|
48
46
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
49
47
|
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
|
package/lib/Truncate.d.ts
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
import { MaxWidthProps } from 'styled-system';
|
2
|
-
import { SystemCommonProps, SystemTypographyProps } from './constants';
|
3
2
|
import { SxProp } from './sx';
|
4
3
|
import { ComponentProps } from './utils/types';
|
5
4
|
declare const Truncate: import("styled-components").StyledComponent<"div", any, {
|
6
5
|
title: string;
|
7
6
|
inline?: boolean | undefined;
|
8
7
|
expandable?: boolean | undefined;
|
9
|
-
} & MaxWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>> &
|
8
|
+
} & MaxWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>> & SxProp, never>;
|
10
9
|
export declare type TruncateProps = ComponentProps<typeof Truncate>;
|
11
10
|
export default Truncate;
|
package/lib/Truncate.js
CHANGED
@@ -9,8 +9,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
|
10
10
|
var _styledSystem = require("styled-system");
|
11
11
|
|
12
|
-
var _constants = require("./constants");
|
13
|
-
|
14
12
|
var _sx = _interopRequireDefault(require("./sx"));
|
15
13
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -18,7 +16,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
18
16
|
const Truncate = _styledComponents.default.div.withConfig({
|
19
17
|
displayName: "Truncate",
|
20
18
|
componentId: "sc-1074h1l-0"
|
21
|
-
})(["
|
19
|
+
})(["display:", ";overflow:hidden;text-overflow:ellipsis;vertical-align:", ";white-space:nowrap;", " ", " ", ";"], props => props.inline ? 'inline-block' : 'inherit', props => props.inline ? 'top' : 'initial', _styledSystem.maxWidth, props => props.expandable ? `&:hover { max-width: 10000px; }` : '', _sx.default);
|
22
20
|
|
23
21
|
Truncate.defaultProps = {
|
24
22
|
expandable: false,
|
@@ -1 +1 @@
|
|
1
|
-
export declare function useResizeObserver(callback: (
|
1
|
+
export declare function useResizeObserver(callback: () => void): void;
|
@@ -11,7 +11,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
11
11
|
|
12
12
|
function useResizeObserver(callback) {
|
13
13
|
_react.default.useLayoutEffect(() => {
|
14
|
-
const observer = new window.ResizeObserver(
|
14
|
+
const observer = new window.ResizeObserver(() => callback());
|
15
15
|
observer.observe(document.documentElement);
|
16
16
|
return () => {
|
17
17
|
observer.disconnect();
|
package/lib/theme-preval.js
CHANGED
@@ -515,7 +515,7 @@ module.exports = {
|
|
515
515
|
}
|
516
516
|
}
|
517
517
|
},
|
518
|
-
"
|
518
|
+
"light_protanopia": {
|
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_protanopia": {
|
2460
2460
|
"colors": {
|
2461
2461
|
"canvasDefaultTransparent": "rgba(13,17,23,0)",
|
2462
2462
|
"marketingIcon": {
|
package/lib/utils/testing.d.ts
CHANGED
@@ -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_protanopia" | "dark" | "dark_dimmed" | "dark_high_contrast" | "dark_protanopia", Record<"colors" | "shadows", Partial<{
|
57
57
|
canvasDefaultTransparent: string;
|
58
58
|
marketingIcon: {
|
59
59
|
primary: string;
|
@@ -26,8 +26,6 @@ interface AnchoredOverlayPropsWithoutAnchor {
|
|
26
26
|
*/
|
27
27
|
anchorRef: React.RefObject<HTMLElement>;
|
28
28
|
}
|
29
|
-
export declare type OverlayOpenGesture = 'anchor-click' | 'anchor-key-press';
|
30
|
-
export declare type OverlayCloseGesture = 'anchor-click' | 'click-outside' | 'escape';
|
31
29
|
export declare type AnchoredOverlayWrapperAnchorProps = Partial<AnchoredOverlayPropsWithAnchor> | AnchoredOverlayPropsWithoutAnchor;
|
32
30
|
interface AnchoredOverlayBaseProps extends Pick<OverlayProps, 'height' | 'width'> {
|
33
31
|
/**
|
@@ -37,11 +35,11 @@ interface AnchoredOverlayBaseProps extends Pick<OverlayProps, 'height' | 'width'
|
|
37
35
|
/**
|
38
36
|
* A callback which is called whenever the overlay is currently closed and an "open gesture" is detected.
|
39
37
|
*/
|
40
|
-
onOpen?: (gesture:
|
38
|
+
onOpen?: (gesture: 'anchor-click' | 'anchor-key-press') => unknown;
|
41
39
|
/**
|
42
40
|
* A callback which is called whenever the overlay is currently open and a "close gesture" is detected.
|
43
41
|
*/
|
44
|
-
onClose?: (gesture:
|
42
|
+
onClose?: (gesture: 'anchor-click' | 'click-outside' | 'escape') => unknown;
|
45
43
|
/**
|
46
44
|
* Props to be spread on the internal `Overlay` component.
|
47
45
|
*/
|
@@ -12,14 +12,12 @@ export type { AutocompleteOverlayProps } from './AutocompleteOverlay';
|
|
12
12
|
declare const _default: React.FC<{
|
13
13
|
id?: string | undefined;
|
14
14
|
}> & {
|
15
|
-
Input: import("@radix-ui/react-polymorphic").ForwardRefComponent<React.ForwardRefExoticComponent<Pick<Omit<Pick<
|
15
|
+
Input: import("@radix-ui/react-polymorphic").ForwardRefComponent<React.ForwardRefExoticComponent<Pick<Omit<Pick<{
|
16
16
|
[x: string]: any;
|
17
17
|
[x: number]: any;
|
18
18
|
} & {
|
19
19
|
theme?: any;
|
20
|
-
} &
|
21
|
-
children?: React.ReactNode;
|
22
|
-
})) & {
|
20
|
+
} & {
|
23
21
|
as?: string | React.ComponentType<any> | undefined;
|
24
22
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
25
23
|
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
|
@@ -4,14 +4,12 @@ import { ComponentProps } from '../utils/types';
|
|
4
4
|
declare type InternalAutocompleteInputProps = {
|
5
5
|
as?: React.ComponentType<any>;
|
6
6
|
};
|
7
|
-
declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRefExoticComponent<Pick<Omit<Pick<
|
7
|
+
declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRefExoticComponent<Pick<Omit<Pick<{
|
8
8
|
[x: string]: any;
|
9
9
|
[x: number]: any;
|
10
10
|
} & {
|
11
11
|
theme?: any;
|
12
|
-
} &
|
13
|
-
children?: React.ReactNode;
|
14
|
-
})) & {
|
12
|
+
} & {
|
15
13
|
as?: string | React.ComponentType<any> | undefined;
|
16
14
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
17
15
|
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
|
package/lib-esm/Button/Button.js
CHANGED
@@ -5,5 +5,5 @@ import ButtonBase, { buttonSystemProps } from './ButtonBase';
|
|
5
5
|
const Button = styled(ButtonBase).withConfig({
|
6
6
|
displayName: "Button",
|
7
7
|
componentId: "xjtz72-0"
|
8
|
-
})(["color:", ";background-color:", ";border:1px solid ", ";box-shadow:", ",", ";&:hover{background-color:", ";border-color:", ";}&:focus{border-color:", ";box-shadow:", ";}&:active{background-color:", ";box-shadow:", ";}&:disabled{color:", ";background-color:", ";border-color:", ";
|
8
|
+
})(["color:", ";background-color:", ";border:1px solid ", ";box-shadow:", ",", "};&:hover{background-color:", ";border-color:", ";}&:focus{border-color:", ";box-shadow:", ";}&:active{background-color:", ";box-shadow:", ";}&:disabled{color:", ";background-color:", ";border-color:", ";}", ";", ";"], get('colors.btn.text'), get('colors.btn.bg'), get('colors.btn.border'), get('shadows.btn.shadow'), get('shadows.btn.insetShadow'), get('colors.btn.hoverBg'), get('colors.btn.hoverBorder'), get('colors.btn.focusBorder'), get('shadows.btn.focusShadow'), get('colors.btn.selectedBg'), get('shadows.btn.shadowActive'), get('colors.primer.fg.disabled'), get('colors.btn.bg'), get('colors.btn.border'), buttonSystemProps, sx);
|
9
9
|
export default Button;
|
@@ -32,14 +32,12 @@ 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
|
-
} &
|
41
|
-
children?: React.ReactNode;
|
42
|
-
})) & {
|
40
|
+
} & {
|
43
41
|
as?: string | React.ComponentType<any> | undefined;
|
44
42
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
45
43
|
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
|
@@ -36,14 +36,12 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
36
36
|
* The number of tokens to display before truncating
|
37
37
|
*/
|
38
38
|
visibleTokenCount?: number | undefined;
|
39
|
-
} & Pick<Omit<Pick<
|
39
|
+
} & Pick<Omit<Pick<{
|
40
40
|
[x: string]: any;
|
41
41
|
[x: number]: any;
|
42
42
|
} & {
|
43
43
|
theme?: any;
|
44
|
-
} &
|
45
|
-
children?: React.ReactNode;
|
46
|
-
})) & {
|
44
|
+
} & {
|
47
45
|
as?: string | React.ComponentType<any> | undefined;
|
48
46
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
49
47
|
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
|
package/lib-esm/Truncate.d.ts
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
import { MaxWidthProps } from 'styled-system';
|
2
|
-
import { SystemCommonProps, SystemTypographyProps } from './constants';
|
3
2
|
import { SxProp } from './sx';
|
4
3
|
import { ComponentProps } from './utils/types';
|
5
4
|
declare const Truncate: import("styled-components").StyledComponent<"div", any, {
|
6
5
|
title: string;
|
7
6
|
inline?: boolean | undefined;
|
8
7
|
expandable?: boolean | undefined;
|
9
|
-
} & MaxWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>> &
|
8
|
+
} & MaxWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>> & SxProp, never>;
|
10
9
|
export declare type TruncateProps = ComponentProps<typeof Truncate>;
|
11
10
|
export default Truncate;
|
package/lib-esm/Truncate.js
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
import styled from 'styled-components';
|
2
2
|
import { maxWidth } from 'styled-system';
|
3
|
-
import { COMMON, TYPOGRAPHY } from './constants';
|
4
3
|
import sx from './sx';
|
5
4
|
const Truncate = styled.div.withConfig({
|
6
5
|
displayName: "Truncate",
|
7
6
|
componentId: "sc-1074h1l-0"
|
8
|
-
})(["
|
7
|
+
})(["display:", ";overflow:hidden;text-overflow:ellipsis;vertical-align:", ";white-space:nowrap;", " ", " ", ";"], props => props.inline ? 'inline-block' : 'inherit', props => props.inline ? 'top' : 'initial', maxWidth, props => props.expandable ? `&:hover { max-width: 10000px; }` : '', sx);
|
9
8
|
Truncate.defaultProps = {
|
10
9
|
expandable: false,
|
11
10
|
inline: false,
|
@@ -1 +1 @@
|
|
1
|
-
export declare function useResizeObserver(callback: (
|
1
|
+
export declare function useResizeObserver(callback: () => void): void;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
export function useResizeObserver(callback) {
|
3
3
|
React.useLayoutEffect(() => {
|
4
|
-
const observer = new window.ResizeObserver(
|
4
|
+
const observer = new window.ResizeObserver(() => callback());
|
5
5
|
observer.observe(document.documentElement);
|
6
6
|
return () => {
|
7
7
|
observer.disconnect();
|
package/lib-esm/theme-preval.js
CHANGED
@@ -515,7 +515,7 @@ module.exports = {
|
|
515
515
|
}
|
516
516
|
}
|
517
517
|
},
|
518
|
-
"
|
518
|
+
"light_protanopia": {
|
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_protanopia": {
|
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_protanopia" | "dark" | "dark_dimmed" | "dark_high_contrast" | "dark_protanopia", 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-2021104225742",
|
4
4
|
"description": "Primer react components",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "lib-esm/index.js",
|
@@ -43,16 +43,20 @@
|
|
43
43
|
"author": "GitHub, Inc.",
|
44
44
|
"license": "MIT",
|
45
45
|
"dependencies": {
|
46
|
-
"@primer/octicons-react": "^
|
47
|
-
"@primer/primitives": "
|
46
|
+
"@primer/octicons-react": "^13.0.0",
|
47
|
+
"@primer/primitives": "5.1.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",
|
53
58
|
"classnames": "2.3.1",
|
54
59
|
"color2k": "1.2.4",
|
55
|
-
"date-fns": "2.25.0",
|
56
60
|
"deepmerge": "4.2.2",
|
57
61
|
"focus-visible": "5.2.0",
|
58
62
|
"styled-system": "5.1.5"
|
@@ -81,11 +85,6 @@
|
|
81
85
|
"@testing-library/react": "11.2.7",
|
82
86
|
"@testing-library/react-hooks": "7.0.2",
|
83
87
|
"@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",
|
89
88
|
"@types/chroma-js": "2.1.3",
|
90
89
|
"@types/enzyme": "3.10.9",
|
91
90
|
"@types/jest": "26.0.23",
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { OverlayProps } from '../Overlay';
|
3
|
-
import { FocusTrapHookSettings } from '../hooks/useFocusTrap';
|
4
|
-
import { FocusZoneHookSettings } from '../hooks/useFocusZone';
|
5
|
-
import { DatePickerConfiguration, Selection } from './useDatePicker';
|
6
|
-
declare type OpenGesture = 'anchor-click' | 'anchor-key-press';
|
7
|
-
declare type CloseGesture = 'anchor-click' | 'click-outside' | 'escape';
|
8
|
-
export interface DatePickerProps extends DatePickerConfiguration {
|
9
|
-
/**
|
10
|
-
* An override to the internal ref that will be spread on to the renderAnchor
|
11
|
-
*/
|
12
|
-
anchorRef?: React.RefObject<HTMLElement>;
|
13
|
-
/**
|
14
|
-
* Settings to apply to the Focus Zone on the internal `Overlay` component.
|
15
|
-
*/
|
16
|
-
focusTrapSettings?: Partial<FocusTrapHookSettings>;
|
17
|
-
/**
|
18
|
-
* Settings to apply to the Focus Zone on the internal `Overlay` component.
|
19
|
-
*/
|
20
|
-
focusZoneSettings?: Partial<FocusZoneHookSettings>;
|
21
|
-
initialValue?: 'today' | Date | string | null;
|
22
|
-
iconOnly?: boolean;
|
23
|
-
placeholder?: string;
|
24
|
-
/**
|
25
|
-
* Determines whether the overlay portion of the component should be shown or not
|
26
|
-
*/
|
27
|
-
open?: boolean;
|
28
|
-
/**
|
29
|
-
* A callback which is called whenever the overlay is currently closed and an "open gesture" is detected.
|
30
|
-
*/
|
31
|
-
onOpen?: (gesture: OpenGesture) => unknown;
|
32
|
-
/**
|
33
|
-
* A callback which is called whenever the overlay is currently open and a "close gesture" is detected.
|
34
|
-
*/
|
35
|
-
onClose?: (gesture: CloseGesture) => unknown;
|
36
|
-
/**
|
37
|
-
* Props to be spread on the internal `Overlay` component.
|
38
|
-
*/
|
39
|
-
overlayProps?: Partial<OverlayProps>;
|
40
|
-
/**
|
41
|
-
* A custom function component used to render the anchor element.
|
42
|
-
* Will receive the selected text as `children` prop when an item is activated.
|
43
|
-
*/
|
44
|
-
renderAnchor?: <T extends React.HTMLAttributes<HTMLElement>>(props: T) => JSX.Element;
|
45
|
-
value?: Selection;
|
46
|
-
/**
|
47
|
-
* Minimum date to select
|
48
|
-
*/
|
49
|
-
minDate?: Date | null;
|
50
|
-
}
|
51
|
-
export declare const DatePicker: React.FC<DatePickerProps>;
|
52
|
-
export {};
|
@@ -1,109 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.DatePicker = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
9
|
-
|
10
|
-
var _DatePickerAnchor = require("./DatePickerAnchor");
|
11
|
-
|
12
|
-
var _useDatePicker = require("./useDatePicker");
|
13
|
-
|
14
|
-
var _DatePickerOverlay = require("./DatePickerOverlay");
|
15
|
-
|
16
|
-
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); }
|
17
|
-
|
18
|
-
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; }
|
19
|
-
|
20
|
-
const DatePicker = ({
|
21
|
-
anchorVariant,
|
22
|
-
anchorRef: externalAnchorRef,
|
23
|
-
confirmation,
|
24
|
-
confirmUnsavedClose,
|
25
|
-
compressedHeader,
|
26
|
-
dateFormat,
|
27
|
-
disableWeekends,
|
28
|
-
focusTrapSettings,
|
29
|
-
focusZoneSettings,
|
30
|
-
iconPlacement,
|
31
|
-
maxDate,
|
32
|
-
maxRangeSize,
|
33
|
-
maxSelections,
|
34
|
-
minDate,
|
35
|
-
onOpen: onOpenExternal,
|
36
|
-
onClose: onCloseExternal,
|
37
|
-
open,
|
38
|
-
overlayProps,
|
39
|
-
placeholder,
|
40
|
-
renderAnchor = null,
|
41
|
-
showInputPrompt,
|
42
|
-
value,
|
43
|
-
variant,
|
44
|
-
view,
|
45
|
-
weekStartsOn
|
46
|
-
}) => {
|
47
|
-
const anchorRef = (0, _react.useRef)(null);
|
48
|
-
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
49
|
-
const datePickerConfiguration = {
|
50
|
-
anchorVariant,
|
51
|
-
confirmation,
|
52
|
-
confirmUnsavedClose,
|
53
|
-
compressedHeader,
|
54
|
-
dateFormat,
|
55
|
-
disableWeekends,
|
56
|
-
iconPlacement,
|
57
|
-
maxDate: maxDate ? new Date(new Date(maxDate).toDateString()) : maxDate,
|
58
|
-
maxRangeSize,
|
59
|
-
maxSelections,
|
60
|
-
minDate: minDate ? new Date(new Date(minDate).toDateString()) : minDate,
|
61
|
-
placeholder,
|
62
|
-
showInputPrompt,
|
63
|
-
variant,
|
64
|
-
view,
|
65
|
-
weekStartsOn
|
66
|
-
};
|
67
|
-
|
68
|
-
const onOpen = gesture => {
|
69
|
-
setIsOpen(true);
|
70
|
-
onOpenExternal === null || onOpenExternal === void 0 ? void 0 : onOpenExternal(gesture);
|
71
|
-
};
|
72
|
-
|
73
|
-
const onClose = gesture => {
|
74
|
-
setIsOpen(false);
|
75
|
-
onCloseExternal === null || onCloseExternal === void 0 ? void 0 : onCloseExternal(gesture);
|
76
|
-
};
|
77
|
-
|
78
|
-
const toggleIsOpen = () => {
|
79
|
-
if (isOpen) {
|
80
|
-
setIsOpen(false);
|
81
|
-
onCloseExternal === null || onCloseExternal === void 0 ? void 0 : onCloseExternal('anchor-click');
|
82
|
-
} else {
|
83
|
-
setIsOpen(true);
|
84
|
-
onCloseExternal === null || onCloseExternal === void 0 ? void 0 : onCloseExternal('anchor-click');
|
85
|
-
}
|
86
|
-
};
|
87
|
-
|
88
|
-
return /*#__PURE__*/_react.default.createElement(_useDatePicker.DatePickerProvider, {
|
89
|
-
configuration: datePickerConfiguration,
|
90
|
-
isOpen: isOpen,
|
91
|
-
value: value,
|
92
|
-
closePicker: () => setIsOpen(false)
|
93
|
-
}, /*#__PURE__*/_react.default.createElement(_DatePickerAnchor.DatePickerAnchor, {
|
94
|
-
ref: anchorRef,
|
95
|
-
onAction: toggleIsOpen
|
96
|
-
}), /*#__PURE__*/_react.default.createElement(_DatePickerOverlay.DatePickerOverlay, {
|
97
|
-
anchorRef: externalAnchorRef !== null && externalAnchorRef !== void 0 ? externalAnchorRef : anchorRef,
|
98
|
-
renderAnchor: renderAnchor,
|
99
|
-
open: open !== null && open !== void 0 ? open : isOpen,
|
100
|
-
onOpen: onOpen,
|
101
|
-
onClose: onClose,
|
102
|
-
overlayProps: overlayProps,
|
103
|
-
focusTrapSettings: focusTrapSettings,
|
104
|
-
focusZoneSettings: focusZoneSettings
|
105
|
-
}));
|
106
|
-
};
|
107
|
-
|
108
|
-
exports.DatePicker = DatePicker;
|
109
|
-
DatePicker.displayName = "DatePicker";
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
export interface DatePickerAnchorProps {
|
3
|
-
onAction?: (event?: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>) => void;
|
4
|
-
}
|
5
|
-
export declare const DatePickerAnchor: React.ForwardRefExoticComponent<DatePickerAnchorProps & React.RefAttributes<HTMLDivElement>>;
|