@primer/components 0.0.0-202191514518 → 0.0.0-20219153411

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 (92) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/browser.esm.js +69 -69
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +28 -28
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/ActionList/Header.js +1 -1
  7. package/lib/ActionList/Item.js +7 -7
  8. package/lib/BranchName.js +1 -1
  9. package/lib/Breadcrumbs.js +1 -1
  10. package/lib/Button/Button.js +1 -1
  11. package/lib/Button/ButtonClose.js +1 -1
  12. package/lib/Button/ButtonInvisible.js +1 -1
  13. package/lib/Button/ButtonTableList.js +1 -1
  14. package/lib/Dialog/ConfirmationDialog.js +1 -1
  15. package/lib/Dialog/Dialog.js +2 -2
  16. package/lib/FilterList.js +1 -1
  17. package/lib/Label.js +1 -1
  18. package/lib/Link.js +1 -1
  19. package/lib/Pagination/Pagination.js +1 -1
  20. package/lib/SelectMenu/SelectMenuDivider.js +1 -1
  21. package/lib/SelectMenu/SelectMenuFooter.js +1 -1
  22. package/lib/SelectMenu/SelectMenuItem.js +1 -1
  23. package/lib/SelectMenu/SelectMenuTab.js +1 -1
  24. package/lib/SubNav.js +1 -1
  25. package/lib/Timeline.js +2 -2
  26. package/lib/Token/Token.js +1 -1
  27. package/lib/UnderlineNav.js +1 -1
  28. package/lib/_TextInputWrapper.js +1 -1
  29. package/lib-esm/ActionList/Header.js +1 -1
  30. package/lib-esm/ActionList/Item.js +7 -7
  31. package/lib-esm/BranchName.js +1 -1
  32. package/lib-esm/Breadcrumbs.js +1 -1
  33. package/lib-esm/Button/Button.js +1 -1
  34. package/lib-esm/Button/ButtonClose.js +1 -1
  35. package/lib-esm/Button/ButtonInvisible.js +1 -1
  36. package/lib-esm/Button/ButtonTableList.js +1 -1
  37. package/lib-esm/Dialog/ConfirmationDialog.js +1 -1
  38. package/lib-esm/Dialog/Dialog.js +2 -2
  39. package/lib-esm/FilterList.js +1 -1
  40. package/lib-esm/Label.js +1 -1
  41. package/lib-esm/Link.js +1 -1
  42. package/lib-esm/Pagination/Pagination.js +1 -1
  43. package/lib-esm/SelectMenu/SelectMenuDivider.js +1 -1
  44. package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
  45. package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
  46. package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
  47. package/lib-esm/SubNav.js +1 -1
  48. package/lib-esm/Timeline.js +2 -2
  49. package/lib-esm/Token/Token.js +1 -1
  50. package/lib-esm/UnderlineNav.js +1 -1
  51. package/lib-esm/_TextInputWrapper.js +1 -1
  52. package/package.json +1 -1
  53. package/lib/ActionList2/Description.d.ts +0 -5
  54. package/lib/ActionList2/Description.js +0 -54
  55. package/lib/ActionList2/Divider.d.ts +0 -8
  56. package/lib/ActionList2/Divider.js +0 -42
  57. package/lib/ActionList2/Group.d.ts +0 -8
  58. package/lib/ActionList2/Group.js +0 -39
  59. package/lib/ActionList2/Header.d.ts +0 -26
  60. package/lib/ActionList2/Header.js +0 -55
  61. package/lib/ActionList2/Item.d.ts +0 -52
  62. package/lib/ActionList2/Item.js +0 -188
  63. package/lib/ActionList2/List.d.ts +0 -18
  64. package/lib/ActionList2/List.js +0 -52
  65. package/lib/ActionList2/Selection.d.ts +0 -5
  66. package/lib/ActionList2/Selection.js +0 -67
  67. package/lib/ActionList2/Visuals.d.ts +0 -12
  68. package/lib/ActionList2/Visuals.js +0 -91
  69. package/lib/ActionList2/hacks.d.ts +0 -30
  70. package/lib/ActionList2/hacks.js +0 -38
  71. package/lib/ActionList2/index.d.ts +0 -26
  72. package/lib/ActionList2/index.js +0 -36
  73. package/lib-esm/ActionList2/Description.d.ts +0 -5
  74. package/lib-esm/ActionList2/Description.js +0 -38
  75. package/lib-esm/ActionList2/Divider.d.ts +0 -8
  76. package/lib-esm/ActionList2/Divider.js +0 -30
  77. package/lib-esm/ActionList2/Group.d.ts +0 -8
  78. package/lib-esm/ActionList2/Group.js +0 -29
  79. package/lib-esm/ActionList2/Header.d.ts +0 -26
  80. package/lib-esm/ActionList2/Header.js +0 -45
  81. package/lib-esm/ActionList2/Item.d.ts +0 -52
  82. package/lib-esm/ActionList2/Item.js +0 -184
  83. package/lib-esm/ActionList2/List.d.ts +0 -18
  84. package/lib-esm/ActionList2/List.js +0 -42
  85. package/lib-esm/ActionList2/Selection.d.ts +0 -5
  86. package/lib-esm/ActionList2/Selection.js +0 -50
  87. package/lib-esm/ActionList2/Visuals.d.ts +0 -12
  88. package/lib-esm/ActionList2/Visuals.js +0 -68
  89. package/lib-esm/ActionList2/hacks.d.ts +0 -30
  90. package/lib-esm/ActionList2/hacks.js +0 -30
  91. package/lib-esm/ActionList2/index.d.ts +0 -26
  92. package/lib-esm/ActionList2/index.js +0 -23
