@primer/components 0.0.0-202110323331 → 0.0.0-20211040541

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +1 -5
  2. package/dist/browser.esm.js +8 -7
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +33 -32
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
  7. package/lib/Autocomplete/Autocomplete.d.ts +4 -2
  8. package/lib/Autocomplete/AutocompleteInput.d.ts +4 -2
  9. package/lib/Button/Button.js +1 -1
  10. package/lib/DatePicker/DatePicker.d.ts +52 -0
  11. package/lib/DatePicker/DatePicker.js +109 -0
  12. package/lib/DatePicker/DatePickerAnchor.d.ts +5 -0
  13. package/lib/DatePicker/DatePickerAnchor.js +202 -0
  14. package/lib/DatePicker/DatePickerOverlay.d.ts +3 -0
  15. package/lib/DatePicker/DatePickerOverlay.js +55 -0
  16. package/lib/DatePicker/DatePickerPanel.d.ts +2 -0
  17. package/lib/DatePicker/DatePickerPanel.js +363 -0
  18. package/lib/DatePicker/Day.d.ts +15 -0
  19. package/lib/DatePicker/Day.js +206 -0
  20. package/lib/DatePicker/Month.d.ts +8 -0
  21. package/lib/DatePicker/Month.js +122 -0
  22. package/lib/DatePicker/dateParser.d.ts +12 -0
  23. package/lib/DatePicker/dateParser.js +192 -0
  24. package/lib/DatePicker/index.d.ts +2 -0
  25. package/lib/DatePicker/index.js +13 -0
  26. package/lib/DatePicker/useDatePicker.d.ts +107 -0
  27. package/lib/DatePicker/useDatePicker.js +558 -0
  28. package/lib/FilterList.d.ts +303 -264
  29. package/lib/FilterList.js +6 -2
  30. package/lib/SelectMenu/SelectMenu.d.ts +4 -2
  31. package/lib/TextInputWithTokens.d.ts +4 -2
  32. package/lib/hooks/useDebounce.d.ts +2 -0
  33. package/lib/hooks/useDebounce.js +24 -0
  34. package/lib/hooks/useResizeObserver.d.ts +1 -1
  35. package/lib/hooks/useResizeObserver.js +1 -1
  36. package/lib/theme-preval.js +2 -2
  37. package/lib/utils/testing.d.ts +1 -1
  38. package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
  39. package/lib-esm/Autocomplete/Autocomplete.d.ts +4 -2
  40. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +4 -2
  41. package/lib-esm/Button/Button.js +1 -1
  42. package/lib-esm/DatePicker/DatePicker.d.ts +52 -0
  43. package/lib-esm/DatePicker/DatePicker.js +92 -0
  44. package/lib-esm/DatePicker/DatePickerAnchor.d.ts +5 -0
  45. package/lib-esm/DatePicker/DatePickerAnchor.js +174 -0
  46. package/lib-esm/DatePicker/DatePickerOverlay.d.ts +3 -0
  47. package/lib-esm/DatePicker/DatePickerOverlay.js +40 -0
  48. package/lib-esm/DatePicker/DatePickerPanel.d.ts +2 -0
  49. package/lib-esm/DatePicker/DatePickerPanel.js +332 -0
  50. package/lib-esm/DatePicker/Day.d.ts +15 -0
  51. package/lib-esm/DatePicker/Day.js +182 -0
  52. package/lib-esm/DatePicker/Month.d.ts +8 -0
  53. package/lib-esm/DatePicker/Month.js +98 -0
  54. package/lib-esm/DatePicker/dateParser.d.ts +12 -0
  55. package/lib-esm/DatePicker/dateParser.js +178 -0
  56. package/lib-esm/DatePicker/index.d.ts +2 -0
  57. package/lib-esm/DatePicker/index.js +1 -0
  58. package/lib-esm/DatePicker/useDatePicker.d.ts +107 -0
  59. package/lib-esm/DatePicker/useDatePicker.js +523 -0
  60. package/lib-esm/FilterList.d.ts +303 -264
  61. package/lib-esm/FilterList.js +7 -3
  62. package/lib-esm/SelectMenu/SelectMenu.d.ts +4 -2
  63. package/lib-esm/TextInputWithTokens.d.ts +4 -2
  64. package/lib-esm/hooks/useDebounce.d.ts +2 -0
  65. package/lib-esm/hooks/useDebounce.js +16 -0
  66. package/lib-esm/hooks/useResizeObserver.d.ts +1 -1
  67. package/lib-esm/hooks/useResizeObserver.js +1 -1
  68. package/lib-esm/theme-preval.js +2 -2
  69. package/lib-esm/utils/testing.d.ts +1 -1
  70. package/package.json +9 -8
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { get } from './constants';
3
+ import { COMMON, get } from './constants';
4
4
  import sx from './sx';
