@themodcraft/core-ui 1.1.0 → 1.1.2

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.
Files changed (52) hide show
  1. package/dist/components/button/Button.d.ts +1 -1
  2. package/dist/components/button/Button.js +72 -114
  3. package/dist/components/button/Button.module.css +1 -0
  4. package/dist/components/button/index.js +1 -1
  5. package/dist/components/checkbox/Checkbox.js +27 -45
  6. package/dist/components/checkbox/Checkbox.module.css +1 -0
  7. package/dist/components/checkbox/Switch.js +32 -77
  8. package/dist/components/checkbox/Switch.module.css +1 -0
  9. package/dist/components/checkbox/index.js +2 -2
  10. package/dist/components/code-block/CodeBlock.js +119 -53
  11. package/dist/components/code-block/CodeBlock.module.css +1 -0
  12. package/dist/components/code-block/index.js +1 -1
  13. package/dist/components/divider/Divider.d.ts +1 -1
  14. package/dist/components/divider/Divider.js +20 -34
  15. package/dist/components/divider/Divider.module.css +1 -0
  16. package/dist/components/divider/index.js +1 -1
  17. package/dist/components/radio/Radio.client.d.ts +2 -0
  18. package/dist/components/radio/Radio.client.js +142 -0
  19. package/dist/components/radio/Radio.d.ts +1 -1
  20. package/dist/components/radio/Radio.js +61 -76
  21. package/dist/components/radio/Radio.module.css +1 -0
  22. package/dist/components/radio/index.d.ts +1 -0
  23. package/dist/components/radio/index.js +2 -1
  24. package/dist/components/slider/Slider.js +31 -84
  25. package/dist/components/slider/Slider.module.css +1 -0
  26. package/dist/components/slider/index.js +1 -1
  27. package/dist/components/text-input/AuthFields.js +57 -11
  28. package/dist/components/text-input/TextArea.js +32 -17
  29. package/dist/components/text-input/TextInput.js +32 -13
  30. package/dist/components/text-input/TextInput.module.css +1 -0
  31. package/dist/components/text-input/contrast.client.d.ts +9 -0
  32. package/dist/components/text-input/contrast.client.js +132 -0
  33. package/dist/components/text-input/index.d.ts +1 -0
  34. package/dist/components/text-input/index.js +4 -3
  35. package/dist/components/text-input/shared.d.ts +1 -26
  36. package/dist/components/text-input/shared.js +4 -112
  37. package/dist/config/component-config.js +6 -4
  38. package/dist/index.js +16 -11
  39. package/dist/path-map/asset-path-map.js +28 -21
  40. package/dist/path-map/index.js +1 -1
  41. package/dist/styles/index.css +1 -67
  42. package/dist/tokens/default-theme.json.js +34 -0
  43. package/dist/tokens/index.js +1 -2
  44. package/dist/utils/color.js +49 -60
  45. package/package.json +7 -7
  46. package/dist/components/button/Button.types.js +0 -1
  47. package/dist/components/checkbox/Checkbox.types.js +0 -1
  48. package/dist/components/code-block/CodeBlock.types.js +0 -1
  49. package/dist/components/divider/Divider.types.js +0 -1
  50. package/dist/components/radio/Radio.types.js +0 -1
  51. package/dist/components/slider/Slider.types.js +0 -1
  52. package/dist/components/text-input/TextInput.types.js +0 -1
@@ -1,2 +1,2 @@
1
1
  import type { ButtonProps } from "./Button.types";
2
- export declare function Button({ active, btype, className, labeling, onClick, onMouseOver, size, tone, buttonStyleType, style, type, children, ...props }: ButtonProps): import("react").JSX.Element;
2
+ export declare function Button({ active, btype, className, disabled, labeling, size, tone, buttonStyleType, style, type, children, ...props }: ButtonProps): import("react").JSX.Element;
@@ -1,123 +1,81 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import styled from "@emotion/styled";
4
- import { darken, getReadableTextColor } from "../../utils/color";
1
+ import { getReadableTextColor, darken } from '../../utils/color.js';
2
+ import styles from './Button.module.css';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
5
  const toneToStyleType = {
6
- neutral: "normal",
7
- accent: "submit",
8
- danger: "danger",
9
- };
10
- const sizeStyles = {
11
- sm: {
12
- fontSize: "0.875rem",
13
- minHeight: "2rem",
14
- padding: "0 0.75rem",
15
- },
16
- md: {
17
- fontSize: "0.95rem",
18
- minHeight: "5vh",
19
- padding: "0 1rem",
20
- },
6
+ neutral: "normal",
7
+ accent: "submit",
8
+ danger: "danger"
21
9
  };
