@stokelp/ui 4.0.3 → 4.1.1
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/components/alert/Alert.cjs +1 -1
- package/dist/components/alert/Alert.cjs.map +1 -1
- package/dist/components/alert/Alert.js +57 -53
- package/dist/components/alert/Alert.js.map +1 -1
- package/dist/components/combobox/Combobox.cjs +2 -2
- package/dist/components/combobox/Combobox.cjs.map +1 -1
- package/dist/components/combobox/Combobox.js +17 -17
- package/dist/components/date-picker/DatePicker.cjs +1 -1
- package/dist/components/date-picker/DatePicker.cjs.map +1 -1
- package/dist/components/date-picker/DatePicker.js +68 -53
- package/dist/components/date-picker/DatePicker.js.map +1 -1
- package/dist/components/dialog/styled.cjs +1 -1
- package/dist/components/dialog/styled.cjs.map +1 -1
- package/dist/components/dialog/styled.js +58 -54
- package/dist/components/dialog/styled.js.map +1 -1
- package/dist/components/drawer/Drawer.cjs +1 -1
- package/dist/components/drawer/Drawer.cjs.map +1 -1
- package/dist/components/drawer/Drawer.js +46 -42
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/pagination/Pagination.cjs +1 -1
- package/dist/components/pagination/Pagination.cjs.map +1 -1
- package/dist/components/pagination/Pagination.js +37 -36
- package/dist/components/pagination/Pagination.js.map +1 -1
- package/dist/components/select/Select.cjs +1 -1
- package/dist/components/select/Select.cjs.map +1 -1
- package/dist/components/select/Select.js +15 -15
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.cjs +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.cjs.map +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.js +4 -4
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.cjs +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.cjs.map +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.js +33 -33
- package/dist/components/ui-labels/UiLabelsProvider.cjs +1 -1
- package/dist/components/ui-labels/UiLabelsProvider.cjs.map +1 -1
- package/dist/components/ui-labels/UiLabelsProvider.d.ts +34 -2
- package/dist/components/ui-labels/UiLabelsProvider.js +32 -7
- package/dist/components/ui-labels/UiLabelsProvider.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +69 -69
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utils/slots.cjs"),n=require("../icon-button/IconButton.cjs"),
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utils/slots.cjs"),n=require("../ui-labels/UiLabelsProvider.cjs"),r=require("../icon-button/IconButton.cjs"),i=require("../drawer/Drawer.cjs");let a=require("@ark-ui/react"),o=require("@stokelp/styled-system/jsx"),s=require("@stokelp/styled-system/recipes"),c=require("react"),l=require("react/jsx-runtime"),u=require("usehooks-ts"),d=require("@stokelp/styled-system/tokens");var f=e.__exportAll({Backdrop:()=>g,Body:()=>S,CloseTrigger:()=>_,Content:()=>y,Footer:()=>C,Header:()=>x,Positioner:()=>w,Root:()=>h,Title:()=>T,Trigger:()=>E}),{withProvider:p,withContext:m}=t.createStyleContext(s.dialog,{dataAttr:!0}),h=p(a.Dialog.Root,void 0,{defaultProps:{lazyMount:!0,unmountOnExit:!0}}),g=m((0,o.styled)(a.Dialog.Backdrop),`backdrop`),_=m((0,o.styled)(a.Dialog.CloseTrigger),`closeTrigger`),v=(0,c.forwardRef)(({children:e,...t},n)=>{let r=(0,u.useMediaQuery)(`(max-width: ${(0,d.token)(`breakpoints.md`)})`,{defaultValue:!1}),{open:i,getContentProps:o}=(0,a.useDialogContext)();return(0,c.useLayoutEffect)(()=>{if(!i)return;let{id:e}=o();e&&setTimeout(()=>{let t=document.getElementById(e);if(t){let e=t.querySelector(`footer`);e&&(r?t.style.setProperty(`--footer-height`,`${Math.ceil(e.clientHeight)}px`):t.style.setProperty(`--footer-height`,`70px`))}},0)},[i,r]),(0,l.jsxs)(a.Portal,{children:[(0,l.jsx)(g,{}),(0,l.jsx)(w,{children:(0,l.jsx)(a.Dialog.Content,{ref:n,...t,children:e})})]})});v.displayName=a.Dialog.Content.displayName;var y=m((0,o.styled)(v),`content`),b=(0,c.forwardRef)(({children:e,showCloseTrigger:t=!0,...o},s)=>{let c=n.useUiLabels();return(0,l.jsxs)(a.ark.header,{...o,ref:s,children:[e,t&&(0,l.jsx)(i.DrawerCloseTrigger,{asChild:!0,children:(0,l.jsx)(r.IconButton,{ml:`auto`,"aria-label":c.close,variant:`tertiary`,children:(0,l.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z`,fill:`currentColor`})})})})]})});b.displayName=`DialogHeader`;var x=m((0,o.styled)(b),`header`),S=m((0,o.styled)(a.ark.main),`body`),C=m((0,o.styled)(a.ark.footer),`footer`),w=m((0,o.styled)(a.Dialog.Positioner),`positioner`),T=m((0,o.styled)(a.Dialog.Title),`title`),E=m((0,o.styled)(a.Dialog.Trigger),`trigger`);exports.Backdrop=g,exports.Body=S,exports.CloseTrigger=_,exports.Content=y,exports.Footer=C,exports.Header=x,exports.Positioner=w,exports.Root=h,exports.Title=T,exports.Trigger=E,Object.defineProperty(exports,"styled_exports",{enumerable:!0,get:function(){return f}});
|
|
2
2
|
//# sourceMappingURL=styled.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.cjs","names":["createStyleContext","dialog","ArkDialog","styled","forwardRef","useMediaQuery","token","useDialogContext","Portal","ark","DrawerCloseTrigger","IconButton","require_runtime","require_slots","require_IconButton","require_Drawer","_ark_ui_react","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","usehooks_ts","_stokelp_styled_system_tokens","styled_exports","Backdrop","Body","CloseTrigger","Content","Footer","Header","Positioner","Root","Title","Trigger","withProvider","withContext","InternalContent","props","isMobile","open","getContentProps","id","$content","$footer","InternalHeader","children","showCloseTrigger"],"sources":["../../../src/components/dialog/styled.tsx"],"sourcesContent":["import { ark, Dialog as ArkDialog, Portal, useDialogContext } from '@ark-ui/react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { dialog } from '@stokelp/styled-system/recipes'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\nimport { createStyleContext } from '~/utils/slots'\nimport { IconButton } from '~/components/icon-button'\nimport { DrawerCloseTrigger } from '~/components/drawer/Drawer'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { token } from '@stokelp/styled-system/tokens'\n\nconst { withProvider, withContext } = createStyleContext(dialog, {\n dataAttr: true,\n})\n\nexport const Root = withProvider(ArkDialog.Root, undefined, {\n defaultProps: {\n lazyMount: true,\n unmountOnExit: true,\n },\n})\nexport const Backdrop = withContext(styled(ArkDialog.Backdrop), 'backdrop')\nexport const CloseTrigger = withContext(styled(ArkDialog.CloseTrigger), 'closeTrigger')\n\nconst InternalContent = forwardRef<\n ElementRef<typeof ArkDialog.Content>,\n ComponentPropsWithoutRef<typeof ArkDialog.Content>\n>(({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n setTimeout(() => {\n const $content = document.getElementById(id)\n\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, 0)\n }, [open, isMobile])\n\n return (\n <Portal>\n <Backdrop />\n <Positioner>\n <ArkDialog.Content ref={ref} {...props}>\n {children}\n </ArkDialog.Content>\n </Positioner>\n </Portal>\n )\n})\nInternalContent.displayName = ArkDialog.Content.displayName\n\nexport const Content = withContext(styled(InternalContent), 'content')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\nconst InternalHeader = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => (\n <ark.header {...props} ref={ref}>\n
|
|
1
|
+
{"version":3,"file":"styled.cjs","names":["createStyleContext","dialog","ArkDialog","styled","forwardRef","useMediaQuery","token","useDialogContext","Portal","useUiLabels","ark","DrawerCloseTrigger","IconButton","require_runtime","require_slots","require_UiLabelsProvider","require_IconButton","require_Drawer","_ark_ui_react","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","usehooks_ts","_stokelp_styled_system_tokens","styled_exports","Backdrop","Body","CloseTrigger","Content","Footer","Header","Positioner","Root","Title","Trigger","withProvider","withContext","InternalContent","props","isMobile","open","getContentProps","id","$content","$footer","InternalHeader","labels","children","showCloseTrigger"],"sources":["../../../src/components/dialog/styled.tsx"],"sourcesContent":["import { ark, Dialog as ArkDialog, Portal, useDialogContext } from '@ark-ui/react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { dialog } from '@stokelp/styled-system/recipes'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\nimport { createStyleContext } from '~/utils/slots'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\nimport { IconButton } from '~/components/icon-button'\nimport { DrawerCloseTrigger } from '~/components/drawer/Drawer'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { token } from '@stokelp/styled-system/tokens'\n\nconst { withProvider, withContext } = createStyleContext(dialog, {\n dataAttr: true,\n})\n\nexport const Root = withProvider(ArkDialog.Root, undefined, {\n defaultProps: {\n lazyMount: true,\n unmountOnExit: true,\n },\n})\nexport const Backdrop = withContext(styled(ArkDialog.Backdrop), 'backdrop')\nexport const CloseTrigger = withContext(styled(ArkDialog.CloseTrigger), 'closeTrigger')\n\nconst InternalContent = forwardRef<\n ElementRef<typeof ArkDialog.Content>,\n ComponentPropsWithoutRef<typeof ArkDialog.Content>\n>(({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n setTimeout(() => {\n const $content = document.getElementById(id)\n\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, 0)\n }, [open, isMobile])\n\n return (\n <Portal>\n <Backdrop />\n <Positioner>\n <ArkDialog.Content ref={ref} {...props}>\n {children}\n </ArkDialog.Content>\n </Positioner>\n </Portal>\n )\n})\nInternalContent.displayName = ArkDialog.Content.displayName\n\nexport const Content = withContext(styled(InternalContent), 'content')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\nconst InternalHeader = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => {\n const labels = useUiLabels()\n return (\n <ark.header {...props} ref={ref}>\n {children}\n {showCloseTrigger && (\n <DrawerCloseTrigger asChild>\n <IconButton ml=\"auto\" aria-label={labels.close} variant=\"tertiary\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </DrawerCloseTrigger>\n )}\n </ark.header>\n )\n },\n)\nInternalHeader.displayName = 'DialogHeader'\n\nexport const Header = withContext(styled(InternalHeader), 'header')\nexport const Body = withContext(styled(ark.main), 'body')\nexport const Footer = withContext(styled(ark.footer), 'footer')\nexport const Positioner = withContext(styled(ArkDialog.Positioner), 'positioner')\nexport const Title = withContext(styled(ArkDialog.Title), 'title')\nexport const Trigger = withContext(styled(ArkDialog.Trigger), 'trigger')\n\nexport interface DialogProps extends ComponentProps<typeof Root> {}\nexport interface DialogBackdropProps extends ComponentProps<typeof Backdrop> {}\nexport interface DialogCloseTriggerProps extends ComponentProps<typeof CloseTrigger> {}\nexport interface DialogContentProps extends ComponentProps<typeof Content> {}\nexport interface DialogHeaderProps extends ComponentProps<typeof Header> {}\nexport interface DialogBodyProps extends ComponentProps<typeof Body> {}\nexport interface DialogFooterProps extends ComponentProps<typeof Footer> {}\nexport interface DialogPositionerProps extends ComponentProps<typeof Positioner> {}\nexport interface DialogT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AAAA,CAAOD,EAAAA,OAAU,UAAU,EAAG,YAAY,EACnEgC,EAAQG,GAAA,EAAYlC,EAAAA,OAAAA,CAAOD,EAAAA,OAAU,KAAK,EAAG,OAAO,EACpDiC,EAAUE,GAAA,EAAYlC,EAAAA,OAAAA,CAAOD,EAAAA,OAAU,OAAO,EAAG,SAAS,E"}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { __exportAll as e } from "../../_virtual/_rolldown/runtime.js";
|
|
3
3
|
import { createStyleContext as t } from "../../utils/slots.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
4
|
+
import { useUiLabels as n } from "../ui-labels/UiLabelsProvider.js";
|
|
5
|
+
import { IconButton as r } from "../icon-button/IconButton.js";
|
|
6
|
+
import { DrawerCloseTrigger as i } from "../drawer/Drawer.js";
|
|
7
|
+
import { Dialog as a, Portal as o, ark as s, useDialogContext as c } from "@ark-ui/react";
|
|
8
|
+
import { styled as l } from "@stokelp/styled-system/jsx";
|
|
9
|
+
import { dialog as u } from "@stokelp/styled-system/recipes";
|
|
10
|
+
import { forwardRef as d, useLayoutEffect as f } from "react";
|
|
11
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
|
+
import { useMediaQuery as h } from "usehooks-ts";
|
|
13
|
+
import { token as g } from "@stokelp/styled-system/tokens";
|
|
13
14
|
// src/components/dialog/styled.tsx
|
|
14
|
-
var
|
|
15
|
-
Backdrop: () =>
|
|
16
|
-
Body: () =>
|
|
17
|
-
CloseTrigger: () =>
|
|
18
|
-
Content: () =>
|
|
19
|
-
Footer: () =>
|
|
20
|
-
Header: () =>
|
|
21
|
-
Positioner: () =>
|
|
22
|
-
Root: () =>
|
|
23
|
-
Title: () =>
|
|
24
|
-
Trigger: () =>
|
|
25
|
-
}), { withProvider:
|
|
15
|
+
var _ = /* @__PURE__ */ e({
|
|
16
|
+
Backdrop: () => x,
|
|
17
|
+
Body: () => D,
|
|
18
|
+
CloseTrigger: () => S,
|
|
19
|
+
Content: () => w,
|
|
20
|
+
Footer: () => O,
|
|
21
|
+
Header: () => E,
|
|
22
|
+
Positioner: () => k,
|
|
23
|
+
Root: () => b,
|
|
24
|
+
Title: () => A,
|
|
25
|
+
Trigger: () => j
|
|
26
|
+
}), { withProvider: v, withContext: y } = t(u, { dataAttr: !0 }), b = v(a.Root, void 0, { defaultProps: {
|
|
26
27
|
lazyMount: !0,
|
|
27
28
|
unmountOnExit: !0
|
|
28
|
-
} }),
|
|
29
|
-
let r =
|
|
30
|
-
return
|
|
31
|
-
if (!
|
|
32
|
-
let { id: e } =
|
|
29
|
+
} }), x = y(l(a.Backdrop), "backdrop"), S = y(l(a.CloseTrigger), "closeTrigger"), C = d(({ children: e, ...t }, n) => {
|
|
30
|
+
let r = h(`(max-width: ${g("breakpoints.md")})`, { defaultValue: !1 }), { open: i, getContentProps: s } = c();
|
|
31
|
+
return f(() => {
|
|
32
|
+
if (!i) return;
|
|
33
|
+
let { id: e } = s();
|
|
33
34
|
e && setTimeout(() => {
|
|
34
35
|
let t = document.getElementById(e);
|
|
35
36
|
if (t) {
|
|
@@ -37,40 +38,43 @@ var g = /* @__PURE__ */ e({
|
|
|
37
38
|
e && (r ? t.style.setProperty("--footer-height", `${Math.ceil(e.clientHeight)}px`) : t.style.setProperty("--footer-height", "70px"));
|
|
38
39
|
}
|
|
39
40
|
}, 0);
|
|
40
|
-
}, [
|
|
41
|
+
}, [i, r]), /* @__PURE__ */ m(o, { children: [/* @__PURE__ */ p(x, {}), /* @__PURE__ */ p(k, { children: /* @__PURE__ */ p(a.Content, {
|
|
41
42
|
ref: n,
|
|
42
43
|
...t,
|
|
43
44
|
children: e
|
|
44
45
|
}) })] });
|
|
45
46
|
});
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
children: /* @__PURE__ */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
C.displayName = a.Content.displayName;
|
|
48
|
+
var w = y(l(C), "content"), T = d(({ children: e, showCloseTrigger: t = !0, ...a }, o) => {
|
|
49
|
+
let c = n();
|
|
50
|
+
return /* @__PURE__ */ m(s.header, {
|
|
51
|
+
...a,
|
|
52
|
+
ref: o,
|
|
53
|
+
children: [e, t && /* @__PURE__ */ p(i, {
|
|
54
|
+
asChild: !0,
|
|
55
|
+
children: /* @__PURE__ */ p(r, {
|
|
56
|
+
ml: "auto",
|
|
57
|
+
"aria-label": c.close,
|
|
58
|
+
variant: "tertiary",
|
|
59
|
+
children: /* @__PURE__ */ p("svg", {
|
|
60
|
+
width: "16",
|
|
61
|
+
height: "16",
|
|
62
|
+
viewBox: "0 0 16 16",
|
|
63
|
+
fill: "none",
|
|
64
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
65
|
+
children: /* @__PURE__ */ p("path", {
|
|
66
|
+
fillRule: "evenodd",
|
|
67
|
+
clipRule: "evenodd",
|
|
68
|
+
d: "M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z",
|
|
69
|
+
fill: "currentColor"
|
|
70
|
+
})
|
|
67
71
|
})
|
|
68
72
|
})
|
|
69
|
-
})
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
var
|
|
74
|
-
export {
|
|
73
|
+
})]
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
T.displayName = "DialogHeader";
|
|
77
|
+
var E = y(l(T), "header"), D = y(l(s.main), "body"), O = y(l(s.footer), "footer"), k = y(l(a.Positioner), "positioner"), A = y(l(a.Title), "title"), j = y(l(a.Trigger), "trigger");
|
|
78
|
+
export { x as Backdrop, D as Body, S as CloseTrigger, w as Content, O as Footer, E as Header, k as Positioner, b as Root, A as Title, j as Trigger, _ as styled_exports };
|
|
75
79
|
|
|
76
80
|
//# sourceMappingURL=styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","names":["ArkDialog","styled_exports","Backdrop","Body","CloseTrigger","Content","Footer","Header","Positioner","Root","Title","Trigger","createStyleContext","dialog","withProvider","Dialog","withContext","styled","InternalContent","forwardRef","props","isMobile","useMediaQuery","token","useDialogContext","useLayoutEffect","open","getContentProps","id","$content","$footer","Portal","InternalHeader","ark","children","showCloseTrigger","DrawerCloseTrigger","IconButton"],"sources":["../../../src/components/dialog/styled.tsx"],"sourcesContent":["import { ark, Dialog as ArkDialog, Portal, useDialogContext } from '@ark-ui/react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { dialog } from '@stokelp/styled-system/recipes'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\nimport { createStyleContext } from '~/utils/slots'\nimport { IconButton } from '~/components/icon-button'\nimport { DrawerCloseTrigger } from '~/components/drawer/Drawer'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { token } from '@stokelp/styled-system/tokens'\n\nconst { withProvider, withContext } = createStyleContext(dialog, {\n dataAttr: true,\n})\n\nexport const Root = withProvider(ArkDialog.Root, undefined, {\n defaultProps: {\n lazyMount: true,\n unmountOnExit: true,\n },\n})\nexport const Backdrop = withContext(styled(ArkDialog.Backdrop), 'backdrop')\nexport const CloseTrigger = withContext(styled(ArkDialog.CloseTrigger), 'closeTrigger')\n\nconst InternalContent = forwardRef<\n ElementRef<typeof ArkDialog.Content>,\n ComponentPropsWithoutRef<typeof ArkDialog.Content>\n>(({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n setTimeout(() => {\n const $content = document.getElementById(id)\n\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, 0)\n }, [open, isMobile])\n\n return (\n <Portal>\n <Backdrop />\n <Positioner>\n <ArkDialog.Content ref={ref} {...props}>\n {children}\n </ArkDialog.Content>\n </Positioner>\n </Portal>\n )\n})\nInternalContent.displayName = ArkDialog.Content.displayName\n\nexport const Content = withContext(styled(InternalContent), 'content')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\nconst InternalHeader = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => (\n <ark.header {...props} ref={ref}>\n
|
|
1
|
+
{"version":3,"file":"styled.js","names":["ArkDialog","styled_exports","Backdrop","Body","CloseTrigger","Content","Footer","Header","Positioner","Root","Title","Trigger","createStyleContext","dialog","withProvider","Dialog","withContext","styled","InternalContent","forwardRef","props","isMobile","useMediaQuery","token","useDialogContext","useLayoutEffect","open","getContentProps","id","$content","$footer","Portal","InternalHeader","labels","useUiLabels","ark","children","showCloseTrigger","DrawerCloseTrigger","IconButton"],"sources":["../../../src/components/dialog/styled.tsx"],"sourcesContent":["import { ark, Dialog as ArkDialog, Portal, useDialogContext } from '@ark-ui/react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { dialog } from '@stokelp/styled-system/recipes'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\nimport { createStyleContext } from '~/utils/slots'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\nimport { IconButton } from '~/components/icon-button'\nimport { DrawerCloseTrigger } from '~/components/drawer/Drawer'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { token } from '@stokelp/styled-system/tokens'\n\nconst { withProvider, withContext } = createStyleContext(dialog, {\n dataAttr: true,\n})\n\nexport const Root = withProvider(ArkDialog.Root, undefined, {\n defaultProps: {\n lazyMount: true,\n unmountOnExit: true,\n },\n})\nexport const Backdrop = withContext(styled(ArkDialog.Backdrop), 'backdrop')\nexport const CloseTrigger = withContext(styled(ArkDialog.CloseTrigger), 'closeTrigger')\n\nconst InternalContent = forwardRef<\n ElementRef<typeof ArkDialog.Content>,\n ComponentPropsWithoutRef<typeof ArkDialog.Content>\n>(({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n setTimeout(() => {\n const $content = document.getElementById(id)\n\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, 0)\n }, [open, isMobile])\n\n return (\n <Portal>\n <Backdrop />\n <Positioner>\n <ArkDialog.Content ref={ref} {...props}>\n {children}\n </ArkDialog.Content>\n </Positioner>\n </Portal>\n )\n})\nInternalContent.displayName = ArkDialog.Content.displayName\n\nexport const Content = withContext(styled(InternalContent), 'content')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\nconst InternalHeader = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => {\n const labels = useUiLabels()\n return (\n <ark.header {...props} ref={ref}>\n {children}\n {showCloseTrigger && (\n <DrawerCloseTrigger asChild>\n <IconButton ml=\"auto\" aria-label={labels.close} variant=\"tertiary\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </DrawerCloseTrigger>\n )}\n </ark.header>\n )\n },\n)\nInternalHeader.displayName = 'DialogHeader'\n\nexport const Header = withContext(styled(InternalHeader), 'header')\nexport const Body = withContext(styled(ark.main), 'body')\nexport const Footer = withContext(styled(ark.footer), 'footer')\nexport const Positioner = withContext(styled(ArkDialog.Positioner), 'positioner')\nexport const Title = withContext(styled(ArkDialog.Title), 'title')\nexport const Trigger = withContext(styled(ArkDialog.Trigger), 'trigger')\n\nexport interface DialogProps extends ComponentProps<typeof Root> {}\nexport interface DialogBackdropProps extends ComponentProps<typeof Backdrop> {}\nexport interface DialogCloseTriggerProps extends ComponentProps<typeof CloseTrigger> {}\nexport interface DialogContentProps extends ComponentProps<typeof Content> {}\nexport interface DialogHeaderProps extends ComponentProps<typeof Header> {}\nexport interface DialogBodyProps extends ComponentProps<typeof Body> {}\nexport interface DialogFooterProps extends ComponentProps<typeof Footer> {}\nexport interface DialogPositionerProps extends ComponentProps<typeof Positioner> {}\nexport interface DialogTitleProps extends ComponentProps<typeof Title> {}\nexport interface DialogTriggerProps extends ComponentProps<typeof Trigger> {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;A,IAWM,EAAE,iBAAc,mBAAgBY,EAAmBC,GAAQ,EAC/D,UAAU,GACZ,CAAC,GAEYJ,IAAOK,EAAad,EAAU,MAAM,KAAA,GAAW,EAC1D,cAAc;CACZ,WAAW;CACX,eAAe;AACjB,EACF,CAAC,GACYE,IAAWc,EAAYC,EAAOjB,EAAU,QAAQ,GAAG,UAAU,GAC7DI,IAAeY,EAAYC,EAAOjB,EAAU,YAAY,GAAG,cAAc,GAEhFkB,IAAkBC,GAGrB,EAAE,aAAU,GAAGC,KAAS,MAAQ;CACjC,IAAMC,IAAWC,EAAc,eAAeC,EAAM,gBAAgB,EAAE,IAAI,EACxE,cAAc,GAChB,CAAC,GACK,EAAE,SAAM,uBAAoBC,EAAiB;CAsBnD,OApBAC,QAAsB;EACpB,IAAI,CAACC,GAAM;EACX,IAAM,EAAE,UAAOC,EAAgB;EAC/B,AAAKC,KACL,iBAAiB;GACf,IAAMC,IAAW,SAAS,eAAeD,CAAE;GAE3C,IAAIC,GAAU;IACZ,IAAMC,IAAUD,EAAS,cAAc,QAAQ;IAC/C,AAAIC,MACET,IACFQ,EAAS,MAAM,YAAY,mBAAmB,GAAG,KAAK,KAAKC,EAAQ,YAAY,EAAE,GAAG,IAEpFD,EAAS,MAAM,YAAY,mBAAmB,MAAM;GAG1D;EACF,GAAG,CAAC;CACN,GAAG,CAACH,GAAML,CAAQ,CAAC,GAGjB,kBAACU,GAAD,EAAA,UAAA,CACE,kBAAC7B,GAAD,CAAW,CAAA,GACX,kBAACM,GAAD,EAAA,UACE,kBAACR,EAAU,SAAX;EAAwB;EAAK,GAAIoB;EAC9B;CACgB,CAAA,EACT,CAAA,CACN,EAAA,CAAA;AAEZ,CAAC;AACD,EAAgB,cAAcpB,EAAU,QAAQ;AAEhD,IAAaK,IAAUW,EAAYC,EAAOC,CAAe,GAAG,SAAS,GAK/Dc,IAAiBb,GACpB,EAAE,aAAU,sBAAmB,IAAM,GAAGC,KAAS,MAAQ;CACxD,IAAMa,IAASC,EAAY;CAC3B,OACE,kBAACC,EAAI,QAAL;EAAY,GAAIf;EAAY;EAA5B,UAAA,CACGgB,GACAC,KACC,kBAACC,GAAD;GAAoB,SAAA;GAClB,UAAA,kBAACC,GAAD;IAAY,IAAG;IAAO,cAAYN,EAAO;IAAO,SAAQ;IACtD,UAAA,kBAAC,OAAD;KAAK,OAAM;KAAK,QAAO;KAAK,SAAQ;KAAY,MAAK;KAAO,OAAM;KAChE,UAAA,kBAAC,QAAD;MACE,UAAS;MACT,UAAS;MACT,GAAE;MACF,MAAK;KACN,CAAA;IACE,CAAA;GACK,CAAA;EACM,CAAA,CAEZ;;AAEhB,CACF;AACA,EAAe,cAAc;AAE7B,IAAa1B,IAASS,EAAYC,EAAOe,CAAc,GAAG,QAAQ,GACrD7B,IAAOa,EAAYC,EAAOkB,EAAI,IAAI,GAAG,MAAM,GAC3C7B,IAASU,EAAYC,EAAOkB,EAAI,MAAM,GAAG,QAAQ,GACjD3B,IAAaQ,EAAYC,EAAOjB,EAAU,UAAU,GAAG,YAAY,GACnEU,IAAQM,EAAYC,EAAOjB,EAAU,KAAK,GAAG,OAAO,GACpDW,IAAUK,EAAYC,EAAOjB,EAAU,OAAO,GAAG,SAAS"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../../utils/slots.cjs"),t=require("../icon-button/IconButton.cjs");let
|
|
1
|
+
"use client";const e=require("../../utils/slots.cjs"),t=require("../ui-labels/UiLabelsProvider.cjs"),n=require("../icon-button/IconButton.cjs");let r=require("@ark-ui/react"),i=require("@stokelp/styled-system/jsx"),a=require("@stokelp/styled-system/recipes"),o=require("react"),s=require("react/jsx-runtime"),c=require("usehooks-ts"),l=require("@stokelp/styled-system/tokens");var{withProvider:u,withContext:d}=e.createStyleContext(a.drawer),f=u(r.Dialog.Root,void 0,{defaultProps:{unmountOnExit:!0,lazyMount:!0}}),p=d((0,i.styled)(r.ark.main),`body`),m=d((0,i.styled)(r.Dialog.CloseTrigger),`closeTrigger`),h=d((0,i.styled)(r.ark.footer),`footer`),g=(0,o.forwardRef)(({children:e,showCloseTrigger:i=!0,...a},o)=>{let c=t.useUiLabels();return(0,s.jsxs)(r.ark.header,{...a,ref:o,children:[e,i&&(0,s.jsx)(m,{asChild:!0,children:(0,s.jsx)(n.IconButton,{ml:`auto`,"aria-label":c.close,variant:`tertiary`,children:(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,s.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z`,fill:`currentColor`})})})})]})});g.displayName=`DrawerHeader`;var _=d(g,`header`),v=d((0,i.styled)(r.Dialog.Title),`title`),y=d((0,i.styled)(r.Dialog.Trigger),`trigger`),b=d((0,i.styled)(r.Dialog.Positioner),`positioner`),x=d((0,i.styled)(r.Dialog.Backdrop),`backdrop`),S=(0,o.forwardRef)(({children:e,...t},n)=>{let i=(0,c.useMediaQuery)(`(max-width: ${(0,l.token)(`breakpoints.md`)})`,{defaultValue:!1}),{open:a,getContentProps:u}=(0,r.useDialogContext)();return(0,o.useLayoutEffect)(()=>{if(!a)return;let{id:e}=u();if(!e)return;let t=document.getElementById(e);if(t){let e=t.querySelector(`footer`);e&&(i?t.style.setProperty(`--footer-height`,`${Math.ceil(e.clientHeight)}px`):t.style.setProperty(`--footer-height`,`70px`))}},[a,i]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(x,{}),(0,s.jsx)(b,{children:(0,s.jsx)(r.Dialog.Content,{ref:n,...t,children:e})})]})});S.displayName=r.Dialog.Content.displayName;var C=d((0,i.styled)(S),`content`),w=r.Dialog.Context;exports.Drawer=f,exports.DrawerBody=p,exports.DrawerCloseTrigger=m,exports.DrawerContent=C,exports.DrawerContext=w,exports.DrawerFooter=h,exports.DrawerHeader=_,exports.DrawerTitle=v,exports.DrawerTrigger=y;
|
|
2
2
|
//# sourceMappingURL=Drawer.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.cjs","names":["createStyleContext","drawer","ArkDrawer","styled","ark","forwardRef","IconButton","useMediaQuery","token","useDialogContext","_Fragment","require_slots","require_IconButton","_ark_ui_react","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","usehooks_ts","_stokelp_styled_system_tokens","Drawer","withProvider","DrawerBody","withContext","DrawerCloseTrigger","DrawerFooter","Header","props","children","showCloseTrigger","DrawerHeader","DrawerTitle","DrawerTrigger","DrawerPositioner","DrawerBackdrop","Content","isMobile","open","getContentProps","id","$content","$footer","DrawerContent","DrawerContext"],"sources":["../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["import { ark, Dialog as ArkDrawer, useDialogContext } from '@ark-ui/react'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { drawer } from '@stokelp/styled-system/recipes'\nimport { token } from '@stokelp/styled-system/tokens'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\n\nimport { createStyleContext } from '~/utils/slots'\nimport { IconButton } from '~/components/icon-button'\n\nconst { withProvider, withContext } = createStyleContext(drawer)\n\nexport const Drawer = withProvider(ArkDrawer.Root, undefined, {\n defaultProps: {\n unmountOnExit: true,\n lazyMount: true,\n },\n})\nexport const DrawerBody = withContext(styled(ark.main), 'body')\nexport const DrawerCloseTrigger = withContext(styled(ArkDrawer.CloseTrigger), 'closeTrigger')\nexport const DrawerFooter = withContext(styled(ark.footer), 'footer')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\n\nconst Header = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => (\n <ark.header {...props} ref={ref}>\n
|
|
1
|
+
{"version":3,"file":"Drawer.cjs","names":["createStyleContext","drawer","ArkDrawer","styled","ark","forwardRef","useUiLabels","IconButton","useMediaQuery","token","useDialogContext","_Fragment","require_slots","require_UiLabelsProvider","require_IconButton","_ark_ui_react","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","usehooks_ts","_stokelp_styled_system_tokens","Drawer","withProvider","DrawerBody","withContext","DrawerCloseTrigger","DrawerFooter","Header","props","labels","children","showCloseTrigger","DrawerHeader","DrawerTitle","DrawerTrigger","DrawerPositioner","DrawerBackdrop","Content","isMobile","open","getContentProps","id","$content","$footer","DrawerContent","DrawerContext"],"sources":["../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["import { ark, Dialog as ArkDrawer, useDialogContext } from '@ark-ui/react'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { drawer } from '@stokelp/styled-system/recipes'\nimport { token } from '@stokelp/styled-system/tokens'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\n\nimport { createStyleContext } from '~/utils/slots'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\nimport { IconButton } from '~/components/icon-button'\n\nconst { withProvider, withContext } = createStyleContext(drawer)\n\nexport const Drawer = withProvider(ArkDrawer.Root, undefined, {\n defaultProps: {\n unmountOnExit: true,\n lazyMount: true,\n },\n})\nexport const DrawerBody = withContext(styled(ark.main), 'body')\nexport const DrawerCloseTrigger = withContext(styled(ArkDrawer.CloseTrigger), 'closeTrigger')\nexport const DrawerFooter = withContext(styled(ark.footer), 'footer')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\n\nconst Header = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => {\n const labels = useUiLabels()\n return (\n <ark.header {...props} ref={ref}>\n {children}\n {showCloseTrigger && (\n <DrawerCloseTrigger asChild>\n <IconButton ml=\"auto\" aria-label={labels.close} variant=\"tertiary\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </DrawerCloseTrigger>\n )}\n </ark.header>\n )\n },\n)\nHeader.displayName = 'DrawerHeader'\n\nexport const DrawerHeader = withContext(Header, 'header')\nexport const DrawerTitle = withContext(styled(ArkDrawer.Title), 'title')\nexport const DrawerTrigger = withContext(styled(ArkDrawer.Trigger), 'trigger')\n\nconst DrawerPositioner = withContext(styled(ArkDrawer.Positioner), 'positioner')\nconst DrawerBackdrop = withContext(styled(ArkDrawer.Backdrop), 'backdrop')\n\nconst Content = forwardRef<ElementRef<typeof ArkDrawer.Content>, ComponentPropsWithoutRef<typeof ArkDrawer.Content>>(\n ({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n const $content = document.getElementById(id)\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, [open, isMobile])\n\n return (\n <>\n <DrawerBackdrop />\n <DrawerPositioner>\n <ArkDrawer.Content ref={ref} {...props}>\n {children}\n </ArkDrawer.Content>\n </DrawerPositioner>\n </>\n )\n },\n)\nContent.displayName = ArkDrawer.Content.displayName\n\nexport const DrawerContent = withContext(styled(Content), 'content')\nexport const DrawerContext = ArkDrawer.Context\n\nexport interface DrawerProps extends ComponentProps<typeof Drawer> {}\nexport interface DrawerBackdropProps extends ComponentProps<typeof DrawerBackdrop> {}\nexport interface DrawerBodyProps extends ComponentProps<typeof DrawerBody> {}\nexport interface DrawerCloseTriggerProps extends ComponentProps<typeof DrawerCloseTrigger> {}\nexport interface DrawerContentProps extends ComponentProps<typeof DrawerContent> {}\nexport interface DrawerFooterProps extends ComponentProps<typeof DrawerFooter> {}\nexport interface DrawerHeaderProps extends ComponentProps<typeof DrawerHeader> {}\nexport interface DrawerPositionerProps extends ComponentProps<typeof DrawerPositioner> {}\nexport interface DrawerTitleProps extends ComponentProps<typeof DrawerTitle> {}\nexport interface DrawerTriggerProps extends ComponentProps<typeof DrawerTrigger> {}\nexport interface DrawerContextProps extends ComponentProps<typeof DrawerContext> {}\n"],"mappings":"A,yXAWA,GAAM,CAAE,eAAc,eAAgBA,EAAAA,mBAAmBC,EAAAA,MAAM,EAElDqB,EAASC,EAAarB,EAAAA,OAAU,KAAM,IAAA,GAAW,CAC5D,aAAc,CACZ,cAAe,GACf,UAAW,EACb,CACF,CAAC,EACYsB,EAAaC,GAAA,EAAYtB,EAAAA,OAAAA,CAAOC,EAAAA,IAAI,IAAI,EAAG,MAAM,EACjDsB,EAAqBD,GAAA,EAAYtB,EAAAA,OAAAA,CAAOD,EAAAA,OAAU,YAAY,EAAG,cAAc,EAC/EyB,EAAeF,GAAA,EAAYtB,EAAAA,OAAAA,CAAOC,EAAAA,IAAI,MAAM,EAAG,QAAQ,EAM9DwB,GAAA,EAASvB,EAAAA,WAAAA,EACZ,CAAE,WAAU,mBAAmB,GAAM,GAAGwB,GAAS,IAAQ,CACxD,IAAMC,EAASxB,EAAAA,YAAY,EAC3B,OACE,EAAAa,EAAA,KAAA,CAACf,EAAAA,IAAI,OAAL,CAAY,GAAIyB,EAAY,MAA5B,SAAA,CACGE,EACAC,IACC,EAAAb,EAAA,IAAA,CAACO,EAAD,CAAoB,QAAA,GAClB,UAAA,EAAAP,EAAA,IAAA,CAACZ,EAAAA,WAAD,CAAY,GAAG,OAAO,aAAYuB,EAAO,MAAO,QAAQ,WACtD,UAAA,EAAAX,EAAA,IAAA,CAAC,MAAD,CAAK,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAChE,UAAA,EAAAA,EAAA,IAAA,CAAC,OAAD,CACE,SAAS,UACT,SAAS,UACT,EAAE,4fACF,KAAK,cACN,CAAA,CACE,CAAA,CACK,CAAA,CACM,CAAA,CAEZ,C,EAEhB,C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,EAAA,IAAA,CAACjB,EAAAA,OAAU,QAAX,CAAwB,MAAK,GAAI2B,EAC9B,UACgB,CAAA,CACH,CAAA,CAClB,CAAA,CAAA,CAEN,CACF,EACA,EAAQ,YAAc3B,EAAAA,OAAU,QAAQ,YAExC,IAAa2C,EAAgBpB,GAAA,EAAYtB,EAAAA,OAAAA,CAAOmC,CAAO,EAAG,SAAS,EACtDQ,EAAgB5C,EAAAA,OAAU,Q"}
|
|
@@ -1,62 +1,66 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createStyleContext as e } from "../../utils/slots.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
3
|
+
import { useUiLabels as t } from "../ui-labels/UiLabelsProvider.js";
|
|
4
|
+
import { IconButton as n } from "../icon-button/IconButton.js";
|
|
5
|
+
import { Dialog as r, ark as i, useDialogContext as a } from "@ark-ui/react";
|
|
6
|
+
import { styled as o } from "@stokelp/styled-system/jsx";
|
|
7
|
+
import { drawer as s } from "@stokelp/styled-system/recipes";
|
|
8
|
+
import { forwardRef as c, useLayoutEffect as l } from "react";
|
|
9
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import { useMediaQuery as p } from "usehooks-ts";
|
|
11
|
+
import { token as m } from "@stokelp/styled-system/tokens";
|
|
11
12
|
// src/components/drawer/Drawer.tsx
|
|
12
|
-
var { withProvider:
|
|
13
|
+
var { withProvider: h, withContext: g } = e(s), _ = h(r.Root, void 0, { defaultProps: {
|
|
13
14
|
unmountOnExit: !0,
|
|
14
15
|
lazyMount: !0
|
|
15
|
-
} }),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
children: /* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
} }), v = g(o(i.main), "body"), y = g(o(r.CloseTrigger), "closeTrigger"), b = g(o(i.footer), "footer"), x = c(({ children: e, showCloseTrigger: r = !0, ...a }, o) => {
|
|
17
|
+
let s = t();
|
|
18
|
+
return /* @__PURE__ */ f(i.header, {
|
|
19
|
+
...a,
|
|
20
|
+
ref: o,
|
|
21
|
+
children: [e, r && /* @__PURE__ */ d(y, {
|
|
22
|
+
asChild: !0,
|
|
23
|
+
children: /* @__PURE__ */ d(n, {
|
|
24
|
+
ml: "auto",
|
|
25
|
+
"aria-label": s.close,
|
|
26
|
+
variant: "tertiary",
|
|
27
|
+
children: /* @__PURE__ */ d("svg", {
|
|
28
|
+
width: "16",
|
|
29
|
+
height: "16",
|
|
30
|
+
viewBox: "0 0 16 16",
|
|
31
|
+
fill: "none",
|
|
32
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
33
|
+
children: /* @__PURE__ */ d("path", {
|
|
34
|
+
fillRule: "evenodd",
|
|
35
|
+
clipRule: "evenodd",
|
|
36
|
+
d: "M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z",
|
|
37
|
+
fill: "currentColor"
|
|
38
|
+
})
|
|
35
39
|
})
|
|
36
40
|
})
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
let
|
|
43
|
-
return
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
x.displayName = "DrawerHeader";
|
|
45
|
+
var S = g(x, "header"), C = g(o(r.Title), "title"), w = g(o(r.Trigger), "trigger"), T = g(o(r.Positioner), "positioner"), E = g(o(r.Backdrop), "backdrop"), D = c(({ children: e, ...t }, n) => {
|
|
46
|
+
let i = p(`(max-width: ${m("breakpoints.md")})`, { defaultValue: !1 }), { open: o, getContentProps: s } = a();
|
|
47
|
+
return l(() => {
|
|
44
48
|
if (!o) return;
|
|
45
49
|
let { id: e } = s();
|
|
46
50
|
if (!e) return;
|
|
47
51
|
let t = document.getElementById(e);
|
|
48
52
|
if (t) {
|
|
49
53
|
let e = t.querySelector("footer");
|
|
50
|
-
e && (
|
|
54
|
+
e && (i ? t.style.setProperty("--footer-height", `${Math.ceil(e.clientHeight)}px`) : t.style.setProperty("--footer-height", "70px"));
|
|
51
55
|
}
|
|
52
|
-
}, [o,
|
|
53
|
-
ref:
|
|
56
|
+
}, [o, i]), /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(E, {}), /* @__PURE__ */ d(T, { children: /* @__PURE__ */ d(r.Content, {
|
|
57
|
+
ref: n,
|
|
54
58
|
...t,
|
|
55
59
|
children: e
|
|
56
60
|
}) })] });
|
|
57
61
|
});
|
|
58
|
-
|
|
59
|
-
var
|
|
60
|
-
export {
|
|
62
|
+
D.displayName = r.Content.displayName;
|
|
63
|
+
var O = g(o(D), "content"), k = r.Context;
|
|
64
|
+
export { _ as Drawer, v as DrawerBody, y as DrawerCloseTrigger, O as DrawerContent, k as DrawerContext, b as DrawerFooter, S as DrawerHeader, C as DrawerTitle, w as DrawerTrigger };
|
|
61
65
|
|
|
62
66
|
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","names":["ArkDrawer","_Fragment","Fragment$1","createStyleContext","drawer","Drawer","withProvider","Dialog","DrawerBody","withContext","styled","ark","DrawerCloseTrigger","DrawerFooter","Header","forwardRef","props","children","showCloseTrigger","IconButton","DrawerHeader","DrawerTitle","DrawerTrigger","DrawerPositioner","DrawerBackdrop","Content","isMobile","useMediaQuery","token","useDialogContext","useLayoutEffect","open","getContentProps","id","$content","$footer","DrawerContent","DrawerContext"],"sources":["../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["import { ark, Dialog as ArkDrawer, useDialogContext } from '@ark-ui/react'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { drawer } from '@stokelp/styled-system/recipes'\nimport { token } from '@stokelp/styled-system/tokens'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\n\nimport { createStyleContext } from '~/utils/slots'\nimport { IconButton } from '~/components/icon-button'\n\nconst { withProvider, withContext } = createStyleContext(drawer)\n\nexport const Drawer = withProvider(ArkDrawer.Root, undefined, {\n defaultProps: {\n unmountOnExit: true,\n lazyMount: true,\n },\n})\nexport const DrawerBody = withContext(styled(ark.main), 'body')\nexport const DrawerCloseTrigger = withContext(styled(ArkDrawer.CloseTrigger), 'closeTrigger')\nexport const DrawerFooter = withContext(styled(ark.footer), 'footer')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\n\nconst Header = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => (\n <ark.header {...props} ref={ref}>\n
|
|
1
|
+
{"version":3,"file":"Drawer.js","names":["ArkDrawer","_Fragment","Fragment$1","createStyleContext","drawer","Drawer","withProvider","Dialog","DrawerBody","withContext","styled","ark","DrawerCloseTrigger","DrawerFooter","Header","forwardRef","props","labels","useUiLabels","children","showCloseTrigger","IconButton","DrawerHeader","DrawerTitle","DrawerTrigger","DrawerPositioner","DrawerBackdrop","Content","isMobile","useMediaQuery","token","useDialogContext","useLayoutEffect","open","getContentProps","id","$content","$footer","DrawerContent","DrawerContext"],"sources":["../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["import { ark, Dialog as ArkDrawer, useDialogContext } from '@ark-ui/react'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { drawer } from '@stokelp/styled-system/recipes'\nimport { token } from '@stokelp/styled-system/tokens'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\n\nimport { createStyleContext } from '~/utils/slots'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\nimport { IconButton } from '~/components/icon-button'\n\nconst { withProvider, withContext } = createStyleContext(drawer)\n\nexport const Drawer = withProvider(ArkDrawer.Root, undefined, {\n defaultProps: {\n unmountOnExit: true,\n lazyMount: true,\n },\n})\nexport const DrawerBody = withContext(styled(ark.main), 'body')\nexport const DrawerCloseTrigger = withContext(styled(ArkDrawer.CloseTrigger), 'closeTrigger')\nexport const DrawerFooter = withContext(styled(ark.footer), 'footer')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\n\nconst Header = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => {\n const labels = useUiLabels()\n return (\n <ark.header {...props} ref={ref}>\n {children}\n {showCloseTrigger && (\n <DrawerCloseTrigger asChild>\n <IconButton ml=\"auto\" aria-label={labels.close} variant=\"tertiary\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </DrawerCloseTrigger>\n )}\n </ark.header>\n )\n },\n)\nHeader.displayName = 'DrawerHeader'\n\nexport const DrawerHeader = withContext(Header, 'header')\nexport const DrawerTitle = withContext(styled(ArkDrawer.Title), 'title')\nexport const DrawerTrigger = withContext(styled(ArkDrawer.Trigger), 'trigger')\n\nconst DrawerPositioner = withContext(styled(ArkDrawer.Positioner), 'positioner')\nconst DrawerBackdrop = withContext(styled(ArkDrawer.Backdrop), 'backdrop')\n\nconst Content = forwardRef<ElementRef<typeof ArkDrawer.Content>, ComponentPropsWithoutRef<typeof ArkDrawer.Content>>(\n ({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n const $content = document.getElementById(id)\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, [open, isMobile])\n\n return (\n <>\n <DrawerBackdrop />\n <DrawerPositioner>\n <ArkDrawer.Content ref={ref} {...props}>\n {children}\n </ArkDrawer.Content>\n </DrawerPositioner>\n </>\n )\n },\n)\nContent.displayName = ArkDrawer.Content.displayName\n\nexport const DrawerContent = withContext(styled(Content), 'content')\nexport const DrawerContext = ArkDrawer.Context\n\nexport interface DrawerProps extends ComponentProps<typeof Drawer> {}\nexport interface DrawerBackdropProps extends ComponentProps<typeof DrawerBackdrop> {}\nexport interface DrawerBodyProps extends ComponentProps<typeof DrawerBody> {}\nexport interface DrawerCloseTriggerProps extends ComponentProps<typeof DrawerCloseTrigger> {}\nexport interface DrawerContentProps extends ComponentProps<typeof DrawerContent> {}\nexport interface DrawerFooterProps extends ComponentProps<typeof DrawerFooter> {}\nexport interface DrawerHeaderProps extends ComponentProps<typeof DrawerHeader> {}\nexport interface DrawerPositionerProps extends ComponentProps<typeof DrawerPositioner> {}\nexport interface DrawerTitleProps extends ComponentProps<typeof DrawerTitle> {}\nexport interface DrawerTriggerProps extends ComponentProps<typeof DrawerTrigger> {}\nexport interface DrawerContextProps extends ComponentProps<typeof DrawerContext> {}\n"],"mappings":";;;;;;;;;;;;AAWA,IAAM,EAAE,iBAAc,mBAAgBG,EAAmBC,CAAM,GAElDC,IAASC,EAAaN,EAAU,MAAM,KAAA,GAAW,EAC5D,cAAc;CACZ,eAAe;CACf,WAAW;AACb,EACF,CAAC,GACYQ,IAAaC,EAAYC,EAAOC,EAAI,IAAI,GAAG,MAAM,GACjDC,IAAqBH,EAAYC,EAAOV,EAAU,YAAY,GAAG,cAAc,GAC/Ea,IAAeJ,EAAYC,EAAOC,EAAI,MAAM,GAAG,QAAQ,GAM9DG,IAASC,GACZ,EAAE,aAAU,sBAAmB,IAAM,GAAGC,KAAS,MAAQ;CACxD,IAAMC,IAASC,EAAY;CAC3B,OACE,kBAACP,EAAI,QAAL;EAAY,GAAIK;EAAY;EAA5B,UAAA,CACGG,GACAC,KACC,kBAACR,GAAD;GAAoB,SAAA;GAClB,UAAA,kBAACS,GAAD;IAAY,IAAG;IAAO,cAAYJ,EAAO;IAAO,SAAQ;IACtD,UAAA,kBAAC,OAAD;KAAK,OAAM;KAAK,QAAO;KAAK,SAAQ;KAAY,MAAK;KAAO,OAAM;KAChE,UAAA,kBAAC,QAAD;MACE,UAAS;MACT,UAAS;MACT,GAAE;MACF,MAAK;KACN,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,2 @@
|
|
|
1
|
-
"use client";const e=require("../../utils/slots.cjs"),t=require("../icon-button/IconButton.cjs"),
|
|
1
|
+
"use client";const e=require("../../utils/slots.cjs"),t=require("../ui-labels/UiLabelsProvider.cjs"),n=require("../icon-button/IconButton.cjs"),r=require("./use-pagination.cjs"),i=require("../../shared/utils/events.cjs");let a=require("@stokelp/styled-system/jsx"),o=require("@stokelp/styled-system/recipes"),s=require("react"),c=require("react/jsx-runtime");var{withProvider:l,withContext:u}=e.createStyleContext(o.pagination),d=l((0,a.styled)(`div`),`root`),f=u((0,a.styled)(`button`),`item`),p=u((0,a.styled)(`div`),`dots`),m=({total:e,value:a,defaultValue:o,onChange:l,disabled:u,onNextPage:m,onPrevPage:h,siblings:g=2,boundaries:_=1,...v})=>{let{range:y,setPage:b,next:x,previous:S,active:C}=r.usePagination({page:a,initialPage:o,onChange:l,total:e,siblings:g,boundaries:_}),w=t.useUiLabels(),T=i.createEventHandler(m,x),E=i.createEventHandler(h,S);return(0,c.jsxs)(d,{...v,children:[(0,c.jsx)(n.IconButton,{size:`md`,variant:`tertiary`,"aria-label":w.previousPage,disabled:u||C===1,onClick:E,children:(0,c.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L10.1464 2.64645C10.3417 2.45119 10.6583 2.45119 10.8536 2.64645C11.0488 2.84171 11.0488 3.15829 10.8536 3.35355L6.20711 8L10.8536 12.6464C11.0488 12.8417 11.0488 13.1583 10.8536 13.3536C10.6583 13.5488 10.3417 13.5488 10.1464 13.3536L5.14645 8.35355Z`,fill:`currentColor`})})}),y.map((e,t)=>e===r.DOTS?(0,s.createElement)(p,{...u?{"data-disabled":!0}:{},key:t},`...`):(0,c.jsx)(f,{disabled:u,...e===C?{"data-selected":!0}:{},onClick:()=>b(e),children:e},t)),(0,c.jsx)(n.IconButton,{size:`md`,variant:`tertiary`,"aria-label":w.nextPage,disabled:u||C===e,onClick:T,children:(0,c.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.8536 7.64645C11.0488 7.84171 11.0488 8.15829 10.8536 8.35355L5.85355 13.3536C5.65829 13.5488 5.34171 13.5488 5.14645 13.3536C4.95118 13.1583 4.95118 12.8417 5.14645 12.6464L9.79289 8L5.14645 3.35355C4.95118 3.15829 4.95118 2.84171 5.14645 2.64645C5.34171 2.45118 5.65829 2.45118 5.85355 2.64645L10.8536 7.64645Z`,fill:`currentColor`})})})]})};exports.Pagination=m;
|
|
2
2
|
//# sourceMappingURL=Pagination.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.cjs","names":["createStyleContext","pagination","styled","usePagination","createEventHandler","IconButton","DOTS","require_slots","require_IconButton","require_use_pagination","require_events","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","StyledPagination","withProvider","PaginationItem","withContext","PaginationDots","Pagination","props","value","defaultValue","handleNextPage","onNextPage","next","handlePreviousPage","onPrevPage","previous","disabled","active","range","pageNumber","index","setPage","total"],"sources":["../../../src/components/pagination/Pagination.tsx"],"sourcesContent":["import type { ComponentProps, FC } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { pagination } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\nimport { DOTS, usePagination } from './use-pagination'\nimport { createEventHandler } from '~/shared/utils/events'\nimport { IconButton } from '~/components/icon-button'\n\nconst { withProvider, withContext } = createStyleContext(pagination)\n\nconst StyledPagination = withProvider(styled('div'), 'root')\ntype StyledPaginationProps = ComponentProps<typeof StyledPagination>\n\nconst PaginationItem = withContext(styled('button'), 'item')\nconst PaginationDots = withContext(styled('div'), 'dots')\n\nexport interface PaginationProps extends Omit<StyledPaginationProps, 'children' | 'defaultValue' | 'onChange'> {\n total: number\n value?: number\n defaultValue?: number\n onChange?: (value: number) => void\n disabled?: boolean\n siblings?: number\n boundaries?: number\n onNextPage?: () => void\n onPrevPage?: () => void\n}\n\nexport const Pagination: FC<PaginationProps> = ({\n total,\n value,\n defaultValue,\n onChange,\n disabled,\n onNextPage,\n onPrevPage,\n siblings = 2,\n boundaries = 1,\n ...props\n}: PaginationProps) => {\n const { range, setPage, next, previous, active } = usePagination({\n page: value,\n initialPage: defaultValue,\n onChange,\n total,\n siblings,\n boundaries,\n })\n\n const handleNextPage = createEventHandler(onNextPage, next)\n const handlePreviousPage = createEventHandler(onPrevPage, previous)\n\n return (\n <StyledPagination {...props}>\n <IconButton\n size=\"md\"\n variant=\"tertiary\"\n aria-label
|
|
1
|
+
{"version":3,"file":"Pagination.cjs","names":["createStyleContext","pagination","styled","usePagination","useUiLabels","createEventHandler","IconButton","DOTS","require_slots","require_UiLabelsProvider","require_IconButton","require_use_pagination","require_events","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","StyledPagination","withProvider","PaginationItem","withContext","PaginationDots","Pagination","props","value","defaultValue","labels","handleNextPage","onNextPage","next","handlePreviousPage","onPrevPage","previous","disabled","active","range","pageNumber","index","setPage","total"],"sources":["../../../src/components/pagination/Pagination.tsx"],"sourcesContent":["import type { ComponentProps, FC } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { pagination } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\nimport { DOTS, usePagination } from './use-pagination'\nimport { createEventHandler } from '~/shared/utils/events'\nimport { IconButton } from '~/components/icon-button'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\n\nconst { withProvider, withContext } = createStyleContext(pagination)\n\nconst StyledPagination = withProvider(styled('div'), 'root')\ntype StyledPaginationProps = ComponentProps<typeof StyledPagination>\n\nconst PaginationItem = withContext(styled('button'), 'item')\nconst PaginationDots = withContext(styled('div'), 'dots')\n\nexport interface PaginationProps extends Omit<StyledPaginationProps, 'children' | 'defaultValue' | 'onChange'> {\n total: number\n value?: number\n defaultValue?: number\n onChange?: (value: number) => void\n disabled?: boolean\n siblings?: number\n boundaries?: number\n onNextPage?: () => void\n onPrevPage?: () => void\n}\n\nexport const Pagination: FC<PaginationProps> = ({\n total,\n value,\n defaultValue,\n onChange,\n disabled,\n onNextPage,\n onPrevPage,\n siblings = 2,\n boundaries = 1,\n ...props\n}: PaginationProps) => {\n const { range, setPage, next, previous, active } = usePagination({\n page: value,\n initialPage: defaultValue,\n onChange,\n total,\n siblings,\n boundaries,\n })\n\n const labels = useUiLabels()\n const handleNextPage = createEventHandler(onNextPage, next)\n const handlePreviousPage = createEventHandler(onPrevPage, previous)\n\n return (\n <StyledPagination {...props}>\n <IconButton\n size=\"md\"\n variant=\"tertiary\"\n aria-label={labels.previousPage}\n disabled={disabled || active === 1}\n onClick={handlePreviousPage}\n >\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L10.1464 2.64645C10.3417 2.45119 10.6583 2.45119 10.8536 2.64645C11.0488 2.84171 11.0488 3.15829 10.8536 3.35355L6.20711 8L10.8536 12.6464C11.0488 12.8417 11.0488 13.1583 10.8536 13.3536C10.6583 13.5488 10.3417 13.5488 10.1464 13.3536L5.14645 8.35355Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n {range.map((pageNumber, index) => {\n if (pageNumber === DOTS) {\n return (\n <PaginationDots {...(disabled ? { 'data-disabled': true } : {})} key={index}>\n ...\n </PaginationDots>\n )\n }\n\n const isSelected = pageNumber === active\n\n return (\n <PaginationItem\n key={index}\n disabled={disabled}\n {...(isSelected\n ? {\n 'data-selected': true,\n }\n : {})}\n onClick={() => setPage(pageNumber)}\n >\n {pageNumber}\n </PaginationItem>\n )\n })}\n <IconButton\n size=\"md\"\n variant=\"tertiary\"\n aria-label={labels.nextPage}\n disabled={disabled || active === total}\n onClick={handleNextPage}\n >\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10.8536 7.64645C11.0488 7.84171 11.0488 8.15829 10.8536 8.35355L5.85355 13.3536C5.65829 13.5488 5.34171 13.5488 5.14645 13.3536C4.95118 13.1583 4.95118 12.8417 5.14645 12.6464L9.79289 8L5.14645 3.35355C4.95118 3.15829 4.95118 2.84171 5.14645 2.64645C5.34171 2.45118 5.65829 2.45118 5.85355 2.64645L10.8536 7.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </StyledPagination>\n )\n}\n"],"mappings":"A,uWASA,GAAM,CAAE,eAAc,eAAgBA,EAAAA,mBAAmBC,EAAAA,UAAU,EAE7DgB,EAAmBC,GAAA,EAAahB,EAAAA,OAAAA,CAAO,KAAK,EAAG,MAAM,EAGrDiB,EAAiBC,GAAA,EAAYlB,EAAAA,OAAAA,CAAO,QAAQ,EAAG,MAAM,EACrDmB,EAAiBD,GAAA,EAAYlB,EAAAA,OAAAA,CAAO,KAAK,EAAG,MAAM,EAc3CoB,GAAmC,CAC9C,QACA,QACA,eACA,WACA,WACA,aACA,aACA,WAAW,EACX,aAAa,EACb,GAAGC,KACkB,CACrB,GAAM,CAAE,QAAO,UAAS,OAAM,WAAU,UAAWpB,EAAAA,cAAc,CAC/D,KAAMqB,EACN,YAAaC,EACb,WACA,QACA,WACA,YACF,CAAC,EAEKC,EAAStB,EAAAA,YAAY,EACrBuB,EAAiBtB,EAAAA,mBAAmBuB,EAAYC,CAAI,EACpDC,EAAqBzB,EAAAA,mBAAmB0B,EAAYC,CAAQ,EAElE,OAC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