@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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/dist/base.css +378 -0
  3. package/dist/components/Anchor/Anchor.d.mts +12 -0
  4. package/dist/components/Anchor/Anchor.mjs +15 -0
  5. package/dist/components/Anchor/Anchor.mjs.map +1 -0
  6. package/dist/components/Button/Button.d.mts +24 -0
  7. package/dist/components/Button/Button.mjs +17 -0
  8. package/dist/components/Button/Button.mjs.map +1 -0
  9. package/dist/components/Card/Card.d.mts +7 -0
  10. package/dist/components/Card/Card.mjs +14 -0
  11. package/dist/components/Card/Card.mjs.map +1 -0
  12. package/dist/components/Checkbox/Checkbox.d.mts +9 -0
  13. package/dist/components/Checkbox/Checkbox.mjs +23 -0
  14. package/dist/components/Checkbox/Checkbox.mjs.map +1 -0
  15. package/dist/components/Code/Code.d.mts +7 -0
  16. package/dist/components/Code/Code.mjs +14 -0
  17. package/dist/components/Code/Code.mjs.map +1 -0
  18. package/dist/components/CodeBlock/CodeBlock.d.mts +12 -0
  19. package/dist/components/CodeBlock/CodeBlock.mjs +44 -0
  20. package/dist/components/CodeBlock/CodeBlock.mjs.map +1 -0
  21. package/dist/components/CodeBlock/refractor.d.mts +7 -0
  22. package/dist/components/CodeBlock/refractor.mjs +26 -0
  23. package/dist/components/CodeBlock/refractor.mjs.map +1 -0
  24. package/dist/components/Container/Container.d.mts +13 -0
  25. package/dist/components/Container/Container.mjs +24 -0
  26. package/dist/components/Container/Container.mjs.map +1 -0
  27. package/dist/components/Details/Details.d.mts +9 -0
  28. package/dist/components/Details/Details.mjs +20 -0
  29. package/dist/components/Details/Details.mjs.map +1 -0
  30. package/dist/components/Grid/Grid.d.mts +13 -0
  31. package/dist/components/Grid/Grid.mjs +24 -0
  32. package/dist/components/Grid/Grid.mjs.map +1 -0
  33. package/dist/components/GridItem/GridItem.d.mts +10 -0
  34. package/dist/components/GridItem/GridItem.mjs +21 -0
  35. package/dist/components/GridItem/GridItem.mjs.map +1 -0
  36. package/dist/components/Heading/Heading.d.mts +22 -0
  37. package/dist/components/Heading/Heading.mjs +53 -0
  38. package/dist/components/Heading/Heading.mjs.map +1 -0
  39. package/dist/components/Input/Input.d.mts +7 -0
  40. package/dist/components/Input/Input.mjs +15 -0
  41. package/dist/components/Input/Input.mjs.map +1 -0
  42. package/dist/components/Label/Label.d.mts +7 -0
  43. package/dist/components/Label/Label.mjs +14 -0
  44. package/dist/components/Label/Label.mjs.map +1 -0
  45. package/dist/components/List/List.d.mts +11 -0
  46. package/dist/components/List/List.mjs +15 -0
  47. package/dist/components/List/List.mjs.map +1 -0
  48. package/dist/components/ListItem/ListItem.d.mts +7 -0
  49. package/dist/components/ListItem/ListItem.mjs +13 -0
  50. package/dist/components/ListItem/ListItem.mjs.map +1 -0
  51. package/dist/components/PS1Root/PS1Root.d.mts +7 -0
  52. package/dist/components/PS1Root/PS1Root.mjs +13 -0
  53. package/dist/components/PS1Root/PS1Root.mjs.map +1 -0
  54. package/dist/components/Stack/Stack.d.mts +19 -0
  55. package/dist/components/Stack/Stack.mjs +48 -0
  56. package/dist/components/Stack/Stack.mjs.map +1 -0
  57. package/dist/components/Table/Table.d.mts +7 -0
  58. package/dist/components/Table/Table.mjs +25 -0
  59. package/dist/components/Table/Table.mjs.map +1 -0
  60. package/dist/components/Tbody/Tbody.d.mts +7 -0
  61. package/dist/components/Tbody/Tbody.mjs +13 -0
  62. package/dist/components/Tbody/Tbody.mjs.map +1 -0
  63. package/dist/components/Td/Td.d.mts +7 -0
  64. package/dist/components/Td/Td.mjs +13 -0
  65. package/dist/components/Td/Td.mjs.map +1 -0
  66. package/dist/components/Text/Text.d.mts +23 -0
  67. package/dist/components/Text/Text.mjs +34 -0
  68. package/dist/components/Text/Text.mjs.map +1 -0
  69. package/dist/components/Th/Th.d.mts +7 -0
  70. package/dist/components/Th/Th.mjs +13 -0
  71. package/dist/components/Th/Th.mjs.map +1 -0
  72. package/dist/components/Thead/Thead.d.mts +7 -0
  73. package/dist/components/Thead/Thead.mjs +13 -0
  74. package/dist/components/Thead/Thead.mjs.map +1 -0
  75. package/dist/components/Tr/Tr.d.mts +7 -0
  76. package/dist/components/Tr/Tr.mjs +13 -0
  77. package/dist/components/Tr/Tr.mjs.map +1 -0
  78. package/dist/components.css +1870 -0
  79. package/dist/index.d.mts +28 -0
  80. package/dist/index.mjs +25 -0
  81. package/dist/styles.css +1930 -0
  82. package/dist/utils/cx.mjs +8 -0
  83. package/dist/utils/cx.mjs.map +1 -0
  84. package/dist/utils/numbers.mjs +8 -0
  85. package/dist/utils/numbers.mjs.map +1 -0
  86. package/dist/utils/responsive.d.mts +6 -0
  87. package/dist/utils/responsive.mjs +39 -0
  88. package/dist/utils/responsive.mjs.map +1 -0
  89. package/dist/utils/spacing.d.mts +5 -0
  90. package/dist/utils/spacing.mjs +8 -0
  91. package/dist/utils/spacing.mjs.map +1 -0
  92. package/dist/utils/typography.d.mts +5 -0
  93. package/dist/utils/typography.mjs +16 -0
  94. package/dist/utils/typography.mjs.map +1 -0
  95. package/dist/utils/useMergedRef.mjs +30 -0
  96. package/dist/utils/useMergedRef.mjs.map +1 -0
  97. package/dist/utils/useScrollableFocus.mjs +29 -0
  98. package/dist/utils/useScrollableFocus.mjs.map +1 -0
  99. package/package.json +84 -3
