@primer/components 0.0.0-202110323331 → 0.0.0-2021103235619

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 (138) hide show
  1. package/CHANGELOG.md +1 -29
  2. package/dist/browser.esm.js +51 -55
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +50 -54
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/ActionList/Header.js +1 -1
  7. package/lib/ActionList/Item.d.ts +0 -6
  8. package/lib/ActionList/Item.js +1 -5
  9. package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
  10. package/lib/Autocomplete/Autocomplete.d.ts +8 -6
  11. package/lib/Autocomplete/AutocompleteInput.d.ts +8 -6
  12. package/lib/Button/Button.d.ts +5 -5
  13. package/lib/Button/ButtonBase.d.ts +1 -1
  14. package/lib/Button/ButtonClose.d.ts +3 -3
  15. package/lib/Button/ButtonDanger.d.ts +5 -5
  16. package/lib/Button/ButtonInvisible.d.ts +5 -5
  17. package/lib/Button/ButtonOutline.d.ts +5 -5
  18. package/lib/Button/ButtonPrimary.d.ts +5 -5
  19. package/lib/CircleBadge.d.ts +2 -2
  20. package/lib/CircleOcticon.d.ts +4 -4
  21. package/lib/DatePicker/DatePicker.d.ts +52 -0
  22. package/lib/DatePicker/DatePicker.js +109 -0
  23. package/lib/DatePicker/DatePickerAnchor.d.ts +5 -0
  24. package/lib/DatePicker/DatePickerAnchor.js +202 -0
  25. package/lib/DatePicker/DatePickerOverlay.d.ts +3 -0
  26. package/lib/DatePicker/DatePickerOverlay.js +55 -0
  27. package/lib/DatePicker/DatePickerPanel.d.ts +2 -0
  28. package/lib/DatePicker/DatePickerPanel.js +363 -0
  29. package/lib/DatePicker/Day.d.ts +15 -0
  30. package/lib/DatePicker/Day.js +206 -0
  31. package/lib/DatePicker/Month.d.ts +8 -0
  32. package/lib/DatePicker/Month.js +122 -0
  33. package/lib/DatePicker/dateParser.d.ts +12 -0
  34. package/lib/DatePicker/dateParser.js +192 -0
  35. package/lib/DatePicker/index.d.ts +2 -0
  36. package/lib/DatePicker/index.js +13 -0
  37. package/lib/DatePicker/useDatePicker.d.ts +107 -0
  38. package/lib/DatePicker/useDatePicker.js +558 -0
  39. package/lib/Dialog.d.ts +4 -4
  40. package/lib/Dropdown.d.ts +16 -16
  41. package/lib/DropdownMenu/DropdownButton.d.ts +6 -6
  42. package/lib/FilterList.d.ts +303 -264
  43. package/lib/FilterList.js +6 -2
  44. package/lib/Flash.d.ts +1 -1
  45. package/lib/Label.d.ts +1 -1
  46. package/lib/Position.d.ts +4 -4
  47. package/lib/ProgressBar.d.ts +1 -1
  48. package/lib/SelectMenu/SelectMenu.d.ts +28 -26
  49. package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
  50. package/lib/TextInputWithTokens.d.ts +8 -10
  51. package/lib/TextInputWithTokens.js +29 -102
  52. package/lib/Timeline.d.ts +4 -4
  53. package/lib/Token/AvatarToken.d.ts +1 -1
  54. package/lib/Token/IssueLabelToken.d.ts +1 -1
  55. package/lib/Token/Token.d.ts +1 -1
  56. package/lib/Token/Token.js +2 -13
  57. package/lib/Token/TokenBase.js +4 -0
  58. package/lib/Token/_RemoveTokenButton.js +2 -15
  59. package/lib/_TextInputWrapper.d.ts +1 -1
  60. package/lib/_TextInputWrapper.js +1 -1
  61. package/lib/hooks/useDebounce.d.ts +2 -0
  62. package/lib/hooks/useDebounce.js +24 -0
  63. package/lib/hooks/useResizeObserver.d.ts +1 -1
  64. package/lib/hooks/useResizeObserver.js +1 -1
  65. package/lib/sx.d.ts +2 -8
  66. package/lib/theme-preval.js +2 -2
  67. package/lib/theme.d.ts +0 -78
  68. package/lib/theme.js +1 -3
  69. package/lib/utils/testing.d.ts +1 -1
  70. package/lib-esm/ActionList/Header.js +1 -1
  71. package/lib-esm/ActionList/Item.d.ts +0 -6
  72. package/lib-esm/ActionList/Item.js +1 -5
  73. package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
  74. package/lib-esm/Autocomplete/Autocomplete.d.ts +8 -6
  75. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +8 -6
  76. package/lib-esm/Button/Button.d.ts +5 -5
  77. package/lib-esm/Button/ButtonBase.d.ts +1 -1
  78. package/lib-esm/Button/ButtonClose.d.ts +3 -3
  79. package/lib-esm/Button/ButtonDanger.d.ts +5 -5
  80. package/lib-esm/Button/ButtonInvisible.d.ts +5 -5
  81. package/lib-esm/Button/ButtonOutline.d.ts +5 -5
  82. package/lib-esm/Button/ButtonPrimary.d.ts +5 -5
  83. package/lib-esm/CircleBadge.d.ts +2 -2
  84. package/lib-esm/CircleOcticon.d.ts +4 -4
  85. package/lib-esm/DatePicker/DatePicker.d.ts +52 -0
  86. package/lib-esm/DatePicker/DatePicker.js +92 -0
  87. package/lib-esm/DatePicker/DatePickerAnchor.d.ts +5 -0
  88. package/lib-esm/DatePicker/DatePickerAnchor.js +174 -0
  89. package/lib-esm/DatePicker/DatePickerOverlay.d.ts +3 -0
  90. package/lib-esm/DatePicker/DatePickerOverlay.js +40 -0
  91. package/lib-esm/DatePicker/DatePickerPanel.d.ts +2 -0
  92. package/lib-esm/DatePicker/DatePickerPanel.js +332 -0
  93. package/lib-esm/DatePicker/Day.d.ts +15 -0
  94. package/lib-esm/DatePicker/Day.js +182 -0
  95. package/lib-esm/DatePicker/Month.d.ts +8 -0
  96. package/lib-esm/DatePicker/Month.js +98 -0
  97. package/lib-esm/DatePicker/dateParser.d.ts +12 -0
  98. package/lib-esm/DatePicker/dateParser.js +178 -0
  99. package/lib-esm/DatePicker/index.d.ts +2 -0
  100. package/lib-esm/DatePicker/index.js +1 -0
  101. package/lib-esm/DatePicker/useDatePicker.d.ts +107 -0
  102. package/lib-esm/DatePicker/useDatePicker.js +523 -0
  103. package/lib-esm/Dialog.d.ts +4 -4
  104. package/lib-esm/Dropdown.d.ts +16 -16
  105. package/lib-esm/DropdownMenu/DropdownButton.d.ts +6 -6
  106. package/lib-esm/FilterList.d.ts +303 -264
  107. package/lib-esm/FilterList.js +7 -3
  108. package/lib-esm/Flash.d.ts +1 -1
  109. package/lib-esm/Label.d.ts +1 -1
  110. package/lib-esm/Position.d.ts +4 -4
  111. package/lib-esm/ProgressBar.d.ts +1 -1
  112. package/lib-esm/SelectMenu/SelectMenu.d.ts +28 -26
  113. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
  114. package/lib-esm/TextInputWithTokens.d.ts +8 -10
  115. package/lib-esm/TextInputWithTokens.js +30 -101
  116. package/lib-esm/Timeline.d.ts +4 -4
  117. package/lib-esm/Token/AvatarToken.d.ts +1 -1
  118. package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
  119. package/lib-esm/Token/Token.d.ts +1 -1
  120. package/lib-esm/Token/Token.js +2 -13
  121. package/lib-esm/Token/TokenBase.js +4 -0
  122. package/lib-esm/Token/_RemoveTokenButton.js +2 -11
  123. package/lib-esm/_TextInputWrapper.d.ts +1 -1
  124. package/lib-esm/_TextInputWrapper.js +1 -1
  125. package/lib-esm/hooks/useDebounce.d.ts +2 -0
  126. package/lib-esm/hooks/useDebounce.js +16 -0
  127. package/lib-esm/hooks/useResizeObserver.d.ts +1 -1
  128. package/lib-esm/hooks/useResizeObserver.js +1 -1
  129. package/lib-esm/sx.d.ts +2 -8
  130. package/lib-esm/theme-preval.js +2 -2
  131. package/lib-esm/theme.d.ts +0 -78
  132. package/lib-esm/theme.js +1 -2
  133. package/lib-esm/utils/testing.d.ts +1 -1
  134. package/package.json +9 -10
  135. package/lib/utils/types/KeyPaths.d.ts +0 -3
  136. package/lib/utils/types/KeyPaths.js +0 -1
  137. package/lib-esm/utils/types/KeyPaths.d.ts +0 -3
  138. package/lib-esm/utils/types/KeyPaths.js +0 -1
