@pittorica/section-react 0.24.0 → 0.25.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/Section.d.ts CHANGED
@@ -1,11 +1,19 @@
1
+ import { type ElementType } from 'react';
1
2
  import { type BoxProps } from '@pittorica/box-react';
2
- export interface SectionProps extends BoxProps {
3
+ export type SectionProps<E extends ElementType = 'section'> = BoxProps<E> & {
3
4
  /**
4
5
  * Vertical padding size.
5
6
  * Maps to responsive padding values in CSS.
6
7
  * @default '3'
7
8
  */
8
9
  size?: '1' | '2' | '3';
9
- }
10
- export declare const Section: ({ children, as: Tag, size, className, ...props }: SectionProps) => import("react/jsx-runtime").JSX.Element;
10
+ };
11
+ /**
12
+ * Section component for high-level page layout.
13
+ * Fully polymorphic and agnostic.
14
+ */
15
+ export declare const Section: {
16
+ <E extends ElementType = "section">({ children, as, size, className, ...props }: SectionProps<E>): import("react/jsx-runtime").JSX.Element;
17
+ displayName: string;
18
+ };
11
19
  //# sourceMappingURL=Section.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Section.d.ts","sourceRoot":"","sources":["../src/Section.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC5C;;;;OAIG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CACxB;AAED,eAAO,MAAM,OAAO,GAAI,kDAMrB,YAAY,4CAWd,CAAC"}
