@dnanpm/ui-components 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/IconButton/IconButton.cjs +107 -0
- package/dist/components/IconButton/IconButton.cjs.map +1 -0
- package/dist/components/IconButton/IconButton.css +177 -0
- package/dist/components/IconButton/IconButton.d.ts +3 -0
- package/dist/components/IconButton/IconButton.d.ts.map +1 -0
- package/dist/components/IconButton/IconButton.js +107 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/IconButton/IconButton.module.css.cjs +16 -0
- package/dist/components/IconButton/IconButton.module.css.cjs.map +1 -0
- package/dist/components/IconButton/IconButton.module.css.js +17 -0
- package/dist/components/IconButton/IconButton.module.css.js.map +1 -0
- package/dist/components/IconButton/IconButton.types.d.ts +52 -0
- package/dist/components/IconButton/IconButton.types.d.ts.map +1 -0
- package/dist/components/IconButton/index.d.ts +3 -0
- package/dist/components/IconButton/index.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const focus_module = require("../../styles/utils/focus.module.css.cjs");
|
|
5
|
+
const IconButton_module = require("./IconButton.module.css.cjs");
|
|
6
|
+
const cn = require("../../utils/cn/cn.cjs");
|
|
7
|
+
const Spinner = require("../Spinner/Spinner.cjs");
|
|
8
|
+
const IconButton = ({
|
|
9
|
+
variant = "default",
|
|
10
|
+
icon,
|
|
11
|
+
iconPosition = "start",
|
|
12
|
+
size = "normal",
|
|
13
|
+
loading = false,
|
|
14
|
+
className,
|
|
15
|
+
children,
|
|
16
|
+
ref,
|
|
17
|
+
...props
|
|
18
|
+
}) => {
|
|
19
|
+
const isDisabled = "disabled" in props && props.disabled;
|
|
20
|
+
const isAnchor = "href" in props && props.href != null;
|
|
21
|
+
const classes = cn.cn(
|
|
22
|
+
IconButton_module["icon-button"],
|
|
23
|
+
IconButton_module[`icon-button--${variant}`],
|
|
24
|
+
IconButton_module[`icon-button--${size}`],
|
|
25
|
+
focus_module.default.focusable,
|
|
26
|
+
{ [IconButton_module["icon-button--disabled"]]: isDisabled },
|
|
27
|
+
{ [IconButton_module["icon-button--loading"]]: loading },
|
|
28
|
+
className
|
|
29
|
+
);
|
|
30
|
+
const Icon = icon;
|
|
31
|
+
const iconSlot = loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: IconButton_module["icon-button__spinner"], "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
+
Spinner.Spinner,
|
|
33
|
+
{
|
|
34
|
+
size: size === "small" ? "xs" : "s",
|
|
35
|
+
color: "inherit",
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
role: "presentation"
|
|
38
|
+
}
|
|
39
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: IconButton_module["icon-button__icon"], "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { "aria-hidden": "true" }) });
|
|
40
|
+
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
41
|
+
iconPosition === "start" && iconSlot,
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: IconButton_module["icon-button__label"], children }),
|
|
43
|
+
iconPosition === "end" && iconSlot
|
|
44
|
+
] });
|
|
45
|
+
if (isAnchor) {
|
|
46
|
+
const { href, renderLink, ...anchorProps } = props;
|
|
47
|
+
const {
|
|
48
|
+
disabled: _disabled,
|
|
49
|
+
type: _type,
|
|
50
|
+
name: _name,
|
|
51
|
+
...safeAnchorProps
|
|
52
|
+
} = anchorProps;
|
|
53
|
+
const target = safeAnchorProps.target;
|
|
54
|
+
const rel = safeAnchorProps.rel;
|
|
55
|
+
const shouldHardenRel = target?.toLowerCase() === "_blank";
|
|
56
|
+
const relTokens = new Set(
|
|
57
|
+
(rel ?? "").split(/\s+/).filter(Boolean).map((token) => token.toLowerCase())
|
|
58
|
+
);
|
|
59
|
+
if (shouldHardenRel) {
|
|
60
|
+
relTokens.add("noopener");
|
|
61
|
+
relTokens.add("noreferrer");
|
|
62
|
+
}
|
|
63
|
+
const hardenedRel = relTokens.size > 0 ? Array.from(relTokens).join(" ") : void 0;
|
|
64
|
+
const linkProps = {
|
|
65
|
+
...safeAnchorProps,
|
|
66
|
+
ref,
|
|
67
|
+
href,
|
|
68
|
+
rel: hardenedRel,
|
|
69
|
+
className: classes,
|
|
70
|
+
"aria-busy": loading || void 0,
|
|
71
|
+
"aria-disabled": loading || void 0,
|
|
72
|
+
tabIndex: loading ? -1 : void 0,
|
|
73
|
+
onClick: loading ? (e) => {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
} : safeAnchorProps.onClick,
|
|
77
|
+
children: content
|
|
78
|
+
};
|
|
79
|
+
if (renderLink) {
|
|
80
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderLink(linkProps) });
|
|
81
|
+
}
|
|
82
|
+
return /* @__PURE__ */ jsxRuntime.jsx("a", { ...linkProps });
|
|
83
|
+
}
|
|
84
|
+
const {
|
|
85
|
+
type = "button",
|
|
86
|
+
disabled,
|
|
87
|
+
href: _href,
|
|
88
|
+
target: _target,
|
|
89
|
+
rel: _rel,
|
|
90
|
+
renderLink: _renderLink,
|
|
91
|
+
...buttonProps
|
|
92
|
+
} = props;
|
|
93
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
94
|
+
"button",
|
|
95
|
+
{
|
|
96
|
+
ref,
|
|
97
|
+
type,
|
|
98
|
+
disabled: disabled || loading,
|
|
99
|
+
className: classes,
|
|
100
|
+
"aria-busy": loading || void 0,
|
|
101
|
+
...buttonProps,
|
|
102
|
+
children: content
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
exports.IconButton = IconButton;
|
|
107
|
+
//# sourceMappingURL=IconButton.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.cjs","sources":["../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, MouseEvent, ReactNode, Ref } from 'react';\nimport { cn } from '../../utils/cn';\nimport focusStyles from '../../styles/utils/focus.module.css';\nimport { Spinner } from '../Spinner';\nimport styles from './IconButton.module.css';\nimport type { IconButtonProps } from './IconButton.types';\n\nexport const IconButton = ({\n variant = 'default',\n icon,\n iconPosition = 'start',\n size = 'normal',\n loading = false,\n className,\n children,\n ref,\n ...props\n}: IconButtonProps) => {\n const isDisabled = 'disabled' in props && props.disabled;\n const isAnchor = 'href' in props && props.href != null;\n\n const classes = cn(\n styles['icon-button'],\n styles[`icon-button--${variant}`],\n styles[`icon-button--${size}`],\n focusStyles.focusable,\n { [styles['icon-button--disabled']]: isDisabled },\n { [styles['icon-button--loading']]: loading },\n className,\n );\n\n const Icon = icon;\n\n const iconSlot = loading ? (\n <span className={styles['icon-button__spinner']} aria-hidden=\"true\">\n <Spinner\n size={size === 'small' ? 'xs' : 's'}\n color=\"inherit\"\n aria-hidden=\"true\"\n role=\"presentation\"\n />\n </span>\n ) : (\n <span className={styles['icon-button__icon']} aria-hidden=\"true\">\n <Icon aria-hidden=\"true\" />\n </span>\n );\n\n const content = (\n <>\n {iconPosition === 'start' && iconSlot}\n <span className={styles['icon-button__label']}>{children}</span>\n {iconPosition === 'end' && iconSlot}\n </>\n );\n\n if (isAnchor) {\n const { href, renderLink, ...anchorProps } = props as Omit<\n typeof props,\n 'variant' | 'icon' | 'iconPosition' | 'size' | 'loading'\n > & {\n href: string;\n renderLink?: (\n props: AnchorHTMLAttributes<HTMLAnchorElement> & {\n href: string;\n children: ReactNode;\n },\n ) => ReactNode;\n };\n\n const {\n disabled: _disabled,\n type: _type,\n name: _name,\n ...safeAnchorProps\n } = anchorProps as typeof anchorProps & {\n disabled?: boolean;\n type?: 'button' | 'submit' | 'reset';\n name?: string;\n };\n\n const target = safeAnchorProps.target;\n const rel = safeAnchorProps.rel;\n const shouldHardenRel = target?.toLowerCase() === '_blank';\n const relTokens = new Set(\n (rel ?? '')\n .split(/\\s+/)\n .filter(Boolean)\n .map((token) => token.toLowerCase()),\n );\n\n if (shouldHardenRel) {\n relTokens.add('noopener');\n relTokens.add('noreferrer');\n }\n\n const hardenedRel = relTokens.size > 0 ? Array.from(relTokens).join(' ') : undefined;\n\n const linkProps = {\n ...safeAnchorProps,\n ref: ref as Ref<HTMLAnchorElement>,\n href,\n rel: hardenedRel,\n className: classes,\n 'aria-busy': loading || undefined,\n 'aria-disabled': loading || undefined,\n tabIndex: loading ? -1 : undefined,\n onClick: loading\n ? (e: MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }\n : safeAnchorProps.onClick,\n children: content,\n };\n\n if (renderLink) {\n return <>{renderLink(linkProps)}</>;\n }\n\n return <a {...linkProps} />;\n }\n\n const {\n type = 'button',\n disabled,\n href: _href,\n target: _target,\n rel: _rel,\n renderLink: _renderLink,\n ...buttonProps\n } = props as Omit<\n typeof props,\n 'variant' | 'icon' | 'iconPosition' | 'size' | 'loading' | 'href'\n > & {\n type?: 'button' | 'submit' | 'reset';\n disabled?: boolean;\n href?: string;\n target?: string;\n rel?: string;\n renderLink?: unknown;\n };\n\n return (\n <button\n ref={ref as Ref<HTMLButtonElement>}\n type={type}\n disabled={disabled || loading}\n className={classes}\n aria-busy={loading || undefined}\n {...buttonProps}\n >\n {content}\n </button>\n );\n};\n"],"names":["cn","styles","focusStyles","jsx","Spinner","jsxs","Fragment"],"mappings":";;;;;;;AAOO,MAAM,aAAa,CAAC;AAAA,EACvB,UAAU;AAAA,EAC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,0 +1,177 @@
|
|
|
1
|
+
@layer dds-components {._icon-button_1dpxf_1 {
|
|
2
|
+
--_button-icon-size: 24px;
|
|
3
|
+
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
gap: var(--spacing-ui-xs);
|
|
8
|
+
max-width: 100%;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
border: none;
|
|
11
|
+
border-radius: var(--radius-semantic-sm);
|
|
12
|
+
padding: 0;
|
|
13
|
+
background: transparent;
|
|
14
|
+
font: var(--typography-label-lg-bold);
|
|
15
|
+
color: var(--color-semantic-foreground-default);
|
|
16
|
+
text-decoration: none;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
transition:
|
|
19
|
+
color 0.2s ease-in-out,
|
|
20
|
+
text-decoration-color 0.2s ease-in-out;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
._icon-button--normal_1dpxf_23 {
|
|
24
|
+
font: var(--typography-label-lg-bold);
|
|
25
|
+
--_button-icon-size: 24px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
._icon-button--small_1dpxf_28 {
|
|
29
|
+
font: var(--typography-label-md-bold);
|
|
30
|
+
--_button-icon-size: 20px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
._icon-button__label_1dpxf_33 {
|
|
34
|
+
flex: 0 1 auto;
|
|
35
|
+
min-width: 0;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
text-overflow: ellipsis;
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
._icon-button__icon_1dpxf_41,
|
|
42
|
+
._icon-button__spinner_1dpxf_42 {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
flex: 0 0 auto;
|
|
47
|
+
width: var(--_button-icon-size);
|
|
48
|
+
height: var(--_button-icon-size);
|
|
49
|
+
color: var(--color-semantic-interactive-primary-default);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
._icon-button__icon_1dpxf_41 > svg {
|
|
53
|
+
width: var(--_button-icon-size);
|
|
54
|
+
height: var(--_button-icon-size);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
._icon-button_1dpxf_1:hover ._icon-button__label_1dpxf_33,
|
|
58
|
+
._icon-button_1dpxf_1:focus-visible ._icon-button__label_1dpxf_33 {
|
|
59
|
+
text-decoration: underline;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
._icon-button_1dpxf_1:hover ._icon-button__icon_1dpxf_41,
|
|
63
|
+
._icon-button_1dpxf_1:hover ._icon-button__spinner_1dpxf_42,
|
|
64
|
+
._icon-button_1dpxf_1:focus-visible ._icon-button__icon_1dpxf_41,
|
|
65
|
+
._icon-button_1dpxf_1:focus-visible ._icon-button__spinner_1dpxf_42 {
|
|
66
|
+
color: var(--color-semantic-interactive-primary-hover);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
._icon-button_1dpxf_1:active ._icon-button__icon_1dpxf_41,
|
|
70
|
+
._icon-button_1dpxf_1:active ._icon-button__spinner_1dpxf_42 {
|
|
71
|
+
color: var(--color-semantic-interactive-primary-active);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
._icon-button--default_1dpxf_74 {
|
|
75
|
+
color: var(--color-semantic-foreground-default);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
._icon-button--link_1dpxf_78 {
|
|
79
|
+
color: var(--color-semantic-foreground-link);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
._icon-button--link_1dpxf_78 ._icon-button__icon_1dpxf_41,
|
|
83
|
+
._icon-button--link_1dpxf_78 ._icon-button__spinner_1dpxf_42 {
|
|
84
|
+
color: var(--color-semantic-foreground-link);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
._icon-button--link_1dpxf_78:hover,
|
|
88
|
+
._icon-button--link_1dpxf_78:focus-visible {
|
|
89
|
+
color: var(--color-semantic-foreground-link-hover);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
._icon-button--link_1dpxf_78:hover ._icon-button__icon_1dpxf_41,
|
|
93
|
+
._icon-button--link_1dpxf_78:hover ._icon-button__spinner_1dpxf_42,
|
|
94
|
+
._icon-button--link_1dpxf_78:focus-visible ._icon-button__icon_1dpxf_41,
|
|
95
|
+
._icon-button--link_1dpxf_78:focus-visible ._icon-button__spinner_1dpxf_42 {
|
|
96
|
+
color: var(--color-semantic-foreground-link-hover);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
._icon-button--link_1dpxf_78:active ._icon-button__icon_1dpxf_41,
|
|
100
|
+
._icon-button--link_1dpxf_78:active ._icon-button__spinner_1dpxf_42 {
|
|
101
|
+
color: var(--color-semantic-interactive-primary-active);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
._icon-button--disabled_1dpxf_104,
|
|
105
|
+
._icon-button--loading_1dpxf_105 {
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
._icon-button--disabled_1dpxf_104 {
|
|
110
|
+
color: var(--color-semantic-foreground-muted);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
._icon-button--disabled_1dpxf_104 ._icon-button__icon_1dpxf_41,
|
|
114
|
+
._icon-button--disabled_1dpxf_104 ._icon-button__spinner_1dpxf_42 {
|
|
115
|
+
color: var(--color-semantic-interactive-primary-disabled);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@scope ([data-color-scheme='dark']) to ([data-color-scheme='light']) {
|
|
119
|
+
._icon-button_1dpxf_1 {
|
|
120
|
+
color: var(--color-semantic-foreground-inverse);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
._icon-button__icon_1dpxf_41,
|
|
124
|
+
._icon-button__spinner_1dpxf_42 {
|
|
125
|
+
color: var(--color-semantic-interactive-inverse-default);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
._icon-button_1dpxf_1:hover ._icon-button__icon_1dpxf_41,
|
|
129
|
+
._icon-button_1dpxf_1:hover ._icon-button__spinner_1dpxf_42,
|
|
130
|
+
._icon-button_1dpxf_1:focus-visible ._icon-button__icon_1dpxf_41,
|
|
131
|
+
._icon-button_1dpxf_1:focus-visible ._icon-button__spinner_1dpxf_42 {
|
|
132
|
+
color: var(--color-semantic-interactive-inverse-hover);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
._icon-button_1dpxf_1:active ._icon-button__icon_1dpxf_41,
|
|
136
|
+
._icon-button_1dpxf_1:active ._icon-button__spinner_1dpxf_42 {
|
|
137
|
+
color: var(--color-semantic-interactive-inverse-active);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
._icon-button--default_1dpxf_74 {
|
|
141
|
+
color: var(--color-semantic-foreground-inverse);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
._icon-button--link_1dpxf_78 {
|
|
145
|
+
color: var(--color-semantic-foreground-inverse);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
._icon-button--link_1dpxf_78 ._icon-button__icon_1dpxf_41,
|
|
149
|
+
._icon-button--link_1dpxf_78 ._icon-button__spinner_1dpxf_42 {
|
|
150
|
+
color: var(--color-semantic-interactive-inverse-default);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
._icon-button--link_1dpxf_78:hover,
|
|
154
|
+
._icon-button--link_1dpxf_78:focus-visible {
|
|
155
|
+
color: var(--color-semantic-foreground-inverse);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
._icon-button--link_1dpxf_78:hover ._icon-button__icon_1dpxf_41,
|
|
159
|
+
._icon-button--link_1dpxf_78:hover ._icon-button__spinner_1dpxf_42,
|
|
160
|
+
._icon-button--link_1dpxf_78:focus-visible ._icon-button__icon_1dpxf_41,
|
|
161
|
+
._icon-button--link_1dpxf_78:focus-visible ._icon-button__spinner_1dpxf_42 {
|
|
162
|
+
color: var(--color-semantic-interactive-inverse-hover);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
._icon-button--disabled_1dpxf_104 ._icon-button__icon_1dpxf_41,
|
|
166
|
+
._icon-button--disabled_1dpxf_104 ._icon-button__spinner_1dpxf_42 {
|
|
167
|
+
color: var(--color-semantic-interactive-inverse-disabled);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@media (forced-colors: active) {
|
|
172
|
+
._icon-button--small_1dpxf_28:focus-visible {
|
|
173
|
+
outline-color: Highlight;
|
|
174
|
+
box-shadow: none;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { IconButtonProps } from './IconButton.types';
|
|
2
|
+
export declare const IconButton: ({ variant, icon, iconPosition, size, loading, className, children, ref, ...props }: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=IconButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../src/components/IconButton/IconButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,eAAO,MAAM,UAAU,GAAI,oFAUxB,eAAe,4CA0IjB,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import focusStyles from "../../styles/utils/focus.module.css.js";
|
|
3
|
+
import styles from "./IconButton.module.css.js";
|
|
4
|
+
import { cn } from "../../utils/cn/cn.js";
|
|
5
|
+
import { Spinner } from "../Spinner/Spinner.js";
|
|
6
|
+
const IconButton = ({
|
|
7
|
+
variant = "default",
|
|
8
|
+
icon,
|
|
9
|
+
iconPosition = "start",
|
|
10
|
+
size = "normal",
|
|
11
|
+
loading = false,
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
ref,
|
|
15
|
+
...props
|
|
16
|
+
}) => {
|
|
17
|
+
const isDisabled = "disabled" in props && props.disabled;
|
|
18
|
+
const isAnchor = "href" in props && props.href != null;
|
|
19
|
+
const classes = cn(
|
|
20
|
+
styles["icon-button"],
|
|
21
|
+
styles[`icon-button--${variant}`],
|
|
22
|
+
styles[`icon-button--${size}`],
|
|
23
|
+
focusStyles.focusable,
|
|
24
|
+
{ [styles["icon-button--disabled"]]: isDisabled },
|
|
25
|
+
{ [styles["icon-button--loading"]]: loading },
|
|
26
|
+
className
|
|
27
|
+
);
|
|
28
|
+
const Icon = icon;
|
|
29
|
+
const iconSlot = loading ? /* @__PURE__ */ jsx("span", { className: styles["icon-button__spinner"], "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
30
|
+
Spinner,
|
|
31
|
+
{
|
|
32
|
+
size: size === "small" ? "xs" : "s",
|
|
33
|
+
color: "inherit",
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
role: "presentation"
|
|
36
|
+
}
|
|
37
|
+
) }) : /* @__PURE__ */ jsx("span", { className: styles["icon-button__icon"], "aria-hidden": "true", children: /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true" }) });
|
|
38
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
|
+
iconPosition === "start" && iconSlot,
|
|
40
|
+
/* @__PURE__ */ jsx("span", { className: styles["icon-button__label"], children }),
|
|
41
|
+
iconPosition === "end" && iconSlot
|
|
42
|
+
] });
|
|
43
|
+
if (isAnchor) {
|
|
44
|
+
const { href, renderLink, ...anchorProps } = props;
|
|
45
|
+
const {
|
|
46
|
+
disabled: _disabled,
|
|
47
|
+
type: _type,
|
|
48
|
+
name: _name,
|
|
49
|
+
...safeAnchorProps
|
|
50
|
+
} = anchorProps;
|
|
51
|
+
const target = safeAnchorProps.target;
|
|
52
|
+
const rel = safeAnchorProps.rel;
|
|
53
|
+
const shouldHardenRel = target?.toLowerCase() === "_blank";
|
|
54
|
+
const relTokens = new Set(
|
|
55
|
+
(rel ?? "").split(/\s+/).filter(Boolean).map((token) => token.toLowerCase())
|
|
56
|
+
);
|
|
57
|
+
if (shouldHardenRel) {
|
|
58
|
+
relTokens.add("noopener");
|
|
59
|
+
relTokens.add("noreferrer");
|
|
60
|
+
}
|
|
61
|
+
const hardenedRel = relTokens.size > 0 ? Array.from(relTokens).join(" ") : void 0;
|
|
62
|
+
const linkProps = {
|
|
63
|
+
...safeAnchorProps,
|
|
64
|
+
ref,
|
|
65
|
+
href,
|
|
66
|
+
rel: hardenedRel,
|
|
67
|
+
className: classes,
|
|
68
|
+
"aria-busy": loading || void 0,
|
|
69
|
+
"aria-disabled": loading || void 0,
|
|
70
|
+
tabIndex: loading ? -1 : void 0,
|
|
71
|
+
onClick: loading ? (e) => {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
} : safeAnchorProps.onClick,
|
|
75
|
+
children: content
|
|
76
|
+
};
|
|
77
|
+
if (renderLink) {
|
|
78
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderLink(linkProps) });
|
|
79
|
+
}
|
|
80
|
+
return /* @__PURE__ */ jsx("a", { ...linkProps });
|
|
81
|
+
}
|
|
82
|
+
const {
|
|
83
|
+
type = "button",
|
|
84
|
+
disabled,
|
|
85
|
+
href: _href,
|
|
86
|
+
target: _target,
|
|
87
|
+
rel: _rel,
|
|
88
|
+
renderLink: _renderLink,
|
|
89
|
+
...buttonProps
|
|
90
|
+
} = props;
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
92
|
+
"button",
|
|
93
|
+
{
|
|
94
|
+
ref,
|
|
95
|
+
type,
|
|
96
|
+
disabled: disabled || loading,
|
|
97
|
+
className: classes,
|
|
98
|
+
"aria-busy": loading || void 0,
|
|
99
|
+
...buttonProps,
|
|
100
|
+
children: content
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
export {
|
|
105
|
+
IconButton
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=IconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.js","sources":["../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, MouseEvent, ReactNode, Ref } from 'react';\nimport { cn } from '../../utils/cn';\nimport focusStyles from '../../styles/utils/focus.module.css';\nimport { Spinner } from '../Spinner';\nimport styles from './IconButton.module.css';\nimport type { IconButtonProps } from './IconButton.types';\n\nexport const IconButton = ({\n variant = 'default',\n icon,\n iconPosition = 'start',\n size = 'normal',\n loading = false,\n className,\n children,\n ref,\n ...props\n}: IconButtonProps) => {\n const isDisabled = 'disabled' in props && props.disabled;\n const isAnchor = 'href' in props && props.href != null;\n\n const classes = cn(\n styles['icon-button'],\n styles[`icon-button--${variant}`],\n styles[`icon-button--${size}`],\n focusStyles.focusable,\n { [styles['icon-button--disabled']]: isDisabled },\n { [styles['icon-button--loading']]: loading },\n className,\n );\n\n const Icon = icon;\n\n const iconSlot = loading ? (\n <span className={styles['icon-button__spinner']} aria-hidden=\"true\">\n <Spinner\n size={size === 'small' ? 'xs' : 's'}\n color=\"inherit\"\n aria-hidden=\"true\"\n role=\"presentation\"\n />\n </span>\n ) : (\n <span className={styles['icon-button__icon']} aria-hidden=\"true\">\n <Icon aria-hidden=\"true\" />\n </span>\n );\n\n const content = (\n <>\n {iconPosition === 'start' && iconSlot}\n <span className={styles['icon-button__label']}>{children}</span>\n {iconPosition === 'end' && iconSlot}\n </>\n );\n\n if (isAnchor) {\n const { href, renderLink, ...anchorProps } = props as Omit<\n typeof props,\n 'variant' | 'icon' | 'iconPosition' | 'size' | 'loading'\n > & {\n href: string;\n renderLink?: (\n props: AnchorHTMLAttributes<HTMLAnchorElement> & {\n href: string;\n children: ReactNode;\n },\n ) => ReactNode;\n };\n\n const {\n disabled: _disabled,\n type: _type,\n name: _name,\n ...safeAnchorProps\n } = anchorProps as typeof anchorProps & {\n disabled?: boolean;\n type?: 'button' | 'submit' | 'reset';\n name?: string;\n };\n\n const target = safeAnchorProps.target;\n const rel = safeAnchorProps.rel;\n const shouldHardenRel = target?.toLowerCase() === '_blank';\n const relTokens = new Set(\n (rel ?? '')\n .split(/\\s+/)\n .filter(Boolean)\n .map((token) => token.toLowerCase()),\n );\n\n if (shouldHardenRel) {\n relTokens.add('noopener');\n relTokens.add('noreferrer');\n }\n\n const hardenedRel = relTokens.size > 0 ? Array.from(relTokens).join(' ') : undefined;\n\n const linkProps = {\n ...safeAnchorProps,\n ref: ref as Ref<HTMLAnchorElement>,\n href,\n rel: hardenedRel,\n className: classes,\n 'aria-busy': loading || undefined,\n 'aria-disabled': loading || undefined,\n tabIndex: loading ? -1 : undefined,\n onClick: loading\n ? (e: MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }\n : safeAnchorProps.onClick,\n children: content,\n };\n\n if (renderLink) {\n return <>{renderLink(linkProps)}</>;\n }\n\n return <a {...linkProps} />;\n }\n\n const {\n type = 'button',\n disabled,\n href: _href,\n target: _target,\n rel: _rel,\n renderLink: _renderLink,\n ...buttonProps\n } = props as Omit<\n typeof props,\n 'variant' | 'icon' | 'iconPosition' | 'size' | 'loading' | 'href'\n > & {\n type?: 'button' | 'submit' | 'reset';\n disabled?: boolean;\n href?: string;\n target?: string;\n rel?: string;\n renderLink?: unknown;\n };\n\n return (\n <button\n ref={ref as Ref<HTMLButtonElement>}\n type={type}\n disabled={disabled || loading}\n className={classes}\n aria-busy={loading || undefined}\n {...buttonProps}\n >\n {content}\n </button>\n );\n};\n"],"names":[],"mappings":";;;;;AAOO,MAAM,aAAa,CAAC;AAAA,EACvB,UAAU;AAAA,EACV;AAAA,EACA,eAAe;AAAA,EACf,OAAO;AAAA,EACP,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACP,MAAuB;AACnB,QAAM,aAAa,cAAc,SAAS,MAAM;AAChD,QAAM,WAAW,UAAU,SAAS,MAAM,QAAQ;AAElD,QAAM,UAAU;AAAA,IACZ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Y;AAAA,IAC9B;AAEA,UAAM,cAAc,UAAU,OAAO,IAAI,MAAM,KAAK,SAAS,EAAE,KAAK,GAAG,IAAI;AAE3E,UAAM,YAAY;AAAA,MACd,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,KAAK;AAAA,MACL,WAAW;AAAA,MACX,aAAa,WAAW;AAAA,MACxB,iBAAiB,WAAW;AAAA,MAC5B,UAAU,UAAU,KAAK;AAAA,MACzB,SAAS,UACH,CAAC,MAAqC;AAClC,UAAE,eAAA;AACF,UAAE,gBAAA;AAAA,MACN,IACA,gBAAgB;AAAA,MACtB,UAAU;AAAA,IAAA;AAGd,QAAI,YAAY;AACZ,aAAO,oBAAA,UAAA,EAAG,UAAA,WAAW,SAAS,GAAE;AAAA,IACpC;AAEA,WAAO,oBAAC,KAAA,EAAG,GAAG,UAAA,CAAW;AAAA,EAC7B;AAEA,QAAM;AAAA,IACF,OAAO;AAAA,IACP;AAAA,IACA,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,IACH;AAYJ,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACG;AAAA,MACA;AAAA,MACA,UAAU,YAAY;AAAA,MACtB,WAAW;AAAA,MACX,aAAW,WAAW;AAAA,MACrB,GAAG;AAAA,MAEH,UAAA;AAAA,IAAA;AAAA,EAAA;AAGb;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require('./IconButton.css');
|
|
2
|
+
"use strict";
|
|
3
|
+
const styles = {
|
|
4
|
+
"icon-button": "_icon-button_1dpxf_1",
|
|
5
|
+
"icon-button--normal": "_icon-button--normal_1dpxf_23",
|
|
6
|
+
"icon-button--small": "_icon-button--small_1dpxf_28",
|
|
7
|
+
"icon-button__label": "_icon-button__label_1dpxf_33",
|
|
8
|
+
"icon-button__icon": "_icon-button__icon_1dpxf_41",
|
|
9
|
+
"icon-button__spinner": "_icon-button__spinner_1dpxf_42",
|
|
10
|
+
"icon-button--default": "_icon-button--default_1dpxf_74",
|
|
11
|
+
"icon-button--link": "_icon-button--link_1dpxf_78",
|
|
12
|
+
"icon-button--disabled": "_icon-button--disabled_1dpxf_104",
|
|
13
|
+
"icon-button--loading": "_icon-button--loading_1dpxf_105"
|
|
14
|
+
};
|
|
15
|
+
module.exports = styles;
|
|
16
|
+
//# sourceMappingURL=IconButton.module.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import './IconButton.css';
|
|
2
|
+
const styles = {
|
|
3
|
+
"icon-button": "_icon-button_1dpxf_1",
|
|
4
|
+
"icon-button--normal": "_icon-button--normal_1dpxf_23",
|
|
5
|
+
"icon-button--small": "_icon-button--small_1dpxf_28",
|
|
6
|
+
"icon-button__label": "_icon-button__label_1dpxf_33",
|
|
7
|
+
"icon-button__icon": "_icon-button__icon_1dpxf_41",
|
|
8
|
+
"icon-button__spinner": "_icon-button__spinner_1dpxf_42",
|
|
9
|
+
"icon-button--default": "_icon-button--default_1dpxf_74",
|
|
10
|
+
"icon-button--link": "_icon-button--link_1dpxf_78",
|
|
11
|
+
"icon-button--disabled": "_icon-button--disabled_1dpxf_104",
|
|
12
|
+
"icon-button--loading": "_icon-button--loading_1dpxf_105"
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
styles as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=IconButton.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ComponentType, ReactNode, SVGProps } from 'react';
|
|
2
|
+
export type IconButtonVariant = 'default' | 'link';
|
|
3
|
+
export type IconPosition = 'start' | 'end';
|
|
4
|
+
export type IconButtonSize = 'normal' | 'small';
|
|
5
|
+
export type Icon = ComponentType<SVGProps<SVGSVGElement>>;
|
|
6
|
+
export interface IconButtonLinkProps extends ComponentPropsWithRef<'a'> {
|
|
7
|
+
readonly href: string;
|
|
8
|
+
readonly children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
interface IconButtonBaseProps {
|
|
11
|
+
/**
|
|
12
|
+
* Visual variant for text/icon coloring.
|
|
13
|
+
* @default 'default'
|
|
14
|
+
*/
|
|
15
|
+
readonly variant?: IconButtonVariant;
|
|
16
|
+
/** Icon component (for example, `ChevronRight` from `@dnanpm/icons`). */
|
|
17
|
+
readonly icon: Icon;
|
|
18
|
+
/** Visible label content used as the button/link accessible name. */
|
|
19
|
+
readonly children: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Position of the icon relative to label text.
|
|
22
|
+
* @default 'start'
|
|
23
|
+
*/
|
|
24
|
+
readonly iconPosition?: IconPosition;
|
|
25
|
+
/**
|
|
26
|
+
* Size variant controlling typography and icon size.
|
|
27
|
+
* @default 'normal'
|
|
28
|
+
*/
|
|
29
|
+
readonly size?: IconButtonSize;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the button is in a loading state.
|
|
32
|
+
* Label stays visible while icon slot shows a spinner.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
readonly loading?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export type IconButtonAsButton = IconButtonBaseProps & Omit<ComponentPropsWithRef<'button'>, keyof IconButtonBaseProps> & {
|
|
38
|
+
readonly href?: never;
|
|
39
|
+
readonly target?: never;
|
|
40
|
+
readonly rel?: never;
|
|
41
|
+
readonly renderLink?: never;
|
|
42
|
+
};
|
|
43
|
+
export type IconButtonAsAnchor = IconButtonBaseProps & Omit<ComponentPropsWithRef<'a'>, keyof IconButtonBaseProps> & {
|
|
44
|
+
readonly href: string;
|
|
45
|
+
readonly disabled?: never;
|
|
46
|
+
readonly type?: never;
|
|
47
|
+
readonly name?: never;
|
|
48
|
+
readonly renderLink?: (props: IconButtonLinkProps) => ReactNode;
|
|
49
|
+
};
|
|
50
|
+
export type IconButtonProps = IconButtonAsButton | IconButtonAsAnchor;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=IconButton.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.types.d.ts","sourceRoot":"","sources":["../../../src/components/IconButton/IconButton.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvF,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,MAAM,CAAC;AACnD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,CAAC;AAC3C,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,OAAO,CAAC;AAChD,MAAM,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAE1D,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB,CAAC,GAAG,CAAC;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAChC;AAED,UAAU,mBAAmB;IACzB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IACrC,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAChD,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,MAAM,mBAAmB,CAAC,GAAG;IAC/D,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;CAC/B,CAAC;AAEN,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAChD,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,MAAM,mBAAmB,CAAC,GAAG;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,SAAS,CAAC;CACnE,CAAC;AAEN,MAAM,MAAM,eAAe,GAAG,kBAAkB,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/IconButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EACR,IAAI,EACJ,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,iBAAiB,GACpB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -7,6 +7,7 @@ const Breadcrumb = require("./components/Breadcrumb/Breadcrumb.cjs");
|
|
|
7
7
|
const Button = require("./components/Button/Button.cjs");
|
|
8
8
|
const ColorScheme = require("./components/ColorScheme/ColorScheme.cjs");
|
|
9
9
|
const Hero = require("./components/Hero/Hero.cjs");
|
|
10
|
+
const IconButton = require("./components/IconButton/IconButton.cjs");
|
|
10
11
|
const Label = require("./components/Label/Label.cjs");
|
|
11
12
|
const Notification = require("./components/Notification/Notification.cjs");
|
|
12
13
|
const Pictograph = require("./components/Pictograph/Pictograph.cjs");
|
|
@@ -19,6 +20,7 @@ exports.Breadcrumb = Breadcrumb.Breadcrumb;
|
|
|
19
20
|
exports.Button = Button.Button;
|
|
20
21
|
exports.ColorScheme = ColorScheme.ColorScheme;
|
|
21
22
|
exports.Hero = Hero.Hero;
|
|
23
|
+
exports.IconButton = IconButton.IconButton;
|
|
22
24
|
exports.Label = Label.Label;
|
|
23
25
|
exports.Notification = Notification.Notification;
|
|
24
26
|
exports.Pictograph = Pictograph.Pictograph;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { Notification } from './components/Notification';
|
|
|
8
8
|
export { Label } from './components/Label';
|
|
9
9
|
export { Pictograph, PictographItem } from './components/Pictograph';
|
|
10
10
|
export { Spinner } from './components/Spinner';
|
|
11
|
+
export { IconButton } from './components/IconButton';
|
|
11
12
|
export type { AccordionProps } from './components/Accordion';
|
|
12
13
|
export type { AccordionItemProps } from './components/AccordionItem';
|
|
13
14
|
export type { BreadcrumbItem, BreadcrumbLinkProps, BreadcrumbProps } from './components/Breadcrumb';
|
|
@@ -18,6 +19,7 @@ export type { NotificationProps, NotificationVariant } from './components/Notifi
|
|
|
18
19
|
export type { LabelProps, LabelVariant } from './components/Label';
|
|
19
20
|
export type { PictographItemProps, PictographProps } from './components/Pictograph';
|
|
20
21
|
export type { SpinnerColor, SpinnerProps, SpinnerSize } from './components/Spinner';
|
|
22
|
+
export type { Icon, IconPosition, IconButtonLinkProps, IconButtonProps, IconButtonSize, IconButtonVariant, } from './components/IconButton';
|
|
21
23
|
export { cn } from './utils';
|
|
22
24
|
export type { CnDictionary, CnInput } from './utils';
|
|
23
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0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M,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Breadcrumb } from "./components/Breadcrumb/Breadcrumb.js";
|
|
|
5
5
|
import { Button } from "./components/Button/Button.js";
|
|
6
6
|
import { ColorScheme } from "./components/ColorScheme/ColorScheme.js";
|
|
7
7
|
import { Hero } from "./components/Hero/Hero.js";
|
|
8
|
+
import { IconButton } from "./components/IconButton/IconButton.js";
|
|
8
9
|
import { Label } from "./components/Label/Label.js";
|
|
9
10
|
import { Notification } from "./components/Notification/Notification.js";
|
|
10
11
|
import { Pictograph } from "./components/Pictograph/Pictograph.js";
|
|
@@ -18,6 +19,7 @@ export {
|
|
|
18
19
|
Button,
|
|
19
20
|
ColorScheme,
|
|
20
21
|
Hero,
|
|
22
|
+
IconButton,
|
|
21
23
|
Label,
|
|
22
24
|
Notification,
|
|
23
25
|
Pictograph,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|