@primer/components 0.0.0-202110417386 → 0.0.0-2021108142649

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 (118) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/dist/browser.esm.js +472 -472
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +102 -102
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/ActionList2/Description.d.ts +12 -0
  7. package/lib/ActionList2/Description.js +53 -0
  8. package/lib/ActionList2/Divider.d.ts +5 -0
  9. package/lib/ActionList2/Divider.js +35 -0
  10. package/lib/ActionList2/Group.d.ts +32 -0
  11. package/lib/ActionList2/Group.js +104 -0
  12. package/lib/ActionList2/Item.d.ts +71 -0
  13. package/lib/ActionList2/Item.js +234 -0
  14. package/lib/ActionList2/LinkItem.d.ts +17 -0
  15. package/lib/ActionList2/LinkItem.js +57 -0
  16. package/lib/ActionList2/List.d.ts +26 -0
  17. package/lib/ActionList2/List.js +59 -0
  18. package/lib/ActionList2/Selection.d.ts +5 -0
  19. package/lib/ActionList2/Selection.js +70 -0
  20. package/lib/ActionList2/Visuals.d.ts +11 -0
  21. package/lib/ActionList2/Visuals.js +90 -0
  22. package/lib/ActionList2/index.d.ts +40 -0
  23. package/lib/ActionList2/index.js +47 -0
  24. package/lib/Autocomplete/Autocomplete.d.ts +28 -28
  25. package/lib/Autocomplete/AutocompleteInput.d.ts +28 -28
  26. package/lib/Button/Button.d.ts +25 -25
  27. package/lib/Button/ButtonClose.d.ts +45 -45
  28. package/lib/Button/ButtonDanger.d.ts +25 -25
  29. package/lib/Button/ButtonInvisible.d.ts +25 -25
  30. package/lib/Button/ButtonOutline.d.ts +25 -25
  31. package/lib/Button/ButtonPrimary.d.ts +25 -25
  32. package/lib/CircleOcticon.d.ts +42 -42
  33. package/lib/Dialog.d.ts +45 -45
  34. package/lib/Dropdown.d.ts +176 -176
  35. package/lib/DropdownMenu/DropdownButton.d.ts +46 -46
  36. package/lib/FilterList.d.ts +42 -42
  37. package/lib/Position.d.ts +4 -4
  38. package/lib/SelectMenu/SelectMenu.d.ts +246 -246
  39. package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
  40. package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
  41. package/lib/TextInputWithTokens.d.ts +28 -28
  42. package/lib/Timeline.d.ts +43 -43
  43. package/lib/Token/AvatarToken.d.ts +1 -1
  44. package/lib/Token/IssueLabelToken.d.ts +1 -1
  45. package/lib/Token/Token.d.ts +1 -1
  46. package/lib/experiments.d.ts +1 -0
  47. package/lib/experiments.js +18 -0
  48. package/lib/sx.d.ts +2 -0
  49. package/lib/sx.js +8 -0
  50. package/lib/theme-preval.js +81 -2
  51. package/lib/utils/create-slots.d.ts +17 -0
  52. package/lib/utils/create-slots.js +105 -0
  53. package/lib/utils/testing.d.ts +14 -1
  54. package/lib/utils/use-force-update.d.ts +1 -0
  55. package/lib/utils/use-force-update.js +19 -0
  56. package/lib-esm/ActionList2/Description.d.ts +12 -0
  57. package/lib-esm/ActionList2/Description.js +37 -0
  58. package/lib-esm/ActionList2/Divider.d.ts +5 -0
  59. package/lib-esm/ActionList2/Divider.js +23 -0
  60. package/lib-esm/ActionList2/Group.d.ts +32 -0
  61. package/lib-esm/ActionList2/Group.js +85 -0
  62. package/lib-esm/ActionList2/Item.d.ts +71 -0
  63. package/lib-esm/ActionList2/Item.js +201 -0
  64. package/lib-esm/ActionList2/LinkItem.d.ts +17 -0
  65. package/lib-esm/ActionList2/LinkItem.js +43 -0
  66. package/lib-esm/ActionList2/List.d.ts +26 -0
  67. package/lib-esm/ActionList2/List.js +37 -0
  68. package/lib-esm/ActionList2/Selection.d.ts +5 -0
  69. package/lib-esm/ActionList2/Selection.js +52 -0
  70. package/lib-esm/ActionList2/Visuals.d.ts +11 -0
  71. package/lib-esm/ActionList2/Visuals.js +68 -0
  72. package/lib-esm/ActionList2/index.d.ts +40 -0
  73. package/lib-esm/ActionList2/index.js +33 -0
  74. package/lib-esm/Autocomplete/Autocomplete.d.ts +28 -28
  75. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +28 -28
  76. package/lib-esm/Button/Button.d.ts +25 -25
  77. package/lib-esm/Button/ButtonClose.d.ts +45 -45
  78. package/lib-esm/Button/ButtonDanger.d.ts +25 -25
  79. package/lib-esm/Button/ButtonInvisible.d.ts +25 -25
  80. package/lib-esm/Button/ButtonOutline.d.ts +25 -25
  81. package/lib-esm/Button/ButtonPrimary.d.ts +25 -25
  82. package/lib-esm/CircleOcticon.d.ts +42 -42
  83. package/lib-esm/Dialog.d.ts +45 -45
  84. package/lib-esm/Dropdown.d.ts +176 -176
  85. package/lib-esm/DropdownMenu/DropdownButton.d.ts +46 -46
  86. package/lib-esm/FilterList.d.ts +42 -42
  87. package/lib-esm/Position.d.ts +4 -4
  88. package/lib-esm/SelectMenu/SelectMenu.d.ts +246 -246
  89. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
  90. package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
  91. package/lib-esm/TextInputWithTokens.d.ts +28 -28
  92. package/lib-esm/Timeline.d.ts +43 -43
  93. package/lib-esm/Token/AvatarToken.d.ts +1 -1
  94. package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
  95. package/lib-esm/Token/Token.d.ts +1 -1
  96. package/lib-esm/experiments.d.ts +1 -0
  97. package/lib-esm/experiments.js +2 -0
  98. package/lib-esm/sx.d.ts +2 -0
  99. package/lib-esm/sx.js +3 -1
  100. package/lib-esm/theme-preval.js +81 -2
  101. package/lib-esm/utils/create-slots.d.ts +17 -0
  102. package/lib-esm/utils/create-slots.js +84 -0
  103. package/lib-esm/utils/testing.d.ts +14 -1
  104. package/lib-esm/utils/use-force-update.d.ts +1 -0
  105. package/lib-esm/utils/use-force-update.js +6 -0
  106. package/package.json +4 -2
  107. package/lib/NewLabel/NewLabel.d.ts +0 -11
  108. package/lib/NewLabel/NewLabel.js +0 -134
  109. package/lib/NewLabel/NewStateLabel.d.ts +0 -10
  110. package/lib/NewLabel/NewStateLabel.js +0 -49
  111. package/lib/NewLabel/_newLabelStyleUtils.d.ts +0 -3
  112. package/lib/NewLabel/_newLabelStyleUtils.js +0 -40
  113. package/lib-esm/NewLabel/NewLabel.d.ts +0 -11
  114. package/lib-esm/NewLabel/NewLabel.js +0 -115
  115. package/lib-esm/NewLabel/NewStateLabel.d.ts +0 -10
  116. package/lib-esm/NewLabel/NewStateLabel.js +0 -36
  117. package/lib-esm/NewLabel/_newLabelStyleUtils.d.ts +0 -3
  118. package/lib-esm/NewLabel/_newLabelStyleUtils.js +0 -30
