@clubmed/trident-ui 1.2.0 → 1.3.0-beta.10
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 +961 -860
- package/README.md +11 -1
- package/assets/style.css +1 -1
- package/atoms/Clickable/Clickable.d.ts +5 -0
- package/atoms/Clickable/Clickable.js +25 -0
- package/atoms/Clickable/Clickable.js.map +1 -0
- package/atoms/Heading/Heading.d.ts +6 -0
- package/atoms/Heading/Heading.js +14 -0
- package/atoms/Heading/Heading.js.map +1 -0
- package/atoms/Heading/HeadingGroup.d.ts +7 -0
- package/atoms/Heading/HeadingGroup.js +15 -0
- package/atoms/Heading/HeadingGroup.js.map +1 -0
- package/atoms/Image/Image.d.ts +7 -0
- package/atoms/Image/Image.js +18 -0
- package/atoms/Image/Image.js.map +1 -0
- package/atoms/Prose/Prose.d.ts +5 -0
- package/atoms/Prose/Prose.js +18 -0
- package/atoms/Prose/Prose.js.map +1 -0
- package/chunks/ResizeObserver.js +287 -0
- package/chunks/ResizeObserver.js.map +1 -0
- package/chunks/_commonjsHelpers.js +24 -4
- package/chunks/_commonjsHelpers.js.map +1 -1
- package/chunks/index.js.map +1 -1
- package/chunks/plugin.js +53 -0
- package/chunks/plugin.js.map +1 -0
- package/contexts/Device.d.ts +2 -22
- package/contexts/Device.js +5 -59
- package/contexts/Device.js.map +1 -1
- package/contexts/Devices/Device.d.ts +11 -0
- package/contexts/Devices/Device.js +23 -0
- package/contexts/Devices/Device.js.map +1 -0
- package/contexts/Devices/hooks/useQueries.d.ts +6 -0
- package/contexts/Devices/hooks/useQueries.js +24 -0
- package/contexts/Devices/hooks/useQueries.js.map +1 -0
- package/contexts/Devices/reducers/reducer.d.ts +25 -0
- package/contexts/Devices/reducers/reducer.js +50 -0
- package/contexts/Devices/reducers/reducer.js.map +1 -0
- package/contexts/TridentUIConfig.js +228 -228
- package/contexts/TridentUIConfig.js.map +1 -1
- package/helpers/colors/colors.d.ts +108 -0
- package/helpers/colors/colors.js +132 -0
- package/helpers/colors/colors.js.map +1 -0
- package/hooks/keyboard.constants.js.map +1 -1
- package/hooks/useInternalStatus.js.map +1 -1
- package/hooks/useKeyboardControls.js.map +1 -1
- package/hooks/useResizeObserver.d.ts +2 -0
- package/hooks/useResizeObserver.js +84 -0
- package/hooks/useResizeObserver.js.map +1 -0
- package/hooks/useSafeBoop.js.map +1 -1
- package/hooks/useValue.js.map +1 -1
- package/molecules/Arrows/Arrows.d.ts +16 -0
- package/molecules/Arrows/Arrows.js +66 -0
- package/molecules/Arrows/Arrows.js.map +1 -0
- package/molecules/Arrows/ArrowsLabels.d.js +2 -0
- package/molecules/Arrows/ArrowsLabels.d.js.map +1 -0
- package/molecules/Arrows.d.ts +1 -50
- package/molecules/Arrows.js +2 -56
- package/molecules/Arrows.js.map +1 -1
- package/molecules/Avatar.js.map +1 -1
- package/molecules/Backdrop.js.map +1 -1
- package/molecules/Breadcrumb.js +8 -9
- package/molecules/Breadcrumb.js.map +1 -1
- package/molecules/Buttons/ArrowButton.d.ts +7 -0
- package/molecules/Buttons/ArrowButton.js +14 -0
- package/molecules/Buttons/ArrowButton.js.map +1 -0
- package/molecules/Buttons/Button.d.ts +15 -32
- package/molecules/Buttons/Button.js +52 -42
- package/molecules/Buttons/Button.js.map +1 -1
- package/molecules/Buttons/ButtonAnchor.d.ts +7 -3
- package/molecules/Buttons/ButtonAnchor.js +17 -36
- package/molecules/Buttons/ButtonAnchor.js.map +1 -1
- package/molecules/Buttons/ButtonContent.d.ts +12 -4
- package/molecules/Buttons/ButtonContent.js +14 -8
- package/molecules/Buttons/ButtonContent.js.map +1 -1
- package/molecules/Buttons/FakeButton.d.ts +8 -0
- package/molecules/Buttons/FakeButton.js +8 -0
- package/molecules/Buttons/FakeButton.js.map +1 -0
- package/molecules/Buttons/InertButton.d.ts +4 -0
- package/molecules/Buttons/InertButton.js +15 -31
- package/molecules/Buttons/InertButton.js.map +1 -1
- package/molecules/Buttons/v2/Button.d.ts +2289 -0
- package/molecules/Buttons/v2/Button.js +57 -0
- package/molecules/Buttons/v2/Button.js.map +1 -0
- package/molecules/Buttons/v2/Button.type.d.ts +57 -0
- package/molecules/Buttons/v2/Button.type.js +45 -0
- package/molecules/Buttons/v2/Button.type.js.map +1 -0
- package/molecules/Card.d.ts +1 -11
- package/molecules/Card.js +2 -35
- package/molecules/Card.js.map +1 -1
- package/molecules/Cards/Card.d.ts +13 -0
- package/molecules/Cards/Card.js +22 -0
- package/molecules/Cards/Card.js.map +1 -0
- package/molecules/Cards/CardAspectRatios.d.ts +6 -0
- package/molecules/Cards/CardAspectRatios.js +10 -0
- package/molecules/Cards/CardAspectRatios.js.map +1 -0
- package/molecules/Cards/CardBackground.d.ts +4 -0
- package/molecules/Cards/CardBackground.js +30 -0
- package/molecules/Cards/CardBackground.js.map +1 -0
- package/molecules/Cards/CardBackgroundContext.d.ts +6 -0
- package/molecules/Cards/CardBackgroundContext.js +10 -0
- package/molecules/Cards/CardBackgroundContext.js.map +1 -0
- package/molecules/Cards/CardClickable.d.ts +6 -0
- package/molecules/Cards/CardClickable.js +37 -0
- package/molecules/Cards/CardClickable.js.map +1 -0
- package/molecules/Cards/ExpandableCard.d.ts +14 -0
- package/molecules/Cards/ExpandableCard.js +80 -0
- package/molecules/Cards/ExpandableCard.js.map +1 -0
- package/molecules/Cards/v2/Card.d.ts +15 -0
- package/molecules/Cards/v2/Card.js +34 -0
- package/molecules/Cards/v2/Card.js.map +1 -0
- package/molecules/Chip.d.ts +9 -0
- package/molecules/Chip.js +31 -0
- package/molecules/Chip.js.map +1 -0
- package/molecules/Chip.themes.d.ts +12 -0
- package/molecules/Chip.themes.js +24 -0
- package/molecules/Chip.themes.js.map +1 -0
- package/molecules/ElasticHeight.d.ts +6 -27
- package/molecules/ElasticHeight.js +28 -33
- package/molecules/ElasticHeight.js.map +1 -1
- package/molecules/Forms/Checkboxes/Checkbox.js +12 -13
- package/molecules/Forms/Checkboxes/Checkbox.js.map +1 -1
- package/molecules/Forms/Checkboxes/Checkboxes.js.map +1 -1
- package/molecules/Forms/DateField.d.ts +1 -1
- package/molecules/Forms/DateField.js +142 -116
- package/molecules/Forms/DateField.js.map +1 -1
- package/molecules/Forms/Filter.js +12 -13
- package/molecules/Forms/Filter.js.map +1 -1
- package/molecules/Forms/FormControl.js +15 -16
- package/molecules/Forms/FormControl.js.map +1 -1
- package/molecules/Forms/FormLabel.js.map +1 -1
- package/molecules/Forms/NumberField.d.ts +29 -29
- package/molecules/Forms/NumberField.js +68 -68
- package/molecules/Forms/NumberField.js.map +1 -1
- package/molecules/Forms/Password/Password.js +10 -11
- package/molecules/Forms/Password/Password.js.map +1 -1
- package/molecules/Forms/Password/ValidationMessage.js +8 -9
- package/molecules/Forms/Password/ValidationMessage.js.map +1 -1
- package/molecules/Forms/Radios/Radio.js.map +1 -1
- package/molecules/Forms/Radios/RadioGroup.js +2 -2
- package/molecules/Forms/Radios/RadioGroup.js.map +1 -1
- package/molecules/Forms/Range.js +124 -406
- package/molecules/Forms/Range.js.map +1 -1
- package/molecules/Forms/Select.d.ts +1 -1
- package/molecules/Forms/Select.js +3 -4
- package/molecules/Forms/Select.js.map +1 -1
- package/molecules/Forms/Switch.js.map +1 -1
- package/molecules/Forms/TextField.d.ts +1 -1
- package/molecules/Forms/TextField.js +7 -8
- package/molecules/Forms/TextField.js.map +1 -1
- package/molecules/HamburgerIcon.js.map +1 -1
- package/molecules/Link.d.ts +1 -1
- package/molecules/Link.js +8 -9
- package/molecules/Link.js.map +1 -1
- package/molecules/Loader.js.map +1 -1
- package/molecules/Pagination.d.ts +38 -0
- package/molecules/Pagination.helper.d.ts +48 -0
- package/molecules/Pagination.helper.js +30 -0
- package/molecules/Pagination.helper.js.map +1 -0
- package/molecules/Pagination.js +154 -0
- package/molecules/Pagination.js.map +1 -0
- package/molecules/Popin.js +16 -16
- package/molecules/Popin.js.map +1 -1
- package/molecules/Spinner.js.map +1 -1
- package/molecules/Tabs/Tab.d.ts +1 -1
- package/molecules/Tabs/Tab.js +51 -49
- package/molecules/Tabs/Tab.js.map +1 -1
- package/molecules/Tabs/TabList.js.map +1 -1
- package/molecules/Tabs/TabPanel.js +31 -29
- package/molecules/Tabs/TabPanel.js.map +1 -1
- package/molecules/Tabs/Tabs.js +7 -9
- package/molecules/Tabs/Tabs.js.map +1 -1
- package/molecules/Tabs/TabsBody.js.map +1 -1
- package/molecules/Tabs/context/TabControl.d.ts +29 -27
- package/molecules/Tabs/context/TabControl.js +67 -66
- package/molecules/Tabs/context/TabControl.js.map +1 -1
- package/molecules/Tabs/hooks/tabControl.d.ts +25 -14
- package/molecules/Tabs/hooks/tabControl.js +26 -23
- package/molecules/Tabs/hooks/tabControl.js.map +1 -1
- package/molecules/Tabs/theme.js.map +1 -1
- package/molecules/Tag.d.ts +43 -0
- package/molecules/Tag.js +73 -0
- package/molecules/Tag.js.map +1 -0
- package/package.json +29 -5
- package/styles/globals.css +16 -15
- package/tailwind/colors.d.ts +38 -0
- package/tailwind/colors.js +44 -0
- package/tailwind/colors.js.map +1 -0
- package/tailwind/plugins/animationDelay.d.ts +4 -0
- package/tailwind/plugins/animationDelay.js +15 -0
- package/tailwind/plugins/animationDelay.js.map +1 -0
- package/tailwind/plugins/hocus.d.ts +4 -0
- package/tailwind/plugins/hocus.js +11 -0
- package/tailwind/plugins/hocus.js.map +1 -0
- package/tailwind/plugins/lineClampFix.d.ts +4 -0
- package/tailwind/plugins/lineClampFix.js +13 -0
- package/tailwind/plugins/lineClampFix.js.map +1 -0
- package/tailwind/plugins/popover.d.ts +4 -0
- package/tailwind/plugins/popover.js +8 -0
- package/tailwind/plugins/popover.js.map +1 -0
- package/tailwind/plugins/startingStyle.d.ts +4 -0
- package/tailwind/plugins/startingStyle.js +8 -0
- package/tailwind/plugins/startingStyle.js.map +1 -0
- package/tailwind/plugins/transitionBehavior.d.ts +4 -0
- package/tailwind/plugins/transitionBehavior.js +11 -0
- package/tailwind/plugins/transitionBehavior.js.map +1 -0
- package/tailwind/tailwind.preset.d.ts +733 -510
- package/tailwind/tailwind.preset.js +706 -629
- package/tailwind/tailwind.preset.js.map +1 -1
- package/types/Colors.d.js +2 -0
- package/types/Colors.d.js.map +1 -0
- package/types/Devices.d.ts +8 -0
- package/types/Devices.js +11 -0
- package/types/Devices.js.map +1 -0
- package/types/Direction.d.js +2 -0
- package/types/Direction.d.js.map +1 -0
- package/types/LiteralUnion.d.js +2 -0
- package/types/LiteralUnion.d.js.map +1 -0
- package/types/ScrollerLabels.d.js +2 -0
- package/types/ScrollerLabels.d.js.map +1 -0
- package/types/Theme.d.js +2 -0
- package/types/Theme.d.js.map +1 -0
- package/molecules/Buttons/Button.helpers.d.ts +0 -7
- package/molecules/Buttons/Button.helpers.js +0 -11
- package/molecules/Buttons/Button.helpers.js.map +0 -1
- package/molecules/Buttons/Button.themes.d.ts +0 -1
- package/molecules/Buttons/Button.themes.js +0 -25
- package/molecules/Buttons/Button.themes.js.map +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type Page = {
|
|
2
|
+
type: 'pageNumber';
|
|
3
|
+
value: number;
|
|
4
|
+
} | {
|
|
5
|
+
type: 'ellipsis';
|
|
6
|
+
} | {
|
|
7
|
+
type: 'previousButton';
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'nextButton';
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Checks for mobile devices only whether a page number should be followed by an ellipsis in a pagination component,
|
|
15
|
+
* based on the active page number.
|
|
16
|
+
*
|
|
17
|
+
* @param page {number} - The number of the current page.
|
|
18
|
+
* @param activePage {number} - The number of the active page.
|
|
19
|
+
* @param lastPage {number} - The last page.
|
|
20
|
+
* @returns {boolean} - Returns `true` if the page number should be followed by an ellipsis, otherwise returns `false`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const showMobileEllipsis: (page: number, activePage: number, lastPage: number) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Get the active page number index from an array of pagination items.
|
|
25
|
+
*
|
|
26
|
+
* @param activePage - The active page number.
|
|
27
|
+
* @param paginationItems - An array of pagination objects containing items of "page" type or sometimes "ellipsis" type.
|
|
28
|
+
* @returns {number} - The index of the active page number in the paginationItems array, or -1 if not found.
|
|
29
|
+
*/
|
|
30
|
+
export declare const getActivePageIndex: (activePage: number, pagination: Page[]) => number;
|
|
31
|
+
/**
|
|
32
|
+
* Generates a pagination object based on the current page and total page number.
|
|
33
|
+
*
|
|
34
|
+
* @param {number} activePage - The active page number.
|
|
35
|
+
* @param {number} totalPage - The total number of pages.
|
|
36
|
+
* @returns {PageArray} - An array of pagination items.
|
|
37
|
+
*/
|
|
38
|
+
export declare const generatePagination: (activePage: number, totalPage: number) => Page[];
|
|
39
|
+
/**
|
|
40
|
+
* Determines whether a page button should be hidden on mobile devices in a pagination component
|
|
41
|
+
* based on the active page number.
|
|
42
|
+
*
|
|
43
|
+
* @param page - The page number currently being evaluated.
|
|
44
|
+
* @param activePage - The number of the currently active page.
|
|
45
|
+
* @param lastPage - The largest page number.
|
|
46
|
+
* @returns {boolean} - Returns `true` if the page button should be hidden, otherwise returns `false`.
|
|
47
|
+
*/
|
|
48
|
+
export declare const hidePageButtonForMobile: (page: number, activePage: number, lastPage: number) => boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const _ = (n, s, r) => r <= 3 ? !1 : n === 1 ? s > 3 : n === r ? s < r - 2 : !1, M = (n, s) => s.findIndex((r) => r.type === "pageNumber" && r.value === n), N = (n, s) => {
|
|
2
|
+
const r = [];
|
|
3
|
+
r.push({
|
|
4
|
+
type: "previousButton",
|
|
5
|
+
disabled: s <= 1 || n <= 1
|
|
6
|
+
});
|
|
7
|
+
for (let e = 1; e <= s; e++)
|
|
8
|
+
s <= 7 || e <= 2 || e < 3 && n < 5 || e >= s - 1 || Math.abs(e - n) <= 1 ? r.push({
|
|
9
|
+
type: "pageNumber",
|
|
10
|
+
value: e
|
|
11
|
+
}) : r[r.length - 1].type !== "ellipsis" && r.push({
|
|
12
|
+
type: "ellipsis"
|
|
13
|
+
});
|
|
14
|
+
return r.push({
|
|
15
|
+
type: "nextButton",
|
|
16
|
+
disabled: s <= 1 || n >= s
|
|
17
|
+
}), r;
|
|
18
|
+
}, f = (n, s, r) => {
|
|
19
|
+
if (r <= 3 || n === 1 || n === s || n === r)
|
|
20
|
+
return !1;
|
|
21
|
+
const e = n === 2, E = n === r - 1, t = n === s - 1, u = n === s + 1;
|
|
22
|
+
return e && s === 1 || E && s === r || e && t ? !1 : !(u && E);
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
N as generatePagination,
|
|
26
|
+
M as getActivePageIndex,
|
|
27
|
+
f as hidePageButtonForMobile,
|
|
28
|
+
_ as showMobileEllipsis
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=Pagination.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pagination.helper.js","sources":["../../lib/molecules/Pagination.helper.ts"],"sourcesContent":["export type Page =\n | {\n type: 'pageNumber';\n value: number;\n }\n | {\n type: 'ellipsis';\n }\n | {\n type: 'previousButton';\n disabled: boolean;\n }\n | {\n type: 'nextButton';\n disabled: boolean;\n };\n\n// The largest page number before splitting pagination items with ellipsis in desktop devices.\nconst DESKTOP_MAX_PAGE_BUTTON_ELEMENTS = 7;\nconst MOBILE_MAX_NUMBER = 3;\nconst MIN_PAGE_NUMBER = 1;\nconst MOBILE_CURRENT_OFFSET = 2;\n\n/**\n * Checks for mobile devices only whether a page number should be followed by an ellipsis in a pagination component,\n * based on the active page number.\n *\n * @param page {number} - The number of the current page.\n * @param activePage {number} - The number of the active page.\n * @param lastPage {number} - The last page.\n * @returns {boolean} - Returns `true` if the page number should be followed by an ellipsis, otherwise returns `false`.\n */\nexport const showMobileEllipsis = (page: number, activePage: number, lastPage: number) => {\n if (lastPage <= MOBILE_MAX_NUMBER) {\n return false;\n }\n\n if (page === MIN_PAGE_NUMBER) {\n return activePage > MIN_PAGE_NUMBER + MOBILE_CURRENT_OFFSET;\n }\n\n if (page === lastPage) {\n return activePage < lastPage - MOBILE_CURRENT_OFFSET;\n }\n\n return false;\n};\n\n/**\n * Get the active page number index from an array of pagination items.\n *\n * @param activePage - The active page number.\n * @param paginationItems - An array of pagination objects containing items of \"page\" type or sometimes \"ellipsis\" type.\n * @returns {number} - The index of the active page number in the paginationItems array, or -1 if not found.\n */\nexport const getActivePageIndex = (activePage: number, pagination: Page[]): number => {\n return pagination.findIndex((page) => page.type === 'pageNumber' && page.value === activePage);\n};\n\n/**\n * Generates a pagination object based on the current page and total page number.\n *\n * @param {number} activePage - The active page number.\n * @param {number} totalPage - The total number of pages.\n * @returns {PageArray} - An array of pagination items.\n */\nexport const generatePagination = (activePage: number, totalPage: number): Page[] => {\n const paginationItems: Page[] = [];\n\n paginationItems.push({\n type: 'previousButton',\n disabled: totalPage <= 1 || activePage <= 1,\n });\n\n for (let page = 1; page <= totalPage; page++) {\n if (\n totalPage <= DESKTOP_MAX_PAGE_BUTTON_ELEMENTS ||\n page <= 2 ||\n (page < 3 && activePage < 5) ||\n page >= totalPage - 1 ||\n Math.abs(page - activePage) <= 1\n ) {\n paginationItems.push({\n type: 'pageNumber',\n value: page,\n });\n } else if (paginationItems[paginationItems.length - 1].type !== 'ellipsis') {\n paginationItems.push({\n type: 'ellipsis',\n });\n }\n }\n\n paginationItems.push({\n type: 'nextButton',\n disabled: totalPage <= 1 || activePage >= totalPage,\n });\n\n return paginationItems;\n};\n\n/**\n * Determines whether a page button should be hidden on mobile devices in a pagination component\n * based on the active page number.\n *\n * @param page - The page number currently being evaluated.\n * @param activePage - The number of the currently active page.\n * @param lastPage - The largest page number.\n * @returns {boolean} - Returns `true` if the page button should be hidden, otherwise returns `false`.\n */\nexport const hidePageButtonForMobile = (page: number, activePage: number, lastPage: number) => {\n if (lastPage <= MOBILE_MAX_NUMBER) {\n return false;\n }\n\n if (page === MIN_PAGE_NUMBER) {\n return false;\n }\n\n if (page === activePage) {\n return false;\n }\n\n if (page === lastPage) {\n return false;\n }\n\n const justAfterFirstNumber = page === MIN_PAGE_NUMBER + 1;\n const justBeforeLastNumber = page === lastPage - 1;\n\n const justBeforeCurrentNumber = page === activePage - 1;\n const justAfterCurrentNumber = page === activePage + 1;\n\n if (justAfterFirstNumber && activePage === MIN_PAGE_NUMBER) {\n return false;\n }\n\n if (justBeforeLastNumber && activePage === lastPage) {\n return false;\n }\n\n if (justAfterFirstNumber && justBeforeCurrentNumber) {\n return false;\n }\n\n return !(justAfterCurrentNumber && justBeforeLastNumber);\n};\n"],"names":["showMobileEllipsis","page","activePage","lastPage","getActivePageIndex","pagination","generatePagination","totalPage","paginationItems","hidePageButtonForMobile","justAfterFirstNumber","justBeforeLastNumber","justBeforeCurrentNumber","justAfterCurrentNumber"],"mappings":"AAgCO,MAAMA,IAAqB,CAACC,GAAcC,GAAoBC,MAC/DA,KAAY,IACP,KAGLF,MAAS,IACJC,IAAa,IAGlBD,MAASE,IACJD,IAAaC,IAAW,IAG1B,IAUIC,IAAqB,CAACF,GAAoBG,MAC9CA,EAAW,UAAU,CAACJ,MAASA,EAAK,SAAS,gBAAgBA,EAAK,UAAUC,CAAU,GAUlFI,IAAqB,CAACJ,GAAoBK,MAA8B;AACnF,QAAMC,IAA0B,CAAA;AAEhC,EAAAA,EAAgB,KAAK;AAAA,IACnB,MAAM;AAAA,IACN,UAAUD,KAAa,KAAKL,KAAc;AAAA,EAAA,CAC3C;AAED,WAASD,IAAO,GAAGA,KAAQM,GAAWN;AACpC,IACEM,KAAa,KACbN,KAAQ,KACPA,IAAO,KAAKC,IAAa,KAC1BD,KAAQM,IAAY,KACpB,KAAK,IAAIN,IAAOC,CAAU,KAAK,IAE/BM,EAAgB,KAAK;AAAA,MACnB,MAAM;AAAA,MACN,OAAOP;AAAA,IAAA,CACR,IACQO,EAAgBA,EAAgB,SAAS,CAAC,EAAE,SAAS,cAC9DA,EAAgB,KAAK;AAAA,MACnB,MAAM;AAAA,IAAA,CACP;AAIL,SAAAA,EAAgB,KAAK;AAAA,IACnB,MAAM;AAAA,IACN,UAAUD,KAAa,KAAKL,KAAcK;AAAA,EAAA,CAC3C,GAEMC;AACT,GAWaC,IAA0B,CAACR,GAAcC,GAAoBC,MAAqB;AAa7F,MAZIA,KAAY,KAIZF,MAAS,KAITA,MAASC,KAITD,MAASE;AACX,WAAO;AAGT,QAAMO,IAAuBT,MAAS,GAChCU,IAAuBV,MAASE,IAAW,GAE3CS,IAA0BX,MAASC,IAAa,GAChDW,IAAyBZ,MAASC,IAAa;AAUrD,SARIQ,KAAwBR,MAAe,KAIvCS,KAAwBT,MAAeC,KAIvCO,KAAwBE,IACnB,KAGF,EAAEC,KAA0BF;AACrC;"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
3
|
+
import { c as l } from "../chunks/index.js";
|
|
4
|
+
import { Fragment as k } from "react";
|
|
5
|
+
import { generatePagination as y, showMobileEllipsis as b, hidePageButtonForMobile as N } from "./Pagination.helper.js";
|
|
6
|
+
import { Button as x } from "./Buttons/Button.js";
|
|
7
|
+
import { Icon as h } from "@clubmed/trident-icons";
|
|
8
|
+
const j = () => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
"aria-controls": "page-content",
|
|
12
|
+
className: "text-base mx-8 ml-4 hidden size-48 items-center justify-center text-b3 font-semibold text-black md:flex",
|
|
13
|
+
children: "…"
|
|
14
|
+
}
|
|
15
|
+
) }, "desktop-ellipsis"), u = () => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
"aria-controls": "page-content",
|
|
19
|
+
className: "text-base mx-8 ml-4 flex size-48 items-center justify-center text-b3 font-semibold text-black md:hidden",
|
|
20
|
+
children: "…"
|
|
21
|
+
}
|
|
22
|
+
) }, "mobile-ellipsis"), E = ({
|
|
23
|
+
defaultPage: i,
|
|
24
|
+
buttonClassName: c = "md:mr-32",
|
|
25
|
+
buttonLabelClassName: o = "md:flex",
|
|
26
|
+
className: p,
|
|
27
|
+
labels: d = {},
|
|
28
|
+
onChange: n,
|
|
29
|
+
paginationFactory: v = y,
|
|
30
|
+
count: r,
|
|
31
|
+
...f
|
|
32
|
+
}) => {
|
|
33
|
+
const m = v(i, r);
|
|
34
|
+
return /* @__PURE__ */ e(
|
|
35
|
+
"nav",
|
|
36
|
+
{
|
|
37
|
+
...f,
|
|
38
|
+
"data-name": "Pagination",
|
|
39
|
+
role: "navigation",
|
|
40
|
+
"aria-label": "pagination navigation",
|
|
41
|
+
className: l("flex justify-center border-t-sand", p),
|
|
42
|
+
children: /* @__PURE__ */ e("ul", { className: "mt-12 flex", children: m.map((t, a) => {
|
|
43
|
+
switch (t.type) {
|
|
44
|
+
case "pageNumber":
|
|
45
|
+
return /* @__PURE__ */ s(k, { children: [
|
|
46
|
+
t.value === r && b(t.value, i, r) && /* @__PURE__ */ e(u, {}),
|
|
47
|
+
/* @__PURE__ */ e(
|
|
48
|
+
"li",
|
|
49
|
+
{
|
|
50
|
+
className: l("mr-2", {
|
|
51
|
+
"hidden md:flex": N(t.value, i, r)
|
|
52
|
+
}),
|
|
53
|
+
children: t.value === i ? /* @__PURE__ */ e(
|
|
54
|
+
x,
|
|
55
|
+
{
|
|
56
|
+
"aria-current": "page",
|
|
57
|
+
className: "text-white",
|
|
58
|
+
color: "black",
|
|
59
|
+
variant: "circle",
|
|
60
|
+
children: t.value.toString()
|
|
61
|
+
}
|
|
62
|
+
) : /* @__PURE__ */ e(
|
|
63
|
+
x,
|
|
64
|
+
{
|
|
65
|
+
className: l("size-48 items-center", {
|
|
66
|
+
"mx-8 flex shrink-0 cursor-pointer justify-center self-start": a === m.length - 1
|
|
67
|
+
}),
|
|
68
|
+
onClick: () => n(t.value),
|
|
69
|
+
color: "white",
|
|
70
|
+
variant: "circle",
|
|
71
|
+
children: t.value.toString()
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
t.value === 1 && b(t.value, i, r) && /* @__PURE__ */ e(u, {})
|
|
77
|
+
] }, `pagination-pageNumber-${a}`);
|
|
78
|
+
case "ellipsis":
|
|
79
|
+
return /* @__PURE__ */ e(j, {}, `pagination-ellipsis-${a}`);
|
|
80
|
+
case "previousButton":
|
|
81
|
+
return /* @__PURE__ */ e("li", { className: l(c), children: /* @__PURE__ */ s(
|
|
82
|
+
"button",
|
|
83
|
+
{
|
|
84
|
+
"data-action": "previous",
|
|
85
|
+
"aria-controls": "page-content",
|
|
86
|
+
"aria-label": `page ${i - 1}`,
|
|
87
|
+
className: l(
|
|
88
|
+
"text:black text-base mx-8 flex h-48 shrink-0 items-center justify-center self-start text-b3 font-semibold active:text-black-active disabled:text-grey hocus:text-black-active",
|
|
89
|
+
{
|
|
90
|
+
"pointer-events-none disabled:text-grey": t.disabled
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
disabled: t.disabled,
|
|
94
|
+
onClick: () => n(i - 1),
|
|
95
|
+
type: "button",
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ e(h, { name: "ArrowDefaultLeft", width: "30px" }),
|
|
98
|
+
/* @__PURE__ */ e(
|
|
99
|
+
"span",
|
|
100
|
+
{
|
|
101
|
+
className: l(
|
|
102
|
+
"ml-4 hidden border-b",
|
|
103
|
+
{ "border-black": !t.disabled },
|
|
104
|
+
o
|
|
105
|
+
),
|
|
106
|
+
children: d.previous
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
) }, "pagination-labels.previous");
|
|
112
|
+
case "nextButton":
|
|
113
|
+
return /* @__PURE__ */ e("li", { className: l(c), children: /* @__PURE__ */ s(
|
|
114
|
+
"button",
|
|
115
|
+
{
|
|
116
|
+
"aria-controls": "page-content",
|
|
117
|
+
"aria-label": `page ${i + 1}`,
|
|
118
|
+
className: l(
|
|
119
|
+
"text:black mb-5 text-base mx-8 flex h-48 shrink-0 items-center justify-center self-start text-b3 font-semibold active:text-black-active disabled:text-grey hocus:text-black-active",
|
|
120
|
+
{
|
|
121
|
+
"pointer-events-none disabled:text-grey": t.disabled
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
"data-action": "next",
|
|
125
|
+
disabled: t.disabled,
|
|
126
|
+
onClick: () => n(i + 1),
|
|
127
|
+
type: "button",
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ e(
|
|
130
|
+
"span",
|
|
131
|
+
{
|
|
132
|
+
className: l(
|
|
133
|
+
"ml-4 hidden border-b",
|
|
134
|
+
{ "border-black": !t.disabled },
|
|
135
|
+
o
|
|
136
|
+
),
|
|
137
|
+
children: d.next
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
/* @__PURE__ */ e(h, { name: "ArrowDefaultRight", width: "30px" })
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
) }, "pagination-labels.next");
|
|
144
|
+
default:
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
}) })
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
export {
|
|
152
|
+
E as Pagination
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=Pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pagination.js","sources":["../../lib/molecules/Pagination.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport { Fragment, type FunctionComponent, type HTMLAttributes } from 'react';\n\nimport {\n showMobileEllipsis,\n generatePagination,\n hidePageButtonForMobile,\n} from './Pagination.helper';\nimport { Button } from '@/molecules/Buttons/Button';\nimport { Icon } from '@clubmed/trident-icons';\nimport type { ScrollerLabels } from '@/types/ScrollerLabels';\n\nexport interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange'> {\n /**\n * The current page number (must be >= 1)\n */\n defaultPage: number;\n /**\n * The total pages number\n */\n count: number;\n /**\n * A callback function to handle page changes.\n */\n onChange: (page: number) => void;\n /**\n * Additional class names for the previous & next buttons\n */\n buttonClassName?: string;\n /**\n * Additional class names for the label of the previous & next buttons\n */\n buttonLabelClassName?: string;\n /**\n * Additional class names\n */\n className?: string;\n /**\n * UI Labels\n */\n labels: ScrollerLabels;\n /**\n * A pagination factory to generate an array of Pagination elements (pageNumber, ellipsis, next button, previous button).\n */\n paginationFactory?: typeof generatePagination;\n}\n\nconst EllipsisDesktop = () => {\n return (\n <li key=\"desktop-ellipsis\">\n <div\n aria-controls=\"page-content\"\n className=\"text-base mx-8 ml-4 hidden size-48 items-center justify-center text-b3 font-semibold text-black md:flex\"\n >\n …\n </div>\n </li>\n );\n};\n\nconst EllipsisMobile = () => {\n return (\n <li key=\"mobile-ellipsis\">\n <div\n aria-controls=\"page-content\"\n className=\"text-base mx-8 ml-4 flex size-48 items-center justify-center text-b3 font-semibold text-black md:hidden\"\n >\n …\n </div>\n </li>\n );\n};\n\nexport const Pagination: FunctionComponent<PaginationProps> = ({\n defaultPage,\n buttonClassName = 'md:mr-32',\n buttonLabelClassName = 'md:flex',\n className,\n labels = {},\n onChange,\n paginationFactory = generatePagination,\n count,\n ...props\n}) => {\n const pagination = paginationFactory(defaultPage, count);\n\n return (\n <nav\n {...props}\n data-name=\"Pagination\"\n role=\"navigation\"\n aria-label=\"pagination navigation\"\n className={classnames('flex justify-center border-t-sand', className)}\n >\n <ul className=\"mt-12 flex\">\n {pagination.map((page, index) => {\n switch (page.type) {\n case 'pageNumber':\n return (\n <Fragment key={`pagination-pageNumber-${index}`}>\n {page.value === count && showMobileEllipsis(page.value, defaultPage, count) && (\n <EllipsisMobile />\n )}\n <li\n className={classnames('mr-2', {\n 'hidden md:flex': hidePageButtonForMobile(page.value, defaultPage, count),\n })}\n >\n {page.value === defaultPage ? (\n <Button\n aria-current=\"page\"\n className=\"text-white\"\n color=\"black\"\n variant=\"circle\"\n >\n {page.value.toString()}\n </Button>\n ) : (\n <Button\n className={classnames('size-48 items-center', {\n 'mx-8 flex shrink-0 cursor-pointer justify-center self-start':\n index === pagination.length - 1,\n })}\n onClick={() => onChange(page.value)}\n color=\"white\"\n variant=\"circle\"\n >\n {page.value.toString()}\n </Button>\n )}\n </li>\n {page.value === 1 && showMobileEllipsis(page.value, defaultPage, count) && (\n <EllipsisMobile />\n )}\n </Fragment>\n );\n\n case 'ellipsis':\n return <EllipsisDesktop key={`pagination-ellipsis-${index}`} />;\n\n case 'previousButton':\n return (\n <li key=\"pagination-labels.previous\" className={classnames(buttonClassName)}>\n <button\n data-action=\"previous\"\n aria-controls=\"page-content\"\n aria-label={`page ${defaultPage - 1}`}\n className={classnames(\n 'text:black text-base mx-8 flex h-48 shrink-0 items-center justify-center self-start text-b3 font-semibold active:text-black-active disabled:text-grey hocus:text-black-active',\n {\n 'pointer-events-none disabled:text-grey': page.disabled,\n },\n )}\n disabled={page.disabled}\n onClick={() => onChange(defaultPage - 1)}\n type=\"button\"\n >\n <Icon name=\"ArrowDefaultLeft\" width=\"30px\" />\n <span\n className={classnames(\n 'ml-4 hidden border-b',\n { 'border-black': !page.disabled },\n buttonLabelClassName,\n )}\n >\n {labels.previous}\n </span>\n </button>\n </li>\n );\n\n case 'nextButton':\n return (\n <li className={classnames(buttonClassName)} key=\"pagination-labels.next\">\n <button\n aria-controls=\"page-content\"\n aria-label={`page ${defaultPage + 1}`}\n className={classnames(\n 'text:black mb-5 text-base mx-8 flex h-48 shrink-0 items-center justify-center self-start text-b3 font-semibold active:text-black-active disabled:text-grey hocus:text-black-active',\n {\n 'pointer-events-none disabled:text-grey': page.disabled,\n },\n )}\n data-action=\"next\"\n disabled={page.disabled}\n onClick={() => onChange(defaultPage + 1)}\n type=\"button\"\n >\n <span\n className={classnames(\n 'ml-4 hidden border-b',\n { 'border-black': !page.disabled },\n buttonLabelClassName,\n )}\n >\n {labels.next}\n </span>\n <Icon name=\"ArrowDefaultRight\" width=\"30px\" />\n </button>\n </li>\n );\n\n default:\n return null;\n }\n })}\n </ul>\n </nav>\n );\n};\n"],"names":["EllipsisDesktop","jsx","EllipsisMobile","Pagination","defaultPage","buttonClassName","buttonLabelClassName","className","labels","onChange","paginationFactory","generatePagination","count","props","pagination","classnames","page","index","Fragment","showMobileEllipsis","hidePageButtonForMobile","Button","jsxs","Icon"],"mappings":";;;;;;;AAiDA,MAAMA,IAAkB,wBAEnB,MAAA,EACC,UAAA,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,iBAAc;AAAA,IACd,WAAU;AAAA,IACX,UAAA;AAAA,EAAA;AAAA,KAJK,kBAOR,GAIEC,IAAiB,wBAElB,MAAA,EACC,UAAA,gBAAAD;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,iBAAc;AAAA,IACd,WAAU;AAAA,IACX,UAAA;AAAA,EAAA;AAAA,KAJK,iBAOR,GAISE,IAAiD,CAAC;AAAA,EAC7D,aAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,sBAAAC,IAAuB;AAAA,EACvB,WAAAC;AAAA,EACA,QAAAC,IAAS,CAAA;AAAA,EACT,UAAAC;AAAA,EACA,mBAAAC,IAAoBC;AAAA,EACpB,OAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAaJ,EAAkBN,GAAaQ,CAAK;AAEvD,SACE,gBAAAX;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGY;AAAA,MACJ,aAAU;AAAA,MACV,MAAK;AAAA,MACL,cAAW;AAAA,MACX,WAAWE,EAAW,qCAAqCR,CAAS;AAAA,MAEpE,UAAA,gBAAAN,EAAC,QAAG,WAAU,cACX,YAAW,IAAI,CAACe,GAAMC,MAAU;AAC/B,gBAAQD,EAAK,MAAA;AAAA,UACX,KAAK;AACH,qCACGE,GAAA,EACE,UAAA;AAAA,cAAAF,EAAK,UAAUJ,KAASO,EAAmBH,EA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0BhD;AAAA,UAGJ;AACE,mBAAO;AAAA,QAAA;AAAA,MAEb,CAAC,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
package/molecules/Popin.js
CHANGED
|
@@ -3,44 +3,44 @@ import { useTransition as f, config as p, animated as x } from "@react-spring/we
|
|
|
3
3
|
import { Backdrop as h } from "./Backdrop.js";
|
|
4
4
|
import { Button as u } from "./Buttons/Button.js";
|
|
5
5
|
import { c as v } from "../chunks/index.js";
|
|
6
|
-
const b = ({ closeLabel: e, onClose:
|
|
6
|
+
const b = ({ closeLabel: e, onClose: r }) => /* @__PURE__ */ t(
|
|
7
7
|
u,
|
|
8
8
|
{
|
|
9
|
-
|
|
10
|
-
variant: "
|
|
9
|
+
color: "black",
|
|
10
|
+
variant: "circle",
|
|
11
11
|
icon: "CrossDefault",
|
|
12
12
|
className: "mx-auto",
|
|
13
|
-
label: e,
|
|
14
|
-
onClick:
|
|
13
|
+
"aria-label": e,
|
|
14
|
+
onClick: r
|
|
15
15
|
}
|
|
16
16
|
), j = ({
|
|
17
17
|
title: e,
|
|
18
|
-
children:
|
|
19
|
-
closeLabel:
|
|
18
|
+
children: r,
|
|
19
|
+
closeLabel: n,
|
|
20
20
|
onClose: a,
|
|
21
|
-
isVisible:
|
|
21
|
+
isVisible: o,
|
|
22
22
|
className: i = "sm:w-360",
|
|
23
|
-
Footer:
|
|
23
|
+
Footer: c = b
|
|
24
24
|
}) => {
|
|
25
|
-
const s = f(
|
|
25
|
+
const s = f(o, {
|
|
26
26
|
from: { scale: 0.3, opacity: 0.3 },
|
|
27
27
|
enter: { scale: 1, opacity: 1 },
|
|
28
28
|
leave: { scale: 0, opacity: 0 },
|
|
29
|
-
config:
|
|
29
|
+
config: o ? { tension: 120, friction: 20 } : p.gentle
|
|
30
30
|
});
|
|
31
|
-
return /* @__PURE__ */ t(h, { isVisible:
|
|
32
|
-
(
|
|
31
|
+
return /* @__PURE__ */ t(h, { isVisible: o, onClose: a, children: s(
|
|
32
|
+
(l, m) => m && /* @__PURE__ */ t(
|
|
33
33
|
x.div,
|
|
34
34
|
{
|
|
35
35
|
className: v(
|
|
36
36
|
"border-lightGrey rounded-16 pointer-events-auto mx-20 w-full border bg-white",
|
|
37
37
|
i
|
|
38
38
|
),
|
|
39
|
-
style:
|
|
39
|
+
style: l,
|
|
40
40
|
children: /* @__PURE__ */ d("div", { className: "p-40 text-center max-h-[90vh] flex flex-col", children: [
|
|
41
41
|
e && /* @__PURE__ */ t("div", { className: "mt-12 text-h5 text-start font-serif", children: e }),
|
|
42
|
-
/* @__PURE__ */ t("div", { className: "mt-12 mb-40 last:mb-0 text-start overflow-auto", children:
|
|
43
|
-
|
|
42
|
+
/* @__PURE__ */ t("div", { className: "mt-12 mb-40 last:mb-0 text-start overflow-auto", children: r }),
|
|
43
|
+
c && /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(c, { closeLabel: n, onClose: a }) })
|
|
44
44
|
] })
|
|
45
45
|
}
|
|
46
46
|
)
|
package/molecules/Popin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popin.js","sources":["../../lib/molecules/Popin.tsx"],"sourcesContent":["import { animated, config, useTransition } from '@react-spring/web';\nimport type { FunctionComponent, PropsWithChildren, ReactNode } from 'react';\n\nimport { Backdrop } from './Backdrop';\nimport { Button } from './Buttons/Button';\nimport classnames from 'classnames';\n\nexport type ClosePopinCallback = () => void;\n\ninterface PopinFooterProps {\n closeLabel: string;\n onClose: ClosePopinCallback;\n}\n\nconst PopinFooter = ({ closeLabel, onClose }: PopinFooterProps) => {\n return (\n <Button\n
|
|
1
|
+
{"version":3,"file":"Popin.js","sources":["../../lib/molecules/Popin.tsx"],"sourcesContent":["import { animated, config, useTransition } from '@react-spring/web';\nimport type { FunctionComponent, PropsWithChildren, ReactNode } from 'react';\n\nimport { Backdrop } from './Backdrop';\nimport { Button } from './Buttons/Button';\nimport classnames from 'classnames';\n\nexport type ClosePopinCallback = () => void;\n\ninterface PopinFooterProps {\n closeLabel: string;\n onClose: ClosePopinCallback;\n}\n\nconst PopinFooter = ({ closeLabel, onClose }: PopinFooterProps) => {\n return (\n <Button\n color=\"black\"\n variant=\"circle\"\n icon=\"CrossDefault\"\n className=\"mx-auto\"\n aria-label={closeLabel}\n onClick={onClose}\n />\n );\n};\n\nexport interface PopinProps {\n title: ReactNode;\n closeLabel: string;\n onClose: ClosePopinCallback;\n isVisible: boolean;\n className?: string;\n showCloseButton?: boolean;\n Footer?: FunctionComponent<PopinFooterProps> | false;\n}\n\nexport const Popin: FunctionComponent<PropsWithChildren<PopinProps>> = ({\n title,\n children,\n closeLabel,\n onClose,\n isVisible,\n className = 'sm:w-360',\n Footer = PopinFooter,\n}) => {\n const transitions = useTransition(isVisible, {\n from: { scale: 0.3, opacity: 0.3 },\n enter: { scale: 1, opacity: 1 },\n leave: { scale: 0, opacity: 0 },\n config: isVisible ? { tension: 120, friction: 20 } : config.gentle,\n });\n\n return (\n <Backdrop isVisible={isVisible} onClose={onClose}>\n {transitions(\n (style, item) =>\n item && (\n <animated.div\n className={classnames(\n 'border-lightGrey rounded-16 pointer-events-auto mx-20 w-full border bg-white',\n className,\n )}\n style={style}\n >\n <div className=\"p-40 text-center max-h-[90vh] flex flex-col\">\n {title && <div className=\"mt-12 text-h5 text-start font-serif\">{title}</div>}\n <div className=\"mt-12 mb-40 last:mb-0 text-start overflow-auto\">{children}</div>\n {Footer && (\n <div>\n <Footer closeLabel={closeLabel} onClose={onClose} />\n </div>\n )}\n </div>\n </animated.div>\n ),\n )}\n </Backdrop>\n );\n};\n"],"names":["PopinFooter","closeLabel","onClose","jsx","Button","Popin","title","children","isVisible","className","Footer","transitions","useTransition","config","Backdrop","style","item","animated","classnames","jsxs"],"mappings":";;;;;AAcA,MAAMA,IAAc,CAAC,EAAE,YAAAC,GAAY,SAAAC,QAE/B,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,SAAQ;AAAA,IACR,MA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],"sourcesContent":["import type { FunctionComponent } from 'react';\n\ninterface SpinnerProps {\n /**\n * className\n */\n className?: string;\n}\n\nexport const Spinner: FunctionComponent<SpinnerProps> = ({ className }) => {\n return (\n <div className={className} aria-busy=\"true\" role=\"alert\" aria-live=\"polite\">\n <svg className=\"w-full animate-spin\" viewBox=\"0 0 26 26\" fill=\"none\">\n <circle cx=\"13\" cy=\"13\" r=\"12\" stroke=\"#CCCCCC\" strokeWidth=\"2\" />\n <circle\n className=\"animate-loaderDash origin-center\"\n cx=\"13\"\n cy=\"13\"\n r=\"12\"\n stroke=\"black\"\n strokeWidth=\"2\"\n strokeDasharray=\"38\"\n strokeDashoffset=\"38\"\n strokeLinecap=\"round\"\n />\n </svg>\n </div>\n );\n};\n"],"names":["Spinner","className","jsxs","jsx"],"mappings":";AASO,MAAMA,IAA2C,CAAC,EAAE,WAAAC,0BAEtD,
|
|
1
|
+
{"version":3,"file":"Spinner.js","sources":["../../lib/molecules/Spinner.tsx"],"sourcesContent":["import type { FunctionComponent } from 'react';\n\ninterface SpinnerProps {\n /**\n * className\n */\n className?: string;\n}\n\nexport const Spinner: FunctionComponent<SpinnerProps> = ({ className }) => {\n return (\n <div className={className} aria-busy=\"true\" role=\"alert\" aria-live=\"polite\">\n <svg className=\"w-full animate-spin\" viewBox=\"0 0 26 26\" fill=\"none\">\n <circle cx=\"13\" cy=\"13\" r=\"12\" stroke=\"#CCCCCC\" strokeWidth=\"2\" />\n <circle\n className=\"animate-loaderDash origin-center\"\n cx=\"13\"\n cy=\"13\"\n r=\"12\"\n stroke=\"black\"\n strokeWidth=\"2\"\n strokeDasharray=\"38\"\n strokeDashoffset=\"38\"\n strokeLinecap=\"round\"\n />\n </svg>\n </div>\n );\n};\n"],"names":["Spinner","className","jsxs","jsx"],"mappings":";AASO,MAAMA,IAA2C,CAAC,EAAE,WAAAC,0BAEtD,OAAA,EAAI,WAAAA,GAAsB,aAAU,QAAO,MAAK,SAAQ,aAAU,UACjE,UAAA,gBAAAC,EAAC,SAAI,WAAU,uBAAsB,SAAQ,aAAY,MAAK,QAC5D,UAAA;AAAA,EAAA,gBAAAC,EAAC,UAAA,EAAO,IAAG,MAAK,IAAG,MAAK,GAAE,MAAK,QAAO,WAAU,aAAY,IAAA,CAAI;AAAA,EAChE,gBAAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,IAAG;AAAA,MACH,IAAG;AAAA,MACH,GAAE;AAAA,MACF,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,iBAAgB;AAAA,MAChB,kBAAiB;AAAA,MACjB,eAAc;AAAA,IAAA;AAAA,EAAA;AAChB,EAAA,CACF,EAAA,CACF;"}
|
package/molecules/Tabs/Tab.d.ts
CHANGED
package/molecules/Tabs/Tab.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useRef as
|
|
5
|
-
import { animated as
|
|
6
|
-
import { useActiveTab as
|
|
7
|
-
import { getTheme as
|
|
8
|
-
import { useSafeBoop as
|
|
9
|
-
import { useKeyboardControls as
|
|
10
|
-
const f = "-z-1 rounded-pill absolute inset-0 duration-300",
|
|
11
|
-
className:
|
|
2
|
+
import { jsx as d, jsxs as j } from "react/jsx-runtime";
|
|
3
|
+
import { c as u } from "../../chunks/index.js";
|
|
4
|
+
import { useRef as m, useEffect as B, useCallback as r } from "react";
|
|
5
|
+
import { animated as I } from "@react-spring/web";
|
|
6
|
+
import { useActiveTab as P, useTabsUid as U, useRegisterTabControl as z } from "./hooks/tabControl.js";
|
|
7
|
+
import { getTheme as G } from "./theme.js";
|
|
8
|
+
import { useSafeBoop as M } from "../../hooks/useSafeBoop.js";
|
|
9
|
+
import { useKeyboardControls as O } from "../../hooks/useKeyboardControls.js";
|
|
10
|
+
const f = "-z-1 rounded-pill absolute inset-0 duration-300", X = ({
|
|
11
|
+
className: y,
|
|
12
12
|
label: a,
|
|
13
|
-
children:
|
|
14
|
-
value:
|
|
13
|
+
children: g,
|
|
14
|
+
value: o,
|
|
15
15
|
onSelect: i,
|
|
16
|
-
as:
|
|
16
|
+
as: T = "h2",
|
|
17
17
|
theme: h = "yellow"
|
|
18
18
|
}) => {
|
|
19
|
-
const p =
|
|
20
|
-
n.current =
|
|
21
|
-
const x = { "--tab-index":
|
|
22
|
-
|
|
19
|
+
const p = m(null), e = P(), b = U(), t = z({ value: o, ref: p }), l = m(e), n = m(e === o);
|
|
20
|
+
n.current = e === o;
|
|
21
|
+
const x = { "--tab-index": o }, { textColor: C, textColorActive: w, bgColor: A } = G(h), [N, c] = M({ scale: 1.02 });
|
|
22
|
+
B(() => {
|
|
23
23
|
var s;
|
|
24
|
-
l.current !==
|
|
25
|
-
}, [a,
|
|
26
|
-
const
|
|
24
|
+
l.current !== e && o === e && ((s = p.current) == null || s.focus(), i == null || i({ value: o, label: a })), l.current !== e && (l.current = e);
|
|
25
|
+
}, [a, o, i, e]);
|
|
26
|
+
const _ = r(() => {
|
|
27
27
|
n.current && c();
|
|
28
|
-
}, [c]),
|
|
28
|
+
}, [c]), k = r(() => {
|
|
29
29
|
t({ type: "start" });
|
|
30
|
-
}, [t]), k = r(() => {
|
|
31
|
-
t({ type: "end" });
|
|
32
30
|
}, [t]), L = r(() => {
|
|
33
|
-
t({ type: "
|
|
31
|
+
t({ type: "end" });
|
|
34
32
|
}, [t]), R = r(() => {
|
|
33
|
+
t({ type: "previous" });
|
|
34
|
+
}, [t]), v = r(() => {
|
|
35
35
|
t({ type: "next" });
|
|
36
36
|
}, [t]), E = r(() => {
|
|
37
37
|
const s = document.documentElement.dir === "rtl";
|
|
@@ -39,63 +39,65 @@ const f = "-z-1 rounded-pill absolute inset-0 duration-300", W = ({
|
|
|
39
39
|
}, [t]), K = r(() => {
|
|
40
40
|
const s = document.documentElement.dir === "rtl";
|
|
41
41
|
t({ type: s ? "previous" : "next" });
|
|
42
|
-
}, [t]),
|
|
43
|
-
activate:
|
|
44
|
-
start:
|
|
45
|
-
end:
|
|
46
|
-
up:
|
|
47
|
-
down:
|
|
42
|
+
}, [t]), $ = O({
|
|
43
|
+
activate: _,
|
|
44
|
+
start: k,
|
|
45
|
+
end: L,
|
|
46
|
+
up: R,
|
|
47
|
+
down: v,
|
|
48
48
|
left: E,
|
|
49
49
|
right: K
|
|
50
|
-
}),
|
|
51
|
-
t({ type: "update", payload:
|
|
52
|
-
}, [c, t,
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
|
|
50
|
+
}), D = r(() => {
|
|
51
|
+
t({ type: "update", payload: o }), n.current && c();
|
|
52
|
+
}, [c, t, o]);
|
|
53
|
+
return /* @__PURE__ */ d(
|
|
54
|
+
I.div,
|
|
55
55
|
{
|
|
56
|
+
id: `Tab_${o}_${b}`,
|
|
56
57
|
"data-name": "Tab",
|
|
57
58
|
ref: p,
|
|
58
59
|
role: "tab",
|
|
59
60
|
"aria-selected": n.current,
|
|
61
|
+
"aria-controls": `TabPanel_${o}_${b}`,
|
|
60
62
|
tabIndex: n.current ? 0 : -1,
|
|
61
|
-
style:
|
|
62
|
-
className:
|
|
63
|
+
style: N,
|
|
64
|
+
className: u(
|
|
63
65
|
"text-b3 group inline-block cursor-pointer overflow-hidden whitespace-nowrap bg-transparent pe-4 align-middle font-semibold outline-none",
|
|
64
|
-
|
|
66
|
+
y,
|
|
65
67
|
{
|
|
66
68
|
[C]: !n.current,
|
|
67
|
-
[
|
|
69
|
+
[w]: n.current
|
|
68
70
|
}
|
|
69
71
|
),
|
|
70
|
-
onKeyDown:
|
|
71
|
-
onClick:
|
|
72
|
-
children: /* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
72
|
+
onKeyDown: $,
|
|
73
|
+
onClick: D,
|
|
74
|
+
children: /* @__PURE__ */ j(T, { className: "relative inline-block px-20 py-12", children: [
|
|
75
|
+
/* @__PURE__ */ d(
|
|
74
76
|
"span",
|
|
75
77
|
{
|
|
76
|
-
className:
|
|
78
|
+
className: u(
|
|
77
79
|
"group-hover:bg-pearl group-focus-within:bg-pearl transition-colors",
|
|
78
80
|
f
|
|
79
81
|
)
|
|
80
82
|
}
|
|
81
83
|
),
|
|
82
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ d(
|
|
83
85
|
"span",
|
|
84
86
|
{
|
|
85
|
-
className:
|
|
87
|
+
className: u(
|
|
86
88
|
"tab-focus-pill ease transition-transform/colors",
|
|
87
89
|
f,
|
|
88
|
-
|
|
90
|
+
A
|
|
89
91
|
),
|
|
90
92
|
style: x
|
|
91
93
|
}
|
|
92
94
|
),
|
|
93
|
-
|
|
95
|
+
g ?? a
|
|
94
96
|
] })
|
|
95
97
|
}
|
|
96
98
|
);
|
|
97
99
|
};
|
|
98
100
|
export {
|
|
99
|
-
|
|
101
|
+
X as Tab
|
|
100
102
|
};
|
|
101
103
|
//# sourceMappingURL=Tab.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","sources":["../../../lib/molecules/Tabs/Tab.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport {\n type CSSProperties,\n type FunctionComponent,\n useCallback,\n useEffect,\n useRef,\n type PropsWithChildren,\n} from 'react';\n\nimport { animated } from 'react-spring';\n\nimport { useActiveTab, useRegisterTabControl } from './hooks/tabControl';\nimport { type Theme, getTheme } from './theme';\n\nimport { useSafeBoop } from '../../hooks/useSafeBoop';\nimport { useKeyboardControls } from '../../hooks/useKeyboardControls';\n\nimport './Tab.css';\n\nconst BACKGROUND_PILL_CLASSNAME = '-z-1 rounded-pill absolute inset-0 duration-300';\n\ninterface Props {\n className?: string;\n /**\n * Tab Heading text\n */\n label
|
|
1
|
+
{"version":3,"file":"Tab.js","sources":["../../../lib/molecules/Tabs/Tab.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport {\n type CSSProperties,\n type FunctionComponent,\n useCallback,\n useEffect,\n useRef,\n type PropsWithChildren,\n} from 'react';\n\nimport { animated } from 'react-spring';\n\nimport { useActiveTab, useRegisterTabControl, useTabsUid } from './hooks/tabControl';\nimport { type Theme, getTheme } from './theme';\n\nimport { useSafeBoop } from '../../hooks/useSafeBoop';\nimport { useKeyboardControls } from '../../hooks/useKeyboardControls';\n\nimport './Tab.css';\n\nconst BACKGROUND_PILL_CLASSNAME = '-z-1 rounded-pill absolute inset-0 duration-300';\n\ninterface Props {\n className?: string;\n /**\n * Tab Heading text\n */\n label?: string;\n /**\n * Tab heading index<br/>\n * _Can be **0** or **1** indexed_\n */\n value: number;\n /**\n * on tab select handler\n */\n onSelect?: (context: { value: Props['value']; label: Props['label'] }) => void;\n /**\n * Tab Heading theme\n */\n theme?: Theme;\n /**\n * Heading type\n * _default: **h2**_\n */\n as?: 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5';\n}\n\nexport const Tab: FunctionComponent<PropsWithChildren<Props>> = ({\n className,\n label,\n children,\n value,\n onSelect,\n as: TagName = 'h2',\n theme = 'yellow',\n}) => {\n const ref = useRef<HTMLDivElement>(null);\n\n const activeTab = useActiveTab();\n const uid = useTabsUid();\n const dispatch = useRegisterTabControl({ value, ref });\n const previousActiveTab = useRef(activeTab);\n\n const isActive = useRef(activeTab === value);\n isActive.current = activeTab === value;\n\n const pillStyle = { '--tab-index': value } as CSSProperties;\n const { textColor, textColorActive, bgColor } = getTheme(theme);\n const [boopStyle, boopTrigger] = useSafeBoop({ scale: 1.02 });\n\n useEffect(() => {\n if (previousActiveTab.current !== activeTab && value === activeTab) {\n ref.current?.focus();\n onSelect?.({ value, label });\n }\n if (previousActiveTab.current !== activeTab) {\n previousActiveTab.current = activeTab;\n }\n }, [label, value, onSelect, activeTab]);\n\n const activate = useCallback(() => {\n if (isActive.current) {\n boopTrigger();\n }\n }, [boopTrigger]);\n\n const start = useCallback(() => {\n dispatch({ type: 'start' });\n }, [dispatch]);\n\n const end = useCallback(() => {\n dispatch({ type: 'end' });\n }, [dispatch]);\n\n const up = useCallback(() => {\n dispatch({ type: 'previous' });\n }, [dispatch]);\n\n const down = useCallback(() => {\n dispatch({ type: 'next' });\n }, [dispatch]);\n\n const left = useCallback(() => {\n const isRTL = document.documentElement.dir === 'rtl';\n\n dispatch({ type: isRTL ? 'next' : 'previous' });\n }, [dispatch]);\n\n const right = useCallback(() => {\n const isRTL = document.documentElement.dir === 'rtl';\n\n dispatch({ type: isRTL ? 'previous' : 'next' });\n }, [dispatch]);\n\n const handleKeyDown = useKeyboardControls({\n activate,\n start,\n end,\n up,\n down,\n left,\n right,\n });\n\n const handleClick = useCallback(() => {\n dispatch({ type: 'update', payload: value });\n\n if (isActive.current) {\n boopTrigger();\n }\n }, [boopTrigger, dispatch, value]);\n\n return (\n <animated.div\n id={`Tab_${value}_${uid}`}\n data-name=\"Tab\"\n ref={ref}\n role=\"tab\"\n aria-selected={isActive.current}\n aria-controls={`TabPanel_${value}_${uid}`}\n tabIndex={isActive.current ? 0 : -1}\n style={boopStyle}\n className={classnames(\n 'text-b3 group inline-block cursor-pointer overflow-hidden whitespace-nowrap bg-transparent pe-4 align-middle font-semibold outline-none',\n className,\n {\n [textColor]: !isActive.current,\n [textColorActive]: isActive.current,\n },\n )}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n >\n <TagName className=\"relative inline-block px-20 py-12\">\n <span\n className={classnames(\n 'group-hover:bg-pearl group-focus-within:bg-pearl transition-colors',\n BACKGROUND_PILL_CLASSNAME,\n )}\n />\n <span\n className={classnames(\n 'tab-focus-pill ease transition-transform/colors',\n BACKGROUND_PILL_CLASSNAME,\n bgColor,\n )}\n style={pillStyle}\n />\n {children ?? label}\n </TagName>\n </animated.div>\n );\n};\n"],"names":["BACKGROUND_PILL_CLASSNAME","Tab","className","label","children","value","onSelect","TagName","theme","ref","useRef","activeTab","useActiveTab","uid","useTabsUid","dispatch","useRegisterTabControl","previousActiveTab","isActive","pillStyle","textColor","textColorActive","bgColor","getTheme","boopStyle","boopTrigger","useSafeBoop","useEffect","_a","activate","useCallback","start","end","up","down","left","isRTL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AAS,GAAG,CAACF,EAAS;AAAA,UACvB,CAACG,CAAe,GAAGH,EAAS;AAAA,QAAA;AAAA,MAC9B;AAAA,MAEF,WAAWoB;AAAA,MACX,SAASE;AAAA,MAET,UAAA,gBAAAI,EAACrC,GAAA,EAAQ,WAAU,qCACjB,UAAA;AAAA,QAAA,gBAAAkC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWE;AAAA,cACT;AAAA,cACA3C;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,QAEF,gBAAAyC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWE;AAAA,cACT;AAAA,cACA3C;AAAA,cACAsB;AAAA,YAAA;AAAA,YAEF,OAAOH;AAAA,UAAA;AAAA,QAAA;AAAA,QAERf,KAAYD;AAAA,MAAA,EAAA,CACf;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabList.js","sources":["../../../lib/molecules/Tabs/TabList.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport {\n type CSSProperties,\n useEffect,\n useRef,\n type FunctionComponent,\n type PropsWithChildren,\n} from 'react';\nimport { animated, useSpring } from '@react-spring/web';\n\nimport { useActiveTabControl } from './hooks/tabControl';\n\ninterface Props {\n className?: string;\n /**\n * Remove filler placeholders\n */\n constrained?: boolean;\n}\n\nexport const TabList: FunctionComponent<PropsWithChildren<Props>> = ({\n className,\n constrained = false,\n children,\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const spacerRef = useRef<HTMLDivElement>(null);\n const [currentTab, currentControl] = useActiveTabControl();\n\n const [{ scrollLeft }, scrollApi] = useSpring(() => ({\n from: { scrollLeft: 0 },\n }));\n\n useEffect(() => {\n if (!currentControl?.current) {\n return;\n }\n\n const tabLeft = currentControl.current.getBoundingClientRect().left;\n const scrollLeft = containerRef.current!.scrollLeft;\n const spacerWidth = spacerRef.current!.offsetWidth;\n\n scrollApi.start({\n to: {\n scrollLeft: scrollLeft + tabLeft - spacerWidth,\n },\n });\n }, [scrollLeft, currentControl, scrollApi]);\n\n const style = { '--active-tab': currentTab } as CSSProperties;\n\n return (\n <animated.div\n ref={containerRef}\n data-name=\"TabsHeader\"\n className={classnames(\n 'scrollbar-hide relative flex max-w-full overflow-x-scroll py-20',\n className,\n )}\n scrollLeft={scrollLeft}\n >\n <div role=\"tablist\" className={classnames('flex flex-row')} style={style}>\n <div\n ref={spacerRef}\n className={classnames('shrink-0', {\n 'w-16 lg:w-[max(calc((100vw-1212px)/2),116px)] xl:w-[max(calc((100vw-1212px)/2),156px)]':\n !constrained,\n })}\n />\n {children}\n <div\n className={classnames('shrink-0', {\n 'w-16 lg:w-[max(calc((100vw-1212px)/2),116px)] xl:w-[max(calc((100vw-1212px)/2),156px)]':\n !constrained,\n })}\n />\n </div>\n </animated.div>\n );\n};\n"],"names":["TabList","className","constrained","children","containerRef","useRef","spacerRef","currentTab","currentControl","useActiveTabControl","scrollLeft","scrollApi","useSpring","useEffect","tabLeft","spacerWidth","style","jsx","animated","classnames","jsxs"],"mappings":";;;;;;AAsBO,MAAMA,IAAuD,CAAC;AAAA,EACnE,WAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAAC;AACF,MAAM;
|
|
1
|
+
{"version":3,"file":"TabList.js","sources":["../../../lib/molecules/Tabs/TabList.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport {\n type CSSProperties,\n useEffect,\n useRef,\n type FunctionComponent,\n type PropsWithChildren,\n} from 'react';\nimport { animated, useSpring } from '@react-spring/web';\n\nimport { useActiveTabControl } from './hooks/tabControl';\n\ninterface Props {\n className?: string;\n /**\n * Remove filler placeholders\n */\n constrained?: boolean;\n}\n\nexport const TabList: FunctionComponent<PropsWithChildren<Props>> = ({\n className,\n constrained = false,\n children,\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const spacerRef = useRef<HTMLDivElement>(null);\n const [currentTab, currentControl] = useActiveTabControl();\n\n const [{ scrollLeft }, scrollApi] = useSpring(() => ({\n from: { scrollLeft: 0 },\n }));\n\n useEffect(() => {\n if (!currentControl?.current) {\n return;\n }\n\n const tabLeft = currentControl.current.getBoundingClientRect().left;\n const scrollLeft = containerRef.current!.scrollLeft;\n const spacerWidth = spacerRef.current!.offsetWidth;\n\n scrollApi.start({\n to: {\n scrollLeft: scrollLeft + tabLeft - spacerWidth,\n },\n });\n }, [scrollLeft, currentControl, scrollApi]);\n\n const style = { '--active-tab': currentTab } as CSSProperties;\n\n return (\n <animated.div\n ref={containerRef}\n data-name=\"TabsHeader\"\n className={classnames(\n 'scrollbar-hide relative flex max-w-full overflow-x-scroll py-20',\n className,\n )}\n scrollLeft={scrollLeft}\n >\n <div role=\"tablist\" className={classnames('flex flex-row')} style={style}>\n <div\n ref={spacerRef}\n className={classnames('shrink-0', {\n 'w-16 lg:w-[max(calc((100vw-1212px)/2),116px)] xl:w-[max(calc((100vw-1212px)/2),156px)]':\n !constrained,\n })}\n />\n {children}\n <div\n className={classnames('shrink-0', {\n 'w-16 lg:w-[max(calc((100vw-1212px)/2),116px)] xl:w-[max(calc((100vw-1212px)/2),156px)]':\n !constrained,\n })}\n />\n </div>\n </animated.div>\n );\n};\n"],"names":["TabList","className","constrained","children","containerRef","useRef","spacerRef","currentTab","currentControl","useActiveTabControl","scrollLeft","scrollApi","useSpring","useEffect","tabLeft","spacerWidth","style","jsx","animated","classnames","jsxs"],"mappings":";;;;;;AAsBO,MAAMA,IAAuD,CAAC;AAAA,EACnE,WAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAAC;AACF,MAAM;AACJ,QAAMC,IAAeC,EAAuB,IAAI,GAC1CC,IAAYD,EAAuB,IAAI,GACvC,CAACE,GAAYC,CAAc,IAAIC,EAAA,GAE/B,CAAC,EAAE,YAAAC,EAAA,GAAcC,CAAS,IAAIC,EAAU,OAAO;AAAA,IACnD,MAAM,EAAE,YAAY,EAAA;AAAA,EAAE,EACtB;AAE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