@ps1ui/core 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/base.css +378 -0
- package/dist/components/Anchor/Anchor.d.mts +12 -0
- package/dist/components/Anchor/Anchor.mjs +15 -0
- package/dist/components/Anchor/Anchor.mjs.map +1 -0
- package/dist/components/Button/Button.d.mts +24 -0
- package/dist/components/Button/Button.mjs +17 -0
- package/dist/components/Button/Button.mjs.map +1 -0
- package/dist/components/Card/Card.d.mts +7 -0
- package/dist/components/Card/Card.mjs +14 -0
- package/dist/components/Card/Card.mjs.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.mts +9 -0
- package/dist/components/Checkbox/Checkbox.mjs +23 -0
- package/dist/components/Checkbox/Checkbox.mjs.map +1 -0
- package/dist/components/Code/Code.d.mts +7 -0
- package/dist/components/Code/Code.mjs +14 -0
- package/dist/components/Code/Code.mjs.map +1 -0
- package/dist/components/CodeBlock/CodeBlock.d.mts +12 -0
- package/dist/components/CodeBlock/CodeBlock.mjs +44 -0
- package/dist/components/CodeBlock/CodeBlock.mjs.map +1 -0
- package/dist/components/CodeBlock/refractor.d.mts +7 -0
- package/dist/components/CodeBlock/refractor.mjs +26 -0
- package/dist/components/CodeBlock/refractor.mjs.map +1 -0
- package/dist/components/Container/Container.d.mts +13 -0
- package/dist/components/Container/Container.mjs +24 -0
- package/dist/components/Container/Container.mjs.map +1 -0
- package/dist/components/Details/Details.d.mts +9 -0
- package/dist/components/Details/Details.mjs +20 -0
- package/dist/components/Details/Details.mjs.map +1 -0
- package/dist/components/Grid/Grid.d.mts +13 -0
- package/dist/components/Grid/Grid.mjs +24 -0
- package/dist/components/Grid/Grid.mjs.map +1 -0
- package/dist/components/GridItem/GridItem.d.mts +10 -0
- package/dist/components/GridItem/GridItem.mjs +21 -0
- package/dist/components/GridItem/GridItem.mjs.map +1 -0
- package/dist/components/Heading/Heading.d.mts +22 -0
- package/dist/components/Heading/Heading.mjs +53 -0
- package/dist/components/Heading/Heading.mjs.map +1 -0
- package/dist/components/Input/Input.d.mts +7 -0
- package/dist/components/Input/Input.mjs +15 -0
- package/dist/components/Input/Input.mjs.map +1 -0
- package/dist/components/Label/Label.d.mts +7 -0
- package/dist/components/Label/Label.mjs +14 -0
- package/dist/components/Label/Label.mjs.map +1 -0
- package/dist/components/List/List.d.mts +11 -0
- package/dist/components/List/List.mjs +15 -0
- package/dist/components/List/List.mjs.map +1 -0
- package/dist/components/ListItem/ListItem.d.mts +7 -0
- package/dist/components/ListItem/ListItem.mjs +13 -0
- package/dist/components/ListItem/ListItem.mjs.map +1 -0
- package/dist/components/PS1Root/PS1Root.d.mts +7 -0
- package/dist/components/PS1Root/PS1Root.mjs +13 -0
- package/dist/components/PS1Root/PS1Root.mjs.map +1 -0
- package/dist/components/Stack/Stack.d.mts +19 -0
- package/dist/components/Stack/Stack.mjs +48 -0
- package/dist/components/Stack/Stack.mjs.map +1 -0
- package/dist/components/Table/Table.d.mts +7 -0
- package/dist/components/Table/Table.mjs +25 -0
- package/dist/components/Table/Table.mjs.map +1 -0
- package/dist/components/Tbody/Tbody.d.mts +7 -0
- package/dist/components/Tbody/Tbody.mjs +13 -0
- package/dist/components/Tbody/Tbody.mjs.map +1 -0
- package/dist/components/Td/Td.d.mts +7 -0
- package/dist/components/Td/Td.mjs +13 -0
- package/dist/components/Td/Td.mjs.map +1 -0
- package/dist/components/Text/Text.d.mts +23 -0
- package/dist/components/Text/Text.mjs +34 -0
- package/dist/components/Text/Text.mjs.map +1 -0
- package/dist/components/Th/Th.d.mts +7 -0
- package/dist/components/Th/Th.mjs +13 -0
- package/dist/components/Th/Th.mjs.map +1 -0
- package/dist/components/Thead/Thead.d.mts +7 -0
- package/dist/components/Thead/Thead.mjs +13 -0
- package/dist/components/Thead/Thead.mjs.map +1 -0
- package/dist/components/Tr/Tr.d.mts +7 -0
- package/dist/components/Tr/Tr.mjs +13 -0
- package/dist/components/Tr/Tr.mjs.map +1 -0
- package/dist/components.css +1870 -0
- package/dist/index.d.mts +28 -0
- package/dist/index.mjs +25 -0
- package/dist/styles.css +1930 -0
- package/dist/utils/cx.mjs +8 -0
- package/dist/utils/cx.mjs.map +1 -0
- package/dist/utils/numbers.mjs +8 -0
- package/dist/utils/numbers.mjs.map +1 -0
- package/dist/utils/responsive.d.mts +6 -0
- package/dist/utils/responsive.mjs +39 -0
- package/dist/utils/responsive.mjs.map +1 -0
- package/dist/utils/spacing.d.mts +5 -0
- package/dist/utils/spacing.mjs +8 -0
- package/dist/utils/spacing.mjs.map +1 -0
- package/dist/utils/typography.d.mts +5 -0
- package/dist/utils/typography.mjs +16 -0
- package/dist/utils/typography.mjs.map +1 -0
- package/dist/utils/useMergedRef.mjs +30 -0
- package/dist/utils/useMergedRef.mjs.map +1 -0
- package/dist/utils/useScrollableFocus.mjs +29 -0
- package/dist/utils/useScrollableFocus.mjs.map +1 -0
- package/package.json +84 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { refractor } from "refractor";
|
|
2
|
+
import dart from "refractor/dart";
|
|
3
|
+
import docker from "refractor/docker";
|
|
4
|
+
import graphql from "refractor/graphql";
|
|
5
|
+
import jsx from "refractor/jsx";
|
|
6
|
+
import nginx from "refractor/nginx";
|
|
7
|
+
import powershell from "refractor/powershell";
|
|
8
|
+
import shellSession from "refractor/shell-session";
|
|
9
|
+
import toml from "refractor/toml";
|
|
10
|
+
import tsx from "refractor/tsx";
|
|
11
|
+
import zig from "refractor/zig";
|
|
12
|
+
//#region src/components/CodeBlock/refractor.ts
|
|
13
|
+
refractor.register(dart);
|
|
14
|
+
refractor.register(docker);
|
|
15
|
+
refractor.register(graphql);
|
|
16
|
+
refractor.register(jsx);
|
|
17
|
+
refractor.register(nginx);
|
|
18
|
+
refractor.register(powershell);
|
|
19
|
+
refractor.register(shellSession);
|
|
20
|
+
refractor.register(toml);
|
|
21
|
+
refractor.register(tsx);
|
|
22
|
+
refractor.register(zig);
|
|
23
|
+
//#endregion
|
|
24
|
+
export { refractor };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=refractor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refractor.mjs","names":[],"sources":["../../../src/components/CodeBlock/refractor.ts"],"sourcesContent":["// Shared Refractor singleton. `refractor` (as opposed to `refractor/core`) ships with\n// ~36 \"checked\" languages pre-registered — see refractor/lib/common.js. We layer a\n// curated set of additional languages on top so common ecosystem grammars work out of\n// the box. Static imports on purpose: only CodeBlock consumers pay for them (this\n// module is its own side-effectful dist chunk — see package.json `sideEffects`),\n// and lazy `import()` registration would make highlighting async (unhighlighted\n// first paint, no SSR story) for a few KB per grammar. Keep this list intentional.\nimport { refractor } from \"refractor\";\n\nimport dart from \"refractor/dart\";\nimport docker from \"refractor/docker\";\nimport graphql from \"refractor/graphql\";\nimport jsx from \"refractor/jsx\";\nimport nginx from \"refractor/nginx\";\nimport powershell from \"refractor/powershell\";\nimport shellSession from \"refractor/shell-session\";\nimport toml from \"refractor/toml\";\nimport tsx from \"refractor/tsx\";\nimport zig from \"refractor/zig\";\n\nrefractor.register(dart);\nrefractor.register(docker);\nrefractor.register(graphql);\nrefractor.register(jsx);\nrefractor.register(nginx);\nrefractor.register(powershell);\nrefractor.register(shellSession);\nrefractor.register(toml);\nrefractor.register(tsx);\nrefractor.register(zig);\n\n// Canonical display names of every language the singleton has registered AND\n// makes sense to expose to consumers. Kept as an `as const` tuple purely so\n// `CodeBlockLanguage` can derive from it — the array itself is intentionally\n// unexported (tree-shakes to nothing in consumer bundles).\n//\n// If you add/remove a `refractor.register(...)` above OR alter what refractor's\n// `common` bundle registers, update this list to match. `scripts/check-languages.mjs`\n// enforces the invariant that every name here is actually registered at runtime.\n//\n// Deliberately EXCLUDED even though refractor registers them:\n// - `clike`, `markup-templating` — base grammars other languages extend; passing\n// them as the top-level language produces near-empty highlighting.\n//\n// Aliases (e.g. `ts` → `typescript`, `html` → `markup`) are NOT listed here; they\n// still resolve at runtime via refractor's alias table and pass through the type\n// via the `(string & {})` escape hatch on `CodeBlockProps[\"language\"]`.\nconst KNOWN_LANGS = [\n // from refractor/lib/common.js (registered by `import { refractor } from \"refractor\"`)\n \"arduino\",\n \"bash\",\n \"basic\",\n \"c\",\n \"cpp\",\n \"csharp\",\n \"css\",\n \"diff\",\n \"go\",\n \"ini\",\n \"java\",\n \"javascript\",\n \"json\",\n \"kotlin\",\n \"less\",\n \"lua\",\n \"makefile\",\n \"markdown\",\n \"markup\",\n \"objectivec\",\n \"perl\",\n \"php\",\n \"python\",\n \"r\",\n \"regex\",\n \"ruby\",\n \"rust\",\n \"sass\",\n \"scss\",\n \"sql\",\n \"swift\",\n \"typescript\",\n \"vbnet\",\n \"yaml\",\n // registered above\n \"dart\",\n \"docker\",\n \"graphql\",\n \"jsx\",\n \"nginx\",\n \"powershell\",\n \"shell-session\",\n \"toml\",\n \"tsx\",\n \"zig\",\n] as const;\n\nexport type CodeBlockLanguage = (typeof KNOWN_LANGS)[number];\n\nexport { refractor };\n"],"mappings":";;;;;;;;;;;;AAoBA,UAAU,SAAS,IAAI;AACvB,UAAU,SAAS,MAAM;AACzB,UAAU,SAAS,OAAO;AAC1B,UAAU,SAAS,GAAG;AACtB,UAAU,SAAS,KAAK;AACxB,UAAU,SAAS,UAAU;AAC7B,UAAU,SAAS,YAAY;AAC/B,UAAU,SAAS,IAAI;AACvB,UAAU,SAAS,GAAG;AACtB,UAAU,SAAS,GAAG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Responsive } from "../../utils/responsive.mjs";
|
|
2
|
+
import { SpaceScale } from "../../utils/spacing.mjs";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
//#region src/components/Container/Container.d.ts
|
|
5
|
+
type ContainerSize = "sm" | "md" | "lg" | "xl" | "full";
|
|
6
|
+
type ContainerProps = ComponentProps<"div"> & {
|
|
7
|
+
size?: Responsive<ContainerSize>;
|
|
8
|
+
px?: Responsive<SpaceScale>;
|
|
9
|
+
};
|
|
10
|
+
declare function Container({ size, px, className, style, ...rest }: ContainerProps): import("react").JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Container, ContainerProps, ContainerSize };
|
|
13
|
+
//# sourceMappingURL=Container.d.mts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.mjs";
|
|
2
|
+
import { resolveResponsive } from "../../utils/responsive.mjs";
|
|
3
|
+
import { spaceToVar } from "../../utils/spacing.mjs";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/Container/Container.tsx
|
|
6
|
+
const sizeToVar = (v) => v === "full" ? "none" : `var(--ps1ui-container-${v})`;
|
|
7
|
+
function Container({ size, px, className, style, ...rest }) {
|
|
8
|
+
const sizeVars = resolveResponsive(size, "--_container-size", sizeToVar);
|
|
9
|
+
const pxVars = resolveResponsive(px, "--_container-px", spaceToVar);
|
|
10
|
+
const mergedStyle = {
|
|
11
|
+
...style,
|
|
12
|
+
...sizeVars,
|
|
13
|
+
...pxVars
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ jsx("div", {
|
|
16
|
+
...rest,
|
|
17
|
+
className: cx("ps1ui-container", className),
|
|
18
|
+
style: mergedStyle
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Container };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=Container.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.mjs","names":[],"sources":["../../../src/components/Container/Container.tsx"],"sourcesContent":["import type { ComponentProps, CSSProperties } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport { resolveResponsive, type Responsive } from \"../../utils/responsive\";\nimport { spaceToVar, type SpaceScale } from \"../../utils/spacing\";\n\nexport type ContainerSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n\nexport type ContainerProps = ComponentProps<\"div\"> & {\n size?: Responsive<ContainerSize>;\n px?: Responsive<SpaceScale>;\n};\n\n// size → max-width. `full` maps to `none` (unbounded), the rest reference\n// the --ps1ui-container-* max-width tokens in tokens.css.\nconst sizeToVar = (v: ContainerSize): string =>\n v === \"full\" ? \"none\" : `var(--ps1ui-container-${v})`;\n\nexport function Container({ size, px, className, style, ...rest }: ContainerProps) {\n const sizeVars = resolveResponsive(size, \"--_container-size\", sizeToVar);\n const pxVars = resolveResponsive(px, \"--_container-px\", spaceToVar);\n // Caller style first, internal `--_*` vars win — see Text.tsx. Cast because\n // csstype has no index signature for `--*` keys (React 19 included).\n const mergedStyle: CSSProperties = {\n ...style,\n ...sizeVars,\n ...pxVars,\n } as CSSProperties;\n return <div {...rest} className={cx(\"ps1ui-container\", className)} style={mergedStyle} />;\n}\n"],"mappings":";;;;;AAcA,MAAM,aAAa,MACjB,MAAM,SAAS,SAAS,yBAAyB,EAAE;AAErD,SAAgB,UAAU,EAAE,MAAM,IAAI,WAAW,OAAO,GAAG,QAAwB;CACjF,MAAM,WAAW,kBAAkB,MAAM,qBAAqB,SAAS;CACvE,MAAM,SAAS,kBAAkB,IAAI,mBAAmB,UAAU;CAGlE,MAAM,cAA6B;EACjC,GAAG;EACH,GAAG;EACH,GAAG;CACL;CACA,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAM,WAAW,GAAG,mBAAmB,SAAS;EAAG,OAAO;CAAc,CAAA;AAC1F"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
//#region src/components/Details/Details.d.ts
|
|
3
|
+
type DetailsProps = ComponentProps<"details"> & {
|
|
4
|
+
summary: ReactNode;
|
|
5
|
+
};
|
|
6
|
+
declare function Details({ summary, children, className, ...rest }: DetailsProps): import("react").JSX.Element;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Details, DetailsProps };
|
|
9
|
+
//# sourceMappingURL=Details.d.mts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.mjs";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/Details/Details.tsx
|
|
4
|
+
function Details({ summary, children, className, ...rest }) {
|
|
5
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
6
|
+
...rest,
|
|
7
|
+
className: cx("ps1ui-details", className),
|
|
8
|
+
children: [/* @__PURE__ */ jsx("summary", {
|
|
9
|
+
className: "ps1ui-details__summary",
|
|
10
|
+
children: summary
|
|
11
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
12
|
+
className: "ps1ui-details__body",
|
|
13
|
+
children
|
|
14
|
+
})]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Details };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=Details.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Details.mjs","names":[],"sources":["../../../src/components/Details/Details.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\nexport type DetailsProps = ComponentProps<\"details\"> & {\n summary: ReactNode;\n};\n\nexport function Details({ summary, children, className, ...rest }: DetailsProps) {\n return (\n <details {...rest} className={cx(\"ps1ui-details\", className)}>\n <summary className=\"ps1ui-details__summary\">{summary}</summary>\n <div className=\"ps1ui-details__body\">{children}</div>\n </details>\n );\n}\n"],"mappings":";;;AAOA,SAAgB,QAAQ,EAAE,SAAS,UAAU,WAAW,GAAG,QAAsB;CAC/E,OACE,qBAAC,WAAD;EAAS,GAAI;EAAM,WAAW,GAAG,iBAAiB,SAAS;YAA3D,CACE,oBAAC,WAAD;GAAS,WAAU;aAA0B;EAAiB,CAAA,GAC9D,oBAAC,OAAD;GAAK,WAAU;GAAuB;EAAc,CAAA,CAC7C;;AAEb"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Responsive } from "../../utils/responsive.mjs";
|
|
2
|
+
import { SpaceScale } from "../../utils/spacing.mjs";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
//#region src/components/Grid/Grid.d.ts
|
|
5
|
+
type GridGap = SpaceScale;
|
|
6
|
+
type GridProps = ComponentProps<"div"> & {
|
|
7
|
+
columns?: Responsive<number>;
|
|
8
|
+
gap?: Responsive<GridGap>;
|
|
9
|
+
};
|
|
10
|
+
declare function Grid({ columns, gap, className, style, ...rest }: GridProps): import("react").JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Grid, GridGap, GridProps };
|
|
13
|
+
//# sourceMappingURL=Grid.d.mts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.mjs";
|
|
2
|
+
import { resolveResponsive } from "../../utils/responsive.mjs";
|
|
3
|
+
import { spaceToVar } from "../../utils/spacing.mjs";
|
|
4
|
+
import { safePositiveInt } from "../../utils/numbers.mjs";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/Grid/Grid.tsx
|
|
7
|
+
function Grid({ columns, gap, className, style, ...rest }) {
|
|
8
|
+
const columnsVars = resolveResponsive(columns, "--_grid-columns", safePositiveInt);
|
|
9
|
+
const gapVars = resolveResponsive(gap, "--_grid-gap", spaceToVar);
|
|
10
|
+
const mergedStyle = {
|
|
11
|
+
...style,
|
|
12
|
+
...columnsVars,
|
|
13
|
+
...gapVars
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ jsx("div", {
|
|
16
|
+
...rest,
|
|
17
|
+
className: cx("ps1ui-grid", className),
|
|
18
|
+
style: mergedStyle
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Grid };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=Grid.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grid.mjs","names":[],"sources":["../../../src/components/Grid/Grid.tsx"],"sourcesContent":["import type { ComponentProps, CSSProperties } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport { safePositiveInt } from \"../../utils/numbers\";\nimport { resolveResponsive, type Responsive } from \"../../utils/responsive\";\nimport { spaceToVar, type SpaceScale } from \"../../utils/spacing\";\n\nexport type GridGap = SpaceScale;\n\nexport type GridProps = ComponentProps<\"div\"> & {\n columns?: Responsive<number>;\n gap?: Responsive<GridGap>;\n};\n\nexport function Grid({ columns, gap, className, style, ...rest }: GridProps) {\n // `repeat(N, ...)` requires N ≥ 1 integer — `safePositiveInt` clamps at\n // the system boundary. See utils/numbers.ts for the full rationale.\n const columnsVars = resolveResponsive(columns, \"--_grid-columns\", safePositiveInt);\n const gapVars = resolveResponsive(gap, \"--_grid-gap\", spaceToVar);\n // Caller style first, internal `--_*` vars win — see Text.tsx. Cast because\n // csstype has no index signature for `--*` keys (React 19 included).\n const mergedStyle: CSSProperties = {\n ...style,\n ...columnsVars,\n ...gapVars,\n } as CSSProperties;\n return <div {...rest} className={cx(\"ps1ui-grid\", className)} style={mergedStyle} />;\n}\n"],"mappings":";;;;;;AAaA,SAAgB,KAAK,EAAE,SAAS,KAAK,WAAW,OAAO,GAAG,QAAmB;CAG3E,MAAM,cAAc,kBAAkB,SAAS,mBAAmB,eAAe;CACjF,MAAM,UAAU,kBAAkB,KAAK,eAAe,UAAU;CAGhE,MAAM,cAA6B;EACjC,GAAG;EACH,GAAG;EACH,GAAG;CACL;CACA,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAM,WAAW,GAAG,cAAc,SAAS;EAAG,OAAO;CAAc,CAAA;AACrF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Responsive } from "../../utils/responsive.mjs";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
//#region src/components/GridItem/GridItem.d.ts
|
|
4
|
+
type GridItemProps = ComponentProps<"div"> & {
|
|
5
|
+
colSpan?: Responsive<number>;
|
|
6
|
+
};
|
|
7
|
+
declare function GridItem({ colSpan, className, style, ...rest }: GridItemProps): import("react").JSX.Element;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { GridItem, GridItemProps };
|
|
10
|
+
//# sourceMappingURL=GridItem.d.mts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.mjs";
|
|
2
|
+
import { resolveResponsive } from "../../utils/responsive.mjs";
|
|
3
|
+
import { safePositiveInt } from "../../utils/numbers.mjs";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/GridItem/GridItem.tsx
|
|
6
|
+
function GridItem({ colSpan, className, style, ...rest }) {
|
|
7
|
+
const colSpanVars = resolveResponsive(colSpan, "--_griditem-col-span", safePositiveInt);
|
|
8
|
+
const mergedStyle = {
|
|
9
|
+
...style,
|
|
10
|
+
...colSpanVars
|
|
11
|
+
};
|
|
12
|
+
return /* @__PURE__ */ jsx("div", {
|
|
13
|
+
...rest,
|
|
14
|
+
className: cx("ps1ui-griditem", className),
|
|
15
|
+
style: mergedStyle
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { GridItem };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=GridItem.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GridItem.mjs","names":[],"sources":["../../../src/components/GridItem/GridItem.tsx"],"sourcesContent":["import type { ComponentProps, CSSProperties } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport { safePositiveInt } from \"../../utils/numbers\";\nimport { resolveResponsive, type Responsive } from \"../../utils/responsive\";\n\nexport type GridItemProps = ComponentProps<\"div\"> & {\n colSpan?: Responsive<number>;\n};\n\nexport function GridItem({ colSpan, className, style, ...rest }: GridItemProps) {\n // `grid-column: span N` requires N ≥ 1 integer — `safePositiveInt` clamps\n // at the system boundary. See utils/numbers.ts for the full rationale.\n const colSpanVars = resolveResponsive(colSpan, \"--_griditem-col-span\", safePositiveInt);\n // Caller style first, internal `--_*` vars win — see Text.tsx. Cast because\n // csstype has no index signature for `--*` keys (React 19 included).\n const mergedStyle: CSSProperties = {\n ...style,\n ...colSpanVars,\n } as CSSProperties;\n return <div {...rest} className={cx(\"ps1ui-griditem\", className)} style={mergedStyle} />;\n}\n"],"mappings":";;;;;AASA,SAAgB,SAAS,EAAE,SAAS,WAAW,OAAO,GAAG,QAAuB;CAG9E,MAAM,cAAc,kBAAkB,SAAS,wBAAwB,eAAe;CAGtF,MAAM,cAA6B;EACjC,GAAG;EACH,GAAG;CACL;CACA,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAM,WAAW,GAAG,kBAAkB,SAAS;EAAG,OAAO;CAAc,CAAA;AACzF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Responsive } from "../../utils/responsive.mjs";
|
|
2
|
+
import { FontWeight } from "../../utils/typography.mjs";
|
|
3
|
+
import { CSSProperties, ComponentPropsWithoutRef } from "react";
|
|
4
|
+
//#region src/components/Heading/Heading.d.ts
|
|
5
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
|
+
type HeadingElement = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
7
|
+
type HeadingSize = "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
|
|
8
|
+
type HeadingWeight = FontWeight;
|
|
9
|
+
type HeadingOwnProps<E extends HeadingElement> = {
|
|
10
|
+
level: HeadingLevel;
|
|
11
|
+
as?: E;
|
|
12
|
+
size?: Responsive<HeadingSize>;
|
|
13
|
+
weight?: Responsive<HeadingWeight>;
|
|
14
|
+
};
|
|
15
|
+
type HeadingProps<E extends HeadingElement = HeadingElement> = HeadingOwnProps<E> & Omit<ComponentPropsWithoutRef<E>, keyof HeadingOwnProps<E>>;
|
|
16
|
+
declare function Heading<E extends HeadingElement = HeadingElement>({ level, as, size: sizeProp, weight: weightProp, className, style, ...rest }: HeadingProps<E>): import("react").ReactElement<Omit<HeadingProps<E>, "as" | "className" | "level" | "size" | "style" | "weight"> & {
|
|
17
|
+
className: string;
|
|
18
|
+
style: CSSProperties;
|
|
19
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Heading, HeadingElement, HeadingLevel, HeadingProps, HeadingSize, HeadingWeight };
|
|
22
|
+
//# sourceMappingURL=Heading.d.mts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.mjs";
|
|
2
|
+
import { resolveResponsive, withResponsiveBase } from "../../utils/responsive.mjs";
|
|
3
|
+
import { fontSizeToVar, weightToValue } from "../../utils/typography.mjs";
|
|
4
|
+
import { createElement } from "react";
|
|
5
|
+
//#region src/components/Heading/Heading.tsx
|
|
6
|
+
const LEVEL_DEFAULTS = {
|
|
7
|
+
1: {
|
|
8
|
+
size: "3xl",
|
|
9
|
+
weight: "bold"
|
|
10
|
+
},
|
|
11
|
+
2: {
|
|
12
|
+
size: "2xl",
|
|
13
|
+
weight: "semibold"
|
|
14
|
+
},
|
|
15
|
+
3: {
|
|
16
|
+
size: "xl",
|
|
17
|
+
weight: "semibold"
|
|
18
|
+
},
|
|
19
|
+
4: {
|
|
20
|
+
size: "lg",
|
|
21
|
+
weight: "semibold"
|
|
22
|
+
},
|
|
23
|
+
5: {
|
|
24
|
+
size: "md",
|
|
25
|
+
weight: "medium"
|
|
26
|
+
},
|
|
27
|
+
6: {
|
|
28
|
+
size: "sm",
|
|
29
|
+
weight: "medium"
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
function Heading({ level, as, size: sizeProp, weight: weightProp, className, style, ...rest }) {
|
|
33
|
+
const tag = as ?? `h${level}`;
|
|
34
|
+
const defaults = LEVEL_DEFAULTS[level];
|
|
35
|
+
const size = withResponsiveBase(sizeProp, defaults.size);
|
|
36
|
+
const weight = withResponsiveBase(weightProp, defaults.weight);
|
|
37
|
+
const sizeVars = resolveResponsive(size, "--_heading-size", fontSizeToVar);
|
|
38
|
+
const weightVars = resolveResponsive(weight, "--_heading-weight", weightToValue);
|
|
39
|
+
const mergedStyle = {
|
|
40
|
+
...style,
|
|
41
|
+
...sizeVars,
|
|
42
|
+
...weightVars
|
|
43
|
+
};
|
|
44
|
+
return createElement(tag, {
|
|
45
|
+
...rest,
|
|
46
|
+
className: cx("ps1ui-heading", className),
|
|
47
|
+
style: mergedStyle
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { Heading };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=Heading.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.mjs","names":[],"sources":["../../../src/components/Heading/Heading.tsx"],"sourcesContent":["import { createElement } from \"react\";\nimport type { ComponentPropsWithoutRef, CSSProperties } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport { resolveResponsive, withResponsiveBase, type Responsive } from \"../../utils/responsive\";\nimport { fontSizeToVar, weightToValue, type FontWeight } from \"../../utils/typography\";\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\nexport type HeadingElement = \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n\nexport type HeadingSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\n// HeadingWeight is a re-export of the shared FontWeight scale. Keeping a\n// component-local alias preserves the public type name (backwards compat)\n// while the underlying scale stays single-sourced in utils/typography.ts.\nexport type HeadingWeight = FontWeight;\n\ntype HeadingOwnProps<E extends HeadingElement> = {\n level: HeadingLevel;\n as?: E;\n size?: Responsive<HeadingSize>;\n weight?: Responsive<HeadingWeight>;\n};\n\n// Deliberate exception to the general \"use ComponentProps<'tag'>\" rule other components follow —\n// same reasoning as Text: with a polymorphic `as` prop TypeScript cannot correctly narrow the\n// `ref` type. All h1-h6 do resolve to HTMLHeadingElement so ref would happen to work today, but\n// keeping the polymorphic pattern consistent avoids surprises if the tag set ever widens.\nexport type HeadingProps<E extends HeadingElement = HeadingElement> = HeadingOwnProps<E> &\n Omit<ComponentPropsWithoutRef<E>, keyof HeadingOwnProps<E>>;\n\n// Exhaustive over HeadingLevel so a new level cannot be added without classifying its defaults.\nconst LEVEL_DEFAULTS: Record<HeadingLevel, { size: HeadingSize; weight: HeadingWeight }> = {\n 1: { size: \"3xl\", weight: \"bold\" },\n 2: { size: \"2xl\", weight: \"semibold\" },\n 3: { size: \"xl\", weight: \"semibold\" },\n 4: { size: \"lg\", weight: \"semibold\" },\n 5: { size: \"md\", weight: \"medium\" },\n 6: { size: \"sm\", weight: \"medium\" },\n};\n\nexport function Heading<E extends HeadingElement = HeadingElement>({\n level,\n as,\n size: sizeProp,\n weight: weightProp,\n className,\n style,\n ...rest\n}: HeadingProps<E>) {\n const tag = as ?? (`h${level}` as HeadingElement);\n const defaults = LEVEL_DEFAULTS[level];\n // `withResponsiveBase` bakes the level's default in at the `base`\n // breakpoint when the caller either omits the prop entirely or passes a\n // responsive object with no `base` entry. Concretely, `<Heading level={1}\n // size={{ md: \"2xl\" }}>` renders as level 1's default `3xl` at base, then\n // `2xl` at the md breakpoint — matching the intuition \"level sets the\n // default; the object overrides at specific widths\".\n const size = withResponsiveBase(sizeProp, defaults.size);\n const weight = withResponsiveBase(weightProp, defaults.weight);\n\n const sizeVars = resolveResponsive(size, \"--_heading-size\", fontSizeToVar);\n const weightVars = resolveResponsive(weight, \"--_heading-weight\", weightToValue);\n\n // Caller style first, internal `--_*` vars win — see Text.tsx. Cast because\n // csstype has no index signature for `--*` keys (React 19 included).\n const mergedStyle: CSSProperties = {\n ...style,\n ...sizeVars,\n ...weightVars,\n } as CSSProperties;\n\n return createElement(tag, {\n ...rest,\n className: cx(\"ps1ui-heading\", className),\n style: mergedStyle,\n });\n}\n"],"mappings":";;;;;AA8BA,MAAM,iBAAqF;CACzF,GAAG;EAAE,MAAM;EAAO,QAAQ;CAAO;CACjC,GAAG;EAAE,MAAM;EAAO,QAAQ;CAAW;CACrC,GAAG;EAAE,MAAM;EAAM,QAAQ;CAAW;CACpC,GAAG;EAAE,MAAM;EAAM,QAAQ;CAAW;CACpC,GAAG;EAAE,MAAM;EAAM,QAAQ;CAAS;CAClC,GAAG;EAAE,MAAM;EAAM,QAAQ;CAAS;AACpC;AAEA,SAAgB,QAAmD,EACjE,OACA,IACA,MAAM,UACN,QAAQ,YACR,WACA,OACA,GAAG,QACe;CAClB,MAAM,MAAM,MAAO,IAAI;CACvB,MAAM,WAAW,eAAe;CAOhC,MAAM,OAAO,mBAAmB,UAAU,SAAS,IAAI;CACvD,MAAM,SAAS,mBAAmB,YAAY,SAAS,MAAM;CAE7D,MAAM,WAAW,kBAAkB,MAAM,mBAAmB,aAAa;CACzE,MAAM,aAAa,kBAAkB,QAAQ,qBAAqB,aAAa;CAI/E,MAAM,cAA6B;EACjC,GAAG;EACH,GAAG;EACH,GAAG;CACL;CAEA,OAAO,cAAc,KAAK;EACxB,GAAG;EACH,WAAW,GAAG,iBAAiB,SAAS;EACxC,OAAO;CACT,CAAC;AACH"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
//#region src/components/Input/Input.d.ts
|
|
3
|
+
type InputProps = ComponentProps<"input">;
|
|
4
|
+
declare function Input({ className, type, ...rest }: InputProps): import("react").JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Input, InputProps };
|
|
7
|
+
//# sourceMappingURL=Input.d.mts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/Input/Input.tsx
|
|
4
|
+
function Input({ className, type = "text", ...rest }) {
|
|
5
|
+
const classes = cx("ps1ui-input", className);
|
|
6
|
+
return /* @__PURE__ */ jsx("input", {
|
|
7
|
+
...rest,
|
|
8
|
+
type,
|
|
9
|
+
className: classes
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Input };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=Input.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.mjs","names":[],"sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\nexport type InputProps = ComponentProps<\"input\">;\n\nexport function Input({ className, type = \"text\", ...rest }: InputProps) {\n const classes = cx(\"ps1ui-input\", className);\n return <input {...rest} type={type} className={classes} />;\n}\n"],"mappings":";;;AAKA,SAAgB,MAAM,EAAE,WAAW,OAAO,QAAQ,GAAG,QAAoB;CACvE,MAAM,UAAU,GAAG,eAAe,SAAS;CAC3C,OAAO,oBAAC,SAAD;EAAO,GAAI;EAAY;EAAM,WAAW;CAAU,CAAA;AAC3D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
//#region src/components/Label/Label.d.ts
|
|
3
|
+
type LabelProps = ComponentProps<"label">;
|
|
4
|
+
declare function Label({ className, ...rest }: LabelProps): import("react").JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Label, LabelProps };
|
|
7
|
+
//# sourceMappingURL=Label.d.mts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/Label/Label.tsx
|
|
4
|
+
function Label({ className, ...rest }) {
|
|
5
|
+
const classes = cx("ps1ui-label", className);
|
|
6
|
+
return /* @__PURE__ */ jsx("label", {
|
|
7
|
+
...rest,
|
|
8
|
+
className: classes
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Label };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=Label.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.mjs","names":[],"sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\nexport type LabelProps = ComponentProps<\"label\">;\n\nexport function Label({ className, ...rest }: LabelProps) {\n const classes = cx(\"ps1ui-label\", className);\n // oxlint-disable-next-line jsx-a11y/label-has-associated-control -- ultra-thin <label> wrapper; the caller supplies htmlFor or nests the control.\n return <label {...rest} className={classes} />;\n}\n"],"mappings":";;;AAKA,SAAgB,MAAM,EAAE,WAAW,GAAG,QAAoB;CACxD,MAAM,UAAU,GAAG,eAAe,SAAS;CAE3C,OAAO,oBAAC,SAAD;EAAO,GAAI;EAAM,WAAW;CAAU,CAAA;AAC/C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentProps, ReactElement } from "react";
|
|
2
|
+
//#region src/components/List/List.d.ts
|
|
3
|
+
type ListProps = ({
|
|
4
|
+
ordered?: false;
|
|
5
|
+
} & ComponentProps<"ul">) | ({
|
|
6
|
+
ordered: true;
|
|
7
|
+
} & Omit<ComponentProps<"ol">, "type">);
|
|
8
|
+
declare function List(props: ListProps): ReactElement;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { List, ListProps };
|
|
11
|
+
//# sourceMappingURL=List.d.mts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.mjs";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
//#region src/components/List/List.tsx
|
|
4
|
+
function List(props) {
|
|
5
|
+
const { ordered = false, className, ...rest } = props;
|
|
6
|
+
return createElement(ordered ? "ol" : "ul", {
|
|
7
|
+
role: "list",
|
|
8
|
+
...rest,
|
|
9
|
+
className: cx("ps1ui-list", ordered ? "ps1ui-list--ordered" : "ps1ui-list--unordered", className)
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { List };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=List.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.mjs","names":[],"sources":["../../../src/components/List/List.tsx"],"sourcesContent":["import { createElement } from \"react\";\nimport type { ComponentProps, ReactElement } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\n// Discriminated union: an unordered <List> shouldn't typecheck with <ol>-only\n// attributes (start / reversed) and shouldn't type its ref as HTMLOListElement.\n// `type` is dropped from the ordered variant because the visible marker is\n// drawn by `::before`, not the browser's `::marker`, so `type=\"a\"` would\n// silently not affect the visible numbering.\nexport type ListProps =\n | ({ ordered?: false } & ComponentProps<\"ul\">)\n | ({ ordered: true } & Omit<ComponentProps<\"ol\">, \"type\">);\n\n// Return type annotated so tsdown emits a small ReactElement in the .d.mts\n// instead of the wide DetailedReactHTMLElement createElement infers for a\n// `\"ol\" | \"ul\"` tag union.\nexport function List(props: ListProps): ReactElement {\n const { ordered = false, className, ...rest } = props;\n const tag = ordered ? \"ol\" : \"ul\";\n return createElement(tag, {\n // Safari's a11y tree drops list semantics (\"list, N items\") when the\n // computed `list-style-type` is `none` — the global reset applies that,\n // so `role=\"list\"` restores VoiceOver's announcement. Placed before\n // `...rest` so a caller can override with a different role.\n role: \"list\",\n ...rest,\n className: cx(\n \"ps1ui-list\",\n ordered ? \"ps1ui-list--ordered\" : \"ps1ui-list--unordered\",\n className,\n ),\n });\n}\n"],"mappings":";;;AAgBA,SAAgB,KAAK,OAAgC;CACnD,MAAM,EAAE,UAAU,OAAO,WAAW,GAAG,SAAS;CAEhD,OAAO,cADK,UAAU,OAAO,MACH;EAKxB,MAAM;EACN,GAAG;EACH,WAAW,GACT,cACA,UAAU,wBAAwB,yBAClC,SACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
//#region src/components/ListItem/ListItem.d.ts
|
|
3
|
+
type ListItemProps = ComponentProps<"li">;
|
|
4
|
+
declare function ListItem({ className, ...rest }: ListItemProps): import("react").JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { ListItem, ListItemProps };
|
|
7
|
+
//# sourceMappingURL=ListItem.d.mts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/ListItem/ListItem.tsx
|
|
4
|
+
function ListItem({ className, ...rest }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("li", {
|
|
6
|
+
...rest,
|
|
7
|
+
className: cx("ps1ui-listitem", className)
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { ListItem };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=ListItem.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItem.mjs","names":[],"sources":["../../../src/components/ListItem/ListItem.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\n// Thin typed wrapper for `<li>` inside a `<List>`. The marker styling lives\n// on `.ps1ui-list > li` in List.css, so a bare `<li>` continues to render\n// identically — ListItem exists to give call sites a stable class hook\n// (`.ps1ui-listitem`, matching GridItem's `.ps1ui-griditem`) and a\n// documented API surface for what belongs inside a `<List>`.\nexport type ListItemProps = ComponentProps<\"li\">;\n\nexport function ListItem({ className, ...rest }: ListItemProps) {\n return <li {...rest} className={cx(\"ps1ui-listitem\", className)} />;\n}\n"],"mappings":";;;AAUA,SAAgB,SAAS,EAAE,WAAW,GAAG,QAAuB;CAC9D,OAAO,oBAAC,MAAD;EAAI,GAAI;EAAM,WAAW,GAAG,kBAAkB,SAAS;CAAI,CAAA;AACpE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
//#region src/components/PS1Root/PS1Root.d.ts
|
|
3
|
+
type PS1RootProps = ComponentProps<"div">;
|
|
4
|
+
declare function PS1Root({ className, ...rest }: PS1RootProps): import("react").JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { PS1Root, PS1RootProps };
|
|
7
|
+
//# sourceMappingURL=PS1Root.d.mts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/PS1Root/PS1Root.tsx
|
|
4
|
+
function PS1Root({ className, ...rest }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
...rest,
|
|
7
|
+
className: cx("ps1ui-root", className)
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { PS1Root };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=PS1Root.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PS1Root.mjs","names":[],"sources":["../../../src/components/PS1Root/PS1Root.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\nexport type PS1RootProps = ComponentProps<\"div\">;\n\n// PS1Root establishes the app-level responsive containment context.\n//\n// Wrap your app's tree in `<PS1Root>` once, at the top level. Responsive props\n// on descendant ps1ui components (`Grid columns={{ base: 1, md: 3 }}` and\n// friends) query their nearest ancestor with CSS `container-type: inline-size`\n// — this component provides that ancestor. Without a PS1Root (or another\n// containment ancestor like Container / Grid / Stack), responsive props\n// silently fall back to their `base` value only.\n//\n// A side effect of `container-type: inline-size` per CSS Containment L2:\n// `contain: layout` is implied, which makes PS1Root the containing block for\n// `position: fixed` descendants. For overlays that must anchor to the viewport\n// (Modal, Tooltip, Popover) render them via React Portal to `document.body`\n// so they escape PS1Root's containment. Raw `position: fixed` inside PS1Root\n// scrolls with the page instead of pinning to the viewport.\nexport function PS1Root({ className, ...rest }: PS1RootProps) {\n return <div {...rest} className={cx(\"ps1ui-root\", className)} />;\n}\n"],"mappings":";;;AAoBA,SAAgB,QAAQ,EAAE,WAAW,GAAG,QAAsB;CAC5D,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAM,WAAW,GAAG,cAAc,SAAS;CAAI,CAAA;AACjE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Responsive } from "../../utils/responsive.mjs";
|
|
2
|
+
import { SpaceScale } from "../../utils/spacing.mjs";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
//#region src/components/Stack/Stack.d.ts
|
|
5
|
+
type StackDirection = "row" | "column";
|
|
6
|
+
type StackGap = SpaceScale;
|
|
7
|
+
type StackAlign = "start" | "center" | "end" | "stretch" | "baseline";
|
|
8
|
+
type StackJustify = "start" | "center" | "end" | "between" | "around" | "evenly";
|
|
9
|
+
type StackProps = ComponentProps<"div"> & {
|
|
10
|
+
direction?: Responsive<StackDirection>;
|
|
11
|
+
gap?: Responsive<StackGap>;
|
|
12
|
+
align?: Responsive<StackAlign>;
|
|
13
|
+
justify?: Responsive<StackJustify>;
|
|
14
|
+
wrap?: Responsive<boolean>;
|
|
15
|
+
};
|
|
16
|
+
declare function Stack({ direction, gap, align, justify, wrap, className, style, ...rest }: StackProps): import("react").JSX.Element;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Stack, StackAlign, StackDirection, StackGap, StackJustify, StackProps };
|
|
19
|
+
//# sourceMappingURL=Stack.d.mts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.mjs";
|
|
2
|
+
import { resolveResponsive } from "../../utils/responsive.mjs";
|
|
3
|
+
import { spaceToVar } from "../../utils/spacing.mjs";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/Stack/Stack.tsx
|
|
6
|
+
const directionToValue = (v) => v;
|
|
7
|
+
const alignToValue = (v) => {
|
|
8
|
+
switch (v) {
|
|
9
|
+
case "start": return "flex-start";
|
|
10
|
+
case "end": return "flex-end";
|
|
11
|
+
default: return v;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const justifyToValue = (v) => {
|
|
15
|
+
switch (v) {
|
|
16
|
+
case "start": return "flex-start";
|
|
17
|
+
case "end": return "flex-end";
|
|
18
|
+
case "between": return "space-between";
|
|
19
|
+
case "around": return "space-around";
|
|
20
|
+
case "evenly": return "space-evenly";
|
|
21
|
+
default: return v;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const wrapToValue = (v) => v ? "wrap" : "nowrap";
|
|
25
|
+
function Stack({ direction, gap, align, justify, wrap, className, style, ...rest }) {
|
|
26
|
+
const directionVars = resolveResponsive(direction, "--_stack-direction", directionToValue);
|
|
27
|
+
const gapVars = resolveResponsive(gap, "--_stack-gap", spaceToVar);
|
|
28
|
+
const alignVars = resolveResponsive(align, "--_stack-align", alignToValue);
|
|
29
|
+
const justifyVars = resolveResponsive(justify, "--_stack-justify", justifyToValue);
|
|
30
|
+
const wrapVars = resolveResponsive(wrap, "--_stack-wrap", wrapToValue);
|
|
31
|
+
const mergedStyle = {
|
|
32
|
+
...style,
|
|
33
|
+
...directionVars,
|
|
34
|
+
...gapVars,
|
|
35
|
+
...alignVars,
|
|
36
|
+
...justifyVars,
|
|
37
|
+
...wrapVars
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ jsx("div", {
|
|
40
|
+
...rest,
|
|
41
|
+
className: cx("ps1ui-stack", className),
|
|
42
|
+
style: mergedStyle
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Stack };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=Stack.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stack.mjs","names":[],"sources":["../../../src/components/Stack/Stack.tsx"],"sourcesContent":["import type { ComponentProps, CSSProperties } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport { resolveResponsive, type Responsive } from \"../../utils/responsive\";\nimport { spaceToVar, type SpaceScale } from \"../../utils/spacing\";\n\nexport type StackDirection = \"row\" | \"column\";\nexport type StackGap = SpaceScale;\nexport type StackAlign = \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\";\nexport type StackJustify = \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\";\n\nexport type StackProps = ComponentProps<\"div\"> & {\n direction?: Responsive<StackDirection>;\n gap?: Responsive<StackGap>;\n align?: Responsive<StackAlign>;\n justify?: Responsive<StackJustify>;\n wrap?: Responsive<boolean>;\n};\n\n// direction values pass straight through — CSS flex-direction accepts\n// `row` / `column` (and `row-reverse` / `column-reverse`, which the union\n// deliberately excludes; add those to the union if the API ever grows).\nconst directionToValue = (v: StackDirection): string => v;\n\n// Flexbox uses `flex-start` / `flex-end` in the box-alignment spec. The\n// StackAlign union exposes the shorter `start` / `end` alias for terseness;\n// the transform remaps them so the CSS variable holds a valid `align-items`\n// value directly.\nconst alignToValue = (v: StackAlign): string => {\n switch (v) {\n case \"start\":\n return \"flex-start\";\n case \"end\":\n return \"flex-end\";\n default:\n return v;\n }\n};\n\n// Same treatment as `alignToValue`, plus expansions for the `space-*`\n// justify-content variants.\nconst justifyToValue = (v: StackJustify): string => {\n switch (v) {\n case \"start\":\n return \"flex-start\";\n case \"end\":\n return \"flex-end\";\n case \"between\":\n return \"space-between\";\n case \"around\":\n return \"space-around\";\n case \"evenly\":\n return \"space-evenly\";\n default:\n return v;\n }\n};\n\n// boolean → CSS flex-wrap keyword.\nconst wrapToValue = (v: boolean): string => (v ? \"wrap\" : \"nowrap\");\n\nexport function Stack({\n direction,\n gap,\n align,\n justify,\n wrap,\n className,\n style,\n ...rest\n}: StackProps) {\n const directionVars = resolveResponsive(direction, \"--_stack-direction\", directionToValue);\n const gapVars = resolveResponsive(gap, \"--_stack-gap\", spaceToVar);\n const alignVars = resolveResponsive(align, \"--_stack-align\", alignToValue);\n const justifyVars = resolveResponsive(justify, \"--_stack-justify\", justifyToValue);\n const wrapVars = resolveResponsive(wrap, \"--_stack-wrap\", wrapToValue);\n\n // Caller style first, internal `--_*` vars win — see Text.tsx. Cast because\n // csstype has no index signature for `--*` keys (React 19 included).\n const mergedStyle: CSSProperties = {\n ...style,\n ...directionVars,\n ...gapVars,\n ...alignVars,\n ...justifyVars,\n ...wrapVars,\n } as CSSProperties;\n\n return <div {...rest} className={cx(\"ps1ui-stack\", className)} style={mergedStyle} />;\n}\n"],"mappings":";;;;;AAqBA,MAAM,oBAAoB,MAA8B;AAMxD,MAAM,gBAAgB,MAA0B;CAC9C,QAAQ,GAAR;EACE,KAAK,SACH,OAAO;EACT,KAAK,OACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAIA,MAAM,kBAAkB,MAA4B;CAClD,QAAQ,GAAR;EACE,KAAK,SACH,OAAO;EACT,KAAK,OACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAGA,MAAM,eAAe,MAAwB,IAAI,SAAS;AAE1D,SAAgB,MAAM,EACpB,WACA,KACA,OACA,SACA,MACA,WACA,OACA,GAAG,QACU;CACb,MAAM,gBAAgB,kBAAkB,WAAW,sBAAsB,gBAAgB;CACzF,MAAM,UAAU,kBAAkB,KAAK,gBAAgB,UAAU;CACjE,MAAM,YAAY,kBAAkB,OAAO,kBAAkB,YAAY;CACzE,MAAM,cAAc,kBAAkB,SAAS,oBAAoB,cAAc;CACjF,MAAM,WAAW,kBAAkB,MAAM,iBAAiB,WAAW;CAIrE,MAAM,cAA6B;EACjC,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;CACL;CAEA,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAM,WAAW,GAAG,eAAe,SAAS;EAAG,OAAO;CAAc,CAAA;AACtF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
//#region src/components/Table/Table.d.ts
|
|
3
|
+
type TableProps = ComponentProps<"table">;
|
|
4
|
+
declare function Table({ className, ref: forwardedRef, ...rest }: TableProps): import("react").JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Table, TableProps };
|
|
7
|
+
//# sourceMappingURL=Table.d.mts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../../utils/cx.mjs";
|
|
3
|
+
import { useMergedRef } from "../../utils/useMergedRef.mjs";
|
|
4
|
+
import { useScrollableFocus } from "../../utils/useScrollableFocus.mjs";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/Table/Table.tsx
|
|
7
|
+
function Table({ className, ref: forwardedRef, ...rest }) {
|
|
8
|
+
const { scrollerRef, contentRef, tabIndex, measure } = useScrollableFocus();
|
|
9
|
+
const mergedRef = useMergedRef(contentRef, forwardedRef);
|
|
10
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11
|
+
className: "ps1ui-table__scroller",
|
|
12
|
+
tabIndex,
|
|
13
|
+
ref: scrollerRef,
|
|
14
|
+
onBlur: measure,
|
|
15
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
16
|
+
...rest,
|
|
17
|
+
ref: mergedRef,
|
|
18
|
+
className: cx("ps1ui-table", className)
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Table };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=Table.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.mjs","names":[],"sources":["../../../src/components/Table/Table.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport { useMergedRef } from \"../../utils/useMergedRef\";\nimport { useScrollableFocus } from \"../../utils/useScrollableFocus\";\n\n// Props type the native <table>: everything spreads onto the <table> element,\n// ref included. The horizontal-scroll wrapper the component renders around it\n// is an internal implementation detail — it carries no caller props and is\n// styled/targeted via the stable `.ps1ui-table__scroller` class.\nexport type TableProps = ComponentProps<\"table\">;\n\nexport function Table({ className, ref: forwardedRef, ...rest }: TableProps) {\n // A <table> cannot be its own overflow container (`display: table` boxes\n // don't honor overflow), so scrolling lives on a wrapper div. Keyboard\n // reachability of that wrapper — tabIndex only while the table actually\n // overflows, kept while focused, safe-side under static SSR — is the shared\n // useScrollableFocus contract (see the hook's header for the full account).\n // The table's own box is the observed content: children re-rendering wider\n // or narrower resize it, which re-fires the measurement.\n const { scrollerRef, contentRef, tabIndex, measure } = useScrollableFocus<\n HTMLDivElement,\n HTMLTableElement\n >();\n\n // Both the hook (overflow observation) and the caller get the <table> node.\n const mergedRef = useMergedRef(contentRef, forwardedRef);\n\n return (\n <div\n className=\"ps1ui-table__scroller\"\n // oxlint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- axe scrollable-region-focusable requires the scroller be keyboard-reachable when the table overflows; useScrollableFocus gates this on measured overflow so small tables stay out of the tab order.\n tabIndex={tabIndex}\n ref={scrollerRef}\n // Re-measure once focus leaves: while focused the hook keeps the tab\n // stop even if content now fits (dropping tabindex off the focused\n // element would blur it to <body>); blur is the moment it can safely go.\n onBlur={measure}\n >\n <table {...rest} ref={mergedRef} className={cx(\"ps1ui-table\", className)} />\n </div>\n );\n}\n"],"mappings":";;;;;;AAaA,SAAgB,MAAM,EAAE,WAAW,KAAK,cAAc,GAAG,QAAoB;CAQ3E,MAAM,EAAE,aAAa,YAAY,UAAU,YAAY,mBAGrD;CAGF,MAAM,YAAY,aAAa,YAAY,YAAY;CAEvD,OACE,oBAAC,OAAD;EACE,WAAU;EAEA;EACV,KAAK;EAIL,QAAQ;YAER,oBAAC,SAAD;GAAO,GAAI;GAAM,KAAK;GAAW,WAAW,GAAG,eAAe,SAAS;EAAI,CAAA;CACxE,CAAA;AAET"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
//#region src/components/Tbody/Tbody.d.ts
|
|
3
|
+
type TbodyProps = ComponentProps<"tbody">;
|
|
4
|
+
declare function Tbody({ className, ...rest }: TbodyProps): import("react").JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Tbody, TbodyProps };
|
|
7
|
+
//# sourceMappingURL=Tbody.d.mts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/Tbody/Tbody.tsx
|
|
4
|
+
function Tbody({ className, ...rest }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
6
|
+
...rest,
|
|
7
|
+
className: cx("ps1ui-tbody", className)
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Tbody };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=Tbody.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tbody.mjs","names":[],"sources":["../../../src/components/Tbody/Tbody.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\n// Thin typed wrapper for `<tbody>` inside a `<Table>`. Cell styling lives on\n// `.ps1ui-table th / td` in Table.css, so a bare `<tbody>` continues to\n// render identically — Tbody exists to give call sites a stable class hook\n// (`.ps1ui-tbody`) and a documented API surface for what belongs inside a\n// `<Table>` (same contract as ListItem inside List).\nexport type TbodyProps = ComponentProps<\"tbody\">;\n\nexport function Tbody({ className, ...rest }: TbodyProps) {\n return <tbody {...rest} className={cx(\"ps1ui-tbody\", className)} />;\n}\n"],"mappings":";;;AAUA,SAAgB,MAAM,EAAE,WAAW,GAAG,QAAoB;CACxD,OAAO,oBAAC,SAAD;EAAO,GAAI;EAAM,WAAW,GAAG,eAAe,SAAS;CAAI,CAAA;AACpE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
//#region src/components/Td/Td.d.ts
|
|
3
|
+
type TdProps = ComponentProps<"td">;
|
|
4
|
+
declare function Td({ className, ...rest }: TdProps): import("react").JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Td, TdProps };
|
|
7
|
+
//# sourceMappingURL=Td.d.mts.map
|