@vaneui/ui 0.0.6 → 0.0.8

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/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@vaneui/ui",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.esm.js",
8
8
  "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
9
12
  "exports": {
10
13
  ".": {
11
14
  "import": "./dist/index.esm.js",
@@ -16,11 +19,20 @@
16
19
  "import": "./dist/components/complex/index.js",
17
20
  "require": "./dist/components/complex/index.js",
18
21
  "types": "./dist/components/complex/index.d.ts"
22
+ },
23
+ "./css/ui": {
24
+ "import": "./dist/ui.css"
25
+ },
26
+ "./css/complex": {
27
+ "import": "./dist/complex.css"
19
28
  }
20
29
  },
21
30
  "scripts": {
22
31
  "clean": "rimraf dist",
23
- "build": "npm run clean && rollup -c --bundleConfigAsCjs",
32
+ "build:js": "npm run clean && rollup -c --bundleConfigAsCjs",
33
+ "build:css:ui": "npx @tailwindcss/cli --input index.css --output ./../../../dist/ui.css --cwd ./src/components/ui/",
34
+ "build:css:complex": "npx @tailwindcss/cli --input index.css --output ./../../../dist/complex.css --cwd ./src/components/complex/",
35
+ "build": "npm run clean && npm run build:js && npm run build:css:ui && npm run build:css:complex",
24
36
  "prepublishOnly": "npm run build"
25
37
  },
26
38
  "keywords": [],
@@ -39,10 +51,9 @@
39
51
  "rollup": "^4.34.9",
40
52
  "rollup-plugin-peer-deps-external": "^2.2.4",
41
53
  "rollup-plugin-typescript2": "^0.36.0",
42
- "typescript": "^5.8.2",
43
54
  "tailwind-merge": "^3.0.2",
44
- "tslib": "^2.8.1"
45
- },
46
- "dependencies": {
55
+ "tailwindcss": "^4.0.9",
56
+ "tslib": "^2.8.1",
57
+ "typescript": "^5.8.2"
47
58
  }
48
59
  }
