@youngonesworks/ui 0.1.120 → 0.1.122

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/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # @youngonesworks/ui
2
2
 
3
- A comprehensive React component library built with Tailwind CSS v4, featuring modular CSS variables, optimized fonts, and TypeScript support.
3
+ A comprehensive React component library built with Tailwind CSS v4, featuring modular CSS variables and TypeScript support.
4
4
 
5
5
  ## Features
6
6
 
7
7
  - 🧩 **React components built with TypeScript**
8
8
  - 🎨 **Styled with Tailwind CSS v4**
9
9
  - 📦 **Modular CSS exports** - Import only what you need
10
- - 🔤 **Next.js optimized fonts** - Gotham font family with automatic optimization
10
+ - 🔤 **Font-agnostic design** – Works seamlessly with app-level fonts (e.g. Work Sans via Google Fonts)
11
11
  - 🎯 **CSS Variables & Utilities** - Exportable design tokens
12
12
  - 🌳 **Tree-shakeable** - Only import what you need
13
13
  - 📝 **Full TypeScript support** - Type-safe CSS variable helpers
@@ -15,26 +15,25 @@ A comprehensive React component library built with Tailwind CSS v4, featuring mo
15
15
 
16
16
  ## Installation
17
17
 
18
- ```bash
18
+ ````bash
19
19
  # yarn
20
20
  yarn add @youngonesworks/ui
21
21
 
22
22
  # npm
23
23
  npm install @youngonesworks/ui
24
- ```
25
24
 
26
25
  ### Peer Dependencies
27
26
 
28
27
  - **react**: ^18 || ^19
29
28
  - **react-dom**: ^18 || ^19
30
- - **next**: ^14 || ^15 *(for Next.js projects)*
29
+ - **next**: ^14 || ^15 _(for Next.js projects)_
31
30
 
32
31
  ### Tailwind CSS v4 setup
33
32
 
34
33
  ```bash
35
34
  yarn add -D tailwindcss@4 postcss autoprefixer
36
35
  yarn tailwindcss init -p
37
- ```
36
+ ````
38
37
 
39
38
  Update `tailwind.config.js`:
40
39
 
@@ -42,8 +41,8 @@ Update `tailwind.config.js`:
42
41
  /** @type {import('tailwindcss').Config} */
