@primer/components 0.0.0-2021929114541 → 0.0.0-202192923313

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 (165) hide show
  1. package/CHANGELOG.md +1 -23
  2. package/dist/browser.esm.js +49 -53
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +46 -50
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/ActionList/Item.d.ts +0 -6
  7. package/lib/ActionList/Item.js +1 -5
  8. package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
  9. package/lib/Autocomplete/Autocomplete.d.ts +8 -6
  10. package/lib/Autocomplete/AutocompleteInput.d.ts +8 -6
  11. package/lib/Button/Button.d.ts +4 -4
  12. package/lib/Button/ButtonClose.d.ts +21 -21
  13. package/lib/Button/ButtonDanger.d.ts +4 -4
  14. package/lib/Button/ButtonInvisible.d.ts +4 -4
  15. package/lib/Button/ButtonOutline.d.ts +4 -4
  16. package/lib/Button/ButtonPrimary.d.ts +4 -4
  17. package/lib/CircleOcticon.d.ts +19 -19
  18. package/lib/DatePicker/DatePicker.d.ts +48 -0
  19. package/lib/DatePicker/DatePicker.js +106 -0
  20. package/lib/DatePicker/DatePickerAnchor.d.ts +5 -0
  21. package/lib/DatePicker/DatePickerAnchor.js +223 -0
  22. package/lib/DatePicker/DatePickerOverlay.d.ts +3 -0
  23. package/lib/DatePicker/DatePickerOverlay.js +48 -0
  24. package/lib/DatePicker/DatePickerPanel.d.ts +2 -0
  25. package/lib/DatePicker/DatePickerPanel.js +126 -0
  26. package/lib/DatePicker/Day.d.ts +14 -0
  27. package/lib/DatePicker/Day.js +192 -0
  28. package/lib/DatePicker/Month.d.ts +9 -0
  29. package/lib/DatePicker/Month.js +122 -0
  30. package/lib/DatePicker/dateParser.d.ts +11 -0
  31. package/lib/DatePicker/dateParser.js +192 -0
  32. package/lib/DatePicker/index.d.ts +2 -0
  33. package/lib/{experiments.js → DatePicker/index.js} +3 -3
  34. package/lib/DatePicker/useDatePicker.d.ts +89 -0
  35. package/lib/DatePicker/useDatePicker.js +439 -0
  36. package/lib/Dialog.d.ts +21 -21
  37. package/lib/Dropdown.d.ts +82 -82
  38. package/lib/DropdownMenu/DropdownButton.d.ts +23 -23
  39. package/lib/FilterList.d.ts +19 -19
  40. package/lib/Position.d.ts +4 -4
  41. package/lib/SelectMenu/SelectMenu.d.ts +107 -105
  42. package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
  43. package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
  44. package/lib/TextInputWithTokens.d.ts +8 -10
  45. package/lib/TextInputWithTokens.js +29 -102
  46. package/lib/Timeline.d.ts +19 -19
  47. package/lib/Token/AvatarToken.d.ts +1 -1
  48. package/lib/Token/IssueLabelToken.d.ts +1 -1
  49. package/lib/Token/Token.d.ts +1 -1
  50. package/lib/Token/Token.js +2 -13
  51. package/lib/Token/TokenBase.js +4 -0
  52. package/lib/Token/_RemoveTokenButton.js +2 -15
  53. package/lib/_TextInputWrapper.js +1 -1
  54. package/lib/hooks/useDebounce.d.ts +2 -0
  55. package/lib/hooks/useDebounce.js +24 -0
  56. package/lib/sx.d.ts +0 -2
  57. package/lib/sx.js +0 -8
  58. package/lib/theme-preval.js +2 -2
  59. package/lib/utils/testing.d.ts +1 -1
  60. package/lib-esm/ActionList/Item.d.ts +0 -6
  61. package/lib-esm/ActionList/Item.js +1 -5
  62. package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
  63. package/lib-esm/Autocomplete/Autocomplete.d.ts +8 -6
  64. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +8 -6
  65. package/lib-esm/Button/Button.d.ts +4 -4
  66. package/lib-esm/Button/ButtonClose.d.ts +21 -21
  67. package/lib-esm/Button/ButtonDanger.d.ts +4 -4
  68. package/lib-esm/Button/ButtonInvisible.d.ts +4 -4
  69. package/lib-esm/Button/ButtonOutline.d.ts +4 -4
  70. package/lib-esm/Button/ButtonPrimary.d.ts +4 -4
  71. package/lib-esm/CircleOcticon.d.ts +19 -19
  72. package/lib-esm/DatePicker/DatePicker.d.ts +48 -0
  73. package/lib-esm/DatePicker/DatePicker.js +89 -0
  74. package/lib-esm/DatePicker/DatePickerAnchor.d.ts +5 -0
  75. package/lib-esm/DatePicker/DatePickerAnchor.js +196 -0
  76. package/lib-esm/DatePicker/DatePickerOverlay.d.ts +3 -0
  77. package/lib-esm/DatePicker/DatePickerOverlay.js +29 -0
  78. package/lib-esm/DatePicker/DatePickerPanel.d.ts +2 -0
  79. package/lib-esm/DatePicker/DatePickerPanel.js +100 -0
  80. package/lib-esm/DatePicker/Day.d.ts +14 -0
  81. package/lib-esm/DatePicker/Day.js +169 -0
  82. package/lib-esm/DatePicker/Month.d.ts +9 -0
  83. package/lib-esm/DatePicker/Month.js +98 -0
  84. package/lib-esm/DatePicker/dateParser.d.ts +11 -0
  85. package/lib-esm/DatePicker/dateParser.js +178 -0
  86. package/lib-esm/DatePicker/index.d.ts +2 -0
  87. package/lib-esm/DatePicker/index.js +1 -0
  88. package/lib-esm/DatePicker/useDatePicker.d.ts +89 -0
  89. package/lib-esm/DatePicker/useDatePicker.js +408 -0
  90. package/lib-esm/Dialog.d.ts +21 -21
  91. package/lib-esm/Dropdown.d.ts +82 -82
  92. package/lib-esm/DropdownMenu/DropdownButton.d.ts +23 -23
  93. package/lib-esm/FilterList.d.ts +19 -19
  94. package/lib-esm/Position.d.ts +4 -4
  95. package/lib-esm/SelectMenu/SelectMenu.d.ts +107 -105
  96. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
  97. package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
  98. package/lib-esm/TextInputWithTokens.d.ts +8 -10
  99. package/lib-esm/TextInputWithTokens.js +30 -101
  100. package/lib-esm/Timeline.d.ts +19 -19
  101. package/lib-esm/Token/AvatarToken.d.ts +1 -1
  102. package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
  103. package/lib-esm/Token/Token.d.ts +1 -1
  104. package/lib-esm/Token/Token.js +2 -13
  105. package/lib-esm/Token/TokenBase.js +4 -0
  106. package/lib-esm/Token/_RemoveTokenButton.js +2 -11
  107. package/lib-esm/_TextInputWrapper.js +1 -1
  108. package/lib-esm/hooks/useDebounce.d.ts +2 -0
  109. package/lib-esm/hooks/useDebounce.js +16 -0
  110. package/lib-esm/sx.d.ts +0 -2
  111. package/lib-esm/sx.js +1 -3
  112. package/lib-esm/theme-preval.js +2 -2
  113. package/lib-esm/utils/testing.d.ts +1 -1
  114. package/package.json +14 -14
  115. package/lib/ActionList2/Description.d.ts +0 -6
  116. package/lib/ActionList2/Description.js +0 -53
  117. package/lib/ActionList2/Divider.d.ts +0 -5
  118. package/lib/ActionList2/Divider.js +0 -33
  119. package/lib/ActionList2/Group.d.ts +0 -11
  120. package/lib/ActionList2/Group.js +0 -55
  121. package/lib/ActionList2/Header.d.ts +0 -26
  122. package/lib/ActionList2/Header.js +0 -55
  123. package/lib/ActionList2/Item.d.ts +0 -48
  124. package/lib/ActionList2/Item.js +0 -204
  125. package/lib/ActionList2/List.d.ts +0 -26
  126. package/lib/ActionList2/List.js +0 -56
  127. package/lib/ActionList2/Selection.d.ts +0 -5
  128. package/lib/ActionList2/Selection.js +0 -73
  129. package/lib/ActionList2/Visuals.d.ts +0 -11
  130. package/lib/ActionList2/Visuals.js +0 -90
  131. package/lib/ActionList2/hacks.d.ts +0 -30
  132. package/lib/ActionList2/hacks.js +0 -38
  133. package/lib/ActionList2/index.d.ts +0 -28
  134. package/lib/ActionList2/index.js +0 -42
  135. package/lib/experiments.d.ts +0 -1
  136. package/lib/utils/create-slots.d.ts +0 -17
  137. package/lib/utils/create-slots.js +0 -105
  138. package/lib/utils/use-force-update.d.ts +0 -1
  139. package/lib/utils/use-force-update.js +0 -19
  140. package/lib-esm/ActionList2/Description.d.ts +0 -6
  141. package/lib-esm/ActionList2/Description.js +0 -37
  142. package/lib-esm/ActionList2/Divider.d.ts +0 -5
  143. package/lib-esm/ActionList2/Divider.js +0 -21
  144. package/lib-esm/ActionList2/Group.d.ts +0 -11
  145. package/lib-esm/ActionList2/Group.js +0 -38
  146. package/lib-esm/ActionList2/Header.d.ts +0 -26
  147. package/lib-esm/ActionList2/Header.js +0 -45
  148. package/lib-esm/ActionList2/Item.d.ts +0 -48
  149. package/lib-esm/ActionList2/Item.js +0 -176
  150. package/lib-esm/ActionList2/List.d.ts +0 -26
  151. package/lib-esm/ActionList2/List.js +0 -38
  152. package/lib-esm/ActionList2/Selection.d.ts +0 -5
  153. package/lib-esm/ActionList2/Selection.js +0 -55
  154. package/lib-esm/ActionList2/Visuals.d.ts +0 -11
  155. package/lib-esm/ActionList2/Visuals.js +0 -68
  156. package/lib-esm/ActionList2/hacks.d.ts +0 -30
  157. package/lib-esm/ActionList2/hacks.js +0 -30
  158. package/lib-esm/ActionList2/index.d.ts +0 -28
  159. package/lib-esm/ActionList2/index.js +0 -29
  160. package/lib-esm/experiments.d.ts +0 -1
  161. package/lib-esm/experiments.js +0 -2
  162. package/lib-esm/utils/create-slots.d.ts +0 -17
  163. package/lib-esm/utils/create-slots.js +0 -84
  164. package/lib-esm/utils/use-force-update.d.ts +0 -1
  165. package/lib-esm/utils/use-force-update.js +0 -6