@@ -21,7 +21,7 @@ const sizeVariants = variant({
21
21
  const TextInputWrapper = styled.span.withConfig({
22
22
  displayName: "_TextInputWrapper__TextInputWrapper",
23
23
  componentId: "sc-5vfcis-0"
24
- })(["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:", ";cursor:text;", " .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 => {
24
+ })(["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 => {
25
25
  if (props.hasIcon) {
26
26
  return css(["padding:0;"]);
27
27
  } else {
@@ -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();
package/lib-esm/sx.d.ts CHANGED
@@ -1,12 +1,6 @@
1
- import { SystemCssProperties, SystemStyleObject } from '@styled-system/css';
2
- import { ThemeColorPaths, ThemeShadowPaths } from './theme';
3
- import { ColorProps, ShadowProps } from 'styled-system';
4
- export declare type BetterCssProperties = {
5
- [K in keyof SystemCssProperties]: K extends keyof ColorProps ? ThemeColorPaths | SystemCssProperties[K] : K extends keyof ShadowProps ? ThemeShadowPaths | SystemCssProperties[K] : SystemCssProperties[K];
6
- };
7
- export declare type BetterSystemStyleObject = BetterCssProperties | SystemStyleObject;
1
+ import { SystemStyleObject } from '@styled-system/css';
8
2
  export interface SxProp {
9
- sx?: BetterSystemStyleObject;
3
+ sx?: SystemStyleObject;
10
4
  }
11
5
  declare const sx: (props: SxProp) => import("@styled-system/css").CssFunctionReturnType;
12
6
  export default sx;
@@ -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": {
@@ -1,80 +1,2 @@
1
1
  import { theme } from './theme-preval';
2
- import { KeyPaths } from './utils/types/KeyPaths';
3
2
  export default theme;
4
- declare type ThemeColors = {
5
- fg: {
6
- default: string;
7
- muted: string;
8
- subtle: string;
9
- onEmphasis: string;
10
- };
11
- canvas: {
12
- default: string;
13
- overlay: string;
14
- inset: string;
15
- subtle: string;
16
- };
17
- border: {
18
- default: string;
19
- muted: string;
20
- subtle: string;
21
- };
22
- neutral: {
23
- emphasisPlus: string;
24
- emphasis: string;
25
- muted: string;
26
- subtle: string;
27
- };
28
- accent: {
29
- fg: string;
30
- emphasis: string;
31
- muted: string;
32
- subtle: string;
33
- };
34
- success: {
35
- fg: string;
36
- emphasis: string;
37
- muted: string;
38
- subtle: string;
39
- };
40
- attention: {
41
- fg: string;
42
- emphasis: string;
43
- muted: string;
44
- subtle: string;
45
- };
46
- severe: {
47
- fg: string;
48
- emphasis: string;
49
- muted: string;
50
- subtle: string;
51
- };
52
- danger: {
53
- fg: string;
54
- emphasis: string;
55
- muted: string;
56
- subtle: string;
57
- };
58
- done: {
59
- fg: string;
60
- emphasis: string;
61
- muted: string;
62
- subtle: string;
63
- };
64
- sponsors: {
65
- fg: string;
66
- emphasis: string;
67
- muted: string;
68
- subtle: string;
69
- };
70
- };
71
- declare type ThemeShadows = {
72
- shadow: {
73
- small: string;
74
- medium: string;
75
- large: string;
76
- extraLarge: string;
77
- };
78
- };
79
- export declare type ThemeColorPaths = KeyPaths<ThemeColors>;
80
- export declare type ThemeShadowPaths = KeyPaths<ThemeShadows>;
package/lib-esm/theme.js CHANGED
@@ -1,3 +1,2 @@
1
1
  import { theme } from './theme-preval';
2
- export default theme; // NOTE: for now, ThemeColors and ThemeShadows are handcrafted types. It would be nice if these
3
- // were exports from primitives (or a different shape but derived from those exports).
2
+ export default theme;
@@ -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-2021103235619",
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",
@@ -132,9 +133,7 @@
132
133
  "rollup-plugin-visualizer": "5.5.0",
133
134
  "semver": "7.3.5",
134
135
  "size-limit": "5.0.2",
135
- "storybook-addon-performance": "0.16.1",
136
136
  "styled-components": "4.4.1",
137
- "ts-toolbelt": "9.6.0",
138
137
  "typescript": "4.2.2"
139
138
  },
140
139
  "peerDependencies": {
@@ -1,3 +0,0 @@
1
- export declare type KeyPaths<O extends Record<string, unknown>> = {
2
- [K in keyof O]: K extends string ? O[K] extends string ? `${K}` : `${K}.${KeyPaths<O[K]>}` : never;
3
- }[keyof O];
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,3 +0,0 @@
1
- export declare type KeyPaths<O extends Record<string, unknown>> = {
2
- [K in keyof O]: K extends string ? O[K] extends string ? `${K}` : `${K}.${KeyPaths<O[K]>}` : never;
3
- }[keyof O];
@@ -1 +0,0 @@
1
- export {};