@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.
- package/CHANGELOG.md +1 -23
- package/dist/browser.esm.js +49 -53
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +46 -50
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.d.ts +0 -6
- package/lib/ActionList/Item.js +1 -5
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
- package/lib/Autocomplete/Autocomplete.d.ts +8 -6
- package/lib/Autocomplete/AutocompleteInput.d.ts +8 -6
- package/lib/Button/Button.d.ts +4 -4
- package/lib/Button/ButtonClose.d.ts +21 -21
- package/lib/Button/ButtonDanger.d.ts +4 -4
- package/lib/Button/ButtonInvisible.d.ts +4 -4
- package/lib/Button/ButtonOutline.d.ts +4 -4
- package/lib/Button/ButtonPrimary.d.ts +4 -4
- package/lib/CircleOcticon.d.ts +19 -19
- package/lib/DatePicker/DatePicker.d.ts +48 -0
- package/lib/DatePicker/DatePicker.js +106 -0
- package/lib/DatePicker/DatePickerAnchor.d.ts +5 -0
- package/lib/DatePicker/DatePickerAnchor.js +223 -0
- package/lib/DatePicker/DatePickerOverlay.d.ts +3 -0
- package/lib/DatePicker/DatePickerOverlay.js +48 -0
- package/lib/DatePicker/DatePickerPanel.d.ts +2 -0
- package/lib/DatePicker/DatePickerPanel.js +126 -0
- package/lib/DatePicker/Day.d.ts +14 -0
- package/lib/DatePicker/Day.js +192 -0
- package/lib/DatePicker/Month.d.ts +9 -0
- package/lib/DatePicker/Month.js +122 -0
- package/lib/DatePicker/dateParser.d.ts +11 -0
- package/lib/DatePicker/dateParser.js +192 -0
- package/lib/DatePicker/index.d.ts +2 -0
- package/lib/{experiments.js → DatePicker/index.js} +3 -3
- package/lib/DatePicker/useDatePicker.d.ts +89 -0
- package/lib/DatePicker/useDatePicker.js +439 -0
- package/lib/Dialog.d.ts +21 -21
- package/lib/Dropdown.d.ts +82 -82
- package/lib/DropdownMenu/DropdownButton.d.ts +23 -23
- package/lib/FilterList.d.ts +19 -19
- package/lib/Position.d.ts +4 -4
- package/lib/SelectMenu/SelectMenu.d.ts +107 -105
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/TextInputWithTokens.d.ts +8 -10
- package/lib/TextInputWithTokens.js +29 -102
- package/lib/Timeline.d.ts +19 -19
- package/lib/Token/AvatarToken.d.ts +1 -1
- package/lib/Token/IssueLabelToken.d.ts +1 -1
- package/lib/Token/Token.d.ts +1 -1
- package/lib/Token/Token.js +2 -13
- package/lib/Token/TokenBase.js +4 -0
- package/lib/Token/_RemoveTokenButton.js +2 -15
- package/lib/_TextInputWrapper.js +1 -1
- package/lib/hooks/useDebounce.d.ts +2 -0
- package/lib/hooks/useDebounce.js +24 -0
- package/lib/sx.d.ts +0 -2
- package/lib/sx.js +0 -8
- package/lib/theme-preval.js +2 -2
- package/lib/utils/testing.d.ts +1 -1
- package/lib-esm/ActionList/Item.d.ts +0 -6
- package/lib-esm/ActionList/Item.js +1 -5
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
- package/lib-esm/Autocomplete/Autocomplete.d.ts +8 -6
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +8 -6
- package/lib-esm/Button/Button.d.ts +4 -4
- package/lib-esm/Button/ButtonClose.d.ts +21 -21
- package/lib-esm/Button/ButtonDanger.d.ts +4 -4
- package/lib-esm/Button/ButtonInvisible.d.ts +4 -4
- package/lib-esm/Button/ButtonOutline.d.ts +4 -4
- package/lib-esm/Button/ButtonPrimary.d.ts +4 -4
- package/lib-esm/CircleOcticon.d.ts +19 -19
- package/lib-esm/DatePicker/DatePicker.d.ts +48 -0
- package/lib-esm/DatePicker/DatePicker.js +89 -0
- package/lib-esm/DatePicker/DatePickerAnchor.d.ts +5 -0
- package/lib-esm/DatePicker/DatePickerAnchor.js +196 -0
- package/lib-esm/DatePicker/DatePickerOverlay.d.ts +3 -0
- package/lib-esm/DatePicker/DatePickerOverlay.js +29 -0
- package/lib-esm/DatePicker/DatePickerPanel.d.ts +2 -0
- package/lib-esm/DatePicker/DatePickerPanel.js +100 -0
- package/lib-esm/DatePicker/Day.d.ts +14 -0
- package/lib-esm/DatePicker/Day.js +169 -0
- package/lib-esm/DatePicker/Month.d.ts +9 -0
- package/lib-esm/DatePicker/Month.js +98 -0
- package/lib-esm/DatePicker/dateParser.d.ts +11 -0
- package/lib-esm/DatePicker/dateParser.js +178 -0
- package/lib-esm/DatePicker/index.d.ts +2 -0
- package/lib-esm/DatePicker/index.js +1 -0
- package/lib-esm/DatePicker/useDatePicker.d.ts +89 -0
- package/lib-esm/DatePicker/useDatePicker.js +408 -0
- package/lib-esm/Dialog.d.ts +21 -21
- package/lib-esm/Dropdown.d.ts +82 -82
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +23 -23
- package/lib-esm/FilterList.d.ts +19 -19
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/SelectMenu/SelectMenu.d.ts +107 -105
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/TextInputWithTokens.d.ts +8 -10
- package/lib-esm/TextInputWithTokens.js +30 -101
- package/lib-esm/Timeline.d.ts +19 -19
- package/lib-esm/Token/AvatarToken.d.ts +1 -1
- package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/Token/Token.js +2 -13
- package/lib-esm/Token/TokenBase.js +4 -0
- package/lib-esm/Token/_RemoveTokenButton.js +2 -11
- package/lib-esm/_TextInputWrapper.js +1 -1
- package/lib-esm/hooks/useDebounce.d.ts +2 -0
- package/lib-esm/hooks/useDebounce.js +16 -0
- package/lib-esm/sx.d.ts +0 -2
- package/lib-esm/sx.js +1 -3
- package/lib-esm/theme-preval.js +2 -2
- package/lib-esm/utils/testing.d.ts +1 -1
- package/package.json +14 -14
- package/lib/ActionList2/Description.d.ts +0 -6
- package/lib/ActionList2/Description.js +0 -53
- package/lib/ActionList2/Divider.d.ts +0 -5
- package/lib/ActionList2/Divider.js +0 -33
- package/lib/ActionList2/Group.d.ts +0 -11
- package/lib/ActionList2/Group.js +0 -55
- package/lib/ActionList2/Header.d.ts +0 -26
- package/lib/ActionList2/Header.js +0 -55
- package/lib/ActionList2/Item.d.ts +0 -48
- package/lib/ActionList2/Item.js +0 -204
- package/lib/ActionList2/List.d.ts +0 -26
- package/lib/ActionList2/List.js +0 -56
- package/lib/ActionList2/Selection.d.ts +0 -5
- package/lib/ActionList2/Selection.js +0 -73
- package/lib/ActionList2/Visuals.d.ts +0 -11
- package/lib/ActionList2/Visuals.js +0 -90
- package/lib/ActionList2/hacks.d.ts +0 -30
- package/lib/ActionList2/hacks.js +0 -38
- package/lib/ActionList2/index.d.ts +0 -28
- package/lib/ActionList2/index.js +0 -42
- package/lib/experiments.d.ts +0 -1
- package/lib/utils/create-slots.d.ts +0 -17
- package/lib/utils/create-slots.js +0 -105
- package/lib/utils/use-force-update.d.ts +0 -1
- package/lib/utils/use-force-update.js +0 -19
- package/lib-esm/ActionList2/Description.d.ts +0 -6
- package/lib-esm/ActionList2/Description.js +0 -37
- package/lib-esm/ActionList2/Divider.d.ts +0 -5
- package/lib-esm/ActionList2/Divider.js +0 -21
- package/lib-esm/ActionList2/Group.d.ts +0 -11
- package/lib-esm/ActionList2/Group.js +0 -38
- package/lib-esm/ActionList2/Header.d.ts +0 -26
- package/lib-esm/ActionList2/Header.js +0 -45
- package/lib-esm/ActionList2/Item.d.ts +0 -48
- package/lib-esm/ActionList2/Item.js +0 -176
- package/lib-esm/ActionList2/List.d.ts +0 -26
- package/lib-esm/ActionList2/List.js +0 -38
- package/lib-esm/ActionList2/Selection.d.ts +0 -5
- package/lib-esm/ActionList2/Selection.js +0 -55
- package/lib-esm/ActionList2/Visuals.d.ts +0 -11
- package/lib-esm/ActionList2/Visuals.js +0 -68
- package/lib-esm/ActionList2/hacks.d.ts +0 -30
- package/lib-esm/ActionList2/hacks.js +0 -30
- package/lib-esm/ActionList2/index.d.ts +0 -28
- package/lib-esm/ActionList2/index.js +0 -29
- package/lib-esm/experiments.d.ts +0 -1
- package/lib-esm/experiments.js +0 -2
- package/lib-esm/utils/create-slots.d.ts +0 -17
- package/lib-esm/utils/create-slots.js +0 -84
- package/lib-esm/utils/use-force-update.d.ts +0 -1
- package/lib-esm/utils/use-force-update.js +0 -6
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
2
2
|
|
3
3
|
import React from 'react';
|
4
4
|
import { XIcon } from '@primer/octicons-react';
|
5
|
-
import styled
|
5
|
+
import styled from 'styled-components';
|
6
6
|
import { variant } from 'styled-system';
|
7
7
|
import { get } from '../constants';
|
8
8
|
import sx from '../sx';
|
@@ -34,16 +34,7 @@ const getTokenButtonIconSize = size => parseInt(tokenSizes[size || defaultTokenS
|
|
34
34
|
const StyledTokenButton = styled.span.withConfig({
|
35
35
|
displayName: "_RemoveTokenButton__StyledTokenButton",
|
36
36
|
componentId: "sc-14lvcw1-0"
|
37
|
-
})(["background-color:transparent;font-family:inherit;color:currentColor;cursor:pointer;display:inline-flex;justify-content:center;align-items:center;user-select:none;appearance:none;text-decoration:none;padding:0;transform:", ";align-self:baseline;border:0;border-radius:999px
|
38
|
-
switch (props.size) {
|
39
|
-
case 'large':
|
40
|
-
case 'extralarge':
|
41
|
-
return css(["margin-left:", ";"], get('space.2'));
|
42
|
-
|
43
|
-
default:
|
44
|
-
return css(["margin-left:", ";"], get('space.1'));
|
45
|
-
}
|
46
|
-
}, get('colors.neutral.muted'), get('colors.neutral.subtle'), variants, sx);
|
37
|
+
})(["background-color:transparent;font-family:inherit;color:currentColor;cursor:pointer;display:inline-flex;justify-content:center;align-items:center;user-select:none;appearance:none;text-decoration:none;padding:0;transform:", ";align-self:baseline;border:0;border-radius:999px;&:hover,&:focus{background-color:", ";}&:active{background-color:", ";}", " ", ""], props => `translate(${props.borderOffset}px, -${props.borderOffset}px)`, get('colors.neutral.muted'), get('colors.neutral.subtle'), variants, sx);
|
47
38
|
|
48
39
|
const RemoveTokenButton = ({
|
49
40
|
'aria-label': ariaLabel,
|
@@ -21,7 +21,7 @@ const sizeVariants = variant({
|
|
21
21
|
const TextInputWrapper = styled.span.withConfig({
|
22
22
|
displayName: "_TextInputWrapper__TextInputWrapper",
|
23
23
|
componentId: "sc-5vfcis-0"
|
24
|
-
})(["display:inline-flex;align-items:stretch;min-height:34px;font-size:", ";line-height:20px;color:", ";vertical-align:middle;background-repeat:no-repeat;background-position:right 8px center;border:1px solid ", ";border-radius:", ";outline:none;box-shadow:", ";
|
24
|
+
})(["display:inline-flex;align-items:stretch;min-height:34px;font-size:", ";line-height:20px;color:", ";vertical-align:middle;background-repeat:no-repeat;background-position:right 8px center;border:1px solid ", ";border-radius:", ";outline:none;box-shadow:", ";", " .TextInput-icon{align-self:center;color:", ";margin:0 ", ";flex-shrink:0;}&:focus-within{border-color:", ";box-shadow:", ";}", " ", " ", " @media (min-width:", "){font-size:", ";}", " ", " ", " ", " ", ";"], get('fontSizes.1'), get('colors.fg.default'), get('colors.border.default'), get('radii.2'), get('shadows.primer.shadow.inset'), props => {
|
25
25
|
if (props.hasIcon) {
|
26
26
|
return css(["padding:0;"]);
|
27
27
|
} else {
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { useEffect, useState } from 'react';
|
2
|
+
|
3
|
+
function useDebounce(value, delay) {
|
4
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
5
|
+
useEffect(() => {
|
6
|
+
const handler = setTimeout(() => {
|
7
|
+
setDebouncedValue(value);
|
8
|
+
}, delay);
|
9
|
+
return () => {
|
10
|
+
clearTimeout(handler);
|
11
|
+
};
|
12
|
+
}, [value, delay]);
|
13
|
+
return debouncedValue;
|
14
|
+
}
|
15
|
+
|
16
|
+
export default useDebounce;
|
package/lib-esm/sx.d.ts
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import { SystemStyleObject } from '@styled-system/css';
|
2
|
-
import merge from 'deepmerge';
|
3
2
|
export interface SxProp {
|
4
3
|
sx?: SystemStyleObject;
|
5
4
|
}
|
6
5
|
declare const sx: (props: SxProp) => import("@styled-system/css").CssFunctionReturnType;
|
7
6
|
export default sx;
|
8
|
-
export { merge };
|
package/lib-esm/sx.js
CHANGED
package/lib-esm/theme-preval.js
CHANGED
@@ -515,7 +515,7 @@ module.exports = {
|
|
515
515
|
}
|
516
516
|
}
|
517
517
|
},
|
518
|
-
"
|
518
|
+
"light_colorblind": {
|
519
519
|
"colors": {
|
520
520
|
"canvasDefaultTransparent": "rgba(255,255,255,0)",
|
521
521
|
"marketingIcon": {
|
@@ -2456,7 +2456,7 @@ module.exports = {
|
|
2456
2456
|
}
|
2457
2457
|
}
|
2458
2458
|
},
|
2459
|
-
"
|
2459
|
+
"dark_colorblind": {
|
2460
2460
|
"colors": {
|
2461
2461
|
"canvasDefaultTransparent": "rgba(13,17,23,0)",
|
2462
2462
|
"marketingIcon": {
|
@@ -53,7 +53,7 @@ export declare function render(component: React.ReactElement, theme?: {
|
|
53
53
|
xlarge: string;
|
54
54
|
};
|
55
55
|
space: string[];
|
56
|
-
colorSchemes: Record<"light" | "
|
56
|
+
colorSchemes: Record<"light" | "light_colorblind" | "dark" | "dark_dimmed" | "dark_high_contrast" | "dark_colorblind", Record<"colors" | "shadows", Partial<{
|
57
57
|
canvasDefaultTransparent: string;
|
58
58
|
marketingIcon: {
|
59
59
|
primary: string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@primer/components",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-202192923313",
|
4
4
|
"description": "Primer react components",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "lib-esm/index.js",
|
@@ -43,20 +43,16 @@
|
|
43
43
|
"author": "GitHub, Inc.",
|
44
44
|
"license": "MIT",
|
45
45
|
"dependencies": {
|
46
|
-
"@primer/octicons-react": "^
|
47
|
-
"@primer/primitives": "
|
46
|
+
"@primer/octicons-react": "^16.1.0",
|
47
|
+
"@primer/primitives": "6.0.0",
|
48
48
|
"@radix-ui/react-polymorphic": "0.0.14",
|
49
49
|
"@react-aria/ssr": "3.1.0",
|
50
50
|
"@styled-system/css": "5.1.5",
|
51
51
|
"@styled-system/props": "5.1.5",
|
52
52
|
"@styled-system/theme-get": "5.1.2",
|
53
|
-
"@types/history": "4.7.8",
|
54
|
-
"@types/styled-components": "5.1.11",
|
55
|
-
"@types/styled-system": "5.1.12",
|
56
|
-
"@types/styled-system__css": "5.0.16",
|
57
|
-
"@types/styled-system__theme-get": "5.0.1",
|
58
53
|
"classnames": "2.3.1",
|
59
54
|
"color2k": "1.2.4",
|
55
|
+
"date-fns": "2.25.0",
|
60
56
|
"deepmerge": "4.2.2",
|
61
57
|
"focus-visible": "5.2.0",
|
62
58
|
"styled-system": "5.1.5"
|
@@ -76,15 +72,20 @@
|
|
76
72
|
"@rollup/plugin-commonjs": "19.0.2",
|
77
73
|
"@rollup/plugin-node-resolve": "13.0.5",
|
78
74
|
"@size-limit/preset-big-lib": "5.0.2",
|
79
|
-
"@storybook/addon-a11y": "6.3.
|
80
|
-
"@storybook/addon-actions": "^6.
|
81
|
-
"@storybook/addon-essentials": "6.
|
82
|
-
"@storybook/addon-links": "^6.
|
83
|
-
"@storybook/react": "6.3.
|
75
|
+
"@storybook/addon-a11y": "6.3.4",
|
76
|
+
"@storybook/addon-actions": "^6.2.9",
|
77
|
+
"@storybook/addon-essentials": "6.2.9",
|
78
|
+
"@storybook/addon-links": "^6.2.9",
|
79
|
+
"@storybook/react": "6.3.8",
|
84
80
|
"@testing-library/dom": "7.31.2",
|
85
81
|
"@testing-library/react": "11.2.7",
|
86
82
|
"@testing-library/react-hooks": "7.0.2",
|
87
83
|
"@testing-library/user-event": "13.1.9",
|
84
|
+
"@types/history": "4.7.9",
|
85
|
+
"@types/styled-components": "5.1.15",
|
86
|
+
"@types/styled-system": "5.1.13",
|
87
|
+
"@types/styled-system__css": "5.0.16",
|
88
|
+
"@types/styled-system__theme-get": "5.0.1",
|
88
89
|
"@types/chroma-js": "2.1.3",
|
89
90
|
"@types/enzyme": "3.10.9",
|
90
91
|
"@types/jest": "26.0.23",
|
@@ -132,7 +133,6 @@
|
|
132
133
|
"rollup-plugin-visualizer": "5.5.0",
|
133
134
|
"semver": "7.3.5",
|
134
135
|
"size-limit": "5.0.2",
|
135
|
-
"storybook-addon-performance": "0.16.1",
|
136
136
|
"styled-components": "4.4.1",
|
137
137
|
"typescript": "4.2.2"
|
138
138
|
},
|
@@ -1,53 +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 _sx = require("../sx");
|
13
|
-
|
14
|
-
var _Truncate = _interopRequireDefault(require("../Truncate"));
|
15
|
-
|
16
|
-
var _Item = require("./Item");
|
17
|
-
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
-
|
20
|
-
const Description = ({
|
21
|
-
variant = 'inline',
|
22
|
-
sx = {},
|
23
|
-
...props
|
24
|
-
}) => {
|
25
|
-
const styles = {
|
26
|
-
color: 'fg.muted',
|
27
|
-
fontSize: 0,
|
28
|
-
lineHeight: '16px',
|
29
|
-
flexGrow: 1,
|
30
|
-
flexBasis: 0,
|
31
|
-
minWidth: 0,
|
32
|
-
marginLeft: variant === 'block' ? 0 : 2
|
33
|
-
};
|
34
|
-
return /*#__PURE__*/_react.default.createElement(_Item.Slot, {
|
35
|
-
name: variant === 'block' ? 'BlockDescription' : 'InlineDescription'
|
36
|
-
}, ({
|
37
|
-
blockDescriptionId,
|
38
|
-
inlineDescriptionId
|
39
|
-
}) => variant === 'block' ? /*#__PURE__*/_react.default.createElement(_Box.default, {
|
40
|
-
as: "span",
|
41
|
-
sx: (0, _sx.merge)(styles, sx),
|
42
|
-
id: blockDescriptionId
|
43
|
-
}, props.children) : /*#__PURE__*/_react.default.createElement(_Truncate.default, {
|
44
|
-
id: inlineDescriptionId,
|
45
|
-
sx: (0, _sx.merge)(styles, sx),
|
46
|
-
title: props.children,
|
47
|
-
inline: true,
|
48
|
-
maxWidth: "100%"
|
49
|
-
}, props.children));
|
50
|
-
};
|
51
|
-
|
52
|
-
exports.Description = Description;
|
53
|
-
Description.displayName = "Description";
|
@@ -1,33 +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: "li",
|
22
|
-
role: "separator",
|
23
|
-
sx: {
|
24
|
-
height: 1,
|
25
|
-
backgroundColor: 'border.muted',
|
26
|
-
marginTop: theme => `calc(${(0, _constants.get)('space.2')(theme)} - 1px)`,
|
27
|
-
marginBottom: 2
|
28
|
-
},
|
29
|
-
"data-component": "ActionList.Divider"
|
30
|
-
});
|
31
|
-
}
|
32
|
-
|
33
|
-
Divider.displayName = "Divider";
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { SxProp } from '../sx';
|
3
|
-
import { HeaderProps } from './Header';
|
4
|
-
import { ListProps } from './List';
|
5
|
-
export declare type GroupProps = HeaderProps & SxProp & {
|
6
|
-
selectionVariant?: ListProps['selectionVariant'] | false;
|
7
|
-
};
|
8
|
-
declare type ContextProps = Pick<GroupProps, 'selectionVariant'>;
|
9
|
-
export declare const GroupContext: React.Context<ContextProps>;
|
10
|
-
export declare const Group: React.FC<GroupProps>;
|
11
|
-
export {};
|
package/lib/ActionList2/Group.js
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Group = exports.GroupContext = void 0;
|
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
|
-
const GroupContext = /*#__PURE__*/_react.default.createContext({});
|
19
|
-
|
20
|
-
exports.GroupContext = GroupContext;
|
21
|
-
|
22
|
-
const Group = ({
|
23
|
-
title,
|
24
|
-
variant,
|
25
|
-
auxiliaryText,
|
26
|
-
selectionVariant,
|
27
|
-
sx = {},
|
28
|
-
...props
|
29
|
-
}) => {
|
30
|
-
return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
|
31
|
-
as: "li",
|
32
|
-
sx: {
|
33
|
-
'&:not(:first-child)': {
|
34
|
-
marginTop: 2
|
35
|
-
},
|
36
|
-
...sx
|
37
|
-
}
|
38
|
-
}, props), title && /*#__PURE__*/_react.default.createElement(_Header.Header, {
|
39
|
-
title: title,
|
40
|
-
variant: variant,
|
41
|
-
auxiliaryText: auxiliaryText
|
42
|
-
}), /*#__PURE__*/_react.default.createElement(GroupContext.Provider, {
|
43
|
-
value: {
|
44
|
-
selectionVariant
|
45
|
-
}
|
46
|
-
}, /*#__PURE__*/_react.default.createElement(_Box.default, {
|
47
|
-
as: "ul",
|
48
|
-
sx: {
|
49
|
-
paddingInlineStart: 0
|
50
|
-
}
|
51
|
-
}, props.children)));
|
52
|
-
};
|
53
|
-
|
54
|
-
exports.Group = Group;
|
55
|
-
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,48 +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 const getVariantStyles: (variant: ItemProps['variant'], disabled: ItemProps['disabled']) => {
|
6
|
-
color: string;
|
7
|
-
iconColor: string;
|
8
|
-
annotationColor: string;
|
9
|
-
};
|
10
|
-
export declare type ItemProps = {
|
11
|
-
/**
|
12
|
-
* Primary content for an Item
|
13
|
-
*/
|
14
|
-
children: React.ReactNode;
|
15
|
-
/**
|
16
|
-
* Callback that will trigger both on click selection and keyboard selection.
|
17
|
-
*/
|
18
|
-
onSelect?: (event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void;
|
19
|
-
/**
|
20
|
-
* Is the `Item` is currently selected?
|
21
|
-
*/
|
22
|
-
selected?: boolean;
|
23
|
-
/**
|
24
|
-
* Style variations associated with various `Item` types.
|
25
|
-
*
|
26
|
-
* - `"default"` - An action `Item`.
|
27
|
-
* - `"danger"` - A destructive action `Item`.
|
28
|
-
*/
|
29
|
-
variant?: 'default' | 'danger';
|
30
|
-
/**
|
31
|
-
* Items that are disabled can not be clicked, selected, or navigated through.
|
32
|
-
*/
|
33
|
-
disabled?: boolean;
|
34
|
-
/**
|
35
|
-
* The ARIA role describing the function of `Item` component. `option` is a common value. |
|
36
|
-
*/
|
37
|
-
role?: AriaRole;
|
38
|
-
} & SxProp;
|
39
|
-
declare const Slot: React.FC<{
|
40
|
-
name: "LeadingVisual" | "InlineDescription" | "BlockDescription" | "TrailingVisual";
|
41
|
-
children: React.ReactNode | ((context: Record<string, unknown>) => React.ReactNode);
|
42
|
-
}>;
|
43
|
-
export { Slot };
|
44
|
-
export declare type ItemContext = Pick<ItemProps, 'variant' | 'disabled'> & {
|
45
|
-
inlineDescriptionId: string;
|
46
|
-
blockDescriptionId: string;
|
47
|
-
};
|
48
|
-
export declare const Item: PolymorphicForwardRefComponent<"li", ItemProps>;
|