@@ -7,7 +7,7 @@ import { COMMON, get } from '../constants';
7
7
  import StyledOcticon from '../StyledOcticon';
8
8
  import sx from '../sx';
9
9
  import { MenuContext } from './SelectMenuContext';
10
- export const listItemStyles = css(["display:flex;align-items:center;padding:", ";overflow:hidden;text-align:left;cursor:pointer;background-color:", ";border:0;border-bottom:", " solid ", ";color:", ";text-decoration:none;font-size:", ";font-family:inherit;width:100%;&:hover{text-decoration:none;}&:focus{outline:none;}&[hidden]{display:none !important;}@media (min-width:", "){padding-top:", ";padding-bottom:", ";}.SelectMenu-icon{width:", ";margin-right:", ";flex-shrink:0;}.SelectMenu-selected-icon{visibility:hidden;transition:transform 0.12s cubic-bezier(0.5,0.1,1,0.5),visibility 0s 0.12s linear;transform:scale(0);}&[aria-checked='true']{font-weight:500;color:", ";.SelectMenu-selected-icon{visibility:visible;transition:transform 0.12s cubic-bezier(0,0,0.2,1),visibility 0s linear;transform:scale(1);}}@media (hover:hover){&:hover,&:active,&:focus{background-color:", ";}}@media (hover:none){&:focus,&:active{background-color:", ";}-webkit-tap-highlight-color:", ";}"], get('space.3'), get('colors.canvas.overlay'), get('borderWidths.1'), get('colors.border.muted'), get('colors.fg.muted'), get('fontSizes.0'), get('breakpoints.0'), get('space.2'), get('space.2'), get('space.3'), get('space.2'), get('colors.fg.default'), get('colors.neutral.subtle'), get('colors.canvas.subtle'), get('colors.selectMenu.tapHighlight'));
10
+ export const listItemStyles = css(["display:flex;align-items:center;padding:", ";overflow:hidden;text-align:left;cursor:pointer;background-color:", ";border:0;border-bottom:", " solid ", ";color:", ";text-decoration:none;font-size:", ";font-family:inherit;width:100%;&:hover{text-decoration:none;}&:focus{outline:none;}&[hidden]{display:none !important;}@media (min-width:", "){padding-top:", ";padding-bottom:", ";}.SelectMenu-icon{width:", ";margin-right:", ";flex-shrink:0;}.SelectMenu-selected-icon{visibility:hidden;transition:transform 0.12s cubic-bezier(0.5,0.1,1,0.5),visibility 0s 0.12s linear;transform:scale(0);}&[aria-checked='true']{font-weight:500;color:", ";.SelectMenu-selected-icon{visibility:visible;transition:transform 0.12s cubic-bezier(0,0,0.2,1),visibility 0s linear;transform:scale(1);}}@media (hover:hover){&:hover,&:active,&:focus{background-color:", ";}}@media (hover:none){&:focus,&:active{background-color:", ";}-webkit-tap-highlight-color:", ";}"], get('space.3'), get('colors.canvas.overlay'), get('borderWidths.1'), get('colors.border.muted'), get('colors.primer.fg.disabled'), get('fontSizes.0'), get('breakpoints.0'), get('space.2'), get('space.2'), get('space.3'), get('space.2'), get('colors.fg.default'), get('colors.neutral.subtle'), get('colors.canvas.subtle'), get('colors.selectMenu.tapHighlight'));
11
11
  const StyledItem = styled.a.attrs(() => ({
12
12
  role: 'menuitemcheckbox'
13
13
  })).withConfig({
@@ -6,7 +6,7 @@ import styled, { css } from 'styled-components';
6
6
  import { COMMON, get } from '../constants';
7
7
  import sx from '../sx';
8
8
  import { MenuContext } from './SelectMenuContext';
9
- const tabStyles = css(["flex:1;padding:", " ", ";font-size:", ";font-weight:500;color:", ";text-align:center;background-color:transparent;border:0;box-shadow:inset 0 -1px 0 ", ";@media (min-width:", "){flex:none;padding:", " ", ";border:", " solid transparent;border-bottom-width:0;border-top-left-radius:", ";border-top-right-radius:", ";}&[aria-selected='true']{z-index:1;color:", ";background-color:", ";box-shadow:0 0 0 1px ", ";@media (min-width:", "){border-color:", ";box-shadow:none;}}&:focus{background-color:", ";}"], get('space.2'), get('space.3'), get('fontSizes.0'), get('colors.fg.muted'), get('colors.border.muted'), get('breakpoints.0'), get('space.1'), get('space.3'), get('borderWidths.1'), get('radii.2'), get('radii.2'), get('colors.text-primary'), get('colors.canvas.overlay'), get('colors.border.muted'), get('breakpoints.0'), get('colors.border.muted'), get('colors.neutral.subtle'));
9
+ const tabStyles = css(["flex:1;padding:", " ", ";font-size:", ";font-weight:500;color:", ";text-align:center;background-color:transparent;border:0;box-shadow:inset 0 -1px 0 ", ";@media (min-width:", "){flex:none;padding:", " ", ";border:", " solid transparent;border-bottom-width:0;border-top-left-radius:", ";border-top-right-radius:", ";}&[aria-selected='true']{z-index:1;color:", ";background-color:", ";box-shadow:0 0 0 1px ", ";@media (min-width:", "){border-color:", ";box-shadow:none;}}&:focus{background-color:", ";}"], get('space.2'), get('space.3'), get('fontSizes.0'), get('colors.primer.fg.disabled'), get('colors.border.muted'), get('breakpoints.0'), get('space.1'), get('space.3'), get('borderWidths.1'), get('radii.2'), get('radii.2'), get('colors.text-primary'), get('colors.canvas.overlay'), get('colors.border.muted'), get('breakpoints.0'), get('colors.border.muted'), get('colors.neutral.subtle'));
10
10
  const StyledTab = styled.button.withConfig({
11
11
  displayName: "SelectMenuTab__StyledTab",
12
12
  componentId: "ga32sz-0"
package/lib-esm/SubNav.js CHANGED
@@ -47,7 +47,7 @@ const SubNavLink = styled.a.attrs(props => ({
47
47
  })).withConfig({
48
48
  displayName: "SubNav__SubNavLink",
49
49
  componentId: "f7w0xa-1"
50
- })(["padding-left:", ";padding-right:", ";font-weight:", ";font-size:", ";line-height:20px;min-height:34px;color:", ";text-align:center;text-decoration:none;border-top:1px solid ", ";border-bottom:1px solid ", ";border-right:1px solid ", ";display:flex;align-items:center;&:first-of-type{border-top-left-radius:", ";border-bottom-left-radius:", ";border-left:1px solid ", ";}&:last-of-type{border-top-right-radius:", ";border-bottom-right-radius:", ";}&:hover,&:focus{text-decoration:none;background-color:", ";transition:0.2s ease;.SubNav-octicon{color:", ";}}&.selected{color:", ";background-color:", ";border-color:", ";.SubNav-octicon{color:", ";}}", ";", ";"], get('space.3'), get('space.3'), get('fontWeights.semibold'), get('fontSizes.1'), get('colors.fg.default'), get('colors.border.default'), get('colors.border.default'), get('colors.border.default'), get('radii.2'), get('radii.2'), get('colors.border.default'), get('radii.2'), get('radii.2'), get('colors.canvas.subtle'), get('colors.fg.muted'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.accent.emphasis'), get('colors.fg.onEmphasis'), COMMON, sx);
50
+ })(["padding-left:", ";padding-right:", ";font-weight:", ";font-size:", ";line-height:20px;min-height:34px;color:", ";text-align:center;text-decoration:none;border-top:1px solid ", ";border-bottom:1px solid ", ";border-right:1px solid ", ";display:flex;align-items:center;&:first-of-type{border-top-left-radius:", ";border-bottom-left-radius:", ";border-left:1px solid ", ";}&:last-of-type{border-top-right-radius:", ";border-bottom-right-radius:", ";}&:hover,&:focus{text-decoration:none;background-color:", ";transition:0.2s ease;.SubNav-octicon{color:", ";}}&.selected{color:", ";background-color:", ";border-color:", ";.SubNav-octicon{color:", ";}}", ";", ";"], get('space.3'), get('space.3'), get('fontWeights.semibold'), get('fontSizes.1'), get('colors.fg.default'), get('colors.border.default'), get('colors.border.default'), get('colors.border.default'), get('radii.2'), get('radii.2'), get('colors.border.default'), get('radii.2'), get('radii.2'), get('colors.canvas.subtle'), get('colors.primer.fg.disabled'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.accent.emphasis'), get('colors.fg.onEmphasis'), COMMON, sx);
51
51
  SubNavLink.displayName = 'SubNav.Link';
52
52
  SubNavLinks.displayName = 'SubNav.Links';
53
53
  export default Object.assign(SubNav, {
@@ -15,7 +15,7 @@ const TimelineItem = styled(Box).attrs(props => ({
15
15
  })).withConfig({
16
16
  displayName: "Timeline__TimelineItem",
17
17
  componentId: "c4dq2e-1"
18
- })(["display:flex;position:relative;padding:", " 0;margin-left:", ";&::before{position:absolute;top:0;bottom:0;left:0;display:block;width:2px;content:'';background-color:", ";}", " ", ";", ";"], get('space.3'), get('space.3'), get('colors.border.muted'), props => props.condensed && css(["padding-top:", ";padding-bottom:0;&:last-child{padding-bottom:", ";}.TimelineItem-Badge{height:16px;margin-top:", ";margin-bottom:", ";color:", ";background-color:", ";border:0;}"], get('space.1'), get('space.3'), get('space.2'), get('space.2'), get('colors.fg.muted'), get('colors.canvas.default')), COMMON, sx);
18
+ })(["display:flex;position:relative;padding:", " 0;margin-left:", ";&::before{position:absolute;top:0;bottom:0;left:0;display:block;width:2px;content:'';background-color:", ";}", " ", ";", ";"], get('space.3'), get('space.3'), get('colors.border.muted'), props => props.condensed && css(["padding-top:", ";padding-bottom:0;&:last-child{padding-bottom:", ";}.TimelineItem-Badge{height:16px;margin-top:", ";margin-bottom:", ";color:", ";background-color:", ";border:0;}"], get('space.1'), get('space.3'), get('space.2'), get('space.2'), get('colors.primer.fg.disabled'), get('colors.canvas.default')), COMMON, sx);
19
19
 
20
20
  const TimelineBadge = props => {
21
21
  return /*#__PURE__*/React.createElement(Box, {
@@ -45,7 +45,7 @@ TimelineBadge.displayName = "TimelineBadge";
45
45
  const TimelineBody = styled(Box).withConfig({
46
46
  displayName: "Timeline__TimelineBody",
47
47
  componentId: "c4dq2e-2"
48
- })(["min-width:0;max-width:100%;margin-top:", ";color:", ";flex:auto;font-size:", ";", ";"], get('space.1'), get('colors.fg.muted'), get('fontSizes.1'), sx);
48
+ })(["min-width:0;max-width:100%;margin-top:", ";color:", ";flex:auto;font-size:", ";", ";"], get('space.1'), get('colors.primer.fg.disabled'), get('fontSizes.1'), sx);
49
49
  const TimelineBreak = styled(Box).withConfig({
50
50
  displayName: "Timeline__TimelineBreak",
51
51
  componentId: "c4dq2e-3"
@@ -11,7 +11,7 @@ const tokenBorderWidthPx = 1;
11
11
  const DefaultTokenStyled = styled(TokenBase).withConfig({
12
12
  displayName: "Token__DefaultTokenStyled",
13
13
  componentId: "sc-1dg52pw-0"
14
- })(["background-color:", ";border-color:", ";border-style:solid;border-width:", "px;color:", ";max-width:100%;padding-right:", ";position:relative;", " ", ""], get('colors.neutral.subtle'), props => props.isSelected ? get('colors.fg.default') : get('colors.border.subtle'), tokenBorderWidthPx, props => props.isSelected ? get('colors.fg.default') : get('colors.fg.muted'), props => !props.hideRemoveButton ? 0 : undefined, sx, props => {
14
+ })(["background-color:", ";border-color:", ";border-style:solid;border-width:", "px;color:", ";max-width:100%;padding-right:", ";position:relative;", " ", ""], get('colors.neutral.subtle'), props => props.isSelected ? get('colors.fg.default') : get('colors.border.subtle'), tokenBorderWidthPx, props => props.isSelected ? get('colors.fg.default') : get('colors.primer.fg.disabled'), props => !props.hideRemoveButton ? 0 : undefined, sx, props => {
15
15
  if (props.isTokenInteractive) {
16
16
  return css(["&:hover{background-color:", ";box-shadow:", ";color:", ";}"], get('colors.neutral.muted'), get('colors.shadow.medium'), get('colors.fg.default'));
17
17
  }
@@ -42,7 +42,7 @@ const UnderlineNavLink = styled.a.attrs(props => ({
42
42
  })).withConfig({
43
43
  displayName: "UnderlineNav__UnderlineNavLink",
44
44
  componentId: "zrnxqt-1"
45
- })(["padding:", " ", ";margin-right:", ";font-size:", ";line-height:", ";color:", ";text-align:center;border-bottom:2px solid transparent;text-decoration:none;&:hover,&:focus{color:", ";text-decoration:none;border-bottom-color:", ";transition:0.2s ease;.UnderlineNav-octicon{color:", ";}}&.selected{color:", ";border-bottom-color:", ";.UnderlineNav-octicon{color:", ";}}", ";", ";"], get('space.3'), get('space.2'), get('space.3'), get('fontSizes.1'), get('lineHeights.default'), get('colors.fg.default'), get('colors.fg.default'), get('colors.neutral.muted'), get('colors.fg.muted'), get('colors.fg.default'), get('colors.primer.border.active'), get('colors.fg.default'), COMMON, sx);
45
+ })(["padding:", " ", ";margin-right:", ";font-size:", ";line-height:", ";color:", ";text-align:center;border-bottom:2px solid transparent;text-decoration:none;&:hover,&:focus{color:", ";text-decoration:none;border-bottom-color:", ";transition:0.2s ease;.UnderlineNav-octicon{color:", ";}}&.selected{color:", ";border-bottom-color:", ";.UnderlineNav-octicon{color:", ";}}", ";", ";"], get('space.3'), get('space.2'), get('space.3'), get('fontSizes.1'), get('lineHeights.default'), get('colors.fg.default'), get('colors.fg.default'), get('colors.neutral.muted'), get('colors.primer.fg.disabled'), get('colors.fg.default'), get('colors.primer.border.active'), get('colors.fg.default'), COMMON, sx);
46
46
  UnderlineNavLink.displayName = 'UnderlineNav.Link';
47
47
  export default Object.assign(UnderlineNav, {
48
48
  Link: UnderlineNavLink
@@ -27,5 +27,5 @@ const TextInputWrapper = styled.span.withConfig({
27
27
  } else {
28
28
  return css(["padding:6px 12px;"]);
29
29
  }
30
- }, 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);
30
+ }, get('colors.primer.fg.disabled'), 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.primer.fg.disabled'), 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);
31
31
  export default TextInputWrapper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/components",
3
- "version": "0.0.0-202191514518",
3
+ "version": "0.0.0-20219153411",
4
4
  "description": "Primer react components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export declare type DescriptionProps = {
3
- variant?: 'inline' | 'block';
4
- };
5
- export declare const Description: React.FC<DescriptionProps>;
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Description = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _Box = _interopRequireDefault(require("../Box"));
11
-
12
- var _Truncate = _interopRequireDefault(require("../Truncate"));
13
-
14
- var _Item = require("./Item");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- const Description = ({
19
- variant = 'inline',
20
- ...props
21
- }) => {
22
- const {
23
- registerSlot
24
- } = _react.default.useContext(_Item.ItemContext);
25
-
26
- const slotName = variant === 'block' ? 'BlockDescription' : 'InlineDescription';
27
- const styles = {
28
- color: 'fg.muted',
29
- fontSize: 0,
30
- lineHeight: '16px',
31
- flexGrow: 1,
32
- flexBasis: 0,
33
- minWidth: 0,
34
- marginLeft: variant === 'block' ? 0 : 2
35
- };
36
-
37
- if (variant === 'block') {
38
- registerSlot(slotName, /*#__PURE__*/_react.default.createElement(_Box.default, {
39
- as: "span",
40
- sx: styles
41
- }, props.children));
42
- } else {
43
- registerSlot(slotName, /*#__PURE__*/_react.default.createElement(_Truncate.default, {
44
- sx: styles,
45
- title: props.children,
46
- inline: true,
47
- maxWidth: "100%"
48
- }, props.children));
49
- }
50
-
51
- return null;
52
- };
53
-
54
- exports.Description = Description;
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- * Visually separates `Item`s or `Group`s in an `ActionList`.
4
- */
5
- export declare function Divider(): JSX.Element;
6
- export declare namespace Divider {
7
- var renderItem: typeof Divider;
8
- }
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Divider = Divider;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _Box = _interopRequireDefault(require("../Box"));
11
-
12
- var _constants = require("../constants");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- /**
17
- * Visually separates `Item`s or `Group`s in an `ActionList`.
18
- */
19
- function Divider() {
20
- return /*#__PURE__*/_react.default.createElement(_Box.default, {
21
- as: "hr",
22
- sx: {
23
- border: 'none',
24
- // override browser styles
25
- height: 1,
26
- backgroundColor: 'border.muted',
27
- marginTop: theme => `calc(${(0, _constants.get)('space.2')(theme)} - 1px)`,
28
- marginBottom: 2
29
- },
30
- "data-component": "ActionList.Divider"
31
- });
32
- }
33
-
34
- Divider.displayName = "Divider";
35
-
36
- /**
37
- * `Divider` fulfills the `ItemPropsWithCustomRenderer` contract,
38
- * so it can be used inline in an `ActionList`’s `items` prop.
39
- * In other words, `items={[ActionList.Divider]}` is supported as a concise
40
- * alternative to `items={[{renderItem: () => <ActionList.Divider />}]}`.
41
- */
42
- Divider.renderItem = Divider;
@@ -1,8 +0,0 @@
1
- /**
2
- * show item dividers
3
- */
4
- /// <reference types="react" />
5
- import { SxProp } from '../sx';
6
- import { HeaderProps } from './Header';
7
- export declare type GroupProps = HeaderProps & SxProp;
8
- export declare function Group({ title, variant, auxiliaryText, sx, ...props }: GroupProps): JSX.Element;
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Group = Group;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _Box = _interopRequireDefault(require("../Box"));
11
-
12
- var _Header = require("./Header");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- 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); }
17
-
18
- function Group({
19
- title,
20
- variant,
21
- auxiliaryText,
22
- sx = {},
23
- ...props
24
- }) {
25
- return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
26
- sx: {
27
- '&:not(:first-child)': {
28
- marginTop: 2
29
- },
30
- ...sx
31
- }
32
- }, props), title && /*#__PURE__*/_react.default.createElement(_Header.Header, {
33
- title: title,
34
- variant: variant,
35
- auxiliaryText: auxiliaryText
36
- }), props.children);
37
- }
38
-
39
- Group.displayName = "Group";
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { SxProp } from '../sx';
3
- /**
4
- * Contract for props passed to the `Header` component.
5
- */
6
- export interface HeaderProps extends React.ComponentPropsWithoutRef<'div'>, SxProp {
7
- /**
8
- * Style variations. Usage is discretionary.
9
- *
10
- * - `"filled"` - Superimposed on a background, offset from nearby content
11
- * - `"subtle"` - Relatively less offset from nearby content
12
- */
13
- variant?: 'subtle' | 'filled';
14
- /**
15
- * Primary text which names a `Group`.
16
- */
17
- title?: string;
18
- /**
19
- * Secondary text which provides additional information about a `Group`.
20
- */
21
- auxiliaryText?: string;
22
- }
23
- /**
24
- * Displays the name and description of a `Group`.
25
- */
26
- export declare function Header({ variant, title, auxiliaryText, children: _children, sx, ...props }: HeaderProps): JSX.Element;
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Header = Header;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _Box = _interopRequireDefault(require("../Box"));
11
-
12
- var _List = require("./List");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- 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); }
17
-
18
- /**
19
- * Displays the name and description of a `Group`.
20
- */
21
- function Header({
22
- variant = 'subtle',
23
- title,
24
- auxiliaryText,
25
- children: _children,
26
- sx = {},
27
- ...props
28
- }) {
29
- const {
30
- variant: listVariant
31
- } = _react.default.useContext(_List.ListContext);
32
-
33
- const styles = {
34
- paddingY: '6px',
35
- paddingX: listVariant === 'full' ? 2 : 3,
36
- fontSize: 0,
37
- fontWeight: 'bold',
38
- color: 'fg.muted',
39
- ...(variant === 'filled' && {
40
- backgroundColor: 'canvas.subtle',
41
- marginX: 0,
42
- marginBottom: 2,
43
- borderTop: '1px solid',
44
- borderBottom: '1px solid',
45
- borderColor: 'neutral.muted'
46
- }),
47
- ...sx
48
- };
49
- return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
50
- sx: styles,
51
- role: "heading"
52
- }, props), title, auxiliaryText && /*#__PURE__*/_react.default.createElement("span", null, "auxiliaryText"));
53
- }
54
-
55
- Header.displayName = "Header";
@@ -1,52 +0,0 @@
1
- /**
2
- * id, role
3
- * text could be non-text
4
- * activeDescendantAttribute
5
- * deepmerge sx
6
- * nicer name for showDivider?
7
- * aria-label
8
- * aria-describedby
9
- * React.FC<Props> doesn't allow id?
10
- * truncate description
11
- * icon color
12
- * disabled checkbox
13
- * check height with divider
14
- *
15
- * use immediate child slot API instead of double render?
16
- * change as= li | div based on context of menu or not?
17
- * check if everyone accepts sx prop
18
- * link example outside of overlay? (details)
19
- * if one item has selected, should we give all of them selected without the need to pass prop?
20
- * move custom item themes to primitives?
21
- * padding: 8 or 6?
22
- * ActionList.Selection or ActionList.Item selected?
23
- * different size for icon and avatar, range?
24
- * minimize number of divs?
25
- */
26
- import React from 'react';
27
- import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
28
- import { SxProp } from '../sx';
29
- export declare const getVariantStyles: (variant: ItemProps['variant'], disabled: ItemProps['disabled']) => {
30
- color: (props: any) => any;
31
- iconColor: (props: any) => any;
32
- annotationColor: (props: any) => any;
33
- } | {
34
- color: string;
35
- iconColor: string;
36
- annotationColor: string;
37
- };
38
- export declare type ItemProps = {
39
- children: React.ReactNode;
40
- onAction?: (event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void;
41
- selected?: boolean;
42
- variant?: 'default' | 'danger';
43
- disabled?: boolean;
44
- showDivider?: boolean;
45
- } & SxProp;
46
- declare type SlotNames = 'LeadingVisual' | 'InlineDescription' | 'BlockDescription' | 'TrailingVisual';
47
- declare type ContextProps = {
48
- registerSlot: (name: SlotNames, contents: React.ReactNode) => void;
49
- };
50
- export declare const ItemContext: React.Context<ContextProps>;
51
- export declare const Item: PolymorphicForwardRefComponent<"li", ItemProps>;
52
- export {};
@@ -1,188 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Item = exports.ItemContext = exports.getVariantStyles = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _ThemeProvider = require("../ThemeProvider");
11
-
12
- var _Box = _interopRequireDefault(require("../Box"));
13
-
14
- var _constants = require("../constants");
15
-
16
- var _List = require("./List");
17
-
18
- var _hacks = require("./hacks");
19
-
20
- var _Selection = require("./Selection");
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- 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); }
25
-
26
- const getVariantStyles = (variant, disabled) => {
27
- if (disabled) {
28
- return {
29
- color: (0, _constants.get)('colors.fg.muted'),
30
- iconColor: (0, _constants.get)('colors.fg.muted'),
31
- annotationColor: (0, _constants.get)('colors.fg.muted')
32
- };
33
- }
34
-
35
- switch (variant) {
36
- case 'danger':
37
- return {
38
- color: 'danger.fg',
39
- iconColor: 'danger.fg',
40
- annotationColor: 'fg.muted'
41
- };
42
-
43
- default:
44
- return {
45
- color: 'fg.default',
46
- iconColor: 'fg.muted',
47
- annotationColor: 'fg.muted'
48
- };
49
- }
50
- };
51
-
52
- exports.getVariantStyles = getVariantStyles;
53
-
54
- const ItemContext = /*#__PURE__*/_react.default.createContext({
55
- registerSlot: () => null
56
- });
57
-
58
- exports.ItemContext = ItemContext;
59
-
60
- const Item = /*#__PURE__*/_react.default.forwardRef(({
61
- variant = 'default',
62
- disabled = false,
63
- selected = undefined,
64
- showDivider = false,
65
- onAction = () => null,
66
- sx = {},
67
- ...props
68
- }, forwardedRef) => {
69
- const customItemTheme = _hacks.customItemThemes[variant];
70
-
71
- const {
72
- variant: listVariant
73
- } = _react.default.useContext(_List.ListContext);
74
-
75
- const {
76
- theme
77
- } = (0, _ThemeProvider.useTheme)();
78
-
79
- const [slots, setSlots] = _react.default.useState({
80
- LeadingVisual: null,
81
- InlineDescription: null,
82
- BlockDescription: null,
83
- TrailingVisual: null
84
- });
85
-
86
- const registerSlot = (name, contents) => {
87
- if (slots[name] === null) setSlots({ ...slots,
88
- [name]: contents
89
- });
90
- };
91
-
92
- const styles = {
93
- display: 'flex',
94
- paddingX: (0, _constants.get)('space.2'),
95
- paddingY: '6px',
96
- marginX: listVariant === 'inset' ? (0, _constants.get)('space.2') : 0,
97
- minHeight: (0, _constants.get)('space.5'),
98
- borderRadius: (0, _constants.get)('radii.2'),
99
- transition: 'background 33.333ms linear',
100
- color: getVariantStyles(variant, disabled).color,
101
- textDecoration: 'none',
102
- // for as="a"
103
- ':not(disabled)': {
104
- cursor: 'pointer'
105
- },
106
- '@media (hover: hover) and (pointer: fine)': {
107
- ':hover': {
108
- backgroundColor: (0, _ThemeProvider.useColorSchemeVar)(customItemTheme.hover, 'inherit')
109
- },
110
- ':focus': {
111
- backgroundColor: (0, _ThemeProvider.useColorSchemeVar)(customItemTheme.focus, 'inherit')
112
- }
113
- },
114
-
115
- /** Divider styles */
116
- '[data-component="ActionList.Item--Main"]': {
117
- position: 'relative'
118
- },
119
- '[data-component="ActionList.Item--Main"]::before': {
120
- content: '" "',
121
- display: 'block',
122
- position: 'absolute',
123
- width: '100%',
124
- top: '-7px',
125
- border: '0 solid',
126
- borderTopWidth: showDivider ? `1px` : '0',
127
- borderColor: 'var(--divider-color, transparent)'
128
- },
129
- // show between 2 items
130
- ':not(:first-of-type)': {
131
- '--divider-color': theme === null || theme === void 0 ? void 0 : theme.colors.border.muted
132
- },
133
- // hide divider after dividers & group header
134
- '[data-component="ActionList.Divider"] + &': {
135
- '--divider-color': 'transparent'
136
- },
137
- // hide border on current and previous item
138
- '&:hover, &:focus': {
139
- '--divider-color': 'transparent'
140
- },
141
- '&:hover + &, &:focus + &': {
142
- '--divider-color': 'transparent'
143
- },
144
- ...sx
145
- };
146
-
147
- const clickHandler = _react.default.useCallback(event => {
148
- if (disabled) return;
149
- if (!event.defaultPrevented) onAction(event);
150
- }, [onAction, disabled]);
151
-
152
- return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
153
- as: "li",
154
- sx: styles,
155
- "data-component": "ActionList.Item",
156
- onClick: clickHandler,
157
- ref: forwardedRef
158
- }, props), /*#__PURE__*/_react.default.createElement(ItemContext.Provider, {
159
- value: {
160
- registerSlot
161
- }
162
- }, /*#__PURE__*/_react.default.createElement(_Selection.Selection, {
163
- selected: selected,
164
- disabled: disabled
165
- }), slots.LeadingVisual, /*#__PURE__*/_react.default.createElement(_Box.default, {
166
- "data-component": "ActionList.Item--Main",
167
- sx: {
168
- display: 'flex',
169
- flexDirection: 'column',
170
- flexGrow: 1,
171
- minWidth: 0
172
- }
173
- }, /*#__PURE__*/_react.default.createElement(_Box.default, {
174
- sx: {
175
- display: 'flex'
176
- }
177
- }, /*#__PURE__*/_react.default.createElement(_Box.default, {
178
- sx: {
179
- display: 'flex',
180
- flexGrow: 1,
181
- alignItems: 'baseline',
182
- minWidth: 0
183
- }
184
- }, /*#__PURE__*/_react.default.createElement("span", null, props.children), slots.InlineDescription), slots.TrailingVisual), slots.BlockDescription)));
185
- });
186
-
187
- exports.Item = Item;
188
- Item.displayName = 'ActionList.Item';
@@ -1,18 +0,0 @@
1
- /**
2
- *
3
- * showItemDividers
4
- * deepmerge sx
5
- * change as= ul | div based on context of menu or not?
6
- * should selectionVariant be single by default or nothing. ask for explicit choice?
7
- */
8
- import React from 'react';
9
- import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
10
- import { SxProp } from '../sx';
11
- export declare type ListProps = {
12
- variant?: 'inset' | 'full';
13
- selectionVariant?: 'single' | 'multiple';
14
- } & SxProp;
15
- declare type ContextProps = Pick<ListProps, 'selectionVariant' | 'variant'>;
16
- export declare const ListContext: React.Context<ContextProps>;
17
- export declare const List: PolymorphicForwardRefComponent<"ul", ListProps>;
18
- export {};