@apipass/design-system 4.2.2 → 5.0.0
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/lib/embedded-styles.d.ts +4 -0
- package/dist/lib/embedded-styles.js +3 -1
- package/dist/lib/style.css +1 -1
- package/dist/lib/ui/components/Breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/lib/ui/components/Breadcrumb/Breadcrumb.cjs.map +1 -1
- package/dist/lib/ui/components/Breadcrumb/Breadcrumb.js +1 -1
- package/dist/lib/ui/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/lib/ui/components/DataTable/DataTable.cjs +1 -1
- package/dist/lib/ui/components/DataTable/DataTable.cjs.map +1 -1
- package/dist/lib/ui/components/DataTable/DataTable.js +118 -106
- package/dist/lib/ui/components/DataTable/DataTable.js.map +1 -1
- package/dist/lib/ui/primitives/Accordion/Accordion.cjs +1 -1
- package/dist/lib/ui/primitives/Accordion/Accordion.cjs.map +1 -1
- package/dist/lib/ui/primitives/Accordion/Accordion.js +5 -5
- package/dist/lib/ui/primitives/Accordion/Accordion.js.map +1 -1
- package/dist/lib/ui/primitives/Alert/Alert.cjs +1 -1
- package/dist/lib/ui/primitives/Alert/Alert.cjs.map +1 -1
- package/dist/lib/ui/primitives/Alert/Alert.js +1 -1
- package/dist/lib/ui/primitives/Alert/Alert.js.map +1 -1
- package/dist/lib/ui/primitives/Checkbox/Checkbox.cjs +1 -1
- package/dist/lib/ui/primitives/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/lib/ui/primitives/Checkbox/Checkbox.js +9 -9
- package/dist/lib/ui/primitives/Checkbox/Checkbox.js.map +1 -1
- package/dist/lib/ui/primitives/Fieldset/Fieldset.cjs +1 -1
- package/dist/lib/ui/primitives/Fieldset/Fieldset.cjs.map +1 -1
- package/dist/lib/ui/primitives/Fieldset/Fieldset.js +1 -1
- package/dist/lib/ui/primitives/Fieldset/Fieldset.js.map +1 -1
- package/dist/lib/ui/primitives/Pagination/Pagination.cjs +1 -1
- package/dist/lib/ui/primitives/Pagination/Pagination.cjs.map +1 -1
- package/dist/lib/ui/primitives/Pagination/Pagination.js +6 -6
- package/dist/lib/ui/primitives/Pagination/Pagination.js.map +1 -1
- package/dist/lib/ui/primitives/Radio/Radio.cjs +1 -1
- package/dist/lib/ui/primitives/Radio/Radio.cjs.map +1 -1
- package/dist/lib/ui/primitives/Radio/Radio.js +8 -8
- package/dist/lib/ui/primitives/Radio/Radio.js.map +1 -1
- package/dist/lib/ui/primitives/Switch/Switch.cjs +1 -1
- package/dist/lib/ui/primitives/Switch/Switch.cjs.map +1 -1
- package/dist/lib/ui/primitives/Switch/Switch.js +1 -1
- package/dist/lib/ui/primitives/Switch/Switch.js.map +1 -1
- package/dist/lib/ui/primitives/Table/Table.cjs +1 -1
- package/dist/lib/ui/primitives/Table/Table.cjs.map +1 -1
- package/dist/lib/ui/primitives/Table/Table.js +44 -44
- package/dist/lib/ui/primitives/Table/Table.js.map +1 -1
- package/dist/lib/ui/primitives/Text/Text.cjs +1 -1
- package/dist/lib/ui/primitives/Text/Text.cjs.map +1 -1
- package/dist/lib/ui/primitives/Text/Text.js +16 -16
- package/dist/lib/ui/primitives/Text/Text.js.map +1 -1
- package/dist/lib/ui/primitives/Tooltip/Tooltip.cjs +1 -1
- package/dist/lib/ui/primitives/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/lib/ui/primitives/Tooltip/Tooltip.js +9 -9
- package/dist/lib/ui/primitives/Tooltip/Tooltip.js.map +1 -1
- package/dist/types/ui/components/DataTable/DataTable.d.ts +10 -1
- package/package.json +2 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as i, jsxs as e, Fragment as m } from "react/jsx-runtime";
|
|
2
|
-
import { clsx as
|
|
2
|
+
import { clsx as s } from "../../../vendor/clsx/dist/clsx.js";
|
|
3
3
|
import { DisclosureGroup as l, Disclosure as d, Heading as u, Button as p, DisclosurePanel as h } from "react-aria-components";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { IconChevronDown as N } from "../../icons/IconChevronDown.js";
|
|
6
6
|
function A({ className: o, ...r }) {
|
|
7
|
-
const c =
|
|
7
|
+
const c = s(o, "sds-accordion");
|
|
8
8
|
return /* @__PURE__ */ i(l, { className: c, ...r });
|
|
9
9
|
}
|
|
10
10
|
function I({
|
|
@@ -12,10 +12,10 @@ function I({
|
|
|
12
12
|
title: r,
|
|
13
13
|
isExpanded: c,
|
|
14
14
|
isDisabled: f,
|
|
15
|
-
children:
|
|
15
|
+
children: n,
|
|
16
16
|
...a
|
|
17
17
|
}) {
|
|
18
|
-
const t =
|
|
18
|
+
const t = s(o, "accordion-item");
|
|
19
19
|
return /* @__PURE__ */ e(d, { className: t, ...a, children: [
|
|
20
20
|
/* @__PURE__ */ i(u, { className: "accordion-item-title", children: /* @__PURE__ */ e(p, { slot: "trigger", children: [
|
|
21
21
|
r,
|
|
@@ -30,7 +30,7 @@ function I({
|
|
|
30
30
|
}
|
|
31
31
|
)
|
|
32
32
|
] }) }),
|
|
33
|
-
/* @__PURE__ */ i(h, { className: "accordion-item-content", children: /* @__PURE__ */ i(m, { children:
|
|
33
|
+
/* @__PURE__ */ i(h, { className: "accordion-item-content", children: /* @__PURE__ */ i(m, { children: n }) })
|
|
34
34
|
] });
|
|
35
35
|
}
|
|
36
36
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","sources":["../../../../../src/ui/primitives/Accordion/Accordion.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { IconChevronDown } from \"icons\";\nimport {\n Button,\n Disclosure,\n DisclosureGroup,\n DisclosurePanel,\n Heading,\n type DisclosureGroupProps,\n type DisclosureProps,\n} from \"react-aria-components\";\nimport \"./accordion.css\";\n\nexport type AccordionProps = DisclosureGroupProps;\nexport function Accordion({ className, ...props }: AccordionProps) {\n const classNames = clsx(className, \"accordion\");\n return <DisclosureGroup className={classNames} {...props} />;\n}\n\nexport type AccordionItemProps = DisclosureProps & { title: string };\nexport function AccordionItem({\n className,\n title,\n isExpanded,\n isDisabled,\n children,\n ...props\n}: AccordionItemProps) {\n const classNames = clsx(className, \"accordion-item\");\n return (\n <Disclosure className={classNames} {...props}>\n <Heading className=\"accordion-item-title\">\n <Button slot=\"trigger\">\n {title}\n <span\n role=\"img\"\n aria-hidden=\"true\"\n aria-label=\"accordion item indicator\"\n className=\"accordion-item-indicator\"\n >\n <IconChevronDown size=\"20\" />\n </span>\n </Button>\n </Heading>\n <DisclosurePanel className=\"accordion-item-content\">\n <>{children}</>\n </DisclosurePanel>\n </Disclosure>\n );\n}\n"],"names":["Accordion","className","props","classNames","clsx","jsx","DisclosureGroup","AccordionItem","title","isExpanded","isDisabled","children","jsxs","Disclosure","Heading","Button","IconChevronDown","DisclosurePanel","Fragment"],"mappings":";;;;;AAcO,SAASA,EAAU,EAAE,WAAAC,GAAW,GAAGC,KAAyB;AACjE,QAAMC,IAAaC,EAAKH,GAAW,
|
|
1
|
+
{"version":3,"file":"Accordion.js","sources":["../../../../../src/ui/primitives/Accordion/Accordion.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { IconChevronDown } from \"icons\";\nimport {\n Button,\n Disclosure,\n DisclosureGroup,\n DisclosurePanel,\n Heading,\n type DisclosureGroupProps,\n type DisclosureProps,\n} from \"react-aria-components\";\nimport \"./accordion.css\";\n\nexport type AccordionProps = DisclosureGroupProps;\nexport function Accordion({ className, ...props }: AccordionProps) {\n const classNames = clsx(className, \"sds-accordion\");\n return <DisclosureGroup className={classNames} {...props} />;\n}\n\nexport type AccordionItemProps = DisclosureProps & { title: string };\nexport function AccordionItem({\n className,\n title,\n isExpanded,\n isDisabled,\n children,\n ...props\n}: AccordionItemProps) {\n const classNames = clsx(className, \"accordion-item\");\n return (\n <Disclosure className={classNames} {...props}>\n <Heading className=\"accordion-item-title\">\n <Button slot=\"trigger\">\n {title}\n <span\n role=\"img\"\n aria-hidden=\"true\"\n aria-label=\"accordion item indicator\"\n className=\"accordion-item-indicator\"\n >\n <IconChevronDown size=\"20\" />\n </span>\n </Button>\n </Heading>\n <DisclosurePanel className=\"accordion-item-content\">\n <>{children}</>\n </DisclosurePanel>\n </Disclosure>\n );\n}\n"],"names":["Accordion","className","props","classNames","clsx","jsx","DisclosureGroup","AccordionItem","title","isExpanded","isDisabled","children","jsxs","Disclosure","Heading","Button","IconChevronDown","DisclosurePanel","Fragment"],"mappings":";;;;;AAcO,SAASA,EAAU,EAAE,WAAAC,GAAW,GAAGC,KAAyB;AACjE,QAAMC,IAAaC,EAAKH,GAAW,eAAe;AAClD,SAAO,gBAAAI,EAACC,GAAA,EAAgB,WAAWH,GAAa,GAAGD,GAAO;AAC5D;AAGO,SAASK,EAAc;AAAA,EAC5B,WAAAN;AAAA,EACA,OAAAO;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGT;AACL,GAAuB;AACrB,QAAMC,IAAaC,EAAKH,GAAW,gBAAgB;AACnD,SACE,gBAAAW,EAACC,GAAA,EAAW,WAAWV,GAAa,GAAGD,GACrC,UAAA;AAAA,IAAA,gBAAAG,EAACS,KAAQ,WAAU,wBACjB,UAAA,gBAAAF,EAACG,GAAA,EAAO,MAAK,WACV,UAAA;AAAA,MAAAP;AAAA,MACD,gBAAAH;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,eAAY;AAAA,UACZ,cAAW;AAAA,UACX,WAAU;AAAA,UAEV,UAAA,gBAAAA,EAACW,GAAA,EAAgB,MAAK,KAAA,CAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IAC7B,EAAA,CACF,EAAA,CACF;AAAA,sBACCC,GAAA,EAAgB,WAAU,0BACzB,UAAA,gBAAAZ,EAAAa,GAAA,EAAG,UAAAP,GAAS,EAAA,CACd;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("../../../vendor/clsx/dist/clsx.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("../../../vendor/clsx/dist/clsx.cjs"),d=require("../IconButton/IconButton.cjs");;/* empty css */const j=require("../../icons/IconX.cjs"),f=require("../../icons/IconAlertTriangle.cjs"),m=require("../../icons/IconCheckCircle.cjs"),h=require("../../icons/IconAlertCircle.cjs"),q=require("../../icons/IconInfo.cjs");function C(r){return r==="warning"?e.jsx(f.IconAlertTriangle,{size:"20"}):r==="success"?e.jsx(m.IconCheckCircle,{size:"20"}):r==="error"?e.jsx(h.IconAlertCircle,{size:"20"}):e.jsx(q.IconInfo,{size:"20"})}function N({level:r="info",variant:c="default",icon:t=!0,title:s,message:n,closeButton:l=!1,onClose:a,children:i,className:o,...u}){const I=x.clsx("sds-alert",`alert-level-${r}`,`alert-variant-${c}`,o);return e.jsxs("div",{role:"alert",className:I,...u,children:[t&&e.jsx("span",{className:"alert-icon",children:C(r)}),e.jsxs("div",{className:"alert-content",children:[s&&e.jsx("span",{className:"alert-title",children:s}),n&&e.jsx("span",{className:"alert-message",children:n}),i]}),l&&e.jsx(d.IconButton,{className:"alert-close",size:"small",variant:"subtle","aria-label":"Fechar alerta",onClick:a,children:e.jsx(j.IconX,{})})]})}exports.Alert=N;
|
|
2
2
|
//# sourceMappingURL=Alert.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.cjs","sources":["../../../../../src/ui/primitives/Alert/Alert.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport {\n IconAlertCircle,\n IconAlertTriangle,\n IconCheckCircle,\n IconInfo,\n IconX,\n} from \"icons\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { ReactNode } from \"react\";\nimport \"./alert.css\";\n\nexport type AlertLevel = \"info\" | \"warning\" | \"success\" | \"error\";\nexport type AlertVariant = \"default\" | \"filled\" | \"outlined\";\n\nexport type AlertProps = React.ComponentPropsWithoutRef<\"div\"> & {\n level?: AlertLevel;\n variant?: AlertVariant;\n icon?: boolean;\n title?: string;\n message?: ReactNode;\n closeButton?: boolean;\n onClose?: () => void;\n};\n\nfunction defaultIcon(level: AlertLevel) {\n if (level === \"warning\") return <IconAlertTriangle size=\"20\" />;\n if (level === \"success\") return <IconCheckCircle size=\"20\" />;\n if (level === \"error\") return <IconAlertCircle size=\"20\" />;\n return <IconInfo size=\"20\" />;\n}\n\nexport function Alert({\n level = \"info\",\n variant = \"default\",\n icon = true,\n title,\n message,\n closeButton = false,\n onClose,\n children,\n className,\n ...props\n}: AlertProps) {\n const classNames = clsx(\n \"alert\",\n `alert-level-${level}`,\n `alert-variant-${variant}`,\n className,\n );\n\n return (\n <div role=\"alert\" className={classNames} {...props}>\n {icon && <span className=\"alert-icon\">{defaultIcon(level)}</span>}\n <div className=\"alert-content\">\n {title && <span className=\"alert-title\">{title}</span>}\n {message && <span className=\"alert-message\">{message}</span>}\n {children}\n </div>\n {closeButton && (\n <IconButton\n className=\"alert-close\"\n size=\"small\"\n variant=\"subtle\"\n aria-label=\"Fechar alerta\"\n onClick={onClose}\n >\n <IconX />\n </IconButton>\n )}\n </div>\n );\n}\n"],"names":["defaultIcon","level","jsx","IconAlertTriangle","IconCheckCircle","IconAlertCircle","IconInfo","Alert","variant","icon","title","message","closeButton","onClose","children","className","props","classNames","clsx","jsxs","IconButton","IconX"],"mappings":"kcAyBA,SAASA,EAAYC,EAAmB,CACtC,OAAIA,IAAU,UAAkBC,EAAAA,IAACC,EAAAA,kBAAA,CAAkB,KAAK,KAAK,EACzDF,IAAU,UAAkBC,EAAAA,IAACE,EAAAA,gBAAA,CAAgB,KAAK,KAAK,EACvDH,IAAU,QAAgBC,EAAAA,IAACG,EAAAA,gBAAA,CAAgB,KAAK,KAAK,EAClDH,EAAAA,IAACI,EAAAA,SAAA,CAAS,KAAK,IAAA,CAAK,CAC7B,CAEO,SAASC,EAAM,CACpB,MAAAN,EAAQ,OACR,QAAAO,EAAU,UACV,KAAAC,EAAO,GACP,MAAAC,EACA,QAAAC,EACA,YAAAC,EAAc,GACd,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,GAAGC,CACL,EAAe,CACb,MAAMC,EAAaC,EAAAA,KACjB,
|
|
1
|
+
{"version":3,"file":"Alert.cjs","sources":["../../../../../src/ui/primitives/Alert/Alert.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport {\n IconAlertCircle,\n IconAlertTriangle,\n IconCheckCircle,\n IconInfo,\n IconX,\n} from \"icons\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { ReactNode } from \"react\";\nimport \"./alert.css\";\n\nexport type AlertLevel = \"info\" | \"warning\" | \"success\" | \"error\";\nexport type AlertVariant = \"default\" | \"filled\" | \"outlined\";\n\nexport type AlertProps = React.ComponentPropsWithoutRef<\"div\"> & {\n level?: AlertLevel;\n variant?: AlertVariant;\n icon?: boolean;\n title?: string;\n message?: ReactNode;\n closeButton?: boolean;\n onClose?: () => void;\n};\n\nfunction defaultIcon(level: AlertLevel) {\n if (level === \"warning\") return <IconAlertTriangle size=\"20\" />;\n if (level === \"success\") return <IconCheckCircle size=\"20\" />;\n if (level === \"error\") return <IconAlertCircle size=\"20\" />;\n return <IconInfo size=\"20\" />;\n}\n\nexport function Alert({\n level = \"info\",\n variant = \"default\",\n icon = true,\n title,\n message,\n closeButton = false,\n onClose,\n children,\n className,\n ...props\n}: AlertProps) {\n const classNames = clsx(\n \"sds-alert\",\n `alert-level-${level}`,\n `alert-variant-${variant}`,\n className,\n );\n\n return (\n <div role=\"alert\" className={classNames} {...props}>\n {icon && <span className=\"alert-icon\">{defaultIcon(level)}</span>}\n <div className=\"alert-content\">\n {title && <span className=\"alert-title\">{title}</span>}\n {message && <span className=\"alert-message\">{message}</span>}\n {children}\n </div>\n {closeButton && (\n <IconButton\n className=\"alert-close\"\n size=\"small\"\n variant=\"subtle\"\n aria-label=\"Fechar alerta\"\n onClick={onClose}\n >\n <IconX />\n </IconButton>\n )}\n </div>\n );\n}\n"],"names":["defaultIcon","level","jsx","IconAlertTriangle","IconCheckCircle","IconAlertCircle","IconInfo","Alert","variant","icon","title","message","closeButton","onClose","children","className","props","classNames","clsx","jsxs","IconButton","IconX"],"mappings":"kcAyBA,SAASA,EAAYC,EAAmB,CACtC,OAAIA,IAAU,UAAkBC,EAAAA,IAACC,EAAAA,kBAAA,CAAkB,KAAK,KAAK,EACzDF,IAAU,UAAkBC,EAAAA,IAACE,EAAAA,gBAAA,CAAgB,KAAK,KAAK,EACvDH,IAAU,QAAgBC,EAAAA,IAACG,EAAAA,gBAAA,CAAgB,KAAK,KAAK,EAClDH,EAAAA,IAACI,EAAAA,SAAA,CAAS,KAAK,IAAA,CAAK,CAC7B,CAEO,SAASC,EAAM,CACpB,MAAAN,EAAQ,OACR,QAAAO,EAAU,UACV,KAAAC,EAAO,GACP,MAAAC,EACA,QAAAC,EACA,YAAAC,EAAc,GACd,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,GAAGC,CACL,EAAe,CACb,MAAMC,EAAaC,EAAAA,KACjB,YACA,eAAejB,CAAK,GACpB,iBAAiBO,CAAO,GACxBO,CAAA,EAGF,cACG,MAAA,CAAI,KAAK,QAAQ,UAAWE,EAAa,GAAGD,EAC1C,SAAA,CAAAP,SAAS,OAAA,CAAK,UAAU,aAAc,SAAAT,EAAYC,CAAK,EAAE,EAC1DkB,EAAAA,KAAC,MAAA,CAAI,UAAU,gBACZ,SAAA,CAAAT,GAASR,EAAAA,IAAC,OAAA,CAAK,UAAU,cAAe,SAAAQ,EAAM,EAC9CC,GAAWT,EAAAA,IAAC,OAAA,CAAK,UAAU,gBAAiB,SAAAS,EAAQ,EACpDG,CAAA,EACH,EACCF,GACCV,EAAAA,IAACkB,EAAAA,WAAA,CACC,UAAU,cACV,KAAK,QACL,QAAQ,SACR,aAAW,gBACX,QAASP,EAET,eAACQ,EAAAA,MAAA,CAAA,CAAM,CAAA,CAAA,CACT,EAEJ,CAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sources":["../../../../../src/ui/primitives/Alert/Alert.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport {\n IconAlertCircle,\n IconAlertTriangle,\n IconCheckCircle,\n IconInfo,\n IconX,\n} from \"icons\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { ReactNode } from \"react\";\nimport \"./alert.css\";\n\nexport type AlertLevel = \"info\" | \"warning\" | \"success\" | \"error\";\nexport type AlertVariant = \"default\" | \"filled\" | \"outlined\";\n\nexport type AlertProps = React.ComponentPropsWithoutRef<\"div\"> & {\n level?: AlertLevel;\n variant?: AlertVariant;\n icon?: boolean;\n title?: string;\n message?: ReactNode;\n closeButton?: boolean;\n onClose?: () => void;\n};\n\nfunction defaultIcon(level: AlertLevel) {\n if (level === \"warning\") return <IconAlertTriangle size=\"20\" />;\n if (level === \"success\") return <IconCheckCircle size=\"20\" />;\n if (level === \"error\") return <IconAlertCircle size=\"20\" />;\n return <IconInfo size=\"20\" />;\n}\n\nexport function Alert({\n level = \"info\",\n variant = \"default\",\n icon = true,\n title,\n message,\n closeButton = false,\n onClose,\n children,\n className,\n ...props\n}: AlertProps) {\n const classNames = clsx(\n \"alert\",\n `alert-level-${level}`,\n `alert-variant-${variant}`,\n className,\n );\n\n return (\n <div role=\"alert\" className={classNames} {...props}>\n {icon && <span className=\"alert-icon\">{defaultIcon(level)}</span>}\n <div className=\"alert-content\">\n {title && <span className=\"alert-title\">{title}</span>}\n {message && <span className=\"alert-message\">{message}</span>}\n {children}\n </div>\n {closeButton && (\n <IconButton\n className=\"alert-close\"\n size=\"small\"\n variant=\"subtle\"\n aria-label=\"Fechar alerta\"\n onClick={onClose}\n >\n <IconX />\n </IconButton>\n )}\n </div>\n );\n}\n"],"names":["defaultIcon","level","jsx","IconAlertTriangle","IconCheckCircle","IconAlertCircle","IconInfo","Alert","variant","icon","title","message","closeButton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,MAAA;AAAA,IAAA;AAAA,EACT,GAEJ;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"Alert.js","sources":["../../../../../src/ui/primitives/Alert/Alert.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport {\n IconAlertCircle,\n IconAlertTriangle,\n IconCheckCircle,\n IconInfo,\n IconX,\n} from \"icons\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { ReactNode } from \"react\";\nimport \"./alert.css\";\n\nexport type AlertLevel = \"info\" | \"warning\" | \"success\" | \"error\";\nexport type AlertVariant = \"default\" | \"filled\" | \"outlined\";\n\nexport type AlertProps = React.ComponentPropsWithoutRef<\"div\"> & {\n level?: AlertLevel;\n variant?: AlertVariant;\n icon?: boolean;\n title?: string;\n message?: ReactNode;\n closeButton?: boolean;\n onClose?: () => void;\n};\n\nfunction defaultIcon(level: AlertLevel) {\n if (level === \"warning\") return <IconAlertTriangle size=\"20\" />;\n if (level === \"success\") return <IconCheckCircle size=\"20\" />;\n if (level === \"error\") return <IconAlertCircle size=\"20\" />;\n return <IconInfo size=\"20\" />;\n}\n\nexport function Alert({\n level = \"info\",\n variant = \"default\",\n icon = true,\n title,\n message,\n closeButton = false,\n onClose,\n children,\n className,\n ...props\n}: AlertProps) {\n const classNames = clsx(\n \"sds-alert\",\n `alert-level-${level}`,\n `alert-variant-${variant}`,\n className,\n );\n\n return (\n <div role=\"alert\" className={classNames} {...props}>\n {icon && <span className=\"alert-icon\">{defaultIcon(level)}</span>}\n <div className=\"alert-content\">\n {title && <span className=\"alert-title\">{title}</span>}\n {message && <span className=\"alert-message\">{message}</span>}\n {children}\n </div>\n {closeButton && (\n <IconButton\n className=\"alert-close\"\n size=\"small\"\n variant=\"subtle\"\n aria-label=\"Fechar alerta\"\n onClick={onClose}\n >\n <IconX />\n </IconButton>\n )}\n </div>\n );\n}\n"],"names":["defaultIcon","level","jsx","IconAlertTriangle","IconCheckCircle","IconAlertCircle","IconInfo","Alert","variant","icon","title","message","closeButton","onClose","children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AAAA,IAAA;AAAA,EACT,GAEJ;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("../../../vendor/clsx/dist/clsx.cjs"),u=require("react-aria-components");;/* empty css */const b=require("../../icons/IconMinus.cjs"),j=require("../../icons/IconCheck.cjs"),r=require("../Fieldset/Fieldset.cjs");function k({className:s,label:c,description:n,errorMessage:i,children:o,...l}){const t=x.clsx(s,"checkbox-group");return e.jsxs(u.CheckboxGroup,{...l,className:t,children:[c&&e.jsx(r.Label,{children:c}),n&&e.jsx(r.Description,{children:n}),i&&e.jsx(r.FieldError,{children:i}),o]})}function m({children:s,className:c,label:n,description:i,errorMessage:o,inline:l,...t}){const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("../../../vendor/clsx/dist/clsx.cjs"),u=require("react-aria-components");;/* empty css */const b=require("../../icons/IconMinus.cjs"),j=require("../../icons/IconCheck.cjs"),r=require("../Fieldset/Fieldset.cjs");function k({className:s,label:c,description:n,errorMessage:i,children:o,...l}){const t=x.clsx(s,"checkbox-group");return e.jsxs(u.CheckboxGroup,{...l,className:t,children:[c&&e.jsx(r.Label,{children:c}),n&&e.jsx(r.Description,{children:n}),i&&e.jsx(r.FieldError,{children:i}),o]})}function m({children:s,className:c,label:n,description:i,errorMessage:o,inline:l,...t}){const h=x.clsx(c,"checkbox-field",l&&"checkbox-field--inline"),a=n||(typeof s=="string"?s:void 0);return e.jsx(u.Checkbox,{className:h,...t,children:e.jsxs(e.Fragment,{children:[e.jsx(r.Label,{children:a}),e.jsx(d,{}),i&&e.jsx(r.Description,{children:i}),e.jsx(r.FieldError,{children:o}),a!==s&&e.jsx("span",{className:"sds-label",children:s})]})})}function d({className:s,...c}){const n=x.clsx(s,"checkbox");return e.jsxs("div",{className:n,...c,children:[e.jsx(b.IconMinus,{"aria-hidden":"true",className:"icon-indeterminate",size:"16"}),e.jsx(j.IconCheck,{"aria-hidden":"true",className:"icon-selected",size:"16"})]})}exports.Checkbox=d;exports.CheckboxField=m;exports.CheckboxGroup=k;
|
|
2
2
|
//# sourceMappingURL=Checkbox.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.cjs","sources":["../../../../../src/ui/primitives/Checkbox/Checkbox.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { IconCheck, IconMinus } from \"icons\";\nimport { Description, FieldError, Label, SharedFieldProps } from \"primitives\";\nimport {\n Checkbox as RACCheckbox,\n CheckboxGroup as RACCheckboxGroup,\n type CheckboxGroupProps as RACCheckboxGroupProps,\n type CheckboxProps as RACCheckboxProps,\n} from \"react-aria-components\";\nimport \"./checkbox.css\";\n\nexport interface CheckboxGroupProps\n extends Omit<RACCheckboxGroupProps, \"children\">,\n SharedFieldProps {\n children?: React.ReactNode;\n}\n\nexport function CheckboxGroup({\n className,\n label,\n description,\n errorMessage,\n children,\n ...props\n}: CheckboxGroupProps) {\n const classNames = clsx(className, \"checkbox-group\");\n return (\n <RACCheckboxGroup {...props} className={classNames}>\n {label && <Label>{label}</Label>}\n {description && <Description>{description}</Description>}\n {errorMessage && <FieldError>{errorMessage}</FieldError>}\n {children}\n </RACCheckboxGroup>\n );\n}\n\nexport type CheckboxFieldProps = RACCheckboxProps &\n SharedFieldProps & { inline?: boolean };\nexport function CheckboxField({\n children,\n className,\n label,\n description,\n errorMessage,\n inline,\n ...props\n}: CheckboxFieldProps) {\n const classNames = clsx(\n className,\n \"checkbox-field\",\n inline && \"checkbox-field--inline\",\n );\n const labelText: string | undefined =\n label || (typeof children === \"string\" ? children : undefined);\n return (\n <RACCheckbox className={classNames} {...props}>\n <>\n <Label>{labelText}</Label>\n <Checkbox />\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n {labelText !== children && (\n <span className=\"label\">{children as React.ReactNode}</span>\n )}\n </>\n </RACCheckbox>\n );\n}\n\nexport type CheckboxProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function Checkbox({ className, ...props }: CheckboxProps) {\n const classNames = clsx(className, \"checkbox\");\n return (\n <div className={classNames} {...props}>\n <IconMinus aria-hidden=\"true\" className=\"icon-indeterminate\" size=\"16\" />\n <IconCheck aria-hidden=\"true\" className=\"icon-selected\" size=\"16\" />\n </div>\n );\n}\n"],"names":["CheckboxGroup","className","label","description","errorMessage","children","props","classNames","clsx","jsxs","RACCheckboxGroup","jsx","Label","Description","FieldError","CheckboxField","inline","labelText","RACCheckbox","Fragment","Checkbox","IconMinus","IconCheck"],"mappings":"gWAiBO,SAASA,EAAc,CAC5B,UAAAC,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,SAAAC,EACA,GAAGC,CACL,EAAuB,CACrB,MAAMC,EAAaC,EAAAA,KAAKP,EAAW,gBAAgB,EACnD,OACEQ,EAAAA,KAACC,EAAAA,cAAA,CAAkB,GAAGJ,EAAO,UAAWC,EACrC,SAAA,CAAAL,GAASS,EAAAA,IAACC,EAAAA,OAAO,SAAAV,CAAA,CAAM,EACvBC,GAAeQ,EAAAA,IAACE,EAAAA,YAAA,CAAa,SAAAV,CAAA,CAAY,EACzCC,GAAgBO,EAAAA,IAACG,EAAAA,WAAA,CAAY,SAAAV,CAAA,CAAa,EAC1CC,CAAA,EACH,CAEJ,CAIO,SAASU,EAAc,CAC5B,SAAAV,EACA,UAAAJ,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,OAAAY,EACA,GAAGV,CACL,EAAuB,CACrB,MAAMC,EAAaC,EAAAA,KACjBP,EACA,iBACAe,GAAU,wBAAA,EAENC,EACJf,IAAU,OAAOG,GAAa,SAAWA,EAAW,QACtD,aACGa,EAAAA,SAAA,CAAY,UAAWX,EAAa,GAAGD,EACtC,SAAAG,EAAAA,KAAAU,EAAAA,SAAA,CACE,SAAA,CAAAR,EAAAA,IAACC,EAAAA,OAAO,SAAAK,CAAA,CAAU,QACjBG,EAAA,EAAS,EACTjB,GAAeQ,EAAAA,IAACE,EAAAA,YAAA,CAAa,SAAAV,CAAA,CAAY,EAC1CQ,EAAAA,IAACG,EAAAA,YAAY,SAAAV,CAAA,CAAa,EACzBa,IAAcZ,GACbM,MAAC,OAAA,CAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"Checkbox.cjs","sources":["../../../../../src/ui/primitives/Checkbox/Checkbox.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { IconCheck, IconMinus } from \"icons\";\nimport { Description, FieldError, Label, SharedFieldProps } from \"primitives\";\nimport {\n Checkbox as RACCheckbox,\n CheckboxGroup as RACCheckboxGroup,\n type CheckboxGroupProps as RACCheckboxGroupProps,\n type CheckboxProps as RACCheckboxProps,\n} from \"react-aria-components\";\nimport \"./checkbox.css\";\n\nexport interface CheckboxGroupProps\n extends Omit<RACCheckboxGroupProps, \"children\">,\n SharedFieldProps {\n children?: React.ReactNode;\n}\n\nexport function CheckboxGroup({\n className,\n label,\n description,\n errorMessage,\n children,\n ...props\n}: CheckboxGroupProps) {\n const classNames = clsx(className, \"checkbox-group\");\n return (\n <RACCheckboxGroup {...props} className={classNames}>\n {label && <Label>{label}</Label>}\n {description && <Description>{description}</Description>}\n {errorMessage && <FieldError>{errorMessage}</FieldError>}\n {children}\n </RACCheckboxGroup>\n );\n}\n\nexport type CheckboxFieldProps = RACCheckboxProps &\n SharedFieldProps & { inline?: boolean };\nexport function CheckboxField({\n children,\n className,\n label,\n description,\n errorMessage,\n inline,\n ...props\n}: CheckboxFieldProps) {\n const classNames = clsx(\n className,\n \"checkbox-field\",\n inline && \"checkbox-field--inline\",\n );\n const labelText: string | undefined =\n label || (typeof children === \"string\" ? children : undefined);\n return (\n <RACCheckbox className={classNames} {...props}>\n <>\n <Label>{labelText}</Label>\n <Checkbox />\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n {labelText !== children && (\n <span className=\"sds-label\">{children as React.ReactNode}</span>\n )}\n </>\n </RACCheckbox>\n );\n}\n\nexport type CheckboxProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function Checkbox({ className, ...props }: CheckboxProps) {\n const classNames = clsx(className, \"checkbox\");\n return (\n <div className={classNames} {...props}>\n <IconMinus aria-hidden=\"true\" className=\"icon-indeterminate\" size=\"16\" />\n <IconCheck aria-hidden=\"true\" className=\"icon-selected\" size=\"16\" />\n </div>\n );\n}\n"],"names":["CheckboxGroup","className","label","description","errorMessage","children","props","classNames","clsx","jsxs","RACCheckboxGroup","jsx","Label","Description","FieldError","CheckboxField","inline","labelText","RACCheckbox","Fragment","Checkbox","IconMinus","IconCheck"],"mappings":"gWAiBO,SAASA,EAAc,CAC5B,UAAAC,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,SAAAC,EACA,GAAGC,CACL,EAAuB,CACrB,MAAMC,EAAaC,EAAAA,KAAKP,EAAW,gBAAgB,EACnD,OACEQ,EAAAA,KAACC,EAAAA,cAAA,CAAkB,GAAGJ,EAAO,UAAWC,EACrC,SAAA,CAAAL,GAASS,EAAAA,IAACC,EAAAA,OAAO,SAAAV,CAAA,CAAM,EACvBC,GAAeQ,EAAAA,IAACE,EAAAA,YAAA,CAAa,SAAAV,CAAA,CAAY,EACzCC,GAAgBO,EAAAA,IAACG,EAAAA,WAAA,CAAY,SAAAV,CAAA,CAAa,EAC1CC,CAAA,EACH,CAEJ,CAIO,SAASU,EAAc,CAC5B,SAAAV,EACA,UAAAJ,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,OAAAY,EACA,GAAGV,CACL,EAAuB,CACrB,MAAMC,EAAaC,EAAAA,KACjBP,EACA,iBACAe,GAAU,wBAAA,EAENC,EACJf,IAAU,OAAOG,GAAa,SAAWA,EAAW,QACtD,aACGa,EAAAA,SAAA,CAAY,UAAWX,EAAa,GAAGD,EACtC,SAAAG,EAAAA,KAAAU,EAAAA,SAAA,CACE,SAAA,CAAAR,EAAAA,IAACC,EAAAA,OAAO,SAAAK,CAAA,CAAU,QACjBG,EAAA,EAAS,EACTjB,GAAeQ,EAAAA,IAACE,EAAAA,YAAA,CAAa,SAAAV,CAAA,CAAY,EAC1CQ,EAAAA,IAACG,EAAAA,YAAY,SAAAV,CAAA,CAAa,EACzBa,IAAcZ,GACbM,MAAC,OAAA,CAAK,UAAU,YAAa,SAAAN,CAAA,CAA4B,CAAA,CAAA,CAE7D,CAAA,CACF,CAEJ,CAGO,SAASe,EAAS,CAAE,UAAAnB,EAAW,GAAGK,GAAwB,CAC/D,MAAMC,EAAaC,EAAAA,KAAKP,EAAW,UAAU,EAC7C,OACEQ,EAAAA,KAAC,MAAA,CAAI,UAAWF,EAAa,GAAGD,EAC9B,SAAA,CAAAK,MAACU,EAAAA,WAAU,cAAY,OAAO,UAAU,qBAAqB,KAAK,KAAK,QACtEC,EAAAA,UAAA,CAAU,cAAY,OAAO,UAAU,gBAAgB,KAAK,IAAA,CAAK,CAAA,EACpE,CAEJ"}
|
|
@@ -9,24 +9,24 @@ function $({
|
|
|
9
9
|
className: c,
|
|
10
10
|
label: o,
|
|
11
11
|
description: r,
|
|
12
|
-
errorMessage:
|
|
13
|
-
children:
|
|
12
|
+
errorMessage: s,
|
|
13
|
+
children: i,
|
|
14
14
|
...n
|
|
15
15
|
}) {
|
|
16
16
|
const a = t(c, "checkbox-group");
|
|
17
17
|
return /* @__PURE__ */ l(u, { ...n, className: a, children: [
|
|
18
18
|
o && /* @__PURE__ */ e(h, { children: o }),
|
|
19
19
|
r && /* @__PURE__ */ e(d, { children: r }),
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
s && /* @__PURE__ */ e(x, { children: s }),
|
|
21
|
+
i
|
|
22
22
|
] });
|
|
23
23
|
}
|
|
24
24
|
function y({
|
|
25
25
|
children: c,
|
|
26
26
|
className: o,
|
|
27
27
|
label: r,
|
|
28
|
-
description:
|
|
29
|
-
errorMessage:
|
|
28
|
+
description: s,
|
|
29
|
+
errorMessage: i,
|
|
30
30
|
inline: n,
|
|
31
31
|
...a
|
|
32
32
|
}) {
|
|
@@ -38,9 +38,9 @@ function y({
|
|
|
38
38
|
return /* @__PURE__ */ e(f, { className: b, ...a, children: /* @__PURE__ */ l(p, { children: [
|
|
39
39
|
/* @__PURE__ */ e(h, { children: m }),
|
|
40
40
|
/* @__PURE__ */ e(C, {}),
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */ e(x, { children:
|
|
43
|
-
m !== c && /* @__PURE__ */ e("span", { className: "label", children: c })
|
|
41
|
+
s && /* @__PURE__ */ e(d, { children: s }),
|
|
42
|
+
/* @__PURE__ */ e(x, { children: i }),
|
|
43
|
+
m !== c && /* @__PURE__ */ e("span", { className: "sds-label", children: c })
|
|
44
44
|
] }) });
|
|
45
45
|
}
|
|
46
46
|
function C({ className: c, ...o }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../../../src/ui/primitives/Checkbox/Checkbox.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { IconCheck, IconMinus } from \"icons\";\nimport { Description, FieldError, Label, SharedFieldProps } from \"primitives\";\nimport {\n Checkbox as RACCheckbox,\n CheckboxGroup as RACCheckboxGroup,\n type CheckboxGroupProps as RACCheckboxGroupProps,\n type CheckboxProps as RACCheckboxProps,\n} from \"react-aria-components\";\nimport \"./checkbox.css\";\n\nexport interface CheckboxGroupProps\n extends Omit<RACCheckboxGroupProps, \"children\">,\n SharedFieldProps {\n children?: React.ReactNode;\n}\n\nexport function CheckboxGroup({\n className,\n label,\n description,\n errorMessage,\n children,\n ...props\n}: CheckboxGroupProps) {\n const classNames = clsx(className, \"checkbox-group\");\n return (\n <RACCheckboxGroup {...props} className={classNames}>\n {label && <Label>{label}</Label>}\n {description && <Description>{description}</Description>}\n {errorMessage && <FieldError>{errorMessage}</FieldError>}\n {children}\n </RACCheckboxGroup>\n );\n}\n\nexport type CheckboxFieldProps = RACCheckboxProps &\n SharedFieldProps & { inline?: boolean };\nexport function CheckboxField({\n children,\n className,\n label,\n description,\n errorMessage,\n inline,\n ...props\n}: CheckboxFieldProps) {\n const classNames = clsx(\n className,\n \"checkbox-field\",\n inline && \"checkbox-field--inline\",\n );\n const labelText: string | undefined =\n label || (typeof children === \"string\" ? children : undefined);\n return (\n <RACCheckbox className={classNames} {...props}>\n <>\n <Label>{labelText}</Label>\n <Checkbox />\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n {labelText !== children && (\n <span className=\"label\">{children as React.ReactNode}</span>\n )}\n </>\n </RACCheckbox>\n );\n}\n\nexport type CheckboxProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function Checkbox({ className, ...props }: CheckboxProps) {\n const classNames = clsx(className, \"checkbox\");\n return (\n <div className={classNames} {...props}>\n <IconMinus aria-hidden=\"true\" className=\"icon-indeterminate\" size=\"16\" />\n <IconCheck aria-hidden=\"true\" className=\"icon-selected\" size=\"16\" />\n </div>\n );\n}\n"],"names":["CheckboxGroup","className","label","description","errorMessage","children","props","classNames","clsx","jsxs","RACCheckboxGroup","jsx","Label","Description","FieldError","CheckboxField","inline","labelText","RACCheckbox","Fragment","Checkbox","IconMinus","IconCheck"],"mappings":";;;;;;;AAiBO,SAASA,EAAc;AAAA,EAC5B,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GAAuB;AACrB,QAAMC,IAAaC,EAAKP,GAAW,gBAAgB;AACnD,SACE,gBAAAQ,EAACC,GAAA,EAAkB,GAAGJ,GAAO,WAAWC,GACrC,UAAA;AAAA,IAAAL,KAAS,gBAAAS,EAACC,KAAO,UAAAV,EAAA,CAAM;AAAA,IACvBC,KAAe,gBAAAQ,EAACE,GAAA,EAAa,UAAAV,EAAA,CAAY;AAAA,IACzCC,KAAgB,gBAAAO,EAACG,GAAA,EAAY,UAAAV,EAAA,CAAa;AAAA,IAC1CC;AAAA,EAAA,GACH;AAEJ;AAIO,SAASU,EAAc;AAAA,EAC5B,UAAAV;AAAA,EACA,WAAAJ;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAY;AAAA,EACA,GAAGV;AACL,GAAuB;AACrB,QAAMC,IAAaC;AAAA,IACjBP;AAAA,IACA;AAAA,IACAe,KAAU;AAAA,EAAA,GAENC,IACJf,MAAU,OAAOG,KAAa,WAAWA,IAAW;AACtD,2BACGa,GAAA,EAAY,WAAWX,GAAa,GAAGD,GACtC,UAAA,gBAAAG,EAAAU,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAR,EAACC,KAAO,UAAAK,EAAA,CAAU;AAAA,sBACjBG,GAAA,EAAS;AAAA,IACTjB,KAAe,gBAAAQ,EAACE,GAAA,EAAa,UAAAV,EAAA,CAAY;AAAA,IAC1C,gBAAAQ,EAACG,KAAY,UAAAV,EAAA,CAAa;AAAA,IACzBa,MAAcZ,KACb,gBAAAM,EAAC,QAAA,EAAK,WAAU,
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../../../src/ui/primitives/Checkbox/Checkbox.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { IconCheck, IconMinus } from \"icons\";\nimport { Description, FieldError, Label, SharedFieldProps } from \"primitives\";\nimport {\n Checkbox as RACCheckbox,\n CheckboxGroup as RACCheckboxGroup,\n type CheckboxGroupProps as RACCheckboxGroupProps,\n type CheckboxProps as RACCheckboxProps,\n} from \"react-aria-components\";\nimport \"./checkbox.css\";\n\nexport interface CheckboxGroupProps\n extends Omit<RACCheckboxGroupProps, \"children\">,\n SharedFieldProps {\n children?: React.ReactNode;\n}\n\nexport function CheckboxGroup({\n className,\n label,\n description,\n errorMessage,\n children,\n ...props\n}: CheckboxGroupProps) {\n const classNames = clsx(className, \"checkbox-group\");\n return (\n <RACCheckboxGroup {...props} className={classNames}>\n {label && <Label>{label}</Label>}\n {description && <Description>{description}</Description>}\n {errorMessage && <FieldError>{errorMessage}</FieldError>}\n {children}\n </RACCheckboxGroup>\n );\n}\n\nexport type CheckboxFieldProps = RACCheckboxProps &\n SharedFieldProps & { inline?: boolean };\nexport function CheckboxField({\n children,\n className,\n label,\n description,\n errorMessage,\n inline,\n ...props\n}: CheckboxFieldProps) {\n const classNames = clsx(\n className,\n \"checkbox-field\",\n inline && \"checkbox-field--inline\",\n );\n const labelText: string | undefined =\n label || (typeof children === \"string\" ? children : undefined);\n return (\n <RACCheckbox className={classNames} {...props}>\n <>\n <Label>{labelText}</Label>\n <Checkbox />\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n {labelText !== children && (\n <span className=\"sds-label\">{children as React.ReactNode}</span>\n )}\n </>\n </RACCheckbox>\n );\n}\n\nexport type CheckboxProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function Checkbox({ className, ...props }: CheckboxProps) {\n const classNames = clsx(className, \"checkbox\");\n return (\n <div className={classNames} {...props}>\n <IconMinus aria-hidden=\"true\" className=\"icon-indeterminate\" size=\"16\" />\n <IconCheck aria-hidden=\"true\" className=\"icon-selected\" size=\"16\" />\n </div>\n );\n}\n"],"names":["CheckboxGroup","className","label","description","errorMessage","children","props","classNames","clsx","jsxs","RACCheckboxGroup","jsx","Label","Description","FieldError","CheckboxField","inline","labelText","RACCheckbox","Fragment","Checkbox","IconMinus","IconCheck"],"mappings":";;;;;;;AAiBO,SAASA,EAAc;AAAA,EAC5B,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GAAuB;AACrB,QAAMC,IAAaC,EAAKP,GAAW,gBAAgB;AACnD,SACE,gBAAAQ,EAACC,GAAA,EAAkB,GAAGJ,GAAO,WAAWC,GACrC,UAAA;AAAA,IAAAL,KAAS,gBAAAS,EAACC,KAAO,UAAAV,EAAA,CAAM;AAAA,IACvBC,KAAe,gBAAAQ,EAACE,GAAA,EAAa,UAAAV,EAAA,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("react/jsx-runtime"),n=require("../../../vendor/clsx/dist/clsx.cjs"),l=require("react-aria-components");;/* empty css */function m({...e}){const s=n.clsx("fieldset");return t.jsx("fieldset",{...e,className:s})}function u({...e}){const s=n.clsx("legend");return t.jsx("legend",{...e,className:s})}function d({...e}){const s=n.clsx("field-group");return t.jsx("div",{...e,className:s})}function f({className:e,singleLine:s,...r}){const a=n.clsx(e,"form",s&&"form-single-line");return t.jsx(l.Form,{className:a,...r})}function x(e){const s=c=>Array.isArray(c),r=new FormData(e),a={};return r.forEach((c,o)=>{if(!Reflect.has(a,o)){a[o]=c;return}const i=a[o];s(i)?i.push(c):a[o]=[i,c]}),a}function N({className:e,...s}){const r=n.clsx(e,"field");return t.jsx("div",{className:r,...s})}function F({className:e,...s}){const r=n.clsx(e,"label");return t.jsx(l.Label,{className:r,slot:"label",...s})}function p({className:e,...s}){const r=n.clsx(e,"description");return t.jsx(l.Text,{className:r,slot:"description",...s})}function b({className:e,...s}){const r=n.clsx(e,"error-message");return t.jsx(l.FieldError,{...s,className:r})}function g({className:e,children:s,...r}){const a=n.clsx(e,"keyboard"),c=typeof s=="string"?s.split("").map(o=>t.jsx("kbd",{children:o},o)):s;return t.jsx(l.Keyboard,{...r,className:a,children:c})}exports.Description=p;exports.Field=N;exports.FieldError=b;exports.FieldGroup=d;exports.Fieldset=m;exports.Form=f;exports.Keyboard=g;exports.Label=F;exports.Legend=u;exports.formEventTargetToFormData=x;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),n=require("../../../vendor/clsx/dist/clsx.cjs"),l=require("react-aria-components");;/* empty css */function m({...e}){const s=n.clsx("fieldset");return t.jsx("fieldset",{...e,className:s})}function u({...e}){const s=n.clsx("legend");return t.jsx("legend",{...e,className:s})}function d({...e}){const s=n.clsx("field-group");return t.jsx("div",{...e,className:s})}function f({className:e,singleLine:s,...r}){const a=n.clsx(e,"form",s&&"form-single-line");return t.jsx(l.Form,{className:a,...r})}function x(e){const s=c=>Array.isArray(c),r=new FormData(e),a={};return r.forEach((c,o)=>{if(!Reflect.has(a,o)){a[o]=c;return}const i=a[o];s(i)?i.push(c):a[o]=[i,c]}),a}function N({className:e,...s}){const r=n.clsx(e,"field");return t.jsx("div",{className:r,...s})}function F({className:e,...s}){const r=n.clsx(e,"sds-label");return t.jsx(l.Label,{className:r,slot:"label",...s})}function p({className:e,...s}){const r=n.clsx(e,"description");return t.jsx(l.Text,{className:r,slot:"description",...s})}function b({className:e,...s}){const r=n.clsx(e,"error-message");return t.jsx(l.FieldError,{...s,className:r})}function g({className:e,children:s,...r}){const a=n.clsx(e,"keyboard"),c=typeof s=="string"?s.split("").map(o=>t.jsx("kbd",{children:o},o)):s;return t.jsx(l.Keyboard,{...r,className:a,children:c})}exports.Description=p;exports.Field=N;exports.FieldError=b;exports.FieldGroup=d;exports.Fieldset=m;exports.Form=f;exports.Keyboard=g;exports.Label=F;exports.Legend=u;exports.formEventTargetToFormData=x;
|
|
2
2
|
//# sourceMappingURL=Fieldset.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fieldset.cjs","sources":["../../../../../src/ui/primitives/Fieldset/Fieldset.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { ComponentPropsWithoutRef } from \"react\";\nimport {\n FieldError as RACFieldError,\n Form as RACForm,\n Keyboard as RACKeyboard,\n Label as RACLabel,\n Text as RACText,\n type FieldErrorProps as RACFieldErrorProps,\n type FormProps as RACFormProps,\n type LabelProps as RACLabelProps,\n type TextProps as RACTextProps,\n type ValidationResult as RACValidationResult,\n} from \"react-aria-components\";\nimport \"./fieldset.css\";\n\nexport type FieldsetProps = ComponentPropsWithoutRef<\"fieldset\">;\nexport function Fieldset({ ...props }: FieldsetProps) {\n const classNames = clsx(\"fieldset\");\n return <fieldset {...props} className={classNames} />;\n}\n\nexport type LegendProps = ComponentPropsWithoutRef<\"legend\">;\nexport function Legend({ ...props }: LegendProps) {\n const classNames = clsx(\"legend\");\n return <legend {...props} className={classNames} />;\n}\n\nexport type FieldGroupProps = ComponentPropsWithoutRef<\"div\">;\nexport function FieldGroup({ ...props }: FieldGroupProps) {\n const classNames = clsx(\"field-group\");\n return <div {...props} className={classNames} />;\n}\n\nexport type FormProps = RACFormProps & { singleLine?: boolean };\nexport function Form({ className, singleLine, ...props }: FormProps) {\n const classNames = clsx(className, \"form\", singleLine && \"form-single-line\");\n return <RACForm className={classNames} {...props} />;\n}\n\nexport type FormDataValue = FormDataEntryValue | FormDataEntryValue[];\n// eslint-disable-next-line react-refresh/only-export-components -- utilitário reaproveitado fora deste arquivo, não é um componente\nexport function formEventTargetToFormData(target: HTMLFormElement) {\n const dataIsArray = (data: FormDataValue): data is FormDataEntryValue[] =>\n Array.isArray(data);\n\n const formData = new FormData(target);\n const data: {\n [k: string]: FormDataValue;\n } = {};\n\n formData.forEach((value, key) => {\n if (!Reflect.has(data, key)) {\n data[key] = value;\n return;\n }\n // convert to array from single value\n const currentItem = data[key];\n if (dataIsArray(currentItem)) {\n currentItem.push(value);\n } else {\n data[key] = [currentItem, value];\n }\n });\n return data;\n}\n\n/**\n * Used by TextField, SelectField, TextareaField, SliderField, etc.\n */\nexport type SharedFieldProps = {\n label?: string;\n description?: string;\n placeholder?: string;\n errorMessage?: string | ((validation: RACValidationResult) => string);\n};\n\nexport type FieldProps = ComponentPropsWithoutRef<\"div\">;\nexport function Field({ className, ...props }: FieldProps) {\n const classNames = clsx(className, \"field\");\n return <div className={classNames} {...props} />;\n}\nexport type LabelProps = RACLabelProps;\nexport function Label({ className, ...props }: LabelProps) {\n const classNames = clsx(className, \"label\");\n return <RACLabel className={classNames} slot=\"label\" {...props} />;\n}\nexport type DescriptionProps = RACTextProps;\nexport function Description({ className, ...props }: DescriptionProps) {\n const classNames = clsx(className, \"description\");\n return <RACText className={classNames} slot=\"description\" {...props} />;\n}\nexport type FieldErrorProps = RACFieldErrorProps;\nexport function FieldError({ className, ...props }: FieldErrorProps) {\n const classNames = clsx(className, \"error-message\");\n return <RACFieldError {...props} className={classNames} />;\n}\nexport type KeyboardProps = RACTextProps;\nexport function Keyboard({ className, children, ...props }: KeyboardProps) {\n const classNames = clsx(className, \"keyboard\");\n const items =\n typeof children === \"string\"\n ? children.split(\"\").map((k) => <kbd key={k}>{k}</kbd>)\n : children;\n return (\n <RACKeyboard {...props} className={classNames}>\n {items}\n </RACKeyboard>\n );\n}\n"],"names":["Fieldset","props","classNames","clsx","jsx","Legend","FieldGroup","Form","className","singleLine","RACForm","formEventTargetToFormData","target","dataIsArray","data","formData","value","key","currentItem","Field","Label","RACLabel","Description","RACText","FieldError","RACFieldError","Keyboard","children","items","k","RACKeyboard"],"mappings":"sOAiBO,SAASA,EAAS,CAAE,GAAGC,GAAwB,CACpD,MAAMC,EAAaC,EAAAA,KAAK,UAAU,EAClC,OAAOC,EAAAA,IAAC,WAAA,CAAU,GAAGH,EAAO,UAAWC,EAAY,CACrD,CAGO,SAASG,EAAO,CAAE,GAAGJ,GAAsB,CAChD,MAAMC,EAAaC,EAAAA,KAAK,QAAQ,EAChC,OAAOC,EAAAA,IAAC,SAAA,CAAQ,GAAGH,EAAO,UAAWC,EAAY,CACnD,CAGO,SAASI,EAAW,CAAE,GAAGL,GAA0B,CACxD,MAAMC,EAAaC,EAAAA,KAAK,aAAa,EACrC,OAAOC,EAAAA,IAAC,MAAA,CAAK,GAAGH,EAAO,UAAWC,EAAY,CAChD,CAGO,SAASK,EAAK,CAAE,UAAAC,EAAW,WAAAC,EAAY,GAAGR,GAAoB,CACnE,MAAMC,EAAaC,EAAAA,KAAKK,EAAW,OAAQC,GAAc,kBAAkB,EAC3E,OAAOL,EAAAA,IAACM,EAAAA,KAAA,CAAQ,UAAWR,EAAa,GAAGD,EAAO,CACpD,CAIO,SAASU,EAA0BC,EAAyB,CACjE,MAAMC,EAAeC,GACnB,MAAM,QAAQA,CAAI,EAEdC,EAAW,IAAI,SAASH,CAAM,EAC9BE,EAEF,CAAA,EAEJ,OAAAC,EAAS,QAAQ,CAACC,EAAOC,IAAQ,CAC/B,GAAI,CAAC,QAAQ,IAAIH,EAAMG,CAAG,EAAG,CAC3BH,EAAKG,CAAG,EAAID,EACZ,MACF,CAEA,MAAME,EAAcJ,EAAKG,CAAG,EACxBJ,EAAYK,CAAW,EACzBA,EAAY,KAAKF,CAAK,EAEtBF,EAAKG,CAAG,EAAI,CAACC,EAAaF,CAAK,CAEnC,CAAC,EACMF,CACT,CAaO,SAASK,EAAM,CAAE,UAAAX,EAAW,GAAGP,GAAqB,CACzD,MAAMC,EAAaC,EAAAA,KAAKK,EAAW,OAAO,EAC1C,OAAOJ,EAAAA,IAAC,MAAA,CAAI,UAAWF,EAAa,GAAGD,EAAO,CAChD,CAEO,SAASmB,EAAM,CAAE,UAAAZ,EAAW,GAAGP,GAAqB,CACzD,MAAMC,EAAaC,EAAAA,KAAKK,EAAW,
|
|
1
|
+
{"version":3,"file":"Fieldset.cjs","sources":["../../../../../src/ui/primitives/Fieldset/Fieldset.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { ComponentPropsWithoutRef } from \"react\";\nimport {\n FieldError as RACFieldError,\n Form as RACForm,\n Keyboard as RACKeyboard,\n Label as RACLabel,\n Text as RACText,\n type FieldErrorProps as RACFieldErrorProps,\n type FormProps as RACFormProps,\n type LabelProps as RACLabelProps,\n type TextProps as RACTextProps,\n type ValidationResult as RACValidationResult,\n} from \"react-aria-components\";\nimport \"./fieldset.css\";\n\nexport type FieldsetProps = ComponentPropsWithoutRef<\"fieldset\">;\nexport function Fieldset({ ...props }: FieldsetProps) {\n const classNames = clsx(\"fieldset\");\n return <fieldset {...props} className={classNames} />;\n}\n\nexport type LegendProps = ComponentPropsWithoutRef<\"legend\">;\nexport function Legend({ ...props }: LegendProps) {\n const classNames = clsx(\"legend\");\n return <legend {...props} className={classNames} />;\n}\n\nexport type FieldGroupProps = ComponentPropsWithoutRef<\"div\">;\nexport function FieldGroup({ ...props }: FieldGroupProps) {\n const classNames = clsx(\"field-group\");\n return <div {...props} className={classNames} />;\n}\n\nexport type FormProps = RACFormProps & { singleLine?: boolean };\nexport function Form({ className, singleLine, ...props }: FormProps) {\n const classNames = clsx(className, \"form\", singleLine && \"form-single-line\");\n return <RACForm className={classNames} {...props} />;\n}\n\nexport type FormDataValue = FormDataEntryValue | FormDataEntryValue[];\n// eslint-disable-next-line react-refresh/only-export-components -- utilitário reaproveitado fora deste arquivo, não é um componente\nexport function formEventTargetToFormData(target: HTMLFormElement) {\n const dataIsArray = (data: FormDataValue): data is FormDataEntryValue[] =>\n Array.isArray(data);\n\n const formData = new FormData(target);\n const data: {\n [k: string]: FormDataValue;\n } = {};\n\n formData.forEach((value, key) => {\n if (!Reflect.has(data, key)) {\n data[key] = value;\n return;\n }\n // convert to array from single value\n const currentItem = data[key];\n if (dataIsArray(currentItem)) {\n currentItem.push(value);\n } else {\n data[key] = [currentItem, value];\n }\n });\n return data;\n}\n\n/**\n * Used by TextField, SelectField, TextareaField, SliderField, etc.\n */\nexport type SharedFieldProps = {\n label?: string;\n description?: string;\n placeholder?: string;\n errorMessage?: string | ((validation: RACValidationResult) => string);\n};\n\nexport type FieldProps = ComponentPropsWithoutRef<\"div\">;\nexport function Field({ className, ...props }: FieldProps) {\n const classNames = clsx(className, \"field\");\n return <div className={classNames} {...props} />;\n}\nexport type LabelProps = RACLabelProps;\nexport function Label({ className, ...props }: LabelProps) {\n const classNames = clsx(className, \"sds-label\");\n return <RACLabel className={classNames} slot=\"label\" {...props} />;\n}\nexport type DescriptionProps = RACTextProps;\nexport function Description({ className, ...props }: DescriptionProps) {\n const classNames = clsx(className, \"description\");\n return <RACText className={classNames} slot=\"description\" {...props} />;\n}\nexport type FieldErrorProps = RACFieldErrorProps;\nexport function FieldError({ className, ...props }: FieldErrorProps) {\n const classNames = clsx(className, \"error-message\");\n return <RACFieldError {...props} className={classNames} />;\n}\nexport type KeyboardProps = RACTextProps;\nexport function Keyboard({ className, children, ...props }: KeyboardProps) {\n const classNames = clsx(className, \"keyboard\");\n const items =\n typeof children === \"string\"\n ? children.split(\"\").map((k) => <kbd key={k}>{k}</kbd>)\n : children;\n return (\n <RACKeyboard {...props} className={classNames}>\n {items}\n </RACKeyboard>\n );\n}\n"],"names":["Fieldset","props","classNames","clsx","jsx","Legend","FieldGroup","Form","className","singleLine","RACForm","formEventTargetToFormData","target","dataIsArray","data","formData","value","key","currentItem","Field","Label","RACLabel","Description","RACText","FieldError","RACFieldError","Keyboard","children","items","k","RACKeyboard"],"mappings":"sOAiBO,SAASA,EAAS,CAAE,GAAGC,GAAwB,CACpD,MAAMC,EAAaC,EAAAA,KAAK,UAAU,EAClC,OAAOC,EAAAA,IAAC,WAAA,CAAU,GAAGH,EAAO,UAAWC,EAAY,CACrD,CAGO,SAASG,EAAO,CAAE,GAAGJ,GAAsB,CAChD,MAAMC,EAAaC,EAAAA,KAAK,QAAQ,EAChC,OAAOC,EAAAA,IAAC,SAAA,CAAQ,GAAGH,EAAO,UAAWC,EAAY,CACnD,CAGO,SAASI,EAAW,CAAE,GAAGL,GAA0B,CACxD,MAAMC,EAAaC,EAAAA,KAAK,aAAa,EACrC,OAAOC,EAAAA,IAAC,MAAA,CAAK,GAAGH,EAAO,UAAWC,EAAY,CAChD,CAGO,SAASK,EAAK,CAAE,UAAAC,EAAW,WAAAC,EAAY,GAAGR,GAAoB,CACnE,MAAMC,EAAaC,EAAAA,KAAKK,EAAW,OAAQC,GAAc,kBAAkB,EAC3E,OAAOL,EAAAA,IAACM,EAAAA,KAAA,CAAQ,UAAWR,EAAa,GAAGD,EAAO,CACpD,CAIO,SAASU,EAA0BC,EAAyB,CACjE,MAAMC,EAAeC,GACnB,MAAM,QAAQA,CAAI,EAEdC,EAAW,IAAI,SAASH,CAAM,EAC9BE,EAEF,CAAA,EAEJ,OAAAC,EAAS,QAAQ,CAACC,EAAOC,IAAQ,CAC/B,GAAI,CAAC,QAAQ,IAAIH,EAAMG,CAAG,EAAG,CAC3BH,EAAKG,CAAG,EAAID,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@@ function L({ className: e, ...s }) {
|
|
|
34
34
|
return /* @__PURE__ */ a("div", { className: r, ...s });
|
|
35
35
|
}
|
|
36
36
|
function $({ className: e, ...s }) {
|
|
37
|
-
const r = o(e, "label");
|
|
37
|
+
const r = o(e, "sds-label");
|
|
38
38
|
return /* @__PURE__ */ a(m, { className: r, slot: "label", ...s });
|
|
39
39
|
}
|
|
40
40
|
function h({ className: e, ...s }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fieldset.js","sources":["../../../../../src/ui/primitives/Fieldset/Fieldset.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { ComponentPropsWithoutRef } from \"react\";\nimport {\n FieldError as RACFieldError,\n Form as RACForm,\n Keyboard as RACKeyboard,\n Label as RACLabel,\n Text as RACText,\n type FieldErrorProps as RACFieldErrorProps,\n type FormProps as RACFormProps,\n type LabelProps as RACLabelProps,\n type TextProps as RACTextProps,\n type ValidationResult as RACValidationResult,\n} from \"react-aria-components\";\nimport \"./fieldset.css\";\n\nexport type FieldsetProps = ComponentPropsWithoutRef<\"fieldset\">;\nexport function Fieldset({ ...props }: FieldsetProps) {\n const classNames = clsx(\"fieldset\");\n return <fieldset {...props} className={classNames} />;\n}\n\nexport type LegendProps = ComponentPropsWithoutRef<\"legend\">;\nexport function Legend({ ...props }: LegendProps) {\n const classNames = clsx(\"legend\");\n return <legend {...props} className={classNames} />;\n}\n\nexport type FieldGroupProps = ComponentPropsWithoutRef<\"div\">;\nexport function FieldGroup({ ...props }: FieldGroupProps) {\n const classNames = clsx(\"field-group\");\n return <div {...props} className={classNames} />;\n}\n\nexport type FormProps = RACFormProps & { singleLine?: boolean };\nexport function Form({ className, singleLine, ...props }: FormProps) {\n const classNames = clsx(className, \"form\", singleLine && \"form-single-line\");\n return <RACForm className={classNames} {...props} />;\n}\n\nexport type FormDataValue = FormDataEntryValue | FormDataEntryValue[];\n// eslint-disable-next-line react-refresh/only-export-components -- utilitário reaproveitado fora deste arquivo, não é um componente\nexport function formEventTargetToFormData(target: HTMLFormElement) {\n const dataIsArray = (data: FormDataValue): data is FormDataEntryValue[] =>\n Array.isArray(data);\n\n const formData = new FormData(target);\n const data: {\n [k: string]: FormDataValue;\n } = {};\n\n formData.forEach((value, key) => {\n if (!Reflect.has(data, key)) {\n data[key] = value;\n return;\n }\n // convert to array from single value\n const currentItem = data[key];\n if (dataIsArray(currentItem)) {\n currentItem.push(value);\n } else {\n data[key] = [currentItem, value];\n }\n });\n return data;\n}\n\n/**\n * Used by TextField, SelectField, TextareaField, SliderField, etc.\n */\nexport type SharedFieldProps = {\n label?: string;\n description?: string;\n placeholder?: string;\n errorMessage?: string | ((validation: RACValidationResult) => string);\n};\n\nexport type FieldProps = ComponentPropsWithoutRef<\"div\">;\nexport function Field({ className, ...props }: FieldProps) {\n const classNames = clsx(className, \"field\");\n return <div className={classNames} {...props} />;\n}\nexport type LabelProps = RACLabelProps;\nexport function Label({ className, ...props }: LabelProps) {\n const classNames = clsx(className, \"label\");\n return <RACLabel className={classNames} slot=\"label\" {...props} />;\n}\nexport type DescriptionProps = RACTextProps;\nexport function Description({ className, ...props }: DescriptionProps) {\n const classNames = clsx(className, \"description\");\n return <RACText className={classNames} slot=\"description\" {...props} />;\n}\nexport type FieldErrorProps = RACFieldErrorProps;\nexport function FieldError({ className, ...props }: FieldErrorProps) {\n const classNames = clsx(className, \"error-message\");\n return <RACFieldError {...props} className={classNames} />;\n}\nexport type KeyboardProps = RACTextProps;\nexport function Keyboard({ className, children, ...props }: KeyboardProps) {\n const classNames = clsx(className, \"keyboard\");\n const items =\n typeof children === \"string\"\n ? children.split(\"\").map((k) => <kbd key={k}>{k}</kbd>)\n : children;\n return (\n <RACKeyboard {...props} className={classNames}>\n {items}\n </RACKeyboard>\n );\n}\n"],"names":["Fieldset","props","classNames","clsx","jsx","Legend","FieldGroup","Form","className","singleLine","RACForm","formEventTargetToFormData","target","dataIsArray","data","formData","value","key","currentItem","Field","Label","RACLabel","Description","RACText","FieldError","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AAC,OAAA,EAAI,WAAWF,GAAa,GAAGD,GAAO;AAChD;AAEO,SAASmB,EAAM,EAAE,WAAAZ,GAAW,GAAGP,KAAqB;AACzD,QAAMC,IAAaC,EAAKK,GAAW,
|
|
1
|
+
{"version":3,"file":"Fieldset.js","sources":["../../../../../src/ui/primitives/Fieldset/Fieldset.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { ComponentPropsWithoutRef } from \"react\";\nimport {\n FieldError as RACFieldError,\n Form as RACForm,\n Keyboard as RACKeyboard,\n Label as RACLabel,\n Text as RACText,\n type FieldErrorProps as RACFieldErrorProps,\n type FormProps as RACFormProps,\n type LabelProps as RACLabelProps,\n type TextProps as RACTextProps,\n type ValidationResult as RACValidationResult,\n} from \"react-aria-components\";\nimport \"./fieldset.css\";\n\nexport type FieldsetProps = ComponentPropsWithoutRef<\"fieldset\">;\nexport function Fieldset({ ...props }: FieldsetProps) {\n const classNames = clsx(\"fieldset\");\n return <fieldset {...props} className={classNames} />;\n}\n\nexport type LegendProps = ComponentPropsWithoutRef<\"legend\">;\nexport function Legend({ ...props }: LegendProps) {\n const classNames = clsx(\"legend\");\n return <legend {...props} className={classNames} />;\n}\n\nexport type FieldGroupProps = ComponentPropsWithoutRef<\"div\">;\nexport function FieldGroup({ ...props }: FieldGroupProps) {\n const classNames = clsx(\"field-group\");\n return <div {...props} className={classNames} />;\n}\n\nexport type FormProps = RACFormProps & { singleLine?: boolean };\nexport function Form({ className, singleLine, ...props }: FormProps) {\n const classNames = clsx(className, \"form\", singleLine && \"form-single-line\");\n return <RACForm className={classNames} {...props} />;\n}\n\nexport type FormDataValue = FormDataEntryValue | FormDataEntryValue[];\n// eslint-disable-next-line react-refresh/only-export-components -- utilitário reaproveitado fora deste arquivo, não é um componente\nexport function formEventTargetToFormData(target: HTMLFormElement) {\n const dataIsArray = (data: FormDataValue): data is FormDataEntryValue[] =>\n Array.isArray(data);\n\n const formData = new FormData(target);\n const data: {\n [k: string]: FormDataValue;\n } = {};\n\n formData.forEach((value, key) => {\n if (!Reflect.has(data, key)) {\n data[key] = value;\n return;\n }\n // convert to array from single value\n const currentItem = data[key];\n if (dataIsArray(currentItem)) {\n currentItem.push(value);\n } else {\n data[key] = [currentItem, value];\n }\n });\n return data;\n}\n\n/**\n * Used by TextField, SelectField, TextareaField, SliderField, etc.\n */\nexport type SharedFieldProps = {\n label?: string;\n description?: string;\n placeholder?: string;\n errorMessage?: string | ((validation: RACValidationResult) => string);\n};\n\nexport type FieldProps = ComponentPropsWithoutRef<\"div\">;\nexport function Field({ className, ...props }: FieldProps) {\n const classNames = clsx(className, \"field\");\n return <div className={classNames} {...props} />;\n}\nexport type LabelProps = RACLabelProps;\nexport function Label({ className, ...props }: LabelProps) {\n const classNames = clsx(className, \"sds-label\");\n return <RACLabel className={classNames} slot=\"label\" {...props} />;\n}\nexport type DescriptionProps = RACTextProps;\nexport function Description({ className, ...props }: DescriptionProps) {\n const classNames = clsx(className, \"description\");\n return <RACText className={classNames} slot=\"description\" {...props} />;\n}\nexport type FieldErrorProps = RACFieldErrorProps;\nexport function FieldError({ className, ...props }: FieldErrorProps) {\n const classNames = clsx(className, \"error-message\");\n return <RACFieldError {...props} className={classNames} />;\n}\nexport type KeyboardProps = RACTextProps;\nexport function Keyboard({ className, children, ...props }: KeyboardProps) {\n const classNames = clsx(className, \"keyboard\");\n const items =\n typeof children === \"string\"\n ? children.split(\"\").map((k) => <kbd key={k}>{k}</kbd>)\n : children;\n return (\n <RACKeyboard {...props} className={classNames}>\n {items}\n </RACKeyboard>\n );\n}\n"],"names":["Fieldset","props","classNames","clsx","jsx","Legend","FieldGroup","Form","className","singleLine","RACForm","formEventTargetToFormData","target","dataIsArray","data","formData","value","key","currentItem","Field","Label","RACLabel","Description","RACText","FieldError","RACFieldError","Keyboard","children","items","k","RACKeyboard"],"mappings":";;;;AAiBO,SAASA,EAAS,EAAE,GAAGC,KAAwB;AACpD,QAAMC,IAAaC,EAAK,UAAU;AAClC,SAAO,gBAAAC,EAA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W;AAC9C,2BAAQa,GAAA,EAAS,WAAWnB,GAAY,MAAK,SAAS,GAAGD,GAAO;AAClE;AAEO,SAASqB,EAAY,EAAE,WAAAd,GAAW,GAAGP,KAA2B;AACrE,QAAMC,IAAaC,EAAKK,GAAW,aAAa;AAChD,2BAAQe,GAAA,EAAQ,WAAWrB,GAAY,MAAK,eAAe,GAAGD,GAAO;AACvE;AAEO,SAASuB,EAAW,EAAE,WAAAhB,GAAW,GAAGP,KAA0B;AACnE,QAAMC,IAAaC,EAAKK,GAAW,eAAe;AAClD,SAAO,gBAAAJ,EAACqB,GAAA,EAAe,GAAGxB,GAAO,WAAWC,GAAY;AAC1D;AAEO,SAASwB,EAAS,EAAE,WAAAlB,GAAW,UAAAmB,GAAU,GAAG1B,KAAwB;AACzE,QAAMC,IAAaC,EAAKK,GAAW,UAAU,GACvCoB,IACJ,OAAOD,KAAa,WAChBA,EAAS,MAAM,EAAE,EAAE,IAAI,CAACE,MAAM,gBAAAzB,EAAC,OAAA,EAAa,UAAAyB,KAAJA,CAAM,CAAM,IACpDF;AACN,2BACGG,GAAA,EAAa,GAAG7B,GAAO,WAAWC,GAChC,UAAA0B,GACH;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=require("../../../vendor/clsx/dist/clsx.cjs");;/* empty css */const h=require("../../icons/IconArrowLeft.cjs"),N=require("../../icons/IconArrowRight.cjs"),A=require("../../hooks/useMediaQuery.cjs"),c=require("../../utils/AnchorOrButton.cjs");function q(a){return"totalPages"in a}function L(a){if(q(a)){const{page:t,totalPages:r,onPageChange:u,previousLabel:m,nextLabel:p,className:f}=a;return r<=1?null:i.jsxs("nav",{"aria-label":"Page navigation",className:l.clsx(f,"pagination"),children:[i.jsx(g,{isDisabled:t<=1,onPress:()=>u(Math.max(1,t-1)),children:m}),i.jsx(x,{children:j(t,r).map((o,v)=>o==="..."?i.jsx(b,{},`gap-${v}`):i.jsx(d,{current:o===t,onPress:()=>u(o),children:String(o)},o))}),i.jsx(P,{isDisabled:t>=r,onPress:()=>u(Math.min(r,t+1)),children:p})]})}const{"aria-label":n="Page navigation",className:e,...s}=a;return i.jsx("nav",{"aria-label":n,...s,className:l.clsx(e,"pagination")})}function g({href:a=null,onPress:n,isDisabled:e=!1,children:s="Previous"}){return i.jsxs(c.AnchorOrButton,{...a!==null?{href:a}:{},onPress:n,isDisabled:e||a===null&&!n,className:l.clsx("pagination-btn","pagination-nav"),"aria-label":"Previous page",children:[i.jsx(h.IconArrowLeft,{size:"16"}),s]})}function P({href:a=null,onPress:n,isDisabled:e=!1,children:s="Next"}){return i.jsxs(c.AnchorOrButton,{...a!==null?{href:a}:{},onPress:n,isDisabled:e||a===null&&!n,className:l.clsx("pagination-btn","pagination-nav"),"aria-label":"Next page",children:[s,i.jsx(N.IconArrowRight,{size:"16"})]})}function x({children:a}){const{isTabletUp:n}=A.useMediaQuery();return n&&i.jsx("span",{className:"pagination-list",children:a})}function d({href:a,onPress:n,children:e,current:s=!1}){return i.jsx(c.AnchorOrButton,{...a?{href:a}:{},onPress:n,"aria-label":`Page ${e}`,"aria-current":s?"page":void 0,className:l.clsx("pagination-btn",s&&"pagination-btn-active"),children:e})}function b(){return i.jsx("div",{"aria-hidden":"true",className:"pagination-gap",children:"…"})}function j(a,n){if(n<=6)return Array.from({length:n},(t,r)=>r+1);const e=[1,2,3],s=[n-1,n];return a<=4?[...e,"...",...s]:a>=n-3?[1,2,"...",n-2,n-1,n]:[1,"...",a-1,a,a+1,"...",n]}exports.Pagination=L;exports.PaginationGap=b;exports.PaginationList=x;exports.PaginationNext=P;exports.PaginationPage=d;exports.PaginationPrevious=g;exports.buildPaginationPages=j;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=require("../../../vendor/clsx/dist/clsx.cjs");;/* empty css */const h=require("../../icons/IconArrowLeft.cjs"),N=require("../../icons/IconArrowRight.cjs"),A=require("../../hooks/useMediaQuery.cjs"),c=require("../../utils/AnchorOrButton.cjs");function q(a){return"totalPages"in a}function L(a){if(q(a)){const{page:t,totalPages:r,onPageChange:u,previousLabel:m,nextLabel:p,className:f}=a;return r<=1?null:i.jsxs("nav",{"aria-label":"Page navigation",className:l.clsx(f,"sds-pagination"),children:[i.jsx(g,{isDisabled:t<=1,onPress:()=>u(Math.max(1,t-1)),children:m}),i.jsx(x,{children:j(t,r).map((o,v)=>o==="..."?i.jsx(b,{},`gap-${v}`):i.jsx(d,{current:o===t,onPress:()=>u(o),children:String(o)},o))}),i.jsx(P,{isDisabled:t>=r,onPress:()=>u(Math.min(r,t+1)),children:p})]})}const{"aria-label":n="Page navigation",className:e,...s}=a;return i.jsx("nav",{"aria-label":n,...s,className:l.clsx(e,"sds-pagination")})}function g({href:a=null,onPress:n,isDisabled:e=!1,children:s="Previous"}){return i.jsxs(c.AnchorOrButton,{...a!==null?{href:a}:{},onPress:n,isDisabled:e||a===null&&!n,className:l.clsx("pagination-btn","pagination-nav"),"aria-label":"Previous page",children:[i.jsx(h.IconArrowLeft,{size:"16"}),s]})}function P({href:a=null,onPress:n,isDisabled:e=!1,children:s="Next"}){return i.jsxs(c.AnchorOrButton,{...a!==null?{href:a}:{},onPress:n,isDisabled:e||a===null&&!n,className:l.clsx("pagination-btn","pagination-nav"),"aria-label":"Next page",children:[s,i.jsx(N.IconArrowRight,{size:"16"})]})}function x({children:a}){const{isTabletUp:n}=A.useMediaQuery();return n&&i.jsx("span",{className:"pagination-list",children:a})}function d({href:a,onPress:n,children:e,current:s=!1}){return i.jsx(c.AnchorOrButton,{...a?{href:a}:{},onPress:n,"aria-label":`Page ${e}`,"aria-current":s?"page":void 0,className:l.clsx("pagination-btn",s&&"pagination-btn-active"),children:e})}function b(){return i.jsx("div",{"aria-hidden":"true",className:"pagination-gap",children:"…"})}function j(a,n){if(n<=6)return Array.from({length:n},(t,r)=>r+1);const e=[1,2,3],s=[n-1,n];return a<=4?[...e,"...",...s]:a>=n-3?[1,2,"...",n-2,n-1,n]:[1,"...",a-1,a,a+1,"...",n]}exports.Pagination=L;exports.PaginationGap=b;exports.PaginationList=x;exports.PaginationNext=P;exports.PaginationPage=d;exports.PaginationPrevious=g;exports.buildPaginationPages=j;
|
|
2
2
|
//# sourceMappingURL=Pagination.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.cjs","sources":["../../../../../src/ui/primitives/Pagination/Pagination.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useMediaQuery } from \"hooks\";\nimport { IconArrowLeft, IconArrowRight } from \"icons\";\nimport type React from \"react\";\nimport { AnchorOrButton } from \"utils\";\nimport \"./pagination.css\";\n\nexport type PaginationManualProps = React.ComponentPropsWithoutRef<\"nav\">;\n\nexport type PaginationControlledProps = {\n page: number;\n totalPages: number;\n onPageChange: (page: number) => void;\n previousLabel: string;\n nextLabel: string;\n className?: string;\n};\n\nexport type PaginationProps = PaginationManualProps | PaginationControlledProps;\n\nfunction isControlledProps(\n props: PaginationProps,\n): props is PaginationControlledProps {\n return \"totalPages\" in props;\n}\n\nexport function Pagination(props: PaginationProps) {\n if (isControlledProps(props)) {\n const { page, totalPages, onPageChange, previousLabel, nextLabel, className } = props;\n if (totalPages <= 1) return null;\n return (\n <nav aria-label=\"Page navigation\" className={clsx(className, \"pagination\")}>\n <PaginationPrevious isDisabled={page <= 1} onPress={() => onPageChange(Math.max(1, page - 1))}>\n {previousLabel}\n </PaginationPrevious>\n <PaginationList>\n {buildPaginationPages(page, totalPages).map((p, i) =>\n p === \"...\" ? (\n <PaginationGap key={`gap-${i}`} />\n ) : (\n <PaginationPage key={p} current={p === page} onPress={() => onPageChange(p)}>\n {String(p)}\n </PaginationPage>\n ),\n )}\n </PaginationList>\n <PaginationNext isDisabled={page >= totalPages} onPress={() => onPageChange(Math.min(totalPages, page + 1))}>\n {nextLabel}\n </PaginationNext>\n </nav>\n );\n }\n const { \"aria-label\": ariaLabel = \"Page navigation\", className, ...rest } = props;\n return <nav aria-label={ariaLabel} {...rest} className={clsx(className, \"pagination\")} />;\n}\n\nexport function PaginationPrevious({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Previous\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Previous page\"\n >\n <IconArrowLeft size=\"16\" />\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationNext({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Next\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Next page\"\n >\n {children}\n <IconArrowRight size=\"16\" />\n </AnchorOrButton>\n );\n}\n\nexport function PaginationList({ children }: { children: React.ReactNode }) {\n const { isTabletUp } = useMediaQuery();\n return isTabletUp && <span className=\"pagination-list\">{children}</span>;\n}\n\nexport function PaginationPage({\n href,\n onPress,\n children,\n current = false,\n}: {\n href?: string;\n onPress?: () => void;\n children: string;\n current?: boolean;\n}) {\n return (\n <AnchorOrButton\n {...(href ? { href } : {})}\n onPress={onPress}\n aria-label={`Page ${children}`}\n aria-current={current ? \"page\" : undefined}\n className={clsx(\"pagination-btn\", current && \"pagination-btn-active\")}\n >\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationGap() {\n return (\n <div aria-hidden=\"true\" className=\"pagination-gap\">\n …\n </div>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components -- utilitário reaproveitado fora deste arquivo, não é um componente\nexport function buildPaginationPages(current: number, total: number): Array<number | \"...\"> {\n if (total <= 6) return Array.from({ length: total }, (_, i) => i + 1);\n const head = [1, 2, 3];\n const tail = [total - 1, total];\n if (current <= 4) return [...head, \"...\", ...tail];\n if (current >= total - 3) return [1, 2, \"...\", total - 2, total - 1, total];\n return [1, \"...\", current - 1, current, current + 1, \"...\", total];\n}\n"],"names":["isControlledProps","props","Pagination","page","totalPages","onPageChange","previousLabel","nextLabel","className","jsxs","clsx","jsx","PaginationPrevious","PaginationList","buildPaginationPages","p","i","PaginationGap","PaginationPage","PaginationNext","ariaLabel","rest","href","onPress","isDisabled","children","AnchorOrButton","IconArrowLeft","IconArrowRight","isTabletUp","useMediaQuery","current","total","_","head","tail"],"mappings":"yXAoBA,SAASA,EACPC,EACoC,CACpC,MAAO,eAAgBA,CACzB,CAEO,SAASC,EAAWD,EAAwB,CACjD,GAAID,EAAkBC,CAAK,EAAG,CAC5B,KAAM,CAAE,KAAAE,EAAM,WAAAC,EAAY,aAAAC,EAAc,cAAAC,EAAe,UAAAC,EAAW,UAAAC,GAAcP,EAChF,OAAIG,GAAc,EAAU,KAE1BK,OAAC,OAAI,aAAW,kBAAkB,UAAWC,EAAAA,KAAKF,EAAW,
|
|
1
|
+
{"version":3,"file":"Pagination.cjs","sources":["../../../../../src/ui/primitives/Pagination/Pagination.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useMediaQuery } from \"hooks\";\nimport { IconArrowLeft, IconArrowRight } from \"icons\";\nimport type React from \"react\";\nimport { AnchorOrButton } from \"utils\";\nimport \"./pagination.css\";\n\nexport type PaginationManualProps = React.ComponentPropsWithoutRef<\"nav\">;\n\nexport type PaginationControlledProps = {\n page: number;\n totalPages: number;\n onPageChange: (page: number) => void;\n previousLabel: string;\n nextLabel: string;\n className?: string;\n};\n\nexport type PaginationProps = PaginationManualProps | PaginationControlledProps;\n\nfunction isControlledProps(\n props: PaginationProps,\n): props is PaginationControlledProps {\n return \"totalPages\" in props;\n}\n\nexport function Pagination(props: PaginationProps) {\n if (isControlledProps(props)) {\n const { page, totalPages, onPageChange, previousLabel, nextLabel, className } = props;\n if (totalPages <= 1) return null;\n return (\n <nav aria-label=\"Page navigation\" className={clsx(className, \"sds-pagination\")}>\n <PaginationPrevious isDisabled={page <= 1} onPress={() => onPageChange(Math.max(1, page - 1))}>\n {previousLabel}\n </PaginationPrevious>\n <PaginationList>\n {buildPaginationPages(page, totalPages).map((p, i) =>\n p === \"...\" ? (\n <PaginationGap key={`gap-${i}`} />\n ) : (\n <PaginationPage key={p} current={p === page} onPress={() => onPageChange(p)}>\n {String(p)}\n </PaginationPage>\n ),\n )}\n </PaginationList>\n <PaginationNext isDisabled={page >= totalPages} onPress={() => onPageChange(Math.min(totalPages, page + 1))}>\n {nextLabel}\n </PaginationNext>\n </nav>\n );\n }\n const { \"aria-label\": ariaLabel = \"Page navigation\", className, ...rest } = props;\n return <nav aria-label={ariaLabel} {...rest} className={clsx(className, \"sds-pagination\")} />;\n}\n\nexport function PaginationPrevious({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Previous\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Previous page\"\n >\n <IconArrowLeft size=\"16\" />\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationNext({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Next\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Next page\"\n >\n {children}\n <IconArrowRight size=\"16\" />\n </AnchorOrButton>\n );\n}\n\nexport function PaginationList({ children }: { children: React.ReactNode }) {\n const { isTabletUp } = useMediaQuery();\n return isTabletUp && <span className=\"pagination-list\">{children}</span>;\n}\n\nexport function PaginationPage({\n href,\n onPress,\n children,\n current = false,\n}: {\n href?: string;\n onPress?: () => void;\n children: string;\n current?: boolean;\n}) {\n return (\n <AnchorOrButton\n {...(href ? { href } : {})}\n onPress={onPress}\n aria-label={`Page ${children}`}\n aria-current={current ? \"page\" : undefined}\n className={clsx(\"pagination-btn\", current && \"pagination-btn-active\")}\n >\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationGap() {\n return (\n <div aria-hidden=\"true\" className=\"pagination-gap\">\n …\n </div>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components -- utilitário reaproveitado fora deste arquivo, não é um componente\nexport function buildPaginationPages(current: number, total: number): Array<number | \"...\"> {\n if (total <= 6) return Array.from({ length: total }, (_, i) => i + 1);\n const head = [1, 2, 3];\n const tail = [total - 1, total];\n if (current <= 4) return [...head, \"...\", ...tail];\n if (current >= total - 3) return [1, 2, \"...\", total - 2, total - 1, total];\n return [1, \"...\", current - 1, current, current + 1, \"...\", total];\n}\n"],"names":["isControlledProps","props","Pagination","page","totalPages","onPageChange","previousLabel","nextLabel","className","jsxs","clsx","jsx","PaginationPrevious","PaginationList","buildPaginationPages","p","i","PaginationGap","PaginationPage","PaginationNext","ariaLabel","rest","href","onPress","isDisabled","children","AnchorOrButton","IconArrowLeft","IconArrowRight","isTabletUp","useMediaQuery","current","total","_","head","tail"],"mappings":"yXAoBA,SAASA,EACPC,EACoC,CACpC,MAAO,eAAgBA,CACzB,CAEO,SAASC,EAAWD,EAAwB,CACjD,GAAID,EAAkBC,CAAK,EAAG,CAC5B,KAAM,CAAE,KAAAE,EAAM,WAAAC,EAAY,aAAAC,EAAc,cAAAC,EAAe,UAAAC,EAAW,UAAAC,GAAcP,EAChF,OAAIG,GAAc,EAAU,KAE1BK,OAAC,OAAI,aAAW,kBAAkB,UAAWC,EAAAA,KA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AAQ,EAAU,CAAC,EAAG,EAAG,MAAOA,EAAQ,EAAGA,EAAQ,EAAGA,CAAK,EACnE,CAAC,EAAG,MAAOD,EAAU,EAAGA,EAASA,EAAU,EAAG,MAAOC,CAAK,CACnE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as u, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { clsx as o } from "../../../vendor/clsx/dist/clsx.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { IconArrowLeft as
|
|
4
|
+
import { IconArrowLeft as b } from "../../icons/IconArrowLeft.js";
|
|
5
5
|
import { IconArrowRight as f } from "../../icons/IconArrowRight.js";
|
|
6
6
|
import { useMediaQuery as v } from "../../hooks/useMediaQuery.js";
|
|
7
7
|
import { AnchorOrButton as c } from "../../utils/AnchorOrButton.js";
|
|
@@ -10,17 +10,17 @@ function N(a) {
|
|
|
10
10
|
}
|
|
11
11
|
function B(a) {
|
|
12
12
|
if (N(a)) {
|
|
13
|
-
const { page: t, totalPages: s, onPageChange: g, previousLabel: m, nextLabel: p, className:
|
|
14
|
-
return s <= 1 ? null : /* @__PURE__ */ u("nav", { "aria-label": "Page navigation", className: o(
|
|
13
|
+
const { page: t, totalPages: s, onPageChange: g, previousLabel: m, nextLabel: p, className: d } = a;
|
|
14
|
+
return s <= 1 ? null : /* @__PURE__ */ u("nav", { "aria-label": "Page navigation", className: o(d, "sds-pagination"), children: [
|
|
15
15
|
/* @__PURE__ */ i(h, { isDisabled: t <= 1, onPress: () => g(Math.max(1, t - 1)), children: m }),
|
|
16
16
|
/* @__PURE__ */ i(L, { children: M(t, s).map(
|
|
17
|
-
(l,
|
|
17
|
+
(l, P) => l === "..." ? /* @__PURE__ */ i(D, {}, `gap-${P}`) : /* @__PURE__ */ i(A, { current: l === t, onPress: () => g(l), children: String(l) }, l)
|
|
18
18
|
) }),
|
|
19
19
|
/* @__PURE__ */ i(x, { isDisabled: t >= s, onPress: () => g(Math.min(s, t + 1)), children: p })
|
|
20
20
|
] });
|
|
21
21
|
}
|
|
22
22
|
const { "aria-label": n = "Page navigation", className: e, ...r } = a;
|
|
23
|
-
return /* @__PURE__ */ i("nav", { "aria-label": n, ...r, className: o(e, "pagination") });
|
|
23
|
+
return /* @__PURE__ */ i("nav", { "aria-label": n, ...r, className: o(e, "sds-pagination") });
|
|
24
24
|
}
|
|
25
25
|
function h({
|
|
26
26
|
href: a = null,
|
|
@@ -37,7 +37,7 @@ function h({
|
|
|
37
37
|
className: o("pagination-btn", "pagination-nav"),
|
|
38
38
|
"aria-label": "Previous page",
|
|
39
39
|
children: [
|
|
40
|
-
/* @__PURE__ */ i(
|
|
40
|
+
/* @__PURE__ */ i(b, { size: "16" }),
|
|
41
41
|
r
|
|
42
42
|
]
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","sources":["../../../../../src/ui/primitives/Pagination/Pagination.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useMediaQuery } from \"hooks\";\nimport { IconArrowLeft, IconArrowRight } from \"icons\";\nimport type React from \"react\";\nimport { AnchorOrButton } from \"utils\";\nimport \"./pagination.css\";\n\nexport type PaginationManualProps = React.ComponentPropsWithoutRef<\"nav\">;\n\nexport type PaginationControlledProps = {\n page: number;\n totalPages: number;\n onPageChange: (page: number) => void;\n previousLabel: string;\n nextLabel: string;\n className?: string;\n};\n\nexport type PaginationProps = PaginationManualProps | PaginationControlledProps;\n\nfunction isControlledProps(\n props: PaginationProps,\n): props is PaginationControlledProps {\n return \"totalPages\" in props;\n}\n\nexport function Pagination(props: PaginationProps) {\n if (isControlledProps(props)) {\n const { page, totalPages, onPageChange, previousLabel, nextLabel, className } = props;\n if (totalPages <= 1) return null;\n return (\n <nav aria-label=\"Page navigation\" className={clsx(className, \"pagination\")}>\n <PaginationPrevious isDisabled={page <= 1} onPress={() => onPageChange(Math.max(1, page - 1))}>\n {previousLabel}\n </PaginationPrevious>\n <PaginationList>\n {buildPaginationPages(page, totalPages).map((p, i) =>\n p === \"...\" ? (\n <PaginationGap key={`gap-${i}`} />\n ) : (\n <PaginationPage key={p} current={p === page} onPress={() => onPageChange(p)}>\n {String(p)}\n </PaginationPage>\n ),\n )}\n </PaginationList>\n <PaginationNext isDisabled={page >= totalPages} onPress={() => onPageChange(Math.min(totalPages, page + 1))}>\n {nextLabel}\n </PaginationNext>\n </nav>\n );\n }\n const { \"aria-label\": ariaLabel = \"Page navigation\", className, ...rest } = props;\n return <nav aria-label={ariaLabel} {...rest} className={clsx(className, \"pagination\")} />;\n}\n\nexport function PaginationPrevious({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Previous\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Previous page\"\n >\n <IconArrowLeft size=\"16\" />\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationNext({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Next\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Next page\"\n >\n {children}\n <IconArrowRight size=\"16\" />\n </AnchorOrButton>\n );\n}\n\nexport function PaginationList({ children }: { children: React.ReactNode }) {\n const { isTabletUp } = useMediaQuery();\n return isTabletUp && <span className=\"pagination-list\">{children}</span>;\n}\n\nexport function PaginationPage({\n href,\n onPress,\n children,\n current = false,\n}: {\n href?: string;\n onPress?: () => void;\n children: string;\n current?: boolean;\n}) {\n return (\n <AnchorOrButton\n {...(href ? { href } : {})}\n onPress={onPress}\n aria-label={`Page ${children}`}\n aria-current={current ? \"page\" : undefined}\n className={clsx(\"pagination-btn\", current && \"pagination-btn-active\")}\n >\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationGap() {\n return (\n <div aria-hidden=\"true\" className=\"pagination-gap\">\n …\n </div>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components -- utilitário reaproveitado fora deste arquivo, não é um componente\nexport function buildPaginationPages(current: number, total: number): Array<number | \"...\"> {\n if (total <= 6) return Array.from({ length: total }, (_, i) => i + 1);\n const head = [1, 2, 3];\n const tail = [total - 1, total];\n if (current <= 4) return [...head, \"...\", ...tail];\n if (current >= total - 3) return [1, 2, \"...\", total - 2, total - 1, total];\n return [1, \"...\", current - 1, current, current + 1, \"...\", total];\n}\n"],"names":["isControlledProps","props","Pagination","page","totalPages","onPageChange","previousLabel","nextLabel","className","jsxs","clsx","jsx","PaginationPrevious","PaginationList","buildPaginationPages","p","i","PaginationGap","PaginationPage","PaginationNext","ariaLabel","rest","href","onPress","isDisabled","children","AnchorOrButton","IconArrowLeft","IconArrowRight","isTabletUp","useMediaQuery","current","total","_","head","tail"],"mappings":";;;;;;;AAoBA,SAASA,EACPC,GACoC;AACpC,SAAO,gBAAgBA;AACzB;AAEO,SAASC,EAAWD,GAAwB;AACjD,MAAID,EAAkBC,CAAK,GAAG;AAC5B,UAAM,EAAE,MAAAE,GAAM,YAAAC,GAAY,cAAAC,GAAc,eAAAC,GAAe,WAAAC,GAAW,WAAAC,MAAcP;AAChF,WAAIG,KAAc,IAAU,OAE1B,gBAAAK,EAAC,SAAI,cAAW,mBAAkB,WAAWC,EAAKF,GAAW,
|
|
1
|
+
{"version":3,"file":"Pagination.js","sources":["../../../../../src/ui/primitives/Pagination/Pagination.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useMediaQuery } from \"hooks\";\nimport { IconArrowLeft, IconArrowRight } from \"icons\";\nimport type React from \"react\";\nimport { AnchorOrButton } from \"utils\";\nimport \"./pagination.css\";\n\nexport type PaginationManualProps = React.ComponentPropsWithoutRef<\"nav\">;\n\nexport type PaginationControlledProps = {\n page: number;\n totalPages: number;\n onPageChange: (page: number) => void;\n previousLabel: string;\n nextLabel: string;\n className?: string;\n};\n\nexport type PaginationProps = PaginationManualProps | PaginationControlledProps;\n\nfunction isControlledProps(\n props: PaginationProps,\n): props is PaginationControlledProps {\n return \"totalPages\" in props;\n}\n\nexport function Pagination(props: PaginationProps) {\n if (isControlledProps(props)) {\n const { page, totalPages, onPageChange, previousLabel, nextLabel, className } = props;\n if (totalPages <= 1) return null;\n return (\n <nav aria-label=\"Page navigation\" className={clsx(className, \"sds-pagination\")}>\n <PaginationPrevious isDisabled={page <= 1} onPress={() => onPageChange(Math.max(1, page - 1))}>\n {previousLabel}\n </PaginationPrevious>\n <PaginationList>\n {buildPaginationPages(page, totalPages).map((p, i) =>\n p === \"...\" ? (\n <PaginationGap key={`gap-${i}`} />\n ) : (\n <PaginationPage key={p} current={p === page} onPress={() => onPageChange(p)}>\n {String(p)}\n </PaginationPage>\n ),\n )}\n </PaginationList>\n <PaginationNext isDisabled={page >= totalPages} onPress={() => onPageChange(Math.min(totalPages, page + 1))}>\n {nextLabel}\n </PaginationNext>\n </nav>\n );\n }\n const { \"aria-label\": ariaLabel = \"Page navigation\", className, ...rest } = props;\n return <nav aria-label={ariaLabel} {...rest} className={clsx(className, \"sds-pagination\")} />;\n}\n\nexport function PaginationPrevious({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Previous\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Previous page\"\n >\n <IconArrowLeft size=\"16\" />\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationNext({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Next\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Next page\"\n >\n {children}\n <IconArrowRight size=\"16\" />\n </AnchorOrButton>\n );\n}\n\nexport function PaginationList({ children }: { children: React.ReactNode }) {\n const { isTabletUp } = useMediaQuery();\n return isTabletUp && <span className=\"pagination-list\">{children}</span>;\n}\n\nexport function PaginationPage({\n href,\n onPress,\n children,\n current = false,\n}: {\n href?: string;\n onPress?: () => void;\n children: string;\n current?: boolean;\n}) {\n return (\n <AnchorOrButton\n {...(href ? { href } : {})}\n onPress={onPress}\n aria-label={`Page ${children}`}\n aria-current={current ? \"page\" : undefined}\n className={clsx(\"pagination-btn\", current && \"pagination-btn-active\")}\n >\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationGap() {\n return (\n <div aria-hidden=\"true\" className=\"pagination-gap\">\n …\n </div>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components -- utilitário reaproveitado fora deste arquivo, não é um componente\nexport function buildPaginationPages(current: number, total: number): Array<number | \"...\"> {\n if (total <= 6) return Array.from({ length: total }, (_, i) => i + 1);\n const head = [1, 2, 3];\n const tail = [total - 1, total];\n if (current <= 4) return [...head, \"...\", ...tail];\n if (current >= total - 3) return [1, 2, \"...\", total - 2, total - 1, total];\n return [1, \"...\", current - 1, current, current + 1, \"...\", total];\n}\n"],"names":["isControlledProps","props","Pagination","page","totalPages","onPageChange","previousLabel","nextLabel","className","jsxs","clsx","jsx","PaginationPrevious","PaginationList","buildPaginationPages","p","i","PaginationGap","PaginationPage","PaginationNext","ariaLabel","rest","href","onPress","isDisabled","children","AnchorOrButton","IconArrowLeft","IconArrowRight","isTabletUp","useMediaQuery","current","total","_","head","tail"],"mappings":";;;;;;;AAoBA,SAASA,EACPC,GACoC;AAC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;AAAA,MAC5B,gBAAcM,IAAU,SAAS;AAAA,MACjC,WAAWrB,EAAK,kBAAkBqB,KAAW,uBAAuB;AAAA,MAEnE,UAAAN;AAAA,IAAA;AAAA,EAAA;AAGP;AAEO,SAASR,IAAgB;AAC9B,2BACG,OAAA,EAAI,eAAY,QAAO,WAAU,kBAAiB,UAAA,KAEnD;AAEJ;AAGO,SAASH,EAAqBiB,GAAiBC,GAAsC;AAC1F,MAAIA,KAAS,EAAG,QAAO,MAAM,KAAK,EAAE,QAAQA,EAAA,GAAS,CAACC,GAAGjB,MAAMA,IAAI,CAAC;AACpE,QAAMkB,IAAO,CAAC,GAAG,GAAG,CAAC,GACfC,IAAO,CAACH,IAAQ,GAAGA,CAAK;AAC9B,SAAID,KAAW,IAAU,CAAC,GAAGG,GAAM,OAAO,GAAGC,CAAI,IAC7CJ,KAAWC,IAAQ,IAAU,CAAC,GAAG,GAAG,OAAOA,IAAQ,GAAGA,IAAQ,GAAGA,CAAK,IACnE,CAAC,GAAG,OAAOD,IAAU,GAAGA,GAASA,IAAU,GAAG,OAAOC,CAAK;AACnE;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),d=require("../../../vendor/clsx/dist/clsx.cjs"),u=require("react-aria-components");;/* empty css */const a=require("../Fieldset/Fieldset.cjs");function m({className:e,label:i,description:r,errorMessage:o,children:n,...c}){const l=d.clsx(e,"radio-group");return s.jsxs(u.RadioGroup,{...c,className:l,children:[i&&s.jsx(a.Label,{children:i}),r&&s.jsx(a.Description,{children:r}),o&&s.jsx(a.FieldError,{children:o}),n]})}function h({children:e,className:i,label:r,description:o,errorMessage:n,inline:c,...l}){const j=d.clsx(i,"radio-field",c&&"radio-field--inline"),t=r||(typeof e=="string"?e:void 0);return s.jsx(u.Radio,{className:j,...l,children:s.jsxs(s.Fragment,{children:[s.jsx(a.Label,{children:t}),s.jsx(x,{}),o&&s.jsx(a.Description,{children:o}),s.jsx(a.FieldError,{children:n}),t!==e&&s.jsx("span",{className:"sds-label",children:e})]})})}function x({className:e,...i}){const r=d.clsx(e,"radio");return s.jsx("div",{className:r,...i,children:s.jsx("span",{"aria-hidden":"true",className:"radio-check"})})}exports.Radio=x;exports.RadioField=h;exports.RadioGroup=m;
|
|
2
2
|
//# sourceMappingURL=Radio.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.cjs","sources":["../../../../../src/ui/primitives/Radio/Radio.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { Description, FieldError, Label, SharedFieldProps } from \"primitives\";\nimport {\n Radio as RACRadio,\n RadioGroup as RACRadioGroup,\n type RadioGroupProps as RACRadioGroupProps,\n type RadioProps as RACRadioProps,\n} from \"react-aria-components\";\nimport \"./radio.css\";\n\nexport interface RadioGroupProps\n extends Omit<RACRadioGroupProps, \"children\">,\n SharedFieldProps {\n children?: React.ReactNode;\n}\n\nexport function RadioGroup({\n className,\n label,\n description,\n errorMessage,\n children,\n ...props\n}: RadioGroupProps) {\n const classNames = clsx(className, \"radio-group\");\n return (\n <RACRadioGroup {...props} className={classNames}>\n {label && <Label>{label}</Label>}\n {description && <Description>{description}</Description>}\n {errorMessage && <FieldError>{errorMessage}</FieldError>}\n {children}\n </RACRadioGroup>\n );\n}\n\nexport type RadioFieldProps = RACRadioProps &\n SharedFieldProps & { inline?: boolean };\nexport function RadioField({\n children,\n className,\n label,\n description,\n errorMessage,\n inline,\n ...props\n}: RadioFieldProps) {\n const classNames = clsx(\n className,\n \"radio-field\",\n inline && \"radio-field--inline\",\n );\n const labelText: string | undefined =\n label || (typeof children === \"string\" ? children : undefined);\n return (\n <RACRadio className={classNames} {...props}>\n <>\n <Label>{labelText}</Label>\n <Radio />\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n {labelText !== children && (\n <span className=\"label\">{children as React.ReactNode}</span>\n )}\n </>\n </RACRadio>\n );\n}\n\nexport type RadioProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function Radio({ className, ...props }: RadioProps) {\n const classNames = clsx(className, \"radio\");\n return (\n <div className={classNames} {...props}>\n <span aria-hidden=\"true\" className=\"radio-check\" />\n </div>\n );\n}\n"],"names":["RadioGroup","className","label","description","errorMessage","children","props","classNames","clsx","jsxs","RACRadioGroup","jsx","Label","Description","FieldError","RadioField","inline","labelText","RACRadio","Fragment","Radio"],"mappings":"+QAgBO,SAASA,EAAW,CACzB,UAAAC,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,SAAAC,EACA,GAAGC,CACL,EAAoB,CAClB,MAAMC,EAAaC,EAAAA,KAAKP,EAAW,aAAa,EAChD,OACEQ,EAAAA,KAACC,EAAAA,WAAA,CAAe,GAAGJ,EAAO,UAAWC,EAClC,SAAA,CAAAL,GAASS,EAAAA,IAACC,EAAAA,OAAO,SAAAV,CAAA,CAAM,EACvBC,GAAeQ,EAAAA,IAACE,EAAAA,YAAA,CAAa,SAAAV,CAAA,CAAY,EACzCC,GAAgBO,EAAAA,IAACG,EAAAA,WAAA,CAAY,SAAAV,CAAA,CAAa,EAC1CC,CAAA,EACH,CAEJ,CAIO,SAASU,EAAW,CACzB,SAAAV,EACA,UAAAJ,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,OAAAY,EACA,GAAGV,CACL,EAAoB,CAClB,MAAMC,EAAaC,EAAAA,KACjBP,EACA,cACAe,GAAU,qBAAA,EAENC,EACJf,IAAU,OAAOG,GAAa,SAAWA,EAAW,QACtD,aACGa,EAAAA,MAAA,CAAS,UAAWX,EAAa,GAAGD,EACnC,SAAAG,EAAAA,KAAAU,EAAAA,SAAA,CACE,SAAA,CAAAR,EAAAA,IAACC,EAAAA,OAAO,SAAAK,CAAA,CAAU,QACjBG,EAAA,EAAM,EACNjB,GAAeQ,EAAAA,IAACE,EAAAA,YAAA,CAAa,SAAAV,CAAA,CAAY,EAC1CQ,EAAAA,IAACG,EAAAA,YAAY,SAAAV,CAAA,CAAa,EACzBa,IAAcZ,GACbM,MAAC,OAAA,CAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"Radio.cjs","sources":["../../../../../src/ui/primitives/Radio/Radio.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { Description, FieldError, Label, SharedFieldProps } from \"primitives\";\nimport {\n Radio as RACRadio,\n RadioGroup as RACRadioGroup,\n type RadioGroupProps as RACRadioGroupProps,\n type RadioProps as RACRadioProps,\n} from \"react-aria-components\";\nimport \"./radio.css\";\n\nexport interface RadioGroupProps\n extends Omit<RACRadioGroupProps, \"children\">,\n SharedFieldProps {\n children?: React.ReactNode;\n}\n\nexport function RadioGroup({\n className,\n label,\n description,\n errorMessage,\n children,\n ...props\n}: RadioGroupProps) {\n const classNames = clsx(className, \"radio-group\");\n return (\n <RACRadioGroup {...props} className={classNames}>\n {label && <Label>{label}</Label>}\n {description && <Description>{description}</Description>}\n {errorMessage && <FieldError>{errorMessage}</FieldError>}\n {children}\n </RACRadioGroup>\n );\n}\n\nexport type RadioFieldProps = RACRadioProps &\n SharedFieldProps & { inline?: boolean };\nexport function RadioField({\n children,\n className,\n label,\n description,\n errorMessage,\n inline,\n ...props\n}: RadioFieldProps) {\n const classNames = clsx(\n className,\n \"radio-field\",\n inline && \"radio-field--inline\",\n );\n const labelText: string | undefined =\n label || (typeof children === \"string\" ? children : undefined);\n return (\n <RACRadio className={classNames} {...props}>\n <>\n <Label>{labelText}</Label>\n <Radio />\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n {labelText !== children && (\n <span className=\"sds-label\">{children as React.ReactNode}</span>\n )}\n </>\n </RACRadio>\n );\n}\n\nexport type RadioProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function Radio({ className, ...props }: RadioProps) {\n const classNames = clsx(className, \"radio\");\n return (\n <div className={classNames} {...props}>\n <span aria-hidden=\"true\" className=\"radio-check\" />\n </div>\n );\n}\n"],"names":["RadioGroup","className","label","description","errorMessage","children","props","classNames","clsx","jsxs","RACRadioGroup","jsx","Label","Description","FieldError","RadioField","inline","labelText","RACRadio","Fragment","Radio"],"mappings":"+QAgBO,SAASA,EAAW,CACzB,UAAAC,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,SAAAC,EACA,GAAGC,CACL,EAAoB,CAClB,MAAMC,EAAaC,EAAAA,KAAKP,EAAW,aAAa,EAChD,OACEQ,EAAAA,KAACC,EAAAA,WAAA,CAAe,GAAGJ,EAAO,UAAWC,EAClC,SAAA,CAAAL,GAASS,EAAAA,IAACC,EAAAA,OAAO,SAAAV,CAAA,CAAM,EACvBC,GAAeQ,EAAAA,IAACE,EAAAA,YAAA,CAAa,SAAAV,CAAA,CAAY,EACzCC,GAAgBO,EAAAA,IAACG,EAAAA,WAAA,CAAY,SAAAV,CAAA,CAAa,EAC1CC,CAAA,EACH,CAEJ,CAIO,SAASU,EAAW,CACzB,SAAAV,EACA,UAAAJ,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,OAAAY,EACA,GAAGV,CACL,EAAoB,CAClB,MAAMC,EAAaC,EAAAA,KACjBP,EACA,cACAe,GAAU,qBAAA,EAENC,EACJf,IAAU,OAAOG,GAAa,SAAWA,EAAW,QACtD,aACGa,EAAAA,MAAA,CAAS,UAAWX,EAAa,GAAGD,EACnC,SAAAG,EAAAA,KAAAU,EAAAA,SAAA,CACE,SAAA,CAAAR,EAAAA,IAACC,EAAAA,OAAO,SAAAK,CAAA,CAAU,QACjBG,EAAA,EAAM,EACNjB,GAAeQ,EAAAA,IAACE,EAAAA,YAAA,CAAa,SAAAV,CAAA,CAAY,EAC1CQ,EAAAA,IAACG,EAAAA,YAAY,SAAAV,CAAA,CAAa,EACzBa,IAAcZ,GACbM,MAAC,OAAA,CAAK,UAAU,YAAa,SAAAN,CAAA,CAA4B,CAAA,CAAA,CAE7D,CAAA,CACF,CAEJ,CAGO,SAASe,EAAM,CAAE,UAAAnB,EAAW,GAAGK,GAAqB,CACzD,MAAMC,EAAaC,EAAAA,KAAKP,EAAW,OAAO,EAC1C,OACEU,EAAAA,IAAC,MAAA,CAAI,UAAWJ,EAAa,GAAGD,EAC9B,SAAAK,EAAAA,IAAC,OAAA,CAAK,cAAY,OAAO,UAAU,aAAA,CAAc,EACnD,CAEJ"}
|
|
@@ -9,10 +9,10 @@ function v({
|
|
|
9
9
|
description: o,
|
|
10
10
|
errorMessage: s,
|
|
11
11
|
children: e,
|
|
12
|
-
...
|
|
12
|
+
...d
|
|
13
13
|
}) {
|
|
14
|
-
const
|
|
15
|
-
return /* @__PURE__ */ t(N, { ...
|
|
14
|
+
const n = c(i, "radio-group");
|
|
15
|
+
return /* @__PURE__ */ t(N, { ...d, className: n, children: [
|
|
16
16
|
r && /* @__PURE__ */ a(m, { children: r }),
|
|
17
17
|
o && /* @__PURE__ */ a(p, { children: o }),
|
|
18
18
|
s && /* @__PURE__ */ a(u, { children: s }),
|
|
@@ -25,20 +25,20 @@ function $({
|
|
|
25
25
|
label: o,
|
|
26
26
|
description: s,
|
|
27
27
|
errorMessage: e,
|
|
28
|
-
inline:
|
|
29
|
-
...
|
|
28
|
+
inline: d,
|
|
29
|
+
...n
|
|
30
30
|
}) {
|
|
31
31
|
const f = c(
|
|
32
32
|
r,
|
|
33
33
|
"radio-field",
|
|
34
|
-
|
|
34
|
+
d && "radio-field--inline"
|
|
35
35
|
), l = o || (typeof i == "string" ? i : void 0);
|
|
36
|
-
return /* @__PURE__ */ a(R, { className: f, ...
|
|
36
|
+
return /* @__PURE__ */ a(R, { className: f, ...n, children: /* @__PURE__ */ t(h, { children: [
|
|
37
37
|
/* @__PURE__ */ a(m, { children: l }),
|
|
38
38
|
/* @__PURE__ */ a(x, {}),
|
|
39
39
|
s && /* @__PURE__ */ a(p, { children: s }),
|
|
40
40
|
/* @__PURE__ */ a(u, { children: e }),
|
|
41
|
-
l !== i && /* @__PURE__ */ a("span", { className: "label", children: i })
|
|
41
|
+
l !== i && /* @__PURE__ */ a("span", { className: "sds-label", children: i })
|
|
42
42
|
] }) });
|
|
43
43
|
}
|
|
44
44
|
function x({ className: i, ...r }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sources":["../../../../../src/ui/primitives/Radio/Radio.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { Description, FieldError, Label, SharedFieldProps } from \"primitives\";\nimport {\n Radio as RACRadio,\n RadioGroup as RACRadioGroup,\n type RadioGroupProps as RACRadioGroupProps,\n type RadioProps as RACRadioProps,\n} from \"react-aria-components\";\nimport \"./radio.css\";\n\nexport interface RadioGroupProps\n extends Omit<RACRadioGroupProps, \"children\">,\n SharedFieldProps {\n children?: React.ReactNode;\n}\n\nexport function RadioGroup({\n className,\n label,\n description,\n errorMessage,\n children,\n ...props\n}: RadioGroupProps) {\n const classNames = clsx(className, \"radio-group\");\n return (\n <RACRadioGroup {...props} className={classNames}>\n {label && <Label>{label}</Label>}\n {description && <Description>{description}</Description>}\n {errorMessage && <FieldError>{errorMessage}</FieldError>}\n {children}\n </RACRadioGroup>\n );\n}\n\nexport type RadioFieldProps = RACRadioProps &\n SharedFieldProps & { inline?: boolean };\nexport function RadioField({\n children,\n className,\n label,\n description,\n errorMessage,\n inline,\n ...props\n}: RadioFieldProps) {\n const classNames = clsx(\n className,\n \"radio-field\",\n inline && \"radio-field--inline\",\n );\n const labelText: string | undefined =\n label || (typeof children === \"string\" ? children : undefined);\n return (\n <RACRadio className={classNames} {...props}>\n <>\n <Label>{labelText}</Label>\n <Radio />\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n {labelText !== children && (\n <span className=\"label\">{children as React.ReactNode}</span>\n )}\n </>\n </RACRadio>\n );\n}\n\nexport type RadioProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function Radio({ className, ...props }: RadioProps) {\n const classNames = clsx(className, \"radio\");\n return (\n <div className={classNames} {...props}>\n <span aria-hidden=\"true\" className=\"radio-check\" />\n </div>\n );\n}\n"],"names":["RadioGroup","className","label","description","errorMessage","children","props","classNames","clsx","jsxs","RACRadioGroup","jsx","Label","Description","FieldError","RadioField","inline","labelText","RACRadio","Fragment","Radio"],"mappings":";;;;;AAgBO,SAASA,EAAW;AAAA,EACzB,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GAAoB;AAClB,QAAMC,IAAaC,EAAKP,GAAW,aAAa;AAChD,SACE,gBAAAQ,EAACC,GAAA,EAAe,GAAGJ,GAAO,WAAWC,GAClC,UAAA;AAAA,IAAAL,KAAS,gBAAAS,EAACC,KAAO,UAAAV,EAAA,CAAM;AAAA,IACvBC,KAAe,gBAAAQ,EAACE,GAAA,EAAa,UAAAV,EAAA,CAAY;AAAA,IACzCC,KAAgB,gBAAAO,EAACG,GAAA,EAAY,UAAAV,EAAA,CAAa;AAAA,IAC1CC;AAAA,EAAA,GACH;AAEJ;AAIO,SAASU,EAAW;AAAA,EACzB,UAAAV;AAAA,EACA,WAAAJ;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAY;AAAA,EACA,GAAGV;AACL,GAAoB;AAClB,QAAMC,IAAaC;AAAA,IACjBP;AAAA,IACA;AAAA,IACAe,KAAU;AAAA,EAAA,GAENC,IACJf,MAAU,OAAOG,KAAa,WAAWA,IAAW;AACtD,2BACGa,GAAA,EAAS,WAAWX,GAAa,GAAGD,GACnC,UAAA,gBAAAG,EAAAU,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAR,EAACC,KAAO,UAAAK,EAAA,CAAU;AAAA,sBACjBG,GAAA,EAAM;AAAA,IACNjB,KAAe,gBAAAQ,EAACE,GAAA,EAAa,UAAAV,EAAA,CAAY;AAAA,IAC1C,gBAAAQ,EAACG,KAAY,UAAAV,EAAA,CAAa;AAAA,IACzBa,MAAcZ,KACb,gBAAAM,EAAC,QAAA,EAAK,WAAU,
|
|
1
|
+
{"version":3,"file":"Radio.js","sources":["../../../../../src/ui/primitives/Radio/Radio.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { Description, FieldError, Label, SharedFieldProps } from \"primitives\";\nimport {\n Radio as RACRadio,\n RadioGroup as RACRadioGroup,\n type RadioGroupProps as RACRadioGroupProps,\n type RadioProps as RACRadioProps,\n} from \"react-aria-components\";\nimport \"./radio.css\";\n\nexport interface RadioGroupProps\n extends Omit<RACRadioGroupProps, \"children\">,\n SharedFieldProps {\n children?: React.ReactNode;\n}\n\nexport function RadioGroup({\n className,\n label,\n description,\n errorMessage,\n children,\n ...props\n}: RadioGroupProps) {\n const classNames = clsx(className, \"radio-group\");\n return (\n <RACRadioGroup {...props} className={classNames}>\n {label && <Label>{label}</Label>}\n {description && <Description>{description}</Description>}\n {errorMessage && <FieldError>{errorMessage}</FieldError>}\n {children}\n </RACRadioGroup>\n );\n}\n\nexport type RadioFieldProps = RACRadioProps &\n SharedFieldProps & { inline?: boolean };\nexport function RadioField({\n children,\n className,\n label,\n description,\n errorMessage,\n inline,\n ...props\n}: RadioFieldProps) {\n const classNames = clsx(\n className,\n \"radio-field\",\n inline && \"radio-field--inline\",\n );\n const labelText: string | undefined =\n label || (typeof children === \"string\" ? children : undefined);\n return (\n <RACRadio className={classNames} {...props}>\n <>\n <Label>{labelText}</Label>\n <Radio />\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n {labelText !== children && (\n <span className=\"sds-label\">{children as React.ReactNode}</span>\n )}\n </>\n </RACRadio>\n );\n}\n\nexport type RadioProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function Radio({ className, ...props }: RadioProps) {\n const classNames = clsx(className, \"radio\");\n return (\n <div className={classNames} {...props}>\n <span aria-hidden=\"true\" className=\"radio-check\" />\n </div>\n );\n}\n"],"names":["RadioGroup","className","label","description","errorMessage","children","props","classNames","clsx","jsxs","RACRadioGroup","jsx","Label","Description","FieldError","RadioField","inline","labelText","RACRadio","Fragment","Radio"],"mappings":";;;;;AAgBO,SAASA,EAAW;AAAA,EACzB,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GAAoB;AAClB,QAAMC,IAAaC,EAAKP,GAAW,aAAa;AAChD,SACE,gBAAAQ,EAACC,GAAA,EAAe,GAAGJ,GAAO,WAAWC,GAClC,UAAA;AAAA,IAAAL,KAAS,gBAAAS,EAACC,KAAO,UAAAV,EAAA,CAAM;AAAA,IACvBC,KAAe,gBAAAQ,EAACE,GAAA,EAAa,UAAAV,EAAA,CAAY;AAAA,IACzCC,KAAgB,gBAAAO,EAACG,GAAA,EAAY,UAAAV,EAAA,CAAa;AAAA,IAC1CC;AAAA,EAAA,GACH;AAEJ;AAIO,SAASU,EAAW;AAAA,EACzB,UAAAV;AAAA,EACA,WAAAJ;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAY;AAAA,EACA,GAAGV;AACL,GAAoB;AAClB,QAAMC,IAAaC;AAAA,IACjBP;AAAA,IACA;AAAA,IACAe,KAAU;AAAA,EAAA,GAENC,IACJf,MAAU,OAAOG,KAAa,WAAWA,IAAW;AACtD,2BACGa,GAAA,EAAS,WAAWX,GAAa,GAAGD,GACnC,UAAA,gBAAAG,EAAAU,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAR,EAACC,KAAO,UAAAK,EAAA,CAAU;AAAA,sBACjBG,GAAA,EAAM;AAAA,IACNjB,KAAe,gBAAAQ,EAACE,GAAA,EAAa,UAAAV,EAAA,CAAY;AAAA,IAC1C,gBAAAQ,EAACG,KAAY,UAAAV,EAAA,CAAa;AAAA,IACzBa,MAAcZ,KACb,gBAAAM,EAAC,QAAA,EAAK,WAAU,aAAa,UAAAN,EAAA,CAA4B;AAAA,EAAA,EAAA,CAE7D,EAAA,CACF;AAEJ;AAGO,SAASe,EAAM,EAAE,WAAAnB,GAAW,GAAGK,KAAqB;AACzD,QAAMC,IAAaC,EAAKP,GAAW,OAAO;AAC1C,SACE,gBAAAU,EAAC,OAAA,EAAI,WAAWJ,GAAa,GAAGD,GAC9B,UAAA,gBAAAK,EAAC,QAAA,EAAK,eAAY,QAAO,WAAU,cAAA,CAAc,GACnD;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),r=require("../../../vendor/clsx/dist/clsx.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),r=require("../../../vendor/clsx/dist/clsx.cjs"),h=require("react-aria-components");;/* empty css */const i=require("../Fieldset/Fieldset.cjs");function x({className:e,...c}){const t=r.clsx(e,"switch-group");return s.jsx("div",{...c,className:t})}function j({children:e,className:c,label:t,description:n,errorMessage:o,...u}){const d=r.clsx(c,"switch-field"),l=t||(typeof e=="string"?e:void 0);return s.jsx(h.Switch,{className:d,...u,children:s.jsxs(s.Fragment,{children:[s.jsx(i.Label,{children:l}),s.jsx(a,{}),n&&s.jsx(i.Description,{children:n}),s.jsx(i.FieldError,{children:o}),l!==e&&e]})})}function a({className:e,...c}){const t=r.clsx(e,"sds-switch");return s.jsx("div",{className:t,...c,children:s.jsx("span",{"aria-hidden":"true",className:"switch-icon"})})}exports.Switch=a;exports.SwitchField=j;exports.SwitchGroup=x;
|
|
2
2
|
//# sourceMappingURL=Switch.cjs.map
|