22
- const StyledButton = styled.button `
23
- --button-color: var(--tmc-color-surface-raised, #fbfcfe);
24
- --button-text-color: var(--tmc-color-text, #151821);
25
- --button-shadow-color: rgba(21, 24, 33, 0.18);
26
- --button-hover-color: var(--tmc-color-surface-muted, #e7ebf0);
27
- --button-focus-color: var(--tmc-color-focus, #d99a00);
28
- align-items: center;
29
- background-color: var(--button-color);
30
- border: none;
31
- border-radius: 15px;
32
- box-shadow:
33
- 3px 3px 6px 1px var(--button-shadow-color),
34
- inset -1px -1px 20px -8px var(--button-shadow-color);
35
- color: var(--button-text-color);
36
- cursor: pointer;
37
- display: inline-flex;
38
- font-size: ${({ $size }) => sizeStyles[$size].fontSize};
39
- font-weight: 600;
40
- gap: 0.5rem;
41
- height: auto;
42
- justify-content: center;
43
- margin: 10px;
44
- min-height: ${({ $size }) => sizeStyles[$size].minHeight};
45
- padding: ${({ $size }) => sizeStyles[$size].padding};
46
- transition:
47
- background-color 0.2s ease,
48
- box-shadow 0.2s ease,
49
- transform 0.2s ease;
50
- width: 100%;
51
-
52
- &:hover {
53
- background-color: var(--button-hover-color);
54
- }
55
-
56
- &:active {
57
- transform: translateY(1px);
58
- }
59
-
60
- &:focus-visible {
61
- outline: 2px solid var(--button-focus-color);
62
- outline-offset: 3px;
63
- }
64
-
65
- &:disabled,
66
- &[aria-disabled="true"] {
67
- cursor: not-allowed;
68
- opacity: 0.55;
69
- pointer-events: none;
70
- }
71
- `;
72
10
  function resolveButtonPalette(styleType) {
73
- switch (styleType) {
74
- case "submit":
75
- return getDynamicPalette("#2454D6");
76
- case "success":
77
- return getDynamicPalette("#1F9D55");
78
- case "warning":
79
- return getDynamicPalette("#D97706");
80
- case "danger":
81
- return getDynamicPalette("#DC2626");
82
- case "normal":
83
- default:
84
- return {
85
- background: "var(--tmc-button-surface, var(--tmc-color-surface-raised, #fbfcfe))",
86
- focus: "var(--tmc-button-focus, var(--tmc-color-focus, #d99a00))",
87
- hover: "var(--tmc-button-hover, var(--tmc-color-surface-muted, #e7ebf0))",
88
- shadow: "var(--tmc-button-shadow, rgba(21, 24, 33, 0.18))",
89
- text: "var(--tmc-button-text, var(--tmc-color-text, #151821))",
90
- };
91
- }
11
+ switch (styleType) {
12
+ case "submit":
13
+ return getDynamicPalette("#2454D6");
14
+ case "success":
15
+ return getDynamicPalette("#1F9D55");
16
+ case "warning":
17
+ return getDynamicPalette("#D97706");
18
+ case "danger":
19
+ return getDynamicPalette("#DC2626");
20
+ case "normal":
21
+ default:
22
+ return {
23
+ background: "var(--tmc-button-surface, var(--tmc-color-surface-raised, #fbfcfe))",
24
+ focus: "var(--tmc-button-focus, var(--tmc-color-focus, #d99a00))",
25
+ hover: "var(--tmc-button-hover, var(--tmc-color-surface-muted, #e7ebf0))",
26
+ shadow: "var(--tmc-button-shadow, rgba(21, 24, 33, 0.18))",
27
+ text: "var(--tmc-button-text, var(--tmc-color-text, #151821))"
28
+ };
29
+ }
92
30
  }