@@ -0,0 +1,13 @@
1
+ import { cx } from "../../utils/cx.mjs";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/components/Td/Td.tsx
4
+ function Td({ className, ...rest }) {
5
+ return /* @__PURE__ */ jsx("td", {
6
+ ...rest,
7
+ className: cx("ps1ui-td", className)
8
+ });
9
+ }
10
+ //#endregion
11
+ export { Td };
12
+
13
+ //# sourceMappingURL=Td.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Td.mjs","names":[],"sources":["../../../src/components/Td/Td.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\n// Thin typed wrapper for `<td>` inside a `<Table>`. Data-cell styling lives\n// on `.ps1ui-table td` in Table.css, so a bare `<td>` continues to render\n// identically — Td exists to give call sites a stable class hook\n// (`.ps1ui-td`) and a documented API surface for what belongs inside a\n// `<Table>` (same contract as ListItem inside List).\nexport type TdProps = ComponentProps<\"td\">;\n\nexport function Td({ className, ...rest }: TdProps) {\n return <td {...rest} className={cx(\"ps1ui-td\", className)} />;\n}\n"],"mappings":";;;AAUA,SAAgB,GAAG,EAAE,WAAW,GAAG,QAAiB;CAClD,OAAO,oBAAC,MAAD;EAAI,GAAI;EAAM,WAAW,GAAG,YAAY,SAAS;CAAI,CAAA;AAC9D"}
@@ -0,0 +1,23 @@
1
+ import { Responsive } from "../../utils/responsive.mjs";
2
+ import { FontWeight } from "../../utils/typography.mjs";
3
+ import { CSSProperties, ComponentPropsWithoutRef } from "react";
4
+ //#region src/components/Text/Text.d.ts
5
+ type TextElement = "p" | "span" | "div" | "label" | "strong" | "em" | "small";
6
+ type TextVariant = "body" | "muted" | "subtle" | "primary" | "accent";
7
+ type TextSize = "xs" | "sm" | "md" | "lg" | "xl";
8
+ type TextWeight = FontWeight;
9
+ type TextOwnProps<E extends TextElement> = {
10
+ as?: E;
11
+ variant?: TextVariant;
12
+ size?: Responsive<TextSize>;
13
+ weight?: Responsive<TextWeight>;
14
+ truncate?: boolean;
15
+ };
16
+ type TextProps<E extends TextElement = "p"> = TextOwnProps<E> & Omit<ComponentPropsWithoutRef<E>, keyof TextOwnProps<E>>;
17
+ declare function Text<E extends TextElement = "p">({ as, variant, size, weight, truncate, className, style, ...rest }: TextProps<E>): import("react").ReactElement<Omit<TextProps<E>, "as" | "className" | "size" | "style" | "truncate" | "variant" | "weight"> & {
18
+ className: string;
19
+ style: CSSProperties;
20
+ }, string | import("react").JSXElementConstructor<any>>;
21
+ //#endregion
22
+ export { Text, TextElement, TextProps, TextSize, TextVariant, TextWeight };
23
+ //# sourceMappingURL=Text.d.mts.map
@@ -0,0 +1,34 @@
1
+ import { cx } from "../../utils/cx.mjs";
2
+ import { resolveResponsive } from "../../utils/responsive.mjs";
3
+ import { fontSizeToVar, weightToValue } from "../../utils/typography.mjs";
4
+ import { createElement } from "react";
5
+ //#region src/components/Text/Text.tsx
6
+ const INLINE_TEXT_ELEMENTS = {
7
+ p: false,
8
+ div: false,
9
+ span: true,
10
+ label: true,
11
+ strong: true,
12
+ em: true,
13
+ small: true
14
+ };
15
+ function Text({ as, variant = "body", size, weight, truncate = false, className, style, ...rest }) {
16
+ const tag = as ?? "p";
17
+ const sizeVars = resolveResponsive(size, "--_text-size", fontSizeToVar);
18
+ const weightVars = resolveResponsive(weight, "--_text-weight", weightToValue);
19
+ const classes = cx("ps1ui-text", `ps1ui-text--${variant}`, truncate && "ps1ui-text--truncate", truncate && INLINE_TEXT_ELEMENTS[tag] && "ps1ui-text--truncate-inline", className);
20
+ const mergedStyle = {
21
+ ...style,
22
+ ...sizeVars,
23
+ ...weightVars
24
+ };
25
+ return createElement(tag, {
26
+ ...rest,
27
+ className: classes,
28
+ style: mergedStyle
29
+ });
30
+ }
31
+ //#endregion
32
+ export { Text };
33
+
34
+ //# sourceMappingURL=Text.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.mjs","names":[],"sources":["../../../src/components/Text/Text.tsx"],"sourcesContent":["import { createElement } from \"react\";\nimport type { ComponentPropsWithoutRef, CSSProperties } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport { resolveResponsive, type Responsive } from \"../../utils/responsive\";\nimport { fontSizeToVar, weightToValue, type FontWeight } from \"../../utils/typography\";\n\nexport type TextElement = \"p\" | \"span\" | \"div\" | \"label\" | \"strong\" | \"em\" | \"small\";\n\nexport type TextVariant = \"body\" | \"muted\" | \"subtle\" | \"primary\" | \"accent\";\nexport type TextSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n// TextWeight 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 TextWeight = FontWeight;\n\ntype TextOwnProps<E extends TextElement> = {\n as?: E;\n variant?: TextVariant;\n size?: Responsive<TextSize>;\n weight?: Responsive<TextWeight>;\n truncate?: boolean;\n};\n\n// Deliberate exception to the general \"use ComponentProps<'tag'>\" rule other components follow.\n// With the polymorphic `as` prop, TypeScript cannot narrow the `ref` prop's type against the\n// resolved element E — allowing `ref` here would silently accept mismatched ref types\n// (e.g. a ref typed for HTMLParagraphElement on `<Text as=\"span\" ref={…} />`). Keeping `ref`\n// out of the prop type entirely is safer than a misleading loose type; don't switch this\n// to ComponentProps for consistency with the other components.\nexport type TextProps<E extends TextElement = \"p\"> = TextOwnProps<E> &\n Omit<ComponentPropsWithoutRef<E>, keyof TextOwnProps<E>>;\n\n// Exhaustive over TextElement so adding a tag without classifying it fails to typecheck,\n// instead of silently leaving truncate's inline-block fix un-applied for that tag.\nconst INLINE_TEXT_ELEMENTS: Record<TextElement, boolean> = {\n p: false,\n div: false,\n span: true,\n label: true,\n strong: true,\n em: true,\n small: true,\n};\n\nexport function Text<E extends TextElement = \"p\">({\n as,\n variant = \"body\",\n size,\n weight,\n truncate = false,\n className,\n style,\n ...rest\n}: TextProps<E>) {\n const tag = as ?? \"p\";\n const sizeVars = resolveResponsive(size, \"--_text-size\", fontSizeToVar);\n const weightVars = resolveResponsive(weight, \"--_text-weight\", weightToValue);\n\n const classes = cx(\n \"ps1ui-text\",\n `ps1ui-text--${variant}`,\n truncate && \"ps1ui-text--truncate\",\n truncate && INLINE_TEXT_ELEMENTS[tag] && \"ps1ui-text--truncate-inline\",\n className,\n );\n\n // Caller style first, resolved vars last: `--_*` is the reserved internal\n // prefix and wins on purpose — responsive values are prop-controlled. Cast\n // because 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, { ...rest, className: classes, style: mergedStyle });\n}\n"],"mappings":";;;;;AAkCA,MAAM,uBAAqD;CACzD,GAAG;CACH,KAAK;CACL,MAAM;CACN,OAAO;CACP,QAAQ;CACR,IAAI;CACJ,OAAO;AACT;AAEA,SAAgB,KAAkC,EAChD,IACA,UAAU,QACV,MACA,QACA,WAAW,OACX,WACA,OACA,GAAG,QACY;CACf,MAAM,MAAM,MAAM;CAClB,MAAM,WAAW,kBAAkB,MAAM,gBAAgB,aAAa;CACtE,MAAM,aAAa,kBAAkB,QAAQ,kBAAkB,aAAa;CAE5E,MAAM,UAAU,GACd,cACA,eAAe,WACf,YAAY,wBACZ,YAAY,qBAAqB,QAAQ,+BACzC,SACF;CAKA,MAAM,cAA6B;EACjC,GAAG;EACH,GAAG;EACH,GAAG;CACL;CAEA,OAAO,cAAc,KAAK;EAAE,GAAG;EAAM,WAAW;EAAS,OAAO;CAAY,CAAC;AAC/E"}
@@ -0,0 +1,7 @@
1
+ import { ComponentProps } from "react";
2
+ //#region src/components/Th/Th.d.ts
3
+ type ThProps = ComponentProps<"th">;
4
+ declare function Th({ className, ...rest }: ThProps): import("react").JSX.Element;
5
+ //#endregion
6
+ export { Th, ThProps };
7
+ //# sourceMappingURL=Th.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/Th/Th.tsx
4
+ function Th({ className, ...rest }) {
5
+ return /* @__PURE__ */ jsx("th", {
6
+ ...rest,
7
+ className: cx("ps1ui-th", className)
8
+ });
9
+ }
10
+ //#endregion
11
+ export { Th };
12
+
13
+ //# sourceMappingURL=Th.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Th.mjs","names":[],"sources":["../../../src/components/Th/Th.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\n// Thin typed wrapper for `<th>` inside a `<Table>`. Header-cell styling\n// lives on `.ps1ui-table th` in Table.css, so a bare `<th>` continues to\n// render identically — Th exists to give call sites a stable class hook\n// (`.ps1ui-th`) and a documented API surface for what belongs inside a\n// `<Table>` (same contract as ListItem inside List). Semantics stay native:\n// pass `scope=\"col\"` / `scope=\"row\"` exactly as you would on a raw <th>.\nexport type ThProps = ComponentProps<\"th\">;\n\nexport function Th({ className, ...rest }: ThProps) {\n return <th {...rest} className={cx(\"ps1ui-th\", className)} />;\n}\n"],"mappings":";;;AAWA,SAAgB,GAAG,EAAE,WAAW,GAAG,QAAiB;CAClD,OAAO,oBAAC,MAAD;EAAI,GAAI;EAAM,WAAW,GAAG,YAAY,SAAS;CAAI,CAAA;AAC9D"}
@@ -0,0 +1,7 @@
1
+ import { ComponentProps } from "react";
2
+ //#region src/components/Thead/Thead.d.ts
3
+ type TheadProps = ComponentProps<"thead">;
4
+ declare function Thead({ className, ...rest }: TheadProps): import("react").JSX.Element;
5
+ //#endregion
6
+ export { Thead, TheadProps };
7
+ //# sourceMappingURL=Thead.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/Thead/Thead.tsx
4
+ function Thead({ className, ...rest }) {
5
+ return /* @__PURE__ */ jsx("thead", {
6
+ ...rest,
7
+ className: cx("ps1ui-thead", className)
8
+ });
9
+ }
10
+ //#endregion
11
+ export { Thead };
12
+
13
+ //# sourceMappingURL=Thead.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Thead.mjs","names":[],"sources":["../../../src/components/Thead/Thead.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\n// Thin typed wrapper for `<thead>` inside a `<Table>`. All header styling\n// lives on `.ps1ui-table thead th` in Table.css, so a bare `<thead>`\n// continues to render identically — Thead exists to give call sites a stable\n// class hook (`.ps1ui-thead`) and a documented API surface for what belongs\n// inside a `<Table>` (same contract as ListItem inside List).\nexport type TheadProps = ComponentProps<\"thead\">;\n\nexport function Thead({ className, ...rest }: TheadProps) {\n return <thead {...rest} className={cx(\"ps1ui-thead\", 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/Tr/Tr.d.ts
3
+ type TrProps = ComponentProps<"tr">;
4
+ declare function Tr({ className, ...rest }: TrProps): import("react").JSX.Element;
5
+ //#endregion
6
+ export { Tr, TrProps };
7
+ //# sourceMappingURL=Tr.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/Tr/Tr.tsx
4
+ function Tr({ className, ...rest }) {
5
+ return /* @__PURE__ */ jsx("tr", {
6
+ ...rest,
7
+ className: cx("ps1ui-tr", className)
8
+ });
9
+ }
10
+ //#endregion
11
+ export { Tr };
12
+
13
+ //# sourceMappingURL=Tr.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tr.mjs","names":[],"sources":["../../../src/components/Tr/Tr.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\n// Thin typed wrapper for `<tr>` inside a `<Table>`. Cell styling lives on\n// `.ps1ui-table th / td` in Table.css, so a bare `<tr>` continues to render\n// identically — Tr exists to give call sites a stable class hook\n// (`.ps1ui-tr`) and a documented API surface for what belongs inside a\n// `<Table>` (same contract as ListItem inside List).\nexport type TrProps = ComponentProps<\"tr\">;\n\nexport function Tr({ className, ...rest }: TrProps) {\n return <tr {...rest} className={cx(\"ps1ui-tr\", className)} />;\n}\n"],"mappings":";;;AAUA,SAAgB,GAAG,EAAE,WAAW,GAAG,QAAiB;CAClD,OAAO,oBAAC,MAAD;EAAI,GAAI;EAAM,WAAW,GAAG,YAAY,SAAS;CAAI,CAAA;AAC9D"}