@postenbring/hedwig-react 0.0.0-refactor-tokens-20231112181830

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.
@@ -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,
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,8 @@
1
+ import {
2
+ PrimaryButton,
3
+ SecondaryButton
4
+ } from "../chunk-4ON435S5.mjs";
5
+ export {
6
+ PrimaryButton,
7
+ SecondaryButton
8
+ };
@@ -0,0 +1,99 @@
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,
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
+ PrimaryButton,
98
+ SecondaryButton
99
+ };
@@ -0,0 +1,3 @@
1
+ export { PrimaryButton, SecondaryButton } from './button/index.mjs';
2
+ import 'react/jsx-runtime';
3
+ import 'react';
@@ -0,0 +1,3 @@
1
+ export { PrimaryButton, SecondaryButton } from './button/index.js';
2
+ import 'react/jsx-runtime';
3
+ import 'react';
package/dist/index.js ADDED
@@ -0,0 +1,123 @@
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
+ PrimaryButton: () => PrimaryButton,
53
+ SecondaryButton: () => SecondaryButton
54
+ });
55
+ module.exports = __toCommonJS(src_exports);
56
+
57
+ // src/button/index.tsx
58
+ var import_tokens = require("@postenbring/hedwig-tokens/tokens-output/css/tokens.css");
59
+ var import_base = require("@postenbring/hedwig-css/dist/base.css");
60
+ var import_button = require("@postenbring/hedwig-css/dist/button/button.css");
61
+
62
+ // src/button/button.tsx
63
+ var import_clsx = require("clsx");
64
+
65
+ // src/utils.ts
66
+ function warnForStyleOverrides(props) {
67
+ if (props.className) {
68
+ console.warn("Overriding styles are not premited");
69
+ }
70
+ if (props.styles) {
71
+ console.warn("Overriding styles are not premited");
72
+ }
73
+ }
74
+
75
+ // src/button/button.tsx
76
+ var import_jsx_runtime = require("react/jsx-runtime");
77
+ function BaseButton(_a) {
78
+ var _b = _a, {
79
+ children,
80
+ variant,
81
+ size = "medium",
82
+ fullWidth = false,
83
+ fill = "contained",
84
+ buttonRef
85
+ } = _b, rest = __objRest(_b, [
86
+ "children",
87
+ "variant",
88
+ "size",
89
+ "fullWidth",
90
+ "fill",
91
+ "buttonRef"
92
+ ]);
93
+ warnForStyleOverrides(rest);
94
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
95
+ "button",
96
+ __spreadProps(__spreadValues({
97
+ className: (0, import_clsx.clsx)("hds-button", `hds-button--${size}`, {
98
+ [`hds-button--${variant}`]: fill === "contained",
99
+ [`hds-button--outline-${variant}`]: fill === "outlined",
100
+ "hds-button--full": fullWidth,
101
+ "hds-button--mobile-full": fullWidth === "mobile"
102
+ }),
103
+ ref: buttonRef,
104
+ type: "button"
105
+ }, rest), {
106
+ children
107
+ })
108
+ );
109
+ }
110
+ BaseButton.displayName = "BaseButton";
111
+ function PrimaryButton(props) {
112
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseButton, __spreadProps(__spreadValues({}, props), { variant: "primary" }));
113
+ }
114
+ PrimaryButton.displayName = "PrimaryButton";
115
+ function SecondaryButton(props) {
116
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseButton, __spreadProps(__spreadValues({}, props), { variant: "secondary" }));
117
+ }
118
+ SecondaryButton.displayName = "SecondaryButton";
119
+ // Annotate the CommonJS export names for ESM import in node:
120
+ 0 && (module.exports = {
121
+ PrimaryButton,
122
+ SecondaryButton
123
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,8 @@
1
+ import {
2
+ PrimaryButton,
3
+ SecondaryButton
4
+ } from "./chunk-4ON435S5.mjs";
5
+ export {
6
+ PrimaryButton,
7
+ SecondaryButton
8
+ };
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@postenbring/hedwig-react",
3
+ "version": "0.0.0-refactor-tokens-20231112181830",
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-refactor-tokens-20231112181830",
30
+ "@postenbring/hedwig-tokens": "0.0.0-refactor-tokens-20231112181830",
31
+ "clsx": "2.0.0"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ }
36
+ }