ionbase-ui 0.1.0 → 0.1.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/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +10 -1
- package/dist/components/Button.js.map +1 -1
- package/dist/components/dom-props.d.ts +51 -0
- package/dist/components/dom-props.d.ts.map +1 -0
- package/dist/components/dom-props.js +69 -0
- package/dist/components/dom-props.js.map +1 -0
- package/package.json +11 -12
- package/LICENSE +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,WAAY,SAAQ,eAAe,CAAC,QAAQ,CAAC;IAC5D,8CAA8C;IAC9C,OAAO,CAAC,EACJ,eAAe,GACf,iBAAiB,GACjB,WAAW,GACX,UAAU,GACV,aAAa,CAAC;IAClB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,gDAAgD;IAChD,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,+CAA+C;IAC/C,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,MAAM,uFA6ElB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
3
3
|
import { useButton, useHover, useFocusRing, mergeProps, } from 'react-aria';
|
|
4
|
+
import { ARIA_BUTTON_NON_DOM_PROPS, omitProps } from './dom-props.js';
|
|
4
5
|
export const Button = forwardRef((props, forwardedRef) => {
|
|
5
6
|
const { variant = 'primary-brand', size = 'md', startIcon, endIcon, className: customClassName, children, isDisabled, ...restProps } = props;
|
|
6
7
|
const domRef = useRef(null);
|
|
@@ -37,7 +38,15 @@ export const Button = forwardRef((props, forwardedRef) => {
|
|
|
37
38
|
'data-focused': isFocusVisible || undefined,
|
|
38
39
|
'data-disabled': isDisabled || undefined,
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
+
/*
|
|
42
|
+
* `useButton` above was handed the *full* props object, so it has already
|
|
43
|
+
* taken `onPress` and friends and wired them up. What is left in
|
|
44
|
+
* `restProps` is a duplicate set that React Aria has no further use for —
|
|
45
|
+
* and spreading it would put `onPress` on the DOM node, which React warns
|
|
46
|
+
* about and ignores. See ./dom-props.ts for the list and its provenance.
|
|
47
|
+
*/
|
|
48
|
+
const domProps = omitProps(restProps, ARIA_BUTTON_NON_DOM_PROPS);
|
|
49
|
+
return (_jsxs("button", { ...domProps, ...mergeProps(buttonProps, hoverProps, focusProps), ...stateAttributes, ref: domRef, className: classNames, children: [startIcon && (_jsx("span", { className: "ion-button__icon-start", children: startIcon })), children && _jsx("span", { className: "ion-button__label", children: children }), endIcon && _jsx("span", { className: "ion-button__icon-end", children: endIcon })] }));
|
|
41
50
|
});
|
|
42
51
|
Button.displayName = 'Button';
|
|
43
52
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,UAAU,EAAE,MAAM,EAAE,mBAA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AAe,IAAI,EAAE;KACtB;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,uEAAuE;IACvE,qEAAqE;IACrE,gCAAgC;IAChC,MAAM,eAAe,GAAG;QACtB,cAAc,EAAE,SAAS,IAAI,SAAS;QACtC,cAAc,EAAE,SAAS,IAAI,SAAS;QACtC,cAAc,EAAE,cAAc,IAAI,SAAS;QAC3C,eAAe,EAAE,UAAU,IAAI,SAAS;KACzC,CAAC;IAEF;;;;;;OAMG;IACH,MAAM,QAAQ,GAAG,SAAS,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;IAEjE,OAAO,CACL,qBACM,QAAQ,KACR,UAAU,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,KAC/C,eAAe,EACnB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,UAAU,aAEpB,SAAS,IAAI,CACZ,eAAM,SAAS,EAAC,wBAAwB,YAAE,SAAS,GAAQ,CAC5D,EACA,QAAQ,IAAI,eAAM,SAAS,EAAC,mBAAmB,YAAE,QAAQ,GAAQ,EACjE,OAAO,IAAI,eAAM,SAAS,EAAC,sBAAsB,YAAE,OAAO,GAAQ,IAC5D,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Aria prop types are not DOM prop types.
|
|
3
|
+
*
|
|
4
|
+
* A component that extends `AriaButtonProps` (or any other `Aria*Props`) and
|
|
5
|
+
* then spreads its leftover props onto an element ships those extras straight
|
|
6
|
+
* to the DOM. React logs `Unknown event handler property \`onPress\`. It will
|
|
7
|
+
* be ignored.` for the handlers and renders the rest as stray attributes — and
|
|
8
|
+
* nothing in this repo's build, lint, typecheck or Storybook run sees it,
|
|
9
|
+
* because it is a runtime console warning in the consumer's app.
|
|
10
|
+
*
|
|
11
|
+
* The hooks already read these off the *full* props object, so dropping them
|
|
12
|
+
* from the spread costs nothing: `useButton(props, ref)` still receives
|
|
13
|
+
* `onPress` and still fires it.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Every `AriaButtonProps<'button'>` member that must not reach a `<button>`.
|
|
17
|
+
*
|
|
18
|
+
* Typed as `keyof AriaButtonProps<'button'>` on purpose: if a React Aria
|
|
19
|
+
* upgrade renames or removes one of these, this array stops compiling rather
|
|
20
|
+
* than silently going stale. That is the whole point — the bug this fixes was
|
|
21
|
+
* a hand-maintained mental list drifting from the library's actual type.
|
|
22
|
+
*
|
|
23
|
+
* Sources, as of react-aria 3.50:
|
|
24
|
+
* PressEvents onPress, onPressStart, onPressEnd, onPressChange,
|
|
25
|
+
* onPressUp
|
|
26
|
+
* FocusEvents onFocusChange
|
|
27
|
+
* FocusableDOMProps excludeFromTabOrder
|
|
28
|
+
* AriaBaseButtonProps preventFocusOnPress
|
|
29
|
+
* LinkButtonProps elementType, href, target, rel
|
|
30
|
+
*
|
|
31
|
+
* `onClick` is deliberately absent: it is a real DOM handler, and `useButton`
|
|
32
|
+
* returns its own `onClick` in `buttonProps`, which is spread afterwards and
|
|
33
|
+
* wins. Also absent are the many members that *are* valid button attributes —
|
|
34
|
+
* `type`, `name`, `value`, `form*`, `autoFocus`, `id`, `aria-*`, `onFocus`,
|
|
35
|
+
* `onBlur`, `onKeyDown`, `onKeyUp` — those must keep flowing through.
|
|
36
|
+
*
|
|
37
|
+
* The `LinkButtonProps` four are here because this Button always renders a
|
|
38
|
+
* `<button>`. `elementType` would draw React's unknown-prop warning; `href`,
|
|
39
|
+
* `target` and `rel` would render as attributes a `<button>` does nothing
|
|
40
|
+
* with.
|
|
41
|
+
*/
|
|
42
|
+
export declare const ARIA_BUTTON_NON_DOM_PROPS: readonly ["onPress", "onPressStart", "onPressEnd", "onPressChange", "onPressUp", "onFocusChange", "excludeFromTabOrder", "preventFocusOnPress", "elementType", "href", "target", "rel"];
|
|
43
|
+
/**
|
|
44
|
+
* Returns `props` without `keys`, leaving `props` untouched.
|
|
45
|
+
*
|
|
46
|
+
* Preferred over a destructure with a long list of ignored bindings: the list
|
|
47
|
+
* lives next to the type it is derived from instead of being retyped in every
|
|
48
|
+
* component, and `no-unused-vars` has nothing to complain about.
|
|
49
|
+
*/
|
|
50
|
+
export declare function omitProps<T extends object, K extends readonly PropertyKey[]>(props: T, keys: K): Omit<T, K[number]>;
|
|
51
|
+
//# sourceMappingURL=dom-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-props.d.ts","sourceRoot":"","sources":["../../src/components/dom-props.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,yBAAyB,yLAa2B,CAAC;AAElE;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,SAAS,WAAW,EAAE,EAC1E,KAAK,EAAE,CAAC,EACR,IAAI,EAAE,CAAC,GACN,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAIpB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Aria prop types are not DOM prop types.
|
|
3
|
+
*
|
|
4
|
+
* A component that extends `AriaButtonProps` (or any other `Aria*Props`) and
|
|
5
|
+
* then spreads its leftover props onto an element ships those extras straight
|
|
6
|
+
* to the DOM. React logs `Unknown event handler property \`onPress\`. It will
|
|
7
|
+
* be ignored.` for the handlers and renders the rest as stray attributes — and
|
|
8
|
+
* nothing in this repo's build, lint, typecheck or Storybook run sees it,
|
|
9
|
+
* because it is a runtime console warning in the consumer's app.
|
|
10
|
+
*
|
|
11
|
+
* The hooks already read these off the *full* props object, so dropping them
|
|
12
|
+
* from the spread costs nothing: `useButton(props, ref)` still receives
|
|
13
|
+
* `onPress` and still fires it.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Every `AriaButtonProps<'button'>` member that must not reach a `<button>`.
|
|
17
|
+
*
|
|
18
|
+
* Typed as `keyof AriaButtonProps<'button'>` on purpose: if a React Aria
|
|
19
|
+
* upgrade renames or removes one of these, this array stops compiling rather
|
|
20
|
+
* than silently going stale. That is the whole point — the bug this fixes was
|
|
21
|
+
* a hand-maintained mental list drifting from the library's actual type.
|
|
22
|
+
*
|
|
23
|
+
* Sources, as of react-aria 3.50:
|
|
24
|
+
* PressEvents onPress, onPressStart, onPressEnd, onPressChange,
|
|
25
|
+
* onPressUp
|
|
26
|
+
* FocusEvents onFocusChange
|
|
27
|
+
* FocusableDOMProps excludeFromTabOrder
|
|
28
|
+
* AriaBaseButtonProps preventFocusOnPress
|
|
29
|
+
* LinkButtonProps elementType, href, target, rel
|
|
30
|
+
*
|
|
31
|
+
* `onClick` is deliberately absent: it is a real DOM handler, and `useButton`
|
|
32
|
+
* returns its own `onClick` in `buttonProps`, which is spread afterwards and
|
|
33
|
+
* wins. Also absent are the many members that *are* valid button attributes —
|
|
34
|
+
* `type`, `name`, `value`, `form*`, `autoFocus`, `id`, `aria-*`, `onFocus`,
|
|
35
|
+
* `onBlur`, `onKeyDown`, `onKeyUp` — those must keep flowing through.
|
|
36
|
+
*
|
|
37
|
+
* The `LinkButtonProps` four are here because this Button always renders a
|
|
38
|
+
* `<button>`. `elementType` would draw React's unknown-prop warning; `href`,
|
|
39
|
+
* `target` and `rel` would render as attributes a `<button>` does nothing
|
|
40
|
+
* with.
|
|
41
|
+
*/
|
|
42
|
+
export const ARIA_BUTTON_NON_DOM_PROPS = [
|
|
43
|
+
'onPress',
|
|
44
|
+
'onPressStart',
|
|
45
|
+
'onPressEnd',
|
|
46
|
+
'onPressChange',
|
|
47
|
+
'onPressUp',
|
|
48
|
+
'onFocusChange',
|
|
49
|
+
'excludeFromTabOrder',
|
|
50
|
+
'preventFocusOnPress',
|
|
51
|
+
'elementType',
|
|
52
|
+
'href',
|
|
53
|
+
'target',
|
|
54
|
+
'rel',
|
|
55
|
+
];
|
|
56
|
+
/**
|
|
57
|
+
* Returns `props` without `keys`, leaving `props` untouched.
|
|
58
|
+
*
|
|
59
|
+
* Preferred over a destructure with a long list of ignored bindings: the list
|
|
60
|
+
* lives next to the type it is derived from instead of being retyped in every
|
|
61
|
+
* component, and `no-unused-vars` has nothing to complain about.
|
|
62
|
+
*/
|
|
63
|
+
export function omitProps(props, keys) {
|
|
64
|
+
const result = { ...props };
|
|
65
|
+
for (const key of keys)
|
|
66
|
+
delete result[key];
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=dom-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-props.js","sourceRoot":"","sources":["../../src/components/dom-props.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,SAAS;IACT,cAAc;IACd,YAAY;IACZ,eAAe;IACf,WAAW;IACX,eAAe;IACf,qBAAqB;IACrB,qBAAqB;IACrB,aAAa;IACb,MAAM;IACN,QAAQ;IACR,KAAK;CAC0D,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CACvB,KAAQ,EACR,IAAO;IAEP,MAAM,MAAM,GAAG,EAAE,GAAG,KAAK,EAAkC,CAAC;IAC5D,KAAK,MAAM,GAAG,IAAI,IAAI;QAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3C,OAAO,MAA4B,CAAC;AACtC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ionbase-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "IonBase Design System — accessible React components, styles and design tokens in one package",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
"./styles": "./dist/styles/index.css",
|
|
15
15
|
"./styles/*": "./dist/styles/*",
|
|
16
16
|
"./tokens": "./dist/styles/tokens/index.css",
|
|
17
|
-
"./tokens/*": "./dist/styles/tokens/*"
|
|
18
|
-
"./src/*": "./src/*"
|
|
17
|
+
"./tokens/*": "./dist/styles/tokens/*"
|
|
19
18
|
},
|
|
20
19
|
"keywords": [
|
|
21
20
|
"design-system",
|
|
@@ -45,6 +44,14 @@
|
|
|
45
44
|
"publishConfig": {
|
|
46
45
|
"access": "public"
|
|
47
46
|
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"dev": "tsc --watch",
|
|
49
|
+
"build": "node scripts/sync-tokens.mjs && tsc --build --force && node scripts/copy-css.mjs",
|
|
50
|
+
"typecheck": "tsc --noEmit",
|
|
51
|
+
"lint": "eslint . && stylelint \"src/styles/*.css\"",
|
|
52
|
+
"format": "prettier --check .",
|
|
53
|
+
"icons:verify": "node scripts/verify-icons.mjs"
|
|
54
|
+
},
|
|
48
55
|
"peerDependencies": {
|
|
49
56
|
"react": "^18.0.0 || ^19.0.0",
|
|
50
57
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
@@ -58,13 +65,5 @@
|
|
|
58
65
|
"//devDependencies": "lucide-react is a devDependency, not a dependency: nothing in src/ imports it. It is here only so scripts/verify-icons.mjs can compare the installed icon set against the Figma page. Consumers pick their own icon library. There is deliberately NO dependency on @ionbase-ui/tokens — it is private and would publish as a version that does not exist on npm. Build ordering is expressed in turbo.json instead.",
|
|
59
66
|
"devDependencies": {
|
|
60
67
|
"lucide-react": "^1.27.0"
|
|
61
|
-
},
|
|
62
|
-
"scripts": {
|
|
63
|
-
"dev": "tsc --watch",
|
|
64
|
-
"build": "node scripts/sync-tokens.mjs && tsc --build --force && node scripts/copy-css.mjs",
|
|
65
|
-
"typecheck": "tsc --noEmit",
|
|
66
|
-
"lint": "eslint . && stylelint \"src/styles/*.css\"",
|
|
67
|
-
"format": "prettier --check .",
|
|
68
|
-
"icons:verify": "node scripts/verify-icons.mjs"
|
|
69
68
|
}
|
|
70
|
-
}
|
|
69
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 IonBase
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|