@primer/components 31.2.0-rc.6afeaa37 → 31.2.0-rc.76ed571d
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/.github/workflows/ci.yml +5 -2
- package/.github/workflows/release.yml +1 -0
- package/.github/workflows/release_canary.yml +1 -0
- package/CHANGELOG.md +4 -0
- package/dist/browser.esm.js +209 -209
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +195 -195
- package/dist/browser.umd.js.map +1 -1
- package/docs/content/ActionList2.mdx +14 -8
- package/docs/content/StateLabel.md +5 -4
- package/docs/src/@primer/gatsby-theme-doctocat/live-code-scope.js +2 -2
- package/lib/ActionList/Divider.jsx +29 -0
- package/lib/ActionList/Group.jsx +23 -0
- package/lib/ActionList/Header.jsx +66 -0
- package/lib/ActionList/Item.jsx +301 -0
- package/lib/ActionList/List.jsx +138 -0
- package/lib/ActionList/index.js +12 -23
- package/lib/ActionList2/Description.jsx +30 -0
- package/lib/ActionList2/Divider.jsx +22 -0
- package/lib/ActionList2/Group.jsx +25 -0
- package/lib/ActionList2/Header.jsx +36 -0
- package/lib/ActionList2/Item.jsx +174 -0
- package/lib/ActionList2/LinkItem.jsx +28 -0
- package/lib/ActionList2/List.jsx +41 -0
- package/lib/ActionList2/Selection.jsx +36 -0
- package/lib/ActionList2/Visuals.jsx +48 -0
- package/lib/ActionList2/index.js +23 -41
- package/lib/ActionMenu.jsx +73 -0
- package/lib/AnchoredOverlay/AnchoredOverlay.jsx +100 -0
- package/lib/AnchoredOverlay/index.js +4 -12
- package/lib/Autocomplete/Autocomplete.d.ts +28 -28
- package/lib/Autocomplete/Autocomplete.jsx +100 -0
- package/lib/Autocomplete/AutocompleteContext.jsx +5 -0
- package/lib/Autocomplete/AutocompleteInput.d.ts +28 -28
- package/lib/Autocomplete/AutocompleteInput.jsx +113 -0
- package/lib/Autocomplete/AutocompleteMenu.jsx +190 -0
- package/lib/Autocomplete/AutocompleteOverlay.jsx +55 -0
- package/lib/Autocomplete/index.js +7 -14
- package/lib/Avatar.jsx +34 -0
- package/lib/AvatarPair.jsx +29 -0
- package/lib/AvatarStack.jsx +151 -0
- package/lib/BaseStyles.jsx +65 -0
- package/lib/BorderBox.jsx +18 -0
- package/lib/Box.jsx +10 -0
- package/lib/BranchName.jsx +20 -0
- package/lib/Breadcrumbs.jsx +74 -0
- package/lib/Button/Button.d.ts +25 -25
- package/lib/Button/Button.jsx +60 -0
- package/lib/Button/ButtonBase.jsx +36 -0
- package/lib/Button/ButtonClose.d.ts +45 -45
- package/lib/Button/ButtonClose.jsx +55 -0
- package/lib/Button/ButtonDanger.d.ts +25 -25
- package/lib/Button/ButtonDanger.jsx +63 -0
- package/lib/Button/ButtonGroup.jsx +55 -0
- package/lib/Button/ButtonInvisible.d.ts +25 -25
- package/lib/Button/ButtonInvisible.jsx +52 -0
- package/lib/Button/ButtonOutline.d.ts +25 -25
- package/lib/Button/ButtonOutline.jsx +63 -0
- package/lib/Button/ButtonPrimary.d.ts +25 -25
- package/lib/Button/ButtonPrimary.jsx +62 -0
- package/lib/Button/ButtonStyles.jsx +37 -0
- package/lib/Button/ButtonTableList.jsx +49 -0
- package/lib/Button/index.js +21 -70
- package/lib/Caret.jsx +93 -0
- package/lib/CircleBadge.jsx +43 -0
- package/lib/CircleOcticon.d.ts +42 -42
- package/lib/CircleOcticon.jsx +21 -0
- package/lib/CounterLabel.jsx +44 -0
- package/lib/Details.jsx +21 -0
- package/lib/Dialog/ConfirmationDialog.jsx +146 -0
- package/lib/Dialog/Dialog.js +1 -0
- package/lib/Dialog/Dialog.jsx +273 -0
- package/lib/Dialog.d.ts +45 -45
- package/lib/Dialog.jsx +131 -0
- package/lib/Dropdown.d.ts +176 -176
- package/lib/Dropdown.jsx +134 -0
- package/lib/DropdownMenu/DropdownButton.d.ts +46 -46
- package/lib/DropdownMenu/DropdownButton.jsx +14 -0
- package/lib/DropdownMenu/DropdownMenu.jsx +70 -0
- package/lib/DropdownMenu/index.js +6 -20
- package/lib/DropdownStyles.js +18 -26
- package/lib/FilterList.d.ts +42 -42
- package/lib/FilterList.jsx +63 -0
- package/lib/FilteredActionList/FilteredActionList.jsx +100 -0
- package/lib/FilteredActionList/index.js +4 -12
- package/lib/FilteredSearch.jsx +29 -0
- package/lib/Flash.jsx +70 -0
- package/lib/Flex.jsx +15 -0
- package/lib/FormGroup.jsx +25 -0
- package/lib/Grid.jsx +15 -0
- package/lib/Header.jsx +90 -0
- package/lib/Heading.jsx +21 -0
- package/lib/Label.jsx +84 -0
- package/lib/LabelGroup.jsx +19 -0
- package/lib/Link.jsx +38 -0
- package/lib/NewButton/button-counter.d.ts +6 -0
- package/lib/NewButton/button-counter.js +31 -0
- package/lib/NewButton/button-counter.jsx +14 -0
- package/lib/NewButton/button.d.ts +13 -0
- package/lib/NewButton/button.js +316 -0
- package/lib/NewButton/button.jsx +278 -0
- package/lib/NewButton/index.d.ts +14 -0
- package/lib/NewButton/index.js +8 -0
- package/lib/NewButton/types.d.ts +32 -0
- package/lib/NewButton/types.js +2 -0
- package/lib/Overlay.jsx +156 -0
- package/lib/Pagehead.jsx +18 -0
- package/lib/Pagination/Pagination.jsx +163 -0
- package/lib/Pagination/index.js +6 -12
- package/lib/Pagination/model.jsx +174 -0
- package/lib/PointerBox.jsx +25 -0
- package/lib/Popover.jsx +210 -0
- package/lib/Portal/Portal.jsx +79 -0
- package/lib/Portal/index.js +5 -16
- package/lib/Position.d.ts +4 -4
- package/lib/Position.jsx +46 -0
- package/lib/ProgressBar.jsx +39 -0
- package/lib/SelectMenu/SelectMenu.d.ts +246 -246
- package/lib/SelectMenu/SelectMenu.jsx +114 -0
- package/lib/SelectMenu/SelectMenuContext.jsx +5 -0
- package/lib/SelectMenu/SelectMenuDivider.jsx +43 -0
- package/lib/SelectMenu/SelectMenuFilter.jsx +59 -0
- package/lib/SelectMenu/SelectMenuFooter.jsx +46 -0
- package/lib/SelectMenu/SelectMenuHeader.jsx +44 -0
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuItem.jsx +143 -0
- package/lib/SelectMenu/SelectMenuList.jsx +60 -0
- package/lib/SelectMenu/SelectMenuLoadingAnimation.jsx +21 -0
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuModal.jsx +119 -0
- package/lib/SelectMenu/SelectMenuTab.jsx +93 -0
- package/lib/SelectMenu/SelectMenuTabPanel.jsx +43 -0
- package/lib/SelectMenu/SelectMenuTabs.jsx +58 -0
- package/lib/SelectMenu/hooks/useKeyboardNav.js +80 -96
- package/lib/SelectMenu/index.js +7 -14
- package/lib/SelectPanel/SelectPanel.jsx +105 -0
- package/lib/SelectPanel/index.js +4 -12
- package/lib/SideNav.jsx +177 -0
- package/lib/Spinner.jsx +35 -0
- package/lib/StateLabel.d.ts +1 -1
- package/lib/StateLabel.js +6 -1
- package/lib/StateLabel.jsx +94 -0
- package/lib/StyledOcticon.jsx +20 -0
- package/lib/SubNav.jsx +104 -0
- package/lib/TabNav.jsx +60 -0
- package/lib/Text.jsx +14 -0
- package/lib/TextInput.jsx +23 -0
- package/lib/TextInputWithTokens.d.ts +28 -28
- package/lib/TextInputWithTokens.jsx +218 -0
- package/lib/ThemeProvider.jsx +130 -0
- package/lib/Timeline.d.ts +43 -43
- package/lib/Timeline.jsx +124 -0
- package/lib/Token/AvatarToken.d.ts +1 -1
- package/lib/Token/AvatarToken.jsx +54 -0
- package/lib/Token/IssueLabelToken.d.ts +1 -1
- package/lib/Token/IssueLabelToken.jsx +125 -0
- package/lib/Token/Token.d.ts +1 -1
- package/lib/Token/Token.jsx +103 -0
- package/lib/Token/TokenBase.jsx +88 -0
- package/lib/Token/_RemoveTokenButton.jsx +108 -0
- package/lib/Token/_TokenTextContainer.jsx +49 -0
- package/lib/Token/index.js +11 -30
- package/lib/Tooltip.jsx +246 -0
- package/lib/Truncate.jsx +27 -0
- package/lib/UnderlineNav.jsx +90 -0
- package/lib/_TextInputWrapper.jsx +120 -0
- package/lib/_UnstyledTextInput.jsx +22 -0
- package/lib/__tests__/ActionList.test.jsx +49 -0
- package/lib/__tests__/ActionList.types.test.jsx +45 -0
- package/lib/__tests__/ActionList2.test.jsx +46 -0
- package/lib/__tests__/ActionMenu.test.jsx +124 -0
- package/lib/__tests__/AnchoredOverlay.test.jsx +121 -0
- package/lib/__tests__/Autocomplete.test.jsx +299 -0
- package/lib/__tests__/Avatar.test.jsx +42 -0
- package/lib/__tests__/AvatarStack.test.jsx +43 -0
- package/lib/__tests__/BorderBox.test.jsx +36 -0
- package/lib/__tests__/Box.test.jsx +41 -0
- package/lib/__tests__/BranchName.test.jsx +27 -0
- package/lib/__tests__/Breadcrumbs.test.jsx +28 -0
- package/lib/__tests__/BreadcrumbsItem.test.jsx +31 -0
- package/lib/__tests__/Button.test.jsx +100 -0
- package/lib/__tests__/Caret.test.jsx +37 -0
- package/lib/__tests__/CircleBadge.test.jsx +55 -0
- package/lib/__tests__/CircleOcticon.test.jsx +45 -0
- package/lib/__tests__/ConfirmationDialog.test.jsx +119 -0
- package/lib/__tests__/CounterLabel.test.jsx +36 -0
- package/lib/__tests__/Details.test.jsx +85 -0
- package/lib/__tests__/Dialog.test.jsx +139 -0
- package/lib/__tests__/Dropdown.test.jsx +49 -0
- package/lib/__tests__/DropdownMenu.test.jsx +119 -0
- package/lib/__tests__/FilterList.test.jsx +27 -0
- package/lib/__tests__/FilterListItem.test.jsx +31 -0
- package/lib/__tests__/FilteredSearch.test.jsx +27 -0
- package/lib/__tests__/Flash.test.jsx +36 -0
- package/lib/__tests__/Flex.test.jsx +51 -0
- package/lib/__tests__/FormGroup.test.jsx +36 -0
- package/lib/__tests__/Grid.test.jsx +69 -0
- package/lib/__tests__/Header.test.jsx +45 -0
- package/lib/__tests__/Heading.test.jsx +71 -0
- package/lib/__tests__/KeyPaths.types.test.js +5 -8
- package/lib/__tests__/Label.test.jsx +33 -0
- package/lib/__tests__/LabelGroup.test.jsx +29 -0
- package/lib/__tests__/Link.test.jsx +43 -0
- package/lib/__tests__/Merge.types.test.js +13 -19
- package/lib/__tests__/NewButton.test.d.ts +1 -0
- package/lib/__tests__/NewButton.test.js +86 -0
- package/lib/__tests__/NewButton.test.jsx +55 -0
- package/lib/__tests__/Overlay.test.jsx +105 -0
- package/lib/__tests__/Pagehead.test.jsx +25 -0
- package/lib/__tests__/Pagination/Pagination.test.jsx +32 -0
- package/lib/__tests__/Pagination/PaginationModel.test.jsx +118 -0
- package/lib/__tests__/PointerBox.test.jsx +33 -0
- package/lib/__tests__/Popover.test.jsx +58 -0
- package/lib/__tests__/Portal.test.jsx +102 -0
- package/lib/__tests__/Position.test.jsx +96 -0
- package/lib/__tests__/ProgressBar.test.jsx +38 -0
- package/lib/__tests__/SelectMenu.test.jsx +120 -0
- package/lib/__tests__/SelectPanel.test.jsx +48 -0
- package/lib/__tests__/SideNav.test.jsx +55 -0
- package/lib/__tests__/Spinner.test.jsx +41 -0
- package/lib/__tests__/StateLabel.test.jsx +46 -0
- package/lib/__tests__/StyledOcticon.test.jsx +28 -0
- package/lib/__tests__/SubNav.test.jsx +47 -0
- package/lib/__tests__/SubNavLink.test.jsx +31 -0
- package/lib/__tests__/TabNav.test.jsx +32 -0
- package/lib/__tests__/Text.test.jsx +71 -0
- package/lib/__tests__/TextInput.test.jsx +45 -0
- package/lib/__tests__/TextInputWithTokens.test.jsx +302 -0
- package/lib/__tests__/ThemeProvider.test.jsx +314 -0
- package/lib/__tests__/Timeline.test.jsx +51 -0
- package/lib/__tests__/Token.test.jsx +93 -0
- package/lib/__tests__/Tooltip.test.jsx +46 -0
- package/lib/__tests__/Truncate.test.jsx +41 -0
- package/lib/__tests__/UnderlineNav.test.jsx +53 -0
- package/lib/__tests__/UnderlineNavLink.test.jsx +31 -0
- package/lib/__tests__/behaviors/anchoredPosition.test.js +229 -376
- package/lib/__tests__/behaviors/focusTrap.test.jsx +184 -0
- package/lib/__tests__/behaviors/focusZone.test.jsx +406 -0
- package/lib/__tests__/behaviors/iterateFocusableElements.test.jsx +58 -0
- package/lib/__tests__/behaviors/scrollIntoViewingArea.test.js +145 -216
- package/lib/__tests__/filterObject.test.js +48 -27
- package/lib/__tests__/hooks/useAnchoredPosition.test.jsx +29 -0
- package/lib/__tests__/hooks/useOnEscapePress.test.jsx +19 -0
- package/lib/__tests__/hooks/useOnOutsideClick.test.jsx +63 -0
- package/lib/__tests__/hooks/useOpenAndCloseFocus.test.jsx +61 -0
- package/lib/__tests__/hooks/useProvidedStateOrCreate.test.jsx +56 -0
- package/lib/__tests__/theme.test.js +33 -34
- package/lib/__tests__/themeGet.test.js +12 -23
- package/lib/__tests__/useSafeTimeout.test.jsx +36 -0
- package/lib/__tests__/utils/createSlots.test.jsx +57 -0
- package/lib/behaviors/anchoredPosition.js +205 -234
- package/lib/behaviors/focusTrap.js +121 -157
- package/lib/behaviors/focusZone.js +434 -509
- package/lib/behaviors/scrollIntoViewingArea.js +18 -35
- package/lib/constants.js +39 -43
- package/lib/{unreleased.d.ts → drafts.d.ts} +2 -1
- package/lib/drafts.js +21 -0
- package/lib/hooks/index.js +16 -60
- package/lib/hooks/useAnchoredPosition.js +32 -40
- package/lib/hooks/useCombinedRefs.js +32 -36
- package/lib/hooks/useDetails.jsx +39 -0
- package/lib/hooks/useDialog.js +72 -96
- package/lib/hooks/useFocusTrap.js +43 -60
- package/lib/hooks/useFocusZone.js +54 -50
- package/lib/hooks/useOnEscapePress.js +25 -36
- package/lib/hooks/useOnOutsideClick.jsx +61 -0
- package/lib/hooks/useOpenAndCloseFocus.js +22 -34
- package/lib/hooks/useOverlay.jsx +15 -0
- package/lib/hooks/useProvidedRefOrCreate.js +10 -14
- package/lib/hooks/useProvidedStateOrCreate.js +13 -16
- package/lib/hooks/useRenderForcingRef.js +13 -17
- package/lib/hooks/useResizeObserver.js +15 -18
- package/lib/hooks/useSafeTimeout.js +22 -30
- package/lib/hooks/useScrollFlash.js +16 -23
- package/lib/index.d.ts +2 -0
- package/lib/index.js +163 -636
- package/lib/polyfills/eventListenerSignal.js +37 -45
- package/lib/stories/ActionList2.stories.js +3 -2
- package/lib/stories/NewButton.stories.js +230 -0
- package/lib/sx.js +10 -22
- package/lib/theme-preval.js +64 -3023
- package/lib/theme.js +3 -12
- package/lib/utils/create-slots.jsx +65 -0
- package/lib/utils/deprecate.jsx +59 -0
- package/lib/utils/isNumeric.jsx +7 -0
- package/lib/utils/iterateFocusableElements.js +63 -85
- package/lib/utils/ssr.jsx +6 -0
- package/lib/utils/test-deprecations.jsx +20 -0
- package/lib/utils/test-helpers.jsx +8 -0
- package/lib/utils/test-matchers.jsx +100 -0
- package/lib/utils/testing.jsx +206 -0
- package/lib/utils/theme.js +33 -47
- package/lib/utils/types/AriaRole.js +2 -1
- package/lib/utils/types/ComponentProps.js +2 -1
- package/lib/utils/types/Flatten.js +2 -1
- package/lib/utils/types/KeyPaths.js +2 -1
- package/lib/utils/types/MandateProps.js +16 -1
- package/lib/utils/types/Merge.js +2 -1
- package/lib/utils/types/index.js +16 -69
- package/lib/utils/uniqueId.js +5 -8
- package/lib/utils/use-force-update.js +8 -14
- package/lib/utils/useIsomorphicLayoutEffect.js +8 -11
- package/lib/utils/userAgent.js +8 -12
- package/lib-esm/Autocomplete/Autocomplete.d.ts +28 -28
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +28 -28
- package/lib-esm/Button/Button.d.ts +25 -25
- package/lib-esm/Button/ButtonClose.d.ts +45 -45
- package/lib-esm/Button/ButtonDanger.d.ts +25 -25
- package/lib-esm/Button/ButtonInvisible.d.ts +25 -25
- package/lib-esm/Button/ButtonOutline.d.ts +25 -25
- package/lib-esm/Button/ButtonPrimary.d.ts +25 -25
- package/lib-esm/CircleOcticon.d.ts +42 -42
- package/lib-esm/Dialog/Dialog.js +1 -0
- package/lib-esm/Dialog.d.ts +45 -45
- package/lib-esm/Dropdown.d.ts +176 -176
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +46 -46
- package/lib-esm/FilterList.d.ts +42 -42
- package/lib-esm/NewButton/button-counter.d.ts +6 -0
- package/lib-esm/NewButton/button-counter.js +18 -0
- package/lib-esm/NewButton/button.d.ts +13 -0
- package/lib-esm/NewButton/button.js +298 -0
- package/lib-esm/NewButton/index.d.ts +14 -0
- package/lib-esm/NewButton/index.js +5 -0
- package/lib-esm/NewButton/types.d.ts +32 -0
- package/lib-esm/NewButton/types.js +1 -0
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/SelectMenu/SelectMenu.d.ts +246 -246
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/StateLabel.d.ts +1 -1
- package/lib-esm/StateLabel.js +7 -2
- package/lib-esm/TextInputWithTokens.d.ts +28 -28
- package/lib-esm/Timeline.d.ts +43 -43
- 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/__tests__/NewButton.test.d.ts +1 -0
- package/lib-esm/__tests__/NewButton.test.js +76 -0
- package/lib-esm/{unreleased.d.ts → drafts.d.ts} +2 -1
- package/lib-esm/{unreleased.js → drafts.js} +3 -2
- package/lib-esm/index.d.ts +2 -0
- package/lib-esm/index.js +1 -0
- package/lib-esm/stories/ActionList2.stories.js +3 -3
- package/lib-esm/stories/NewButton.stories.js +178 -0
- package/package-lock.json +7 -7
- package/package.json +4 -3
- package/script/build +1 -1
- package/src/Dialog/Dialog.tsx +1 -0
- package/src/NewButton/button-counter.tsx +15 -0
- package/src/NewButton/button.tsx +279 -0
- package/src/NewButton/index.ts +10 -0
- package/src/NewButton/types.ts +36 -0
- package/src/StateLabel.tsx +14 -2
- package/src/__tests__/NewButton.test.tsx +64 -0
- package/src/__tests__/__snapshots__/Autocomplete.test.tsx.snap +1 -0
- package/src/__tests__/__snapshots__/CircleBadge.test.tsx.snap +1 -0
- package/src/__tests__/__snapshots__/CircleOcticon.test.tsx.snap +1 -0
- package/src/__tests__/__snapshots__/Dialog.test.tsx.snap +1 -0
- package/src/__tests__/__snapshots__/DropdownMenu.test.tsx.snap +1 -0
- package/src/__tests__/__snapshots__/NewButton.test.tsx.snap +182 -0
- package/src/__tests__/__snapshots__/SelectMenu.test.tsx.snap +4 -0
- package/src/__tests__/__snapshots__/SelectPanel.test.tsx.snap +1 -0
- package/src/__tests__/__snapshots__/StateLabel.test.tsx.snap +13 -6
- package/src/__tests__/__snapshots__/StyledOcticon.test.tsx.snap +1 -0
- package/src/__tests__/__snapshots__/TextInputWithTokens.test.tsx.snap +66 -0
- package/src/__tests__/__snapshots__/Token.test.tsx.snap +17 -0
- package/src/{unreleased.ts → drafts.ts} +2 -1
- package/src/index.ts +2 -0
- package/src/stories/ActionList2.stories.tsx +12 -9
- package/src/stories/NewButton.stories.tsx +201 -0
- package/stats.html +1 -1
- package/tsconfig.base.json +20 -0
- package/tsconfig.build.json +2 -2
- package/tsconfig.json +4 -17
- package/lib/unreleased.js +0 -18
@@ -0,0 +1,76 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { NewButton as Button } from '../NewButton';
|
3
|
+
import { render, behavesAsComponent } from '../utils/testing';
|
4
|
+
import { render as HTMLRender, cleanup } from '@testing-library/react';
|
5
|
+
import { axe, toHaveNoViolations } from 'jest-axe';
|
6
|
+
import 'babel-polyfill';
|
7
|
+
expect.extend(toHaveNoViolations); // eslint-disable-next-line @typescript-eslint/no-empty-function
|
8
|
+
|
9
|
+
function noop() {}
|
10
|
+
|
11
|
+
describe('Button', () => {
|
12
|
+
behavesAsComponent({
|
13
|
+
Component: Button
|
14
|
+
});
|
15
|
+
it('renders a <button>', () => {
|
16
|
+
expect(render( /*#__PURE__*/React.createElement(Button, null, "Default")).type).toEqual('button');
|
17
|
+
});
|
18
|
+
it('should have no axe violations', async () => {
|
19
|
+
const {
|
20
|
+
container
|
21
|
+
} = HTMLRender( /*#__PURE__*/React.createElement(Button, null, "Click here"));
|
22
|
+
const results = await axe(container);
|
23
|
+
expect(results).toHaveNoViolations();
|
24
|
+
cleanup();
|
25
|
+
});
|
26
|
+
it('preserves "onClick" prop', () => {
|
27
|
+
expect(render( /*#__PURE__*/React.createElement(Button, {
|
28
|
+
onClick: noop
|
29
|
+
}, "Noop")).props.onClick).toEqual(noop);
|
30
|
+
});
|
31
|
+
it('respects width props', () => {
|
32
|
+
expect(render( /*#__PURE__*/React.createElement(Button, {
|
33
|
+
sx: {
|
34
|
+
width: 200
|
35
|
+
}
|
36
|
+
}, "Block"))).toHaveStyleRule('width', '200px');
|
37
|
+
});
|
38
|
+
it('respects the "disabled" prop', () => {
|
39
|
+
const item = render( /*#__PURE__*/React.createElement(Button, {
|
40
|
+
disabled: true
|
41
|
+
}, " Disabled"));
|
42
|
+
expect(item.props.disabled).toEqual(true);
|
43
|
+
expect(item).toMatchSnapshot();
|
44
|
+
});
|
45
|
+
it('respects the "variant" prop', () => {
|
46
|
+
expect(render( /*#__PURE__*/React.createElement(Button, {
|
47
|
+
size: "small"
|
48
|
+
}, "Smol"))).toHaveStyleRule('font-size', '12px');
|
49
|
+
expect(render( /*#__PURE__*/React.createElement(Button, {
|
50
|
+
size: "large"
|
51
|
+
}, "Large"))).toHaveStyleRule('font-size', '16px');
|
52
|
+
});
|
53
|
+
it('respects the "fontSize" prop over the "variant" prop', () => {
|
54
|
+
expect(render( /*#__PURE__*/React.createElement(Button, {
|
55
|
+
size: "small",
|
56
|
+
sx: {
|
57
|
+
fontSize: 20
|
58
|
+
}
|
59
|
+
}, "Big Smol"))).toHaveStyleRule('font-size', '20px');
|
60
|
+
});
|
61
|
+
it('styles primary button appropriately', () => {
|
62
|
+
expect(render( /*#__PURE__*/React.createElement(Button, {
|
63
|
+
variant: "primary"
|
64
|
+
}, "Primary"))).toHaveStyleRule('background-color', '#2da44e');
|
65
|
+
});
|
66
|
+
it('styles invisible button appropriately', () => {
|
67
|
+
expect(render( /*#__PURE__*/React.createElement(Button, {
|
68
|
+
variant: "invisible"
|
69
|
+
}, "Invisible"))).toHaveStyleRule('background-color', 'transparent');
|
70
|
+
});
|
71
|
+
it('styles danger button appropriately', () => {
|
72
|
+
expect(render( /*#__PURE__*/React.createElement(Button, {
|
73
|
+
variant: "danger"
|
74
|
+
}, "Danger"))).toHaveStyleRule('background-color', '#f6f8fa');
|
75
|
+
});
|
76
|
+
});
|
@@ -2,6 +2,7 @@
|
|
2
2
|
* api yet (not in main bundle). We don't recommend using it in production.
|
3
3
|
*
|
4
4
|
* But, they are published on npm and you can import them for experimentation/feedback.
|
5
|
-
* example: import {ActionList} from '@primer/components/
|
5
|
+
* example: import {ActionList} from '@primer/components/drafts
|
6
6
|
*/
|
7
7
|
export * from './ActionList2';
|
8
|
+
export * from './NewButton';
|
@@ -2,7 +2,8 @@
|
|
2
2
|
* api yet (not in main bundle). We don't recommend using it in production.
|
3
3
|
*
|
4
4
|
* But, they are published on npm and you can import them for experimentation/feedback.
|
5
|
-
* example: import {ActionList} from '@primer/components/
|
5
|
+
* example: import {ActionList} from '@primer/components/drafts
|
6
6
|
*/
|
7
7
|
// Components
|
8
|
-
export * from './ActionList2';
|
8
|
+
export * from './ActionList2';
|
9
|
+
export * from './NewButton';
|
package/lib-esm/index.d.ts
CHANGED
@@ -37,6 +37,8 @@ export type { BranchNameProps } from './BranchName';
|
|
37
37
|
export { default as Breadcrumbs, Breadcrumb } from './Breadcrumbs';
|
38
38
|
export type { BreadcrumbsProps, BreadcrumbsItemProps, BreadcrumbProps, BreadcrumbItemProps } from './Breadcrumbs';
|
39
39
|
export { default as Button, ButtonDanger, ButtonOutline, ButtonPrimary, ButtonInvisible, ButtonTableList, ButtonClose, ButtonGroup } from './Button';
|
40
|
+
export { NewButton } from './NewButton';
|
41
|
+
export type { NewButtonProps } from './NewButton';
|
40
42
|
export type { ButtonProps, ButtonDangerProps, ButtonOutlineProps, ButtonPrimaryProps, ButtonInvisibleProps, ButtonTableListProps, ButtonCloseProps, ButtonGroupProps } from './Button';
|
41
43
|
export { default as Caret } from './Caret';
|
42
44
|
export type { CaretProps } from './Caret';
|
package/lib-esm/index.js
CHANGED
@@ -26,6 +26,7 @@ export { default as AvatarStack } from './AvatarStack';
|
|
26
26
|
export { default as BranchName } from './BranchName';
|
27
27
|
export { default as Breadcrumbs, Breadcrumb } from './Breadcrumbs';
|
28
28
|
export { default as Button, ButtonDanger, ButtonOutline, ButtonPrimary, ButtonInvisible, ButtonTableList, ButtonClose, ButtonGroup } from './Button';
|
29
|
+
export { NewButton } from './NewButton';
|
29
30
|
export { default as Caret } from './Caret';
|
30
31
|
export { default as CircleBadge } from './CircleBadge';
|
31
32
|
export { default as CircleOcticon } from './CircleOcticon';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
2
|
|
3
|
-
import { ServerIcon, PlusCircleIcon, TypographyIcon, VersionsIcon, SearchIcon, NoteIcon, ProjectIcon, FilterIcon, GearIcon, ArrowRightIcon, ArrowLeftIcon, LinkIcon, LawIcon, StarIcon,
|
3
|
+
import { ServerIcon, PlusCircleIcon, TypographyIcon, VersionsIcon, SearchIcon, NoteIcon, ProjectIcon, FilterIcon, GearIcon, ArrowRightIcon, ArrowLeftIcon, LinkIcon, LawIcon, StarIcon, RepoForkedIcon, AlertIcon, TableIcon, PeopleIcon, CalendarIcon, IssueOpenedIcon, NumberIcon, XIcon, RepoIcon } from '@primer/octicons-react';
|
4
4
|
import React, { forwardRef } from 'react';
|
5
5
|
import styled from 'styled-components';
|
6
6
|
import { DndProvider, useDrag, useDrop } from 'react-dnd';
|
@@ -42,7 +42,7 @@ export function SimpleListStory() {
|
|
42
42
|
}
|
43
43
|
SimpleListStory.storyName = 'Simple List';
|
44
44
|
export function WithIcon() {
|
45
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h1", null, "With Icon"), /*#__PURE__*/React.createElement(ActionList, null, /*#__PURE__*/React.createElement(ActionList.Item, null, /*#__PURE__*/React.createElement(ActionList.LeadingVisual, null, /*#__PURE__*/React.createElement(LinkIcon, null)), "github.com/primer"), /*#__PURE__*/React.createElement(ActionList.Item, null, /*#__PURE__*/React.createElement(ActionList.LeadingVisual, null, /*#__PURE__*/React.createElement(LawIcon, null)), "MIT License"), /*#__PURE__*/React.createElement(ActionList.Item, null, /*#__PURE__*/React.createElement(ActionList.LeadingVisual, null, /*#__PURE__*/React.createElement(StarIcon, null)), "256 stars"), /*#__PURE__*/React.createElement(ActionList.Item, null, /*#__PURE__*/React.createElement(ActionList.LeadingVisual, null, /*#__PURE__*/React.createElement(
|
45
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h1", null, "With Icon"), /*#__PURE__*/React.createElement(ActionList, null, /*#__PURE__*/React.createElement(ActionList.Item, null, /*#__PURE__*/React.createElement(ActionList.LeadingVisual, null, /*#__PURE__*/React.createElement(LinkIcon, null)), "github.com/primer"), /*#__PURE__*/React.createElement(ActionList.Item, null, /*#__PURE__*/React.createElement(ActionList.LeadingVisual, null, /*#__PURE__*/React.createElement(LawIcon, null)), "MIT License"), /*#__PURE__*/React.createElement(ActionList.Item, null, /*#__PURE__*/React.createElement(ActionList.LeadingVisual, null, /*#__PURE__*/React.createElement(StarIcon, null)), "256 stars"), /*#__PURE__*/React.createElement(ActionList.Item, null, /*#__PURE__*/React.createElement(ActionList.LeadingVisual, null, /*#__PURE__*/React.createElement(RepoForkedIcon, null)), "3 forks"), /*#__PURE__*/React.createElement(ActionList.Item, {
|
46
46
|
variant: "danger"
|
47
47
|
}, /*#__PURE__*/React.createElement(ActionList.LeadingVisual, null, /*#__PURE__*/React.createElement(AlertIcon, null)), "4 vulnerabilities")));
|
48
48
|
}
|
@@ -739,7 +739,7 @@ SortableItem.displayName = "SortableItem";
|
|
739
739
|
const repos = ['primer/primer-markdown', 'primer/octicons', 'primer/css', 'primer/primer-layout', 'primer/primer-alerts', 'primer/primer-avatars', 'primer/react', 'primer/primitives'];
|
740
740
|
export function AsyncListStory() {
|
741
741
|
const [results, setResults] = React.useState(repos.slice(0, 6));
|
742
|
-
const [loading, setLoading] = React.useState(false);
|
742
|
+
const [loading, setLoading] = React.useState(false); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
743
743
|
|
744
744
|
const filter = async event => {
|
745
745
|
setLoading(true);
|
@@ -0,0 +1,178 @@
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
|
+
|
3
|
+
import React, { useState } from 'react';
|
4
|
+
import { NewButton as Button } from '../NewButton';
|
5
|
+
import { BaseStyles, ThemeProvider } from '..';
|
6
|
+
import { XIcon, SearchIcon, EyeIcon, EyeClosedIcon, TriangleDownIcon } from '@primer/octicons-react';
|
7
|
+
import Box from '../Box';
|
8
|
+
export default {
|
9
|
+
title: 'Composite components/New Button',
|
10
|
+
decorators: [Story => {
|
11
|
+
return /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(BaseStyles, null, /*#__PURE__*/React.createElement(Story, null)));
|
12
|
+
}],
|
13
|
+
argTypes: {
|
14
|
+
size: {
|
15
|
+
control: {
|
16
|
+
type: 'radio',
|
17
|
+
options: ['small', 'medium', 'large']
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
};
|
22
|
+
export const defaultButton = ({
|
23
|
+
size = 'medium',
|
24
|
+
...args
|
25
|
+
}) => {
|
26
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
27
|
+
size: size
|
28
|
+
}, args), "Default");
|
29
|
+
};
|
30
|
+
defaultButton.displayName = "defaultButton";
|
31
|
+
export const primaryButton = args => {
|
32
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, args, {
|
33
|
+
variant: "primary"
|
34
|
+
}), "Primary");
|
35
|
+
};
|
36
|
+
primaryButton.displayName = "primaryButton";
|
37
|
+
export const dangerButton = args => {
|
38
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, args, {
|
39
|
+
variant: "danger"
|
40
|
+
}), "Danger");
|
41
|
+
};
|
42
|
+
dangerButton.displayName = "dangerButton";
|
43
|
+
export const invisibleButton = args => {
|
44
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, args, {
|
45
|
+
variant: "invisible"
|
46
|
+
}), "Invisible");
|
47
|
+
};
|
48
|
+
invisibleButton.displayName = "invisibleButton";
|
49
|
+
export const iconBeforeButton = args => {
|
50
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
51
|
+
leadingIcon: SearchIcon
|
52
|
+
}, args), "Before");
|
53
|
+
};
|
54
|
+
iconBeforeButton.displayName = "iconBeforeButton";
|
55
|
+
export const iconButton = ({ ...args
|
56
|
+
}) => {
|
57
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
|
58
|
+
mb: 2
|
59
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
60
|
+
icon: XIcon
|
61
|
+
}, args), "Close")), /*#__PURE__*/React.createElement(Box, {
|
62
|
+
mb: 2
|
63
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
64
|
+
icon: XIcon
|
65
|
+
}, args, {
|
66
|
+
variant: "invisible"
|
67
|
+
}), "Close")), /*#__PURE__*/React.createElement(Box, {
|
68
|
+
mb: 2
|
69
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
70
|
+
icon: XIcon
|
71
|
+
}, args, {
|
72
|
+
variant: "danger"
|
73
|
+
}), "Close")), /*#__PURE__*/React.createElement(Box, {
|
74
|
+
mb: 2
|
75
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
76
|
+
icon: XIcon
|
77
|
+
}, args, {
|
78
|
+
variant: "primary"
|
79
|
+
}), "Close")), /*#__PURE__*/React.createElement(Box, {
|
80
|
+
mb: 2
|
81
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
82
|
+
icon: XIcon
|
83
|
+
}, args, {
|
84
|
+
variant: "outline"
|
85
|
+
}), "Close")));
|
86
|
+
};
|
87
|
+
export const WatchCounterButton = ({ ...args
|
88
|
+
}) => {
|
89
|
+
const [count, setCount] = useState(0);
|
90
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
|
91
|
+
mb: 2
|
92
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
93
|
+
onClick: () => setCount(count + 1)
|
94
|
+
}, args), "Watch", /*#__PURE__*/React.createElement(Button.Counter, null, count))), /*#__PURE__*/React.createElement(Box, {
|
95
|
+
mb: 2
|
96
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
97
|
+
onClick: () => setCount(count + 1)
|
98
|
+
}, args, {
|
99
|
+
variant: "primary"
|
100
|
+
}), "Watch", /*#__PURE__*/React.createElement(Button.Counter, null, count))), /*#__PURE__*/React.createElement(Box, {
|
101
|
+
mb: 2
|
102
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
103
|
+
onClick: () => setCount(count + 1)
|
104
|
+
}, args, {
|
105
|
+
variant: "invisible"
|
106
|
+
}), "Watch", /*#__PURE__*/React.createElement(Button.Counter, null, count))), /*#__PURE__*/React.createElement(Box, {
|
107
|
+
mb: 2
|
108
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
109
|
+
onClick: () => setCount(count + 1)
|
110
|
+
}, args, {
|
111
|
+
variant: "danger"
|
112
|
+
}), "Watch", /*#__PURE__*/React.createElement(Button.Counter, null, count))), /*#__PURE__*/React.createElement(Box, {
|
113
|
+
mb: 2
|
114
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
115
|
+
onClick: () => setCount(count + 1)
|
116
|
+
}, args, {
|
117
|
+
variant: "outline"
|
118
|
+
}), "Watch", /*#__PURE__*/React.createElement(Button.Counter, null, count))));
|
119
|
+
};
|
120
|
+
export const WatchIconButton = ({ ...args
|
121
|
+
}) => {
|
122
|
+
const [watching, setWatching] = useState(false);
|
123
|
+
const icon = watching ? EyeClosedIcon : () => /*#__PURE__*/React.createElement(EyeIcon, null);
|
124
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
125
|
+
onClick: () => setWatching(!watching),
|
126
|
+
trailingIcon: icon
|
127
|
+
}, args), "Watch");
|
128
|
+
};
|
129
|
+
WatchIconButton.displayName = "WatchIconButton";
|
130
|
+
export const caretButton = ({ ...args
|
131
|
+
}) => {
|
132
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
133
|
+
trailingIcon: TriangleDownIcon
|
134
|
+
}, args), "Dropdown");
|
135
|
+
};
|
136
|
+
caretButton.displayName = "caretButton";
|
137
|
+
export const blockButton = ({ ...args
|
138
|
+
}) => {
|
139
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, args, {
|
140
|
+
sx: {
|
141
|
+
width: '100%'
|
142
|
+
}
|
143
|
+
}), "Block");
|
144
|
+
};
|
145
|
+
blockButton.displayName = "blockButton";
|
146
|
+
export const disabledButton = ({ ...args
|
147
|
+
}) => {
|
148
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
|
149
|
+
mb: 2
|
150
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
151
|
+
disabled: true
|
152
|
+
}, args), "Disabled")), /*#__PURE__*/React.createElement(Box, {
|
153
|
+
mb: 2
|
154
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
155
|
+
disabled: true,
|
156
|
+
variant: "danger"
|
157
|
+
}, args), "Disabled")), /*#__PURE__*/React.createElement(Box, {
|
158
|
+
mb: 2
|
159
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
160
|
+
disabled: true,
|
161
|
+
variant: "invisible"
|
162
|
+
}, args), "Disabled")), /*#__PURE__*/React.createElement(Box, {
|
163
|
+
mb: 2
|
164
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
165
|
+
disabled: true,
|
166
|
+
variant: "primary"
|
167
|
+
}, args), "Disabled")), /*#__PURE__*/React.createElement(Box, {
|
168
|
+
mb: 2
|
169
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
170
|
+
disabled: true,
|
171
|
+
variant: "outline"
|
172
|
+
}, args), "Disabled")), /*#__PURE__*/React.createElement(Box, {
|
173
|
+
mb: 2
|
174
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({
|
175
|
+
disabled: true,
|
176
|
+
icon: () => /*#__PURE__*/React.createElement(XIcon, null)
|
177
|
+
}, args))));
|
178
|
+
};
|
package/package-lock.json
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"version": "31.1.0",
|
10
10
|
"license": "MIT",
|
11
11
|
"dependencies": {
|
12
|
-
"@primer/octicons-react": "^
|
12
|
+
"@primer/octicons-react": "^16.1.0",
|
13
13
|
"@primer/primitives": "6.1.0",
|
14
14
|
"@radix-ui/react-polymorphic": "0.0.14",
|
15
15
|
"@react-aria/ssr": "3.1.0",
|
@@ -7550,9 +7550,9 @@
|
|
7550
7550
|
}
|
7551
7551
|
},
|
7552
7552
|
"node_modules/@primer/octicons-react": {
|
7553
|
-
"version": "
|
7554
|
-
"resolved": "https://registry.npmjs.org/@primer/octicons-react/-/octicons-react-
|
7555
|
-
"integrity": "sha512-
|
7553
|
+
"version": "16.1.1",
|
7554
|
+
"resolved": "https://registry.npmjs.org/@primer/octicons-react/-/octicons-react-16.1.1.tgz",
|
7555
|
+
"integrity": "sha512-xCxQ5z23ol7yDuJs85Lc4ARzyoay+b3zOhAKkEMU7chk0xi2hT2OnRP23QUudNNDPTGozX268RGYLexUa6P4xw==",
|
7556
7556
|
"engines": {
|
7557
7557
|
"node": ">=8"
|
7558
7558
|
},
|
@@ -43345,9 +43345,9 @@
|
|
43345
43345
|
"dev": true
|
43346
43346
|
},
|
43347
43347
|
"@primer/octicons-react": {
|
43348
|
-
"version": "
|
43349
|
-
"resolved": "https://registry.npmjs.org/@primer/octicons-react/-/octicons-react-
|
43350
|
-
"integrity": "sha512-
|
43348
|
+
"version": "16.1.1",
|
43349
|
+
"resolved": "https://registry.npmjs.org/@primer/octicons-react/-/octicons-react-16.1.1.tgz",
|
43350
|
+
"integrity": "sha512-xCxQ5z23ol7yDuJs85Lc4ARzyoay+b3zOhAKkEMU7chk0xi2hT2OnRP23QUudNNDPTGozX268RGYLexUa6P4xw==",
|
43351
43351
|
"requires": {}
|
43352
43352
|
},
|
43353
43353
|
"@primer/primitives": {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@primer/components",
|
3
|
-
"version": "31.2.0-rc.
|
3
|
+
"version": "31.2.0-rc.76ed571d",
|
4
4
|
"description": "Primer react components",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "lib-esm/index.js",
|
@@ -20,7 +20,8 @@
|
|
20
20
|
"test": "jest",
|
21
21
|
"test:update": "npm run test -- --updateSnapshot",
|
22
22
|
"release": "npm run build && changeset publish",
|
23
|
-
"size": "size-limit"
|
23
|
+
"size": "size-limit",
|
24
|
+
"typecheck": "npx tsc --project tsconfig.json"
|
24
25
|
},
|
25
26
|
"repository": "primer/react",
|
26
27
|
"keywords": [
|
@@ -43,7 +44,7 @@
|
|
43
44
|
"author": "GitHub, Inc.",
|
44
45
|
"license": "MIT",
|
45
46
|
"dependencies": {
|
46
|
-
"@primer/octicons-react": "^
|
47
|
+
"@primer/octicons-react": "^16.1.0",
|
47
48
|
"@primer/primitives": "6.1.0",
|
48
49
|
"@radix-ui/react-polymorphic": "0.0.14",
|
49
50
|
"@react-aria/ssr": "3.1.0",
|
package/script/build
CHANGED
@@ -14,7 +14,7 @@ npx cross-env NODE_ENV=production rollup -c
|
|
14
14
|
npx cross-env BABEL_MODULE=commonjs babel src --out-dir lib --extensions ".js,.ts,.jsx,.tsx"
|
15
15
|
npx babel src --out-dir lib-esm --extensions ".js,.ts,.jsx,.tsx"
|
16
16
|
|
17
|
-
#
|
17
|
+
# Build type declarations
|
18
18
|
npx tsc --project tsconfig.build.json
|
19
19
|
|
20
20
|
# Copy type declarations
|
package/src/Dialog/Dialog.tsx
CHANGED
@@ -372,6 +372,7 @@ const Buttons: React.FC<{buttons: DialogButtonProps[]}> = ({buttons}) => {
|
|
372
372
|
<ButtonElement
|
373
373
|
key={index}
|
374
374
|
{...buttonProps}
|
375
|
+
variant={buttonType}
|
375
376
|
ref={autoFocus && autoFocusCount === 0 ? (autoFocusCount++, autoFocusRef) : null}
|
376
377
|
>
|
377
378
|
{content}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import {SxProp} from '../sx'
|
3
|
+
import CounterLabel from '../CounterLabel'
|
4
|
+
|
5
|
+
export type CounterProps = {
|
6
|
+
children: number
|
7
|
+
} & SxProp
|
8
|
+
|
9
|
+
export const Counter = ({children, sx: sxProp = {}, ...props}: CounterProps) => {
|
10
|
+
return (
|
11
|
+
<CounterLabel data-component="ButtonCounter" sx={{ml: 2, ...sxProp}} {...props}>
|
12
|
+
{children}
|
13
|
+
</CounterLabel>
|
14
|
+
)
|
15
|
+
}
|