1
+ {"version":3,"file":"Section.d.ts","sourceRoot":"","sources":["../src/Section.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAIzC,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,SAAS,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG;IAC1E;;;;OAIG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO;KAAI,CAAC,SAAS,WAAW,2DAM1C,YAAY,CAAC,CAAC,CAAC;;CAcjB,CAAC"}
package/dist/index.js CHANGED
@@ -1,100 +1,91 @@
1
- import { jsx as y } from "react/jsx-runtime";
2
- function b(r) {
3
- var a, i, t = "";
4
- if (typeof r == "string" || typeof r == "number") t += r;
5
- else if (typeof r == "object") if (Array.isArray(r)) {
6
- var o = r.length;
7
- for (a = 0; a < o; a++) r[a] && (i = b(r[a])) && (t && (t += " "), t += i);
8
- } else for (i in r) r[i] && (t && (t += " "), t += i);
9
- return t;
1
+ import { jsx as x } from "react/jsx-runtime";
2
+ function T(i) {
3
+ var p, t, a = "";
4
+ if (typeof i == "string" || typeof i == "number") a += i;
5
+ else if (typeof i == "object") if (Array.isArray(i)) {
6
+ var o = i.length;
7
+ for (p = 0; p < o; p++) i[p] && (t = T(i[p])) && (a && (a += " "), a += t);
8
+ } else for (t in i) i[t] && (a && (a += " "), a += t);
9
+ return a;
10
10
  }
11
- function S() {
12
- for (var r, a, i = 0, t = "", o = arguments.length; i < o; i++) (r = arguments[i]) && (a = b(r)) && (t && (t += " "), t += a);
13
- return t;
11
+ function k() {
12
+ for (var i, p, t = 0, a = "", o = arguments.length; t < o; t++) (i = arguments[t]) && (p = T(i)) && (a && (a += " "), a += p);
13
+ return a;
14
14
  }
15
- function $(r) {
16
- var a, i, t = "";
17
- if (typeof r == "string" || typeof r == "number") t += r;
18
- else if (typeof r == "object") if (Array.isArray(r)) {
19
- var o = r.length;
20
- for (a = 0; a < o; a++) r[a] && (i = $(r[a])) && (t && (t += " "), t += i);
21
- } else for (i in r) r[i] && (t && (t += " "), t += i);
22
- return t;
15
+ function N(i) {
16
+ var p, t, a = "";
17
+ if (typeof i == "string" || typeof i == "number") a += i;
18
+ else if (typeof i == "object") if (Array.isArray(i)) {
19
+ var o = i.length;
20
+ for (p = 0; p < o; p++) i[p] && (t = N(i[p])) && (a && (a += " "), a += t);
21
+ } else for (t in i) i[t] && (a && (a += " "), a += t);
22
+ return a;
23
23
  }
24
- function k() {
25
- for (var r, a, i = 0, t = "", o = arguments.length; i < o; i++) (r = arguments[i]) && (a = $(r)) && (t && (t += " "), t += a);
26
- return t;
24
+ function z() {
25
+ for (var i, p, t = 0, a = "", o = arguments.length; t < o; t++) (i = arguments[t]) && (p = N(i)) && (a && (a += " "), a += p);
26
+ return a;
27
27
  }
28
- const x = ({
29
- ref: r,
30
- as: a = "div",
31
- children: i,
28
+ const A = ({
29
+ as: i,
30
+ children: p,
32
31
  display: t,
33
- m: o,
34
- mt: n,
35
- mr: p,
36
- mb: s,
37
- ml: c,
32
+ m: a,
33
+ mt: o,
34
+ mr: e,
35
+ mb: m,
36
+ ml: d,
37
+ mx: c,
38
+ my: s,
38
39
  p: f,
39
- pt: m,
40
+ pt: v,
40
41
  pr: l,
41
- pb: g,
42
- pl: d,
42
+ pb: y,
43
+ pl: $,
44
+ px: n,
45
+ py: g,
43
46
  width: h,
44
47
  height: u,
45
- position: v,
46
- style: A,
47
- className: N,
48
- href: j,
49
- target: w,
50
- rel: B,
51
- htmlFor: F,
52
- type: L,
53
- name: R,
54
- disabled: T,
55
- ...q
48
+ position: b,
49
+ style: B,
50
+ className: L,
51
+ disabled: R,
52
+ ...j
56
53
  }) => {
57
- const e = {};
58
- t && (e.display = t), h && (e.width = h), u && (e.height = u), v && (e.position = v), o && (e.margin = `var(--pittorica-space-${o})`), n && (e.marginTop = `var(--pittorica-space-${n})`), p && (e.marginRight = `var(--pittorica-space-${p})`), s && (e.marginBottom = `var(--pittorica-space-${s})`), c && (e.marginLeft = `var(--pittorica-space-${c})`), f && (e.padding = `var(--pittorica-space-${f})`), m && (e.paddingTop = `var(--pittorica-space-${m})`), l && (e.paddingRight = `var(--pittorica-space-${l})`), g && (e.paddingBottom = `var(--pittorica-space-${g})`), d && (e.paddingLeft = `var(--pittorica-space-${d})`);
59
- const z = {
60
- ...A,
61
- ...e
54
+ const w = i || "div", r = {};
55
+ t && (r.display = t), h && (r.width = h), u && (r.height = u), b && (r.position = b), a && (r.margin = `var(--pittorica-space-${a})`), o && (r.marginTop = `var(--pittorica-space-${o})`), e && (r.marginRight = `var(--pittorica-space-${e})`), m && (r.marginBottom = `var(--pittorica-space-${m})`), d && (r.marginLeft = `var(--pittorica-space-${d})`), c && (r.marginLeft = `var(--pittorica-space-${c})`, r.marginRight = `var(--pittorica-space-${c})`), s && (r.marginTop = `var(--pittorica-space-${s})`, r.marginBottom = `var(--pittorica-space-${s})`), f && (r.padding = `var(--pittorica-space-${f})`), v && (r.paddingTop = `var(--pittorica-space-${v})`), l && (r.paddingRight = `var(--pittorica-space-${l})`), y && (r.paddingBottom = `var(--pittorica-space-${y})`), $ && (r.paddingLeft = `var(--pittorica-space-${$})`), n && (r.paddingLeft = `var(--pittorica-space-${n})`, r.paddingRight = `var(--pittorica-space-${n})`), g && (r.paddingTop = `var(--pittorica-space-${g})`, r.paddingBottom = `var(--pittorica-space-${g})`);
56
+ const S = {
57
+ ...B,
58
+ ...r
62
59
  };
63
- return /* @__PURE__ */ y(
64
- a,
60
+ return /* @__PURE__ */ x(
61
+ w,
65
62
  {
66
- ref: r,
67
- className: k("pittorica-box", N),
68
- style: z,
69
- href: j,
70
- target: w,
71
- rel: B,
72
- htmlFor: F,
73
- type: L,
74
- name: R,
75
- disabled: T,
76
- ...q,
77
- children: i
63
+ className: z("pittorica-box", L),
64
+ style: S,
65
+ disabled: R,
66
+ ...j,
67
+ children: p
78
68
  }
79
69
  );
80
70
  };
81
- x.displayName = "Box";
82
- const D = ({
83
- children: r,
84
- as: a = "section",
85
- size: i = "3",
86
- className: t,
71
+ A.displayName = "Box";
72
+ const q = ({
73
+ children: i,
74
+ as: p,
75
+ size: t = "3",
76
+ className: a,
87
77
  ...o
88
- }) => /* @__PURE__ */ y(
89
- x,
78
+ }) => /* @__PURE__ */ x(
79
+ A,
90
80
  {
91
- as: a,
92
- className: S("pittorica-section", t),
93
- "data-size": i,
81
+ as: p || "section",
82
+ className: k("pittorica-section", a),
83
+ "data-size": t,
94
84
  ...o,
95
- children: r
85
+ children: i
96
86
  }
97
87
  );
88
+ q.displayName = "Section";
98
89
  export {
99
- D as Section
90
+ q as Section
100
91
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pittorica/section-react",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "clsx": "^2.1.1",
13
- "@pittorica/box-react": "0.24.0"
13
+ "@pittorica/box-react": "0.25.0"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@testing-library/jest-dom": "^6.9.1",
@@ -22,9 +22,9 @@
22
22
  "typescript": "^5.0.0",
23
23
  "vite": "^5.0.0",
24
24
  "vitest": "^2.1.9",
25
- "@pittorica/theme-react": "0.24.0",
26
- "pittorica": "0.24.0",
27
- "@pittorica/text-react": "0.24.0"
25
+ "@pittorica/text-react": "0.25.0",
26
+ "@pittorica/theme-react": "0.25.0",
27
+ "pittorica": "0.25.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": ">=19",
@@ -35,7 +35,6 @@
35
35
  "build:js": "vite build",
36
36
  "build:types": "tsc -p tsconfig.json",
37
37
  "clean": "rm -rf dist",
38
- "dev": "vite",
39
38
  "test": "vitest run",
40
39
  "test:watch": "vitest"
41
40
  }