@youngonesworks/ui 0.1.52 → 0.1.54

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.
@@ -2,13 +2,14 @@ import React from 'react';
2
2
  export declare const PasswordInput: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & {
3
3
  rightSection?: React.ReactNode;
4
4
  leftSection?: React.ReactNode;
5
- label?: React.ReactNode;
5
+ label?: React.ReactNode | string;
6
6
  className?: string;
7
7
  min?: string | undefined | number;
8
8
  max?: string | undefined | number;
9
9
  error?: string;
10
10
  showRightSection?: boolean;
11
11
  step?: string;
12
+ loadingState?: boolean;
12
13
  autoFocus?: boolean;
13
14
  wrapperClassName?: string;
14
15
  maxLength?: undefined | number;
@@ -6,3 +6,8 @@ type Story = StoryObj<typeof TextInput>;
6
6
  export declare const Default: Story;
7
7
  export declare const WithIcon: Story;
8
8
  export declare const Password: Story;
9
+ export declare const LeftSection: Story;
10
+ export declare const ErrorState: Story;
11
+ export declare const NumberWithMinMax: Story;
12
+ export declare const PasswordAutofill: Story;
13
+ export declare const LoadingState: Story;
@@ -3,13 +3,14 @@ import { type ChangeEvent, type FocusEvent, type InputHTMLAttributes, type Keybo
3
3
  export type TextInputProps = InputHTMLAttributes<HTMLInputElement> & {
4
4
  rightSection?: React.ReactNode;
5
5
  leftSection?: React.ReactNode;
6
- label?: React.ReactNode;
6
+ label?: React.ReactNode | string;
7
7
  className?: string;
8
8
  min?: string | undefined | number;
9
9
  max?: string | undefined | number;
10
10
  error?: string;
11
11
  showRightSection?: boolean;
12
12
  step?: string;
13
+ loadingState?: boolean;
13
14
  autoFocus?: boolean;
14
15
  wrapperClassName?: string;
15
16
  maxLength?: undefined | number;
@@ -23,13 +24,14 @@ export type TextInputProps = InputHTMLAttributes<HTMLInputElement> & {
23
24
  export declare const TextInput: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & {
24
25
  rightSection?: React.ReactNode;
25
26
  leftSection?: React.ReactNode;
26
- label?: React.ReactNode;
27
+ label?: React.ReactNode | string;
27
28
  className?: string;
28
29
  min?: string | undefined | number;
29
30
  max?: string | undefined | number;
30
31
  error?: string;
31
32
  showRightSection?: boolean;
32
33
  step?: string;
34
+ loadingState?: boolean;
33
35
  autoFocus?: boolean;
34
36
  wrapperClassName?: string;
35
37
  maxLength?: undefined | number;
package/dist/index.cjs CHANGED
@@ -103141,20 +103141,107 @@ const AppleAppButtonIcon = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs
103141
103141
  }) })]
103142
103142
  });
103143
103143
 
103144
+ //#endregion
103145
+ //#region src/icons/IconLoading.tsx
103146
+ const IconLoading = ({ className,...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
103147
+ "data-component": "button",
103148
+ "data-testid": "loading-svg-button",
103149
+ viewBox: "0 0 256 256",
103150
+ width: "1em",
103151
+ height: "1em",
103152
+ className,
103153
+ stroke: "currentColor",
103154
+ ...props,
103155
+ children: [
103156
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103157
+ x1: "128",
103158
+ y1: "32",
103159
+ x2: "128",
103160
+ y2: "64",
103161
+ strokeLinecap: "round",
103162
+ strokeLinejoin: "round",
103163
+ strokeWidth: "24"
103164
+ }),
103165
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103166
+ x1: "195.9",
103167
+ y1: "60.1",
103168
+ x2: "173.3",
103169
+ y2: "82.7",
103170
+ strokeLinecap: "round",
103171
+ strokeLinejoin: "round",
103172
+ strokeWidth: "24"
103173
+ }),
103174
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103175
+ x1: "224",
103176
+ y1: "128",
103177
+ x2: "192",
103178
+ y2: "128",
103179
+ strokeLinecap: "round",
103180
+ strokeLinejoin: "round",
103181
+ strokeWidth: "24"
103182
+ }),
103183
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103184
+ x1: "195.9",
103185
+ y1: "195.9",
103186
+ x2: "173.3",
103187
+ y2: "173.3",
103188
+ strokeLinecap: "round",
103189
+ strokeLinejoin: "round",
103190
+ strokeWidth: "24"
103191
+ }),
103192
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103193
+ x1: "128",
103194
+ y1: "224",
103195
+ x2: "128",
103196
+ y2: "192",
103197
+ strokeLinecap: "round",
103198
+ strokeLinejoin: "round",
103199
+ strokeWidth: "24"
103200
+ }),
103201
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103202
+ x1: "60.1",
103203
+ y1: "195.9",
103204
+ x2: "82.7",
103205
+ y2: "173.3",
103206
+ strokeLinecap: "round",
103207
+ strokeLinejoin: "round",
103208
+ strokeWidth: "24"
103209
+ }),
103210
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103211
+ x1: "32",
103212
+ y1: "128",
103213
+ x2: "64",
103214
+ y2: "128",
103215
+ strokeLinecap: "round",
103216
+ strokeLinejoin: "round",
103217
+ strokeWidth: "24"
103218
+ }),
103219
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103220
+ x1: "60.1",
103221
+ y1: "60.1",
103222
+ x2: "82.7",
103223
+ y2: "82.7",
103224
+ strokeLinecap: "round",
103225
+ strokeLinejoin: "round",
103226
+ strokeWidth: "24"
103227
+ })
103228
+ ]
103229
+ });
103230
+
103144
103231
  //#endregion
