@uqds/react 1.0.0-alpha.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/CHANGELOG.md +10 -0
- package/README.md +25 -0
- package/dist/css/main.css +1 -0
- package/dist/js/main.d.ts +122 -0
- package/dist/js/main.js +287 -0
- package/package.json +69 -0
- package/src/jsx/components/UqCard/UqCard.tsx +31 -0
- package/src/jsx/components/UqIcon/UqIcon.tsx +16 -0
- package/src/jsx/components/UqPagination/UqPagination.tsx +180 -0
- package/src/jsx/components/UqPagination/UqPaginationItem.tsx +55 -0
- package/src/jsx/components/UqPane/UqPane.tsx +34 -0
- package/src/jsx/components/UqStoryCard/UqStoryCard.tsx +38 -0
- package/src/jsx/enum/index.ts +42 -0
- package/src/jsx/layout/UqCardGrid/UqCardGrid.tsx +17 -0
- package/src/jsx/layout/UqContainer/UqContainer.tsx +7 -0
- package/src/jsx/main.tsx +21 -0
- package/src/scss/main.scss +7 -0
- package/tsconfig.json +23 -0
- package/vite.config.js +25 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { FC, MouseEventHandler } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { UqIcon } from "../UqIcon/UqIcon.tsx";
|
|
4
|
+
import { UqPaginationItemType } from "../../enum";
|
|
5
|
+
|
|
6
|
+
export interface UqPaginationItemProps {
|
|
7
|
+
As?: "button" | "a";
|
|
8
|
+
type?: UqPaginationItemType;
|
|
9
|
+
number?: number;
|
|
10
|
+
current?: boolean;
|
|
11
|
+
href?: string;
|
|
12
|
+
value?: string;
|
|
13
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const UqPaginationItem: FC<UqPaginationItemProps> = ({
|
|
17
|
+
As = "button",
|
|
18
|
+
type,
|
|
19
|
+
number,
|
|
20
|
+
current = false,
|
|
21
|
+
href,
|
|
22
|
+
value,
|
|
23
|
+
onClick,
|
|
24
|
+
}) => {
|
|
25
|
+
return (
|
|
26
|
+
<li className="uq-pagination__list-item">
|
|
27
|
+
<As
|
|
28
|
+
className={classNames("uq-pagination__item", {
|
|
29
|
+
[`uq-pagination__${type}`]: type,
|
|
30
|
+
"uq-pagination__current": current,
|
|
31
|
+
})}
|
|
32
|
+
aria-current={current && "page"}
|
|
33
|
+
// @ts-expect-error Dynamic elements expect different attributes (a and button).
|
|
34
|
+
onClick={onClick}
|
|
35
|
+
href={href}
|
|
36
|
+
value={value}
|
|
37
|
+
>
|
|
38
|
+
<span className="visually-hidden">
|
|
39
|
+
{!type && "Page"}
|
|
40
|
+
{type === UqPaginationItemType.Previous && "Previous page"}
|
|
41
|
+
{type === UqPaginationItemType.Next && "Previous page"}
|
|
42
|
+
{type === UqPaginationItemType.Ellipsis && `Skip to page ${number}`}
|
|
43
|
+
</span>
|
|
44
|
+
{!type && `${number}`}
|
|
45
|
+
{type === UqPaginationItemType.Previous && (
|
|
46
|
+
<UqIcon name={"standard--chevron-left"} />
|
|
47
|
+
)}
|
|
48
|
+
{type === UqPaginationItemType.Next && (
|
|
49
|
+
<UqIcon name={"standard--chevron-right"} />
|
|
50
|
+
)}
|
|
51
|
+
{type === UqPaginationItemType.Ellipsis && "…"}
|
|
52
|
+
</As>
|
|
53
|
+
</li>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { FC, ReactNode } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { UqPaneVariant } from "../../enum";
|
|
4
|
+
|
|
5
|
+
export interface UqPaneProps {
|
|
6
|
+
title: string;
|
|
7
|
+
variant: UqPaneVariant;
|
|
8
|
+
image?: ReactNode;
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
video?: ReactNode;
|
|
11
|
+
description?: ReactNode;
|
|
12
|
+
links?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const UqPane: FC<UqPaneProps> = ({
|
|
16
|
+
image,
|
|
17
|
+
icon,
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
variant,
|
|
21
|
+
links,
|
|
22
|
+
video,
|
|
23
|
+
}) => (
|
|
24
|
+
<div className={classNames("uq-pane", `uq-pane--${variant}`)}>
|
|
25
|
+
{image && <div className="uq-pane__image">{image}</div>}
|
|
26
|
+
{video && <div className="uq-pane__video">{video}</div>}
|
|
27
|
+
<div className="uq-pane__content">
|
|
28
|
+
{icon && <div className="uq-pane__icon">{icon}</div>}
|
|
29
|
+
<h3 className="uq-pane__title">{title}</h3>
|
|
30
|
+
{description && <div className="uq-pane__description">{description}</div>}
|
|
31
|
+
{links && <div className="uq-pane__actions">{links}</div>}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FC, ReactNode } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { UqStoryCardVariant } from "../../enum";
|
|
4
|
+
|
|
5
|
+
export interface UqStoryCardProps {
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
variant: UqStoryCardVariant;
|
|
8
|
+
image?: ReactNode;
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
topLabel: string;
|
|
11
|
+
bottomLabel: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const UqStoryCard: FC<UqStoryCardProps> = ({
|
|
15
|
+
image,
|
|
16
|
+
title,
|
|
17
|
+
description,
|
|
18
|
+
variant,
|
|
19
|
+
topLabel,
|
|
20
|
+
bottomLabel,
|
|
21
|
+
}) => (
|
|
22
|
+
<div
|
|
23
|
+
className={classNames("uq-story-card", `uq-story-card--${variant}`)}
|
|
24
|
+
data-gtm-category="StoryCard"
|
|
25
|
+
>
|
|
26
|
+
{image && <div className="uq-story-card__image">{image}</div>}
|
|
27
|
+
<div className="uq-story-card__content">
|
|
28
|
+
{topLabel && <div className="uq-story-card__top-label">{topLabel}</div>}
|
|
29
|
+
<h3 className="uq-story-card__title">{title}</h3>
|
|
30
|
+
{description && (
|
|
31
|
+
<div className="uq-story-card__description">{description}</div>
|
|
32
|
+
)}
|
|
33
|
+
{bottomLabel && (
|
|
34
|
+
<div className="uq-story-card__bottom-label">{bottomLabel}</div>
|
|
35
|
+
)}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const enum UqCardVariant {
|
|
2
|
+
text = "text",
|
|
3
|
+
image = "image",
|
|
4
|
+
icon = "icon",
|
|
5
|
+
iconNav = "icon-nav",
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum UqCardGridTarget {
|
|
9
|
+
x1 = "1x",
|
|
10
|
+
x2 = "2x",
|
|
11
|
+
x3 = "3x",
|
|
12
|
+
x4 = "4x",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const enum UqIconVariant {
|
|
16
|
+
light = "light",
|
|
17
|
+
text = "text",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const enum UqPaginationItemType {
|
|
21
|
+
Previous = "previous",
|
|
22
|
+
Next = "next",
|
|
23
|
+
Ellipsis = "ellipsis",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const enum UqPaneVariant {
|
|
27
|
+
text = "text",
|
|
28
|
+
image = "image",
|
|
29
|
+
video = "video",
|
|
30
|
+
icon = "icon",
|
|
31
|
+
iconLarge = "icon-large",
|
|
32
|
+
textShaded = "text-shaded",
|
|
33
|
+
iconShaded = "icon-shaded",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const enum UqStoryCardVariant {
|
|
37
|
+
story = "story",
|
|
38
|
+
news = "news",
|
|
39
|
+
event = "event",
|
|
40
|
+
landscape = "landscape",
|
|
41
|
+
feature = "feature",
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FC, PropsWithChildren } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { UqCardGridTarget } from "../../enum";
|
|
4
|
+
|
|
5
|
+
export interface UqCardGridProps extends PropsWithChildren {
|
|
6
|
+
target?: UqCardGridTarget;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const UqCardGrid: FC<UqCardGridProps> = ({ children, target }) => (
|
|
10
|
+
<div
|
|
11
|
+
className={classNames("uq-card-grid", {
|
|
12
|
+
[`uq-card-grid--target-${target}`]: target,
|
|
13
|
+
})}
|
|
14
|
+
>
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
package/src/jsx/main.tsx
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UqContainer } from "./layout/UqContainer/UqContainer";
|
|
2
|
+
import { UqCardGrid } from "./layout/UqCardGrid/UqCardGrid";
|
|
3
|
+
import { UqIcon } from "./components/UqIcon/UqIcon";
|
|
4
|
+
import { UqCard } from "./components/UqCard/UqCard";
|
|
5
|
+
import { UqPane } from "./components/UqPane/UqPane";
|
|
6
|
+
import { UqStoryCard } from "./components/UqStoryCard/UqStoryCard";
|
|
7
|
+
import { UqPagination } from "./components/UqPagination/UqPagination";
|
|
8
|
+
import { UqPaginationItem } from "./components/UqPagination/UqPaginationItem";
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
UqContainer,
|
|
12
|
+
UqCardGrid,
|
|
13
|
+
UqCard,
|
|
14
|
+
UqIcon,
|
|
15
|
+
UqPane,
|
|
16
|
+
UqStoryCard,
|
|
17
|
+
UqPagination,
|
|
18
|
+
UqPaginationItem,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export * from "./enum/index";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
@use "@uqds/core/src/scss/main" as core;
|
|
2
|
+
@use "@uqds/layout/src/scss/main" as layout;
|
|
3
|
+
@use "@uqds/body/src/scss/main" as body;
|
|
4
|
+
@use "@uqds/icon/src/scss/main" as icon;
|
|
5
|
+
@use "@uqds/card/src/scss/main" as card;
|
|
6
|
+
@use "@uqds/pane/src/scss/main" as pane;
|
|
7
|
+
@use "@uqds/pagination/src/scss/main" as pagination;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"moduleDetection": "force",
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"jsx": "react-jsx",
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noUnusedLocals": true,
|
|
16
|
+
"noUnusedParameters": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
"noUncheckedSideEffectImports": true,
|
|
19
|
+
"declaration": true,
|
|
20
|
+
"verbatimModuleSyntax": true
|
|
21
|
+
},
|
|
22
|
+
"include": ["src"]
|
|
23
|
+
}
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import { resolve } from "path";
|
|
3
|
+
import react from "@vitejs/plugin-react";
|
|
4
|
+
import dts from "vite-plugin-dts";
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [
|
|
8
|
+
react(),
|
|
9
|
+
dts({
|
|
10
|
+
rollupTypes: true,
|
|
11
|
+
tsconfigPath: "./tsconfig.json",
|
|
12
|
+
}),
|
|
13
|
+
],
|
|
14
|
+
build: {
|
|
15
|
+
lib: {
|
|
16
|
+
entry: resolve(import.meta.dirname, "src/jsx/main.tsx"),
|
|
17
|
+
fileName: "main",
|
|
18
|
+
formats: ["es"],
|
|
19
|
+
},
|
|
20
|
+
outDir: resolve(import.meta.dirname, "./dist/js"),
|
|
21
|
+
rollupOptions: {
|
|
22
|
+
external: ["react", "react/jsx-runtime"],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|