@net-advantage/jo-ui-button 0.1.0
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 +61 -0
- package/dist/Button.d.ts +3 -0
- package/dist/button.model.d.ts +3 -0
- package/dist/button.types.d.ts +25 -0
- package/dist/button.view-model.d.ts +2 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +272 -0
- package/dist/jo-ui-button.css +2 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @net-advantage/jo-ui-button
|
|
2
|
+
|
|
3
|
+
Publishable single-button primitive package.
|
|
4
|
+
|
|
5
|
+
The button follows a strict MVVM split. The model normalizes variant and size. The view-model owns the click guard. The view renders the view-model.
|
|
6
|
+
|
|
7
|
+
## MVVM
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
flowchart LR
|
|
11
|
+
Props["ButtonProps"] --> ViewModel["useButtonViewModel"]
|
|
12
|
+
Model["button.model.ts<br/>normalize variant and size"] --> ViewModel
|
|
13
|
+
ViewModel --> View["Button.tsx"]
|
|
14
|
+
View -->|"onClick"| ViewModel
|
|
15
|
+
ViewModel -->|"onClick"| Host["Host application"]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
| Layer | File | Responsibility |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| Contract | [button.types.ts](src/button.types.ts) | Props, variant, size, and view-model |
|
|
21
|
+
| Model | [button.model.ts](src/button.model.ts) | Default missing variant to secondary and size to md |
|
|
22
|
+
| View-model | [button.view-model.ts](src/button.view-model.ts) | Map props into render-ready state and guard clicks |
|
|
23
|
+
| View | [Button.tsx](src/Button.tsx) | Render the button from the view-model |
|
|
24
|
+
|
|
25
|
+
## Models
|
|
26
|
+
|
|
27
|
+
```mermaid
|
|
28
|
+
flowchart TD
|
|
29
|
+
Props["ButtonProps"] --> Variant["ButtonVariant"]
|
|
30
|
+
Props --> Size["ButtonSize"]
|
|
31
|
+
Variant --> ViewModel["ButtonViewModel"]
|
|
32
|
+
Size --> ViewModel
|
|
33
|
+
Props --> ViewModel
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- `ButtonVariant` is `primary`, `secondary`, `ghost`, `primary-modal`, `text-muted`, or `destructive`. A missing variant becomes `secondary`.
|
|
37
|
+
- `ButtonSize` is `sm`, `md`, or `lg`. A missing size becomes `md`.
|
|
38
|
+
- `loading` disables the button and shows the loading mark. A disabled or loading button does not call `onClick`.
|
|
39
|
+
|
|
40
|
+
## Variants
|
|
41
|
+
|
|
42
|
+
- `primary`
|
|
43
|
+
- `secondary`
|
|
44
|
+
- `ghost`
|
|
45
|
+
- `primary-modal` (matches New Journey Type "Next" styling)
|
|
46
|
+
- `text-muted` (matches New Journey Type "Cancel" styling)
|
|
47
|
+
- `destructive` (reddish emphasis action)
|
|
48
|
+
|
|
49
|
+
## Structure
|
|
50
|
+
|
|
51
|
+
- src: runtime component, model, view-model, and types.
|
|
52
|
+
- stories: Storybook stories for documentation and visual testing.
|
|
53
|
+
|
|
54
|
+
## Publish footprint
|
|
55
|
+
|
|
56
|
+
This package publishes only:
|
|
57
|
+
|
|
58
|
+
- dist
|
|
59
|
+
- README.md
|
|
60
|
+
|
|
61
|
+
Stories and tests are excluded from the published artifact by design.
|
package/dist/Button.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'primary-modal' | 'text-muted' | 'destructive';
|
|
3
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export interface ButtonProps {
|
|
5
|
+
readonly children: ReactNode;
|
|
6
|
+
readonly variant?: ButtonVariant;
|
|
7
|
+
readonly size?: ButtonSize;
|
|
8
|
+
readonly disabled?: boolean;
|
|
9
|
+
readonly loading?: boolean;
|
|
10
|
+
readonly leadingIcon?: ReactNode;
|
|
11
|
+
readonly trailingIcon?: ReactNode;
|
|
12
|
+
readonly className?: string;
|
|
13
|
+
readonly buttonProps?: Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'onClick' | 'disabled' | 'children' | 'className'>;
|
|
14
|
+
readonly onClick?: () => void;
|
|
15
|
+
}
|
|
16
|
+
export interface ButtonViewModel {
|
|
17
|
+
readonly className: string;
|
|
18
|
+
readonly disabled: boolean;
|
|
19
|
+
readonly loading: boolean;
|
|
20
|
+
readonly leadingIcon?: ReactNode;
|
|
21
|
+
readonly trailingIcon?: ReactNode;
|
|
22
|
+
readonly children?: ReactNode;
|
|
23
|
+
readonly buttonProps?: ButtonProps['buttonProps'];
|
|
24
|
+
readonly onClick: () => void;
|
|
25
|
+
}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);let t=require("react");function n(e){return e??`secondary`}function r(e){return e??`md`}function i(e){let i=n(e.variant),a=r(e.size),o=e.disabled??!1,s=e.loading??!1,c=(0,t.useCallback)(()=>{e.onClick?.()},[e.onClick]);return(0,t.useMemo)(()=>({className:[`jo-ui-button`,`jo-ui-button--${i}`,`jo-ui-button--${a}`,s?`jo-ui-button--loading`:``,e.className??``].filter(Boolean).join(` `),disabled:o,loading:s,leadingIcon:e.leadingIcon,trailingIcon:e.trailingIcon,children:e.children,buttonProps:e.buttonProps,onClick:c}),[o,s,c,e.buttonProps,e.children,e.className,e.leadingIcon,e.trailingIcon,a,i])}var a=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),o=e((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===k?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`;case O:return`ViewTransition`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=A.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(j.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){P||(P=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function l(){var e=t(this.type);return F[e]||(F[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,"ref",{enumerable:!1,value:null}):Object.defineProperty(e,"ref",{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0){if(o){if(M(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`)}else f(p)}if(j.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,R[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
5
|
+
let props = %s;
|
|
6
|
+
<%s key={someKey} {...props} />`,o,p,m,p),R[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.view_transition`),k=Symbol.for(`react.client.reference`),A=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=Object.prototype.hasOwnProperty,M=Array.isArray,N=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var P,F={},I=m.react_stack_bottom_frame.bind(m,o)(),L=N(i(o)),R={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;if(r){var a=Error.stackTraceLimit;Error.stackTraceLimit=10;var o=Error(`react-stack-top-frame`);Error.stackTraceLimit=a}else o=I;return d(e,t,n,!1,o,r?N(i(e)):L)},e.jsxs=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;if(r){var a=Error.stackTraceLimit;Error.stackTraceLimit=10;var o=Error(`react-stack-top-frame`);Error.stackTraceLimit=a}else o=I;return d(e,t,n,!0,o,r?N(i(e)):L)}})()})),s=e(((e,t)=>{t.exports=process.env.NODE_ENV===`production`?a():o()}))();function c(e){let t=i(e);return(0,s.jsxs)(`button`,{...t.buttonProps,type:`button`,className:t.className,disabled:t.disabled,onClick:t.onClick,children:[t.leadingIcon?(0,s.jsx)(`span`,{className:`jo-ui-button__icon`,children:t.leadingIcon}):null,(0,s.jsx)(`span`,{className:`jo-ui-button__label`,children:t.children}),t.trailingIcon?(0,s.jsx)(`span`,{className:`jo-ui-button__icon`,children:t.trailingIcon}):null,t.loading?(0,s.jsx)(`span`,{className:`jo-ui-button__spinner`,"aria-hidden":`true`}):null]})}exports.Button=c;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { useCallback as e, useMemo as t } from "react";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var n = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), r = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
4
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
5
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
6
|
+
});
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/button.model.ts
|
|
9
|
+
function i(e) {
|
|
10
|
+
return e ?? "secondary";
|
|
11
|
+
}
|
|
12
|
+
function a(e) {
|
|
13
|
+
return e ?? "md";
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/button.view-model.ts
|
|
17
|
+
function o(n) {
|
|
18
|
+
let r = i(n.variant), o = a(n.size), s = n.disabled ?? !1, c = n.loading ?? !1, l = e(() => {
|
|
19
|
+
n.onClick?.();
|
|
20
|
+
}, [n.onClick]);
|
|
21
|
+
return t(() => ({
|
|
22
|
+
className: [
|
|
23
|
+
"jo-ui-button",
|
|
24
|
+
`jo-ui-button--${r}`,
|
|
25
|
+
`jo-ui-button--${o}`,
|
|
26
|
+
c ? "jo-ui-button--loading" : "",
|
|
27
|
+
n.className ?? ""
|
|
28
|
+
].filter(Boolean).join(" "),
|
|
29
|
+
disabled: s,
|
|
30
|
+
loading: c,
|
|
31
|
+
leadingIcon: n.leadingIcon,
|
|
32
|
+
trailingIcon: n.trailingIcon,
|
|
33
|
+
children: n.children,
|
|
34
|
+
buttonProps: n.buttonProps,
|
|
35
|
+
onClick: l
|
|
36
|
+
}), [
|
|
37
|
+
s,
|
|
38
|
+
c,
|
|
39
|
+
l,
|
|
40
|
+
n.buttonProps,
|
|
41
|
+
n.children,
|
|
42
|
+
n.className,
|
|
43
|
+
n.leadingIcon,
|
|
44
|
+
n.trailingIcon,
|
|
45
|
+
o,
|
|
46
|
+
r
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region ../../node_modules/.pnpm/react@19.3.0/node_modules/react/cjs/react-jsx-runtime.production.js
|
|
51
|
+
var s = /* @__PURE__ */ n(((e) => {
|
|
52
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
53
|
+
function r(e, n, r) {
|
|
54
|
+
var i = null;
|
|
55
|
+
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
56
|
+
else r = n;
|
|
57
|
+
return n = r.ref, {
|
|
58
|
+
$$typeof: t,
|
|
59
|
+
type: e,
|
|
60
|
+
key: i,
|
|
61
|
+
ref: n === void 0 ? null : n,
|
|
62
|
+
props: r
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
66
|
+
})), c = /* @__PURE__ */ n(((e) => {
|
|
67
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
68
|
+
function t(e) {
|
|
69
|
+
if (e == null) return null;
|
|
70
|
+
if (typeof e == "function") return e.$$typeof === A ? null : e.displayName || e.name || null;
|
|
71
|
+
if (typeof e == "string") return e;
|
|
72
|
+
switch (e) {
|
|
73
|
+
case v: return "Fragment";
|
|
74
|
+
case b: return "Profiler";
|
|
75
|
+
case y: return "StrictMode";
|
|
76
|
+
case w: return "Suspense";
|
|
77
|
+
case T: return "SuspenseList";
|
|
78
|
+
case O: return "Activity";
|
|
79
|
+
case k: return "ViewTransition";
|
|
80
|
+
}
|
|
81
|
+
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
82
|
+
case _: return "Portal";
|
|
83
|
+
case S: return e.displayName || "Context";
|
|
84
|
+
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
85
|
+
case C:
|
|
86
|
+
var n = e.render;
|
|
87
|
+
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
88
|
+
case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
89
|
+
case D:
|
|
90
|
+
n = e._payload, e = e._init;
|
|
91
|
+
try {
|
|
92
|
+
return t(e(n));
|
|
93
|
+
} catch {}
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
function n(e) {
|
|
98
|
+
return "" + e;
|
|
99
|
+
}
|
|
100
|
+
function i(e) {
|
|
101
|
+
try {
|
|
102
|
+
n(e);
|
|
103
|
+
var t = !1;
|
|
104
|
+
} catch {
|
|
105
|
+
t = !0;
|
|
106
|
+
}
|
|
107
|
+
if (t) {
|
|
108
|
+
t = console;
|
|
109
|
+
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
110
|
+
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function a(e) {
|
|
114
|
+
if (e === v) return "<>";
|
|
115
|
+
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
116
|
+
try {
|
|
117
|
+
var n = t(e);
|
|
118
|
+
return n ? "<" + n + ">" : "<...>";
|
|
119
|
+
} catch {
|
|
120
|
+
return "<...>";
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function o() {
|
|
124
|
+
var e = j.A;
|
|
125
|
+
return e === null ? null : e.getOwner();
|
|
126
|
+
}
|
|
127
|
+
function s() {
|
|
128
|
+
return Error("react-stack-top-frame");
|
|
129
|
+
}
|
|
130
|
+
function c(e) {
|
|
131
|
+
if (M.call(e, "key")) {
|
|
132
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
133
|
+
if (t && t.isReactWarning) return !1;
|
|
134
|
+
}
|
|
135
|
+
return e.key !== void 0;
|
|
136
|
+
}
|
|
137
|
+
function l(e, t) {
|
|
138
|
+
function n() {
|
|
139
|
+
F || (F = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
140
|
+
}
|
|
141
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
142
|
+
get: n,
|
|
143
|
+
configurable: !0
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function u() {
|
|
147
|
+
var e = t(this.type);
|
|
148
|
+
return I[e] || (I[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
149
|
+
}
|
|
150
|
+
function d(e, t, n, r, i, a) {
|
|
151
|
+
var o = n.ref;
|
|
152
|
+
return e = {
|
|
153
|
+
$$typeof: g,
|
|
154
|
+
type: e,
|
|
155
|
+
key: t,
|
|
156
|
+
props: n,
|
|
157
|
+
_owner: r
|
|
158
|
+
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
159
|
+
enumerable: !1,
|
|
160
|
+
value: null
|
|
161
|
+
}) : Object.defineProperty(e, "ref", {
|
|
162
|
+
enumerable: !1,
|
|
163
|
+
get: u
|
|
164
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
165
|
+
configurable: !1,
|
|
166
|
+
enumerable: !1,
|
|
167
|
+
writable: !0,
|
|
168
|
+
value: 0
|
|
169
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
170
|
+
configurable: !1,
|
|
171
|
+
enumerable: !1,
|
|
172
|
+
writable: !0,
|
|
173
|
+
value: null
|
|
174
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
175
|
+
configurable: !1,
|
|
176
|
+
enumerable: !1,
|
|
177
|
+
writable: !0,
|
|
178
|
+
value: i
|
|
179
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
180
|
+
configurable: !1,
|
|
181
|
+
enumerable: !1,
|
|
182
|
+
writable: !0,
|
|
183
|
+
value: a
|
|
184
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
185
|
+
}
|
|
186
|
+
function f(e, n, r, a, s, u) {
|
|
187
|
+
var f = n.children;
|
|
188
|
+
if (f !== void 0) {
|
|
189
|
+
if (a) {
|
|
190
|
+
if (N(f)) {
|
|
191
|
+
for (a = 0; a < f.length; a++) p(f[a]);
|
|
192
|
+
Object.freeze && Object.freeze(f);
|
|
193
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
194
|
+
} else p(f);
|
|
195
|
+
}
|
|
196
|
+
if (M.call(n, "key")) {
|
|
197
|
+
f = t(e);
|
|
198
|
+
var m = Object.keys(n).filter(function(e) {
|
|
199
|
+
return e !== "key";
|
|
200
|
+
});
|
|
201
|
+
a = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", z[f + a] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", a, f, m, f), z[f + a] = !0);
|
|
202
|
+
}
|
|
203
|
+
if (f = null, r !== void 0 && (i(r), f = "" + r), c(n) && (i(n.key), f = "" + n.key), "key" in n) for (var h in r = {}, n) h !== "key" && (r[h] = n[h]);
|
|
204
|
+
else r = n;
|
|
205
|
+
return f && l(r, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, r, o(), s, u);
|
|
206
|
+
}
|
|
207
|
+
function p(e) {
|
|
208
|
+
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
209
|
+
}
|
|
210
|
+
function m(e) {
|
|
211
|
+
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
212
|
+
}
|
|
213
|
+
var h = r("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.view_transition"), A = Symbol.for("react.client.reference"), j = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, N = Array.isArray, P = console.createTask ? console.createTask : function() {
|
|
214
|
+
return null;
|
|
215
|
+
};
|
|
216
|
+
h = { react_stack_bottom_frame: function(e) {
|
|
217
|
+
return e();
|
|
218
|
+
} };
|
|
219
|
+
var F, I = {}, L = h.react_stack_bottom_frame.bind(h, s)(), R = P(a(s)), z = {};
|
|
220
|
+
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
221
|
+
var r = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
222
|
+
if (r) {
|
|
223
|
+
var i = Error.stackTraceLimit;
|
|
224
|
+
Error.stackTraceLimit = 10;
|
|
225
|
+
var o = Error("react-stack-top-frame");
|
|
226
|
+
Error.stackTraceLimit = i;
|
|
227
|
+
} else o = L;
|
|
228
|
+
return f(e, t, n, !1, o, r ? P(a(e)) : R);
|
|
229
|
+
}, e.jsxs = function(e, t, n) {
|
|
230
|
+
var r = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
231
|
+
if (r) {
|
|
232
|
+
var i = Error.stackTraceLimit;
|
|
233
|
+
Error.stackTraceLimit = 10;
|
|
234
|
+
var o = Error("react-stack-top-frame");
|
|
235
|
+
Error.stackTraceLimit = i;
|
|
236
|
+
} else o = L;
|
|
237
|
+
return f(e, t, n, !0, o, r ? P(a(e)) : R);
|
|
238
|
+
};
|
|
239
|
+
})();
|
|
240
|
+
})), l = (/* @__PURE__ */ n(((e, t) => {
|
|
241
|
+
t.exports = process.env.NODE_ENV === "production" ? s() : c();
|
|
242
|
+
})))();
|
|
243
|
+
function u(e) {
|
|
244
|
+
let t = o(e);
|
|
245
|
+
return /* @__PURE__ */ (0, l.jsxs)("button", {
|
|
246
|
+
...t.buttonProps,
|
|
247
|
+
type: "button",
|
|
248
|
+
className: t.className,
|
|
249
|
+
disabled: t.disabled,
|
|
250
|
+
onClick: t.onClick,
|
|
251
|
+
children: [
|
|
252
|
+
t.leadingIcon ? /* @__PURE__ */ (0, l.jsx)("span", {
|
|
253
|
+
className: "jo-ui-button__icon",
|
|
254
|
+
children: t.leadingIcon
|
|
255
|
+
}) : null,
|
|
256
|
+
/* @__PURE__ */ (0, l.jsx)("span", {
|
|
257
|
+
className: "jo-ui-button__label",
|
|
258
|
+
children: t.children
|
|
259
|
+
}),
|
|
260
|
+
t.trailingIcon ? /* @__PURE__ */ (0, l.jsx)("span", {
|
|
261
|
+
className: "jo-ui-button__icon",
|
|
262
|
+
children: t.trailingIcon
|
|
263
|
+
}) : null,
|
|
264
|
+
t.loading ? /* @__PURE__ */ (0, l.jsx)("span", {
|
|
265
|
+
className: "jo-ui-button__spinner",
|
|
266
|
+
"aria-hidden": "true"
|
|
267
|
+
}) : null
|
|
268
|
+
]
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
//#endregion
|
|
272
|
+
export { u as Button };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.container{width:100%}@media (width>=640px){.container{max-width:640px}}@media (width>=768px){.container{max-width:768px}}@media (width>=1024px){.container{max-width:1024px}}@media (width>=1280px){.container{max-width:1280px}}@media (width>=1536px){.container{max-width:1536px}}.jo-ui-button{--jo-ui-button-font-family:Inter,"Segoe UI",system-ui,sans-serif;--jo-ui-button-primary-bg:var(--jo-color-accent,#1f2f5f);--jo-ui-button-primary-text:var(--jo-color-accent-contrast,#fff);--jo-ui-button-primary-border:var(--jo-color-accent,#1f2f5f);--jo-ui-button-primary-hover-bg:#162448;--jo-ui-button-primary-hover-border:#162448;--jo-ui-button-secondary-bg:var(--jo-color-surface-alt,#f7f9fc);--jo-ui-button-secondary-text:var(--jo-color-text,#1f2a44);--jo-ui-button-secondary-border:var(--jo-color-border,#d8dfeb);--jo-ui-button-secondary-hover-bg:#eef3fa;--jo-ui-button-secondary-hover-border:#c8d2e3;--jo-ui-button-ghost-bg:transparent;--jo-ui-button-ghost-text:var(--jo-color-text,#1f2a44);--jo-ui-button-ghost-border:transparent;--jo-ui-button-modal-primary-bg:#14224a;--jo-ui-button-modal-primary-text:#fff;--jo-ui-button-modal-text:oklch(55.1% .027 264.364);--jo-ui-button-destructive-bg:#d94a5a;--jo-ui-button-destructive-border:#d94a5a;--jo-ui-button-destructive-text:#fff;--jo-ui-button-destructive-hover:#c43f4e;--jo-ui-button-focus-color:var(--jo-color-focus,#5f7fe3);--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);min-height:2.5rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);font-size:.875rem;font-weight:500;line-height:1;font-family:var(--jo-ui-button-font-family);border-width:1px;border-color:var(--jo-ui-button-primary-border);color:var(--jo-ui-button-primary-text);background:var(--jo-ui-button-primary-bg);border-radius:.375rem;justify-content:center;align-items:center;gap:.5rem;padding:.5rem 1rem;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);display:inline-flex}.jo-ui-button:disabled{cursor:not-allowed;opacity:.65}.jo-ui-button:focus-visible{outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-offset-width:2px;--tw-ring-color:var(--jo-ui-button-focus-color);outline:2px solid #0000}.jo-ui-button--sm{min-height:2rem;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem}.jo-ui-button--md{font-size:.95rem}.jo-ui-button--lg{min-height:2.75rem;padding:.75rem 1.125rem;font-size:1rem;line-height:1.5rem}.jo-ui-button--primary{border-color:var(--jo-ui-button-primary-border);color:var(--jo-ui-button-primary-text);background:var(--jo-ui-button-primary-bg)}.jo-ui-button--primary:hover:not(:disabled){border-color:var(--jo-ui-button-primary-hover-border);background:var(--jo-ui-button-primary-hover-bg)}.jo-ui-button--secondary{border-color:var(--jo-ui-button-secondary-border);color:var(--jo-ui-button-secondary-text);background:var(--jo-ui-button-secondary-bg)}.jo-ui-button--secondary:hover:not(:disabled){border-color:var(--jo-ui-button-secondary-hover-border);background:var(--jo-ui-button-secondary-hover-bg)}.theme-dark .jo-ui-button{--jo-ui-button-primary-hover-bg:#b3c6ff;--jo-ui-button-primary-hover-border:#b3c6ff;--jo-ui-button-secondary-hover-bg:#223552;--jo-ui-button-secondary-hover-border:#3a507a}.jo-ui-button--ghost{border-color:var(--jo-ui-button-ghost-border);color:var(--jo-ui-button-ghost-text);background:var(--jo-ui-button-ghost-bg)}.jo-ui-button--ghost:hover:not(:disabled){--tw-bg-opacity:1;background-color:rgb(241 245 249/var(--tw-bg-opacity,1))}.jo-ui-button--primary-modal{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;min-height:0;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);color:var(--jo-ui-button-modal-primary-text);background:var(--jo-ui-button-modal-primary-bg);border-width:0;border-color:#0000;border-radius:.5rem;padding:.5rem 1rem;font-size:12.5px;font-weight:700;line-height:18.75px}.jo-ui-button--primary-modal:hover:not(:disabled){background:#0f1a38}.jo-ui-button--text-muted{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;min-height:0;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);color:var(--jo-ui-button-modal-text);border-width:0;border-color:#0000;border-radius:0;padding:0;font-size:12px;font-weight:600;line-height:18px}.jo-ui-button--text-muted,.jo-ui-button--text-muted:hover:not(:disabled){background:0 0}.jo-ui-button--text-muted:hover:not(:disabled){color:#1c2333}.theme-dark .jo-ui-button.jo-ui-button--ghost,.theme-dark .jo-ui-button.jo-ui-button--ghost .jo-ui-button__icon,.theme-dark .jo-ui-button.jo-ui-button--ghost .jo-ui-button__label{color:#e7ecf8!important}.theme-dark .jo-ui-button.jo-ui-button--ghost:hover:not(:disabled){background:#23314d!important}.theme-dark .jo-ui-button.jo-ui-button--text-muted,.theme-dark .jo-ui-button.jo-ui-button--text-muted .jo-ui-button__icon,.theme-dark .jo-ui-button.jo-ui-button--text-muted .jo-ui-button__label{color:#b9c4da!important}.theme-dark .jo-ui-button.jo-ui-button--text-muted:hover:not(:disabled),.theme-dark .jo-ui-button.jo-ui-button--text-muted:hover:not(:disabled) .jo-ui-button__icon,.theme-dark .jo-ui-button.jo-ui-button--text-muted:hover:not(:disabled) .jo-ui-button__label{color:#e7ecf8!important;background:0 0!important}.jo-ui-button--destructive{border-color:var(--jo-ui-button-destructive-border);color:var(--jo-ui-button-destructive-text);background:var(--jo-ui-button-destructive-bg)}.jo-ui-button--destructive:hover:not(:disabled){border-color:var(--jo-ui-button-destructive-hover);background:var(--jo-ui-button-destructive-hover)}.jo-ui-button--loading{position:relative}.jo-ui-button__icon,.jo-ui-button__label{align-items:center;display:inline-flex}.relative{position:relative}.inline-flex{display:inline-flex}.min-h-0{min-height:0}.min-h-10{min-height:2.5rem}.min-h-11{min-height:2.75rem}.min-h-8{min-height:2rem}.cursor-not-allowed{cursor:not-allowed}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.border{border-width:1px}.border-0{border-width:0}.border-blue-700{--tw-border-opacity:1;border-color:rgb(29 78 216/var(--tw-border-opacity,1))}.px-0{padding-left:0;padding-right:0}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-\[1\.125rem\]{padding-left:1.125rem;padding-right:1.125rem}.py-0{padding-top:0;padding-bottom:0}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.text-\[0\.95rem\]{font-size:.95rem}.text-\[12\.5px\]{font-size:12.5px}.text-\[12px\]{font-size:12px}.text-sm{font-size:.875rem;line-height:1.25rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-\[18\.75px\]{line-height:18.75px}.leading-\[18px\]{line-height:18px}.leading-none{line-height:1}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline-offset:2px;outline:2px solid #0000}.ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}
|
|
2
|
+
/*$vite$:1*/
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@net-advantage/jo-ui-button",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": [
|
|
21
|
+
"**/*.css"
|
|
22
|
+
],
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": "^19.0.0",
|
|
25
|
+
"react-dom": "^19.0.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "pnpm run build:styles && pnpm run build:js && pnpm run build:types",
|
|
29
|
+
"build:styles": "pnpm exec tailwindcss -c ../../tailwind.controls.config.cjs -i ./src/button.tailwind.css -o ./src/button.css --minify",
|
|
30
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
31
|
+
"build:js": "vite build",
|
|
32
|
+
"test": "vitest run"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/react": "^19.2.18",
|
|
36
|
+
"@types/react-dom": "^19.2.7",
|
|
37
|
+
"typescript": "~6.0.2",
|
|
38
|
+
"vite": "^8.3.0",
|
|
39
|
+
"vitest": "latest",
|
|
40
|
+
"@vitejs/plugin-react": "^6.1.1"
|
|
41
|
+
}
|
|
42
|
+
}
|