@primer/components 0.0.0-202192711645 → 0.0.0-2021927173554

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 +1 -1
  2. package/dist/browser.esm.js +615 -615
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +176 -176
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/Autocomplete/Autocomplete.d.ts +8 -8
  7. package/lib/Autocomplete/AutocompleteInput.d.ts +8 -8
  8. package/lib/Button/Button.d.ts +6 -6
  9. package/lib/Button/ButtonBase.d.ts +1 -1
  10. package/lib/Button/ButtonClose.d.ts +5 -5
  11. package/lib/Button/ButtonDanger.d.ts +6 -6
  12. package/lib/Button/ButtonInvisible.d.ts +6 -6
  13. package/lib/Button/ButtonOutline.d.ts +6 -6
  14. package/lib/Button/ButtonPrimary.d.ts +6 -6
  15. package/lib/CircleBadge.d.ts +2 -2
  16. package/lib/CircleOcticon.d.ts +4 -4
  17. package/lib/Dialog.d.ts +4 -4
  18. package/lib/Dropdown.d.ts +18 -18
  19. package/lib/DropdownMenu/DropdownButton.d.ts +7 -7
  20. package/lib/FilterList.d.ts +3 -3
  21. package/lib/Flash.d.ts +1 -1
  22. package/lib/Label.d.ts +1 -1
  23. package/lib/Position.d.ts +4 -4
  24. package/lib/ProgressBar.d.ts +1 -1
  25. package/lib/SelectMenu/SelectMenu.d.ts +28 -28
  26. package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
  27. package/lib/TextInputWithTokens.d.ts +8 -8
  28. package/lib/Timeline.d.ts +4 -4
  29. package/lib/Token/AvatarToken.d.ts +1 -1
  30. package/lib/Token/IssueLabelToken.d.ts +1 -1
  31. package/lib/Token/Token.d.ts +1 -1
  32. package/lib/_TextInputWrapper.d.ts +1 -1
  33. package/lib/index.d.ts +0 -1
  34. package/lib/index.js +0 -8
  35. package/lib/sx.d.ts +8 -4
  36. package/lib/sx.js +0 -8
  37. package/lib/theme.d.ts +100 -0
  38. package/lib-esm/Autocomplete/Autocomplete.d.ts +8 -8
  39. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +8 -8
  40. package/lib-esm/Button/Button.d.ts +6 -6
  41. package/lib-esm/Button/ButtonBase.d.ts +1 -1
  42. package/lib-esm/Button/ButtonClose.d.ts +5 -5
  43. package/lib-esm/Button/ButtonDanger.d.ts +6 -6
  44. package/lib-esm/Button/ButtonInvisible.d.ts +6 -6
  45. package/lib-esm/Button/ButtonOutline.d.ts +6 -6
  46. package/lib-esm/Button/ButtonPrimary.d.ts +6 -6
  47. package/lib-esm/CircleBadge.d.ts +2 -2
  48. package/lib-esm/CircleOcticon.d.ts +4 -4
  49. package/lib-esm/Dialog.d.ts +4 -4
  50. package/lib-esm/Dropdown.d.ts +18 -18
  51. package/lib-esm/DropdownMenu/DropdownButton.d.ts +7 -7
  52. package/lib-esm/FilterList.d.ts +3 -3
  53. package/lib-esm/Flash.d.ts +1 -1
  54. package/lib-esm/Label.d.ts +1 -1
  55. package/lib-esm/Position.d.ts +4 -4
  56. package/lib-esm/ProgressBar.d.ts +1 -1
  57. package/lib-esm/SelectMenu/SelectMenu.d.ts +28 -28
  58. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
  59. package/lib-esm/TextInputWithTokens.d.ts +8 -8
  60. package/lib-esm/Timeline.d.ts +4 -4
  61. package/lib-esm/Token/AvatarToken.d.ts +1 -1
  62. package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
  63. package/lib-esm/Token/Token.d.ts +1 -1
  64. package/lib-esm/_TextInputWrapper.d.ts +1 -1
  65. package/lib-esm/index.d.ts +0 -1
  66. package/lib-esm/index.js +0 -1
  67. package/lib-esm/sx.d.ts +8 -4
  68. package/lib-esm/sx.js +1 -3
  69. package/lib-esm/theme.d.ts +100 -0
  70. package/package.json +1 -1
  71. package/lib/ActionList2/Description.d.ts +0 -6
  72. package/lib/ActionList2/Description.js +0 -53
  73. package/lib/ActionList2/Divider.d.ts +0 -8
  74. package/lib/ActionList2/Divider.js +0 -42
  75. package/lib/ActionList2/Group.d.ts +0 -8
  76. package/lib/ActionList2/Group.js +0 -39
  77. package/lib/ActionList2/Header.d.ts +0 -26
  78. package/lib/ActionList2/Header.js +0 -55
  79. package/lib/ActionList2/Item.d.ts +0 -50
  80. package/lib/ActionList2/Item.js +0 -205
  81. package/lib/ActionList2/List.d.ts +0 -11
  82. package/lib/ActionList2/List.js +0 -53
  83. package/lib/ActionList2/Selection.d.ts +0 -5
  84. package/lib/ActionList2/Selection.js +0 -67
  85. package/lib/ActionList2/Visuals.d.ts +0 -11
  86. package/lib/ActionList2/Visuals.js +0 -90
  87. package/lib/ActionList2/hacks.d.ts +0 -30
  88. package/lib/ActionList2/hacks.js +0 -38
  89. package/lib/ActionList2/index.d.ts +0 -26
  90. package/lib/ActionList2/index.js +0 -36
  91. package/lib/utils/create-slots.d.ts +0 -17
  92. package/lib/utils/create-slots.js +0 -105
  93. package/lib/utils/use-force-update.d.ts +0 -1
  94. package/lib/utils/use-force-update.js +0 -19
  95. package/lib-esm/ActionList2/Description.d.ts +0 -6
  96. package/lib-esm/ActionList2/Description.js +0 -37
  97. package/lib-esm/ActionList2/Divider.d.ts +0 -8
  98. package/lib-esm/ActionList2/Divider.js +0 -30
  99. package/lib-esm/ActionList2/Group.d.ts +0 -8
  100. package/lib-esm/ActionList2/Group.js +0 -29
  101. package/lib-esm/ActionList2/Header.d.ts +0 -26
  102. package/lib-esm/ActionList2/Header.js +0 -45
  103. package/lib-esm/ActionList2/Item.d.ts +0 -50
  104. package/lib-esm/ActionList2/Item.js +0 -199
  105. package/lib-esm/ActionList2/List.d.ts +0 -11
  106. package/lib-esm/ActionList2/List.js +0 -35
  107. package/lib-esm/ActionList2/Selection.d.ts +0 -5
  108. package/lib-esm/ActionList2/Selection.js +0 -50
  109. package/lib-esm/ActionList2/Visuals.d.ts +0 -11
  110. package/lib-esm/ActionList2/Visuals.js +0 -68
  111. package/lib-esm/ActionList2/hacks.d.ts +0 -30
  112. package/lib-esm/ActionList2/hacks.js +0 -30
  113. package/lib-esm/ActionList2/index.d.ts +0 -26
  114. package/lib-esm/ActionList2/index.js +0 -23
  115. package/lib-esm/utils/create-slots.d.ts +0 -17
  116. package/lib-esm/utils/create-slots.js +0 -84
  117. package/lib-esm/utils/use-force-update.d.ts +0 -1
  118. package/lib-esm/utils/use-force-update.js +0 -6
