@damarkuncoro/ui-library 0.0.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/LICENSE +21 -0
- package/README.md +122 -0
- package/lib/cjs/components/button/button-base.d.ts +3 -0
- package/lib/cjs/components/button/button-base.d.ts.map +1 -0
- package/lib/cjs/components/button/button-base.js +21 -0
- package/lib/cjs/components/button/button-base.js.map +1 -0
- package/lib/cjs/components/button/button-contract.d.ts +54 -0
- package/lib/cjs/components/button/button-contract.d.ts.map +1 -0
- package/lib/cjs/components/button/button-contract.js +32 -0
- package/lib/cjs/components/button/button-contract.js.map +1 -0
- package/lib/cjs/components/button/button-examples.d.ts +11 -0
- package/lib/cjs/components/button/button-examples.d.ts.map +1 -0
- package/lib/cjs/components/button/button-examples.js +67 -0
- package/lib/cjs/components/button/button-examples.js.map +1 -0
- package/lib/cjs/components/button/button-skin-contract.d.ts +133 -0
- package/lib/cjs/components/button/button-skin-contract.d.ts.map +1 -0
- package/lib/cjs/components/button/button-skin-contract.js +118 -0
- package/lib/cjs/components/button/button-skin-contract.js.map +1 -0
- package/lib/cjs/components/button/button-skin-native.d.ts +3 -0
- package/lib/cjs/components/button/button-skin-native.d.ts.map +1 -0
- package/lib/cjs/components/button/button-skin-native.js +62 -0
- package/lib/cjs/components/button/button-skin-native.js.map +1 -0
- package/lib/cjs/components/button/button-skin-tailwind.d.ts +15 -0
- package/lib/cjs/components/button/button-skin-tailwind.d.ts.map +1 -0
- package/lib/cjs/components/button/button-skin-tailwind.js +46 -0
- package/lib/cjs/components/button/button-skin-tailwind.js.map +1 -0
- package/lib/cjs/components/button/index.d.ts +8 -0
- package/lib/cjs/components/button/index.d.ts.map +1 -0
- package/lib/cjs/components/button/index.js +28 -0
- package/lib/cjs/components/button/index.js.map +1 -0
- package/lib/cjs/components/input/index.d.ts +8 -0
- package/lib/cjs/components/input/index.d.ts.map +1 -0
- package/lib/cjs/components/input/index.js +28 -0
- package/lib/cjs/components/input/index.js.map +1 -0
- package/lib/cjs/components/input/input-base.d.ts +9 -0
- package/lib/cjs/components/input/input-base.d.ts.map +1 -0
- package/lib/cjs/components/input/input-base.js +17 -0
- package/lib/cjs/components/input/input-base.js.map +1 -0
- package/lib/cjs/components/input/input-contract.d.ts +40 -0
- package/lib/cjs/components/input/input-contract.d.ts.map +1 -0
- package/lib/cjs/components/input/input-contract.js +32 -0
- package/lib/cjs/components/input/input-contract.js.map +1 -0
- package/lib/cjs/components/input/input-examples.d.ts +12 -0
- package/lib/cjs/components/input/input-examples.d.ts.map +1 -0
- package/lib/cjs/components/input/input-examples.js +67 -0
- package/lib/cjs/components/input/input-examples.js.map +1 -0
- package/lib/cjs/components/input/input-skin-contract.d.ts +93 -0
- package/lib/cjs/components/input/input-skin-contract.d.ts.map +1 -0
- package/lib/cjs/components/input/input-skin-contract.js +97 -0
- package/lib/cjs/components/input/input-skin-contract.js.map +1 -0
- package/lib/cjs/components/input/input-skin-native.d.ts +3 -0
- package/lib/cjs/components/input/input-skin-native.d.ts.map +1 -0
- package/lib/cjs/components/input/input-skin-native.js +68 -0
- package/lib/cjs/components/input/input-skin-native.js.map +1 -0
- package/lib/cjs/components/input/input-skin-tailwind.d.ts +18 -0
- package/lib/cjs/components/input/input-skin-tailwind.d.ts.map +1 -0
- package/lib/cjs/components/input/input-skin-tailwind.js +49 -0
- package/lib/cjs/components/input/input-skin-tailwind.js.map +1 -0
- package/lib/cjs/index.d.ts +4 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/index.js +20 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/package.json +1 -0
- package/lib/cjs/test-setup.d.ts +2 -0
- package/lib/cjs/test-setup.d.ts.map +1 -0
- package/lib/cjs/test-setup.js +4 -0
- package/lib/cjs/test-setup.js.map +1 -0
- package/lib/cjs/theme/design-tokens.d.ts +200 -0
- package/lib/cjs/theme/design-tokens.d.ts.map +1 -0
- package/lib/cjs/theme/design-tokens.js +177 -0
- package/lib/cjs/theme/design-tokens.js.map +1 -0
- package/lib/cjs/theme/index.d.ts +3 -0
- package/lib/cjs/theme/index.d.ts.map +1 -0
- package/lib/cjs/theme/index.js +19 -0
- package/lib/cjs/theme/index.js.map +1 -0
- package/lib/cjs/theme/theme-provider.d.ts +16 -0
- package/lib/cjs/theme/theme-provider.d.ts.map +1 -0
- package/lib/cjs/theme/theme-provider.js +39 -0
- package/lib/cjs/theme/theme-provider.js.map +1 -0
- package/lib/cjs/usage-example.d.ts +2 -0
- package/lib/cjs/usage-example.d.ts.map +1 -0
- package/lib/cjs/usage-example.js +13 -0
- package/lib/cjs/usage-example.js.map +1 -0
- package/lib/esm/components/button/button-base.d.ts +3 -0
- package/lib/esm/components/button/button-base.d.ts.map +1 -0
- package/lib/esm/components/button/button-base.js +18 -0
- package/lib/esm/components/button/button-base.js.map +1 -0
- package/lib/esm/components/button/button-contract.d.ts +54 -0
- package/lib/esm/components/button/button-contract.d.ts.map +1 -0
- package/lib/esm/components/button/button-contract.js +29 -0
- package/lib/esm/components/button/button-contract.js.map +1 -0
- package/lib/esm/components/button/button-examples.d.ts +11 -0
- package/lib/esm/components/button/button-examples.d.ts.map +1 -0
- package/lib/esm/components/button/button-examples.js +52 -0
- package/lib/esm/components/button/button-examples.js.map +1 -0
- package/lib/esm/components/button/button-skin-contract.d.ts +133 -0
- package/lib/esm/components/button/button-skin-contract.d.ts.map +1 -0
- package/lib/esm/components/button/button-skin-contract.js +115 -0
- package/lib/esm/components/button/button-skin-contract.js.map +1 -0
- package/lib/esm/components/button/button-skin-native.d.ts +3 -0
- package/lib/esm/components/button/button-skin-native.d.ts.map +1 -0
- package/lib/esm/components/button/button-skin-native.js +59 -0
- package/lib/esm/components/button/button-skin-native.js.map +1 -0
- package/lib/esm/components/button/button-skin-tailwind.d.ts +15 -0
- package/lib/esm/components/button/button-skin-tailwind.d.ts.map +1 -0
- package/lib/esm/components/button/button-skin-tailwind.js +43 -0
- package/lib/esm/components/button/button-skin-tailwind.js.map +1 -0
- package/lib/esm/components/button/index.d.ts +8 -0
- package/lib/esm/components/button/index.d.ts.map +1 -0
- package/lib/esm/components/button/index.js +8 -0
- package/lib/esm/components/button/index.js.map +1 -0
- package/lib/esm/components/input/index.d.ts +8 -0
- package/lib/esm/components/input/index.d.ts.map +1 -0
- package/lib/esm/components/input/index.js +8 -0
- package/lib/esm/components/input/index.js.map +1 -0
- package/lib/esm/components/input/input-base.d.ts +9 -0
- package/lib/esm/components/input/input-base.d.ts.map +1 -0
- package/lib/esm/components/input/input-base.js +14 -0
- package/lib/esm/components/input/input-base.js.map +1 -0
- package/lib/esm/components/input/input-contract.d.ts +40 -0
- package/lib/esm/components/input/input-contract.d.ts.map +1 -0
- package/lib/esm/components/input/input-contract.js +29 -0
- package/lib/esm/components/input/input-contract.js.map +1 -0
- package/lib/esm/components/input/input-examples.d.ts +12 -0
- package/lib/esm/components/input/input-examples.d.ts.map +1 -0
- package/lib/esm/components/input/input-examples.js +51 -0
- package/lib/esm/components/input/input-examples.js.map +1 -0
- package/lib/esm/components/input/input-skin-contract.d.ts +93 -0
- package/lib/esm/components/input/input-skin-contract.d.ts.map +1 -0
- package/lib/esm/components/input/input-skin-contract.js +94 -0
- package/lib/esm/components/input/input-skin-contract.js.map +1 -0
- package/lib/esm/components/input/input-skin-native.d.ts +3 -0
- package/lib/esm/components/input/input-skin-native.d.ts.map +1 -0
- package/lib/esm/components/input/input-skin-native.js +65 -0
- package/lib/esm/components/input/input-skin-native.js.map +1 -0
- package/lib/esm/components/input/input-skin-tailwind.d.ts +18 -0
- package/lib/esm/components/input/input-skin-tailwind.d.ts.map +1 -0
- package/lib/esm/components/input/input-skin-tailwind.js +46 -0
- package/lib/esm/components/input/input-skin-tailwind.js.map +1 -0
- package/lib/esm/index.d.ts +4 -0
- package/lib/esm/index.d.ts.map +1 -0
- package/lib/esm/index.js +4 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/test-setup.d.ts +2 -0
- package/lib/esm/test-setup.d.ts.map +1 -0
- package/lib/esm/test-setup.js +2 -0
- package/lib/esm/test-setup.js.map +1 -0
- package/lib/esm/theme/design-tokens.d.ts +200 -0
- package/lib/esm/theme/design-tokens.d.ts.map +1 -0
- package/lib/esm/theme/design-tokens.js +174 -0
- package/lib/esm/theme/design-tokens.js.map +1 -0
- package/lib/esm/theme/index.d.ts +3 -0
- package/lib/esm/theme/index.d.ts.map +1 -0
- package/lib/esm/theme/index.js +3 -0
- package/lib/esm/theme/index.js.map +1 -0
- package/lib/esm/theme/theme-provider.d.ts +16 -0
- package/lib/esm/theme/theme-provider.d.ts.map +1 -0
- package/lib/esm/theme/theme-provider.js +34 -0
- package/lib/esm/theme/theme-provider.js.map +1 -0
- package/lib/esm/usage-example.d.ts +2 -0
- package/lib/esm/usage-example.d.ts.map +1 -0
- package/lib/esm/usage-example.js +10 -0
- package/lib/esm/usage-example.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Damar Kuncoro
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# @damarkuncoro/ui-library
|
|
2
|
+
|
|
3
|
+
A strict Meta-Architecture compliant UI library focusing on Separation of Concerns, Zero Hardcoding, and Contract-Driven Development.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Meta Architecture**: Strict separation between Logic (Base) and Visuals (Skin).
|
|
8
|
+
- **Contract-Driven**: All component APIs and Visual Styles are defined by rigid Contracts.
|
|
9
|
+
- **Zero Hardcoding**: Every visual value (color, spacing, size) is derived from Design Tokens or Contracts.
|
|
10
|
+
- **Multi-Skin Support**: Comes with Tailwind CSS skin by default, but supports framework-agnostic implementations.
|
|
11
|
+
- **TypeScript First**: Built with strict type safety and `as const` assertions.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @damarkuncoro/ui-library
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Setup
|
|
20
|
+
|
|
21
|
+
Wrap your application with the `ThemeProvider` to inject the design tokens (CSS Variables).
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { ThemeProvider } from '@damarkuncoro/ui-library';
|
|
25
|
+
|
|
26
|
+
function App() {
|
|
27
|
+
return (
|
|
28
|
+
<ThemeProvider>
|
|
29
|
+
<YourApp />
|
|
30
|
+
</ThemeProvider>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### Button
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { Button } from '@damarkuncoro/ui-library';
|
|
41
|
+
|
|
42
|
+
// Standard usage (Tailwind Skin)
|
|
43
|
+
<Button variant="primary" size="md" onClick={() => console.log('Clicked')}>
|
|
44
|
+
Click Me
|
|
45
|
+
</Button>
|
|
46
|
+
|
|
47
|
+
// With Icons
|
|
48
|
+
<Button leftIcon={<span>👈</span>} variant="outline">
|
|
49
|
+
Go Back
|
|
50
|
+
</Button>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Input
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { Input } from '@damarkuncoro/ui-library';
|
|
57
|
+
|
|
58
|
+
<Input
|
|
59
|
+
placeholder="Enter your name"
|
|
60
|
+
variant="filled"
|
|
61
|
+
onChange={(e) => console.log(e.target.value)}
|
|
62
|
+
/>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Customization
|
|
66
|
+
|
|
67
|
+
### 1. Theming (Easy)
|
|
68
|
+
|
|
69
|
+
You can override the default design tokens (colors, etc.) by passing a `themeOverrides` prop to `ThemeProvider`.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
const myBrandTheme = {
|
|
73
|
+
light: {
|
|
74
|
+
'--color-primary-main': '#ff4757', // Change primary color to Red
|
|
75
|
+
'--color-primary-hover': '#ff6b81',
|
|
76
|
+
},
|
|
77
|
+
dark: {
|
|
78
|
+
'--color-primary-main': '#ff6b81',
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
function App() {
|
|
83
|
+
return (
|
|
84
|
+
<ThemeProvider themeOverrides={myBrandTheme}>
|
|
85
|
+
<Button variant="primary">Branded Button</Button>
|
|
86
|
+
</ThemeProvider>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 2. Custom Skins (Advanced)
|
|
92
|
+
|
|
93
|
+
If you need complete control over the visual implementation (e.g., using a different CSS framework like Emotion or Styled Components), you can build your own **Skin** on top of our **Base** components.
|
|
94
|
+
|
|
95
|
+
This library follows a strict dependency rule:
|
|
96
|
+
1. **Contracts**: JSON/TS definitions of Logic (Props) and Visuals (Tokens).
|
|
97
|
+
2. **Base UI**: Functional components (Logic, ARIA, DOM). Depends only on Logic Contracts.
|
|
98
|
+
3. **Skins**: Visual implementations. Depend on Base UI + Visual Contracts.
|
|
99
|
+
|
|
100
|
+
To create your own skin:
|
|
101
|
+
|
|
102
|
+
1. Import `ButtonBase` and `buttonSkinContractDef`.
|
|
103
|
+
2. Create a wrapper that styles `ButtonBase` using values from `buttonSkinContractDef`.
|
|
104
|
+
3. Pass styles via `className` or `style` prop.
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
import { ButtonBase, buttonSkinContractDef } from '@damarkuncoro/ui-library';
|
|
108
|
+
import styled from 'styled-components'; // Example
|
|
109
|
+
|
|
110
|
+
// 1. Read values from the Contract (Single Source of Truth)
|
|
111
|
+
const { variants } = buttonSkinContractDef;
|
|
112
|
+
|
|
113
|
+
// 2. Build your Styled Component
|
|
114
|
+
const MyStyledButton = styled(ButtonBase)`
|
|
115
|
+
background-color: ${variants.primary.backgroundColor};
|
|
116
|
+
color: ${variants.primary.color};
|
|
117
|
+
/* ... map other contract values ... */
|
|
118
|
+
`;
|
|
119
|
+
|
|
120
|
+
// 3. Use it!
|
|
121
|
+
<MyStyledButton variant="primary">Custom Skin</MyStyledButton>
|
|
122
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-base.d.ts","sourceRoot":"","sources":["../../../../src/components/button/button-base.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAanD,eAAO,MAAM,UAAU,8GAuEtB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ButtonBase = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const button_skin_contract_1 = require("./button-skin-contract");
|
|
7
|
+
exports.ButtonBase = (0, react_1.forwardRef)(({ children, disabled, isLoading, leftIcon, rightIcon, type = 'button', className, ...props }, ref) => {
|
|
8
|
+
const isDisabled = disabled || isLoading;
|
|
9
|
+
const handleKeyDown = (event) => {
|
|
10
|
+
if (isDisabled)
|
|
11
|
+
return;
|
|
12
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
13
|
+
event.preventDefault();
|
|
14
|
+
event.currentTarget.click();
|
|
15
|
+
}
|
|
16
|
+
props.onKeyDown?.(event);
|
|
17
|
+
};
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)("button", { ref: ref, type: type, disabled: isDisabled, "aria-disabled": isDisabled, "aria-busy": isLoading, className: className, onKeyDown: handleKeyDown, ...props, children: [isLoading && ((0, jsx_runtime_1.jsx)("span", { className: "button-loader-wrapper", "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)("span", { className: "button-loader" }) })), !isLoading && leftIcon && ((0, jsx_runtime_1.jsx)("span", { className: "button-icon-left", "aria-hidden": button_skin_contract_1.buttonSkinContractDef.icons.ariaHidden, children: leftIcon })), (0, jsx_runtime_1.jsx)("span", { className: "button-content", children: children }), !isLoading && rightIcon && ((0, jsx_runtime_1.jsx)("span", { className: "button-icon-right", "aria-hidden": button_skin_contract_1.buttonSkinContractDef.icons.ariaHidden, children: rightIcon }))] }));
|
|
19
|
+
});
|
|
20
|
+
exports.ButtonBase.displayName = 'ButtonBase';
|
|
21
|
+
//# sourceMappingURL=button-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-base.js","sourceRoot":"","sources":["../../../../src/components/button/button-base.tsx"],"names":[],"mappings":";;;;AAAA,iCAAmC;AAEnC,iEAA+D;AAYlD,QAAA,UAAU,GAAG,IA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C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ReactNode, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
export declare const buttonContractDef: {
|
|
3
|
+
readonly id: "contract_button_v1";
|
|
4
|
+
readonly name: "button";
|
|
5
|
+
readonly category: "ui.component";
|
|
6
|
+
readonly description: "A button component with various variants and sizes";
|
|
7
|
+
readonly variants: readonly [{
|
|
8
|
+
readonly name: "variant";
|
|
9
|
+
readonly type: "intent";
|
|
10
|
+
readonly values: readonly ["primary", "secondary", "outline", "ghost", "danger"];
|
|
11
|
+
readonly defaultValue: "primary";
|
|
12
|
+
readonly description: "Visual style of the button";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "size";
|
|
15
|
+
readonly type: "size";
|
|
16
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
17
|
+
readonly defaultValue: "md";
|
|
18
|
+
readonly description: "Size of the button";
|
|
19
|
+
}];
|
|
20
|
+
readonly props: readonly [{
|
|
21
|
+
readonly name: "children";
|
|
22
|
+
readonly type: "object";
|
|
23
|
+
readonly required: true;
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "isLoading";
|
|
26
|
+
readonly type: "boolean";
|
|
27
|
+
readonly required: false;
|
|
28
|
+
readonly defaultValue: false;
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "leftIcon";
|
|
31
|
+
readonly type: "object";
|
|
32
|
+
readonly required: false;
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "rightIcon";
|
|
35
|
+
readonly type: "object";
|
|
36
|
+
readonly required: false;
|
|
37
|
+
}];
|
|
38
|
+
};
|
|
39
|
+
type ExtractValues<T, Name> = T extends ReadonlyArray<infer U> ? U extends {
|
|
40
|
+
name: Name;
|
|
41
|
+
values: ReadonlyArray<infer V>;
|
|
42
|
+
} ? V : never : never;
|
|
43
|
+
export type ButtonVariant = ExtractValues<typeof buttonContractDef.variants, "variant">;
|
|
44
|
+
export type ButtonSize = ExtractValues<typeof buttonContractDef.variants, "size">;
|
|
45
|
+
export interface ButtonContract extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
variant?: ButtonVariant;
|
|
48
|
+
size?: ButtonSize;
|
|
49
|
+
isLoading?: boolean;
|
|
50
|
+
leftIcon?: ReactNode;
|
|
51
|
+
rightIcon?: ReactNode;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=button-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-contract.d.ts","sourceRoot":"","sources":["../../../../src/components/button/button-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAMxD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BpB,CAAC;AAoBX,KAAK,aAAa,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAC1D,CAAC,SAAS;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,GAAG,KAAK,CAAC;AAMjF,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,iBAAiB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAMxF,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAKlF,MAAM,WAAW,cAAe,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IAI7E,QAAQ,EAAE,SAAS,CAAC;IAMpB,OAAO,CAAC,EAAE,aAAa,CAAC;IAMxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAKlB,SAAS,CAAC,EAAE,OAAO,CAAC;IAKpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAKrB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buttonContractDef = void 0;
|
|
4
|
+
exports.buttonContractDef = {
|
|
5
|
+
id: "contract_button_v1",
|
|
6
|
+
name: "button",
|
|
7
|
+
category: "ui.component",
|
|
8
|
+
description: "A button component with various variants and sizes",
|
|
9
|
+
variants: [
|
|
10
|
+
{
|
|
11
|
+
name: "variant",
|
|
12
|
+
type: "intent",
|
|
13
|
+
values: ["primary", "secondary", "outline", "ghost", "danger"],
|
|
14
|
+
defaultValue: "primary",
|
|
15
|
+
description: "Visual style of the button"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "size",
|
|
19
|
+
type: "size",
|
|
20
|
+
values: ["sm", "md", "lg"],
|
|
21
|
+
defaultValue: "md",
|
|
22
|
+
description: "Size of the button"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
props: [
|
|
26
|
+
{ name: "children", type: "object", required: true },
|
|
27
|
+
{ name: "isLoading", type: "boolean", required: false, defaultValue: false },
|
|
28
|
+
{ name: "leftIcon", type: "object", required: false },
|
|
29
|
+
{ name: "rightIcon", type: "object", required: false }
|
|
30
|
+
]
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=button-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-contract.js","sourceRoot":"","sources":["../../../../src/components/button/button-contract.ts"],"names":[],"mappings":";;;AAMa,QAAA,iBAAiB,GAAG;IAC/B,EAAE,EAAE,oBAAoB;IACxB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,cAAc;IACxB,WAAW,EAAE,oDAAoD;IACjE,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC;YAC9D,YAAY,EAAE,SAAS;YACvB,WAAW,EAAE,4BAA4B;SAC1C;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;YAC1B,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,oBAAoB;SAClC;KACF;IACD,KAAK,EAAE;QACL,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QACpD,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE;QAC5E,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE;QACrD,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE;KACvD;CACO,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function ButtonVariantExamples(): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function ButtonSizeExamples(): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function ButtonIconExamples(): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function ButtonStateExamples(): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function ButtonCombinedExamples(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function ButtonNativeSkinExamples(): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function ButtonInteractiveExamples(): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ButtonAccessibilityExamples(): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function ButtonCustomStylingExamples(): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function AllButtonExamples(): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=button-examples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-examples.d.ts","sourceRoot":"","sources":["../../../../src/components/button/button-examples.tsx"],"names":[],"mappings":"AAeA,wBAAgB,qBAAqB,4CAUpC;AAMD,wBAAgB,kBAAkB,4CAQjC;AAMD,wBAAgB,kBAAkB,4CAajC;AAMD,wBAAgB,mBAAmB,4CAQlC;AAMD,wBAAgB,sBAAsB,4CA8BrC;AAMD,wBAAgB,wBAAwB,4CA4BvC;AAMD,wBAAgB,yBAAyB,4CAwCxC;AAMD,wBAAgB,2BAA2B,4CAgB1C;AAMD,wBAAgB,2BAA2B,4CA4B1C;AAMD,wBAAgB,iBAAiB,4CAiDhC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ButtonVariantExamples = ButtonVariantExamples;
|
|
7
|
+
exports.ButtonSizeExamples = ButtonSizeExamples;
|
|
8
|
+
exports.ButtonIconExamples = ButtonIconExamples;
|
|
9
|
+
exports.ButtonStateExamples = ButtonStateExamples;
|
|
10
|
+
exports.ButtonCombinedExamples = ButtonCombinedExamples;
|
|
11
|
+
exports.ButtonNativeSkinExamples = ButtonNativeSkinExamples;
|
|
12
|
+
exports.ButtonInteractiveExamples = ButtonInteractiveExamples;
|
|
13
|
+
exports.ButtonAccessibilityExamples = ButtonAccessibilityExamples;
|
|
14
|
+
exports.ButtonCustomStylingExamples = ButtonCustomStylingExamples;
|
|
15
|
+
exports.AllButtonExamples = AllButtonExamples;
|
|
16
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const button_skin_tailwind_1 = require("./button-skin-tailwind");
|
|
19
|
+
const button_skin_native_1 = require("./button-skin-native");
|
|
20
|
+
function ButtonVariantExamples() {
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "primary", children: "Primary" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "secondary", children: "Secondary" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "outline", children: "Outline" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "ghost", children: "Ghost" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "danger", children: "Danger" })] }));
|
|
22
|
+
}
|
|
23
|
+
function ButtonSizeExamples() {
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 items-center flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { size: "sm", children: "Small" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { size: "md", children: "Medium" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { size: "lg", children: "Large" })] }));
|
|
25
|
+
}
|
|
26
|
+
function ButtonIconExamples() {
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { leftIcon: (0, jsx_runtime_1.jsx)("span", { children: "\u2190" }), children: "Back" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { rightIcon: (0, jsx_runtime_1.jsx)("span", { children: "\u2192" }), children: "Next" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { leftIcon: (0, jsx_runtime_1.jsx)("span", { children: "\u2713" }), rightIcon: (0, jsx_runtime_1.jsx)("span", { children: "\u2193" }), children: "Confirm" })] }));
|
|
28
|
+
}
|
|
29
|
+
function ButtonStateExamples() {
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { children: "Normal" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { disabled: true, children: "Disabled" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { isLoading: true, children: "Loading..." })] }));
|
|
31
|
+
}
|
|
32
|
+
function ButtonCombinedExamples() {
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 items-center flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "primary", size: "sm", children: "Small Primary" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "primary", size: "md", children: "Medium Primary" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "primary", size: "lg", children: "Large Primary" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "secondary", leftIcon: (0, jsx_runtime_1.jsx)("span", { children: "+" }), children: "Add" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "secondary", rightIcon: (0, jsx_runtime_1.jsx)("span", { children: "\u2715" }), children: "Close" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "outline", children: "Normal" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "outline", disabled: true, children: "Disabled" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "outline", isLoading: true, children: "Loading..." })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "danger", leftIcon: (0, jsx_runtime_1.jsx)("span", { children: "\u26A0" }), children: "Warning" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "danger", rightIcon: (0, jsx_runtime_1.jsx)("span", { children: "\uD83D\uDDD1" }), children: "Delete" })] })] }));
|
|
34
|
+
}
|
|
35
|
+
function ButtonNativeSkinExamples() {
|
|
36
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_native_1.ButtonNative, { variant: "primary", children: "Primary Native" }), (0, jsx_runtime_1.jsx)(button_skin_native_1.ButtonNative, { variant: "secondary", children: "Secondary Native" }), (0, jsx_runtime_1.jsx)(button_skin_native_1.ButtonNative, { variant: "outline", children: "Outline Native" }), (0, jsx_runtime_1.jsx)(button_skin_native_1.ButtonNative, { variant: "ghost", children: "Ghost Native" }), (0, jsx_runtime_1.jsx)(button_skin_native_1.ButtonNative, { variant: "danger", children: "Danger Native" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 items-center flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_native_1.ButtonNative, { size: "sm", children: "Small" }), (0, jsx_runtime_1.jsx)(button_skin_native_1.ButtonNative, { size: "md", children: "Medium" }), (0, jsx_runtime_1.jsx)(button_skin_native_1.ButtonNative, { size: "lg", children: "Large" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_native_1.ButtonNative, { leftIcon: (0, jsx_runtime_1.jsx)("span", { children: "\u2190" }), children: "Back" }), (0, jsx_runtime_1.jsx)(button_skin_native_1.ButtonNative, { rightIcon: (0, jsx_runtime_1.jsx)("span", { children: "\u2192" }), children: "Next" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_native_1.ButtonNative, { disabled: true, children: "Disabled" }), (0, jsx_runtime_1.jsx)(button_skin_native_1.ButtonNative, { isLoading: true, children: "Loading..." })] })] }));
|
|
37
|
+
}
|
|
38
|
+
function ButtonInteractiveExamples() {
|
|
39
|
+
const [isLoading, setIsLoading] = react_1.default.useState(false);
|
|
40
|
+
const [count, setCount] = react_1.default.useState(0);
|
|
41
|
+
const handleClick = () => {
|
|
42
|
+
setIsLoading(true);
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
setIsLoading(false);
|
|
45
|
+
setCount(c => c + 1);
|
|
46
|
+
}, 1000);
|
|
47
|
+
};
|
|
48
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 items-center flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { onClick: () => alert('Clicked!'), children: "Click Me" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { isLoading: isLoading, onClick: handleClick, children: isLoading ? 'Loading...' : `Click to increment (${count})` })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex gap-4 items-center flex-wrap", children: (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { variant: "danger", onClick: () => {
|
|
49
|
+
if (confirm('Are you sure?')) {
|
|
50
|
+
alert('Deleted!');
|
|
51
|
+
}
|
|
52
|
+
}, children: "Delete with Confirmation" }) })] }));
|
|
53
|
+
}
|
|
54
|
+
function ButtonAccessibilityExamples() {
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { "aria-label": "Close dialog", children: "\u2715" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { "aria-describedby": "help-text", children: "Submit" })] }), (0, jsx_runtime_1.jsx)("p", { id: "help-text", className: "text-sm text-gray-600", children: "This button submits the form" })] }));
|
|
56
|
+
}
|
|
57
|
+
function ButtonCustomStylingExamples() {
|
|
58
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 flex-wrap", children: [(0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { className: "shadow-lg", children: "With Shadow" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { className: "rounded-full", children: "Rounded Full" }), (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { className: "w-full", children: "Full Width" })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex gap-4 items-center flex-wrap", children: (0, jsx_runtime_1.jsx)(button_skin_tailwind_1.ButtonTailwind, { style: {
|
|
59
|
+
backgroundColor: '#8B5CF6',
|
|
60
|
+
color: 'white',
|
|
61
|
+
borderRadius: '8px',
|
|
62
|
+
}, children: "Custom Style" }) })] }));
|
|
63
|
+
}
|
|
64
|
+
function AllButtonExamples() {
|
|
65
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-8 p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "p-4 border rounded space-y-2", children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-bold", children: "Variants" }), (0, jsx_runtime_1.jsx)(ButtonVariantExamples, {})] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 border rounded space-y-2", children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-bold", children: "Sizes" }), (0, jsx_runtime_1.jsx)(ButtonSizeExamples, {})] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 border rounded space-y-2", children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-bold", children: "Icons" }), (0, jsx_runtime_1.jsx)(ButtonIconExamples, {})] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 border rounded space-y-2", children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-bold", children: "States" }), (0, jsx_runtime_1.jsx)(ButtonStateExamples, {})] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 border rounded space-y-2", children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-bold", children: "Combined" }), (0, jsx_runtime_1.jsx)(ButtonCombinedExamples, {})] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 border rounded space-y-2", children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-bold", children: "Native Skin" }), (0, jsx_runtime_1.jsx)(ButtonNativeSkinExamples, {})] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 border rounded space-y-2", children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-bold", children: "Interactive" }), (0, jsx_runtime_1.jsx)(ButtonInteractiveExamples, {})] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 border rounded space-y-2", children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-bold", children: "Accessibility" }), (0, jsx_runtime_1.jsx)(ButtonAccessibilityExamples, {})] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 border rounded space-y-2", children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-bold", children: "Custom Styling" }), (0, jsx_runtime_1.jsx)(ButtonCustomStylingExamples, {})] })] }));
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=button-examples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-examples.js","sourceRoot":"","sources":["../../../../src/components/button/button-examples.tsx"],"names":[],"mappings":";;;;;AAeA,sDAUC;AAMD,gDAQC;AAMD,gDAaC;AAMD,kDAQC;AAMD,wDA8BC;AAMD,4DA4BC;AAMD,8DAwCC;AAMD,kEAgBC;AAMD,kEA4BC;AAMD,8CAi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AAC,WAAW,yBAAc,EACvC,uBAAC,qBAAqB,KAAG,IACrB,EAEN,iCAAK,SAAS,EAAC,8BAA8B,aAC3C,+BAAI,SAAS,EAAC,WAAW,sBAAW,EACpC,uBAAC,kBAAkB,KAAG,IAClB,EAEN,iCAAK,SAAS,EAAC,8BAA8B,aAC3C,+BAAI,SAAS,EAAC,WAAW,sBAAW,EACpC,uBAAC,kBAAkB,KAAG,IAClB,EAEN,iCAAK,SAAS,EAAC,8BAA8B,aAC3C,+BAAI,SAAS,EAAC,WAAW,uBAAY,EACrC,uBAAC,mBAAmB,KAAG,IACnB,EAEN,iCAAK,SAAS,EAAC,8BAA8B,aAC3C,+BAAI,SAAS,EAAC,WAAW,yBAAc,EACvC,uBAAC,sBAAsB,KAAG,IACtB,EAEN,iCAAK,SAAS,EAAC,8BAA8B,aAC3C,+BAAI,SAAS,EAAC,WAAW,4BAAiB,EAC1C,uBAAC,wBAAwB,KAAG,IACxB,EAEN,iCAAK,SAAS,EAAC,8BAA8B,aAC3C,+BAAI,SAAS,EAAC,WAAW,4BAAiB,EAC1C,uBAAC,yBAAyB,KAAG,IACzB,EAEN,iCAAK,SAAS,EAAC,8BAA8B,aAC3C,+BAAI,SAAS,EAAC,WAAW,8BAAmB,EAC5C,uBAAC,2BAA2B,KAAG,IAC3B,EAEN,iCAAK,SAAS,EAAC,8BAA8B,aAC3C,+BAAI,SAAS,EAAC,WAAW,+BAAoB,EAC7C,uBAAC,2BAA2B,KAAG,IAC3B,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare const buttonSkinContractDef: {
|
|
3
|
+
readonly id: "contract_button_skin_v1";
|
|
4
|
+
readonly name: "button-skin";
|
|
5
|
+
readonly category: "ui.skin";
|
|
6
|
+
readonly description: "Visual contract for button skin implementations";
|
|
7
|
+
readonly variants: {
|
|
8
|
+
readonly primary: {
|
|
9
|
+
readonly backgroundColor: "var(--color-primary-main)";
|
|
10
|
+
readonly color: "var(--color-primary-contrast)";
|
|
11
|
+
readonly hover: {
|
|
12
|
+
readonly backgroundColor: "var(--color-primary-hover)";
|
|
13
|
+
};
|
|
14
|
+
readonly focus: {
|
|
15
|
+
readonly outline: "var(--shadow-focus-ring) var(--color-primary-focus)";
|
|
16
|
+
readonly outlineOffset: "2px";
|
|
17
|
+
readonly ringColor: "var(--color-primary-focus)";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
readonly secondary: {
|
|
21
|
+
readonly backgroundColor: "var(--color-secondary-main)";
|
|
22
|
+
readonly color: "var(--color-secondary-contrast)";
|
|
23
|
+
readonly hover: {
|
|
24
|
+
readonly backgroundColor: "var(--color-secondary-hover)";
|
|
25
|
+
};
|
|
26
|
+
readonly focus: {
|
|
27
|
+
readonly outline: "var(--shadow-focus-ring) var(--color-secondary-focus)";
|
|
28
|
+
readonly outlineOffset: "2px";
|
|
29
|
+
readonly ringColor: "var(--color-secondary-focus)";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
readonly outline: {
|
|
33
|
+
readonly backgroundColor: "transparent";
|
|
34
|
+
readonly borderColor: "var(--color-neutral-border)";
|
|
35
|
+
readonly color: "var(--color-neutral-text)";
|
|
36
|
+
readonly hover: {
|
|
37
|
+
readonly backgroundColor: "var(--color-neutral-bg)";
|
|
38
|
+
};
|
|
39
|
+
readonly focus: {
|
|
40
|
+
readonly outline: "var(--shadow-focus-ring) var(--color-primary-focus)";
|
|
41
|
+
readonly outlineOffset: "2px";
|
|
42
|
+
readonly ringColor: "var(--color-primary-focus)";
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly ghost: {
|
|
46
|
+
readonly backgroundColor: "transparent";
|
|
47
|
+
readonly color: "var(--color-neutral-text)";
|
|
48
|
+
readonly hover: {
|
|
49
|
+
readonly backgroundColor: "var(--color-secondary-main)";
|
|
50
|
+
};
|
|
51
|
+
readonly focus: {
|
|
52
|
+
readonly outline: "var(--shadow-focus-ring) var(--color-secondary-focus)";
|
|
53
|
+
readonly outlineOffset: "2px";
|
|
54
|
+
readonly ringColor: "var(--color-secondary-focus)";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly danger: {
|
|
58
|
+
readonly backgroundColor: "var(--color-danger-main)";
|
|
59
|
+
readonly color: "var(--color-danger-contrast)";
|
|
60
|
+
readonly hover: {
|
|
61
|
+
readonly backgroundColor: "var(--color-danger-hover)";
|
|
62
|
+
};
|
|
63
|
+
readonly focus: {
|
|
64
|
+
readonly outline: "var(--shadow-focus-ring) var(--color-danger-focus)";
|
|
65
|
+
readonly outlineOffset: "2px";
|
|
66
|
+
readonly ringColor: "var(--color-danger-focus)";
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
readonly sizes: {
|
|
71
|
+
readonly sm: {
|
|
72
|
+
readonly height: "32px";
|
|
73
|
+
readonly padding: "0 12px";
|
|
74
|
+
readonly fontSize: "0.75rem";
|
|
75
|
+
readonly iconSize: "14px";
|
|
76
|
+
};
|
|
77
|
+
readonly md: {
|
|
78
|
+
readonly height: "40px";
|
|
79
|
+
readonly padding: "0 16px";
|
|
80
|
+
readonly fontSize: "0.875rem";
|
|
81
|
+
readonly iconSize: "16px";
|
|
82
|
+
};
|
|
83
|
+
readonly lg: {
|
|
84
|
+
readonly height: "48px";
|
|
85
|
+
readonly padding: "0 24px";
|
|
86
|
+
readonly fontSize: "1rem";
|
|
87
|
+
readonly iconSize: "20px";
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
readonly base: {
|
|
91
|
+
readonly display: "inline-flex";
|
|
92
|
+
readonly alignItems: "center";
|
|
93
|
+
readonly justifyContent: "center";
|
|
94
|
+
readonly borderRadius: "6px";
|
|
95
|
+
readonly border: "1px solid transparent";
|
|
96
|
+
readonly cursor: "pointer";
|
|
97
|
+
readonly transition: "all 0.2s ease";
|
|
98
|
+
readonly fontWeight: "500";
|
|
99
|
+
};
|
|
100
|
+
readonly disabled: {
|
|
101
|
+
readonly opacity: "0.5";
|
|
102
|
+
readonly cursor: "not-allowed";
|
|
103
|
+
};
|
|
104
|
+
readonly icons: {
|
|
105
|
+
readonly leftSpacing: "8px";
|
|
106
|
+
readonly rightSpacing: "8px";
|
|
107
|
+
readonly ariaHidden: true;
|
|
108
|
+
};
|
|
109
|
+
readonly loader: {
|
|
110
|
+
readonly size: "16px";
|
|
111
|
+
readonly borderWidth: "2px";
|
|
112
|
+
readonly animation: "spin";
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export type ButtonSkinVariant = keyof typeof buttonSkinContractDef.variants;
|
|
116
|
+
export type ButtonSkinSize = keyof typeof buttonSkinContractDef.sizes;
|
|
117
|
+
export type VariantVisualProperties = typeof buttonSkinContractDef.variants[ButtonSkinVariant];
|
|
118
|
+
export type SizeSpecifications = typeof buttonSkinContractDef.sizes[ButtonSkinSize];
|
|
119
|
+
export type BaseStyles = typeof buttonSkinContractDef.base;
|
|
120
|
+
export type DisabledStyles = typeof buttonSkinContractDef.disabled;
|
|
121
|
+
export type IconBehavior = typeof buttonSkinContractDef.icons;
|
|
122
|
+
export type LoaderBehavior = typeof buttonSkinContractDef.loader;
|
|
123
|
+
export interface ButtonSkinContract {
|
|
124
|
+
variant?: ButtonSkinVariant;
|
|
125
|
+
size?: ButtonSkinSize;
|
|
126
|
+
disabled?: boolean;
|
|
127
|
+
isLoading?: boolean;
|
|
128
|
+
leftIcon?: ReactNode;
|
|
129
|
+
rightIcon?: ReactNode;
|
|
130
|
+
className?: string;
|
|
131
|
+
style?: React.CSSProperties;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=button-skin-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-skin-contract.d.ts","sourceRoot":"","sources":["../../../../src/components/button/button-skin-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAalC,eAA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= require("../../theme/design-tokens");
|
|
5
|
+
exports.buttonSkinContractDef = {
|
|
6
|
+
id: "contract_button_skin_v1",
|
|
7
|
+
name: "button-skin",
|
|
8
|
+
category: "ui.skin",
|
|
9
|
+
description: "Visual contract for button skin implementations",
|
|
10
|
+
variants: {
|
|
11
|
+
primary: {
|
|
12
|
+
backgroundColor: design_tokens_1.tokens.colors.primary.main,
|
|
13
|
+
color: design_tokens_1.tokens.colors.primary.contrastText,
|
|
14
|
+
hover: {
|
|
15
|
+
backgroundColor: design_tokens_1.tokens.colors.primary.hover,
|
|
16
|
+
},
|
|
17
|
+
focus: {
|
|
18
|
+
outline: `${design_tokens_1.tokens.shadows.focusRing} ${design_tokens_1.tokens.colors.primary.focus}`,
|
|
19
|
+
outlineOffset: design_tokens_1.tokens.ui.outlineOffset,
|
|
20
|
+
ringColor: design_tokens_1.tokens.colors.primary.focus,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
secondary: {
|
|
24
|
+
backgroundColor: design_tokens_1.tokens.colors.secondary.main,
|
|
25
|
+
color: design_tokens_1.tokens.colors.secondary.contrastText,
|
|
26
|
+
hover: {
|
|
27
|
+
backgroundColor: design_tokens_1.tokens.colors.secondary.hover,
|
|
28
|
+
},
|
|
29
|
+
focus: {
|
|
30
|
+
outline: `${design_tokens_1.tokens.shadows.focusRing} ${design_tokens_1.tokens.colors.secondary.focus}`,
|
|
31
|
+
outlineOffset: design_tokens_1.tokens.ui.outlineOffset,
|
|
32
|
+
ringColor: design_tokens_1.tokens.colors.secondary.focus,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
outline: {
|
|
36
|
+
backgroundColor: design_tokens_1.tokens.colors.transparent,
|
|
37
|
+
borderColor: design_tokens_1.tokens.colors.neutral.border,
|
|
38
|
+
color: design_tokens_1.tokens.colors.neutral.text,
|
|
39
|
+
hover: {
|
|
40
|
+
backgroundColor: design_tokens_1.tokens.colors.neutral.bg,
|
|
41
|
+
},
|
|
42
|
+
focus: {
|
|
43
|
+
outline: `${design_tokens_1.tokens.shadows.focusRing} ${design_tokens_1.tokens.colors.primary.focus}`,
|
|
44
|
+
outlineOffset: design_tokens_1.tokens.ui.outlineOffset,
|
|
45
|
+
ringColor: design_tokens_1.tokens.colors.primary.focus,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
ghost: {
|
|
49
|
+
backgroundColor: design_tokens_1.tokens.colors.transparent,
|
|
50
|
+
color: design_tokens_1.tokens.colors.neutral.text,
|
|
51
|
+
hover: {
|
|
52
|
+
backgroundColor: design_tokens_1.tokens.colors.secondary.main,
|
|
53
|
+
},
|
|
54
|
+
focus: {
|
|
55
|
+
outline: `${design_tokens_1.tokens.shadows.focusRing} ${design_tokens_1.tokens.colors.secondary.focus}`,
|
|
56
|
+
outlineOffset: design_tokens_1.tokens.ui.outlineOffset,
|
|
57
|
+
ringColor: design_tokens_1.tokens.colors.secondary.focus,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
danger: {
|
|
61
|
+
backgroundColor: design_tokens_1.tokens.colors.danger.main,
|
|
62
|
+
color: design_tokens_1.tokens.colors.danger.contrastText,
|
|
63
|
+
hover: {
|
|
64
|
+
backgroundColor: design_tokens_1.tokens.colors.danger.hover,
|
|
65
|
+
},
|
|
66
|
+
focus: {
|
|
67
|
+
outline: `${design_tokens_1.tokens.shadows.focusRing} ${design_tokens_1.tokens.colors.danger.focus}`,
|
|
68
|
+
outlineOffset: design_tokens_1.tokens.ui.outlineOffset,
|
|
69
|
+
ringColor: design_tokens_1.tokens.colors.danger.focus,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
sizes: {
|
|
74
|
+
sm: {
|
|
75
|
+
height: design_tokens_1.tokens.sizing[8],
|
|
76
|
+
padding: `0 ${design_tokens_1.tokens.spacing[3]}`,
|
|
77
|
+
fontSize: design_tokens_1.tokens.typography.fontSize.xs,
|
|
78
|
+
iconSize: design_tokens_1.tokens.sizing.icon.sm,
|
|
79
|
+
},
|
|
80
|
+
md: {
|
|
81
|
+
height: design_tokens_1.tokens.sizing[10],
|
|
82
|
+
padding: `0 ${design_tokens_1.tokens.spacing[4]}`,
|
|
83
|
+
fontSize: design_tokens_1.tokens.typography.fontSize.sm,
|
|
84
|
+
iconSize: design_tokens_1.tokens.sizing.icon.md,
|
|
85
|
+
},
|
|
86
|
+
lg: {
|
|
87
|
+
height: design_tokens_1.tokens.sizing[12],
|
|
88
|
+
padding: `0 ${design_tokens_1.tokens.spacing[6]}`,
|
|
89
|
+
fontSize: design_tokens_1.tokens.typography.fontSize.base,
|
|
90
|
+
iconSize: design_tokens_1.tokens.sizing.icon.lg,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
base: {
|
|
94
|
+
display: 'inline-flex',
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
justifyContent: 'center',
|
|
97
|
+
borderRadius: design_tokens_1.tokens.borderRadius.md,
|
|
98
|
+
border: `1px solid ${design_tokens_1.tokens.colors.transparent}`,
|
|
99
|
+
cursor: 'pointer',
|
|
100
|
+
transition: design_tokens_1.tokens.transition.base,
|
|
101
|
+
fontWeight: design_tokens_1.tokens.typography.fontWeight.medium,
|
|
102
|
+
},
|
|
103
|
+
disabled: {
|
|
104
|
+
opacity: design_tokens_1.tokens.opacity.disabled,
|
|
105
|
+
cursor: 'not-allowed',
|
|
106
|
+
},
|
|
107
|
+
icons: {
|
|
108
|
+
leftSpacing: design_tokens_1.tokens.spacing[2],
|
|
109
|
+
rightSpacing: design_tokens_1.tokens.spacing[2],
|
|
110
|
+
ariaHidden: true,
|
|
111
|
+
},
|
|
112
|
+
loader: {
|
|
113
|
+
size: design_tokens_1.tokens.sizing.icon.md,
|
|
114
|
+
borderWidth: design_tokens_1.tokens.ui.outlineWidth,
|
|
115
|
+
animation: 'spin',
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=button-skin-contract.js.map
|