103145
103232
  //#region src/components/textInput/index.tsx
103146
- const TextInput = react.default.forwardRef(({ rightSection, leftSection, className, error: error$1, autoFocus, label, maxLength, enablePasswordManagerAutofill = false, onBlur, disabled, onKeyDown, min: min$2 = "0", max: max$2, autoComplete, showRightSection = true, step, wrapperClassName, password = false,...props }, ref) => {
103233
+ const TextInput = react.default.forwardRef(({ rightSection, leftSection, className, error: error$1, autoFocus, label, maxLength, enablePasswordManagerAutofill = false, onBlur, disabled, loadingState, onKeyDown, min: min$2 = "0", max: max$2, autoComplete, showRightSection = true, step, wrapperClassName, password = false,...props }, ref) => {
103147
103234
  const [showPassword, setShowPassword] = react.default.useState(false);
103148
103235
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
103149
103236
  "data-component": "TextInput",
103150
103237
  "data-testid": "TextInput",
103151
103238
  className: clsx_default("relative", wrapperClassName),
103152
103239
  children: [
103153
- label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
103240
+ typeof label === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
103154
103241
  htmlFor: props.id,
103155
103242
  className: "mb-2 flex items-center gap-1 text-xs font-medium text-black",
103156
103243
  children: label
103157
- }),
103244
+ }) : label,
103158
103245
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
103159
103246
  className: "relative",
103160
103247
  children: [
@@ -103172,15 +103259,22 @@ const TextInput = react.default.forwardRef(({ rightSection, leftSection, classNa
103172
103259
  disabled,
103173
103260
  step,
103174
103261
  maxLength,
103175
- className: clsx_default(`${disabled ? "text-gray-500" : "text-gray-900"} selection:bg-turquoise-200 focus:border-turquoise-500 focus:ring-turquoise-500 active:border-turquoise-500 active:ring-turquoise-500 h-10 w-full rounded-[4px] border border-gray-200 bg-gray-50 px-3 text-sm font-normal outline-hidden ${rightSection && "pr-12"} ${leftSection && "pl-12"} ${error$1 && "border-red-500 text-red-500 selection:bg-red-200 focus:border-red-500 focus:ring-red-500 focus:placeholder:text-red-500 active:border-red-500 active:ring-red-500"}`, className),
103262
+ className: clsx_default(`${loadingState ? "cursor-not-allowed" : ""}`, `${disabled ? "text-gray-500" : "text-gray-900"} selection:bg-turquoise-200 focus:border-turquoise-500 focus:ring-turquoise-500 active:border-turquoise-500 active:ring-turquoise-500 h-10 w-full rounded-[4px] border border-gray-200 bg-gray-50 px-3 text-sm font-normal outline-hidden ${rightSection && "pr-12"} ${leftSection && "pl-12"} ${error$1 && "border-red-500 text-red-500 selection:bg-red-200 focus:border-red-500 focus:ring-red-500 focus:placeholder:text-red-500 active:border-red-500 active:ring-red-500"}`, className),
103263
+ "aria-busy": loadingState || undefined,
103176
103264
  "data-lpignore": enablePasswordManagerAutofill ? undefined : "true",
103177
103265
  "data-1p-ignore": enablePasswordManagerAutofill ? undefined : "true",
103178
103266
  ref,
103179
103267
  ...props,
103180
103268
  type: password ? showPassword ? "text" : "password" : "text"
103181
103269
  }),
103182
- rightSection && showRightSection && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
103183
- className: "absolute inset-y-0 right-0 flex w-12 content-center items-center justify-center align-middle text-sm font-medium text-black",
103270
+ loadingState ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
103271
+ className: "absolute inset-y-0 right-0 flex h-10 w-12 content-center items-center justify-center align-middle text-sm font-medium text-black",
103272
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconLoading, {
103273
+ className: "h-4 w-4 animate-spin text-gray-500",
103274
+ "aria-label": "Loading"
103275
+ })
103276
+ }) : rightSection && showRightSection && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
103277
+ className: "absolute inset-y-0 right-0 flex h-10 w-12 content-center items-center justify-center align-middle text-sm font-medium text-black",
103184
103278
  children: rightSection