5
5
  const FilterListBase = styled.ul.withConfig({
6
6
  displayName: "FilterList__FilterListBase",
7
7
  componentId: "sc-1l4pxmz-0"
8
- })(["list-style-type:none;margin:0;padding:0;", ";"], sx);
8
+ })(["list-style-type:none;", ";", ";"], COMMON, sx);
9
9
 
10
10
  const FilterList = ({
11
11
  children,
@@ -21,7 +21,7 @@ FilterList.displayName = "FilterList";
21
21
  const FilterListItemBase = styled.a.withConfig({
22
22
  displayName: "FilterList__FilterListItemBase",
23
23
  componentId: "sc-1l4pxmz-1"
24
- })(["position:relative;display:block;padding:", ";margin:", ";overflow:hidden;font-size:", ";color:", ";background-color:", "!important;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;border-radius:", ";&:hover{text-decoration:none;background-color:", ";}&:active{color:", ";background-color:", ";}.count{float:right;font-weight:", ";}", ";"], props => props.small ? `${get('space.1')(props)} 10px` : `${get('space.2')(props)} 11px`, props => props.small ? '0 0 2px' : '0 0 5px 0', get('fontSizes.1'), props => props.selected ? get('colors.fg.onEmphasis') : get('colors.fg.muted'), props => props.selected ? get('colors.accent.emphasis') : '', get('radii.1'), get('colors.canvas.subtle'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('fontWeights.bold'), sx);
24
+ })(["position:relative;display:block;padding:", ";margin:", ";overflow:hidden;font-size:", ";color:", ";background-color:", "!important;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;border-radius:", ";&:hover{text-decoration:none;background-color:", ";}&:active{color:", ";background-color:", ";}.count{float:right;font-weight:", ";}", ";", ";"], props => props.small ? `${get('space.1')(props)} 10px` : `${get('space.2')(props)} 11px`, props => props.small ? '0 0 2px' : '0 0 5px 0', get('fontSizes.1'), props => props.selected ? get('colors.fg.onEmphasis') : get('colors.fg.muted'), props => props.selected ? get('colors.accent.emphasis') : '', get('radii.1'), get('colors.canvas.subtle'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('fontWeights.bold'), COMMON, sx);
25
25
 
26
26
  function FilterListItem({
27
27
  children,
@@ -35,6 +35,10 @@ function FilterListItem({
35
35
  }
36
36
 
37
37
  FilterListItem.displayName = "FilterListItem";
38
+ FilterList.defaultProps = {
39
+ m: 0,
40
+ p: 0
41
+ };
38
42
  FilterListItem.displayName = 'FilterList.Item';
39
43
  export default Object.assign(FilterList, {
40
44
  Item: FilterListItem
@@ -32,12 +32,14 @@ declare const _default: React.ForwardRefExoticComponent<Pick<SelectMenuInternalP
32
32
  Divider: import("styled-components").StyledComponent<"div", any, SystemCommonProps & SxProp, never>;
33
33
  Filter: React.ForwardRefExoticComponent<Pick<{
34
34
  value?: string | undefined;
35
- } & Pick<Omit<Pick<{
35
+ } & Pick<Omit<Pick<({
36
36
  [x: string]: any;
37
37
  [x: number]: any;
38
38
  } & {
39
39
  theme?: any;
40
- } & {
40
+ } & ({} | {
41
+ children?: React.ReactNode;
42
+ })) & {
41
43
  as?: string | React.ComponentType<any> | undefined;
42
44
  forwardedAs?: string | React.ComponentType<any> | undefined;
43
45
  }, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
@@ -36,12 +36,14 @@ 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
- } & {
44
+ } & ({} | {
45
+ children?: React.ReactNode;
46
+ })) & {
45
47
  as?: string | React.ComponentType<any> | undefined;
46
48
  forwardedAs?: string | React.ComponentType<any> | undefined;
47
49
  }, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
@@ -0,0 +1,2 @@
1
+ declare function useDebounce<T>(value: T, delay: number): T;
2
+ export default useDebounce;
@@ -0,0 +1,16 @@
1
+ import { useEffect, useState } from 'react';
2
+
3
+ function useDebounce(value, delay) {
4
+ const [debouncedValue, setDebouncedValue] = useState(value);
5
+ useEffect(() => {
6
+ const handler = setTimeout(() => {
7
+ setDebouncedValue(value);
8
+ }, delay);
9
+ return () => {
10
+ clearTimeout(handler);
11
+ };
12
+ }, [value, delay]);
13
+ return debouncedValue;
14
+ }
15
+
16
+ export default useDebounce;
@@ -1 +1 @@
1
- export declare function useResizeObserver(callback: () => void): void;
1
+ export declare function useResizeObserver(callback: (window: ResizeObserverEntry) => 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(() => callback());
4
+ const observer = new window.ResizeObserver(entries => callback(entries[0]));
5
5
  observer.observe(document.documentElement);
6
6
  return () => {
7
7
  observer.disconnect();
@@ -515,7 +515,7 @@ module.exports = {
515
515
  }
516
516
  }
517
517
  },
518
- "light_protanopia": {
518
+ "light_colorblind": {
519
519
  "colors": {
520
520
  "canvasDefaultTransparent": "rgba(255,255,255,0)",
521
521
  "marketingIcon": {
@@ -2456,7 +2456,7 @@ module.exports = {
2456
2456
  }
2457
2457
  }
2458
2458
  },
2459
- "dark_protanopia": {
2459
+ "dark_colorblind": {
2460
2460
  "colors": {
2461
2461
  "canvasDefaultTransparent": "rgba(13,17,23,0)",
2462
2462
  "marketingIcon": {
@@ -53,7 +53,7 @@ export declare function render(component: React.ReactElement, theme?: {
53
53
  xlarge: string;
54
54
  };
55
55
  space: string[];
56
- colorSchemes: Record<"light" | "light_protanopia" | "dark" | "dark_dimmed" | "dark_high_contrast" | "dark_protanopia", Record<"colors" | "shadows", Partial<{
56
+ colorSchemes: Record<"light" | "light_colorblind" | "dark" | "dark_dimmed" | "dark_high_contrast" | "dark_colorblind", Record<"colors" | "shadows", Partial<{
57
57
  canvasDefaultTransparent: string;
58
58
  marketingIcon: {
59
59
  primary: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/components",
3
- "version": "0.0.0-202110323331",
3
+ "version": "0.0.0-20211040541",
4
4
  "description": "Primer react components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -43,20 +43,16 @@
43
43
  "author": "GitHub, Inc.",
44
44
  "license": "MIT",
45
45
  "dependencies": {
46
- "@primer/octicons-react": "^13.0.0",
47
- "@primer/primitives": "5.1.0",
46
+ "@primer/octicons-react": "^16.1.1",
47
+ "@primer/primitives": "6.0.0",
48
48
  "@radix-ui/react-polymorphic": "0.0.14",
49
49
  "@react-aria/ssr": "3.1.0",
50
50
  "@styled-system/css": "5.1.5",
51
51
  "@styled-system/props": "5.1.5",
52
52
  "@styled-system/theme-get": "5.1.2",
53
- "@types/history": "4.7.8",
54
- "@types/styled-components": "5.1.11",
55
- "@types/styled-system": "5.1.12",
56
- "@types/styled-system__css": "5.0.16",
57
- "@types/styled-system__theme-get": "5.0.1",
58
53
  "classnames": "2.3.1",
59
54
  "color2k": "1.2.4",
55
+ "date-fns": "2.25.0",
60
56
  "deepmerge": "4.2.2",
61
57
  "focus-visible": "5.2.0",
62
58
  "styled-system": "5.1.5"
@@ -85,6 +81,11 @@
85
81
  "@testing-library/react": "11.2.7",
86
82
  "@testing-library/react-hooks": "7.0.2",
87
83
  "@testing-library/user-event": "13.1.9",
84
+ "@types/history": "4.7.9",
85
+ "@types/styled-components": "5.1.15",
86
+ "@types/styled-system": "5.1.13",
87
+ "@types/styled-system__css": "5.0.16",
88
+ "@types/styled-system__theme-get": "5.0.1",
88
89
  "@types/chroma-js": "2.1.3",
89
90
  "@types/enzyme": "3.10.9",
90
91
  "@types/jest": "26.0.23",