@strapi/design-system 1.6.2 → 1.6.4
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/dist/Accordion/Accordion.cjs +5 -5
- package/dist/Accordion/Accordion.js +45 -44
- package/dist/Accordion/AccordionContent.cjs +1 -1
- package/dist/Accordion/AccordionContent.js +4 -4
- package/dist/Accordion/AccordionGroup.cjs +4 -4
- package/dist/Accordion/AccordionGroup.js +18 -18
- package/dist/Accordion/AccordionToggle.cjs +2 -2
- package/dist/Accordion/AccordionToggle.js +11 -11
- package/dist/Alert/Alert.cjs +1 -1
- package/dist/Alert/Alert.js +8 -8
- package/dist/Avatar/Avatar.cjs +5 -5
- package/dist/Avatar/Avatar.js +11 -11
- package/dist/Avatar/AvatarGroup.cjs +2 -2
- package/dist/Avatar/AvatarGroup.js +4 -4
- package/dist/BaseButton/BaseButton.cjs +5 -11
- package/dist/BaseButton/BaseButton.js +31 -38
- package/dist/BaseCheckbox/BaseCheckbox.cjs +3 -3
- package/dist/BaseCheckbox/BaseCheckbox.js +22 -22
- package/dist/BaseRadio/BaseRadio.cjs +2 -2
- package/dist/BaseRadio/BaseRadio.js +4 -4
- package/dist/BaseRadio/RadioGroup.cjs +1 -1
- package/dist/BaseRadio/RadioGroup.js +28 -26
- package/dist/Box/Box.cjs +2 -2
- package/dist/Box/Box.js +36 -33
- package/dist/Breadcrumbs/Breadcrumbs.cjs +4 -4
- package/dist/Breadcrumbs/Breadcrumbs.js +12 -12
- package/dist/Button/Button.cjs +10 -27
- package/dist/Button/Button.js +65 -85
- package/dist/Button/utils.cjs +22 -22
- package/dist/Button/utils.js +2 -2
- package/dist/Card/Card.cjs +1 -1
- package/dist/Card/Card.js +15 -14
- package/dist/Card/CardAsset.js +4 -4
- package/dist/Card/CardBody.cjs +1 -1
- package/dist/Card/CardBody.js +4 -4
- package/dist/Card/CardCheckbox.cjs +1 -1
- package/dist/Card/CardCheckbox.js +6 -6
- package/dist/Card/CardTitle.cjs +1 -1
- package/dist/Card/CardTitle.js +1 -1
- package/dist/CarouselInput/Carousel.cjs +2 -2
- package/dist/CarouselInput/Carousel.js +19 -64
- package/dist/CarouselInput/CarouselActions.js +1 -9
- package/dist/CarouselInput/CarouselImage.js +1 -10
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +19 -24
- package/dist/CarouselInput/CarouselSlide.js +13 -9
- package/dist/Checkbox/Checkbox.cjs +2 -2
- package/dist/Checkbox/Checkbox.js +7 -26
- package/dist/Combobox/Combobox.cjs +1 -1
- package/dist/Combobox/Combobox.js +106 -120
- package/dist/Combobox/ComboboxOption.cjs +1 -1
- package/dist/Combobox/ComboboxOption.js +18 -17
- package/dist/DatePicker/DatePicker.cjs +1 -1
- package/dist/DatePicker/DatePicker.js +47 -46
- package/dist/DatePicker/DatePickerCalendar.cjs +1 -1
- package/dist/DatePicker/DatePickerCalendar.js +28 -61
- package/dist/DatePicker/DatePickerTd.js +1 -12
- package/dist/DatePicker/DatePickerTh.cjs +3 -3
- package/dist/DatePicker/DatePickerTh.js +7 -16
- package/dist/DatePicker/components.cjs +3 -3
- package/dist/DatePicker/components.js +6 -6
- package/dist/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/DateTimePicker/DateTimePicker.js +64 -61
- package/dist/DateTimePicker/DateTimePickerProps.js +1 -3
- package/dist/Dialog/Dialog.cjs +4 -4
- package/dist/Dialog/Dialog.js +26 -37
- package/dist/Dialog/DialogBody.cjs +1 -1
- package/dist/Dialog/DialogBody.js +2 -11
- package/dist/Dialog/DialogFooter.cjs +1 -1
- package/dist/Dialog/DialogFooter.js +2 -7
- package/dist/DismissibleLayer/DismissibleLayer.js +1 -4
- package/dist/Divider/Divider.js +1 -5
- package/dist/EmptyStateLayout/EmptyStateLayout.cjs +1 -1
- package/dist/EmptyStateLayout/EmptyStateLayout.js +2 -16
- package/dist/EmptyStateLayout/story-assets/Illo.js +60 -45
- package/dist/Field/Field.cjs +1 -1
- package/dist/Field/Field.js +12 -13
- package/dist/Field/FieldAction.cjs +1 -1
- package/dist/Field/FieldAction.js +2 -6
- package/dist/Field/FieldError.js +1 -7
- package/dist/Field/FieldHint.js +1 -6
- package/dist/Field/FieldInput.cjs +4 -4
- package/dist/Field/FieldInput.js +26 -34
- package/dist/Field/FieldLabel.cjs +1 -1
- package/dist/Field/FieldLabel.js +3 -16
- package/dist/FocusTrap/FocusTrap.js +1 -5
- package/dist/Grid/Grid.cjs +3 -3
- package/dist/Grid/Grid.js +12 -15
- package/dist/Grid/GridItem.cjs +2 -2
- package/dist/Grid/GridItem.js +5 -13
- package/dist/IconButton/IconButton.cjs +7 -12
- package/dist/IconButton/IconButton.js +88 -84
- package/dist/JSONInput/JSONInput.cjs +1 -1
- package/dist/JSONInput/JSONInput.js +85 -78
- package/dist/JSONInput/JSONInputContainer.cjs +10 -10
- package/dist/JSONInput/JSONInputContainer.js +22 -15
- package/dist/Layout/ActionLayout.js +1 -13
- package/dist/Layout/ContentLayout.js +1 -4
- package/dist/Layout/HeaderLayout.cjs +1 -1
- package/dist/Layout/HeaderLayout.js +35 -64
- package/dist/Layout/Layout.js +1 -5
- package/dist/Layout/TwoColsLayout.js +1 -17
- package/dist/Link/Link.cjs +5 -5
- package/dist/Link/Link.js +55 -57
- package/dist/LinkButton/LinkButton.cjs +7 -24
- package/dist/LinkButton/LinkButton.js +60 -87
- package/dist/LiveRegions/LiveRegions.cjs +1 -1
- package/dist/LiveRegions/LiveRegions.js +1 -1
- package/dist/Loader/Loader.cjs +4 -4
- package/dist/Loader/Loader.js +26 -24
- package/dist/Main/Main.js +1 -6
- package/dist/Main/SkipToContent.cjs +2 -2
- package/dist/Main/SkipToContent.js +17 -13
- package/dist/MainNav/MainNav.cjs +2 -2
- package/dist/MainNav/MainNav.js +21 -20
- package/dist/MainNav/NavBrand.cjs +2 -2
- package/dist/MainNav/NavBrand.js +4 -38
- package/dist/MainNav/NavCondense.cjs +2 -2
- package/dist/MainNav/NavCondense.js +10 -18
- package/dist/MainNav/NavFooter.js +1 -3
- package/dist/MainNav/NavLink.cjs +4 -4
- package/dist/MainNav/NavLink.js +8 -34
- package/dist/MainNav/NavSection.cjs +1 -1
- package/dist/MainNav/NavSection.js +5 -38
- package/dist/MainNav/NavSections.cjs +2 -2
- package/dist/MainNav/NavSections.js +4 -15
- package/dist/MainNav/NavUser.cjs +2 -2
- package/dist/MainNav/NavUser.js +6 -27
- package/dist/ModalLayout/ModalBody.js +1 -4
- package/dist/ModalLayout/ModalFooter.cjs +1 -1
- package/dist/ModalLayout/ModalFooter.js +2 -10
- package/dist/ModalLayout/ModalHeader.cjs +2 -2
- package/dist/ModalLayout/ModalHeader.js +8 -20
- package/dist/ModalLayout/ModalLayout.cjs +3 -3
- package/dist/ModalLayout/ModalLayout.js +23 -31
- package/dist/NumberInput/NumberInput.cjs +2 -2
- package/dist/NumberInput/NumberInput.js +54 -59
- package/dist/Pagination/Pagination.cjs +2 -2
- package/dist/Pagination/Pagination.js +11 -16
- package/dist/Pagination/components.cjs +3 -3
- package/dist/Pagination/components.js +31 -38
- package/dist/Popover/Popover.cjs +3 -3
- package/dist/Popover/Popover.js +111 -102
- package/dist/Popover/index.cjs +1 -1
- package/dist/Popover/index.js +9 -3
- package/dist/Portal/Portal.cjs +1 -1
- package/dist/Portal/Portal.js +10 -12
- package/dist/ProgressBar/ProgressBar.js +17 -14
- package/dist/Radio/Radio.cjs +2 -2
- package/dist/Radio/Radio.js +4 -11
- package/dist/RawTable/RawCell.cjs +1 -1
- package/dist/RawTable/RawCell.js +5 -14
- package/dist/RawTable/RawTable.cjs +1 -1
- package/dist/RawTable/RawTable.js +36 -35
- package/dist/RawTable/RawTbody.js +1 -3
- package/dist/RawTable/RawThead.js +1 -3
- package/dist/RawTable/RawTr.js +1 -4
- package/dist/Searchbar/SearchForm.js +1 -4
- package/dist/Searchbar/Searchbar.cjs +3 -3
- package/dist/Searchbar/Searchbar.js +21 -25
- package/dist/Select/MultiSelectNested.js +2 -14
- package/dist/Select/OptGroup.cjs +1 -1
- package/dist/Select/OptGroup.js +14 -10
- package/dist/Select/Option.cjs +3 -3
- package/dist/Select/Option.js +31 -33
- package/dist/Select/Select.cjs +2 -2
- package/dist/Select/Select.js +87 -107
- package/dist/Select/SelectButton.cjs +1 -1
- package/dist/Select/SelectButton.js +14 -11
- package/dist/Select/SelectList.cjs +1 -1
- package/dist/Select/SelectList.js +20 -16
- package/dist/Select/SelectTags.cjs +3 -3
- package/dist/Select/SelectTags.js +17 -15
- package/dist/Select/SingleSelect.cjs +1 -1
- package/dist/Select/SingleSelect.js +1 -1
- package/dist/SimpleMenu/SimpleMenu.cjs +3 -3
- package/dist/SimpleMenu/SimpleMenu.js +43 -67
- package/dist/Status/Status.js +15 -13
- package/dist/SubNav/SubNav.cjs +2 -2
- package/dist/SubNav/SubNav.js +5 -9
- package/dist/SubNav/SubNavHeader.cjs +2 -2
- package/dist/SubNav/SubNavHeader.js +31 -53
- package/dist/SubNav/SubNavLink.cjs +3 -3
- package/dist/SubNav/SubNavLink.js +18 -22
- package/dist/SubNav/SubNavLinkSection.cjs +2 -2
- package/dist/SubNav/SubNavLinkSection.js +5 -30
- package/dist/SubNav/SubNavSection.cjs +2 -2
- package/dist/SubNav/SubNavSection.js +23 -30
- package/dist/SubNav/SubNavSectionLabel.cjs +2 -2
- package/dist/SubNav/SubNavSectionLabel.js +15 -24
- package/dist/SubNav/SubNavSections.cjs +1 -1
- package/dist/SubNav/SubNavSections.js +3 -12
- package/dist/Switch/Switch.cjs +2 -2
- package/dist/Switch/Switch.js +16 -17
- package/dist/Table/Cell.cjs +1 -1
- package/dist/Table/Cell.js +3 -8
- package/dist/Table/TFooter.cjs +2 -2
- package/dist/Table/TFooter.js +3 -17
- package/dist/Table/Table.cjs +1 -1
- package/dist/Table/Table.js +2 -18
- package/dist/Table/Tbody.js +1 -3
- package/dist/Table/Thead.js +1 -3
- package/dist/Table/Tr.js +1 -3
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +30 -27
- package/dist/Tabs/TabPanels.js +2 -10
- package/dist/Tabs/Tabs.cjs +1 -1
- package/dist/Tabs/Tabs.js +43 -51
- package/dist/Tag/Tag.cjs +1 -1
- package/dist/Tag/Tag.js +20 -23
- package/dist/TextButton/TextButton.cjs +6 -6
- package/dist/TextButton/TextButton.js +15 -15
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +14 -32
- package/dist/Textarea/Textarea.cjs +2 -2
- package/dist/Textarea/Textarea.js +10 -25
- package/dist/Textarea/TextareaInput.cjs +1 -1
- package/dist/Textarea/TextareaInput.js +15 -15
- package/dist/TimePicker/TimePicker.cjs +2 -2
- package/dist/TimePicker/TimePicker.js +27 -26
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +5 -5
- package/dist/ToggleCheckbox/ToggleCheckbox.js +85 -60
- package/dist/ToggleInput/ToggleInput.cjs +3 -3
- package/dist/ToggleInput/ToggleInput.js +14 -32
- package/dist/Tooltip/Tooltip.cjs +2 -2
- package/dist/Tooltip/Tooltip.js +62 -53
- package/dist/Tooltip/hooks/useTooltipHandlers.cjs +1 -1
- package/dist/Tooltip/hooks/useTooltipHandlers.js +7 -7
- package/dist/Tooltip/hooks/useTooltipLayout.cjs +1 -1
- package/dist/Tooltip/hooks/useTooltipLayout.js +8 -5
- package/dist/Typography/Typography.cjs +3 -2
- package/dist/Typography/Typography.js +17 -14
- package/dist/helpers/objects.cjs +1 -1
- package/dist/helpers/objects.js +1 -1
- package/dist/hooks/useId.cjs +1 -0
- package/dist/hooks/useId.js +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +136 -134
- package/dist/themes/extendTheme.cjs +1 -1
- package/dist/themes/extendTheme.js +4 -4
- package/dist/v2/Breadcrumbs/Breadcrumbs.cjs +2 -2
- package/dist/v2/Breadcrumbs/Breadcrumbs.js +4 -13
- package/dist/v2/Breadcrumbs/Crumb.js +11 -12
- package/dist/v2/Breadcrumbs/CrumbLink.js +1 -3
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.cjs +2 -2
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.js +5 -11
- package/dist/v2/Breadcrumbs/Divider.js +1 -8
- package/dist/v2/Link/Link.cjs +2 -2
- package/dist/v2/Link/Link.js +5 -24
- package/dist/v2/LinkButton/LinkButton.cjs +11 -24
- package/dist/v2/LinkButton/LinkButton.js +62 -84
- package/dist/v2/MainNav/MainNav.cjs +2 -2
- package/dist/v2/MainNav/MainNav.js +21 -20
- package/dist/v2/MainNav/NavBrand.cjs +2 -2
- package/dist/v2/MainNav/NavBrand.js +4 -38
- package/dist/v2/MainNav/NavCondense.cjs +2 -2
- package/dist/v2/MainNav/NavCondense.js +10 -18
- package/dist/v2/MainNav/NavFooter.js +1 -3
- package/dist/v2/MainNav/NavLink.cjs +4 -4
- package/dist/v2/MainNav/NavLink.js +10 -39
- package/dist/v2/MainNav/NavSection.cjs +1 -1
- package/dist/v2/MainNav/NavSection.js +5 -38
- package/dist/v2/MainNav/NavSections.cjs +2 -2
- package/dist/v2/MainNav/NavSections.js +4 -15
- package/dist/v2/MainNav/NavUser.cjs +2 -2
- package/dist/v2/MainNav/NavUser.js +6 -27
- package/dist/v2/Pagination/Pagination.cjs +2 -2
- package/dist/v2/Pagination/Pagination.js +11 -16
- package/dist/v2/Pagination/components.cjs +2 -2
- package/dist/v2/Pagination/components.js +11 -39
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +4 -4
- package/dist/v2/SimpleMenu/SimpleMenu.js +42 -65
- package/dist/v2/SubNav/SubNav.cjs +2 -2
- package/dist/v2/SubNav/SubNav.js +5 -9
- package/dist/v2/SubNav/SubNavHeader.cjs +2 -2
- package/dist/v2/SubNav/SubNavHeader.js +31 -53
- package/dist/v2/SubNav/SubNavLink.cjs +2 -2
- package/dist/v2/SubNav/SubNavLink.js +18 -22
- package/dist/v2/SubNav/SubNavLinkSection.cjs +2 -2
- package/dist/v2/SubNav/SubNavLinkSection.js +5 -30
- package/dist/v2/SubNav/SubNavSection.cjs +2 -2
- package/dist/v2/SubNav/SubNavSection.js +26 -33
- package/dist/v2/SubNav/SubNavSectionLabel.cjs +2 -2
- package/dist/v2/SubNav/SubNavSectionLabel.js +15 -24
- package/dist/v2/SubNav/SubNavSections.cjs +1 -1
- package/dist/v2/SubNav/SubNavSections.js +3 -12
- package/package.json +7 -4
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import a from "styled-components";
|
|
1
|
+
import * as e from "react";
|
|
3
2
|
import r from "prop-types";
|
|
4
|
-
import
|
|
3
|
+
import i from "styled-components";
|
|
5
4
|
import { PaginationContext as c } from "./PaginationContext.js";
|
|
6
|
-
|
|
5
|
+
import { Flex as u } from "../Flex/Flex.js";
|
|
6
|
+
const d = i.nav``, f = i(u)`
|
|
7
7
|
& > * + * {
|
|
8
8
|
margin-left: ${({ theme: t }) => t.spaces[1]};
|
|
9
9
|
}
|
|
10
|
-
`,
|
|
11
|
-
|
|
12
|
-
}, /* @__PURE__ */ e.createElement(d, {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
as: "ul"
|
|
16
|
-
}, s.map(t, (m, p) => /* @__PURE__ */ e.createElement("li", {
|
|
17
|
-
key: p
|
|
18
|
-
}, m)))));
|
|
19
|
-
i.defaultProps = {
|
|
10
|
+
`, o = ({ children: t, label: l, activePage: n, pageCount: a }) => {
|
|
11
|
+
const m = e.useMemo(() => ({ activePage: n, pageCount: a }), [n, a]);
|
|
12
|
+
return /* @__PURE__ */ e.createElement(c.Provider, { value: m }, /* @__PURE__ */ e.createElement(d, { "aria-label": l }, /* @__PURE__ */ e.createElement(f, { as: "ul" }, e.Children.map(t, (s, p) => /* @__PURE__ */ e.createElement("li", { key: p }, s)))));
|
|
13
|
+
};
|
|
14
|
+
o.defaultProps = {
|
|
20
15
|
label: "pagination"
|
|
21
16
|
};
|
|
22
|
-
|
|
17
|
+
o.propTypes = {
|
|
23
18
|
activePage: r.number.isRequired,
|
|
24
19
|
children: r.node.isRequired,
|
|
25
20
|
label: r.string,
|
|
26
21
|
pageCount: r.number.isRequired
|
|
27
22
|
};
|
|
28
23
|
export {
|
|
29
|
-
|
|
24
|
+
o as Pagination
|
|
30
25
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("react"),g=require("@strapi/icons"),k=require("prop-types"),q=require("react-router-dom"),T=require("styled-components"),u=require("./PaginationContext.cjs"),x=require("../themes/utils.cjs"),E=require("../Typography/Typography.cjs"),l=require("../VisuallyHidden/VisuallyHidden.cjs"),c=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},a=c(L),o=c(k),s=c(T),v=s.default(E.Typography)`
|
|
2
2
|
line-height: revert;
|
|
3
|
-
`,$={active:!0},p=s.default(
|
|
3
|
+
`,$={active:!0},p=s.default(q.NavLink).withConfig({shouldForwardProp:(e,t)=>!$[e]&&t(e)})`
|
|
4
4
|
padding: ${({theme:e})=>e.spaces[3]};
|
|
5
5
|
border-radius: ${({theme:e})=>e.borderRadius};
|
|
6
6
|
box-shadow: ${({active:e,theme:t})=>e?t.shadows.filterShadow:void 0};
|
|
7
7
|
text-decoration: none;
|
|
8
8
|
display: flex;
|
|
9
9
|
|
|
10
|
-
${
|
|
10
|
+
${x.buttonFocusStyle}
|
|
11
11
|
`,R=s.default(p)`
|
|
12
12
|
color: ${({theme:e,active:t})=>t?e.colors.primary700:e.colors.neutral800};
|
|
13
13
|
background: ${({theme:e,active:t})=>t?e.colors.neutral0:void 0};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import t from "react";
|
|
2
|
-
import s from "styled-components";
|
|
3
|
-
import n from "prop-types";
|
|
4
2
|
import { ChevronLeft as b, ChevronRight as y } from "@strapi/icons";
|
|
3
|
+
import n from "prop-types";
|
|
5
4
|
import { NavLink as P } from "react-router-dom";
|
|
6
|
-
import
|
|
5
|
+
import s from "styled-components";
|
|
7
6
|
import { usePagination as c } from "./PaginationContext.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
7
|
+
import { buttonFocusStyle as E } from "../themes/utils.js";
|
|
8
|
+
import { Typography as k } from "../Typography/Typography.js";
|
|
9
|
+
import { VisuallyHidden as l } from "../VisuallyHidden/VisuallyHidden.js";
|
|
10
|
+
const u = s(k)`
|
|
11
11
|
line-height: revert;
|
|
12
12
|
`, L = {
|
|
13
13
|
active: !0
|
|
@@ -20,7 +20,7 @@ const u = s(E)`
|
|
|
20
20
|
text-decoration: none;
|
|
21
21
|
display: flex;
|
|
22
22
|
|
|
23
|
-
${
|
|
23
|
+
${E}
|
|
24
24
|
`, $ = s(p)`
|
|
25
25
|
color: ${({ theme: e, active: r }) => r ? e.colors.primary700 : e.colors.neutral800};
|
|
26
26
|
background: ${({ theme: e, active: r }) => r ? e.colors.neutral0 : void 0};
|
|
@@ -48,47 +48,40 @@ const u = s(E)`
|
|
|
48
48
|
color: ${({ theme: e }) => e.colors.neutral800};
|
|
49
49
|
`, h = ({ children: e, to: r, ...a }) => {
|
|
50
50
|
const { activePage: i } = c(), o = i === 1;
|
|
51
|
-
return /* @__PURE__ */ t.createElement(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
return /* @__PURE__ */ t.createElement(
|
|
52
|
+
m,
|
|
53
|
+
{
|
|
54
|
+
to: o ? "#" : r,
|
|
55
|
+
"aria-disabled": o,
|
|
56
|
+
tabIndex: o ? -1 : void 0,
|
|
57
|
+
...a
|
|
58
|
+
},
|
|
59
|
+
/* @__PURE__ */ t.createElement(l, null, e),
|
|
60
|
+
/* @__PURE__ */ t.createElement(b, { "aria-hidden": !0 })
|
|
61
|
+
);
|
|
59
62
|
};
|
|
60
63
|
h.displayName = "PreviousLink";
|
|
61
64
|
const v = ({ children: e, to: r, ...a }) => {
|
|
62
65
|
const { activePage: i, pageCount: o } = c(), d = i === o;
|
|
63
|
-
return /* @__PURE__ */ t.createElement(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
return /* @__PURE__ */ t.createElement(
|
|
67
|
+
m,
|
|
68
|
+
{
|
|
69
|
+
to: d ? "#" : r,
|
|
70
|
+
"aria-disabled": d,
|
|
71
|
+
tabIndex: d ? -1 : void 0,
|
|
72
|
+
...a
|
|
73
|
+
},
|
|
74
|
+
/* @__PURE__ */ t.createElement(l, null, e),
|
|
75
|
+
/* @__PURE__ */ t.createElement(y, { "aria-hidden": !0 })
|
|
76
|
+
);
|
|
71
77
|
};
|
|
72
78
|
v.displayName = "NextLink";
|
|
73
79
|
const f = ({ number: e, children: r, ...a }) => {
|
|
74
80
|
const { activePage: i } = c(), o = i === e;
|
|
75
|
-
return /* @__PURE__ */ t.createElement($, {
|
|
76
|
-
...a,
|
|
77
|
-
active: o
|
|
78
|
-
}, /* @__PURE__ */ t.createElement(l, null, r), /* @__PURE__ */ t.createElement(u, {
|
|
79
|
-
"aria-hidden": !0,
|
|
80
|
-
variant: "pi",
|
|
81
|
-
fontWeight: o ? "bold" : null
|
|
82
|
-
}, e));
|
|
81
|
+
return /* @__PURE__ */ t.createElement($, { ...a, active: o }, /* @__PURE__ */ t.createElement(l, null, r), /* @__PURE__ */ t.createElement(u, { "aria-hidden": !0, variant: "pi", fontWeight: o ? "bold" : null }, e));
|
|
83
82
|
};
|
|
84
83
|
f.displayName = "PageLink";
|
|
85
|
-
const w = ({ children: e, ...r }) => /* @__PURE__ */ t.createElement(x, {
|
|
86
|
-
...r,
|
|
87
|
-
as: "div"
|
|
88
|
-
}, /* @__PURE__ */ t.createElement(l, null, e), /* @__PURE__ */ t.createElement(u, {
|
|
89
|
-
"aria-hidden": !0,
|
|
90
|
-
variant: "pi"
|
|
91
|
-
}, "\u2026"));
|
|
84
|
+
const w = ({ children: e, ...r }) => /* @__PURE__ */ t.createElement(x, { ...r, as: "div" }, /* @__PURE__ */ t.createElement(l, null, e), /* @__PURE__ */ t.createElement(u, { "aria-hidden": !0, variant: "pi" }, "\u2026"));
|
|
92
85
|
f.propTypes = {
|
|
93
86
|
children: n.node.isRequired,
|
|
94
87
|
number: n.number.isRequired
|
package/dist/Popover/Popover.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),w=require("react"),a=require("@floating-ui/react-dom"),y=require("styled-components"),u=require("../Box/Box.cjs"),_=require("../helpers/useIntersection.cjs"),k=require("../Portal/Portal.cjs"),v=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function S(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const l=S(w),f=v(y),O=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],$=f.default(u.Box)`
|
|
2
2
|
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
3
3
|
z-index: 4;
|
|
4
4
|
border: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
5
5
|
background: ${({theme:e})=>e.colors.neutral0};
|
|
6
|
-
`,
|
|
6
|
+
`,p=({source:e,children:t,spacing:o=0,fullWidth:r=!1,placement:s="bottom-start",centered:i=!1,...c})=>{const[h,g]=l.useState(void 0),{x:m,y:x,reference:d,floating:j,strategy:P}=a.useFloating({strategy:"fixed",placement:i?"bottom":s,middleware:[a.offset({mainAxis:o}),a.shift(),a.flip()],whileElementsMounted:a.autoUpdate});return l.useLayoutEffect(()=>{d(e.current)},[e,d]),l.useLayoutEffect(()=>{r&&g(e.current.offsetWidth)},[r,e]),n.jsx($,{ref:j,style:{left:m,top:x,position:P,width:h||void 0},hasRadius:!0,background:"neutral0",padding:1,...c,children:t})},b=({children:e,intersectionId:t,onReachEnd:o,...r})=>{const s=l.useRef(null);return _.useIntersection(s,o??(()=>{}),{selectorToWatch:`#${t}`,skipWhen:!t||!o}),n.jsxs(q,{ref:s,...r,children:[e,t&&o&&n.jsx(u.Box,{id:t,width:"100%",height:"1px"})]})},q=f.default(u.Box)`
|
|
7
7
|
// 16 is base base size, 3 is the factor to get closer to 40px and 5 is the number of elements visible in the list
|
|
8
8
|
max-height: ${3*5}rem;
|
|
9
9
|
overflow-y: auto;
|
|
@@ -23,4 +23,4 @@
|
|
|
23
23
|
border-radius: ${({theme:e})=>e.borderRadius};
|
|
24
24
|
margin-right: 10px;
|
|
25
25
|
}
|
|
26
|
-
`,
|
|
26
|
+
`,E=({children:e,source:t,spacing:o,fullWidth:r,placement:s,centered:i,...c})=>n.jsx(k.Portal,{children:n.jsx(p,{source:t,spacing:o,fullWidth:r,placement:s,centered:i,children:n.jsx(b,{...c,children:e})})});exports.Content=p;exports.POPOVER_PLACEMENTS=O;exports.Popover=E;exports.Scrolling=b;
|
package/dist/Popover/Popover.js
CHANGED
|
@@ -1,29 +1,83 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Box as
|
|
1
|
+
import { jsx as i, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { useFloating as w, offset as k, shift as y, flip as $, autoUpdate as v } from "@floating-ui/react-dom";
|
|
4
|
+
import c from "styled-components";
|
|
5
|
+
import { Box as d } from "../Box/Box.js";
|
|
6
|
+
import { useIntersection as P } from "../helpers/useIntersection.js";
|
|
6
7
|
import { Portal as S } from "../Portal/Portal.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"top-end",
|
|
12
|
-
"right",
|
|
13
|
-
"right-start",
|
|
14
|
-
"right-end",
|
|
15
|
-
"bottom",
|
|
16
|
-
"bottom-start",
|
|
17
|
-
"bottom-end",
|
|
18
|
-
"left",
|
|
19
|
-
"left-start",
|
|
20
|
-
"left-end"
|
|
21
|
-
], z = d(s)`
|
|
22
|
-
box-shadow: ${({ theme: e }) => e.shadows.filterShadow};
|
|
8
|
+
const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end"], W = c(d)`
|
|
9
|
+
box-shadow: ${({
|
|
10
|
+
theme: t
|
|
11
|
+
}) => t.shadows.filterShadow};
|
|
23
12
|
z-index: 4;
|
|
24
|
-
border: 1px solid ${({
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
border: 1px solid ${({
|
|
14
|
+
theme: t
|
|
15
|
+
}) => t.colors.neutral150};
|
|
16
|
+
background: ${({
|
|
17
|
+
theme: t
|
|
18
|
+
}) => t.colors.neutral0};
|
|
19
|
+
`, E = ({
|
|
20
|
+
source: t,
|
|
21
|
+
children: e,
|
|
22
|
+
spacing: o = 0,
|
|
23
|
+
fullWidth: r = !1,
|
|
24
|
+
placement: s = "bottom-start",
|
|
25
|
+
centered: n = !1,
|
|
26
|
+
...l
|
|
27
|
+
}) => {
|
|
28
|
+
const [p, u] = a.useState(void 0), {
|
|
29
|
+
x: h,
|
|
30
|
+
y: m,
|
|
31
|
+
reference: f,
|
|
32
|
+
floating: b,
|
|
33
|
+
strategy: g
|
|
34
|
+
} = w({
|
|
35
|
+
strategy: "fixed",
|
|
36
|
+
placement: n ? "bottom" : s,
|
|
37
|
+
middleware: [k({
|
|
38
|
+
mainAxis: o
|
|
39
|
+
}), y(), $()],
|
|
40
|
+
whileElementsMounted: v
|
|
41
|
+
});
|
|
42
|
+
return a.useLayoutEffect(() => {
|
|
43
|
+
f(t.current);
|
|
44
|
+
}, [t, f]), a.useLayoutEffect(() => {
|
|
45
|
+
r && u(t.current.offsetWidth);
|
|
46
|
+
}, [r, t]), i(W, {
|
|
47
|
+
ref: b,
|
|
48
|
+
style: {
|
|
49
|
+
left: h,
|
|
50
|
+
top: m,
|
|
51
|
+
position: g,
|
|
52
|
+
width: p || void 0
|
|
53
|
+
},
|
|
54
|
+
hasRadius: !0,
|
|
55
|
+
background: "neutral0",
|
|
56
|
+
padding: 1,
|
|
57
|
+
...l,
|
|
58
|
+
children: e
|
|
59
|
+
});
|
|
60
|
+
}, R = ({
|
|
61
|
+
children: t,
|
|
62
|
+
intersectionId: e,
|
|
63
|
+
onReachEnd: o,
|
|
64
|
+
...r
|
|
65
|
+
}) => {
|
|
66
|
+
const s = a.useRef(null);
|
|
67
|
+
return P(s, o ?? (() => {
|
|
68
|
+
}), {
|
|
69
|
+
selectorToWatch: `#${e}`,
|
|
70
|
+
skipWhen: !e || !o
|
|
71
|
+
}), x(L, {
|
|
72
|
+
ref: s,
|
|
73
|
+
...r,
|
|
74
|
+
children: [t, e && o && i(d, {
|
|
75
|
+
id: e,
|
|
76
|
+
width: "100%",
|
|
77
|
+
height: "1px"
|
|
78
|
+
})]
|
|
79
|
+
});
|
|
80
|
+
}, L = c(d)`
|
|
27
81
|
// 16 is base base size, 3 is the factor to get closer to 40px and 5 is the number of elements visible in the list
|
|
28
82
|
max-height: ${3 * 5}rem;
|
|
29
83
|
overflow-y: auto;
|
|
@@ -35,89 +89,44 @@ const L = [
|
|
|
35
89
|
}
|
|
36
90
|
|
|
37
91
|
&::-webkit-scrollbar-track {
|
|
38
|
-
background: ${({
|
|
92
|
+
background: ${({
|
|
93
|
+
theme: t
|
|
94
|
+
}) => t.colors.neutral0};
|
|
39
95
|
}
|
|
40
96
|
|
|
41
97
|
&::-webkit-scrollbar-thumb {
|
|
42
|
-
background: ${({
|
|
43
|
-
|
|
98
|
+
background: ${({
|
|
99
|
+
theme: t
|
|
100
|
+
}) => t.colors.neutral150};
|
|
101
|
+
border-radius: ${({
|
|
102
|
+
theme: t
|
|
103
|
+
}) => t.borderRadius};
|
|
44
104
|
margin-right: 10px;
|
|
45
105
|
}
|
|
46
|
-
`,
|
|
106
|
+
`, B = ({
|
|
107
|
+
children: t,
|
|
47
108
|
source: e,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
],
|
|
67
|
-
whileElementsMounted: O
|
|
68
|
-
});
|
|
69
|
-
return o.useLayoutEffect(() => {
|
|
70
|
-
p(e.current);
|
|
71
|
-
}, [e, p]), o.useLayoutEffect(() => {
|
|
72
|
-
i && x(e.current.offsetWidth);
|
|
73
|
-
}, [i, e]), q(l, n, {
|
|
74
|
-
selectorToWatch: `#${r}`,
|
|
75
|
-
skipWhen: !r || !n
|
|
76
|
-
}), /* @__PURE__ */ o.createElement(z, {
|
|
77
|
-
ref: P,
|
|
78
|
-
style: {
|
|
79
|
-
left: y,
|
|
80
|
-
top: E,
|
|
81
|
-
position: k,
|
|
82
|
-
width: v || void 0
|
|
83
|
-
},
|
|
84
|
-
hasRadius: !0,
|
|
85
|
-
background: "neutral0",
|
|
86
|
-
padding: 1
|
|
87
|
-
}, /* @__PURE__ */ o.createElement(A, {
|
|
88
|
-
ref: l,
|
|
89
|
-
...w
|
|
90
|
-
}, m, r && n && /* @__PURE__ */ o.createElement(s, {
|
|
91
|
-
id: r,
|
|
92
|
-
width: "100%",
|
|
93
|
-
height: "1px"
|
|
94
|
-
})));
|
|
95
|
-
}, c = (e) => /* @__PURE__ */ o.createElement(S, null, /* @__PURE__ */ o.createElement(a, {
|
|
96
|
-
...e
|
|
97
|
-
})), f = {
|
|
98
|
-
fullWidth: !1,
|
|
99
|
-
intersectionId: void 0,
|
|
100
|
-
onReachEnd: void 0,
|
|
101
|
-
centered: !1,
|
|
102
|
-
placement: "bottom-start",
|
|
103
|
-
spacing: 0
|
|
104
|
-
}, u = {
|
|
105
|
-
centered: t.bool,
|
|
106
|
-
children: t.node.isRequired,
|
|
107
|
-
fullWidth: t.bool,
|
|
108
|
-
intersectionId: t.string,
|
|
109
|
-
onReachEnd: t.func,
|
|
110
|
-
placement: t.oneOf(L),
|
|
111
|
-
source: t.shape({
|
|
112
|
-
current: (typeof Element > "u" ? t.any : t.instanceOf(Element)).isRequired
|
|
113
|
-
}).isRequired,
|
|
114
|
-
spacing: t.number
|
|
115
|
-
};
|
|
116
|
-
a.propTypes = u;
|
|
117
|
-
a.defaultProps = f;
|
|
118
|
-
c.propTypes = u;
|
|
119
|
-
c.defaultProps = f;
|
|
109
|
+
spacing: o,
|
|
110
|
+
fullWidth: r,
|
|
111
|
+
placement: s,
|
|
112
|
+
centered: n,
|
|
113
|
+
...l
|
|
114
|
+
}) => i(S, {
|
|
115
|
+
children: i(E, {
|
|
116
|
+
source: e,
|
|
117
|
+
spacing: o,
|
|
118
|
+
fullWidth: r,
|
|
119
|
+
placement: s,
|
|
120
|
+
centered: n,
|
|
121
|
+
children: i(R, {
|
|
122
|
+
...l,
|
|
123
|
+
children: t
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
});
|
|
120
127
|
export {
|
|
121
|
-
|
|
122
|
-
|
|
128
|
+
E as Content,
|
|
129
|
+
T as POPOVER_PLACEMENTS,
|
|
130
|
+
B as Popover,
|
|
131
|
+
R as Scrolling
|
|
123
132
|
};
|
package/dist/Popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Popover.cjs");exports.POPOVER_PLACEMENTS=e.POPOVER_PLACEMENTS;exports.Popover=e.Popover;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Popover.cjs"),o={Content:e.Content,Scrolling:e.Scrolling};exports.POPOVER_PLACEMENTS=e.POPOVER_PLACEMENTS;exports.Popover=e.Popover;exports.PopoverPrimitives=o;
|
package/dist/Popover/index.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Content as o, Scrolling as r } from "./Popover.js";
|
|
2
|
+
import { POPOVER_PLACEMENTS as p, Popover as m } from "./Popover.js";
|
|
3
|
+
const e = {
|
|
4
|
+
Content: o,
|
|
5
|
+
Scrolling: r
|
|
6
|
+
};
|
|
2
7
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
8
|
+
p as POPOVER_PLACEMENTS,
|
|
9
|
+
m as Popover,
|
|
10
|
+
e as PopoverPrimitives
|
|
5
11
|
};
|
package/dist/Portal/Portal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),c=require("react-dom");function a(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const u=a(o),l=({children:e})=>{const t=u.useRef(null),[r,n]=u.useState(!1);return u.useLayoutEffect(()=>(t.current=document.createElement("div"),t.current.setAttribute("data-react-portal","true"),document.body.appendChild(t.current),n(!0),()=>{t.current?.remove()}),[]),!r||!t.current?null:c.createPortal(e,t.current)};exports.Portal=l;
|
package/dist/Portal/Portal.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createPortal as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
p.propTypes = {
|
|
11
|
-
children: d.node.isRequired
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { createPortal as o } from "react-dom";
|
|
3
|
+
const a = ({
|
|
4
|
+
children: r
|
|
5
|
+
}) => {
|
|
6
|
+
const t = e.useRef(null), [u, n] = e.useState(!1);
|
|
7
|
+
return e.useLayoutEffect(() => (t.current = document.createElement("div"), t.current.setAttribute("data-react-portal", "true"), document.body.appendChild(t.current), n(!0), () => {
|
|
8
|
+
t.current?.remove();
|
|
9
|
+
}), []), !u || !t.current ? null : o(r, t.current);
|
|
12
10
|
};
|
|
13
11
|
export {
|
|
14
|
-
|
|
12
|
+
a as Portal
|
|
15
13
|
};
|
|
@@ -12,20 +12,23 @@ const p = m(l)`
|
|
|
12
12
|
top: 0;
|
|
13
13
|
width: ${({ value: r }) => `${r}%`};
|
|
14
14
|
}
|
|
15
|
-
`, t = ({ min: r, max: i, value: o, children: s, size: a, ...n }) => /* @__PURE__ */ u.createElement(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
`, t = ({ min: r, max: i, value: o, children: s, size: a, ...n }) => /* @__PURE__ */ u.createElement(
|
|
16
|
+
p,
|
|
17
|
+
{
|
|
18
|
+
background: "neutral600",
|
|
19
|
+
hasRadius: !0,
|
|
20
|
+
"aria-label": s,
|
|
21
|
+
"aria-valuemax": i,
|
|
22
|
+
"aria-valuemin": r,
|
|
23
|
+
"aria-valuenow": o,
|
|
24
|
+
height: a === "S" ? 1 : 2,
|
|
25
|
+
position: "relative",
|
|
26
|
+
role: "progressbar",
|
|
27
|
+
value: o,
|
|
28
|
+
width: a === "S" ? "78px" : "102px",
|
|
29
|
+
...n
|
|
30
|
+
}
|
|
31
|
+
);
|
|
29
32
|
t.defaultProps = {
|
|
30
33
|
min: 0,
|
|
31
34
|
max: 100,
|
package/dist/Radio/Radio.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react"),d=require("prop-types"),n=require("styled-components"),u=require("../BaseRadio/BaseRadio.cjs"),c=require("../
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react"),d=require("prop-types"),n=require("styled-components"),u=require("../BaseRadio/BaseRadio.cjs"),c=require("../Box/Box.cjs"),i=require("../Typography/Typography.cjs"),a=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},t=a(l),o=a(d),p=a(n),y=p.default(i.Typography)`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
|
-
`,r=({children:e,...s})=>t.default.createElement(y,{as:"label",textColor:"neutral800"},t.default.createElement(u.BaseRadio,{...s}),t.default.createElement(
|
|
4
|
+
`,r=({children:e,...s})=>t.default.createElement(y,{as:"label",textColor:"neutral800"},t.default.createElement(u.BaseRadio,{...s}),t.default.createElement(c.Box,{paddingLeft:2},e));r.propTypes={children:o.default.node.isRequired,value:o.default.any.isRequired};exports.Radio=r;
|
package/dist/Radio/Radio.js
CHANGED
|
@@ -2,19 +2,12 @@ import e from "react";
|
|
|
2
2
|
import r from "prop-types";
|
|
3
3
|
import a from "styled-components";
|
|
4
4
|
import { BaseRadio as i } from "../BaseRadio/BaseRadio.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
const l = a(
|
|
5
|
+
import { Box as m } from "../Box/Box.js";
|
|
6
|
+
import { Typography as p } from "../Typography/Typography.js";
|
|
7
|
+
const l = a(p)`
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
|
-
`, n = ({ children: t, ...o }) => /* @__PURE__ */ e.createElement(l, {
|
|
11
|
-
as: "label",
|
|
12
|
-
textColor: "neutral800"
|
|
13
|
-
}, /* @__PURE__ */ e.createElement(i, {
|
|
14
|
-
...o
|
|
15
|
-
}), /* @__PURE__ */ e.createElement(p, {
|
|
16
|
-
paddingLeft: 2
|
|
17
|
-
}, t));
|
|
10
|
+
`, n = ({ children: t, ...o }) => /* @__PURE__ */ e.createElement(l, { as: "label", textColor: "neutral800" }, /* @__PURE__ */ e.createElement(i, { ...o }), /* @__PURE__ */ e.createElement(m, { paddingLeft: 2 }, t));
|
|
18
11
|
n.propTypes = {
|
|
19
12
|
children: r.node.isRequired,
|
|
20
13
|
value: r.any.isRequired
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react"),w=require("prop-types"),F=require("../Box/Box.cjs"),n=require("../helpers/getFocusableNodes.cjs"),f=require("../helpers/keyboardKeys.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react"),w=require("prop-types"),F=require("./RawTableContext.cjs"),R=require("../Box/Box.cjs"),n=require("../helpers/getFocusableNodes.cjs"),f=require("../helpers/keyboardKeys.cjs"),p=o=>o&&typeof o=="object"&&"default"in o?o:{default:o},T=p(d),s=p(w),h=o=>T.default.createElement(i,{...o,as:"th"}),i=({coords:o,as:x,...m})=>{const r=d.useRef(null),{rowIndex:E,colIndex:K,setTableValues:N}=F.useTable(),[u,b]=d.useState(!1),v=e=>{const t=n.getFocusableNodes(r.current,!0);if(t.length===0||t.length===1&&n.getFocusableNodesWithKeyboardNav(t).length===0)return;if(t.length>1&&!t.find(l=>l.tagName!=="BUTTON")){e.preventDefault();const l=t.findIndex(c=>c===document.activeElement);if(e.key===f.KeyboardKeys.RIGHT){const c=t[l+1];c&&(e.stopPropagation(),c.focus())}else if(e.key===f.KeyboardKeys.LEFT){const c=t[l-1];c&&(e.stopPropagation(),c.focus())}return}const a=e.key===f.KeyboardKeys.ENTER;if(a&&!u)b(!0);else if((e.key===f.KeyboardKeys.ESCAPE||a)&&u){if(a&&document.activeElement.tagName==="A")return;b(!1),r.current.focus()}else u&&e.stopPropagation()},y=E===o.row-1&&K===o.col-1;d.useLayoutEffect(()=>{const e=n.getFocusableNodes(r.current,!0);e.length===0||e.length===1&&n.getFocusableNodesWithKeyboardNav(e).length!==0||e.length>1&&Boolean(e.find(t=>t.tagName!=="BUTTON"))?(r.current.setAttribute("tabIndex",!u&&y?0:-1),e.forEach((t,a)=>{t.setAttribute("tabIndex",u?0:-1),u&&a===0&&t.focus()})):e.forEach(t=>{t.setAttribute("tabIndex",y?0:-1)})},[u,y]);const g=d.useCallback(()=>{const e=n.getFocusableNodes(r.current,!0);e.length>=1&&(n.getFocusableNodesWithKeyboardNav(e).length!==0||!e.find(t=>t.tagName!=="BUTTON"))&&b(!0),N({rowIndex:o.row-1,colIndex:o.col-1})},[o,N]);return d.useLayoutEffect(()=>{const e=r.current;return n.getFocusableNodes(e,!0).forEach(a=>{a.addEventListener("focus",g)}),()=>{n.getFocusableNodes(e,!0).forEach(l=>{l.removeEventListener("focus",g)})}},[g]),T.default.createElement(R.Box,{role:"gridcell",as:x,ref:r,onKeyDown:v,...m})};h.defaultProps={children:void 0,coords:{}};h.propTypes={"aria-colindex":s.default.number.isRequired,children:s.default.node,coords:s.default.shape({col:s.default.number,row:s.default.number})};i.defaultProps={as:"td",children:void 0,coords:{}};i.propTypes={"aria-colindex":s.default.number.isRequired,as:s.default.oneOf(["td","th"]),children:s.default.node,coords:s.default.shape({col:s.default.number,row:s.default.number})};exports.RawTd=i;exports.RawTh=h;
|
package/dist/RawTable/RawCell.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import g, { useRef as w, useState as R, useLayoutEffect as N, useCallback as A } from "react";
|
|
2
2
|
import o from "prop-types";
|
|
3
|
-
import {
|
|
3
|
+
import { useTable as P } from "./RawTableContext.js";
|
|
4
|
+
import { Box as B } from "../Box/Box.js";
|
|
4
5
|
import { getFocusableNodes as l, getFocusableNodesWithKeyboardNav as b } from "../helpers/getFocusableNodes.js";
|
|
5
6
|
import { KeyboardKeys as d } from "../helpers/keyboardKeys.js";
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
...r,
|
|
9
|
-
as: "th"
|
|
10
|
-
}), h = ({ coords: r, as: T, ...x }) => {
|
|
11
|
-
const s = w(null), { rowIndex: y, colIndex: v, setTableValues: p } = B(), [c, i] = R(!1), I = (e) => {
|
|
7
|
+
const E = (r) => /* @__PURE__ */ g.createElement(h, { ...r, as: "th" }), h = ({ coords: r, as: T, ...x }) => {
|
|
8
|
+
const s = w(null), { rowIndex: y, colIndex: v, setTableValues: p } = P(), [c, i] = R(!1), I = (e) => {
|
|
12
9
|
const t = l(s.current, !0);
|
|
13
10
|
if (t.length === 0 || t.length === 1 && b(t).length === 0)
|
|
14
11
|
return;
|
|
@@ -55,13 +52,7 @@ const E = (r) => /* @__PURE__ */ g.createElement(h, {
|
|
|
55
52
|
u.removeEventListener("focus", m);
|
|
56
53
|
});
|
|
57
54
|
};
|
|
58
|
-
}, [m]), /* @__PURE__ */ g.createElement(
|
|
59
|
-
role: "gridcell",
|
|
60
|
-
as: T,
|
|
61
|
-
ref: s,
|
|
62
|
-
onKeyDown: I,
|
|
63
|
-
...x
|
|
64
|
-
});
|
|
55
|
+
}, [m]), /* @__PURE__ */ g.createElement(B, { role: "gridcell", as: T, ref: s, onKeyDown: I, ...x });
|
|
65
56
|
};
|
|
66
57
|
E.defaultProps = {
|
|
67
58
|
children: void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react"),_=require("prop-types"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react"),_=require("prop-types"),E=require("./focusFocusable.cjs"),q=require("./RawTableContext.cjs"),r=require("../helpers/keyboardKeys.cjs"),k=a=>a&&typeof a=="object"&&"default"in a?a:{default:a},y=k(u),o=k(_),d=({colCount:a,rowCount:l,jumpStep:n,initialCol:T,initialRow:p,...R})=>{const K=u.useRef(null),f=u.useRef(!1),[b,s]=u.useState(p),[i,c]=u.useState(T),D=u.useCallback(({colIndex:t,rowIndex:e})=>{c(t),s(e)},[]);u.useEffect(()=>{f.current&&E.focusFocusable(K.current),f.current||(f.current=!0)},[i,b]);const m=t=>{switch(t.key){case r.KeyboardKeys.RIGHT:{t.preventDefault(),c(e=>e<a-1?e+1:e);break}case r.KeyboardKeys.LEFT:{t.preventDefault(),c(e=>e>0?e-1:e);break}case r.KeyboardKeys.UP:{t.preventDefault(),s(e=>e>0?e-1:e);break}case r.KeyboardKeys.DOWN:{t.preventDefault(),s(e=>e<l-1?e+1:e);break}case r.KeyboardKeys.HOME:{t.preventDefault(),t.ctrlKey&&s(0),c(0);break}case r.KeyboardKeys.END:{t.preventDefault(),t.ctrlKey&&s(l-1),c(a-1);break}case r.KeyboardKeys.PAGE_DOWN:{t.preventDefault(),s(e=>e+n<l?e+n:l-1);break}case r.KeyboardKeys.PAGE_UP:{t.preventDefault(),s(e=>e-n>0?e-n:0);break}}},P=y.default.useMemo(()=>({rowIndex:b,colIndex:i,setTableValues:D}),[i,b,D]);return y.default.createElement(q.RawTableContext.Provider,{value:P},y.default.createElement("table",{role:"grid",ref:K,"aria-rowcount":l,"aria-colcount":a,onKeyDown:m,...R}))};d.defaultProps={jumpStep:3,initialCol:0,initialRow:0};d.propTypes={colCount:o.default.number.isRequired,initialCol:o.default.number,initialRow:o.default.number,jumpStep:o.default.number,rowCount:o.default.number.isRequired};exports.RawTable=d;
|