@@ -1,204 +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
- onSelect = () => null,
70
- sx = {},
71
- ...props
72
- }, forwardedRef) => {
73
- const customItemTheme = _hacks.customItemThemes[variant];
74
-
75
- const {
76
- variant: listVariant,
77
- showDividers
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: showDividers ? `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
- onClick: clickHandler,
157
- "aria-selected": selected,
158
- "aria-disabled": disabled ? true : undefined,
159
- "aria-labelledby": labelId,
160
- "aria-describedby": [slots.InlineDescription && inlineDescriptionId, slots.BlockDescription && blockDescriptionId].filter(Boolean).join(' ')
161
- }, props), /*#__PURE__*/_react.default.createElement(_Selection.Selection, {
162
- selected: selected,
163
- disabled: disabled
164
- }), slots.LeadingVisual, /*#__PURE__*/_react.default.createElement(_Box.default, {
165
- "data-component": "ActionList.Item--DividerContainer",
166
- sx: {
167
- display: 'flex',
168
- flexDirection: 'column',
169
- flexGrow: 1,
170
- minWidth: 0
171
- }
172
- }, /*#__PURE__*/_react.default.createElement(ConditionalBox, {
173
- if: Boolean(slots.TrailingVisual),
174
- sx: {
175
- display: 'flex',
176
- flexGrow: 1
177
- }
178
- }, /*#__PURE__*/_react.default.createElement(ConditionalBox, {
179
- if: Boolean(slots.InlineDescription),
180
- sx: {
181
- display: 'flex',
182
- flexGrow: 1,
183
- alignItems: 'baseline',
184
- minWidth: 0
185
- }
186
- }, /*#__PURE__*/_react.default.createElement(_Box.default, {
187
- as: "span",
188
- id: labelId,
189
- sx: {
190
- flexGrow: slots.InlineDescription ? 0 : 1
191
- }
192
- }, props.children), slots.InlineDescription), slots.TrailingVisual), slots.BlockDescription)));
193
- });
194
-
195
- exports.Item = Item;
196
- Item.displayName = 'ActionList.Item';
197
-
198
- const ConditionalBox = props => {
199
- const {
200
- if: condition,
201
- ...rest
202
- } = props;
203
- if (condition) return /*#__PURE__*/_react.default.createElement(_Box.default, rest, props.children);else return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.children);
204
- };
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
3
- import { SxProp } from '../sx';
4
- import { AriaRole } from '../utils/types';
5
- export declare type ListProps = {
6
- /**
7
- * `inset` children are offset (vertically and horizontally) from `List`’s edges, `full` children are flush (vertically and horizontally) with `List` edges
8
- */
9
- variant?: 'inset' | 'full';
10
- /**
11
- * Whether multiple Items or a single Item can be selected.
12
- */
13
- selectionVariant?: 'single' | 'multiple';
14
- /**
15
- * Display a divider above each `Item` in this `List` when it does not follow a `Header` or `Divider`.
16
- */
17
- showDividers?: boolean;
18
- /**
19
- * The ARIA role describing the function of `List` component. `listbox` or `menu` are a common values.
20
- */
21
- role?: AriaRole;
22
- } & SxProp;
23
- declare type ContextProps = Omit<ListProps, 'sx'>;
24
- export declare const ListContext: React.Context<ContextProps>;
25
- export declare const List: PolymorphicForwardRefComponent<"ul", ListProps>;
26
- export {};
@@ -1,56 +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,
27
- showDividers = false,
28
- sx = {},
29
- ...props
30
- }, forwardedRef) => {
31
- const styles = {
32
- margin: 0,
33
- fontSize: (0, _constants.get)('fontSizes.1'),
34
- lineHeight: '20px',
35
- // TODO: check if we replace this already
36
- paddingInlineStart: 0,
37
- // reset ul styles
38
- paddingY: variant === 'inset' ? (0, _constants.get)('space.2') : 0
39
- };
40
- return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
41
- as: "ul",
42
- sx: (0, _sx.merge)(styles, sx),
43
- "aria-multiselectable": selectionVariant === 'multiple' ? true : undefined
44
- }, props, {
45
- ref: forwardedRef
46
- }), /*#__PURE__*/_react.default.createElement(ListContext.Provider, {
47
- value: {
48
- variant,
49
- selectionVariant,
50
- showDividers
51
- }
52
- }, props.children));
53
- });
54
-
55
- exports.List = List;
56
- 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,73 +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 _List = require("./List");
13
-
14
- var _Group = require("./Group");
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: listSelectionVariant
26
- } = _react.default.useContext(_List.ListContext);
27
-
28
- const {
29
- selectionVariant: groupSelectionVariant
30
- } = _react.default.useContext(_Group.GroupContext);
31
- /** selectionVariant in Group can override the selectionVariant in List root */
32
-
33
-
34
- const selectionVariant = typeof groupSelectionVariant !== 'undefined' ? groupSelectionVariant : listSelectionVariant; // if selectionVariant is not set on List, don't show selection
35
-
36
- if (!selectionVariant) {
37
- // to avoid confusion, fail loudly instead of silently ignoring
38
- if (selected) throw new Error('For Item to be selected, List needs to have a selectionVariant defined');
39
- return null;
40
- }
41
-
42
- if (selectionVariant === 'single') {
43
- return /*#__PURE__*/_react.default.createElement(_Visuals.LeadingVisualContainer, null, selected && /*#__PURE__*/_react.default.createElement(_octiconsReact.CheckIcon, null));
44
- }
45
- /**
46
- * selectionVariant is multiple
47
- * readOnly is required because we are doing a one-way bind to `checked`
48
- * aria-readonly="false" tells screen that they can still interact with the checkbox
49
- * TODO: not sure if disabled & aria-label be here or should we apply it on the instance as props
50
- * TODO: aria-label should come from the text part of the slot
51
- */
52
-
53
-
54
- return /*#__PURE__*/_react.default.createElement(_Visuals.LeadingVisualContainer, {
55
- sx: {
56
- input: {
57
- margin: 0,
58
- pointerEvents: 'none'
59
- }
60
- }
61
- }, /*#__PURE__*/_react.default.createElement("input", {
62
- type: "checkbox",
63
- checked: selected,
64
- disabled: disabled,
65
- "aria-label": "TODO",
66
- tabIndex: -1,
67
- readOnly: true,
68
- "aria-readonly": "false"
69
- }));
70
- };
71
-
72
- exports.Selection = Selection;
73
- Selection.displayName = "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,28 +0,0 @@
1
- /// <reference types="react" />
2
- import { Divider } from './Divider';
3
- export type { ListProps as ActionListProps } from './List';
4
- export type { GroupProps } from './Group';
5
- export type { ItemProps } from './Item';
6
- export type { DescriptionProps } from './Description';
7
- export type { LeadingVisualProps, TrailingVisualProps } from './Visuals';
8
- /**
9
- * Collection of list-related components.
10
- */
11
- export declare const ActionList: import("@radix-ui/react-polymorphic").ForwardRefComponent<"ul", import("./List").ListProps> & {
12
- /** Collects related `Items` in an `ActionList`. */
13
- Group: import("react").FC<import("./Group").GroupProps>;
14
- /** An actionable or selectable `Item` */
15
- Item: import("@radix-ui/react-polymorphic").ForwardRefComponent<"li", import("./Item").ItemProps>;
16
- /** Visually separates `Item`s or `Group`s in an `ActionList`. */
17
- Divider: typeof Divider;
18
- /** Secondary text which provides additional information about an `Item`. */
19
- Description: import("react").FC<import("./Description").DescriptionProps>;
20
- /** Icon (or similar) positioned before `Item` text. */
21
- LeadingVisual: import("react").FC<import("../sx").SxProp & {
22
- children: import("react").ReactNode;
23
- }>;
24
- /** Icon (or similar) positioned after `Item` text. */
25
- TrailingVisual: import("react").FC<import("../sx").SxProp & {
26
- children: import("react").ReactNode;
27
- }>;
28
- };
@@ -1,42 +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` */
28
- Item: _Item.Item,
29
-
30
- /** Visually separates `Item`s or `Group`s in an `ActionList`. */
31
- Divider: _Divider.Divider,
32
-
33
- /** Secondary text which provides additional information about an `Item`. */
34
- Description: _Description.Description,
35
-
36
- /** Icon (or similar) positioned before `Item` text. */
37
- LeadingVisual: _Visuals.LeadingVisual,
38
-
39
- /** Icon (or similar) positioned after `Item` text. */
40
- TrailingVisual: _Visuals.TrailingVisual
41
- });
42
- exports.ActionList = ActionList;
@@ -1 +0,0 @@
1
- export { ActionList } from './ActionList2';
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- /** createSlots is a factory that can create a
3
- * typesafe Slots + Slot pair to use in a component definition
4
- * For example: ActionList.Item uses createSlots to get a Slots wrapper
5
- * + Slot component that is used by LeadingVisual, Description
6
- */
7
- declare const createSlots: <SlotNames extends string>(slotNames: SlotNames[]) => {
8
- Slots: React.FC<{
9
- context: Record<string, unknown>;
10
- children: (slots: { [key in SlotNames]?: React.ReactNode; }) => React.ReactNode;
11
- }>;
12
- Slot: React.FC<{
13
- name: SlotNames;
14
- children: React.ReactNode | ((context: Record<string, unknown>) => React.ReactNode);
15
- }>;
16
- };
17
- export default createSlots;