@@ -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,50 +0,0 @@
1
- /**
2
- * selection check color
3
- * nicer name for showDivider?
4
- * minimize number of divs
5
- * docs
6
- * docs for types
7
- * test suite!
8
- * ref unhappy with polymorphic
9
- *
10
- * check height with divider
11
- * questions:
12
- * change as= li | div based on context of menu or not?
13
- * should selectionVariant be single by default or nothing. ask for explicit choice?
14
- * selection api - if one item has selected, should we give all of them selected without the need to pass prop?
15
- * move custom item themes to primitives?
16
- * padding: 8 or 6?
17
- * different size for icon and avatar, range?
18
- * ActionList.Selection or ActionList.Item selected?
19
- * aria-describedby empty value bad? also, 2 description = 2 values?
20
- *
21
- * activeDescendantAttribute (for actionMenu)
22
- */
23
- import React from 'react';
24
- import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
25
- import { SxProp } from '../sx';
26
- import { AriaRole } from '../utils/types';
27
- export declare const getVariantStyles: (variant: ItemProps['variant'], disabled: ItemProps['disabled']) => {
28
- color: string;
29
- iconColor: string;
30
- annotationColor: string;
31
- };
32
- export declare type ItemProps = {
33
- children: React.ReactNode;
34
- onSelect?: (event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void;
35
- selected?: boolean;
36
- variant?: 'default' | 'danger';
37
- disabled?: boolean;
38
- showDivider?: boolean;
39
- role?: AriaRole;
40
- } & SxProp;
41
- declare const Slot: React.FC<{
42
- name: "LeadingVisual" | "InlineDescription" | "BlockDescription" | "TrailingVisual";
43
- children: React.ReactNode | ((context: Record<string, unknown>) => React.ReactNode);
44
- }>;
45
- export { Slot };
46
- export declare type ItemContext = Pick<ItemProps, 'variant' | 'disabled'> & {
47
- inlineDescriptionId: string;
48
- blockDescriptionId: string;
49
- };
50
- export declare const Item: PolymorphicForwardRefComponent<"li", ItemProps>;
@@ -1,205 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Item = exports.Slot = exports.getVariantStyles = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _ssr = require("@react-aria/ssr");
11
-
12
- var _ThemeProvider = require("../ThemeProvider");
13
-
14
- var _Box = _interopRequireDefault(require("../Box"));
15
-
16
- var _constants = require("../constants");
17
-
18
- var _sx = require("../sx");
19
-
20
- var _createSlots = _interopRequireDefault(require("../utils/create-slots"));
21
-
22
- var _List = require("./List");
23
-
24
- var _hacks = require("./hacks");
25
-
26
- var _Selection = require("./Selection");
27
-
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
30
- 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); }
31
-
32
- const getVariantStyles = (variant, disabled) => {
33
- if (disabled) {
34
- return {
35
- color: 'fg.muted',
36
- iconColor: 'fg.muted',
37
- annotationColor: 'fg.muted'
38
- };
39
- }
40
-
41
- switch (variant) {
42
- case 'danger':
43
- return {
44
- color: 'danger.fg',
45
- iconColor: 'danger.fg',
46
- annotationColor: 'fg.muted'
47
- };
48
-
49
- default:
50
- return {
51
- color: 'fg.default',
52
- iconColor: 'fg.muted',
53
- annotationColor: 'fg.muted'
54
- };
55
- }
56
- };
57
-
58
- exports.getVariantStyles = getVariantStyles;
59
- const {
60
- Slots,
61
- Slot
62
- } = (0, _createSlots.default)(['LeadingVisual', 'InlineDescription', 'BlockDescription', 'TrailingVisual']);
63
- exports.Slot = Slot;
64
-
65
- const Item = /*#__PURE__*/_react.default.forwardRef(({
66
- variant = 'default',
67
- disabled = false,
68
- selected = undefined,
69
- showDivider = false,
70
- onSelect = () => null,
71
- sx = {},
72
- ...props
73
- }, forwardedRef) => {
74
- const customItemTheme = _hacks.customItemThemes[variant];
75
-
76
- const {
77
- variant: listVariant
78
- } = _react.default.useContext(_List.ListContext);
79
-
80
- const {
81
- theme
82
- } = (0, _ThemeProvider.useTheme)();
83
- const styles = {
84
- display: 'flex',
85
- paddingX: (0, _constants.get)('space.2'),
86
- paddingY: '6px',
87
- marginX: listVariant === 'inset' ? (0, _constants.get)('space.2') : 0,
88
- minHeight: (0, _constants.get)('space.5'),
89
- borderRadius: (0, _constants.get)('radii.2'),
90
- transition: 'background 33.333ms linear',
91
- color: getVariantStyles(variant, disabled).color,
92
- textDecoration: 'none',
93
- // for as="a"
94
- ':not([aria-disabled])': {
95
- cursor: 'pointer'
96
- },
97
- '@media (hover: hover) and (pointer: fine)': {
98
- ':hover:not([aria-disabled])': {
99
- backgroundColor: (0, _ThemeProvider.useColorSchemeVar)(customItemTheme.hover, 'inherit')
100
- },
101
- ':focus:not([aria-disabled])': {
102
- backgroundColor: (0, _ThemeProvider.useColorSchemeVar)(customItemTheme.focus, 'inherit')
103
- }
104
- },
105
-
106
- /** Divider styles */
107
- '[data-component="ActionList.Item--DividerContainer"]': {
108
- position: 'relative'
109
- },
110
- '[data-component="ActionList.Item--DividerContainer"]::before': {
111
- content: '" "',
112
- display: 'block',
113
- position: 'absolute',
114
- width: '100%',
115
- top: '-7px',
116
- border: '0 solid',
117
- borderTopWidth: showDivider ? `1px` : '0',
118
- borderColor: 'var(--divider-color, transparent)'
119
- },
120
- // show between 2 items
121
- ':not(:first-of-type)': {
122
- '--divider-color': theme === null || theme === void 0 ? void 0 : theme.colors.border.muted
123
- },
124
- // hide divider after dividers & group header
125
- '[data-component="ActionList.Divider"] + &': {
126
- '--divider-color': 'transparent'
127
- },
128
- // hide border on current and previous item
129
- '&:hover:not([aria-disabled]), &:focus:not([aria-disabled])': {
130
- '--divider-color': 'transparent'
131
- },
132
- '&:hover:not([aria-disabled]) + &, &:focus:not([aria-disabled]) + &': {
133
- '--divider-color': 'transparent'
134
- }
135
- };
136
-
137
- const clickHandler = _react.default.useCallback(event => {
138
- if (disabled) return;
139
- if (!event.defaultPrevented) onSelect(event);
140
- }, [onSelect, disabled]);
141
-
142
- const labelId = (0, _ssr.useSSRSafeId)();
143
- const inlineDescriptionId = (0, _ssr.useSSRSafeId)();
144
- const blockDescriptionId = (0, _ssr.useSSRSafeId)();
145
- return /*#__PURE__*/_react.default.createElement(Slots, {
146
- context: {
147
- variant,
148
- disabled,
149
- inlineDescriptionId,
150
- blockDescriptionId
151
- }
152
- }, slots => /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
153
- as: "li",
154
- ref: forwardedRef,
155
- sx: (0, _sx.merge)(styles, sx),
156
- "data-component": "ActionList.Item",
157
- onClick: clickHandler,
158
- "aria-selected": selected,
159
- "aria-disabled": disabled ? true : undefined,
160
- "aria-labelledby": labelId,
161
- "aria-describedby": [slots.InlineDescription && inlineDescriptionId, slots.BlockDescription && blockDescriptionId].filter(Boolean).join(' ')
162
- }, props), /*#__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--DividerContainer",
167
- sx: {
168
- display: 'flex',
169
- flexDirection: 'column',
170
- flexGrow: 1,
171
- minWidth: 0
172
- }
173
- }, /*#__PURE__*/_react.default.createElement(ConditionalBox, {
174
- if: Boolean(slots.TrailingVisual),
175
- sx: {
176
- display: 'flex',
177
- flexGrow: 1
178
- }
179
- }, /*#__PURE__*/_react.default.createElement(ConditionalBox, {
180
- if: Boolean(slots.InlineDescription),
181
- sx: {
182
- display: 'flex',
183
- flexGrow: 1,
184
- alignItems: 'baseline',
185
- minWidth: 0
186
- }
187
- }, /*#__PURE__*/_react.default.createElement(_Box.default, {
188
- as: "span",
189
- id: labelId,
190
- sx: {
191
- flexGrow: slots.InlineDescription ? 0 : 1
192
- }
193
- }, props.children), slots.InlineDescription), slots.TrailingVisual), slots.BlockDescription)));
194
- });
195
-
196
- exports.Item = Item;
197
- Item.displayName = 'ActionList.Item';
198
-
199
- const ConditionalBox = props => {
200
- const {
201
- if: condition,
202
- ...rest
203
- } = props;
204
- if (condition) return /*#__PURE__*/_react.default.createElement(_Box.default, rest, props.children);else return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.children);
205
- };
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
3
- import { SxProp } from '../sx';
4
- export declare type ListProps = {
5
- variant?: 'inset' | 'full';
6
- selectionVariant?: 'single' | 'multiple';
7
- } & SxProp;
8
- declare type ContextProps = Pick<ListProps, 'selectionVariant' | 'variant'>;
9
- export declare const ListContext: React.Context<ContextProps>;
10
- export declare const List: PolymorphicForwardRefComponent<"ul", ListProps>;
11
- export {};
@@ -1,53 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.List = exports.ListContext = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _Box = _interopRequireDefault(require("../Box"));
11
-
12
- var _constants = require("../constants");
13
-
14
- var _sx = require("../sx");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- 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); }
19
-
20
- const ListContext = /*#__PURE__*/_react.default.createContext({});
21
-
22
- exports.ListContext = ListContext;
23
-
24
- const List = /*#__PURE__*/_react.default.forwardRef(({
25
- variant = 'inset',
26
- selectionVariant = 'single',
27
- sx = {},
28
- ...props
29
- }, forwardedRef) => {
30
- const styles = {
31
- margin: 0,
32
- fontSize: (0, _constants.get)('fontSizes.1'),
33
- lineHeight: '20px',
34
- // TODO: check if we replace this already
35
- paddingInlineStart: 0,
36
- // reset ul styles
37
- paddingY: variant === 'inset' ? (0, _constants.get)('space.2') : 0
38
- };
39
- return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
40
- as: "ul",
41
- sx: (0, _sx.merge)(styles, sx)
42
- }, props, {
43
- ref: forwardedRef
44
- }), /*#__PURE__*/_react.default.createElement(ListContext.Provider, {
45
- value: {
46
- variant,
47
- selectionVariant
48
- }
49
- }, props.children));
50
- });
51
-
52
- exports.List = List;
53
- List.displayName = 'ActionList';
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { ItemProps } from './Item';
3
- declare type SelectionProps = Pick<ItemProps, 'selected' | 'disabled'>;
4
- export declare const Selection: React.FC<SelectionProps>;
5
- export {};
@@ -1,67 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Selection = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _octiconsReact = require("@primer/octicons-react");
11
-
12
- var _ThemeProvider = require("../ThemeProvider");
13
-
14
- var _List = require("./List");
15
-
16
- var _Visuals = require("./Visuals");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- const Selection = ({
21
- selected,
22
- disabled
23
- }) => {
24
- const {
25
- selectionVariant
26
- } = _react.default.useContext(_List.ListContext);
27
-
28
- const {
29
- theme
30
- } = (0, _ThemeProvider.useTheme)();
31
- if (typeof selected === 'undefined') return null;
32
-
33
- if (selectionVariant === 'single') {
34
- return /*#__PURE__*/_react.default.createElement(_Visuals.LeadingVisualContainer, null, selected && /*#__PURE__*/_react.default.createElement(_octiconsReact.CheckIcon, {
35
- fill: "fg.muted"
36
- }));
37
- }
38
-
39
- if (selectionVariant === 'multiple') {
40
- /**
41
- * readOnly is required because we are doing a one-way bind to `checked`
42
- * aria-readonly="false" tells screen that they can still interact with the checkbox
43
- * TODO: not sure if disabled & aria-label be here or should we apply it on the instance as props
44
- * TODO: aria-label should come from the text part of the slot
45
- */
46
- return /*#__PURE__*/_react.default.createElement(_Visuals.LeadingVisualContainer, {
47
- sx: {
48
- input: {
49
- margin: 0,
50
- pointerEvents: 'none'
51
- }
52
- }
53
- }, /*#__PURE__*/_react.default.createElement("input", {
54
- type: "checkbox",
55
- checked: selected,
56
- disabled: disabled,
57
- "aria-label": "TODO",
58
- tabIndex: -1,
59
- readOnly: true,
60
- "aria-readonly": "false"
61
- }));
62
- }
63
-
64
- return null;
65
- };
66
-
67
- exports.Selection = Selection;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { SxProp } from '../sx';
3
- declare type VisualProps = SxProp & {
4
- children: React.ReactNode;
5
- };
6
- export declare const LeadingVisualContainer: React.FC<SxProp>;
7
- export declare type LeadingVisualProps = VisualProps;
8
- export declare const LeadingVisual: React.FC<VisualProps>;
9
- export declare type TrailingVisualProps = VisualProps;
10
- export declare const TrailingVisual: React.FC<VisualProps>;
11
- export {};
@@ -1,90 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.TrailingVisual = exports.LeadingVisual = exports.LeadingVisualContainer = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _Box = _interopRequireDefault(require("../Box"));
11
-
12
- var _sx = require("../sx");
13
-
14
- var _constants = require("../constants");
15
-
16
- var _Item = require("./Item");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- 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); }
21
-
22
- const LeadingVisualContainer = ({
23
- sx = {},
24
- ...props
25
- }) => {
26
- return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
27
- as: "span",
28
- sx: (0, _sx.merge)({
29
- height: '20px',
30
- // match height of text row
31
- minWidth: (0, _constants.get)('space.3'),
32
- maxWidth: '20px',
33
- // square (same as height)
34
- display: 'flex',
35
- justifyContent: 'center',
36
- alignItems: 'center',
37
- flexShrink: 0,
38
- marginRight: 2
39
- }, sx)
40
- }, props));
41
- };
42
-
43
- exports.LeadingVisualContainer = LeadingVisualContainer;
44
- LeadingVisualContainer.displayName = "LeadingVisualContainer";
45
-
46
- const LeadingVisual = ({
47
- sx = {},
48
- ...props
49
- }) => {
50
- return /*#__PURE__*/_react.default.createElement(_Item.Slot, {
51
- name: "LeadingVisual"
52
- }, ({
53
- variant,
54
- disabled
55
- }) => /*#__PURE__*/_react.default.createElement(LeadingVisualContainer, _extends({
56
- sx: (0, _sx.merge)({
57
- color: (0, _Item.getVariantStyles)(variant, disabled).iconColor,
58
- svg: {
59
- fontSize: 0
60
- }
61
- }, sx)
62
- }, props), props.children));
63
- };
64
-
65
- exports.LeadingVisual = LeadingVisual;
66
- LeadingVisual.displayName = "LeadingVisual";
67
-
68
- const TrailingVisual = ({
69
- sx = {},
70
- ...props
71
- }) => {
72
- return /*#__PURE__*/_react.default.createElement(_Item.Slot, {
73
- name: "TrailingVisual"
74
- }, ({
75
- variant,
76
- disabled
77
- }) => /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
78
- as: "span",
79
- sx: (0, _sx.merge)({
80
- height: '20px',
81
- // match height of text row
82
- flexShrink: 0,
83
- color: (0, _Item.getVariantStyles)(variant, disabled).annotationColor,
84
- marginLeft: 2
85
- }, sx)
86
- }, props), props.children));
87
- };
88
-
89
- exports.TrailingVisual = TrailingVisual;
90
- TrailingVisual.displayName = "TrailingVisual";
@@ -1,30 +0,0 @@
1
- /**
2
- * These colors are not yet in our default theme.
3
- * TODO: Need to remove this once they are added.
4
- */
5
- export declare const customItemThemes: {
6
- default: {
7
- hover: {
8
- light: string;
9
- dark: string;
10
- dark_dimmed: string;
11
- };
12
- focus: {
13
- light: string;
14
- dark: string;
15
- dark_dimmed: string;
16
- };
17
- };
18
- danger: {
19
- hover: {
20
- light: string;
21
- dark: string;
22
- dark_dimmed: string;
23
- };
24
- focus: {
25
- light: string;
26
- dark: string;
27
- dark_dimmed: string;
28
- };
29
- };
30
- };
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.customItemThemes = void 0;
7
-
8
- /**
9
- * These colors are not yet in our default theme.
10
- * TODO: Need to remove this once they are added.
11
- */
12
- const customItemThemes = {
13
- default: {
14
- hover: {
15
- light: 'rgba(46, 77, 108, 0.06)',
16
- dark: 'rgba(201, 206, 212, 0.12)',
17
- dark_dimmed: 'rgba(201, 206, 212, 0.12)'
18
- },
19
- focus: {
20
- light: 'rgba(54, 77, 100, 0.16)',
21
- dark: 'rgba(201, 206, 212, 0.24)',
22
- dark_dimmed: 'rgba(201, 206, 212, 0.24)'
23
- }
24
- },
25
- danger: {
26
- hover: {
27
- light: 'rgba(234, 74, 90, 0.08)',
28
- dark: 'rgba(248, 81, 73, 0.16)',
29
- dark_dimmed: 'rgba(248, 81, 73, 0.16)'
30
- },
31
- focus: {
32
- light: 'rgba(234, 74, 90, 0.14)',
33
- dark: 'rgba(248, 81, 73, 0.24)',
34
- dark_dimmed: 'rgba(248, 81, 73, 0.24)'
35
- }
36
- }
37
- };
38
- exports.customItemThemes = customItemThemes;
@@ -1,26 +0,0 @@
1
- /// <reference types="react" />
2
- import { Group } from './Group';
3
- import { Divider } from './Divider';
4
- export type { ListProps as ActionListProps } from './List';
5
- export type { GroupProps } from './Group';
6
- export type { ItemProps } from './Item';
7
- export type { DescriptionProps } from './Description';
8
- export type { LeadingVisualProps, TrailingVisualProps } from './Visuals';
9
- /**
10
- * Collection of list-related components.
11
- */
12
- export declare const ActionList: import("@radix-ui/react-polymorphic").ForwardRefComponent<"ul", import("./List").ListProps> & {
13
- /** Collects related `Items` in an `ActionList`. */
14
- Group: typeof Group;
15
- /** An actionable or selectable `Item` with an optional icon and description. */
16
- Item: import("@radix-ui/react-polymorphic").ForwardRefComponent<"li", import("./Item").ItemProps>;
17
- /** Visually separates `Item`s or `Group`s in an `ActionList`. */
18
- Divider: typeof Divider;
19
- Description: import("react").FC<import("./Description").DescriptionProps>;
20
- LeadingVisual: import("react").FC<import("../sx").SxProp & {
21
- children: import("react").ReactNode;
22
- }>;
23
- TrailingVisual: import("react").FC<import("../sx").SxProp & {
24
- children: import("react").ReactNode;
25
- }>;
26
- };
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ActionList = void 0;
7
-
8
- var _List = require("./List");
9
-
10
- var _Group = require("./Group");
11
-
12
- var _Item = require("./Item");
13
-
14
- var _Divider = require("./Divider");
15
-
16
- var _Description = require("./Description");
17
-
18
- var _Visuals = require("./Visuals");
19
-
20
- /**
21
- * Collection of list-related components.
22
- */
23
- const ActionList = Object.assign(_List.List, {
24
- /** Collects related `Items` in an `ActionList`. */
25
- Group: _Group.Group,
26
-
27
- /** An actionable or selectable `Item` with an optional icon and description. */
28
- Item: _Item.Item,
29
-
30
- /** Visually separates `Item`s or `Group`s in an `ActionList`. */
31
- Divider: _Divider.Divider,
32
- Description: _Description.Description,
33
- LeadingVisual: _Visuals.LeadingVisual,
34
- TrailingVisual: _Visuals.TrailingVisual
35
- });
36
- exports.ActionList = ActionList;