43
42
  module.exports = {
44
43
  content: [
45
- './src/**/*.{js,jsx,ts,tsx}',
46
- './node_modules/@youngonesworks/ui/**/*.{js,jsx,ts,tsx}',
44
+ "./src/**/*.{js,jsx,ts,tsx}",
45
+ "./node_modules/@youngonesworks/ui/**/*.{js,jsx,ts,tsx}",
47
46
  ],
48
47
  theme: { extend: {} },
49
48
  plugins: [],
@@ -55,14 +54,18 @@ module.exports = {
55
54
  ### 🧩 React Components
56
55
 
57
56
  ```tsx
58
- import { Button } from '@youngonesworks/ui';
57
+ import { Button } from "@youngonesworks/ui";
59
58
 
60
59
  function App() {
61
60
  return (
62
61
  <>
63
62
  <Button>Default</Button>
64
- <Button variant="secondary" size="sm">Small Secondary</Button>
65
- <Button variant="outline" size="lg">Large Outline</Button>
63
+ <Button variant="secondary" size="sm">
64
+ Small Secondary
65
+ </Button>
66
+ <Button variant="outline" size="lg">
67
+ Large Outline
68
+ </Button>
66
69
  </>
67
70
  );
68
71
  }
@@ -74,13 +77,13 @@ function App() {
74
77
 
75
78
  ```css
76
79
  /* Import in your CSS file */
77
- @import '@youngonesworks/ui/styles/variables.css';
78
- @import '@youngonesworks/ui/styles/utilities.css';
80
+ @import "@youngonesworks/ui/styles/variables.css";
81
+ @import "@youngonesworks/ui/styles/utilities.css";
79
82
 
80
83
  .my-component {
81
- color: var(--color-primary); /* #10d1bb */
82
- font-family: var(--font-family-sans); /* Gotham font */
83
- font-size: var(--font-lg-size); /* 1.125rem */
84
+ color: var(--color-primary); /* #10d1bb */
85
+ font-family: var(--font-family-sans); /* App-defined sans font */
86
+ font-size: var(--font-lg-size); /* 1.125rem */
84
87
  transition: var(--transition-duration-sidebar);
85
88
  }
86
89
  ```
@@ -88,26 +91,30 @@ function App() {
88
91
  #### TypeScript CSS Variable Helpers
89
92
 
90
93
  ```tsx
91
- import { getCSSVariable, setCSSVariable, type CSSVariables } from '@youngonesworks/ui/theme';
94
+ import {
95
+ getCSSVariable,
96
+ setCSSVariable,
97
+ type CSSVariables,
98
+ } from "@youngonesworks/ui/theme";
92
99
 
93
100
  // Get CSS variable values
94
- const primaryColor = getCSSVariable('--color-primary');
95
- const fontSize = getCSSVariable('--font-lg-size');
101
+ const primaryColor = getCSSVariable("--color-primary");
102
+ const fontSize = getCSSVariable("--font-lg-size");
96
103
 
97
104
  // Set CSS variables dynamically
98
- setCSSVariable('--color-primary', '#ff6b35');
99
- setCSSVariable('--font-lg-size', '1.25rem');
105
+ setCSSVariable("--color-primary", "#ff6b35");
106
+ setCSSVariable("--font-lg-size", "1.25rem");
100
107
 
101
108
  // Type-safe variable names
102
109
  const variables: CSSVariables = {
103
110
  colors: {
104
- primary: '#10d1bb',
105
- secondary: '#6366f1'
111
+ primary: "#10d1bb",
112
+ secondary: "#6366f1",
106
113
  },
107
114
  typography: {
108
- fontLgSize: '1.125rem',
109
- fontBaseLine: '1.5rem'
110
- }
115
+ fontLgSize: "1.125rem",
116
+ fontBaseLine: "1.5rem",
117
+ },
111
118
  };
112
119
  ```
113
120
 
@@ -117,15 +124,20 @@ const variables: CSSVariables = {
117
124
 
118
125
  ```tsx
119
126
  // app/layout.tsx
120
- import { gothamFont } from '@youngonesworks/ui/theme/fonts';
121
- import '@youngonesworks/ui/styles/variables.css';
127
+ // app/layout.tsx
128
+ import { Work_Sans } from "next/font/google";
129
+ import "@youngonesworks/ui/styles/variables.css";
130
+
131
+ const workSans = Work_Sans({
132
+ subsets: ["latin"],
133
+ weight: ["300", "400", "500", "600", "700", "900"],
134
+ variable: "--font-family-sans",
135
+ });
122
136
 
123
137
  export default function RootLayout({ children }) {
124
138
  return (
125
- <html lang="en" className={gothamFont.variable}>
126
- <body className={gothamFont.className}>
127
- {children}
128
- </body>
139
+ <html lang="en" className={workSans.variable}>
140
+ <body>{children}</body>
129
141
  </html>
130
142
  );
131
143
  }
@@ -134,22 +146,21 @@ export default function RootLayout({ children }) {
134
146
  #### Use Font Utilities
135
147
 
136
148
  ```tsx
137
- import { FONT_FAMILIES, FONT_CLASS_NAMES, FONT_WEIGHTS } from '@youngonesworks/ui/theme/fonts';
149
+ // app/layout.tsx
150
+ import { Work_Sans } from "next/font/google";
151
+ import "@youngonesworks/ui/styles/variables.css";
152
+
153
+ const workSans = Work_Sans({
154
+ subsets: ["latin"],
155
+ weight: ["300", "400", "500", "600", "700", "900"],
156
+ variable: "--font-family-sans",
157
+ });
138
158
 
139
- function MyComponent() {
159
+ export default function RootLayout({ children }) {
140
160
  return (
141
- <div>
142
- {/* Using CSS class */}
143
- <h1 className={FONT_CLASS_NAMES.gotham}>Optimized Gotham</h1>
144
-
145
- {/* Using inline styles */}
146
- <p style={{
147
- fontFamily: FONT_FAMILIES.gotham,
148
- fontWeight: FONT_WEIGHTS.medium
149
- }}>
150
- Custom styled text
151
- </p>
152
- </div>
161
+ <html lang="en" className={workSans.variable}>
162
+ <body>{children}</body>
163
+ </html>
153
164
  );
154
165
  }
155
166
  ```
@@ -158,13 +169,10 @@ function MyComponent() {
158
169
 
159
170
  ```tsx
160
171
  // Components
161
- import { Button, Card, Input } from '@youngonesworks/ui';
172
+ import { Button, Card, Input } from "@youngonesworks/ui";
162
173
 
163
174
  // CSS Variables (TypeScript helpers)
164
- import { getCSSVariable, setCSSVariable } from '@youngonesworks/ui/theme';
165
-
166
- // Font utilities
167
- import { gothamFont, FONT_FAMILIES } from '@youngonesworks/ui/theme/fonts';
175
+ import { getCSSVariable, setCSSVariable } from "@youngonesworks/ui/theme";
168
176
 
169
177
  // CSS files (import in CSS/SCSS)
170
178
  // @import '@youngonesworks/ui/styles/variables.css';
@@ -174,21 +182,25 @@ import { gothamFont, FONT_FAMILIES } from '@youngonesworks/ui/theme/fonts';
174
182
  ## 📊 Available CSS Variables
175
183
 
176
184
  ### Colors
185
+
177
186
  - `--color-primary` - Primary brand color (#10d1bb)
178
- - `--color-secondary` - Secondary brand color
187
+ - `--color-secondary` - Secondary brand color
179
188
  - `--color-background` - Background colors
180
189
  - `--color-foreground` - Text colors
181
190
 
182
191
  ### Typography
183
- - `--font-family-sans` - Gotham font stack
192
+
193
+ - `--font-family-sans` - Application-defined sans font stack (e.g. Work Sans)
184
194
  - `--font-xs-size` to `--font-9xl-size` - Font sizes (0.75rem - 8rem)
185
195
  - `--font-xs-line` to `--font-9xl-line` - Line heights
186
196
 
187
197
  ### Spacing & Sizing
198
+
188
199
  - `--spacing-*` - Consistent spacing scale
189
200
  - `--sizing-*` - Width/height utilities
190
201
 
191
202
  ### Transitions & Animations
203
+
192
204
  - `--transition-duration-*` - Duration presets
193
205
  - Custom animation utilities (`.animate-spin-slow`, etc.)
194
206
 
@@ -198,9 +210,9 @@ import { gothamFont, FONT_FAMILIES } from '@youngonesworks/ui/theme/fonts';
198
210
 
199
211
  ```tsx
200
212
  <Button
201
- variant="primary" // 'primary' | 'secondary' | 'outline'
202
- size="md" // 'sm' | 'md' | 'lg'
203
- onClick={() => console.log('clicked')}
213
+ variant="primary" // 'primary' | 'secondary' | 'outline'
214
+ size="md" // 'sm' | 'md' | 'lg'
215
+ onClick={() => console.log("clicked")}
204
216
  >
205
217
  Click me
206
218
  </Button>
@@ -267,6 +279,7 @@ Contributions are welcome! Please follow these guidelines:
267
279
  ### CSS Variables
268
280
 
269
281
  When adding new CSS variables:
282
+
270
283
  1. Add them to `src/styles/variables.css`
271
284
  2. Update TypeScript interfaces in `src/theme/variables.ts`
272
285
  3. Document them in this README
@@ -7,4 +7,5 @@ export declare const buttonVariants: {
7
7
  readonly search: string;
8
8
  readonly icon__primary: string;
9
9
  readonly icon__danger: string;
10
+ readonly action: string;
10
11
  };
package/dist/globals.css CHANGED
@@ -2,10 +2,10 @@
2
2
  * Global CSS Styles
3
3
  * Main stylesheet for the YoungOnes B2B Dashboard
4
4
  */
5
+ @import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400;500;600;700;900&display=swap");
5
6
 
6
7
  @import "tailwindcss";
7
8
 
8
- @import "./styles/fonts.css";
9
9
  @import "./styles/variables.css";
10
10
  @import "./styles/utilities.css";
11
11
  @import "react-phone-input-2/lib/style.css";
@@ -19,5 +19,3 @@
19
19
  transform: rotate(360deg);
20
20
  }
21
21
  }
22
-
23
-
package/dist/index.cjs CHANGED
@@ -765,7 +765,7 @@ const AvatarIndicator = ({ indicatorCount, className,...props }) => /* @__PURE__
765
765
  "data-testid": "AvatarIndicator",
766
766
  ...props,
767
767
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
768
- className: "font-['Gotham'] text-[10px] leading-[10px] text-black",
768
+ className: "font-[var(--font-family-sans)] text-[10px] leading-[10px] text-black",
769
769
  children: `+${indicatorCount}`
770
770
  })
771
771
  });
@@ -842,7 +842,8 @@ const buttonVariants = {
842
842
  outline: (0, clsx.default)(defaultButtonStyling, "border-solid border-gray-200 bg-transparent text-white hover:border-gray-800 hover:bg-[rgba(255,255,255,0.1)] disabled:text-gray-800 disabled:hover:border-gray-200 disabled:hover:bg-white"),
843
843
  search: (0, clsx.default)(defaultButtonStyling, "absolute top-0 right-0 h-full w-[50px] border-0 bg-transparent bg-no-repeat"),
844
844
  icon__primary: (0, clsx.default)(defaultButtonStyling, "flex! items-center justify-center"),
845
- icon__danger: (0, clsx.default)(defaultButtonStyling, "flex! items-center justify-center")
845
+ icon__danger: (0, clsx.default)(defaultButtonStyling, "flex! items-center justify-center"),
846
+ action: (0, clsx.default)(defaultButtonStyling, "w-full bg-transparent border border-gray-200 whitespace-nowrap", "lg:w-[36px] lg:h-[36px]", "lg:p-0 lg:gap-0", "lg:hover:bg-transparent lg:hover:border-black", "lg:[&_svg]:-ml-2 lg:[&_svg]:-mr-2")
846
847
  };
847
848
 
848
849
  //#endregion
@@ -2684,7 +2685,7 @@ const NumberedStepper = ({ steps, active, className, stepsCompleted, completedLa
2684
2685
  className: "flex size-12 flex-auto items-center justify-center whitespace-nowrap",
2685
2686
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2686
2687
  "data-testid": `stepper-number-${index}`,
2687
- className: `grid size-12 place-content-center rounded-full leading-[36px]! md:leading-[40px]! ${index === 0 && active === 1 ? "bg-light-blue text-white" : "bg-transparent!"} ${index <= active ? "border-light-blue text-light-blue border" : "border border-gray-500 text-gray-500"} align-middle font-["Gotham"] font-bold md:text-2xl`,
2688
+ className: `grid size-12 place-content-center rounded-full leading-[36px]! md:leading-[40px]! ${index === 0 && active === 1 ? "bg-light-blue text-white" : "bg-transparent!"} ${index <= active ? "border-light-blue text-light-blue border" : "border border-gray-500 text-gray-500"} align-middle font-sans font-bold md:text-2xl`,
2688
2689
  children: index + 1
2689
2690
  })
2690
2691
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -3530,7 +3531,12 @@ const WysiwygEditor = (0, react.forwardRef)(({ id, content, className, placehold
3530
3531
  immediatelyRender: false,
3531
3532
  editable: !readOnly,
3532
3533
  onUpdate({ editor: editor$1 }) {
3533
- onChange && onChange(editor$1.getHTML().replaceAll(/<li><p>(.*?)<\/p><(\/?)(ol|li|ul)>/gi, "<li>$1<$2$3>").replaceAll("<p></p>", ""));
3534
+ let sanitizedOutput = editor$1.getHTML().replaceAll(/<li><p>(.*?)<\/p><(\/?)(ol|li|ul)>/gi, "<li>$1<$2$3>");
3535
+ sanitizedOutput = sanitizedOutput.replace(/(<p><\/p>\s*)+/gi, "<p></p>");
3536
+ sanitizedOutput = sanitizedOutput.replace(/^(<p><\/p>\s*)+/gi, "");
3537
+ sanitizedOutput = sanitizedOutput.replace(/(<p><\/p>\s*)+$/gi, "");
3538
+ sanitizedOutput = sanitizedOutput.replace(/<p><\/p>/gi, "<br>");
3539
+ onChange && onChange(sanitizedOutput);
3534
3540
  }
3535
3541
  });
3536
3542
  (0, react.useEffect)(() => {