@yourdash/uikit 0.1.4 → 0.1.6

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.
@@ -1,8 +1,9 @@
1
- import { FC, ReactNode } from 'react';
1
+ import { default as React, FC, ReactNode } from 'react';
2
2
  declare const UKContainer: FC<{
3
3
  className?: string;
4
4
  level?: 0 | 1 | 2 | 3;
5
5
  children: ReactNode | ReactNode[];
6
6
  disableRounding?: boolean;
7
+ style?: React.CSSProperties;
7
8
  }>;
8
9
  export default UKContainer;
@@ -1,11 +1,11 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
- import o from "../../core/clippy.mjs";
3
- import r from "../../core/incrementLevel.mjs";
4
- import { useLevel as m, useLevelClass as t } from "../../core/level.mjs";
2
+ import i from "../../core/clippy.mjs";
3
+ import m from "../../core/incrementLevel.mjs";
4
+ import { useLevel as o, useLevelClass as r } from "../../core/level.mjs";
5
5
  import n from "./container.module.scss.mjs";
6
6
  const u = (e) => {
7
- const i = e.level || m();
8
- return /* @__PURE__ */ l("div", { className: o(n.component, e.className, e.disableRounding && n.disableRounding, t(i)), children: /* @__PURE__ */ l(r, { children: e.children }) });
7
+ const t = e.level || o();
8
+ return /* @__PURE__ */ l("div", { className: i(n.component, e.className, e.disableRounding && n.disableRounding, r(t)), style: e.style, children: /* @__PURE__ */ l(m, { children: e.children }) });
9
9
  };
10
10
  export {
11
11
  u as default
@@ -1 +1 @@
1
- {"version":3,"file":"UKContainer.mjs","sources":["../../../../lib/components/container/UKContainer.tsx"],"sourcesContent":["/*\r\n * Copyright ©2025 Ewsgit<https://github.com/ewsgit> and YourDash<https://github.com/yourdash> contributors.\r\n * YourDash is licensed under the MIT License. (https://ewsgit.mit-license.org)\r\n */\r\n\r\nimport clippy from \"../../core/clippy.ts\";\r\nimport { FC, ReactNode } from \"react\";\r\nimport IncrementLevel from \"../../core/incrementLevel.tsx\";\r\nimport { useLevel, useLevelClass } from \"../../core/level.tsx\";\r\nimport styles from \"./container.module.scss\";\r\n\r\nconst UKContainer: FC<{ className?: string; level?: 0 | 1 | 2 | 3; children: ReactNode | ReactNode[]; disableRounding?: boolean }> = (\r\n props,\r\n) => {\r\n const level = props.level || useLevel();\r\n\r\n return (\r\n <div className={clippy(styles.component, props.className, props.disableRounding && styles.disableRounding, useLevelClass(level))}>\r\n <IncrementLevel>{props.children}</IncrementLevel>\r\n </div>\r\n );\r\n};\r\n\r\nexport default UKContainer;\r\n"],"names":["UKContainer","props","level","useLevel","jsx","clippy","styles","component","className","disableRounding","useLevelClass","IncrementLevel","children"],"mappings":";;;;;AAWA,MAAMA,IACJC,CACGA,MAAA;AACGC,QAAAA,IAAQD,EAAMC,SAASC,EAAS;AAGpC,SAAA,gBAAAC,EAAC,SAAI,WAAWC,EAAOC,EAAOC,WAAWN,EAAMO,WAAWP,EAAMQ,mBAAmBH,EAAOG,iBAAiBC,EAAcR,CAAK,CAAC,GAC7H,4BAACS,GAAgBV,EAAAA,UAAAA,EAAMW,UAAS,EAClC,CAAA;AAEJ;"}
1
+ {"version":3,"file":"UKContainer.mjs","sources":["../../../../lib/components/container/UKContainer.tsx"],"sourcesContent":["/*\r\n * Copyright ©2025 Ewsgit<https://github.com/ewsgit> and YourDash<https://github.com/yourdash> contributors.\r\n * YourDash is licensed under the MIT License. (https://ewsgit.mit-license.org)\r\n */\r\n\r\nimport clippy from \"../../core/clippy.ts\";\r\nimport React, { FC, ReactNode } from \"react\";\r\nimport IncrementLevel from \"../../core/incrementLevel.tsx\";\r\nimport { useLevel, useLevelClass } from \"../../core/level.tsx\";\r\nimport styles from \"./container.module.scss\";\r\n\r\nconst UKContainer: FC<{ className?: string; level?: 0 | 1 | 2 | 3; children: ReactNode | ReactNode[]; disableRounding?: boolean; style?: React.CSSProperties }> = (\r\n props,\r\n) => {\r\n const level = props.level || useLevel();\r\n\r\n return (\r\n <div className={clippy(styles.component, props.className, props.disableRounding && styles.disableRounding, useLevelClass(level))} style={props.style}>\r\n <IncrementLevel>{props.children}</IncrementLevel>\r\n </div>\r\n );\r\n};\r\n\r\nexport default UKContainer;\r\n"],"names":["UKContainer","props","level","useLevel","jsx","clippy","styles","component","className","disableRounding","useLevelClass","style","IncrementLevel","children"],"mappings":";;;;;AAWA,MAAMA,IACJC,CACGA,MAAA;AACGC,QAAAA,IAAQD,EAAMC,SAASC,EAAS;AAGpC,SAAA,gBAAAC,EAAC,SAAI,WAAWC,EAAOC,EAAOC,WAAWN,EAAMO,WAAWP,EAAMQ,mBAAmBH,EAAOG,iBAAiBC,EAAcR,CAAK,CAAC,GAAG,OAAOD,EAAMU,OAC7I,UAAC,gBAAAP,EAAAQ,GAAA,EAAgBX,UAAMY,EAAAA,SAAAA,CAAS,EAClC,CAAA;AAEJ;"}
@@ -4,6 +4,8 @@ declare const UKCarousel: React.FC<{
4
4
  element: React.ReactElement;
5
5
  id: string;
6
6
  }[];
7
+ loopAround?: boolean;
7
8
  className?: string;
9
+ height?: string;
8
10
  }>;
9
11
  export default UKCarousel;
