@postenbring/hedwig-react 0.0.0-link-component-20231112202102
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/button/index.d.mts +37 -0
- package/dist/button/index.d.ts +37 -0
- package/dist/button/index.js +121 -0
- package/dist/button/index.mjs +8 -0
- package/dist/chunk-ZPSTPWVB.mjs +103 -0
- package/dist/index.d.mts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +161 -0
- package/dist/index.mjs +49 -0
- package/package.json +36 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "style"> {
|
|
5
|
+
/**
|
|
6
|
+
* The height, font size and padding of the button
|
|
7
|
+
*/
|
|
8
|
+
size?: "small" | "medium" | "large";
|
|
9
|
+
/**
|
|
10
|
+
* Make the button use 100% width available.
|
|
11
|
+
* Using the "mobile" it only stretch to full width on smaller screens
|
|
12
|
+
*/
|
|
13
|
+
fullWidth?: boolean | "mobile";
|
|
14
|
+
/**
|
|
15
|
+
* The background of the button.
|
|
16
|
+
*/
|
|
17
|
+
fill?: "contained" | "outlined";
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
buttonRef?: React.ForwardedRef<HTMLButtonElement>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* ## TODO
|
|
23
|
+
*
|
|
24
|
+
* - [ ] Handle links that looks like buttons
|
|
25
|
+
* - [ ] Revisit how to handle outline
|
|
26
|
+
* - [ ] Figure out outline-white
|
|
27
|
+
*/
|
|
28
|
+
declare function PrimaryButton(props: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
29
|
+
declare namespace PrimaryButton {
|
|
30
|
+
var displayName: string;
|
|
31
|
+
}
|
|
32
|
+
declare function SecondaryButton(props: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
33
|
+
declare namespace SecondaryButton {
|
|
34
|
+
var displayName: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { PrimaryButton, SecondaryButton };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "style"> {
|
|
5
|
+
/**
|
|
6
|
+
* The height, font size and padding of the button
|
|
7
|
+
*/
|
|
8
|
+
size?: "small" | "medium" | "large";
|
|
9
|
+
/**
|
|
10
|
+
* Make the button use 100% width available.
|
|
11
|
+
* Using the "mobile" it only stretch to full width on smaller screens
|
|
12
|
+
*/
|
|
13
|
+
fullWidth?: boolean | "mobile";
|
|
14
|
+
/**
|
|
15
|
+
* The background of the button.
|
|
16
|
+
*/
|
|
17
|
+
fill?: "contained" | "outlined";
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
buttonRef?: React.ForwardedRef<HTMLButtonElement>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* ## TODO
|
|
23
|
+
*
|
|
24
|
+
* - [ ] Handle links that looks like buttons
|
|
25
|
+
* - [ ] Revisit how to handle outline
|
|
26
|
+
* - [ ] Figure out outline-white
|
|
27
|
+
*/
|
|
28
|
+
declare function PrimaryButton(props: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
29
|
+
declare namespace PrimaryButton {
|
|
30
|
+
var displayName: string;
|
|
31
|
+
}
|
|
32
|
+
declare function SecondaryButton(props: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
33
|
+
declare namespace SecondaryButton {
|
|
34
|
+
var displayName: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { PrimaryButton, SecondaryButton };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/button/index.tsx
|
|
50
|
+
var button_exports = {};
|
|
51
|
+
__export(button_exports, {
|
|
52
|
+
PrimaryButton: () => PrimaryButton,
|
|
53
|
+
SecondaryButton: () => SecondaryButton
|
|
54
|
+
});
|
|
55
|
+
module.exports = __toCommonJS(button_exports);
|
|
56
|
+
var import_tokens = require("@postenbring/hedwig-tokens/tokens-output/css/tokens.css");
|
|
57
|
+
var import_base = require("@postenbring/hedwig-css/dist/base.css");
|
|
58
|
+
var import_button = require("@postenbring/hedwig-css/dist/button/button.css");
|
|
59
|
+
|
|
60
|
+
// src/button/button.tsx
|
|
61
|
+
var import_clsx = require("clsx");
|
|
62
|
+
|
|
63
|
+
// src/utils.ts
|
|
64
|
+
function warnForStyleOverrides(props) {
|
|
65
|
+
if (props.className) {
|
|
66
|
+
console.warn("Overriding styles are not premited");
|
|
67
|
+
}
|
|
68
|
+
if (props.styles) {
|
|
69
|
+
console.warn("Overriding styles are not premited");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/button/button.tsx
|
|
74
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
75
|
+
function BaseButton(_a) {
|
|
76
|
+
var _b = _a, {
|
|
77
|
+
children,
|
|
78
|
+
variant,
|
|
79
|
+
size = "medium",
|
|
80
|
+
fullWidth = false,
|
|
81
|
+
fill = "contained",
|
|
82
|
+
buttonRef
|
|
83
|
+
} = _b, rest = __objRest(_b, [
|
|
84
|
+
"children",
|
|
85
|
+
"variant",
|
|
86
|
+
"size",
|
|
87
|
+
"fullWidth",
|
|
88
|
+
"fill",
|
|
89
|
+
"buttonRef"
|
|
90
|
+
]);
|
|
91
|
+
warnForStyleOverrides(rest);
|
|
92
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
93
|
+
"button",
|
|
94
|
+
__spreadProps(__spreadValues({
|
|
95
|
+
className: (0, import_clsx.clsx)("hds-button", `hds-button--${size}`, {
|
|
96
|
+
[`hds-button--${variant}`]: fill === "contained",
|
|
97
|
+
[`hds-button--outline-${variant}`]: fill === "outlined",
|
|
98
|
+
"hds-button--full": fullWidth === true,
|
|
99
|
+
"hds-button--mobile-full": fullWidth === "mobile"
|
|
100
|
+
}),
|
|
101
|
+
ref: buttonRef,
|
|
102
|
+
type: "button"
|
|
103
|
+
}, rest), {
|
|
104
|
+
children
|
|
105
|
+
})
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
BaseButton.displayName = "BaseButton";
|
|
109
|
+
function PrimaryButton(props) {
|
|
110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseButton, __spreadProps(__spreadValues({}, props), { variant: "primary" }));
|
|
111
|
+
}
|
|
112
|
+
PrimaryButton.displayName = "PrimaryButton";
|
|
113
|
+
function SecondaryButton(props) {
|
|
114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseButton, __spreadProps(__spreadValues({}, props), { variant: "secondary" }));
|
|
115
|
+
}
|
|
116
|
+
SecondaryButton.displayName = "SecondaryButton";
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
PrimaryButton,
|
|
120
|
+
SecondaryButton
|
|
121
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/button/index.tsx
|
|
34
|
+
import "@postenbring/hedwig-tokens/tokens-output/css/tokens.css";
|
|
35
|
+
import "@postenbring/hedwig-css/dist/base.css";
|
|
36
|
+
import "@postenbring/hedwig-css/dist/button/button.css";
|
|
37
|
+
|
|
38
|
+
// src/button/button.tsx
|
|
39
|
+
import { clsx } from "clsx";
|
|
40
|
+
|
|
41
|
+
// src/utils.ts
|
|
42
|
+
function warnForStyleOverrides(props) {
|
|
43
|
+
if (props.className) {
|
|
44
|
+
console.warn("Overriding styles are not premited");
|
|
45
|
+
}
|
|
46
|
+
if (props.styles) {
|
|
47
|
+
console.warn("Overriding styles are not premited");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/button/button.tsx
|
|
52
|
+
import { jsx } from "react/jsx-runtime";
|
|
53
|
+
function BaseButton(_a) {
|
|
54
|
+
var _b = _a, {
|
|
55
|
+
children,
|
|
56
|
+
variant,
|
|
57
|
+
size = "medium",
|
|
58
|
+
fullWidth = false,
|
|
59
|
+
fill = "contained",
|
|
60
|
+
buttonRef
|
|
61
|
+
} = _b, rest = __objRest(_b, [
|
|
62
|
+
"children",
|
|
63
|
+
"variant",
|
|
64
|
+
"size",
|
|
65
|
+
"fullWidth",
|
|
66
|
+
"fill",
|
|
67
|
+
"buttonRef"
|
|
68
|
+
]);
|
|
69
|
+
warnForStyleOverrides(rest);
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
"button",
|
|
72
|
+
__spreadProps(__spreadValues({
|
|
73
|
+
className: clsx("hds-button", `hds-button--${size}`, {
|
|
74
|
+
[`hds-button--${variant}`]: fill === "contained",
|
|
75
|
+
[`hds-button--outline-${variant}`]: fill === "outlined",
|
|
76
|
+
"hds-button--full": fullWidth === true,
|
|
77
|
+
"hds-button--mobile-full": fullWidth === "mobile"
|
|
78
|
+
}),
|
|
79
|
+
ref: buttonRef,
|
|
80
|
+
type: "button"
|
|
81
|
+
}, rest), {
|
|
82
|
+
children
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
BaseButton.displayName = "BaseButton";
|
|
87
|
+
function PrimaryButton(props) {
|
|
88
|
+
return /* @__PURE__ */ jsx(BaseButton, __spreadProps(__spreadValues({}, props), { variant: "primary" }));
|
|
89
|
+
}
|
|
90
|
+
PrimaryButton.displayName = "PrimaryButton";
|
|
91
|
+
function SecondaryButton(props) {
|
|
92
|
+
return /* @__PURE__ */ jsx(BaseButton, __spreadProps(__spreadValues({}, props), { variant: "secondary" }));
|
|
93
|
+
}
|
|
94
|
+
SecondaryButton.displayName = "SecondaryButton";
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
__spreadValues,
|
|
98
|
+
__spreadProps,
|
|
99
|
+
__objRest,
|
|
100
|
+
warnForStyleOverrides,
|
|
101
|
+
PrimaryButton,
|
|
102
|
+
SecondaryButton
|
|
103
|
+
};
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export { PrimaryButton, SecondaryButton } from './button/index.mjs';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "className" | "style"> {
|
|
6
|
+
/**
|
|
7
|
+
* The visual style of the link
|
|
8
|
+
*/
|
|
9
|
+
variant?: "underline" | "solid" | "inverted" | "no-underline";
|
|
10
|
+
/**
|
|
11
|
+
* Font size of the link
|
|
12
|
+
*/
|
|
13
|
+
size?: "small" | "medium" | "large";
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
anchorRef?: React.ForwardedRef<HTMLAnchorElement>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ## TODO
|
|
19
|
+
*
|
|
20
|
+
* - [ ] Handle button styling
|
|
21
|
+
*/
|
|
22
|
+
declare function Link({ children, variant, size, anchorRef, ...rest }: LinkProps): react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare namespace Link {
|
|
24
|
+
var displayName: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { Link };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export { PrimaryButton, SecondaryButton } from './button/index.js';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "className" | "style"> {
|
|
6
|
+
/**
|
|
7
|
+
* The visual style of the link
|
|
8
|
+
*/
|
|
9
|
+
variant?: "underline" | "solid" | "inverted" | "no-underline";
|
|
10
|
+
/**
|
|
11
|
+
* Font size of the link
|
|
12
|
+
*/
|
|
13
|
+
size?: "small" | "medium" | "large";
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
anchorRef?: React.ForwardedRef<HTMLAnchorElement>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ## TODO
|
|
19
|
+
*
|
|
20
|
+
* - [ ] Handle button styling
|
|
21
|
+
*/
|
|
22
|
+
declare function Link({ children, variant, size, anchorRef, ...rest }: LinkProps): react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare namespace Link {
|
|
24
|
+
var displayName: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { Link };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/index.tsx
|
|
50
|
+
var src_exports = {};
|
|
51
|
+
__export(src_exports, {
|
|
52
|
+
Link: () => Link,
|
|
53
|
+
PrimaryButton: () => PrimaryButton,
|
|
54
|
+
SecondaryButton: () => SecondaryButton
|
|
55
|
+
});
|
|
56
|
+
module.exports = __toCommonJS(src_exports);
|
|
57
|
+
|
|
58
|
+
// src/button/index.tsx
|
|
59
|
+
var import_tokens = require("@postenbring/hedwig-tokens/tokens-output/css/tokens.css");
|
|
60
|
+
var import_base = require("@postenbring/hedwig-css/dist/base.css");
|
|
61
|
+
var import_button = require("@postenbring/hedwig-css/dist/button/button.css");
|
|
62
|
+
|
|
63
|
+
// src/button/button.tsx
|
|
64
|
+
var import_clsx = require("clsx");
|
|
65
|
+
|
|
66
|
+
// src/utils.ts
|
|
67
|
+
function warnForStyleOverrides(props) {
|
|
68
|
+
if (props.className) {
|
|
69
|
+
console.warn("Overriding styles are not premited");
|
|
70
|
+
}
|
|
71
|
+
if (props.styles) {
|
|
72
|
+
console.warn("Overriding styles are not premited");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// src/button/button.tsx
|
|
77
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
78
|
+
function BaseButton(_a) {
|
|
79
|
+
var _b = _a, {
|
|
80
|
+
children,
|
|
81
|
+
variant,
|
|
82
|
+
size = "medium",
|
|
83
|
+
fullWidth = false,
|
|
84
|
+
fill = "contained",
|
|
85
|
+
buttonRef
|
|
86
|
+
} = _b, rest = __objRest(_b, [
|
|
87
|
+
"children",
|
|
88
|
+
"variant",
|
|
89
|
+
"size",
|
|
90
|
+
"fullWidth",
|
|
91
|
+
"fill",
|
|
92
|
+
"buttonRef"
|
|
93
|
+
]);
|
|
94
|
+
warnForStyleOverrides(rest);
|
|
95
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
|
+
"button",
|
|
97
|
+
__spreadProps(__spreadValues({
|
|
98
|
+
className: (0, import_clsx.clsx)("hds-button", `hds-button--${size}`, {
|
|
99
|
+
[`hds-button--${variant}`]: fill === "contained",
|
|
100
|
+
[`hds-button--outline-${variant}`]: fill === "outlined",
|
|
101
|
+
"hds-button--full": fullWidth === true,
|
|
102
|
+
"hds-button--mobile-full": fullWidth === "mobile"
|
|
103
|
+
}),
|
|
104
|
+
ref: buttonRef,
|
|
105
|
+
type: "button"
|
|
106
|
+
}, rest), {
|
|
107
|
+
children
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
BaseButton.displayName = "BaseButton";
|
|
112
|
+
function PrimaryButton(props) {
|
|
113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseButton, __spreadProps(__spreadValues({}, props), { variant: "primary" }));
|
|
114
|
+
}
|
|
115
|
+
PrimaryButton.displayName = "PrimaryButton";
|
|
116
|
+
function SecondaryButton(props) {
|
|
117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseButton, __spreadProps(__spreadValues({}, props), { variant: "secondary" }));
|
|
118
|
+
}
|
|
119
|
+
SecondaryButton.displayName = "SecondaryButton";
|
|
120
|
+
|
|
121
|
+
// src/link/index.tsx
|
|
122
|
+
var import_tokens2 = require("@postenbring/hedwig-tokens/tokens-output/css/tokens.css");
|
|
123
|
+
var import_base2 = require("@postenbring/hedwig-css/dist/base.css");
|
|
124
|
+
var import_link = require("@postenbring/hedwig-css/dist/link/link.css");
|
|
125
|
+
|
|
126
|
+
// src/link/link.tsx
|
|
127
|
+
var import_clsx2 = require("clsx");
|
|
128
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
129
|
+
function Link(_a) {
|
|
130
|
+
var _b = _a, {
|
|
131
|
+
children,
|
|
132
|
+
variant = "underline",
|
|
133
|
+
size = "medium",
|
|
134
|
+
anchorRef
|
|
135
|
+
} = _b, rest = __objRest(_b, [
|
|
136
|
+
"children",
|
|
137
|
+
"variant",
|
|
138
|
+
"size",
|
|
139
|
+
"anchorRef"
|
|
140
|
+
]);
|
|
141
|
+
warnForStyleOverrides(rest);
|
|
142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
143
|
+
"a",
|
|
144
|
+
__spreadProps(__spreadValues({
|
|
145
|
+
className: (0, import_clsx2.clsx)("hds-link", {
|
|
146
|
+
[`hds-link--${variant}`]: variant !== "underline",
|
|
147
|
+
[`hds-link--${size}`]: size !== "medium"
|
|
148
|
+
}),
|
|
149
|
+
ref: anchorRef
|
|
150
|
+
}, rest), {
|
|
151
|
+
children
|
|
152
|
+
})
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
Link.displayName = "Link";
|
|
156
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
157
|
+
0 && (module.exports = {
|
|
158
|
+
Link,
|
|
159
|
+
PrimaryButton,
|
|
160
|
+
SecondaryButton
|
|
161
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PrimaryButton,
|
|
3
|
+
SecondaryButton,
|
|
4
|
+
__objRest,
|
|
5
|
+
__spreadProps,
|
|
6
|
+
__spreadValues,
|
|
7
|
+
warnForStyleOverrides
|
|
8
|
+
} from "./chunk-ZPSTPWVB.mjs";
|
|
9
|
+
|
|
10
|
+
// src/link/index.tsx
|
|
11
|
+
import "@postenbring/hedwig-tokens/tokens-output/css/tokens.css";
|
|
12
|
+
import "@postenbring/hedwig-css/dist/base.css";
|
|
13
|
+
import "@postenbring/hedwig-css/dist/link/link.css";
|
|
14
|
+
|
|
15
|
+
// src/link/link.tsx
|
|
16
|
+
import { clsx } from "clsx";
|
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
|
18
|
+
function Link(_a) {
|
|
19
|
+
var _b = _a, {
|
|
20
|
+
children,
|
|
21
|
+
variant = "underline",
|
|
22
|
+
size = "medium",
|
|
23
|
+
anchorRef
|
|
24
|
+
} = _b, rest = __objRest(_b, [
|
|
25
|
+
"children",
|
|
26
|
+
"variant",
|
|
27
|
+
"size",
|
|
28
|
+
"anchorRef"
|
|
29
|
+
]);
|
|
30
|
+
warnForStyleOverrides(rest);
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
"a",
|
|
33
|
+
__spreadProps(__spreadValues({
|
|
34
|
+
className: clsx("hds-link", {
|
|
35
|
+
[`hds-link--${variant}`]: variant !== "underline",
|
|
36
|
+
[`hds-link--${size}`]: size !== "medium"
|
|
37
|
+
}),
|
|
38
|
+
ref: anchorRef
|
|
39
|
+
}, rest), {
|
|
40
|
+
children
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
Link.displayName = "Link";
|
|
45
|
+
export {
|
|
46
|
+
Link,
|
|
47
|
+
PrimaryButton,
|
|
48
|
+
SecondaryButton
|
|
49
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@postenbring/hedwig-react",
|
|
3
|
+
"version": "0.0.0-link-component-20231112202102",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"module": "./dist/index.mjs",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/**"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsup --format esm,cjs --dts --external react",
|
|
14
|
+
"dev": "tsup --format esm,cjs --watch --dts --external react",
|
|
15
|
+
"lint": "eslint src/",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/react": "^18.2.37",
|
|
21
|
+
"@types/react-dom": "^18.2.15",
|
|
22
|
+
"eslint-config-custom": "*",
|
|
23
|
+
"hedwig-tsconfig": "*",
|
|
24
|
+
"react": "^18.2.0",
|
|
25
|
+
"tsup": "^7.2.0",
|
|
26
|
+
"typescript": "^5.2.2"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@postenbring/hedwig-css": "0.0.0-link-component-20231112202102",
|
|
30
|
+
"@postenbring/hedwig-tokens": "0.0.0-link-component-20231112202102",
|
|
31
|
+
"clsx": "2.0.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
}
|
|
36
|
+
}
|