103185
103279
  }),
103186
103280
  password && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -103343,92 +103437,6 @@ const BreadCrumb = ({ children, LinkText }) => /* @__PURE__ */ (0, react_jsx_run
103343
103437
  });
103344
103438
  BreadCrumb.displayName = "BreadCrumb";
103345
103439
 
103346
- //#endregion
103347
- //#region src/icons/IconLoading.tsx
103348
- const IconLoading = ({ className,...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
103349
- "data-component": "button",
103350
- "data-testid": "loading-svg-button",
103351
- viewBox: "0 0 256 256",
103352
- width: "1em",
103353
- height: "1em",
103354
- className,
103355
- ...props,
103356
- children: [
103357
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103358
- x1: "128",
103359
- y1: "32",
103360
- x2: "128",
103361
- y2: "64",
103362
- strokeLinecap: "round",
103363
- strokeLinejoin: "round",
103364
- strokeWidth: "24"
103365
- }),
103366
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103367
- x1: "195.9",
103368
- y1: "60.1",
103369
- x2: "173.3",
103370
- y2: "82.7",
103371
- strokeLinecap: "round",
103372
- strokeLinejoin: "round",
103373
- strokeWidth: "24"
103374
- }),
103375
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103376
- x1: "224",
103377
- y1: "128",
103378
- x2: "192",
103379
- y2: "128",
103380
- strokeLinecap: "round",
103381
- strokeLinejoin: "round",
103382
- strokeWidth: "24"
103383
- }),
103384
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103385
- x1: "195.9",
103386
- y1: "195.9",
103387
- x2: "173.3",
103388
- y2: "173.3",
103389
- strokeLinecap: "round",
103390
- strokeLinejoin: "round",
103391
- strokeWidth: "24"
103392
- }),
103393
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103394
- x1: "128",
103395
- y1: "224",
103396
- x2: "128",
103397
- y2: "192",
103398
- strokeLinecap: "round",
103399
- strokeLinejoin: "round",
103400
- strokeWidth: "24"
103401
- }),
103402
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103403
- x1: "60.1",
103404
- y1: "195.9",
103405
- x2: "82.7",
103406
- y2: "173.3",
103407
- strokeLinecap: "round",
103408
- strokeLinejoin: "round",
103409
- strokeWidth: "24"
103410
- }),
103411
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103412
- x1: "32",
103413
- y1: "128",
103414
- x2: "64",
103415
- y2: "128",
103416
- strokeLinecap: "round",
103417
- strokeLinejoin: "round",
103418
- strokeWidth: "24"
103419
- }),
103420
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103421
- x1: "60.1",
103422
- y1: "60.1",
103423
- x2: "82.7",
103424
- y2: "82.7",
103425
- strokeLinecap: "round",
103426
- strokeLinejoin: "round",
103427
- strokeWidth: "24"
103428
- })
103429
- ]
103430
- });
103431
-
103432
103440
  //#endregion
103433
103441
  //#region src/components/button/buttonVariants.ts
103434
103442
  const defaultButtonStyling = "justify-center group relative flex items-center gap-2 cursor-pointer border rounded py-2 px-5 text-sx md:text-sm md:font-medium font-medium hover:outline-hidden focus:outline-hidden disabled:cursor-not-allowed transition-colors duration-100 ease-in-out";