@@ -1,115 +0,0 @@
1
- import React from 'react';
2
- import styled, { css } from 'styled-components';
3
- import { get } from '../constants';
4
- import { labelVariants } from './_newLabelStyleUtils';
5
- const labelColorMap = {
6
- default: {
7
- borderColor: get('colors.border.default')
8
- },
9
- primary: {
10
- borderColor: get('colors.fg.default')
11
- },
12
- secondary: {
13
- borderColor: get('colors.border.muted'),
14
- textColor: get('colors.fg.muted')
15
- },
16
- accent: {
17
- borderColor: get('colors.accent.emphasis'),
18
- textColor: get('colors.accent.fg')
19
- },
20
- success: {
21
- borderColor: get('colors.success.emphasis'),
22
- textColor: get('colors.success.fg')
23
- },
24
- attention: {
25
- borderColor: get('colors.attention.emphasis'),
26
- textColor: get('colors.attention.fg')
27
- },
28
- severe: {
29
- borderColor: get('colors.severe.emphasis'),
30
- textColor: get('colors.severe.fg')
31
- },
32
- danger: {
33
- borderColor: get('colors.danger.emphasis'),
34
- textColor: get('colors.danger.fg')
35
- },
36
- done: {
37
- borderColor: get('colors.done.fg'),
38
- textColor: get('colors.done.emphasis')
39
- },
40
- sponsors: {
41
- borderColor: get('colors.sponsors.fg'),
42
- textColor: get('colors.sponsors.emphasis')
43
- }
44
- };
45
- const filledLabelColorMap = {
46
- default: {
47
- bgColor: get('colors.neutral.muted')
48
- },
49
- primary: {
50
- bgColor: get('colors.neutral.emphasis'),
51
- textColor: get('colors.fg.onEmphasis')
52
- },
53
- secondary: {
54
- bgColor: get('colors.neutral.subtle'),
55
- textColor: get('colors.fg.muted')
56
- },
57
- accent: {
58
- bgColor: get('colors.accent.emphasis'),
59
- textColor: get('colors.fg.onEmphasis')
60
- },
61
- success: {
62
- bgColor: get('colors.success.emphasis'),
63
- textColor: get('colors.fg.onEmphasis')
64
- },
65
- attention: {
66
- bgColor: get('colors.attention.emphasis'),
67
- textColor: get('colors.fg.onEmphasis')
68
- },
69
- severe: {
70
- bgColor: get('colors.severe.emphasis'),
71
- textColor: get('colors.fg.onEmphasis')
72
- },
73
- danger: {
74
- bgColor: get('colors.danger.emphasis'),
75
- textColor: get('colors.fg.onEmphasis')
76
- },
77
- done: {
78
- bgColor: get('colors.done.fg'),
79
- textColor: get('colors.fg.onEmphasis')
80
- },
81
- sponsors: {
82
- bgColor: get('colors.sponsors.fg'),
83
- textColor: get('colors.fg.onEmphasis')
84
- }
85
- };
86
- const LeadingVisualContainer = styled('span').withConfig({
87
- displayName: "NewLabel__LeadingVisualContainer",
88
- componentId: "sc-6osasq-0"
89
- })(["flex-shrink:0;line-height:0;margin-right:", ";"], get('space.1'));
90
- const LabelContainer = styled.span.withConfig({
91
- displayName: "NewLabel__LabelContainer",
92
- componentId: "sc-6osasq-1"
93
- })(["align-items:center;border-width:1px;border-radius:999px;border-style:solid;display:inline-flex;font-weight:", ";line-height:1;white-space:nowrap;", ";", ""], get('fontWeights.bold'), labelVariants, ({
94
- color = 'default',
95
- filled
96
- }) => {
97
- if (filled) {
98
- return css(["background-color:", ";border-color:transparent;color:", ";"], filledLabelColorMap[color].bgColor, filledLabelColorMap[color].textColor);
99
- } else {
100
- return css(["background-color:transparent;border-color:", ";color:", ";"], labelColorMap[color].borderColor, labelColorMap[color].textColor);
101
- }
102
- });
103
-
104
- const NewLabel = ({
105
- children,
106
- leadingVisual: LeadingVisual,
107
- ...other
108
- }) => /*#__PURE__*/React.createElement(LabelContainer, other, LeadingVisual && /*#__PURE__*/React.createElement(LeadingVisualContainer, null, /*#__PURE__*/React.createElement(LeadingVisual, null)), children);
109
-
110
- NewLabel.displayName = "NewLabel";
111
- NewLabel.defaultProps = {
112
- size: 'md',
113
- color: 'default'
114
- };
115
- export default NewLabel;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { LabelSizeKeys } from './_newLabelStyleUtils';
3
- declare type Statuses = 'issueClosed' | 'pullClosed' | 'pullMerged' | 'issueOpened' | 'pullOpened' | 'draft';
4
- interface Props {
5
- status: Statuses;
6
- size?: LabelSizeKeys;
7
- leadingVisual?: React.ComponentType<any>;
8
- }
9
- declare const NewStateLabel: React.FC<Props>;
10
- export default NewStateLabel;
@@ -1,36 +0,0 @@
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
-
3
- import React from 'react';
4
- import { GitMergeIcon, GitPullRequestIcon, IssueClosedIcon, IssueOpenedIcon } from '@primer/octicons-react';
5
- import NewLabel from './NewLabel';
6
- const colorMap = {
7
- issueClosed: 'done',
8
- pullClosed: 'done',
9
- pullMerged: 'done',
10
- issueOpened: 'success',
11
- pullOpened: 'success',
12
- draft: 'primary'
13
- };
14
- const octiconMap = {
15
- issueOpened: IssueOpenedIcon,
16
- pullOpened: GitPullRequestIcon,
17
- issueClosed: IssueClosedIcon,
18
- pullClosed: GitPullRequestIcon,
19
- pullMerged: GitMergeIcon,
20
- draft: GitPullRequestIcon
21
- };
22
-
23
- const NewStateLabel = ({
24
- status,
25
- ...rest
26
- }) => /*#__PURE__*/React.createElement(NewLabel, _extends({
27
- filled: true,
28
- color: colorMap[status],
29
- leadingVisual: octiconMap[status]
30
- }, rest));
31
-
32
- NewStateLabel.displayName = "NewStateLabel";
33
- NewStateLabel.defaultProps = {
34
- size: 'lg'
35
- };
36
- export default NewStateLabel;
@@ -1,3 +0,0 @@
1
- export declare type LabelSizeKeys = 'sm' | 'md' | 'lg';
2
- export declare const badgeSizes: Record<LabelSizeKeys, number>;
3
- export declare const labelVariants: (...args: any[]) => any;
@@ -1,30 +0,0 @@
1
- import { variant } from 'styled-system';
2
- // TODO: consider moving to Primitives
3
- export const badgeSizes = {
4
- sm: 20,
5
- md: 24,
6
- lg: 32
7
- };
8
- export const labelVariants = variant({
9
- prop: 'size',
10
- variants: {
11
- sm: {
12
- fontSize: 0,
13
- height: `${badgeSizes.sm}px`,
14
- paddingLeft: 2,
15
- paddingRight: 2
16
- },
17
- md: {
18
- fontSize: 0,
19
- height: `${badgeSizes.md}px`,
20
- paddingLeft: 2,
21
- paddingRight: 2
22
- },
23
- lg: {
24
- fontSize: 1,
25
- height: `${badgeSizes.lg}px`,
26
- paddingLeft: 3,
27
- paddingRight: 3
28
- }
29
- }
30
- });