93
31
  function getDynamicPalette(background) {
94
- return {
95
- background,
96
- focus: darken(background, 28),
97
- hover: darken(background, 24),
98
- shadow: darken(background, 54),
99
- text: getReadableTextColor(background),
100
- };
32
+ return {
33
+ background,
34
+ focus: darken(background, 28),
35
+ hover: darken(background, 24),
36
+ shadow: darken(background, 54),
37
+ text: getReadableTextColor(background)
38
+ };
101
39
  }
102
40
  function isButtonActive(active) {
103
- return active !== false && active !== "false";
41
+ return active !== false && active !== "false";
42
+ }
43
+ function classNames(...classes) {
44
+ return classes.filter(Boolean).join(" ");
104
45
  }
105
- export function Button({ active = true, btype = "button", className, labeling, onClick, onMouseOver, size = "md", tone = "neutral", buttonStyleType = toneToStyleType[tone], style, type, children, ...props }) {
106
- const palette = resolveButtonPalette(buttonStyleType);
107
- const cssVariables = {
108
- "--button-color": palette.background,
109
- "--button-focus-color": palette.focus,
110
- "--button-hover-color": palette.hover,
111
- "--button-shadow-color": palette.shadow,
112
- "--button-text-color": palette.text,
113
- };
114
- return (_jsx(StyledButton, { "$size": size, className: className, onClick: (event) => {
115
- if (!isButtonActive(active)) {
116
- event.preventDefault();
117
- return;
118
- }
119
- onClick?.(event);
120
- }, onMouseOver: (event) => {
121
- onMouseOver?.(event);
122
- }, style: { ...cssVariables, ...style }, type: buttonStyleType === "submit" ? "submit" : (type ?? btype), ...props, children: children ?? labeling }));
46
+ function Button({
47
+ active = true,
48
+ btype = "button",
49
+ className,
50
+ disabled,
51
+ labeling,
52
+ size = "md",
53
+ tone = "neutral",
54
+ buttonStyleType = toneToStyleType[tone],
55
+ style,
56
+ type,
57
+ children,
58
+ ...props
59
+ }) {
60
+ const palette = resolveButtonPalette(buttonStyleType);
61
+ const cssVariables = {
62
+ "--button-color": palette.background,
63
+ "--button-focus-color": palette.focus,
64
+ "--button-hover-color": palette.hover,
65
+ "--button-shadow-color": palette.shadow,
66
+ "--button-text-color": palette.text
67
+ };
68
+ return /*#__PURE__*/jsx("button", {
69
+ className: classNames(styles.button, styles[size], className),
70
+ disabled: disabled || !isButtonActive(active),
71
+ style: {
72
+ ...cssVariables,
73
+ ...style
74
+ },
75
+ type: buttonStyleType === "submit" ? "submit" : type ?? btype,
76
+ ...props,
77
+ children: children ?? labeling
78
+ });
123
79
  }
80
+
81
+ export { Button };
@@ -0,0 +1 @@
1
+ .button{--button-color:var(--tmc-color-surface-raised,#fbfcfe);--button-text-color:var(--tmc-color-text,#151821);--button-shadow-color:rgba(21,24,33,.18);--button-hover-color:var(--tmc-color-surface-muted,#e7ebf0);--button-focus-color:var(--tmc-color-focus,#d99a00);align-items:center;background-color:var(--button-color);border:0;border-radius:15px;box-shadow:3px 3px 6px 1px var(--button-shadow-color),inset -1px -1px 20px -8px var(--button-shadow-color);color:var(--button-text-color);cursor:pointer;display:inline-flex;font-weight:600;gap:.5rem;height:auto;justify-content:center;margin:10px;transition:background-color .2s ease,box-shadow .2s ease,transform .2s ease;width:100%}.button:hover{background-color:var(--button-hover-color)}.button:active{transform:translateY(1px)}.button:focus-visible{outline:2px solid var(--button-focus-color);outline-offset:3px}.button:disabled,.button[aria-disabled=true]{cursor:not-allowed;opacity:.55;pointer-events:none}.sm{font-size:.875rem;min-height:2rem;padding:0 .75rem}.md{font-size:.95rem;min-height:5vh;padding:0 1rem}
@@ -1 +1 @@
1
- export { Button } from "./Button";
1
+ export { Button } from './Button.js';
@@ -1,47 +1,29 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import styled from "@emotion/styled";
4
- import { useContrastedFieldStyle } from "../text-input/shared";
5
- const CheckboxRoot = styled.label `
6
- align-items: flex-start;
7
- color: var(--tmc-field-label-text, var(--tmc-field-auto-text, var(--tmc-color-text, #151821)));
8
- cursor: pointer;
9
- display: inline-flex;
10
- gap: 0.7rem;
11
- `;
12
- const CheckboxInput = styled.input `
13
- accent-color: var(--cta-color, #30fa00);
14
- cursor: pointer;
15
- flex: 0 0 auto;
16
- height: 1.1rem;
17
- margin-top: 0.1rem;
18
- width: 1.1rem;
1
+ import styles from './Checkbox.module.css';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
19
3
 
20
- &:focus-visible {
21
- outline: 2px solid var(--cta-color, #30fa00);
22
- outline-offset: 3px;
23
- }
24
-
25
- &:disabled {
26
- cursor: not-allowed;
27
- opacity: 0.55;
28
- }
29
- `;
30
- const CheckboxCopy = styled.span `
31
- display: grid;
32
- gap: 0.2rem;
33
- line-height: 1.35;
34
- `;
35
- const CheckboxLabel = styled.span `
36
- color: inherit;
37
- font-size: 0.95rem;
38
- font-weight: 600;
39
- `;
40
- const CheckboxDescription = styled.span `
41
- color: var(--tmc-field-description-text, var(--tmc-color-text-muted, var(--tmc-field-auto-text, #5f6b7a)));
42
- font-size: 0.82rem;
43
- `;
44
- export function Checkbox({ description, label, children, ...props }) {
45
- const fieldStyle = useContrastedFieldStyle();
46
- return (_jsxs(CheckboxRoot, { ...fieldStyle, children: [_jsx(CheckboxInput, { type: "checkbox", ...props }), (label || description || children) && (_jsxs(CheckboxCopy, { children: [(label || children) && _jsx(CheckboxLabel, { children: label ?? children }), description && _jsx(CheckboxDescription, { children: description })] }))] }));
4
+ function Checkbox({
5
+ description,
6
+ label,
7
+ children,
8
+ ...props
9
+ }) {
10
+ return /*#__PURE__*/jsxs("label", {
11
+ className: styles.checkboxRoot,
12
+ children: [/*#__PURE__*/jsx("input", {
13
+ className: styles.checkboxInput,
14
+ type: "checkbox",
15
+ ...props
16
+ }), (label || description || children) && /*#__PURE__*/jsxs("span", {
17
+ className: styles.copy,
18
+ children: [(label || children) && /*#__PURE__*/jsx("span", {
19
+ className: styles.label,
20
+ children: label ?? children
21
+ }), description && /*#__PURE__*/jsx("span", {
22
+ className: styles.description,
23
+ children: description
24
+ })]
25
+ })]
26
+ });
47
27
  }
28
+
29
+ export { Checkbox };
@@ -0,0 +1 @@
1
+ .checkboxRoot{align-items:flex-start;color:var(--tmc-field-label-text,var(--tmc-field-auto-text,var(--tmc-color-text,#151821)));cursor:pointer;display:inline-flex;gap:.7rem}.checkboxInput{accent-color:var(--cta-color,#30fa00);cursor:pointer;flex:0 0 auto;height:1.1rem;margin-top:.1rem;width:1.1rem}.checkboxInput:focus-visible{outline:2px solid var(--cta-color,#30fa00);outline-offset:3px}.checkboxInput:disabled{cursor:not-allowed;opacity:.55}.copy{display:grid;gap:.2rem;line-height:1.35}.label{color:inherit;font-size:.95rem;font-weight:600}.description{color:var(--tmc-field-description-text,var(--tmc-color-text-muted,var(--tmc-field-auto-text,#5f6b7a)));font-size:.82rem}
@@ -1,79 +1,34 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import styled from "@emotion/styled";
4
- import { useContrastedFieldStyle } from "../text-input/shared";
5
- const SwitchRoot = styled.label `
6
- align-items: center;
7
- color: var(--tmc-field-label-text, var(--tmc-field-auto-text, var(--tmc-color-text, #151821)));
8
- cursor: pointer;
9
- display: inline-flex;
10
- gap: 0.75rem;
11
- `;
12
- const SwitchInput = styled.input `
13
- height: 0;
14
- opacity: 0;
15
- position: absolute;
16
- width: 0;
17
- `;
18
- const SwitchTrack = styled.span `
19
- background-color: color-mix(in srgb, var(--tmc-color-surface-muted, #e7ebf0) 78%, var(--tmc-color-text, #151821) 22%);
20
- border: 1px solid color-mix(in srgb, var(--tmc-color-text-muted, #5f6b7a) 38%, transparent);
21
- border-radius: 34px;
22
- display: inline-block;
23
- flex: 0 0 auto;
24
- height: 34px;
25
- position: relative;
26
- transition: background-color 0.4s ease, box-shadow 0.2s ease;
27
- width: 60px;
1
+ import styles from './Switch.module.css';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
28
3
 
29
- &::before {
30
- background-color: var(--tmc-switch-thumb, #f8fafc);
31
- border-radius: 50%;
32
- bottom: 4px;
33
- box-shadow: 0 1px 4px rgb(0 0 0 / 0.3), 0 0 0 1px rgb(255 255 255 / 0.18);
34
- content: "";
35
- height: 24px;
36
- left: 4px;
37
- position: absolute;
38
- transition: transform 0.4s ease;
39
- width: 24px;
40
- }
41
- `;
42
- const SwitchCopy = styled.span `
43
- display: grid;
44
- gap: 0.2rem;
45
- line-height: 1.35;
46
- `;
47
- const SwitchLabel = styled.span `
48
- color: inherit;
49
- font-size: 0.95rem;
50
- font-weight: 600;
51
- `;
52
- const SwitchDescription = styled.span `
53
- color: var(--tmc-field-description-text, var(--tmc-color-text-muted, var(--tmc-field-auto-text, #5f6b7a)));
54
- font-size: 0.82rem;
55
- `;
56
- const SwitchControl = styled.span `
57
- display: inline-flex;
58
-
59
- .tmc-switch-input:checked + .tmc-switch-track {
60
- background-color: var(--cta-color, var(--tmc-color-accent, #2454d6));
61
- }
62
-
63
- .tmc-switch-input:focus-visible + .tmc-switch-track {
64
- box-shadow: 0 0 0 3px color-mix(in srgb, var(--cta-color, var(--tmc-color-accent, #2454d6)) 35%, transparent);
65
- }
66
-
67
- .tmc-switch-input:checked + .tmc-switch-track::before {
68
- transform: translateX(28px);
69
- }
70
-
71
- .tmc-switch-input:disabled + .tmc-switch-track {
72
- cursor: not-allowed;
73
- opacity: 0.55;
74
- }
75
- `;
76
- export function Switch({ description, label, children, ...props }) {
77
- const fieldStyle = useContrastedFieldStyle();
78
- return (_jsxs(SwitchRoot, { ...fieldStyle, children: [_jsxs(SwitchControl, { children: [_jsx(SwitchInput, { className: "tmc-switch-input", type: "checkbox", ...props }), _jsx(SwitchTrack, { className: "tmc-switch-track" })] }), (label || description || children) && (_jsxs(SwitchCopy, { children: [(label || children) && _jsx(SwitchLabel, { children: label ?? children }), description && _jsx(SwitchDescription, { children: description })] }))] }));
4
+ function Switch({
5
+ description,
6
+ label,
7
+ children,
8
+ ...props
9
+ }) {
10
+ return /*#__PURE__*/jsxs("label", {
11
+ className: styles.switchRoot,
12
+ children: [/*#__PURE__*/jsxs("span", {
13
+ className: styles.switchControl,
14
+ children: [/*#__PURE__*/jsx("input", {
15
+ className: styles.switchInput,
16
+ type: "checkbox",
17
+ ...props
18
+ }), /*#__PURE__*/jsx("span", {
19
+ className: styles.switchTrack
20
+ })]
21
+ }), (label || description || children) && /*#__PURE__*/jsxs("span", {
22
+ className: styles.copy,
23
+ children: [(label || children) && /*#__PURE__*/jsx("span", {
24
+ className: styles.label,
25
+ children: label ?? children
26
+ }), description && /*#__PURE__*/jsx("span", {
27
+ className: styles.description,
28
+ children: description
29
+ })]
30
+ })]
31
+ });
79
32
  }
33
+
34
+ export { Switch };
@@ -0,0 +1 @@
1
+ .switchRoot{align-items:center;color:var(--tmc-field-label-text,var(--tmc-field-auto-text,var(--tmc-color-text,#151821)));cursor:pointer;display:inline-flex;gap:.75rem}.switchInput{height:0;opacity:0;position:absolute;width:0}.switchTrack{background-color:color-mix(in srgb,var(--tmc-color-surface-muted,#e7ebf0) 78%,var(--tmc-color-text,#151821) 22%);border:1px solid color-mix(in srgb,var(--tmc-color-text-muted,#5f6b7a) 38%,transparent);border-radius:34px;display:inline-block;flex:0 0 auto;height:34px;position:relative;transition:background-color .4s ease,box-shadow .2s ease;width:60px}.switchTrack:before{background-color:var(--tmc-switch-thumb,#f8fafc);border-radius:50%;bottom:4px;box-shadow:0 1px 4px rgb(0 0 0/.3),0 0 0 1px hsla(0,0%,100%,.18);content:"";height:24px;left:4px;position:absolute;transition:transform .4s ease;width:24px}.switchControl{display:inline-flex}.switchInput:checked+.switchTrack{background-color:var(--cta-color,var(--tmc-color-accent,#2454d6))}.switchInput:focus-visible+.switchTrack{box-shadow:0 0 0 3px color-mix(in srgb,var(--cta-color,var(--tmc-color-accent,#2454d6)) 35%,transparent)}.switchInput:checked+.switchTrack:before{transform:translateX(28px)}.switchInput:disabled+.switchTrack{cursor:not-allowed;opacity:.55}.copy{display:grid;gap:.2rem;line-height:1.35}.label{color:inherit;font-size:.95rem;font-weight:600}.description{color:var(--tmc-field-description-text,var(--tmc-color-text-muted,var(--tmc-field-auto-text,#5f6b7a)));font-size:.82rem}
@@ -1,2 +1,2 @@
1
- export { Checkbox } from "./Checkbox";
2
- export { Switch } from "./Switch";
1
+ export { Checkbox } from './Checkbox.js';
2
+ export { Switch } from './Switch.js';
@@ -1,56 +1,122 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import styled from "@emotion/styled";
4
- import { useState } from "react";
5
- const CodeBlockRoot = styled.div `
6
- background: #111722;
7
- border: 1px solid #273244;
8
- border-radius: 8px;
9
- color: #eef4ff;
10
- overflow: hidden;
11
- `;
12
- const CodeBlockHeader = styled.div `
13
- align-items: center;
14
- background: #182132;
15
- border-bottom: 1px solid #273244;
16
- display: flex;
17
- gap: 0.75rem;
18
- justify-content: space-between;
19
- min-height: 2.35rem;
20
- padding: 0.45rem 0.75rem;
21
- `;
22
- const CodeBlockTitle = styled.span `
23
- color: #aebbd0;
24
- font-family: var(--tmc-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
25
- font-size: 0.78rem;
26
- `;
27
- const CopyButton = styled.button `
28
- background: #24314a;
29
- border: 1px solid #354561;
30
- border-radius: 6px;
31
- color: #eef4ff;
32
- cursor: pointer;
33
- font-size: 0.75rem;
34
- padding: 0.25rem 0.55rem;
2
+ import { c } from 'react/compiler-runtime';
3
+ import { useState } from 'react';
4
+ import styles from './CodeBlock.module.css';
5
+ import { jsx, jsxs } from 'react/jsx-runtime';
35
6
 
36
- &:hover {
37
- background: #2d3b58;
38
- }
39
- `;
40
- const CodePre = styled.pre `
41
- font-family: var(--tmc-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
42
- font-size: 0.82rem;
43
- line-height: 1.65;
44
- margin: 0;
45
- overflow-x: auto;
46
- padding: 1rem;
47
- `;
48
- export function CodeBlock({ code, filename, language, ...props }) {
49
- const [copied, setCopied] = useState(false);
50
- async function copyCode() {
51
- await navigator.clipboard.writeText(code);
52
- setCopied(true);
53
- window.setTimeout(() => setCopied(false), 1200);
54
- }
55
- return (_jsxs(CodeBlockRoot, { ...props, children: [_jsxs(CodeBlockHeader, { children: [_jsx(CodeBlockTitle, { children: filename ?? language ?? "code" }), _jsx(CopyButton, { onClick: () => void copyCode(), type: "button", children: copied ? "Copied" : "Copy" })] }), _jsx(CodePre, { children: _jsx("code", { children: code }) })] }));
7
+ function CodeBlock(t0) {
8
+ const $ = c(23);
9
+ let code;
10
+ let filename;
11
+ let language;
12
+ let props;
13
+ if ($[0] !== t0) {
14
+ ({
15
+ code,
16
+ filename,
17
+ language,
18
+ ...props
19
+ } = t0);
20
+ $[0] = t0;
21
+ $[1] = code;
22
+ $[2] = filename;
23
+ $[3] = language;
24
+ $[4] = props;
25
+ } else {
26
+ code = $[1];
27
+ filename = $[2];
28
+ language = $[3];
29
+ props = $[4];
30
+ }
31
+ const [copied, setCopied] = useState(false);
32
+ let t1;
33
+ if ($[5] !== code) {
34
+ t1 = async function copyCode() {
35
+ await navigator.clipboard.writeText(code);
36
+ setCopied(true);
37
+ window.setTimeout(() => setCopied(false), 1200);
38
+ };
39
+ $[5] = code;
40
+ $[6] = t1;
41
+ } else {
42
+ t1 = $[6];
43
+ }
44
+ const copyCode = t1;
45
+ const t2 = filename ?? language ?? "code";
46
+ let t3;
47
+ if ($[7] !== t2) {
48
+ t3 = /*#__PURE__*/jsx("span", {
49
+ className: styles.title,
50
+ children: t2
51
+ });
52
+ $[7] = t2;
53
+ $[8] = t3;
54
+ } else {
55
+ t3 = $[8];
56
+ }
57
+ let t4;
58
+ if ($[9] !== copyCode) {
59
+ t4 = () => void copyCode();
60
+ $[9] = copyCode;
61
+ $[10] = t4;
62
+ } else {
63
+ t4 = $[10];
64
+ }
65
+ const t5 = copied ? "Copied" : "Copy";
66
+ let t6;
67
+ if ($[11] !== t4 || $[12] !== t5) {
68
+ t6 = /*#__PURE__*/jsx("button", {
69
+ className: styles.copyButton,
70
+ onClick: t4,
71
+ type: "button",
72
+ children: t5
73
+ });
74
+ $[11] = t4;
75
+ $[12] = t5;
76
+ $[13] = t6;
77
+ } else {
78
+ t6 = $[13];
79
+ }
80
+ let t7;
81
+ if ($[14] !== t3 || $[15] !== t6) {
82
+ t7 = /*#__PURE__*/jsxs("div", {
83
+ className: styles.header,
84
+ children: [t3, t6]
85
+ });
86
+ $[14] = t3;
87
+ $[15] = t6;
88
+ $[16] = t7;
89
+ } else {
90
+ t7 = $[16];
91
+ }
92
+ let t8;
93
+ if ($[17] !== code) {
94
+ t8 = /*#__PURE__*/jsx("pre", {
95
+ className: styles.pre,
96
+ children: /*#__PURE__*/jsx("code", {
97
+ children: code
98
+ })
99
+ });
100
+ $[17] = code;
101
+ $[18] = t8;
102
+ } else {
103
+ t8 = $[18];
104
+ }
105
+ let t9;
106
+ if ($[19] !== props || $[20] !== t7 || $[21] !== t8) {
107
+ t9 = /*#__PURE__*/jsxs("div", {
108
+ className: styles.root,
109
+ ...props,
110
+ children: [t7, t8]
111
+ });
112
+ $[19] = props;
113
+ $[20] = t7;
114
+ $[21] = t8;
115
+ $[22] = t9;
116
+ } else {
117
+ t9 = $[22];
118
+ }
119
+ return t9;
56
120
  }
121
+
122
+ export { CodeBlock };
@@ -0,0 +1 @@
1
+ .root{background:#111722;border:1px solid #273244;border-radius:8px;color:#eef4ff;overflow:hidden}.header{align-items:center;background:#182132;border-bottom:1px solid #273244;display:flex;gap:.75rem;justify-content:space-between;min-height:2.35rem;padding:.45rem .75rem}.title{color:#aebbd0;font-family:var(--tmc-font-mono,ui-monospace,SFMono-Regular,Menlo,monospace);font-size:.78rem}.copyButton{background:#24314a;border:1px solid #354561;border-radius:6px;color:#eef4ff;cursor:pointer;font-size:.75rem;padding:.25rem .55rem}.copyButton:hover{background:#2d3b58}.pre{font-family:var(--tmc-font-mono,ui-monospace,SFMono-Regular,Menlo,monospace);font-size:.82rem;line-height:1.65;margin:0;overflow-x:auto;padding:1rem}
@@ -1 +1 @@
1
- export { CodeBlock } from "./CodeBlock";
1
+ export { CodeBlock } from './CodeBlock.js';
@@ -1,2 +1,2 @@
1
1
  import type { DividerProps } from "./Divider.types";
2
- export declare function Divider({ children, orientation, role, ...props }: DividerProps): import("react").JSX.Element;
2
+ export declare function Divider({ children, className, orientation, role, ...props }: DividerProps): import("react").JSX.Element;
@@ -1,36 +1,22 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import styled from "@emotion/styled";
4
- const DividerRoot = styled.div `
5
- align-items: center;
6
- color: var(--tmc-color-text-muted, #5f6b7a);
7
- display: flex;
8
- font-size: 0.78rem;
9
- font-weight: 700;
10
- gap: 0.75rem;
11
- letter-spacing: 0.08em;
12
- text-transform: uppercase;
13
- width: ${({ $orientation }) => $orientation === "horizontal" ? "100%" : "auto"};
1
+ import styles from './Divider.module.css';
2
+ import { jsx } from 'react/jsx-runtime';
14
3
 
15
- &::before,
16
- &::after {
17
- background: var(--tmc-color-border, #d7dde5);
18
- content: "";
19
- display: block;
20
- flex: 1 1 auto;
21
- height: ${({ $orientation }) => $orientation === "horizontal" ? "1px" : "100%"};
22
- min-height: ${({ $orientation }) => $orientation === "vertical" ? "1.5rem" : "0"};
23
- width: ${({ $orientation }) => $orientation === "vertical" ? "1px" : "auto"};
24
- }
25
-
26
- &:empty {
27
- gap: 0;
28
- }
29
-
30
- &:empty::before {
31
- display: none;
32
- }
33
- `;
34
- export function Divider({ children, orientation = "horizontal", role, ...props }) {
35
- return (_jsx(DividerRoot, { "$orientation": orientation, role: role ?? "separator", ...props, children: children }));
4
+ function classNames(...classes) {
5
+ return classes.filter(Boolean).join(" ");
36
6
  }
7
+ function Divider({
8
+ children,
9
+ className,
10
+ orientation = "horizontal",
11
+ role,
12
+ ...props
13
+ }) {
14
+ return /*#__PURE__*/jsx("div", {
15
+ className: classNames(styles.divider, styles[orientation], className),
16
+ role: role ?? "separator",
17
+ ...props,
18
+ children: children
19
+ });
20
+ }
21
+
22
+ export { Divider };
@@ -0,0 +1 @@
1
+ .divider{align-items:center;color:var(--tmc-color-text-muted,#5f6b7a);display:flex;font-size:.78rem;font-weight:700;gap:.75rem;letter-spacing:.08em;text-transform:uppercase}.horizontal{width:100%}.vertical{width:auto}.divider:after,.divider:before{background:var(--tmc-color-border,#d7dde5);content:"";display:block;flex:1 1 auto}.horizontal:after,.horizontal:before{height:1px;width:auto}.vertical:after,.vertical:before{height:100%;min-height:1.5rem;width:1px}.divider:empty{gap:0}.divider:empty:before{display:none}