@@ -1,97 +1,123 @@
1
- import { jsx as p, jsxs as w } from "react/jsx-runtime";
2
- import { c as y } from "../../../_virtual/compiler-runtime.mjs";
3
- import { useRef as K, useState as L, useEffect as U } from "react";
4
- import x from "../../components/card/UKCard.mjs";
5
- import V from "../../components/container/UKContainer.mjs";
6
- import I from "../../core/clippy.mjs";
7
- import { UKIcons as T } from "../../core/iconDictionary.mjs";
8
- import B from "../../components/iconButton/UKIconButton.mjs";
9
- import l from "./carousel.module.scss.mjs";
10
- const G = (v) => {
11
- const e = y.c(27), {
12
- items: s,
13
- className: R
14
- } = v, h = K(null), [r, P] = L(0);
15
- let b, E;
16
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (b = () => {
17
- const t = h.current;
1
+ import { jsx as P, jsxs as y } from "react/jsx-runtime";
2
+ import { c as M } from "../../../_virtual/compiler-runtime.mjs";
3
+ import { useRef as j, useState as A, useEffect as S } from "react";
4
+ import O from "../../components/card/UKCard.mjs";
5
+ import $ from "../../components/container/UKContainer.mjs";
6
+ import x from "../../core/clippy.mjs";
7
+ import { UKIcons as K } from "../../core/iconDictionary.mjs";
8
+ import L from "../../components/iconButton/UKIconButton.mjs";
9
+ import o from "./carousel.module.scss.mjs";
10
+ const X = (U) => {
11
+ const e = M.c(35), {
12
+ items: c,
13
+ className: k,
14
+ loopAround: s,
15
+ height: R
16
+ } = U, N = j(null), [r, i] = A(0);
17
+ let E, I;
18
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (E = () => {
19
+ const t = N.current;
18
20
  if (!t)
19
21
  return;
20
- console.log(Array.from(t.children));
21
- let o;
22
- const C = () => {
23
- clearTimeout(o), o = setTimeout(function() {
24
- Array.from(t.children).forEach((n, _) => {
25
- if (Math.abs(n.getBoundingClientRect().left + n.getBoundingClientRect().width / 2 - (t.getBoundingClientRect().left + t.getBoundingClientRect().width / 2)) < n.getBoundingClientRect().width / 2) {
26
- P(_);
27
- return;
28
- }
29
- });
30
- }, 16);
22
+ const l = () => {
23
+ const n = t.getBoundingClientRect();
24
+ let b;
25
+ b = 0;
26
+ let C;
27
+ C = -1, Array.from(t.children).forEach((V, B) => {
28
+ const T = V.getBoundingClientRect(), w = Math.max(0, Math.min(T.right, n.right) - Math.max(T.left, n.left));
29
+ w > b && (b = w, C = B);
30
+ }), C !== -1 && i(C);
31
31
  };
32
- return t.addEventListener("scroll", C), () => {
33
- t.removeEventListener("scroll", C), clearTimeout(o);
32
+ return t.addEventListener("scroll", l), () => {
33
+ t.removeEventListener("scroll", l);
34
34
  };
35
- }, E = [], e[0] = b, e[1] = E) : (b = e[0], E = e[1]), U(b, E);
36
- let i;
37
- e[2] !== R ? (i = I(l.containerComponent, R), e[2] = R, e[3] = i) : i = e[3];
38
- let c;
39
- e[4] !== s ? (c = s.map(k), e[4] = s, e[5] = c) : c = e[5];
35
+ }, I = [], e[0] = E, e[1] = I) : (E = e[0], I = e[1]), S(E, I);
40
36
  let a;
41
- e[6] !== c ? (a = /* @__PURE__ */ p("div", { className: l.component, "data-pages": !0, ref: h, children: c }), e[6] = c, e[7] = a) : a = e[7];
37
+ e[2] !== k ? (a = x(o.containerComponent, k), e[2] = k, e[3] = a) : a = e[3];
42
38
  let m;
43
- e[8] !== r ? (m = /* @__PURE__ */ p(B, { accessibleLabel: "previous page", icon: T.ChevronLeft, className: l.pageControl, onClick: () => {
44
- const t = h.current;
39
+ e[4] !== R ? (m = {
40
+ "--carousel-height": R
41
+ }, e[4] = R, e[5] = m) : m = e[5];
42
+ let f;
43
+ if (e[6] !== r || e[7] !== c) {
44
+ let t;
45
+ e[9] !== r ? (t = (l, n) => /* @__PURE__ */ P("div", { className: x(o.page, n === r && o.activePage), children: l.element }, l.id), e[9] = r, e[10] = t) : t = e[10], f = c.map(t), e[6] = r, e[7] = c, e[8] = f;
46
+ } else
47
+ f = e[8];
48
+ let h;
49
+ e[11] !== f ? (h = /* @__PURE__ */ P("div", { className: o.component, "data-pages": !0, ref: N, children: f }), e[11] = f, e[12] = h) : h = e[12];
50
+ let u;
51
+ e[13] !== r || e[14] !== s ? (u = /* @__PURE__ */ P(L, { accessibleLabel: "previous page", icon: K.ChevronLeft, className: o.pageControl, onClick: () => {
52
+ const t = N.current;
45
53
  if (!t)
46
54
  return;
47
- const o = t.children[r - 1];
48
- o && o.scrollIntoView({
49
- behavior: "smooth"
50
- });
51
- } }), e[8] = r, e[9] = m) : m = e[9];
52
- let f;
53
- if (e[10] !== r || e[11] !== s) {
55
+ const l = t.children[r - 1];
56
+ if (!l) {
57
+ s && (t.children[t.children.length - 1].scrollIntoView({
58
+ behavior: "smooth",
59
+ inline: "center",
60
+ block: "center"
61
+ }), i(t.children.length - 1));
62
+ return;
63
+ }
64
+ l.scrollIntoView({
65
+ behavior: "smooth",
66
+ inline: "center",
67
+ block: "center"
68
+ }), i(r - 1);
69
+ } }), e[13] = r, e[14] = s, e[15] = u) : u = e[15];
70
+ let g;
71
+ if (e[16] !== r || e[17] !== c) {
54
72
  let t;
55
- e[13] !== r ? (t = (o, C) => /* @__PURE__ */ p("button", { className: I(l.pageIndicator, C === r && l.selected), onClick: () => {
56
- const n = h.current;
57
- if (!n)
73
+ e[19] !== r ? (t = (l, n) => /* @__PURE__ */ P("button", { className: x(o.pageIndicator, n === r && o.selected), onClick: () => {
74
+ const b = N.current;
75
+ if (!b)
58
76
  return;
59
- n.scrollIntoView({
60
- behavior: "smooth"
61
- }), n.children[C].scrollIntoView({
62
- behavior: "smooth"
77
+ const C = b.children[n];
78
+ i(n), C.scrollIntoView({
79
+ behavior: "smooth",
80
+ inline: "center",
81
+ block: "center"
63
82
  });
64
- } }, o.id), e[13] = r, e[14] = t) : t = e[14], f = s.map(t), e[10] = r, e[11] = s, e[12] = f;
83
+ } }, l.id), e[19] = r, e[20] = t) : t = e[20], g = c.map(t), e[16] = r, e[17] = c, e[18] = g;
65
84
  } else
66
- f = e[12];
67
- let u;
68
- e[15] !== f ? (u = /* @__PURE__ */ p(x, { className: l.indicator, children: f }), e[15] = f, e[16] = u) : u = e[16];
85
+ g = e[18];
86
+ let p;
87
+ e[21] !== g ? (p = /* @__PURE__ */ P(O, { className: o.indicator, containerClassName: o.indicatorContainer, children: g }), e[21] = g, e[22] = p) : p = e[22];
69
88
  let d;
70
- e[17] !== r ? (d = /* @__PURE__ */ p(B, { accessibleLabel: "next page", icon: T.ChevronRight, className: l.pageControl, onClick: () => {
71
- const t = h.current;
89
+ e[23] !== r || e[24] !== s ? (d = /* @__PURE__ */ P(L, { accessibleLabel: "next page", icon: K.ChevronRight, className: o.pageControl, onClick: () => {
90
+ const t = N.current;
72
91
  if (!t)
73
92
  return;
74
- const o = t.children[r + 1];
75
- o && o.scrollIntoView({
76
- behavior: "smooth"
77
- });
78
- } }), e[17] = r, e[18] = d) : d = e[18];
79
- let g;
80
- e[19] !== m || e[20] !== u || e[21] !== d ? (g = /* @__PURE__ */ w("div", { className: l.controls, children: [
81
- m,
93
+ const l = t.children[r + 1];
94
+ if (!l) {
95
+ s && (t.children[0].scrollIntoView({
96
+ behavior: "smooth",
97
+ inline: "center",
98
+ block: "center"
99
+ }), i(0));
100
+ return;
101
+ }
102
+ l.scrollIntoView({
103
+ behavior: "smooth",
104
+ inline: "center",
105
+ block: "center"
106
+ }), i(r + 1);
107
+ } }), e[23] = r, e[24] = s, e[25] = d) : d = e[25];
108
+ let v;
109
+ e[26] !== d || e[27] !== u || e[28] !== p ? (v = /* @__PURE__ */ y("div", { className: o.controls, children: [
82
110
  u,
111
+ p,
83
112
  d
84
- ] }), e[19] = m, e[20] = u, e[21] = d, e[22] = g) : g = e[22];
85
- let N;
86
- return e[23] !== g || e[24] !== i || e[25] !== a ? (N = /* @__PURE__ */ w(V, { className: i, children: [
87
- a,
88
- g
89
- ] }), e[23] = g, e[24] = i, e[25] = a, e[26] = N) : N = e[26], N;
113
+ ] }), e[26] = d, e[27] = u, e[28] = p, e[29] = v) : v = e[29];
114
+ let _;
115
+ return e[30] !== v || e[31] !== a || e[32] !== m || e[33] !== h ? (_ = /* @__PURE__ */ y($, { className: a, style: m, children: [
116
+ h,
117
+ v
118
+ ] }), e[30] = v, e[31] = a, e[32] = m, e[33] = h, e[34] = _) : _ = e[34], _;
90
119
  };
91
- function k(v) {
92
- return /* @__PURE__ */ p("div", { className: l.page, children: v.element }, v.id);
93
- }
94
120
  export {
95
- G as default
121
+ X as default
96
122
  };
97
123
  //# sourceMappingURL=UKCarousel.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"UKCarousel.mjs","sources":["../../../../lib/views/carousel/UKCarousel.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\r\nimport UKCard from \"../../components/card/UKCard.tsx\";\r\nimport UKContainer from \"../../components/container/UKContainer.tsx\";\r\nimport clippy from \"../../core/clippy.js\";\r\nimport { UKIcons } from \"../../core/iconDictionary.ts\";\r\nimport UKIconButton from \"../../components/iconButton/UKIconButton.tsx\";\r\nimport styles from \"./carousel.module.scss\";\r\n\r\nconst UKCarousel: React.FC<{\r\n items: { element: React.ReactElement; id: string }[];\r\n className?: string;\r\n}> = ({ items, className }) => {\r\n const scrollRef = useRef<HTMLDivElement>(null);\r\n const [currentPage, setCurrentPage] = useState<number>(0);\r\n\r\n useEffect(() => {\r\n const scrollElement = scrollRef.current;\r\n\r\n if (!scrollElement) return;\r\n\r\n console.log(Array.from(scrollElement.children));\r\n\r\n let timer: number;\r\n let listener = () => {\r\n clearTimeout(timer);\r\n timer = setTimeout(function () {\r\n Array.from(scrollElement.children).forEach((ele: Element, index: number) => {\r\n if (\r\n Math.abs(\r\n ele.getBoundingClientRect().left +\r\n ele.getBoundingClientRect().width / 2 -\r\n (scrollElement.getBoundingClientRect().left + scrollElement.getBoundingClientRect().width / 2),\r\n ) <\r\n ele.getBoundingClientRect().width / 2\r\n ) {\r\n setCurrentPage(index);\r\n return;\r\n }\r\n });\r\n }, 16) as unknown as number;\r\n };\r\n\r\n scrollElement.addEventListener(\"scroll\", listener);\r\n\r\n return () => {\r\n scrollElement.removeEventListener(\"scroll\", listener);\r\n clearTimeout(timer);\r\n };\r\n }, []);\r\n\r\n return (\r\n <UKContainer className={clippy(styles.containerComponent, className)}>\r\n <div\r\n className={styles.component}\r\n data-pages={true}\r\n ref={scrollRef}\r\n >\r\n {items.map((child) => {\r\n return (\r\n <div\r\n key={child.id}\r\n className={styles.page}\r\n >\r\n {child.element}\r\n </div>\r\n );\r\n })}\r\n </div>\r\n <div className={styles.controls}>\r\n <UKIconButton\r\n accessibleLabel={\"previous page\"}\r\n icon={UKIcons.ChevronLeft}\r\n className={styles.pageControl}\r\n onClick={() => {\r\n const scrollElement = scrollRef.current;\r\n\r\n if (!scrollElement) {\r\n return;\r\n }\r\n\r\n const carouselTargetPage = scrollElement.children[currentPage - 1] as HTMLDivElement;\r\n\r\n if (!carouselTargetPage) {\r\n return;\r\n }\r\n\r\n carouselTargetPage.scrollIntoView({ behavior: \"smooth\" });\r\n }}\r\n />\r\n <UKCard className={styles.indicator}>\r\n {items.map((page, index) => {\r\n return (\r\n <button\r\n key={page.id}\r\n className={clippy(styles.pageIndicator, index === currentPage && styles.selected)}\r\n onClick={() => {\r\n const scrollElement = scrollRef.current;\r\n\r\n if (!scrollElement) {\r\n return;\r\n }\r\n\r\n scrollElement.scrollIntoView({ behavior: \"smooth\" });\r\n\r\n const carouselTargetPage = scrollElement.children[index] as HTMLDivElement;\r\n\r\n carouselTargetPage.scrollIntoView({ behavior: \"smooth\" });\r\n }}\r\n />\r\n );\r\n })}\r\n </UKCard>\r\n <UKIconButton\r\n accessibleLabel={\"next page\"}\r\n icon={UKIcons.ChevronRight}\r\n className={styles.pageControl}\r\n onClick={() => {\r\n const scrollElement = scrollRef.current;\r\n\r\n if (!scrollElement) {\r\n return;\r\n }\r\n\r\n const carouselTargetPage = scrollElement.children[currentPage + 1] as HTMLDivElement;\r\n\r\n if (!carouselTargetPage) {\r\n return;\r\n }\r\n\r\n carouselTargetPage.scrollIntoView({ behavior: \"smooth\" });\r\n }}\r\n />\r\n </div>\r\n </UKContainer>\r\n );\r\n};\r\n\r\nexport default UKCarousel;\r\n"],"names":["UKCarousel","t0","$","_c","items","className","scrollRef","useRef","currentPage","setCurrentPage","useState","t1","t2","Symbol","for","scrollElement","current","console","log","Array","from","children","timer","listener","clearTimeout","forEach","ele","index","Math","abs","getBoundingClientRect","left","width","addEventListener","removeEventListener","useEffect","t3","clippy","styles","containerComponent","t4","map","_temp","t5","jsx","component","t6","UKIconButton","UKIcons","ChevronLeft","pageControl","scrollElement_0","carouselTargetPage","scrollIntoView","behavior","t7","t8","page","index_0","pageIndicator","selected","scrollElement_1","id","UKCard","indicator","t9","ChevronRight","scrollElement_2","carouselTargetPage_1","t10","jsxs","controls","t11","UKContainer","child","element"],"mappings":";;;;;;;;;AAQA,MAAMA,IAGDC,CAAAA,MAAA;AAAAC,QAAAA,IAAAC,IAAA,EAAA,GAAC;AAAA,IAAAC,OAAAA;AAAAA,IAAAC,WAAAA;AAAAA,EAAAA,IAAAJ,GACJK,IAAkBC,EAAA,IAA2B,G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AAzC,QAAAsE,KAAAA,IAAAtE,EAAA,EAAA,GAlFdsE;AAkFc;AA1Hb,SAAA9B,EAAAgC,GAAA;AAgDO,SAAA,gBAAA9B,EAAA,SAEa,WAAAN,EAAAmB,MAEViB,UAAKC,EAAAA,WAHDD,EAAKZ,EAIZ;AAAM;"}
1
+ {"version":3,"file":"UKCarousel.mjs","sources":["../../../../lib/views/carousel/UKCarousel.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\r\nimport UKCard from \"../../components/card/UKCard.tsx\";\r\nimport UKContainer from \"../../components/container/UKContainer.tsx\";\r\nimport clippy from \"../../core/clippy.js\";\r\nimport { UKIcons } from \"../../core/iconDictionary.ts\";\r\nimport UKIconButton from \"../../components/iconButton/UKIconButton.tsx\";\r\nimport styles from \"./carousel.module.scss\";\r\n\r\nconst UKCarousel: React.FC<{\r\n items: { element: React.ReactElement; id: string }[]; loopAround?: boolean; className?: string; height?: string;\r\n}> = ({ items, className, loopAround, height }) => {\r\n const scrollRef = useRef<HTMLDivElement>(null);\r\n const [ currentPage, setCurrentPage ] = useState<number>(0);\r\n\r\n useEffect(() => {\r\n const scrollElement = scrollRef.current;\r\n\r\n if (!scrollElement) return;\r\n\r\n let listener = () => {\r\n const scrollRect = scrollElement.getBoundingClientRect();\r\n let maxOverlap = 0;\r\n let currentPageIndex = -1;\r\n\r\n Array.from(scrollElement.children).forEach((ele: Element, index: number) => {\r\n const elementRect = ele.getBoundingClientRect();\r\n\r\n // Calculate the overlap between the element and the scroll element\r\n const overlap = Math.max(\r\n 0, Math.min(elementRect.right, scrollRect.right) - Math.max(elementRect.left, scrollRect.left));\r\n\r\n // Check if this overlap is greater than the current maximum overlap\r\n if (overlap > maxOverlap) {\r\n maxOverlap = overlap;\r\n currentPageIndex = index;\r\n }\r\n });\r\n\r\n // If an element has some overlap, set it as the current page\r\n if (currentPageIndex !== -1) {\r\n setCurrentPage(currentPageIndex);\r\n }\r\n };\r\n\r\n scrollElement.addEventListener(\"scroll\", listener);\r\n\r\n return () => {\r\n scrollElement.removeEventListener(\"scroll\", listener);\r\n };\r\n }, []);\r\n\r\n return (<UKContainer className={clippy(styles.containerComponent, className)} style={{\r\n // @ts-ignore\r\n \"--carousel-height\": height\r\n }}>\r\n <div\r\n className={styles.component}\r\n data-pages={true}\r\n ref={scrollRef}\r\n >\r\n {items.map((child, index) => {\r\n return (<div\r\n key={child.id}\r\n className={clippy(styles.page, index === currentPage && styles.activePage)}\r\n >\r\n {child.element}\r\n </div>);\r\n })}\r\n </div>\r\n <div className={styles.controls}>\r\n <UKIconButton\r\n accessibleLabel={\"previous page\"}\r\n icon={UKIcons.ChevronLeft}\r\n className={styles.pageControl}\r\n onClick={() => {\r\n const scrollElement = scrollRef.current;\r\n\r\n if (!scrollElement) {\r\n return;\r\n }\r\n\r\n const carouselTargetPage = scrollElement.children[currentPage - 1] as HTMLDivElement;\r\n\r\n if (!carouselTargetPage) {\r\n if (loopAround) {\r\n const carouselTargetPage = scrollElement.children[scrollElement.children.length - 1] as HTMLDivElement;\r\n carouselTargetPage.scrollIntoView({ behavior: \"smooth\", inline: \"center\", block: \"center\" });\r\n setCurrentPage(scrollElement.children.length - 1);\r\n }\r\n return;\r\n }\r\n\r\n carouselTargetPage.scrollIntoView({ behavior: \"smooth\", inline: \"center\", block: \"center\" });\r\n setCurrentPage(currentPage - 1);\r\n }}\r\n />\r\n <UKCard className={styles.indicator} containerClassName={styles.indicatorContainer}>\r\n {items.map((page, index) => {\r\n return (<button\r\n key={page.id}\r\n className={clippy(styles.pageIndicator, index === currentPage && styles.selected)}\r\n onClick={() => {\r\n const scrollElement = scrollRef.current;\r\n\r\n if (!scrollElement) {\r\n return;\r\n }\r\n\r\n const carouselTargetPage = scrollElement.children[index] as HTMLDivElement;\r\n\r\n setCurrentPage(index);\r\n carouselTargetPage.scrollIntoView({ behavior: \"smooth\", inline: \"center\", block: \"center\" });\r\n }}\r\n />);\r\n })}\r\n </UKCard>\r\n <UKIconButton\r\n accessibleLabel={\"next page\"}\r\n icon={UKIcons.ChevronRight}\r\n className={styles.pageControl}\r\n onClick={() => {\r\n const scrollElement = scrollRef.current;\r\n\r\n if (!scrollElement) {\r\n return;\r\n }\r\n\r\n const carouselTargetPage = scrollElement.children[currentPage + 1] as HTMLDivElement;\r\n\r\n if (!carouselTargetPage) {\r\n if (loopAround) {\r\n const carouselTargetPage = scrollElement.children[0] as HTMLDivElement;\r\n carouselTargetPage.scrollIntoView({ behavior: \"smooth\", inline: \"center\", block: \"center\" });\r\n setCurrentPage(0);\r\n }\r\n return;\r\n }\r\n\r\n carouselTargetPage.scrollIntoView({ behavior: \"smooth\", inline: \"center\", block: \"center\" });\r\n setCurrentPage(currentPage + 1);\r\n }}\r\n />\r\n </div>\r\n </UKContainer>);\r\n};\r\n\r\nexport default UKCarousel;\r\n"],"names":["UKCarousel","t0","$","_c","items","className","loopAround","height","scrollRef","useRef","currentPage","setCurrentPage","useState","t1","t2","Symbol","for","scrollElement","current","listener","scrollRect","getBoundingClientRect","maxOverlap","currentPageIndex","Array","from","children","forEach","ele","index","elementRect","overlap","Math","max","min","right","left","addEventListener","removeEventListener","useEffect","t3","clippy","styles","containerComponent","t4","t5","t6","child","index_0","page","activePage","element","id","map","jsx","component","t7","UKIconButton","UKIcons","ChevronLeft","pageControl","scrollElement_0","carouselTargetPage","length","scrollIntoView","behavior","inline","block","t8","t9","index_1","pageIndicator","selected","scrollElement_1","carouselTargetPage_1","UKCard","indicator","indicatorContainer","t10","ChevronRight","scrollElement_2","carouselTargetPage_2","t11","jsxs","controls","t12","UKContainer"],"mappings":";;;;;;;;;AAQA,MAAMA,IAEDC,CAAAA,MAAA;AAAAC,QAAAA,IAAAC,IAAA,EAAA,GAAC;AAAA,IAAAC,OAAAA;AAAAA,IAAAC,WAAAA;AAAAA,IAAAC,YAAAA;AAAAA,IAAAC,QAAAA;AAAAA,EAAAA,IAAAN,GACJO,IAAkBC,EAAA,IAA2B,GAC7C,CAAAC,GAAAC,CAAA,IAAw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A,IAAAnF,EAAA,EAAA,GA5FNmF;AA4FM;"}
@@ -1,4 +1,4 @@
1
1
  @charset "UTF-8";/*!
2
2
  * Copyright ©2025 Ewsgit <https://ewsgit.uk> and YourDash <https://yourdash.ewsgit.uk> contributors.
3
3
  * YourDash is licensed under the MIT License. (https://mit.ewsgit.uk)
4
- */._containerComponent_ya0ua_6{display:flex;flex-direction:row;width:100%;height:24rem;position:relative;padding:0;overflow:hidden}._component_ya0ua_16{display:flex;align-items:center;max-width:100%;height:24rem;gap:.5rem;flex-direction:row;overflow-x:auto;scroll-snap-type:x mandatory;scroll-snap-stop:always;scrollbar-width:none;padding-bottom:2.5rem}._component_ya0ua_16::-webkit-scrollbar{display:none}._page_ya0ua_33{display:flex;width:100%;height:100%;flex-shrink:0;scroll-snap-align:center}._page_ya0ua_33:first-of-type{margin-left:calc(20% + var(--utgap))}._page_ya0ua_33:last-of-type{margin-right:calc(20% + var(--utgap))}._controls_ya0ua_47{position:absolute;bottom:0;left:50%;transform:translate(-50%);display:flex;flex-direction:row;gap:var(--utgap)}._indicator_ya0ua_57{display:flex;flex-direction:row;gap:var(--utgap);padding:calc(var(--utpdn) / 2);border-radius:var(--utrad)}._indicator_ya0ua_57 ._pageIndicator_ya0ua_64{background-color:rgb(var(--utcol));padding:.5rem;border-radius:var(--utrad);transition:var(--uttrans);position:relative}._indicator_ya0ua_57 ._pageIndicator_ya0ua_64._selected_ya0ua_71{padding-right:1.5rem;padding-left:1.5rem}
4
+ */._containerComponent_5q8wt_6{display:flex;flex-direction:row;width:100%;height:var(--carousel-height, 24rem);position:relative;padding:0;overflow:hidden;border-radius:0}._component_5q8wt_17{display:flex;align-items:center;max-width:100%;height:100%;gap:10rem;flex-direction:row;overflow-x:auto;scroll-snap-type:x mandatory;scroll-snap-stop:always;scrollbar-width:none;padding-bottom:2.5rem}._component_5q8wt_17::-webkit-scrollbar{display:none}._page_5q8wt_34{display:flex;width:max-content;height:100%;align-items:center;justify-content:center;flex-shrink:0;scroll-snap-align:center;opacity:.5;transition:var(--uttrans)}._page_5q8wt_34:first-of-type{margin-left:100%}._page_5q8wt_34:last-of-type{margin-right:100%}._activePage_5q8wt_52{opacity:1}._controls_5q8wt_56{position:absolute;bottom:0;left:50%;transform:translate(-50%);display:flex;flex-direction:row;gap:var(--utgap);width:max-content}._indicatorContainer_5q8wt_67{width:max-content;overflow:unset}._indicator_5q8wt_67{display:flex;flex-direction:row;gap:var(--utgap);padding:calc(var(--utpdn) / 4 * 3);border-radius:var(--utrad);min-width:max-content}._indicator_5q8wt_67 ._pageIndicator_5q8wt_80{background-color:rgb(var(--utcol));height:calc(var(--utpdn) + var(--utpdn) / 4);border-radius:calc(var(--utrad) * .5);transition:var(--uttrans);aspect-ratio:1/1;opacity:.8;display:flex}._indicator_5q8wt_67 ._pageIndicator_5q8wt_80._selected_5q8wt_89{aspect-ratio:3/1;opacity:1}
@@ -1,20 +1,24 @@
1
- import './carousel.module.css';const o = "_containerComponent_ya0ua_6", n = "_component_ya0ua_16", t = "_page_ya0ua_33", a = "_controls_ya0ua_47", e = "_indicator_ya0ua_57", c = "_pageIndicator_ya0ua_64", _ = "_selected_ya0ua_71", s = {
2
- containerComponent: o,
1
+ import './carousel.module.css';const t = "_containerComponent_5q8wt_6", n = "_component_5q8wt_17", o = "_page_5q8wt_34", e = "_activePage_5q8wt_52", c = "_controls_5q8wt_56", a = "_indicatorContainer_5q8wt_67", _ = "_indicator_5q8wt_67", i = "_pageIndicator_5q8wt_80", r = "_selected_5q8wt_89", s = {
2
+ containerComponent: t,
3
3
  component: n,
4
- page: t,
5
- controls: a,
6
- indicator: e,
7
- pageIndicator: c,
8
- selected: _
4
+ page: o,
5
+ activePage: e,
6
+ controls: c,
7
+ indicatorContainer: a,
8
+ indicator: _,
9
+ pageIndicator: i,
10
+ selected: r
9
11
  };
10
12
  export {
13
+ e as activePage,
11
14
  n as component,
12
- o as containerComponent,
13
- a as controls,
15
+ t as containerComponent,
16
+ c as controls,
14
17
  s as default,
15
- e as indicator,
16
- t as page,
17
- c as pageIndicator,
18
- _ as selected
18
+ _ as indicator,
19
+ a as indicatorContainer,
20
+ o as page,
21
+ i as pageIndicator,
22
+ r as selected
19
23
  };
20
24
  //# sourceMappingURL=carousel.module.scss.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.module.scss.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
1
+ {"version":3,"file":"carousel.module.scss.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ interface IUKLayoutProps {
3
+ primarySidebar?: React.ReactNode;
4
+ secondarySidebar?: React.ReactNode;
5
+ header?: React.ReactNode;
6
+ footer?: React.ReactNode;
7
+ }
8
+ declare const UKLayout: React.FC<React.PropsWithChildren<IUKLayoutProps>>;
9
+ export default UKLayout;
File without changes
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare const CarouselTestPage: React.FC;
3
+ export default CarouselTestPage;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare const LayoutTestPage: React.FC;
3
+ export default LayoutTestPage;
@@ -4,18 +4,18 @@
4
4
  */
5
5
 
6
6
  import clippy from "../../core/clippy.ts";
7
- import { FC, ReactNode } from "react";
7
+ import React, { FC, ReactNode } from "react";
8
8
  import IncrementLevel from "../../core/incrementLevel.tsx";
9
9
  import { useLevel, useLevelClass } from "../../core/level.tsx";
10
10
  import styles from "./container.module.scss";
11
11
 
12
- const UKContainer: FC<{ className?: string; level?: 0 | 1 | 2 | 3; children: ReactNode | ReactNode[]; disableRounding?: boolean }> = (
12
+ const UKContainer: FC<{ className?: string; level?: 0 | 1 | 2 | 3; children: ReactNode | ReactNode[]; disableRounding?: boolean; style?: React.CSSProperties }> = (
13
13
  props,
14
14
  ) => {
15
15
  const level = props.level || useLevel();
16
16
 
17
17
  return (
18
- <div className={clippy(styles.component, props.className, props.disableRounding && styles.disableRounding, useLevelClass(level))}>
18
+ <div className={clippy(styles.component, props.className, props.disableRounding && styles.disableRounding, useLevelClass(level))} style={props.style}>
19
19
  <IncrementLevel>{props.children}</IncrementLevel>
20
20
  </div>
21
21
  );
@@ -7,132 +7,141 @@ import UKIconButton from "../../components/iconButton/UKIconButton.tsx";
7
7
  import styles from "./carousel.module.scss";
8
8
 
9
9
  const UKCarousel: React.FC<{
10
- items: { element: React.ReactElement; id: string }[];
11
- className?: string;
12
- }> = ({ items, className }) => {
10
+ items: { element: React.ReactElement; id: string }[]; loopAround?: boolean; className?: string; height?: string;
11
+ }> = ({ items, className, loopAround, height }) => {
13
12
  const scrollRef = useRef<HTMLDivElement>(null);
14
- const [currentPage, setCurrentPage] = useState<number>(0);
13
+ const [ currentPage, setCurrentPage ] = useState<number>(0);
15
14
 
16
15
  useEffect(() => {
17
16
  const scrollElement = scrollRef.current;
18
17
 
19
18
  if (!scrollElement) return;
20
19
 
21
- console.log(Array.from(scrollElement.children));
22
-
23
- let timer: number;
24
20
  let listener = () => {
25
- clearTimeout(timer);
26
- timer = setTimeout(function () {
27
- Array.from(scrollElement.children).forEach((ele: Element, index: number) => {
28
- if (
29
- Math.abs(
30
- ele.getBoundingClientRect().left +
31
- ele.getBoundingClientRect().width / 2 -
32
- (scrollElement.getBoundingClientRect().left + scrollElement.getBoundingClientRect().width / 2),
33
- ) <
34
- ele.getBoundingClientRect().width / 2
35
- ) {
36
- setCurrentPage(index);
37
- return;
38
- }
39
- });
40
- }, 16) as unknown as number;
21
+ const scrollRect = scrollElement.getBoundingClientRect();
22
+ let maxOverlap = 0;
23
+ let currentPageIndex = -1;
24
+
25
+ Array.from(scrollElement.children).forEach((ele: Element, index: number) => {
26
+ const elementRect = ele.getBoundingClientRect();
27
+
28
+ // Calculate the overlap between the element and the scroll element
29
+ const overlap = Math.max(
30
+ 0, Math.min(elementRect.right, scrollRect.right) - Math.max(elementRect.left, scrollRect.left));
31
+
32
+ // Check if this overlap is greater than the current maximum overlap
33
+ if (overlap > maxOverlap) {
34
+ maxOverlap = overlap;
35
+ currentPageIndex = index;
36
+ }
37
+ });
38
+
39
+ // If an element has some overlap, set it as the current page
40
+ if (currentPageIndex !== -1) {
41
+ setCurrentPage(currentPageIndex);
42
+ }
41
43
  };
42
44
 
43
45
  scrollElement.addEventListener("scroll", listener);
44
46
 
45
47
  return () => {
46
48
  scrollElement.removeEventListener("scroll", listener);
47
- clearTimeout(timer);
48
49
  };
49
50
  }, []);
50
51
 
51
- return (
52
- <UKContainer className={clippy(styles.containerComponent, className)}>
53
- <div
54
- className={styles.component}
55
- data-pages={true}
56
- ref={scrollRef}
57
- >
58
- {items.map((child) => {
59
- return (
60
- <div
61
- key={child.id}
62
- className={styles.page}
63
- >
64
- {child.element}
65
- </div>
66
- );
67
- })}
68
- </div>
69
- <div className={styles.controls}>
70
- <UKIconButton
71
- accessibleLabel={"previous page"}
72
- icon={UKIcons.ChevronLeft}
73
- className={styles.pageControl}
74
- onClick={() => {
75
- const scrollElement = scrollRef.current;
76
-
77
- if (!scrollElement) {
78
- return;
79
- }
52
+ return (<UKContainer className={clippy(styles.containerComponent, className)} style={{
53
+ // @ts-ignore
54
+ "--carousel-height": height
55
+ }}>
56
+ <div
57
+ className={styles.component}
58
+ data-pages={true}
59
+ ref={scrollRef}
60
+ >
61
+ {items.map((child, index) => {
62
+ return (<div
63
+ key={child.id}
64
+ className={clippy(styles.page, index === currentPage && styles.activePage)}
65
+ >
66
+ {child.element}
67
+ </div>);
68
+ })}
69
+ </div>
70
+ <div className={styles.controls}>
71
+ <UKIconButton
72
+ accessibleLabel={"previous page"}
73
+ icon={UKIcons.ChevronLeft}
74
+ className={styles.pageControl}
75
+ onClick={() => {
76
+ const scrollElement = scrollRef.current;
77
+
78
+ if (!scrollElement) {
79
+ return;
80
+ }
80
81
 
81
- const carouselTargetPage = scrollElement.children[currentPage - 1] as HTMLDivElement;
82
+ const carouselTargetPage = scrollElement.children[currentPage - 1] as HTMLDivElement;
82
83
 
83
- if (!carouselTargetPage) {
84
- return;
84
+ if (!carouselTargetPage) {
85
+ if (loopAround) {
86
+ const carouselTargetPage = scrollElement.children[scrollElement.children.length - 1] as HTMLDivElement;
87
+ carouselTargetPage.scrollIntoView({ behavior: "smooth", inline: "center", block: "center" });
88
+ setCurrentPage(scrollElement.children.length - 1);
85
89
  }
90
+ return;
91
+ }
86
92
 
87
- carouselTargetPage.scrollIntoView({ behavior: "smooth" });
88
- }}
89
- />
90
- <UKCard className={styles.indicator}>
91
- {items.map((page, index) => {
92
- return (
93
- <button
94
- key={page.id}
95
- className={clippy(styles.pageIndicator, index === currentPage && styles.selected)}
96
- onClick={() => {
97
- const scrollElement = scrollRef.current;
98
-
99
- if (!scrollElement) {
100
- return;
101
- }
102
-
103
- scrollElement.scrollIntoView({ behavior: "smooth" });
104
-
105
- const carouselTargetPage = scrollElement.children[index] as HTMLDivElement;
106
-
107
- carouselTargetPage.scrollIntoView({ behavior: "smooth" });
108
- }}
109
- />
110
- );
111
- })}
112
- </UKCard>
113
- <UKIconButton
114
- accessibleLabel={"next page"}
115
- icon={UKIcons.ChevronRight}
116
- className={styles.pageControl}
117
- onClick={() => {
118
- const scrollElement = scrollRef.current;
119
-
120
- if (!scrollElement) {
121
- return;
122
- }
93
+ carouselTargetPage.scrollIntoView({ behavior: "smooth", inline: "center", block: "center" });
94
+ setCurrentPage(currentPage - 1);
95
+ }}
96
+ />
97
+ <UKCard className={styles.indicator} containerClassName={styles.indicatorContainer}>
98
+ {items.map((page, index) => {
99
+ return (<button
100
+ key={page.id}
101
+ className={clippy(styles.pageIndicator, index === currentPage && styles.selected)}
102
+ onClick={() => {
103
+ const scrollElement = scrollRef.current;
104
+
105
+ if (!scrollElement) {
106
+ return;
107
+ }
108
+
109
+ const carouselTargetPage = scrollElement.children[index] as HTMLDivElement;
110
+
111
+ setCurrentPage(index);
112
+ carouselTargetPage.scrollIntoView({ behavior: "smooth", inline: "center", block: "center" });
113
+ }}
114
+ />);
115
+ })}
116
+ </UKCard>
117
+ <UKIconButton
118
+ accessibleLabel={"next page"}
119
+ icon={UKIcons.ChevronRight}
120
+ className={styles.pageControl}
121
+ onClick={() => {
122
+ const scrollElement = scrollRef.current;
123
+
124
+ if (!scrollElement) {
125
+ return;
126
+ }
123
127
 
124
- const carouselTargetPage = scrollElement.children[currentPage + 1] as HTMLDivElement;
128
+ const carouselTargetPage = scrollElement.children[currentPage + 1] as HTMLDivElement;
125
129
 
126
- if (!carouselTargetPage) {
127
- return;
130
+ if (!carouselTargetPage) {
131
+ if (loopAround) {
132
+ const carouselTargetPage = scrollElement.children[0] as HTMLDivElement;
133
+ carouselTargetPage.scrollIntoView({ behavior: "smooth", inline: "center", block: "center" });
134
+ setCurrentPage(0);
128
135
  }
136
+ return;
137
+ }
129
138
 
130
- carouselTargetPage.scrollIntoView({ behavior: "smooth" });
131
- }}
132
- />
133
- </div>
134
- </UKContainer>
135
- );
139
+ carouselTargetPage.scrollIntoView({ behavior: "smooth", inline: "center", block: "center" });
140
+ setCurrentPage(currentPage + 1);
141
+ }}
142
+ />
143
+ </div>
144
+ </UKContainer>);
136
145
  };
137
146
 
138
147
  export default UKCarousel;
@@ -4,18 +4,19 @@
4
4
  display: flex;
5
5
  flex-direction: row;
6
6
  width: 100%;
7
- height: 24rem;
7
+ height: var(--carousel-height, 24rem);
8
8
  position: relative;
9
9
  padding: 0;
10
10
  overflow: hidden;
11
+ border-radius: 0;
11
12
  }
12
13
 
13
14
  .component {
14
15
  display: flex;
15
16
  align-items: center;
16
17
  max-width: 100%;
17
- height: 24rem;
18
- gap: 0.5rem;
18
+ height: 100%;
19
+ gap: 10rem;
19
20
  flex-direction: row;
20
21
  overflow-x: auto;
21
22
  scroll-snap-type: x mandatory;
@@ -30,20 +31,28 @@
30
31
 
31
32
  .page {
32
33
  display: flex;
33
- width: 100%;
34
+ width: max-content;
34
35
  height: 100%;
36
+ align-items: center;
37
+ justify-content: center;
35
38
  flex-shrink: 0;
36
39
  scroll-snap-align: center;
40
+ opacity: 0.5;
41
+ transition: $UKTransition;
37
42
 
38
43
  &:first-of-type {
39
- margin-left: calc(20% + var(#{$theme+$gap}));
44
+ margin-left: 100%;
40
45
  }
41
46
 
42
47
  &:last-of-type {
43
- margin-right: calc(20% + var(#{$theme+$gap}));
48
+ margin-right: 100%;
44
49
  }
45
50
  }
46
51
 
52
+ .activePage {
53
+ opacity: 1;
54
+ }
55
+
47
56
  .controls {
48
57
  position: absolute;
49
58
  bottom: 0;
@@ -51,26 +60,35 @@
51
60
  transform: translateX(-50%);
52
61
  display: flex;
53
62
  flex-direction: row;
54
- gap: var(#{$theme+$gap});
63
+ gap: $UKGap;
64
+ width: max-content;
65
+ }
66
+
67
+ .indicatorContainer {
68
+ width: max-content;
69
+ overflow: unset;
55
70
  }
56
71
 
57
72
  .indicator {
58
73
  display: flex;
59
74
  flex-direction: row;
60
75
  gap: var(#{$theme+$gap});
61
- padding: calc(var(#{$theme+$padding}) / 2);
76
+ padding: calc(calc(var(#{$theme+$padding}) / 4) * 3);
62
77
  border-radius: var(#{$theme+$radius});
78
+ min-width: max-content;
63
79
 
64
80
  .pageIndicator {
65
81
  background-color: rgb(var(#{$theme+$color}));
66
- padding: 0.5rem;
67
- border-radius: var(#{$theme+$radius});
68
- transition: var(#{$theme+$transition});
69
- position: relative;
82
+ height: calc($UKPadding + calc($UKPadding / 4));
83
+ border-radius: calc(var(#{$theme+$radius}) * 0.5);
84
+ transition: $UKTransition;
85
+ aspect-ratio: 1 / 1;
86
+ opacity: 0.8;
87
+ display: flex;
70
88
 
71
89
  &.selected {
72
- padding-right: 1.5rem;
73
- padding-left: 1.5rem;
90
+ aspect-ratio: 3 / 1;
91
+ opacity: 1;
74
92
  }
75
93
  }
76
94
  }
@@ -0,0 +1,24 @@
1
+ .layout {
2
+ display: grid;
3
+ grid-template: auto 1fr auto / auto 1fr auto;
4
+ }
5
+
6
+ .header {
7
+ grid-column: 1 / 4;
8
+ }
9
+
10
+ .footer {
11
+ grid-column: 1 / 4;
12
+ }
13
+
14
+ .children {
15
+ grid-column: 2 / 3;
16
+ }
17
+
18
+ .primarySidebar {
19
+ grid-column: 1 / 2;
20
+ }
21
+
22
+ .secondarySidebar {
23
+ grid-column: 3 / 4;
24
+ }
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import styles from "./UKLayout.module.scss";
3
+
4
+ interface IUKLayoutProps {
5
+ primarySidebar?: React.ReactNode,
6
+ secondarySidebar?: React.ReactNode,
7
+ header?: React.ReactNode,
8
+ footer?: React.ReactNode,
9
+ }
10
+
11
+ const UKLayout: React.FC<React.PropsWithChildren<IUKLayoutProps>> = ({
12
+ primarySidebar,
13
+ secondarySidebar,
14
+ footer,
15
+ header,
16
+ children
17
+ }) => {
18
+ return <div className={styles.layout}>
19
+ {header && <div className={styles.header}>{header}</div>}
20
+ {primarySidebar && <div className={styles.primarySidebar}>{primarySidebar}</div>}
21
+ <div className={styles.children}>
22
+ {children}
23
+ </div>
24
+ {secondarySidebar && <div className={styles.secondarySidebar}>{secondarySidebar}</div>}
25
+ {footer && <div className={styles.footer}>{footer}</div>}
26
+ </div>;
27
+ };
28
+
29
+ export default UKLayout;
30
+
package/package.json CHANGED
@@ -1,62 +1,64 @@
1
- {
2
- "name": "@yourdash/uikit",
3
- "version": "0.1.4",
4
- "description": "",
5
- "scripts": {
6
- "dev-compile": "vite build --watch",
7
- "dev": "vite dev",
8
- "compile": "vite build"
9
- },
10
- "keywords": [],
11
- "author": "Ewsgit",
12
- "license": "MIT",
13
- "files": [
14
- "dist",
15
- "lib"
16
- ],
17
- "sideEffects": [
18
- "**/*.css"
19
- ],
20
- "type": "module",
21
- "exports": {
22
- "./lib/theme/themeValues.scss": {
23
- "default": "./dist/themeValues.scss"
24
- },
25
- "./themeValues.scss": {
26
- "default": "./dist/themeValues.scss"
27
- },
28
- ".": {
29
- "import": "./dist/src/index.mjs",
30
- "types": "./dist/src/index.d.ts",
31
- "default": "./dist/src/index.mjs"
32
- }
33
- },
34
- "dependencies": {
35
- "@vitejs/plugin-react": "^4.3.4",
36
- "animate.css": "^4.1.1",
37
- "babel-plugin-react-compiler": "19.0.0-beta-e1e972c-20250221",
38
- "clsx": "^2.1.1",
39
- "glob": "^11.0.1",
40
- "npm-run-all": "^4.1.5",
41
- "vite": "^6.2.0",
42
- "vite-plugin-dynamic-import": "^1.6.0",
43
- "vite-plugin-lib-inject-css": "^2.2.1"
44
- },
45
- "devDependencies": {
46
- "@types/node": "^22.13.8",
47
- "@types/react": "^19.0.10",
48
- "@types/react-dom": "^19.0.4",
49
- "@types/react-router": "^5.1.20",
50
- "@types/react-router-dom": "^5.3.3",
51
- "react": "^19.0.0",
52
- "react-dom": "^19.0.0",
53
- "react-router": "^7.2.0",
54
- "react-router-dom": "^7.2.0",
55
- "sass-embedded": "^1.85.1",
56
- "vite-plugin-dts": "^4.5.3"
57
- },
58
- "peerDependencies": {
59
- "react": "^19.0.0",
60
- "react-dom": "^19.0.0"
61
- }
62
- }
1
+ {
2
+ "name": "@yourdash/uikit",
3
+ "version": "0.1.6",
4
+ "description": "",
5
+ "scripts": {
6
+ "dev-compile": "vite build --watch",
7
+ "dev": "vite dev",
8
+ "build": "vite build",
9
+ "compile": "vite build"
10
+ },
11
+ "keywords": [],
12
+ "author": "Ewsgit",
13
+ "license": "MIT",
14
+ "files": [
15
+ "dist",
16
+ "lib"
17
+ ],
18
+ "sideEffects": [
19
+ "**/*.css"
20
+ ],
21
+ "type": "module",
22
+ "exports": {
23
+ "./lib/theme/themeValues.scss": {
24
+ "default": "./dist/themeValues.scss"
25
+ },
26
+ "./themeValues.scss": {
27
+ "default": "./dist/themeValues.scss"
28
+ },
29
+ ".": {
30
+ "import": "./dist/src/index.mjs",
31
+ "types": "./dist/src/index.d.ts",
32
+ "default": "./dist/src/index.mjs"
33
+ }
34
+ },
35
+ "dependencies": {
36
+ "@vitejs/plugin-react": "^4.3.4",
37
+ "animate.css": "^4.1.1",
38
+ "babel-plugin-react-compiler": "19.0.0-beta-e1e972c-20250221",
39
+ "clsx": "^2.1.1",
40
+ "glob": "^11.0.1",
41
+ "npm-run-all": "^4.1.5",
42
+ "vite": "^6.2.0",
43
+ "vite-plugin-dynamic-import": "^1.6.0",
44
+ "vite-plugin-lib-inject-css": "^2.2.1"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^22.13.8",
48
+ "@types/react": "^19.0.10",
49
+ "@types/react-dom": "^19.0.4",
50
+ "@types/react-router": "^5.1.20",
51
+ "@types/react-router-dom": "^5.3.3",
52
+ "react": "^19.0.0",
53
+ "react-dom": "^19.0.0",
54
+ "react-router": "^7.2.0",
55
+ "react-router-dom": "^7.2.0",
56
+ "sass-embedded": "^1.85.1",
57
+ "vite-plugin-dts": "^4.5.3"
58
+ },
59
+ "peerDependencies": {
60
+ "react": "^19.0.0",
61
+ "react-dom": "^19.0.0"
62
+ },
63
+ "packageManager": "pnpm@10.6.3+sha512.bb45e34d50a9a76e858a95837301bfb6bd6d35aea2c5d52094fa497a467c43f5c440103ce2511e9e0a2f89c3d6071baac3358fc68ac6fb75e2ceb3d2736065e6"
64
+ }
package/lib/imports.d.ts DELETED
@@ -1,81 +0,0 @@
1
- /*
2
- * Copyright ©2023 @Ewsgit and YourDash contributors.
3
- * YourDash is licensed under the MIT License. (https://ewsgit.mit-license.org)
4
- */
5
-
6
- // Declare common file imports as shared for the Typescript Language Server
7
-
8
- declare module "*.module.css" {
9
- const content: { [className: string]: string };
10
- export default content;
11
- }
12
-
13
- declare module "*.module.scss" {
14
- const content: { [className: string]: string };
15
- export default content;
16
- }
17
-
18
- declare module "*.jpg" {
19
- const value: string;
20
- export default value;
21
- }
22
-
23
- declare module "*.png" {
24
- const value: string;
25
- export default value;
26
- }
27
-
28
- declare module "*.svg" {
29
- const value: string;
30
- export default value;
31
- }
32
-
33
- declare module "*.avif" {
34
- const value: string;
35
- export default value;
36
- }
37
-
38
- declare module "*.css" {
39
- const value: string;
40
- export default value;
41
- }
42
-
43
- declare module "*.scss" {
44
- const value: string;
45
- export default value;
46
- }
47
-
48
- declare module "*.json" {
49
- const content: { [key: string]: string | number | object | boolean };
50
- export default content;
51
- }
52
-
53
- declare module "*.obj" {
54
- const value: string;
55
- export default value;
56
- }
57
-
58
- declare module "*.glb" {
59
- const value: string;
60
- export default value;
61
- }
62
-
63
- declare module "*.gltf" {
64
- const value: string;
65
- export default value;
66
- }
67
-
68
- declare module "*.md" {
69
- const value: string;
70
- export default value;
71
- }
72
-
73
- declare module "*.mdx" {
74
- const value: string;
75
- export default value;
76
- }
77
-
78
- declare module "*.wasm" {
79
- const value: string;
80
- export default value;
81
- }