@@ -1,65 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
-
4
- name: Npm publish on push
5
-
6
- on: [push]
7
-
8
- jobs:
9
- build:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - name: Checkout Code
13
- uses: actions/checkout@v4
14
-
15
- - name: Setup Node.js
16
- uses: actions/setup-node@v3
17
- with:
18
- node-version: '20'
19
- registry-url: 'https://registry.npmjs.org'
20
- cache: 'npm'
21
-
22
- - name: Install Dependencies
23
- run: npm ci
24
-
25
- - name: Build Package
26
- run: npm run build
27
-
28
- publish-npm:
29
- needs: build
30
- runs-on: ubuntu-latest
31
- steps:
32
- - name: Checkout Code
33
- uses: actions/checkout@v4
34
-
35
- - name: Setup Node.js
36
- uses: actions/setup-node@v3
37
- with:
38
- node-version: '20'
39
- registry-url: 'https://registry.npmjs.org'
40
-
41
- - name: Install Dependencies
42
- run: npm ci
43
-
44
- - name: Check if Version Already Published
45
- id: check_version
46
- run: |
47
- # Get version from package.json
48
- VERSION=$(node -p "require('./package.json').version")
49
- echo "Local package version: $VERSION"
50
- # Get published version for the package (@vaneui/ui) or "none" if not published.
51
- PUBLISHED_VERSION=$(npm view @vaneui/ui version || echo "none")
52
- echo "Published package version: $PUBLISHED_VERSION"
53
- if [ "$VERSION" = "$PUBLISHED_VERSION" ]; then
54
- echo "Version already published. Skipping publish step."
55
- echo "shouldPublish=false" >> $GITHUB_OUTPUT
56
- else
57
- echo "Version is new. Proceeding with publish."
58
- echo "shouldPublish=true" >> $GITHUB_OUTPUT
59
- fi
60
-
61
- - name: Publish Package to npm
62
- if: steps.check_version.outputs.shouldPublish == 'true'
63
- run: npm publish --access public
64
- env:
65
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,5 +0,0 @@
1
- {
2
- "cSpell.words": [
3
- "vaneui"
4
- ]
5
- }
package/rollup.config.mjs DELETED
@@ -1,45 +0,0 @@
1
- import peerDepsExternal from "rollup-plugin-peer-deps-external";
2
- import resolve from "@rollup/plugin-node-resolve";
3
- import commonjs from "@rollup/plugin-commonjs";
4
- import typescript from "rollup-plugin-typescript2";
5
- import pkg from "./package.json";
6
-
7
- export default [
8
- {
9
- input: "src/index.ts",
10
- output: [
11
- {
12
- file: pkg.main,
13
- format: "cjs",
14
- sourcemap: true,
15
- },
16
- {
17
- file: pkg.module,
18
- format: "esm",
19
- sourcemap: true,
20
- },
21
- ],
22
- plugins: [
23
- peerDepsExternal(),
24
- resolve(),
25
- commonjs(),
26
- typescript({ tsconfig: "./tsconfig.json" }),
27
- ],
28
- },
29
- {
30
- input: "src/components/complex/index.ts",
31
- output: [
32
- {
33
- file: "dist/components/complex/index.js",
34
- format: "esm",
35
- sourcemap: true,
36
- },
37
- ],
38
- plugins: [
39
- peerDepsExternal(),
40
- resolve(),
41
- commonjs(),
42
- typescript({ tsconfig: "./tsconfig.complex.json" }),
43
- ],
44
- },
45
- ];
@@ -1 +0,0 @@
1
- export { SocialShare } from "./sharer";
@@ -1,216 +0,0 @@
1
- import React from 'react';
2
-
3
- type Platform = 'fb' | 'li' | 'x' | 'th' | 'em' | 'wa' | 'tg' | 're';
4
-
5
- interface SocialShareCommonProps {
6
- url?: string;
7
- text?: string;
8
- width?: number;
9
- height?: number;
10
- isLink?: boolean;
11
- isBlank?: boolean;
12
- platforms?: Platform[];
13
- containerComponent?: React.ElementType;
14
- buttonComponent?: React.ElementType;
15
- buttonComponents?: Partial<Record<Platform, React.ElementType>>;
16
- }
17
-
18
- interface FacebookShareProps {
19
- hashtag?: string;
20
- }
21
-
22
- interface TwitterShareProps {
23
- hashtags?: string;
24
- via?: string;
25
- related?: string;
26
- inReplyTo?: string;
27
- }
28
-
29
- interface EmailShareProps {
30
- title?: string;
31
- to?: string;
32
- }
33
-
34
- interface WhatsAppShareProps {
35
- to?: string;
36
- web?: boolean;
37
- }
38
-
39
- interface SocialShareProps extends SocialShareCommonProps {
40
- facebookProps?: FacebookShareProps;
41
- twitterProps?: TwitterShareProps;
42
- emailProps?: EmailShareProps;
43
- whatsappProps?: WhatsAppShareProps;
44
- }
45
-
46
- interface ShareConfig {
47
- shareUrl: string;
48
- getParams: () => { [key: string]: string | number | boolean | undefined };
49
- }
50
-
51
- const buildQueryString = (
52
- params: { [key: string]: string | number | boolean | undefined }
53
- ): string => {
54
- const validKeys = Object.keys(params).filter(
55
- key => params[key] !== undefined && params[key] !== ''
56
- );
57
- return validKeys.length > 0
58
- ? '?' +
59
- validKeys
60
- .map(key => `${key}=${encodeURIComponent(String(params[key]))}`)
61
- .join('&')
62
- : '';
63
- };
64
-
65
- export const SocialShare: React.FC<SocialShareProps> = ({
66
- url = window.location.href,
67
- text = '',
68
- width = 600,
69
- height = 480,
70
- isLink = false,
71
- isBlank = true,
72
- platforms,
73
- containerComponent,
74
- buttonComponent,
75
- buttonComponents,
76
- facebookProps = {},
77
- twitterProps = {},
78
- emailProps = {},
79
- whatsappProps = {},
80
- }) => {
81
- const shareConfigs: { [key in Platform]: ShareConfig } = {
82
- fb: {
83
- shareUrl: 'https://www.facebook.com/sharer/sharer.php',
84
- getParams: () => ({
85
- u: url,
86
- hashtag: facebookProps.hashtag
87
- ? facebookProps.hashtag.startsWith('#')
88
- ? facebookProps.hashtag
89
- : `#${facebookProps.hashtag}`
90
- : '',
91
- quote: text,
92
- }),
93
- },
94
- li: {
95
- shareUrl: 'https://www.linkedin.com/shareArticle',
96
- getParams: () => ({
97
- url,
98
- }),
99
- },
100
- x: {
101
- shareUrl: 'https://x.com/intent/tweet',
102
- getParams: () => ({
103
- text,
104
- url,
105
- hashtags: twitterProps.hashtags,
106
- via: twitterProps.via,
107
- related: twitterProps.related,
108
- in_reply_to: twitterProps.inReplyTo,
109
- }),
110
- },
111
- th: {
112
- shareUrl: 'https://threads.net/intent/post',
113
- getParams: () => ({
114
- text: `${text} ${url}`,
115
- }),
116
- },
117
- em: {
118
- shareUrl: 'mailto:' + (emailProps.to || ''),
119
- getParams: () => ({
120
- subject: emailProps.title,
121
- body: `${text}\n${url}`,
122
- }),
123
- },
124
- wa: {
125
- shareUrl: whatsappProps.web
126
- ? 'https://web.whatsapp.com/send'
127
- : 'https://wa.me/',
128
- getParams: () => ({
129
- phone: whatsappProps.to,
130
- text: `${text} ${url}`,
131
- }),
132
- },
133
- tg: {
134
- shareUrl: 'https://t.me/share',
135
- getParams: () => ({
136
- text,
137
- url,
138
- }),
139
- },
140
- re: {
141
- shareUrl: 'https://www.reddit.com/submit',
142
- getParams: () => ({
143
- url,
144
- title: text,
145
- }),
146
- },
147
- };
148
-
149
- const platformLabels: { [key in Platform]: string } = {
150
- fb: 'Facebook',
151
- li: 'LinkedIn',
152
- x: 'X',
153
- th: 'Threads',
154
- em: 'Email',
155
- wa: 'WhatsApp',
156
- tg: 'Telegram',
157
- re: 'Reddit',
158
- };
159
-
160
- const buildShareUrl = (config: ShareConfig): string => {
161
- const params = config.getParams();
162
- const queryString = buildQueryString(params);
163
- return config.shareUrl + queryString;
164
- };
165
-
166
- const openShareWindow = (shareUrl: string): void => {
167
- if (isLink) {
168
- if (isBlank) {
169
- window.open(shareUrl, '_blank');
170
- } else {
171
- window.location.href = shareUrl;
172
- }
173
- } else {
174
- const left = window.innerWidth / 2 - width / 2 + window.screenX;
175
- const top = window.innerHeight / 2 - height / 2 + window.screenY;
176
- const popParams = `scrollbars=no, width=${width}, height=${height}, top=${top}, left=${left}`;
177
- const newWindow = window.open(shareUrl, '', popParams);
178
- if (newWindow) {
179
- newWindow.focus();
180
- }
181
- }
182
- };
183
-
184
- const handleShare = (key: Platform): void => {
185
- const config = shareConfigs[key];
186
- if (!config) return;
187
- const shareUrl = buildShareUrl(config);
188
- openShareWindow(shareUrl);
189
- };
190
-
191
- // Use the provided container component or default to 'div'
192
- const Container = containerComponent || 'div';
193
- // Default button component to use if no platform-specific component is provided
194
- const DefaultButton = buttonComponent || 'button';
195
- const platformsToShow: Platform[] =
196
- platforms || (Object.keys(shareConfigs) as Platform[]);
197
-
198
- return (
199
- <Container>
200
- {platformsToShow.map(key => {
201
- // Use a specific button component if defined for the key
202
- const Button = (buttonComponents && buttonComponents[key]) || DefaultButton;
203
- const label = platformLabels[key] || key;
204
- return (
205
- <Button
206
- key={key}
207
- onClick={() => handleShare(key)}
208
- title={`Share on ${label}`}
209
- >
210
- {label}
211
- </Button>
212
- );
213
- })}
214
- </Container>
215
- );
216
- };
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
- import { componentBuilder } from "../utils/componentBuilder";
3
- import { TypographyComponentProps } from "./props/props";
4
-
5
- export const Badge: React.FC<TypographyComponentProps> = (props) =>
6
- componentBuilder(props, "span", "rounded-full w-fit")
7
- .withSizes({
8
- xs: "px-2 py-1 text-xs",
9
- sm: "px-3 py-1 text-sm",
10
- md: "px-4 py-2 text-base",
11
- lg: "px-5 py-2 text-lg",
12
- xl: "px-6 py-3 text-xl",
13
- })
14
- .withAppearance({
15
- default: "bg-gray-200",
16
- accent: "bg-gray-200",
17
- primary: "bg-blue-200",
18
- secondary: "bg-gray-200",
19
- tertiary: "bg-gray-200",
20
- success: "bg-green-200",
21
- danger: "bg-red-200",
22
- warning: "bg-yellow-200",
23
- info: "bg-blue-200"
24
- }, {})
25
- .withTypography({
26
- fontWeight: { semibold: true },
27
- fontFamily: { mono: true },
28
- textTransform: { uppercase: true },
29
- textAppearance: { secondary: true },
30
- })
31
- .build();
32
-
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import { componentBuilder } from "../utils/componentBuilder";
3
- import { TypographyComponentProps } from "./props/props";
4
-
5
- export const Button: React.FC<TypographyComponentProps> = (props) =>
6
- componentBuilder(props, "button", "w-fit h-fit cursor-pointer flex justify-center items-center border border-gray-200 transition-all duration-300")
7
- .withSizes({
8
- xs: "px-2 py-1 rounded-sm text-xs",
9
- sm: "px-3 py-1 rounded-md text-sm",
10
- md: "px-4 py-2 rounded-md text-base",
11
- lg: "px-6 py-3 rounded-lg text-lg",
12
- xl: "px-8 py-4 rounded-xl text-xl",
13
- })
14
- .withSizes({
15
- xs: "shadow-xs hover:shadow-sm",
16
- sm: "shadow-xs hover:shadow-sm",
17
- md: "shadow-sm hover:shadow-md",
18
- lg: "shadow-md hover:shadow-lg",
19
- xl: "shadow-lg hover:shadow-xl",
20
- })
21
- .withTypography({
22
- fontWeight: { semibold: true },
23
- })
24
- .build();
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- import { componentBuilder } from "./../utils/componentBuilder";
3
- import { TypographyComponentProps } from "./props/props";
4
-
5
- export const Chip: React.FC<TypographyComponentProps> = (props) =>
6
- componentBuilder(props, "span", "rounded-full w-fit h-fit border")
7
- .withSizes({
8
- xs: "px-1 py-1 rounded-sm text-xs",
9
- sm: "px-2 py-1 rounded-md text-sm",
10
- md: "px-2 py-1 rounded-lg text-base",
11
- lg: "px-3 py-2 rounded-xl text-lg",
12
- xl: "px-4 py-3 rounded-2xl text-xl",
13
- })
14
- .withAppearance({
15
- default: "bg-gray-100",
16
- accent: "bg-gray-200",
17
- primary: "bg-blue-200",
18
- secondary: "bg-gray-200",
19
- tertiary: "bg-gray-200",
20
- success: "bg-green-200",
21
- danger: "bg-red-200",
22
- warning: "bg-yellow-200",
23
- info: "bg-blue-200"
24
- }, {})
25
- .withTypography({
26
- fontFamily: { mono: true },
27
- textAppearance: { secondary: true },
28
- })
29
- .build();
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { componentBuilder } from "./../utils/componentBuilder";
3
- import { BaseComponentProps } from "./props/props";
4
-
5
- export const Divider: React.FC<BaseComponentProps> = (props) =>
6
- componentBuilder(props, "div", "bg-gray-200 w-full h-px")
7
- .build();
@@ -1,102 +0,0 @@
1
- import React from 'react';
2
- import { GridProps, LayoutComponentProps, ColProps, RowProps } from "./props/props";
3
- import { componentBuilder } from "../utils/componentBuilder";
4
-
5
- const centeredClasses = {
6
- centered: "items-center justify-center",
7
- vCentered: "items-center",
8
- hCentered: "justify-center"
9
- }
10
-
11
- export const Section: React.FC<LayoutComponentProps> = (props) =>
12
- componentBuilder(props, "section", "w-full flex flex-col items-start")
13
- .withCentered(centeredClasses)
14
- .withSizes({
15
- xs: "py-6 max-lg:py-4 max-md:py-2",
16
- sm: "py-8 max-lg:py-6 max-md:py-4",
17
- md: "py-10 max-lg:py-8 max-md:py-6",
18
- lg: "py-12 max-lg:py-10 max-md:py-8",
19
- xl: "py-14 max-lg:py-12 max-md:py-10",
20
- })
21
- .withSizes({
22
- xs: "px-4 max-lg:px-2 max-md:px-0",
23
- sm: "px-6 max-lg:px-6 max-md:px-2",
24
- md: "px-8 max-lg:px-6 max-md:px-4",
25
- lg: "px-10 max-lg:px-8 max-md:px-6",
26
- xl: "px-12 max-lg:px-10 max-md:px-8",
27
- })
28
- .build();
29
-
30
- export const Container: React.FC<LayoutComponentProps> = (props) =>
31
- componentBuilder(props, "div", "flex flex-col mx-auto w-full")
32
- .withCentered(centeredClasses)
33
- .withSizes({
34
- xs: "max-w-3xl gap-2 max-lg:gap-1",
35
- sm: "max-w-4xl gap-4 max-lg:gap-3 max-md:gap-2",
36
- md: "max-w-5xl gap-6 max-lg:gap-5 max-md:gap-4",
37
- lg: "max-w-6xl gap-8 max-lg:gap-7 max-md:gap-6",
38
- xl: "max-w-7xl gap-10 max-lg:gap-9 max-md:gap-8",
39
- })
40
- .build();
41
-
42
- const commonGaps = {
43
- xs: "gap-1",
44
- sm: "gap-2 max-lg:gap-1",
45
- md: "gap-4 max-lg:gap-3 max-md:gap-2",
46
- lg: "gap-6 max-lg:gap-5 max-md:gap-4",
47
- xl: "gap-8 max-lg:gap-7 max-md:gap-6",
48
- }
49
-
50
- export const Col: React.FC<ColProps> = (props) =>
51
- componentBuilder(props, "div", "flex flex-col")
52
- .withGaps({ noGap: "gap-0" }, commonGaps)
53
- .withReverse({
54
- reverse: "flex-col-reverse"
55
- })
56
- .withCentered(centeredClasses)
57
- .build();
58
-
59
- export const Row: React.FC<RowProps> = (props) =>
60
- componentBuilder(props, "div", "flex flex-row")
61
- .withGaps({ noGap: "gap-0" }, commonGaps)
62
- .withReverse({
63
- reverse: "flex-row-reverse"
64
- })
65
- .withCentered(centeredClasses)
66
- .withBreakpoints({
67
- xsCol: "max-xs:flex-col",
68
- smCol: "max-sm:flex-col",
69
- mdCol: "max-md:flex-col",
70
- lgCol: "max-lg:flex-col",
71
- xlCol: "max-xl:flex-col"
72
- })
73
- .withBooleanProps({
74
- justifyStart: "justify-start",
75
- justifyEnd: "justify-end",
76
- justifyCenter: "justify-center",
77
- justifyBetween: "justify-between",
78
- justifyAround: "justify-around",
79
- justifyEvenly: "justify-evenly",
80
- justifyStretch: "justify-stretch",
81
- justifyBaseline: "justify-baseline",
82
- })
83
- .build();
84
-
85
- const gridGaps = {
86
- xs: "gap-2",
87
- sm: "gap-4 max-lg:gap-2",
88
- md: "gap-6 max-lg:gap-4",
89
- lg: "gap-8 max-lg:gap-6 max-md:gap-4",
90
- xl: "gap-10 max-lg:gap-8 max-md:gap-6",
91
- }
92
-
93
- export const Grid3: React.FC<GridProps> = (props) =>
94
- componentBuilder(props, "div", "w-full grid grid-cols-3 max-lg:grid-cols-2 max-md:grid-cols-1")
95
- .withGaps({ noGap: "gap-0" }, gridGaps)
96
- .build();
97
-
98
- export const Grid4: React.FC<GridProps> = (props) =>
99
- componentBuilder(props, "div", "w-full grid grid-cols-4 max-lg:grid-cols-3 max-md:grid-cols-2 max-sm:grid-cols-1")
100
- .withGaps({ noGap: "gap-0" }, gridGaps)
101
- .build();
102
-
@@ -1,51 +0,0 @@
1
- export const fontWeightClasses = {
2
- thin: "font-thin",
3
- extralight: "font-extralight",
4
- light: "font-light",
5
- normal: "font-normal",
6
- medium: "font-medium",
7
- semibold: "font-semibold",
8
- bold: "font-bold",
9
- extrabold: "font-extrabold",
10
- black: "font-black",
11
- }
12
-
13
- export const fontStyleClasses = {
14
- italic: "italic",
15
- notItalic: "not-italic",
16
- }
17
-
18
- export const fontFamilyClasses = {
19
- sans: "font-sans",
20
- serif: "font-serif",
21
- mono: "font-mono",
22
- }
23
-
24
- export const textDecorationClasses = {
25
- underline: "underline",
26
- lineThrough: "line-through",
27
- noUnderline: "no-underline",
28
- overline: "overline",
29
- }
30
-
31
- export const textTransformClasses = {
32
- uppercase: "uppercase",
33
- lowercase: "lowercase",
34
- capitalize: "capitalize",
35
- normalCase: "normal-case",
36
- }
37
-
38
- export const textAppearanceClasses = {
39
- default: "text-(--text-color-default)",
40
- primary: "text-(--text-color-primary)",
41
- secondary: "text-(--text-color-secondary)",
42
- tertiary: "text-(--text-color-tertiary)",
43
- muted: "text-(--text-color-muted)",
44
- link: "text-(--text-color-link)",
45
-
46
- accent: "text-(--text-color-accent)",
47
- success: "text-(--text-color-success)",
48
- danger: "text-(--text-color-danger)",
49
- warning: "text-(--text-color-warning)",
50
- info: "text-(--text-color-info)",
51
- }