@mirohq/design-system-toolbar 2.5.30 → 2.6.0-update-toolbar.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +184 -85
- package/dist/main.js.map +1 -1
- package/dist/module.js +185 -86
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +34 -36
- package/package.json +2 -1
package/dist/main.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var designSystemExperiments = require('@mirohq/design-system-experiments');
|
|
7
8
|
var designSystemStitches = require('@mirohq/design-system-stitches');
|
|
8
9
|
var RadixToolbar = require('@radix-ui/react-toolbar');
|
|
9
10
|
var interactions = require('@react-aria/interactions');
|
|
@@ -50,18 +51,40 @@ const StyledToolbar = designSystemStitches.styled(RadixToolbar.Root, {
|
|
|
50
51
|
height: "$12"
|
|
51
52
|
},
|
|
52
53
|
variants: {
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
v1: {
|
|
55
|
+
true: {}
|
|
56
|
+
},
|
|
57
|
+
variant: {
|
|
58
|
+
floating: {},
|
|
59
|
+
flat: {}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
compoundVariants: [
|
|
63
|
+
{
|
|
64
|
+
variant: "floating",
|
|
65
|
+
v1: false,
|
|
66
|
+
css: {
|
|
55
67
|
backgroundColor: "$background-neutrals-container",
|
|
56
68
|
boxShadow: "$50",
|
|
57
69
|
borderRadius: "$50",
|
|
58
70
|
padding: "2px"
|
|
59
71
|
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
variant: "floating",
|
|
75
|
+
v1: true,
|
|
76
|
+
css: {
|
|
77
|
+
backgroundColor: "$background-neutrals-layout",
|
|
78
|
+
boxShadow: "0px 1px 8px 0px rgba(34, 36, 40, 0.05)",
|
|
79
|
+
border: "0.5px solid $border-neutrals-subtle",
|
|
80
|
+
borderRadius: "$100",
|
|
81
|
+
padding: "$50"
|
|
82
|
+
}
|
|
60
83
|
}
|
|
61
|
-
|
|
84
|
+
]
|
|
62
85
|
});
|
|
63
86
|
|
|
64
|
-
const
|
|
87
|
+
const StyledItem = designSystemStitches.styled(RadixToolbar__namespace.Button, {
|
|
65
88
|
boxSizing: "border-box",
|
|
66
89
|
cursor: "pointer",
|
|
67
90
|
userSelect: "none",
|
|
@@ -69,63 +92,6 @@ const defaultStyles = {
|
|
|
69
92
|
alignItems: "center",
|
|
70
93
|
justifyContent: "center",
|
|
71
94
|
flexShrink: 0
|
|
72
|
-
};
|
|
73
|
-
const disabledSelector = '&[disabled], &[aria-disabled="true"]';
|
|
74
|
-
const StyledItem = designSystemStitches.styled(RadixToolbar__namespace.Button, {
|
|
75
|
-
variants: {
|
|
76
|
-
unstyled: {
|
|
77
|
-
true: {
|
|
78
|
-
...defaultStyles
|
|
79
|
-
},
|
|
80
|
-
false: {
|
|
81
|
-
...defaultStyles,
|
|
82
|
-
borderRadius: 4,
|
|
83
|
-
height: "$10",
|
|
84
|
-
...designSystemStyles.focus.css({
|
|
85
|
-
boxShadow: "$focus-small",
|
|
86
|
-
outline: "1px solid transparent"
|
|
87
|
-
}),
|
|
88
|
-
[disabledSelector]: {
|
|
89
|
-
pointerEvents: "none",
|
|
90
|
-
color: "$text-neutrals-disabled"
|
|
91
|
-
},
|
|
92
|
-
"&[data-hovered]": {
|
|
93
|
-
backgroundColor: "$background-primary-subtle-hover",
|
|
94
|
-
color: "$icon-primary-hover"
|
|
95
|
-
},
|
|
96
|
-
"&:active, &[data-pressed]": {
|
|
97
|
-
backgroundColor: "$background-primary-subtle-active",
|
|
98
|
-
color: "$icon-primary-active"
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
wrapper: {
|
|
103
|
-
true: {
|
|
104
|
-
backgroundColor: "transparent",
|
|
105
|
-
border: "none",
|
|
106
|
-
cursor: "pointer"
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
active: {
|
|
110
|
-
true: {},
|
|
111
|
-
false: {}
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
'&[tabindex="0"]': {
|
|
115
|
-
zIndex: "1"
|
|
116
|
-
},
|
|
117
|
-
compoundVariants: [
|
|
118
|
-
{
|
|
119
|
-
unstyled: false,
|
|
120
|
-
active: true,
|
|
121
|
-
css: {
|
|
122
|
-
"&&": {
|
|
123
|
-
backgroundColor: "$background-primary-subtle-selected",
|
|
124
|
-
color: "$icon-primary-selected"
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
]
|
|
129
95
|
});
|
|
130
96
|
|
|
131
97
|
const Item = React__default["default"].forwardRef(
|
|
@@ -133,8 +99,6 @@ const Item = React__default["default"].forwardRef(
|
|
|
133
99
|
disabled = false,
|
|
134
100
|
"aria-disabled": ariaDisabled,
|
|
135
101
|
asChild,
|
|
136
|
-
unstyled = true,
|
|
137
|
-
active = false,
|
|
138
102
|
onHoverStart,
|
|
139
103
|
onHoverEnd,
|
|
140
104
|
onHoverChange,
|
|
@@ -158,9 +122,6 @@ const Item = React__default["default"].forwardRef(
|
|
|
158
122
|
...elementProps,
|
|
159
123
|
"data-hovered": isHovered ? "" : void 0,
|
|
160
124
|
asChild,
|
|
161
|
-
active,
|
|
162
|
-
unstyled: asChild === true ? unstyled : false,
|
|
163
|
-
wrapper: asChild !== true,
|
|
164
125
|
disabled,
|
|
165
126
|
"aria-disabled": designSystemUtils.booleanify(ariaDisabled) ? "true" : ariaDisabled,
|
|
166
127
|
ref: forwardRef
|
|
@@ -169,16 +130,120 @@ const Item = React__default["default"].forwardRef(
|
|
|
169
130
|
}
|
|
170
131
|
);
|
|
171
132
|
|
|
133
|
+
const disabledSelector = '&[disabled], &[aria-disabled="true"]';
|
|
134
|
+
const sharedStyles = {
|
|
135
|
+
base: {
|
|
136
|
+
backgroundColor: "$transparent",
|
|
137
|
+
borderRadius: "$50",
|
|
138
|
+
height: "$10",
|
|
139
|
+
border: "none"
|
|
140
|
+
},
|
|
141
|
+
old: {
|
|
142
|
+
...designSystemStyles.focus.css({
|
|
143
|
+
boxShadow: "$focus-small",
|
|
144
|
+
outline: "1px solid transparent"
|
|
145
|
+
}),
|
|
146
|
+
[disabledSelector]: {
|
|
147
|
+
pointerEvents: "none",
|
|
148
|
+
color: "$text-neutrals-disabled"
|
|
149
|
+
},
|
|
150
|
+
"&[data-hovered]": {
|
|
151
|
+
backgroundColor: "$background-primary-subtle-hover",
|
|
152
|
+
color: "$icon-primary-hover"
|
|
153
|
+
},
|
|
154
|
+
"&:active, &[data-pressed]": {
|
|
155
|
+
backgroundColor: "$background-primary-subtle-active",
|
|
156
|
+
color: "$icon-primary-active"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
v1: {
|
|
160
|
+
...designSystemStyles.focus.css({
|
|
161
|
+
boxShadow: "$focus-v1"
|
|
162
|
+
}),
|
|
163
|
+
"&[data-hovered]": {
|
|
164
|
+
backgroundColor: "$background-neutrals-hover"
|
|
165
|
+
},
|
|
166
|
+
"&:active, &[data-pressed]": {
|
|
167
|
+
backgroundColor: "$background-neutrals-active"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
172
|
const StyledIcon = designSystemStitches.styled(Item, {
|
|
173
173
|
padding: 0,
|
|
174
|
-
border: "none",
|
|
175
174
|
font: "unset",
|
|
176
175
|
width: "$10",
|
|
177
|
-
color: "$icon-neutrals"
|
|
176
|
+
color: "$icon-neutrals",
|
|
177
|
+
...sharedStyles.base,
|
|
178
|
+
variants: {
|
|
179
|
+
v1: {
|
|
180
|
+
true: {},
|
|
181
|
+
false: {}
|
|
182
|
+
},
|
|
183
|
+
active: {
|
|
184
|
+
true: {},
|
|
185
|
+
false: {}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
'&[tabindex="0"]': {
|
|
189
|
+
zIndex: "1"
|
|
190
|
+
},
|
|
191
|
+
compoundVariants: [
|
|
192
|
+
{
|
|
193
|
+
v1: true,
|
|
194
|
+
active: true,
|
|
195
|
+
css: {
|
|
196
|
+
backgroundColor: "$background-primary-subtle",
|
|
197
|
+
color: "$icon-primary-selected"
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
v1: false,
|
|
202
|
+
active: true,
|
|
203
|
+
css: {
|
|
204
|
+
backgroundColor: "$background-primary-subtle-selected",
|
|
205
|
+
color: "$icon-primary-selected"
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
v1: true,
|
|
210
|
+
active: false,
|
|
211
|
+
css: {
|
|
212
|
+
...sharedStyles.v1,
|
|
213
|
+
[disabledSelector]: {
|
|
214
|
+
pointerEvents: "none",
|
|
215
|
+
color: "$icon-neutrals-disabled"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
v1: false,
|
|
221
|
+
active: false,
|
|
222
|
+
css: sharedStyles.old
|
|
223
|
+
}
|
|
224
|
+
]
|
|
178
225
|
});
|
|
179
226
|
|
|
227
|
+
const ToolbarContext = React.createContext({});
|
|
228
|
+
const ToolbarProvider = ({
|
|
229
|
+
children,
|
|
230
|
+
...restProps
|
|
231
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
232
|
+
ToolbarContext.Provider,
|
|
233
|
+
{
|
|
234
|
+
value: {
|
|
235
|
+
...restProps
|
|
236
|
+
},
|
|
237
|
+
children
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
const useToolbarContext = () => React.useContext(ToolbarContext);
|
|
241
|
+
|
|
180
242
|
const Icon = React__default["default"].forwardRef(
|
|
181
|
-
(
|
|
243
|
+
({ active = false, ...restProps }, forwardRef) => {
|
|
244
|
+
const { v1 } = useToolbarContext();
|
|
245
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledIcon, { ...restProps, v1, active, ref: forwardRef });
|
|
246
|
+
}
|
|
182
247
|
);
|
|
183
248
|
|
|
184
249
|
const StyledSeparator = designSystemStitches.styled(RadixToolbar.Separator, {
|
|
@@ -195,39 +260,73 @@ const StyledSeparator = designSystemStitches.styled(RadixToolbar.Separator, {
|
|
|
195
260
|
height: "1px",
|
|
196
261
|
width: "$6",
|
|
197
262
|
margin: "$50 0"
|
|
263
|
+
},
|
|
264
|
+
variants: {
|
|
265
|
+
v1: {
|
|
266
|
+
true: { backgroundColor: "$border-neutrals-subtle" }
|
|
267
|
+
}
|
|
198
268
|
}
|
|
199
269
|
});
|
|
200
270
|
|
|
201
|
-
const Separator = React__default["default"].forwardRef((props, forwardRef) =>
|
|
271
|
+
const Separator = React__default["default"].forwardRef((props, forwardRef) => {
|
|
272
|
+
const { v1 } = useToolbarContext();
|
|
273
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledSeparator, { ...props, v1, ref: forwardRef });
|
|
274
|
+
});
|
|
202
275
|
|
|
203
276
|
const StyledLink = designSystemStitches.styled(Item, {
|
|
204
277
|
paddingX: "$150",
|
|
205
|
-
textDecoration: "none"
|
|
278
|
+
textDecoration: "none",
|
|
279
|
+
...sharedStyles.base,
|
|
280
|
+
variants: {
|
|
281
|
+
v1: {
|
|
282
|
+
true: {
|
|
283
|
+
...sharedStyles.v1,
|
|
284
|
+
color: "$text-primary",
|
|
285
|
+
textDecoration: "underline solid",
|
|
286
|
+
textDecorationThickness: "1px",
|
|
287
|
+
textUnderlineOffset: "4px",
|
|
288
|
+
outline: "none",
|
|
289
|
+
[disabledSelector]: {
|
|
290
|
+
pointerEvents: "none",
|
|
291
|
+
color: "$text-neutrals-disabled"
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
false: sharedStyles.old
|
|
295
|
+
}
|
|
296
|
+
}
|
|
206
297
|
});
|
|
207
298
|
|
|
208
299
|
const Link = React__default["default"].forwardRef(
|
|
209
|
-
({ children, href, ...restProps }, forwardRef) =>
|
|
300
|
+
({ children, href, ...restProps }, forwardRef) => {
|
|
301
|
+
const { v1 } = useToolbarContext();
|
|
302
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledLink, { ...restProps, asChild: true, v1, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href, ref: forwardRef, children }) });
|
|
303
|
+
}
|
|
210
304
|
);
|
|
211
305
|
|
|
212
306
|
const Toolbar = React__default["default"].forwardRef(
|
|
213
307
|
({
|
|
214
|
-
unstyled
|
|
308
|
+
unstyled,
|
|
215
309
|
orientation = "horizontal",
|
|
310
|
+
variant = "floating",
|
|
216
311
|
dir = "ltr",
|
|
217
312
|
loop = true,
|
|
218
|
-
direction,
|
|
219
313
|
...restProps
|
|
220
|
-
}, forwardRef) =>
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
314
|
+
}, forwardRef) => {
|
|
315
|
+
const [v1] = designSystemExperiments.useNewDesignLanguage();
|
|
316
|
+
const variantProp = unstyled === void 0 ? variant : unstyled ? "flat" : "floating";
|
|
317
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToolbarProvider, { v1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
318
|
+
StyledToolbar,
|
|
319
|
+
{
|
|
320
|
+
v1,
|
|
321
|
+
variant: variantProp,
|
|
322
|
+
orientation,
|
|
323
|
+
dir,
|
|
324
|
+
loop,
|
|
325
|
+
ref: forwardRef,
|
|
326
|
+
...restProps
|
|
327
|
+
}
|
|
328
|
+
) });
|
|
329
|
+
}
|
|
231
330
|
);
|
|
232
331
|
Toolbar.Icon = Icon;
|
|
233
332
|
Toolbar.Item = Item;
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":["../src/toolbar.styled.ts","../src/partials/item.styled.ts","../src/partials/item.tsx","../src/partials/icon.styled.tsx","../src/partials/icon.tsx","../src/partials/separator.styled.ts","../src/partials/separator.tsx","../src/partials/link.styled.tsx","../src/partials/link.tsx","../src/toolbar.tsx"],"sourcesContent":["import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Root } from '@radix-ui/react-toolbar'\n\nexport const StyledToolbar = styled(Root, {\n all: 'unset',\n display: 'flex',\n boxSizing: 'border-box',\n alignItems: 'center',\n maxWidth: '100%',\n gap: '$50',\n\n '&[data-orientation=\"vertical\"]': {\n flexDirection: 'column',\n width: '$12',\n },\n\n '&[data-orientation=\"horizontal\"]': {\n height: '$12',\n },\n\n variants: {\n unstyled: {\n false: {\n backgroundColor: '$background-neutrals-container',\n boxShadow: '$50',\n borderRadius: '$50',\n padding: '2px',\n },\n },\n },\n})\n\nexport type StyledToolbarProps = StrictComponentProps<typeof StyledToolbar>\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport * as RadixToolbar from '@radix-ui/react-toolbar'\nimport { focus } from '@mirohq/design-system-styles'\n\nconst defaultStyles = {\n boxSizing: 'border-box',\n cursor: 'pointer',\n userSelect: 'none',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n}\n\nconst disabledSelector = '&[disabled], &[aria-disabled=\"true\"]'\n\nexport const StyledItem = styled(RadixToolbar.Button, {\n variants: {\n unstyled: {\n true: {\n ...defaultStyles,\n },\n false: {\n ...defaultStyles,\n borderRadius: 4,\n height: '$10',\n\n ...focus.css({\n boxShadow: '$focus-small',\n outline: '1px solid transparent',\n }),\n\n [disabledSelector]: {\n pointerEvents: 'none',\n color: '$text-neutrals-disabled',\n },\n\n '&[data-hovered]': {\n backgroundColor: '$background-primary-subtle-hover',\n color: '$icon-primary-hover',\n },\n\n '&:active, &[data-pressed]': {\n backgroundColor: '$background-primary-subtle-active',\n color: '$icon-primary-active',\n },\n },\n },\n wrapper: {\n true: {\n backgroundColor: 'transparent',\n border: 'none',\n cursor: 'pointer',\n },\n },\n active: {\n true: {},\n false: {},\n },\n },\n\n '&[tabindex=\"0\"]': {\n zIndex: '1',\n },\n\n compoundVariants: [\n {\n unstyled: false,\n active: true,\n css: {\n '&&': {\n backgroundColor: '$background-primary-subtle-selected',\n color: '$icon-primary-selected',\n },\n },\n },\n ],\n})\n\nexport type StyledItemProps = StrictComponentProps<typeof StyledItem>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { useHover } from '@react-aria/interactions'\nimport type { HoverEvents } from '@react-types/shared'\nimport { mergeProps } from '@react-aria/utils'\nimport { usePress } from '@mirohq/design-system-use-press'\nimport { booleanify } from '@mirohq/design-system-utils'\nimport type { PressEvents } from '@mirohq/design-system-use-press'\n\nimport { StyledItem } from './item.styled'\nimport type { StyledItemProps } from './item.styled'\n\nexport interface ItemProps extends StyledItemProps, HoverEvents, PressEvents {\n /**\n * Renders item in enabled/toggled state.\n * @default false\n */\n active?: boolean\n\n /**\n * It's applied by default when using with asChild attribute.\n * You can still combine default Item styles with your own component by\n * setting this prop to false.\n * Note: Must be used together with asChild\n * @default true\n */\n unstyled?: boolean\n\n disabled?: boolean\n}\n\nexport const Item = React.forwardRef<ElementRef<typeof StyledItem>, ItemProps>(\n (\n {\n disabled = false,\n 'aria-disabled': ariaDisabled,\n asChild,\n unstyled = true,\n active = false,\n onHoverStart,\n onHoverEnd,\n onHoverChange,\n ...restProps\n },\n forwardRef\n ) => {\n let elementProps = restProps\n\n const { pressProps } = usePress({\n preventFocusOnPress: 'auto',\n disabled: disabled || booleanify(ariaDisabled),\n ...elementProps,\n })\n\n const { hoverProps, isHovered } = useHover({\n onHoverStart,\n onHoverEnd,\n onHoverChange,\n })\n\n elementProps = mergeProps(pressProps, hoverProps)\n\n return (\n <StyledItem\n {...elementProps}\n data-hovered={isHovered ? '' : undefined}\n asChild={asChild}\n active={active}\n unstyled={asChild === true ? unstyled : false}\n wrapper={asChild !== true}\n disabled={disabled}\n aria-disabled={booleanify(ariaDisabled) ? 'true' : ariaDisabled}\n ref={forwardRef}\n />\n )\n }\n)\n","import { styled } from '@mirohq/design-system-stitches'\n\nimport { Item } from './item'\n\nexport const StyledIcon = styled(Item, {\n padding: 0,\n border: 'none',\n font: 'unset',\n width: '$10',\n color: '$icon-neutrals',\n})\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport type { ItemProps } from './item'\nimport { StyledIcon } from './icon.styled'\n\nexport type IconProps = Omit<ItemProps, 'unstyled'>\n\nexport const Icon = React.forwardRef<ElementRef<typeof StyledIcon>, IconProps>(\n (props, forwardRef) => (\n <StyledIcon unstyled={false} {...props} ref={forwardRef} />\n )\n)\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Separator } from '@radix-ui/react-toolbar'\n\nexport const StyledSeparator = styled(Separator, {\n all: 'unset',\n display: 'block',\n boxSizing: 'border-box',\n backgroundColor: 'rgba(205, 204, 215, 1)',\n\n '&[data-orientation=\"vertical\"]': {\n width: '1px',\n height: '$6',\n margin: '0 $50',\n },\n\n '&[data-orientation=\"horizontal\"]': {\n height: '1px',\n width: '$6',\n margin: '$50 0',\n },\n})\n\nexport type StyledSeparatorProps = StrictComponentProps<typeof StyledSeparator>\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport type { StyledSeparatorProps } from './separator.styled'\nimport { StyledSeparator } from './separator.styled'\n\nexport interface SeparatorProps extends StyledSeparatorProps {}\n\nexport const Separator = React.forwardRef<\n ElementRef<typeof StyledSeparator>,\n SeparatorProps\n>((props, forwardRef) => <StyledSeparator {...props} ref={forwardRef} />)\n","import { styled } from '@mirohq/design-system-stitches'\n\nimport { Item } from './item'\n\nexport const StyledLink = styled(Item, {\n paddingX: '$150',\n textDecoration: 'none',\n})\n","import React from 'react'\nimport type { ElementRef, AnchorHTMLAttributes } from 'react'\n\nimport type { ItemProps } from './item'\nimport { StyledLink } from './link.styled'\n\ntype ItemPropsWithAnchor = Omit<ItemProps, 'unstyled'> &\n AnchorHTMLAttributes<typeof StyledLink>\nexport interface LinkProps extends ItemPropsWithAnchor {}\n\nexport const Link = React.forwardRef<ElementRef<typeof StyledLink>, LinkProps>(\n ({ children, href, ...restProps }, forwardRef) => (\n <StyledLink asChild unstyled={false} {...restProps} ref={forwardRef}>\n <a href={href}>{children}</a>\n </StyledLink>\n )\n)\n","import React from 'react'\nimport type { ElementRef, ForwardRefExoticComponent } from 'react'\n\nimport type { StyledToolbarProps } from './toolbar.styled'\nimport { StyledToolbar } from './toolbar.styled'\nimport { Icon } from './partials/icon'\nimport { Separator } from './partials/separator'\nimport { Link } from './partials/link'\nimport { Item } from './partials/item'\n\nexport interface ToolbarProps extends StyledToolbarProps {\n /**\n * Defines whether the toolbar has default styles (e.g. background, shadow, etc.)\n * @default false\n */\n unstyled?: boolean\n\n /**\n * The orientation of the toolbar\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical'\n\n /**\n * The reading direction of the toolbar\n * @default 'ltr'\n */\n dir?: 'ltr' | 'rtl'\n\n /**\n * The reading direction of the toolbar\n * @deprecated use dir instead\n */\n direction?: 'ltr' | 'rtl'\n\n /**\n * When true, keyboard navigation will loop from last tab to first, and vice versa\n * @default true\n */\n loop?: boolean\n}\n\nexport const Toolbar = React.forwardRef<\n ElementRef<typeof StyledToolbar>,\n ToolbarProps\n>(\n (\n {\n unstyled = false,\n orientation = 'horizontal',\n dir = 'ltr',\n loop = true,\n direction,\n ...restProps\n },\n forwardRef\n ) => (\n <StyledToolbar\n unstyled={unstyled}\n orientation={orientation}\n dir={direction ?? dir}\n loop={loop}\n ref={forwardRef}\n {...restProps}\n />\n )\n) as ForwardRefExoticComponent<ToolbarProps> & Partials\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Icon: typeof Icon\n Item: typeof Item\n Link: typeof Link\n Separator: typeof Separator\n}\n\nToolbar.Icon = Icon\nToolbar.Item = Item\nToolbar.Link = Link\nToolbar.Separator = Separator\n"],"names":["styled","Root","RadixToolbar","focus","React","usePress","booleanify","useHover","mergeProps","jsx","Separator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIa,MAAA,aAAA,GAAgBA,4BAAOC,iBAAM,EAAA;AAAA,EACxC,GAAK,EAAA,OAAA;AAAA,EACL,OAAS,EAAA,MAAA;AAAA,EACT,SAAW,EAAA,YAAA;AAAA,EACX,UAAY,EAAA,QAAA;AAAA,EACZ,QAAU,EAAA,MAAA;AAAA,EACV,GAAK,EAAA,KAAA;AAAA,EAEL,gCAAkC,EAAA;AAAA,IAChC,aAAe,EAAA,QAAA;AAAA,IACf,KAAO,EAAA,KAAA;AAAA,GACT;AAAA,EAEA,kCAAoC,EAAA;AAAA,IAClC,MAAQ,EAAA,KAAA;AAAA,GACV;AAAA,EAEA,QAAU,EAAA;AAAA,IACR,QAAU,EAAA;AAAA,MACR,KAAO,EAAA;AAAA,QACL,eAAiB,EAAA,gCAAA;AAAA,QACjB,SAAW,EAAA,KAAA;AAAA,QACX,YAAc,EAAA,KAAA;AAAA,QACd,OAAS,EAAA,KAAA;AAAA,OACX;AAAA,KACF;AAAA,GACF;AACF,CAAC,CAAA;;AC1BD,MAAM,aAAgB,GAAA;AAAA,EACpB,SAAW,EAAA,YAAA;AAAA,EACX,MAAQ,EAAA,SAAA;AAAA,EACR,UAAY,EAAA,MAAA;AAAA,EACZ,OAAS,EAAA,MAAA;AAAA,EACT,UAAY,EAAA,QAAA;AAAA,EACZ,cAAgB,EAAA,QAAA;AAAA,EAChB,UAAY,EAAA,CAAA;AACd,CAAA,CAAA;AAEA,MAAM,gBAAmB,GAAA,sCAAA,CAAA;AAEZ,MAAA,UAAA,GAAaD,2BAAO,CAAAE,uBAAA,CAAa,MAAQ,EAAA;AAAA,EACpD,QAAU,EAAA;AAAA,IACR,QAAU,EAAA;AAAA,MACR,IAAM,EAAA;AAAA,QACJ,GAAG,aAAA;AAAA,OACL;AAAA,MACA,KA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cAAA,CAAA,GAAA,EAAA,EAAE,IAAa,EAAA,QAAA,EAAS,CAC3B,EAAA,CAAA;AAEJ,CAAA;;AC0BO,MAAM,UAAUL,yBAAM,CAAA,UAAA;AAAA,EAI3B,CACE;AAAA,IACE,QAAW,GAAA,KAAA;AAAA,IACX,WAAc,GAAA,YAAA;AAAA,IACd,GAAM,GAAA,KAAA;AAAA,IACN,IAAO,GAAA,IAAA;AAAA,IACP,SAAA;AAAA,IACA,GAAG,SAAA;AAAA,KAEL,UAEA,qBAAAK,cAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,QAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAK,SAAa,IAAA,IAAA,GAAA,SAAA,GAAA,GAAA;AAAA,MAClB,IAAA;AAAA,MACA,GAAK,EAAA,UAAA;AAAA,MACJ,GAAG,SAAA;AAAA,KAAA;AAAA,GACN;AAEJ,EAAA;AAYA,OAAA,CAAQ,IAAO,GAAA,IAAA,CAAA;AACf,OAAA,CAAQ,IAAO,GAAA,IAAA,CAAA;AACf,OAAA,CAAQ,IAAO,GAAA,IAAA,CAAA;AACf,OAAA,CAAQ,SAAY,GAAA,SAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"main.js","sources":["../src/toolbar.styled.ts","../src/partials/item.styled.ts","../src/partials/item.tsx","../src/styles.ts","../src/partials/icon.styled.tsx","../src/hooks/use-toolbar-context.tsx","../src/partials/icon.tsx","../src/partials/separator.styled.ts","../src/partials/separator.tsx","../src/partials/link.styled.tsx","../src/partials/link.tsx","../src/toolbar.tsx"],"sourcesContent":["import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Root } from '@radix-ui/react-toolbar'\n\nexport const StyledToolbar = styled(Root, {\n all: 'unset',\n display: 'flex',\n boxSizing: 'border-box',\n alignItems: 'center',\n maxWidth: '100%',\n gap: '$50',\n\n '&[data-orientation=\"vertical\"]': {\n flexDirection: 'column',\n width: '$12',\n },\n\n '&[data-orientation=\"horizontal\"]': {\n height: '$12',\n },\n\n variants: {\n v1: {\n true: {},\n },\n variant: {\n floating: {},\n flat: {},\n },\n },\n compoundVariants: [\n {\n variant: 'floating',\n v1: false,\n css: {\n backgroundColor: '$background-neutrals-container',\n boxShadow: '$50',\n borderRadius: '$50',\n padding: '2px',\n },\n },\n {\n variant: 'floating',\n v1: true,\n css: {\n backgroundColor: '$background-neutrals-layout',\n boxShadow: '0px 1px 8px 0px rgba(34, 36, 40, 0.05)',\n border: '0.5px solid $border-neutrals-subtle',\n borderRadius: '$100',\n padding: '$50',\n },\n },\n ],\n})\n\nexport type StyledToolbarProps = StrictComponentProps<typeof StyledToolbar>\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport * as RadixToolbar from '@radix-ui/react-toolbar'\n\nexport const StyledItem = styled(RadixToolbar.Button, {\n boxSizing: 'border-box',\n cursor: 'pointer',\n userSelect: 'none',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n})\n\nexport type StyledItemProps = StrictComponentProps<typeof StyledItem>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { useHover } from '@react-aria/interactions'\nimport type { HoverEvents } from '@react-types/shared'\nimport { mergeProps } from '@react-aria/utils'\nimport { usePress } from '@mirohq/design-system-use-press'\nimport { booleanify } from '@mirohq/design-system-utils'\nimport type { PressEvents } from '@mirohq/design-system-use-press'\n\nimport { StyledItem } from './item.styled'\nimport type { StyledItemProps } from './item.styled'\n\nexport interface ItemProps extends StyledItemProps, HoverEvents, PressEvents {\n /**\n * @deprecated Toolbar.Item does no longer support any styling\n */\n unstyled?: boolean\n\n disabled?: boolean\n}\n\nexport const Item = React.forwardRef<ElementRef<typeof StyledItem>, ItemProps>(\n (\n {\n disabled = false,\n 'aria-disabled': ariaDisabled,\n asChild,\n onHoverStart,\n onHoverEnd,\n onHoverChange,\n ...restProps\n },\n forwardRef\n ) => {\n let elementProps = restProps\n\n const { pressProps } = usePress({\n preventFocusOnPress: 'auto',\n disabled: disabled || booleanify(ariaDisabled),\n ...elementProps,\n })\n\n const { hoverProps, isHovered } = useHover({\n onHoverStart,\n onHoverEnd,\n onHoverChange,\n })\n\n elementProps = mergeProps(pressProps, hoverProps)\n\n return (\n <StyledItem\n {...elementProps}\n data-hovered={isHovered ? '' : undefined}\n asChild={asChild}\n disabled={disabled}\n aria-disabled={booleanify(ariaDisabled) ? 'true' : ariaDisabled}\n ref={forwardRef}\n />\n )\n }\n)\n","import { focus } from '@mirohq/design-system-styles'\n\nexport const disabledSelector = '&[disabled], &[aria-disabled=\"true\"]'\n\nexport const sharedStyles = {\n base: {\n backgroundColor: '$transparent',\n borderRadius: '$50',\n height: '$10',\n border: 'none',\n },\n old: {\n ...focus.css({\n boxShadow: '$focus-small',\n outline: '1px solid transparent',\n }),\n\n [disabledSelector]: {\n pointerEvents: 'none',\n color: '$text-neutrals-disabled',\n },\n\n '&[data-hovered]': {\n backgroundColor: '$background-primary-subtle-hover',\n color: '$icon-primary-hover',\n },\n\n '&:active, &[data-pressed]': {\n backgroundColor: '$background-primary-subtle-active',\n color: '$icon-primary-active',\n },\n },\n v1: {\n ...focus.css({\n boxShadow: '$focus-v1',\n }),\n\n '&[data-hovered]': {\n backgroundColor: '$background-neutrals-hover',\n },\n\n '&:active, &[data-pressed]': {\n backgroundColor: '$background-neutrals-active',\n },\n },\n}\n","import { styled } from '@mirohq/design-system-stitches'\n\nimport { Item } from './item'\nimport { disabledSelector, sharedStyles } from '../styles'\n\nexport const StyledIcon = styled(Item, {\n padding: 0,\n font: 'unset',\n width: '$10',\n color: '$icon-neutrals',\n\n ...sharedStyles.base,\n\n variants: {\n v1: {\n true: {},\n false: {},\n },\n active: {\n true: {},\n false: {},\n },\n },\n\n '&[tabindex=\"0\"]': {\n zIndex: '1',\n },\n\n compoundVariants: [\n {\n v1: true,\n active: true,\n css: {\n backgroundColor: '$background-primary-subtle',\n color: '$icon-primary-selected',\n },\n },\n {\n v1: false,\n active: true,\n css: {\n backgroundColor: '$background-primary-subtle-selected',\n color: '$icon-primary-selected',\n },\n },\n {\n v1: true,\n active: false,\n css: {\n ...sharedStyles.v1,\n\n [disabledSelector]: {\n pointerEvents: 'none',\n color: '$icon-neutrals-disabled',\n },\n },\n },\n {\n v1: false,\n active: false,\n css: sharedStyles.old,\n },\n ],\n})\n","import React, { createContext, useContext } from 'react'\nimport type { PropsWithChildren } from 'react'\n\ninterface ToolbarProps {\n v1: boolean\n}\n\ntype ToolbarContextProps = ToolbarProps\n\nexport type ToolbarProviderProps = ToolbarProps\n\nconst ToolbarContext = createContext<ToolbarContextProps>({} as any)\n\nexport const ToolbarProvider = ({\n children,\n ...restProps\n}: PropsWithChildren<ToolbarProviderProps>): React.ReactElement => (\n <ToolbarContext.Provider\n value={{\n ...restProps,\n }}\n >\n {children}\n </ToolbarContext.Provider>\n)\n\nexport const useToolbarContext = (): ToolbarContextProps =>\n useContext(ToolbarContext)\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport type { ItemProps } from './item'\nimport { StyledIcon } from './icon.styled'\nimport { useToolbarContext } from '../hooks/use-toolbar-context'\n\nexport interface IconProps extends Omit<ItemProps, 'unstyled' | 'v1'> {\n /**\n * Renders item in enabled/toggled state.\n * @default false\n */\n active?: boolean\n}\n\nexport const Icon = React.forwardRef<ElementRef<typeof StyledIcon>, IconProps>(\n ({ active = false, ...restProps }, forwardRef) => {\n const { v1 } = useToolbarContext()\n\n return (\n <StyledIcon {...restProps} v1={v1} active={active} ref={forwardRef} />\n )\n }\n)\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Separator } from '@radix-ui/react-toolbar'\n\nexport const StyledSeparator = styled(Separator, {\n all: 'unset',\n display: 'block',\n boxSizing: 'border-box',\n backgroundColor: 'rgba(205, 204, 215, 1)',\n\n '&[data-orientation=\"vertical\"]': {\n width: '1px',\n height: '$6',\n margin: '0 $50',\n },\n\n '&[data-orientation=\"horizontal\"]': {\n height: '1px',\n width: '$6',\n margin: '$50 0',\n },\n\n variants: {\n v1: {\n true: { backgroundColor: '$border-neutrals-subtle' },\n },\n },\n})\n\nexport type StyledSeparatorProps = StrictComponentProps<typeof StyledSeparator>\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport type { StyledSeparatorProps } from './separator.styled'\nimport { StyledSeparator } from './separator.styled'\nimport { useToolbarContext } from '../hooks/use-toolbar-context'\n\nexport interface SeparatorProps extends Omit<StyledSeparatorProps, 'v1'> {}\n\nexport const Separator = React.forwardRef<\n ElementRef<typeof StyledSeparator>,\n SeparatorProps\n>((props, forwardRef) => {\n const { v1 } = useToolbarContext()\n\n return <StyledSeparator {...props} v1={v1} ref={forwardRef} />\n})\n","import { styled } from '@mirohq/design-system-stitches'\n\nimport { Item } from './item'\nimport { disabledSelector, sharedStyles } from '../styles'\n\nexport const StyledLink = styled(Item, {\n paddingX: '$150',\n textDecoration: 'none',\n\n ...sharedStyles.base,\n\n variants: {\n v1: {\n true: {\n ...sharedStyles.v1,\n color: '$text-primary',\n textDecoration: 'underline solid',\n textDecorationThickness: '1px',\n textUnderlineOffset: '4px',\n outline: 'none',\n\n [disabledSelector]: {\n pointerEvents: 'none',\n color: '$text-neutrals-disabled',\n },\n },\n false: sharedStyles.old,\n },\n },\n})\n","import React from 'react'\nimport type { ElementRef, AnchorHTMLAttributes } from 'react'\n\nimport type { ItemProps } from './item'\nimport { StyledLink } from './link.styled'\nimport { useToolbarContext } from '../hooks/use-toolbar-context'\n\ntype ItemPropsWithAnchor = Omit<ItemProps, 'unstyled' | 'v1' | 'ref'> &\n AnchorHTMLAttributes<typeof StyledLink>\nexport interface LinkProps extends ItemPropsWithAnchor {}\n\nexport const Link = React.forwardRef<ElementRef<'a'>, LinkProps>(\n ({ children, href, ...restProps }, forwardRef) => {\n const { v1 } = useToolbarContext()\n\n return (\n <StyledLink {...restProps} asChild v1={v1}>\n <a href={href} ref={forwardRef}>\n {children}\n </a>\n </StyledLink>\n )\n }\n)\n","import React from 'react'\nimport type { ElementRef, ForwardRefExoticComponent } from 'react'\nimport { useNewDesignLanguage } from '@mirohq/design-system-experiments'\n\nimport type { StyledToolbarProps } from './toolbar.styled'\nimport { StyledToolbar } from './toolbar.styled'\nimport { Icon } from './partials/icon'\nimport { Separator } from './partials/separator'\nimport { Link } from './partials/link'\nimport { Item } from './partials/item'\nimport { ToolbarProvider } from './hooks/use-toolbar-context'\n\nexport interface ToolbarProps extends Omit<StyledToolbarProps, 'v1'> {\n /**\n * @deprecated Please use variant for non-floating toolbar\n */\n unstyled?: boolean\n\n /**\n * When floating, the toolbar has shadow and border to differentiate it from the surface\n * @default floating\n */\n variant?: StyledToolbarProps['variant']\n\n /**\n * The orientation of the toolbar\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical'\n\n /**\n * The reading direction of the toolbar\n * @default 'ltr'\n */\n dir?: 'ltr' | 'rtl'\n\n /**\n * When true, keyboard navigation will loop from last tab to first, and vice versa\n * @default true\n */\n loop?: boolean\n}\n\nexport const Toolbar = React.forwardRef<\n ElementRef<typeof StyledToolbar>,\n ToolbarProps\n>(\n (\n {\n unstyled,\n orientation = 'horizontal',\n variant = 'floating',\n dir = 'ltr',\n loop = true,\n ...restProps\n },\n forwardRef\n ) => {\n const [v1] = useNewDesignLanguage()\n\n const variantProp =\n unstyled === undefined ? variant : unstyled ? 'flat' : 'floating'\n\n return (\n <ToolbarProvider v1={v1}>\n <StyledToolbar\n v1={v1}\n variant={variantProp}\n orientation={orientation}\n dir={dir}\n loop={loop}\n ref={forwardRef}\n {...restProps}\n />\n </ToolbarProvider>\n )\n }\n) as ForwardRefExoticComponent<ToolbarProps> & Partials\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Icon: typeof Icon\n Item: typeof Item\n Link: typeof Link\n Separator: typeof Separator\n}\n\nToolbar.Icon = Icon\nToolbar.Item = Item\nToolbar.Link = Link\nToolbar.Separator = Separator\n"],"names":["styled","Root","RadixToolbar","React","usePress","booleanify","useHover","mergeProps","jsx","focus","createContext","useContext","Separator","useNewDesignLanguage"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIa,MAAA,aAAA,GAAgBA,4BAAOC,iBAAM,EAAA;AAAA,EACxC,GAAK,EAAA,OAAA;AAAA,EACL,OAAS,EAAA,MAAA;AAAA,EACT,SAAW,EAAA,YAAA;AAAA,EACX,UAAY,EAAA,QAAA;AAAA,EACZ,QAAU,EAAA,MAAA;AAAA,EACV,GAAK,EAAA,KAAA;AAAA,EAEL,gCAAkC,EAAA;AAAA,IAChC,aAAe,EAAA,QAAA;AAAA,IACf,KAAO,EAAA,KAAA;AAAA,GACT;AAAA,EAEA,kCAAoC,EAAA;AAAA,IAClC,MAAQ,EAAA,KAAA;AAAA,GACV;AAAA,EAEA,QAAU,EAAA;AAAA,IACR,EAAI,EAAA;AAAA,MACF,MAAM,EAAC;AAAA,KACT;AAAA,IACA,OAAS,EAAA;AAAA,MACP,UAAU,EAAC;AAAA,MACX,MAAM,EAAC;AAAA,KACT;AAAA,GACF;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB;AAAA,MACE,OAAS,EAAA,UAAA;AAAA,MACT,EAAI,EAAA,KAAA;AAAA,MACJ,GAAK,EAAA;AAAA,QACH,eAAiB,EAAA,gCAAA;AAAA,QACjB,SAAW,EAAA,KAAA;AAAA,QACX,YAAc,EAAA,KAAA;AAAA,QACd,OAAS,EAAA,KAAA;AAAA,OACX;AAAA,KACF;AAAA,IACA;AAAA,MACE,OAAS,EAAA,UAAA;AAAA,MACT,EAAI,EAAA,IAAA;AAAA,MACJ,GAAK,EAAA;AAAA,QACH,eAAiB,EAAA,6BAAA;AAAA,QACjB,SAAW,EAAA,wCAAA;AAAA,QACX,MAAQ,EAAA,qCAAA;AAAA,QACR,YAAc,EAAA,MAAA;AAAA,QACd,OAAS,EAAA,KAAA;AAAA,OACX;AAAA,KACF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;AAAA,IACV,GAAM,GAAA,KAAA;AAAA,IACN,IAAO,GAAA,IAAA;AAAA,IACP,GAAG,SAAA;AAAA,KAEL,UACG,KAAA;AACH,IAAM,MAAA,CAAC,EAAE,CAAA,GAAIU,4CAAqB,EAAA,CAAA;AAElC,IAAA,MAAM,WACJ,GAAA,QAAA,KAAa,KAAY,CAAA,GAAA,OAAA,GAAU,WAAW,MAAS,GAAA,UAAA,CAAA;AAEzD,IACE,uBAAAL,cAAA,CAAC,mBAAgB,EACf,EAAA,QAAA,kBAAAA,cAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,EAAA;AAAA,QACA,OAAS,EAAA,WAAA;AAAA,QACT,WAAA;AAAA,QACA,GAAA;AAAA,QACA,IAAA;AAAA,QACA,GAAK,EAAA,UAAA;AAAA,QACJ,GAAG,SAAA;AAAA,OAAA;AAAA,KAER,EAAA,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAYA,OAAA,CAAQ,IAAO,GAAA,IAAA,CAAA;AACf,OAAA,CAAQ,IAAO,GAAA,IAAA,CAAA;AACf,OAAA,CAAQ,IAAO,GAAA,IAAA,CAAA;AACf,OAAA,CAAQ,SAAY,GAAA,SAAA;;;;"}
|
package/dist/module.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { createContext, useContext } from 'react';
|
|
3
|
+
import { useNewDesignLanguage } from '@mirohq/design-system-experiments';
|
|
3
4
|
import { styled } from '@mirohq/design-system-stitches';
|
|
4
5
|
import * as RadixToolbar from '@radix-ui/react-toolbar';
|
|
5
6
|
import { Root, Separator as Separator$1 } from '@radix-ui/react-toolbar';
|
|
@@ -24,18 +25,40 @@ const StyledToolbar = styled(Root, {
|
|
|
24
25
|
height: "$12"
|
|
25
26
|
},
|
|
26
27
|
variants: {
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
v1: {
|
|
29
|
+
true: {}
|
|
30
|
+
},
|
|
31
|
+
variant: {
|
|
32
|
+
floating: {},
|
|
33
|
+
flat: {}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
compoundVariants: [
|
|
37
|
+
{
|
|
38
|
+
variant: "floating",
|
|
39
|
+
v1: false,
|
|
40
|
+
css: {
|
|
29
41
|
backgroundColor: "$background-neutrals-container",
|
|
30
42
|
boxShadow: "$50",
|
|
31
43
|
borderRadius: "$50",
|
|
32
44
|
padding: "2px"
|
|
33
45
|
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
variant: "floating",
|
|
49
|
+
v1: true,
|
|
50
|
+
css: {
|
|
51
|
+
backgroundColor: "$background-neutrals-layout",
|
|
52
|
+
boxShadow: "0px 1px 8px 0px rgba(34, 36, 40, 0.05)",
|
|
53
|
+
border: "0.5px solid $border-neutrals-subtle",
|
|
54
|
+
borderRadius: "$100",
|
|
55
|
+
padding: "$50"
|
|
56
|
+
}
|
|
34
57
|
}
|
|
35
|
-
|
|
58
|
+
]
|
|
36
59
|
});
|
|
37
60
|
|
|
38
|
-
const
|
|
61
|
+
const StyledItem = styled(RadixToolbar.Button, {
|
|
39
62
|
boxSizing: "border-box",
|
|
40
63
|
cursor: "pointer",
|
|
41
64
|
userSelect: "none",
|
|
@@ -43,63 +66,6 @@ const defaultStyles = {
|
|
|
43
66
|
alignItems: "center",
|
|
44
67
|
justifyContent: "center",
|
|
45
68
|
flexShrink: 0
|
|
46
|
-
};
|
|
47
|
-
const disabledSelector = '&[disabled], &[aria-disabled="true"]';
|
|
48
|
-
const StyledItem = styled(RadixToolbar.Button, {
|
|
49
|
-
variants: {
|
|
50
|
-
unstyled: {
|
|
51
|
-
true: {
|
|
52
|
-
...defaultStyles
|
|
53
|
-
},
|
|
54
|
-
false: {
|
|
55
|
-
...defaultStyles,
|
|
56
|
-
borderRadius: 4,
|
|
57
|
-
height: "$10",
|
|
58
|
-
...focus.css({
|
|
59
|
-
boxShadow: "$focus-small",
|
|
60
|
-
outline: "1px solid transparent"
|
|
61
|
-
}),
|
|
62
|
-
[disabledSelector]: {
|
|
63
|
-
pointerEvents: "none",
|
|
64
|
-
color: "$text-neutrals-disabled"
|
|
65
|
-
},
|
|
66
|
-
"&[data-hovered]": {
|
|
67
|
-
backgroundColor: "$background-primary-subtle-hover",
|
|
68
|
-
color: "$icon-primary-hover"
|
|
69
|
-
},
|
|
70
|
-
"&:active, &[data-pressed]": {
|
|
71
|
-
backgroundColor: "$background-primary-subtle-active",
|
|
72
|
-
color: "$icon-primary-active"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
wrapper: {
|
|
77
|
-
true: {
|
|
78
|
-
backgroundColor: "transparent",
|
|
79
|
-
border: "none",
|
|
80
|
-
cursor: "pointer"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
active: {
|
|
84
|
-
true: {},
|
|
85
|
-
false: {}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
'&[tabindex="0"]': {
|
|
89
|
-
zIndex: "1"
|
|
90
|
-
},
|
|
91
|
-
compoundVariants: [
|
|
92
|
-
{
|
|
93
|
-
unstyled: false,
|
|
94
|
-
active: true,
|
|
95
|
-
css: {
|
|
96
|
-
"&&": {
|
|
97
|
-
backgroundColor: "$background-primary-subtle-selected",
|
|
98
|
-
color: "$icon-primary-selected"
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
69
|
});
|
|
104
70
|
|
|
105
71
|
const Item = React.forwardRef(
|
|
@@ -107,8 +73,6 @@ const Item = React.forwardRef(
|
|
|
107
73
|
disabled = false,
|
|
108
74
|
"aria-disabled": ariaDisabled,
|
|
109
75
|
asChild,
|
|
110
|
-
unstyled = true,
|
|
111
|
-
active = false,
|
|
112
76
|
onHoverStart,
|
|
113
77
|
onHoverEnd,
|
|
114
78
|
onHoverChange,
|
|
@@ -132,9 +96,6 @@ const Item = React.forwardRef(
|
|
|
132
96
|
...elementProps,
|
|
133
97
|
"data-hovered": isHovered ? "" : void 0,
|
|
134
98
|
asChild,
|
|
135
|
-
active,
|
|
136
|
-
unstyled: asChild === true ? unstyled : false,
|
|
137
|
-
wrapper: asChild !== true,
|
|
138
99
|
disabled,
|
|
139
100
|
"aria-disabled": booleanify(ariaDisabled) ? "true" : ariaDisabled,
|
|
140
101
|
ref: forwardRef
|
|
@@ -143,16 +104,120 @@ const Item = React.forwardRef(
|
|
|
143
104
|
}
|
|
144
105
|
);
|
|
145
106
|
|
|
107
|
+
const disabledSelector = '&[disabled], &[aria-disabled="true"]';
|
|
108
|
+
const sharedStyles = {
|
|
109
|
+
base: {
|
|
110
|
+
backgroundColor: "$transparent",
|
|
111
|
+
borderRadius: "$50",
|
|
112
|
+
height: "$10",
|
|
113
|
+
border: "none"
|
|
114
|
+
},
|
|
115
|
+
old: {
|
|
116
|
+
...focus.css({
|
|
117
|
+
boxShadow: "$focus-small",
|
|
118
|
+
outline: "1px solid transparent"
|
|
119
|
+
}),
|
|
120
|
+
[disabledSelector]: {
|
|
121
|
+
pointerEvents: "none",
|
|
122
|
+
color: "$text-neutrals-disabled"
|
|
123
|
+
},
|
|
124
|
+
"&[data-hovered]": {
|
|
125
|
+
backgroundColor: "$background-primary-subtle-hover",
|
|
126
|
+
color: "$icon-primary-hover"
|
|
127
|
+
},
|
|
128
|
+
"&:active, &[data-pressed]": {
|
|
129
|
+
backgroundColor: "$background-primary-subtle-active",
|
|
130
|
+
color: "$icon-primary-active"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
v1: {
|
|
134
|
+
...focus.css({
|
|
135
|
+
boxShadow: "$focus-v1"
|
|
136
|
+
}),
|
|
137
|
+
"&[data-hovered]": {
|
|
138
|
+
backgroundColor: "$background-neutrals-hover"
|
|
139
|
+
},
|
|
140
|
+
"&:active, &[data-pressed]": {
|
|
141
|
+
backgroundColor: "$background-neutrals-active"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
146
|
const StyledIcon = styled(Item, {
|
|
147
147
|
padding: 0,
|
|
148
|
-
border: "none",
|
|
149
148
|
font: "unset",
|
|
150
149
|
width: "$10",
|
|
151
|
-
color: "$icon-neutrals"
|
|
150
|
+
color: "$icon-neutrals",
|
|
151
|
+
...sharedStyles.base,
|
|
152
|
+
variants: {
|
|
153
|
+
v1: {
|
|
154
|
+
true: {},
|
|
155
|
+
false: {}
|
|
156
|
+
},
|
|
157
|
+
active: {
|
|
158
|
+
true: {},
|
|
159
|
+
false: {}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
'&[tabindex="0"]': {
|
|
163
|
+
zIndex: "1"
|
|
164
|
+
},
|
|
165
|
+
compoundVariants: [
|
|
166
|
+
{
|
|
167
|
+
v1: true,
|
|
168
|
+
active: true,
|
|
169
|
+
css: {
|
|
170
|
+
backgroundColor: "$background-primary-subtle",
|
|
171
|
+
color: "$icon-primary-selected"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
v1: false,
|
|
176
|
+
active: true,
|
|
177
|
+
css: {
|
|
178
|
+
backgroundColor: "$background-primary-subtle-selected",
|
|
179
|
+
color: "$icon-primary-selected"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
v1: true,
|
|
184
|
+
active: false,
|
|
185
|
+
css: {
|
|
186
|
+
...sharedStyles.v1,
|
|
187
|
+
[disabledSelector]: {
|
|
188
|
+
pointerEvents: "none",
|
|
189
|
+
color: "$icon-neutrals-disabled"
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
v1: false,
|
|
195
|
+
active: false,
|
|
196
|
+
css: sharedStyles.old
|
|
197
|
+
}
|
|
198
|
+
]
|
|
152
199
|
});
|
|
153
200
|
|
|
201
|
+
const ToolbarContext = createContext({});
|
|
202
|
+
const ToolbarProvider = ({
|
|
203
|
+
children,
|
|
204
|
+
...restProps
|
|
205
|
+
}) => /* @__PURE__ */ jsx(
|
|
206
|
+
ToolbarContext.Provider,
|
|
207
|
+
{
|
|
208
|
+
value: {
|
|
209
|
+
...restProps
|
|
210
|
+
},
|
|
211
|
+
children
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
const useToolbarContext = () => useContext(ToolbarContext);
|
|
215
|
+
|
|
154
216
|
const Icon = React.forwardRef(
|
|
155
|
-
(
|
|
217
|
+
({ active = false, ...restProps }, forwardRef) => {
|
|
218
|
+
const { v1 } = useToolbarContext();
|
|
219
|
+
return /* @__PURE__ */ jsx(StyledIcon, { ...restProps, v1, active, ref: forwardRef });
|
|
220
|
+
}
|
|
156
221
|
);
|
|
157
222
|
|
|
158
223
|
const StyledSeparator = styled(Separator$1, {
|
|
@@ -169,39 +234,73 @@ const StyledSeparator = styled(Separator$1, {
|
|
|
169
234
|
height: "1px",
|
|
170
235
|
width: "$6",
|
|
171
236
|
margin: "$50 0"
|
|
237
|
+
},
|
|
238
|
+
variants: {
|
|
239
|
+
v1: {
|
|
240
|
+
true: { backgroundColor: "$border-neutrals-subtle" }
|
|
241
|
+
}
|
|
172
242
|
}
|
|
173
243
|
});
|
|
174
244
|
|
|
175
|
-
const Separator = React.forwardRef((props, forwardRef) =>
|
|
245
|
+
const Separator = React.forwardRef((props, forwardRef) => {
|
|
246
|
+
const { v1 } = useToolbarContext();
|
|
247
|
+
return /* @__PURE__ */ jsx(StyledSeparator, { ...props, v1, ref: forwardRef });
|
|
248
|
+
});
|
|
176
249
|
|
|
177
250
|
const StyledLink = styled(Item, {
|
|
178
251
|
paddingX: "$150",
|
|
179
|
-
textDecoration: "none"
|
|
252
|
+
textDecoration: "none",
|
|
253
|
+
...sharedStyles.base,
|
|
254
|
+
variants: {
|
|
255
|
+
v1: {
|
|
256
|
+
true: {
|
|
257
|
+
...sharedStyles.v1,
|
|
258
|
+
color: "$text-primary",
|
|
259
|
+
textDecoration: "underline solid",
|
|
260
|
+
textDecorationThickness: "1px",
|
|
261
|
+
textUnderlineOffset: "4px",
|
|
262
|
+
outline: "none",
|
|
263
|
+
[disabledSelector]: {
|
|
264
|
+
pointerEvents: "none",
|
|
265
|
+
color: "$text-neutrals-disabled"
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
false: sharedStyles.old
|
|
269
|
+
}
|
|
270
|
+
}
|
|
180
271
|
});
|
|
181
272
|
|
|
182
273
|
const Link = React.forwardRef(
|
|
183
|
-
({ children, href, ...restProps }, forwardRef) =>
|
|
274
|
+
({ children, href, ...restProps }, forwardRef) => {
|
|
275
|
+
const { v1 } = useToolbarContext();
|
|
276
|
+
return /* @__PURE__ */ jsx(StyledLink, { ...restProps, asChild: true, v1, children: /* @__PURE__ */ jsx("a", { href, ref: forwardRef, children }) });
|
|
277
|
+
}
|
|
184
278
|
);
|
|
185
279
|
|
|
186
280
|
const Toolbar = React.forwardRef(
|
|
187
281
|
({
|
|
188
|
-
unstyled
|
|
282
|
+
unstyled,
|
|
189
283
|
orientation = "horizontal",
|
|
284
|
+
variant = "floating",
|
|
190
285
|
dir = "ltr",
|
|
191
286
|
loop = true,
|
|
192
|
-
direction,
|
|
193
287
|
...restProps
|
|
194
|
-
}, forwardRef) =>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
288
|
+
}, forwardRef) => {
|
|
289
|
+
const [v1] = useNewDesignLanguage();
|
|
290
|
+
const variantProp = unstyled === void 0 ? variant : unstyled ? "flat" : "floating";
|
|
291
|
+
return /* @__PURE__ */ jsx(ToolbarProvider, { v1, children: /* @__PURE__ */ jsx(
|
|
292
|
+
StyledToolbar,
|
|
293
|
+
{
|
|
294
|
+
v1,
|
|
295
|
+
variant: variantProp,
|
|
296
|
+
orientation,
|
|
297
|
+
dir,
|
|
298
|
+
loop,
|
|
299
|
+
ref: forwardRef,
|
|
300
|
+
...restProps
|
|
301
|
+
}
|
|
302
|
+
) });
|
|
303
|
+
}
|
|
205
304
|
);
|
|
206
305
|
Toolbar.Icon = Icon;
|
|
207
306
|
Toolbar.Item = Item;
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../src/toolbar.styled.ts","../src/partials/item.styled.ts","../src/partials/item.tsx","../src/partials/icon.styled.tsx","../src/partials/icon.tsx","../src/partials/separator.styled.ts","../src/partials/separator.tsx","../src/partials/link.styled.tsx","../src/partials/link.tsx","../src/toolbar.tsx"],"sourcesContent":["import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Root } from '@radix-ui/react-toolbar'\n\nexport const StyledToolbar = styled(Root, {\n all: 'unset',\n display: 'flex',\n boxSizing: 'border-box',\n alignItems: 'center',\n maxWidth: '100%',\n gap: '$50',\n\n '&[data-orientation=\"vertical\"]': {\n flexDirection: 'column',\n width: '$12',\n },\n\n '&[data-orientation=\"horizontal\"]': {\n height: '$12',\n },\n\n variants: {\n unstyled: {\n false: {\n backgroundColor: '$background-neutrals-container',\n boxShadow: '$50',\n borderRadius: '$50',\n padding: '2px',\n },\n },\n },\n})\n\nexport type StyledToolbarProps = StrictComponentProps<typeof StyledToolbar>\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport * as RadixToolbar from '@radix-ui/react-toolbar'\nimport { focus } from '@mirohq/design-system-styles'\n\nconst defaultStyles = {\n boxSizing: 'border-box',\n cursor: 'pointer',\n userSelect: 'none',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n}\n\nconst disabledSelector = '&[disabled], &[aria-disabled=\"true\"]'\n\nexport const StyledItem = styled(RadixToolbar.Button, {\n variants: {\n unstyled: {\n true: {\n ...defaultStyles,\n },\n false: {\n ...defaultStyles,\n borderRadius: 4,\n height: '$10',\n\n ...focus.css({\n boxShadow: '$focus-small',\n outline: '1px solid transparent',\n }),\n\n [disabledSelector]: {\n pointerEvents: 'none',\n color: '$text-neutrals-disabled',\n },\n\n '&[data-hovered]': {\n backgroundColor: '$background-primary-subtle-hover',\n color: '$icon-primary-hover',\n },\n\n '&:active, &[data-pressed]': {\n backgroundColor: '$background-primary-subtle-active',\n color: '$icon-primary-active',\n },\n },\n },\n wrapper: {\n true: {\n backgroundColor: 'transparent',\n border: 'none',\n cursor: 'pointer',\n },\n },\n active: {\n true: {},\n false: {},\n },\n },\n\n '&[tabindex=\"0\"]': {\n zIndex: '1',\n },\n\n compoundVariants: [\n {\n unstyled: false,\n active: true,\n css: {\n '&&': {\n backgroundColor: '$background-primary-subtle-selected',\n color: '$icon-primary-selected',\n },\n },\n },\n ],\n})\n\nexport type StyledItemProps = StrictComponentProps<typeof StyledItem>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { useHover } from '@react-aria/interactions'\nimport type { HoverEvents } from '@react-types/shared'\nimport { mergeProps } from '@react-aria/utils'\nimport { usePress } from '@mirohq/design-system-use-press'\nimport { booleanify } from '@mirohq/design-system-utils'\nimport type { PressEvents } from '@mirohq/design-system-use-press'\n\nimport { StyledItem } from './item.styled'\nimport type { StyledItemProps } from './item.styled'\n\nexport interface ItemProps extends StyledItemProps, HoverEvents, PressEvents {\n /**\n * Renders item in enabled/toggled state.\n * @default false\n */\n active?: boolean\n\n /**\n * It's applied by default when using with asChild attribute.\n * You can still combine default Item styles with your own component by\n * setting this prop to false.\n * Note: Must be used together with asChild\n * @default true\n */\n unstyled?: boolean\n\n disabled?: boolean\n}\n\nexport const Item = React.forwardRef<ElementRef<typeof StyledItem>, ItemProps>(\n (\n {\n disabled = false,\n 'aria-disabled': ariaDisabled,\n asChild,\n unstyled = true,\n active = false,\n onHoverStart,\n onHoverEnd,\n onHoverChange,\n ...restProps\n },\n forwardRef\n ) => {\n let elementProps = restProps\n\n const { pressProps } = usePress({\n preventFocusOnPress: 'auto',\n disabled: disabled || booleanify(ariaDisabled),\n ...elementProps,\n })\n\n const { hoverProps, isHovered } = useHover({\n onHoverStart,\n onHoverEnd,\n onHoverChange,\n })\n\n elementProps = mergeProps(pressProps, hoverProps)\n\n return (\n <StyledItem\n {...elementProps}\n data-hovered={isHovered ? '' : undefined}\n asChild={asChild}\n active={active}\n unstyled={asChild === true ? unstyled : false}\n wrapper={asChild !== true}\n disabled={disabled}\n aria-disabled={booleanify(ariaDisabled) ? 'true' : ariaDisabled}\n ref={forwardRef}\n />\n )\n }\n)\n","import { styled } from '@mirohq/design-system-stitches'\n\nimport { Item } from './item'\n\nexport const StyledIcon = styled(Item, {\n padding: 0,\n border: 'none',\n font: 'unset',\n width: '$10',\n color: '$icon-neutrals',\n})\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport type { ItemProps } from './item'\nimport { StyledIcon } from './icon.styled'\n\nexport type IconProps = Omit<ItemProps, 'unstyled'>\n\nexport const Icon = React.forwardRef<ElementRef<typeof StyledIcon>, IconProps>(\n (props, forwardRef) => (\n <StyledIcon unstyled={false} {...props} ref={forwardRef} />\n )\n)\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Separator } from '@radix-ui/react-toolbar'\n\nexport const StyledSeparator = styled(Separator, {\n all: 'unset',\n display: 'block',\n boxSizing: 'border-box',\n backgroundColor: 'rgba(205, 204, 215, 1)',\n\n '&[data-orientation=\"vertical\"]': {\n width: '1px',\n height: '$6',\n margin: '0 $50',\n },\n\n '&[data-orientation=\"horizontal\"]': {\n height: '1px',\n width: '$6',\n margin: '$50 0',\n },\n})\n\nexport type StyledSeparatorProps = StrictComponentProps<typeof StyledSeparator>\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport type { StyledSeparatorProps } from './separator.styled'\nimport { StyledSeparator } from './separator.styled'\n\nexport interface SeparatorProps extends StyledSeparatorProps {}\n\nexport const Separator = React.forwardRef<\n ElementRef<typeof StyledSeparator>,\n SeparatorProps\n>((props, forwardRef) => <StyledSeparator {...props} ref={forwardRef} />)\n","import { styled } from '@mirohq/design-system-stitches'\n\nimport { Item } from './item'\n\nexport const StyledLink = styled(Item, {\n paddingX: '$150',\n textDecoration: 'none',\n})\n","import React from 'react'\nimport type { ElementRef, AnchorHTMLAttributes } from 'react'\n\nimport type { ItemProps } from './item'\nimport { StyledLink } from './link.styled'\n\ntype ItemPropsWithAnchor = Omit<ItemProps, 'unstyled'> &\n AnchorHTMLAttributes<typeof StyledLink>\nexport interface LinkProps extends ItemPropsWithAnchor {}\n\nexport const Link = React.forwardRef<ElementRef<typeof StyledLink>, LinkProps>(\n ({ children, href, ...restProps }, forwardRef) => (\n <StyledLink asChild unstyled={false} {...restProps} ref={forwardRef}>\n <a href={href}>{children}</a>\n </StyledLink>\n )\n)\n","import React from 'react'\nimport type { ElementRef, ForwardRefExoticComponent } from 'react'\n\nimport type { StyledToolbarProps } from './toolbar.styled'\nimport { StyledToolbar } from './toolbar.styled'\nimport { Icon } from './partials/icon'\nimport { Separator } from './partials/separator'\nimport { Link } from './partials/link'\nimport { Item } from './partials/item'\n\nexport interface ToolbarProps extends StyledToolbarProps {\n /**\n * Defines whether the toolbar has default styles (e.g. background, shadow, etc.)\n * @default false\n */\n unstyled?: boolean\n\n /**\n * The orientation of the toolbar\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical'\n\n /**\n * The reading direction of the toolbar\n * @default 'ltr'\n */\n dir?: 'ltr' | 'rtl'\n\n /**\n * The reading direction of the toolbar\n * @deprecated use dir instead\n */\n direction?: 'ltr' | 'rtl'\n\n /**\n * When true, keyboard navigation will loop from last tab to first, and vice versa\n * @default true\n */\n loop?: boolean\n}\n\nexport const Toolbar = React.forwardRef<\n ElementRef<typeof StyledToolbar>,\n ToolbarProps\n>(\n (\n {\n unstyled = false,\n orientation = 'horizontal',\n dir = 'ltr',\n loop = true,\n direction,\n ...restProps\n },\n forwardRef\n ) => (\n <StyledToolbar\n unstyled={unstyled}\n orientation={orientation}\n dir={direction ?? dir}\n loop={loop}\n ref={forwardRef}\n {...restProps}\n />\n )\n) as ForwardRefExoticComponent<ToolbarProps> & Partials\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Icon: typeof Icon\n Item: typeof Item\n Link: typeof Link\n Separator: typeof Separator\n}\n\nToolbar.Icon = Icon\nToolbar.Item = Item\nToolbar.Link = Link\nToolbar.Separator = Separator\n"],"names":["Separator"],"mappings":";;;;;;;;;;;AAIa,MAAA,aAAA,GAAgB,OAAO,IAAM,EAAA;AAAA,EACxC,GAAK,EAAA,OAAA;AAAA,EACL,OAAS,EAAA,MAAA;AAAA,EACT,SAAW,EAAA,YAAA;AAAA,EACX,UAAY,EAAA,QAAA;AAAA,EACZ,QAAU,EAAA,MAAA;AAAA,EACV,GAAK,EAAA,KAAA;AAAA,EAEL,gCAAkC,EAAA;AAAA,IAChC,aAAe,EAAA,QAAA;AAAA,IACf,KAAO,EAAA,KAAA;AAAA,GACT;AAAA,EAEA,kCAAoC,EAAA;AAAA,IAClC,MAAQ,EAAA,KAAA;AAAA,GACV;AAAA,EAEA,QAAU,EAAA;AAAA,IACR,QAAU,EAAA;AAAA,MACR,KAAO,EAAA;AAAA,QACL,eAAiB,EAAA,gCAAA;AAAA,QACjB,SAAW,EAAA,KAAA;AAAA,QACX,YAAc,EAAA,KAAA;AAAA,QACd,OAAS,EAAA,KAAA;AAAA,OACX;AAAA,KACF;AAAA,GACF;AACF,CAAC,CAAA;;AC1BD,MAAM,aAAgB,GAAA;AAAA,EACpB,SAAW,EAAA,YAAA;AAAA,EACX,MAAQ,EAAA,SAAA;AAAA,EACR,UAAY,EAAA,MAAA;AAAA,EACZ,OAAS,EAAA,MAAA;AAAA,EACT,UAAY,EAAA,QAAA;AAAA,EACZ,cAAgB,EAAA,QAAA;AAAA,EAChB,UAAY,EAAA,CAAA;AACd,CAAA,CAAA;AAEA,MAAM,gBAAmB,GAAA,sCAAA,CAAA;AAEZ,MAAA,UAAA,GAA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A,CAAC,UAAW,EAAA,EAAA,OAAA,EAAO,MAAC,QAAU,EAAA,KAAA,EAAQ,GAAG,SAAW,EAAA,GAAA,EAAK,YACvD,QAAC,kBAAA,GAAA,CAAA,GAAA,EAAA,EAAE,IAAa,EAAA,QAAA,EAAS,CAC3B,EAAA,CAAA;AAEJ,CAAA;;AC0BO,MAAM,UAAU,KAAM,CAAA,UAAA;AAAA,EAI3B,CACE;AAAA,IACE,QAAW,GAAA,KAAA;AAAA,IACX,WAAc,GAAA,YAAA;AAAA,IACd,GAAM,GAAA,KAAA;AAAA,IACN,IAAO,GAAA,IAAA;AAAA,IACP,SAAA;AAAA,IACA,GAAG,SAAA;AAAA,KAEL,UAEA,qBAAA,GAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,QAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAK,SAAa,IAAA,IAAA,GAAA,SAAA,GAAA,GAAA;AAAA,MAClB,IAAA;AAAA,MACA,GAAK,EAAA,UAAA;AAAA,MACJ,GAAG,SAAA;AAAA,KAAA;AAAA,GACN;AAEJ,EAAA;AAYA,OAAA,CAAQ,IAAO,GAAA,IAAA,CAAA;AACf,OAAA,CAAQ,IAAO,GAAA,IAAA,CAAA;AACf,OAAA,CAAQ,IAAO,GAAA,IAAA,CAAA;AACf,OAAA,CAAQ,SAAY,GAAA,SAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../src/toolbar.styled.ts","../src/partials/item.styled.ts","../src/partials/item.tsx","../src/styles.ts","../src/partials/icon.styled.tsx","../src/hooks/use-toolbar-context.tsx","../src/partials/icon.tsx","../src/partials/separator.styled.ts","../src/partials/separator.tsx","../src/partials/link.styled.tsx","../src/partials/link.tsx","../src/toolbar.tsx"],"sourcesContent":["import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Root } from '@radix-ui/react-toolbar'\n\nexport const StyledToolbar = styled(Root, {\n all: 'unset',\n display: 'flex',\n boxSizing: 'border-box',\n alignItems: 'center',\n maxWidth: '100%',\n gap: '$50',\n\n '&[data-orientation=\"vertical\"]': {\n flexDirection: 'column',\n width: '$12',\n },\n\n '&[data-orientation=\"horizontal\"]': {\n height: '$12',\n },\n\n variants: {\n v1: {\n true: {},\n },\n variant: {\n floating: {},\n flat: {},\n },\n },\n compoundVariants: [\n {\n variant: 'floating',\n v1: false,\n css: {\n backgroundColor: '$background-neutrals-container',\n boxShadow: '$50',\n borderRadius: '$50',\n padding: '2px',\n },\n },\n {\n variant: 'floating',\n v1: true,\n css: {\n backgroundColor: '$background-neutrals-layout',\n boxShadow: '0px 1px 8px 0px rgba(34, 36, 40, 0.05)',\n border: '0.5px solid $border-neutrals-subtle',\n borderRadius: '$100',\n padding: '$50',\n },\n },\n ],\n})\n\nexport type StyledToolbarProps = StrictComponentProps<typeof StyledToolbar>\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport * as RadixToolbar from '@radix-ui/react-toolbar'\n\nexport const StyledItem = styled(RadixToolbar.Button, {\n boxSizing: 'border-box',\n cursor: 'pointer',\n userSelect: 'none',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n})\n\nexport type StyledItemProps = StrictComponentProps<typeof StyledItem>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { useHover } from '@react-aria/interactions'\nimport type { HoverEvents } from '@react-types/shared'\nimport { mergeProps } from '@react-aria/utils'\nimport { usePress } from '@mirohq/design-system-use-press'\nimport { booleanify } from '@mirohq/design-system-utils'\nimport type { PressEvents } from '@mirohq/design-system-use-press'\n\nimport { StyledItem } from './item.styled'\nimport type { StyledItemProps } from './item.styled'\n\nexport interface ItemProps extends StyledItemProps, HoverEvents, PressEvents {\n /**\n * @deprecated Toolbar.Item does no longer support any styling\n */\n unstyled?: boolean\n\n disabled?: boolean\n}\n\nexport const Item = React.forwardRef<ElementRef<typeof StyledItem>, ItemProps>(\n (\n {\n disabled = false,\n 'aria-disabled': ariaDisabled,\n asChild,\n onHoverStart,\n onHoverEnd,\n onHoverChange,\n ...restProps\n },\n forwardRef\n ) => {\n let elementProps = restProps\n\n const { pressProps } = usePress({\n preventFocusOnPress: 'auto',\n disabled: disabled || booleanify(ariaDisabled),\n ...elementProps,\n })\n\n const { hoverProps, isHovered } = useHover({\n onHoverStart,\n onHoverEnd,\n onHoverChange,\n })\n\n elementProps = mergeProps(pressProps, hoverProps)\n\n return (\n <StyledItem\n {...elementProps}\n data-hovered={isHovered ? '' : undefined}\n asChild={asChild}\n disabled={disabled}\n aria-disabled={booleanify(ariaDisabled) ? 'true' : ariaDisabled}\n ref={forwardRef}\n />\n )\n }\n)\n","import { focus } from '@mirohq/design-system-styles'\n\nexport const disabledSelector = '&[disabled], &[aria-disabled=\"true\"]'\n\nexport const sharedStyles = {\n base: {\n backgroundColor: '$transparent',\n borderRadius: '$50',\n height: '$10',\n border: 'none',\n },\n old: {\n ...focus.css({\n boxShadow: '$focus-small',\n outline: '1px solid transparent',\n }),\n\n [disabledSelector]: {\n pointerEvents: 'none',\n color: '$text-neutrals-disabled',\n },\n\n '&[data-hovered]': {\n backgroundColor: '$background-primary-subtle-hover',\n color: '$icon-primary-hover',\n },\n\n '&:active, &[data-pressed]': {\n backgroundColor: '$background-primary-subtle-active',\n color: '$icon-primary-active',\n },\n },\n v1: {\n ...focus.css({\n boxShadow: '$focus-v1',\n }),\n\n '&[data-hovered]': {\n backgroundColor: '$background-neutrals-hover',\n },\n\n '&:active, &[data-pressed]': {\n backgroundColor: '$background-neutrals-active',\n },\n },\n}\n","import { styled } from '@mirohq/design-system-stitches'\n\nimport { Item } from './item'\nimport { disabledSelector, sharedStyles } from '../styles'\n\nexport const StyledIcon = styled(Item, {\n padding: 0,\n font: 'unset',\n width: '$10',\n color: '$icon-neutrals',\n\n ...sharedStyles.base,\n\n variants: {\n v1: {\n true: {},\n false: {},\n },\n active: {\n true: {},\n false: {},\n },\n },\n\n '&[tabindex=\"0\"]': {\n zIndex: '1',\n },\n\n compoundVariants: [\n {\n v1: true,\n active: true,\n css: {\n backgroundColor: '$background-primary-subtle',\n color: '$icon-primary-selected',\n },\n },\n {\n v1: false,\n active: true,\n css: {\n backgroundColor: '$background-primary-subtle-selected',\n color: '$icon-primary-selected',\n },\n },\n {\n v1: true,\n active: false,\n css: {\n ...sharedStyles.v1,\n\n [disabledSelector]: {\n pointerEvents: 'none',\n color: '$icon-neutrals-disabled',\n },\n },\n },\n {\n v1: false,\n active: false,\n css: sharedStyles.old,\n },\n ],\n})\n","import React, { createContext, useContext } from 'react'\nimport type { PropsWithChildren } from 'react'\n\ninterface ToolbarProps {\n v1: boolean\n}\n\ntype ToolbarContextProps = ToolbarProps\n\nexport type ToolbarProviderProps = ToolbarProps\n\nconst ToolbarContext = createContext<ToolbarContextProps>({} as any)\n\nexport const ToolbarProvider = ({\n children,\n ...restProps\n}: PropsWithChildren<ToolbarProviderProps>): React.ReactElement => (\n <ToolbarContext.Provider\n value={{\n ...restProps,\n }}\n >\n {children}\n </ToolbarContext.Provider>\n)\n\nexport const useToolbarContext = (): ToolbarContextProps =>\n useContext(ToolbarContext)\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport type { ItemProps } from './item'\nimport { StyledIcon } from './icon.styled'\nimport { useToolbarContext } from '../hooks/use-toolbar-context'\n\nexport interface IconProps extends Omit<ItemProps, 'unstyled' | 'v1'> {\n /**\n * Renders item in enabled/toggled state.\n * @default false\n */\n active?: boolean\n}\n\nexport const Icon = React.forwardRef<ElementRef<typeof StyledIcon>, IconProps>(\n ({ active = false, ...restProps }, forwardRef) => {\n const { v1 } = useToolbarContext()\n\n return (\n <StyledIcon {...restProps} v1={v1} active={active} ref={forwardRef} />\n )\n }\n)\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Separator } from '@radix-ui/react-toolbar'\n\nexport const StyledSeparator = styled(Separator, {\n all: 'unset',\n display: 'block',\n boxSizing: 'border-box',\n backgroundColor: 'rgba(205, 204, 215, 1)',\n\n '&[data-orientation=\"vertical\"]': {\n width: '1px',\n height: '$6',\n margin: '0 $50',\n },\n\n '&[data-orientation=\"horizontal\"]': {\n height: '1px',\n width: '$6',\n margin: '$50 0',\n },\n\n variants: {\n v1: {\n true: { backgroundColor: '$border-neutrals-subtle' },\n },\n },\n})\n\nexport type StyledSeparatorProps = StrictComponentProps<typeof StyledSeparator>\n","import React from 'react'\nimport type { ElementRef } from 'react'\n\nimport type { StyledSeparatorProps } from './separator.styled'\nimport { StyledSeparator } from './separator.styled'\nimport { useToolbarContext } from '../hooks/use-toolbar-context'\n\nexport interface SeparatorProps extends Omit<StyledSeparatorProps, 'v1'> {}\n\nexport const Separator = React.forwardRef<\n ElementRef<typeof StyledSeparator>,\n SeparatorProps\n>((props, forwardRef) => {\n const { v1 } = useToolbarContext()\n\n return <StyledSeparator {...props} v1={v1} ref={forwardRef} />\n})\n","import { styled } from '@mirohq/design-system-stitches'\n\nimport { Item } from './item'\nimport { disabledSelector, sharedStyles } from '../styles'\n\nexport const StyledLink = styled(Item, {\n paddingX: '$150',\n textDecoration: 'none',\n\n ...sharedStyles.base,\n\n variants: {\n v1: {\n true: {\n ...sharedStyles.v1,\n color: '$text-primary',\n textDecoration: 'underline solid',\n textDecorationThickness: '1px',\n textUnderlineOffset: '4px',\n outline: 'none',\n\n [disabledSelector]: {\n pointerEvents: 'none',\n color: '$text-neutrals-disabled',\n },\n },\n false: sharedStyles.old,\n },\n },\n})\n","import React from 'react'\nimport type { ElementRef, AnchorHTMLAttributes } from 'react'\n\nimport type { ItemProps } from './item'\nimport { StyledLink } from './link.styled'\nimport { useToolbarContext } from '../hooks/use-toolbar-context'\n\ntype ItemPropsWithAnchor = Omit<ItemProps, 'unstyled' | 'v1' | 'ref'> &\n AnchorHTMLAttributes<typeof StyledLink>\nexport interface LinkProps extends ItemPropsWithAnchor {}\n\nexport const Link = React.forwardRef<ElementRef<'a'>, LinkProps>(\n ({ children, href, ...restProps }, forwardRef) => {\n const { v1 } = useToolbarContext()\n\n return (\n <StyledLink {...restProps} asChild v1={v1}>\n <a href={href} ref={forwardRef}>\n {children}\n </a>\n </StyledLink>\n )\n }\n)\n","import React from 'react'\nimport type { ElementRef, ForwardRefExoticComponent } from 'react'\nimport { useNewDesignLanguage } from '@mirohq/design-system-experiments'\n\nimport type { StyledToolbarProps } from './toolbar.styled'\nimport { StyledToolbar } from './toolbar.styled'\nimport { Icon } from './partials/icon'\nimport { Separator } from './partials/separator'\nimport { Link } from './partials/link'\nimport { Item } from './partials/item'\nimport { ToolbarProvider } from './hooks/use-toolbar-context'\n\nexport interface ToolbarProps extends Omit<StyledToolbarProps, 'v1'> {\n /**\n * @deprecated Please use variant for non-floating toolbar\n */\n unstyled?: boolean\n\n /**\n * When floating, the toolbar has shadow and border to differentiate it from the surface\n * @default floating\n */\n variant?: StyledToolbarProps['variant']\n\n /**\n * The orientation of the toolbar\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical'\n\n /**\n * The reading direction of the toolbar\n * @default 'ltr'\n */\n dir?: 'ltr' | 'rtl'\n\n /**\n * When true, keyboard navigation will loop from last tab to first, and vice versa\n * @default true\n */\n loop?: boolean\n}\n\nexport const Toolbar = React.forwardRef<\n ElementRef<typeof StyledToolbar>,\n ToolbarProps\n>(\n (\n {\n unstyled,\n orientation = 'horizontal',\n variant = 'floating',\n dir = 'ltr',\n loop = true,\n ...restProps\n },\n forwardRef\n ) => {\n const [v1] = useNewDesignLanguage()\n\n const variantProp =\n unstyled === undefined ? variant : unstyled ? 'flat' : 'floating'\n\n return (\n <ToolbarProvider v1={v1}>\n <StyledToolbar\n v1={v1}\n variant={variantProp}\n orientation={orientation}\n dir={dir}\n loop={loop}\n ref={forwardRef}\n {...restProps}\n />\n </ToolbarProvider>\n )\n }\n) as ForwardRefExoticComponent<ToolbarProps> & Partials\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Icon: typeof Icon\n Item: typeof Item\n Link: typeof Link\n Separator: typeof Separator\n}\n\nToolbar.Icon = Icon\nToolbar.Item = Item\nToolbar.Link = Link\nToolbar.Separator = Separator\n"],"names":["Separator"],"mappings":";;;;;;;;;;;;AAIa,MAAA,aAAA,GAAgB,OAAO,IAAM,EAAA;AAAA,EACxC,GAAK,EAAA,OAAA;AAAA,EACL,OAAS,EAAA,MAAA;AAAA,EACT,SAAW,EAAA,YAAA;AAAA,EACX,UAAY,EAAA,QAAA;AAAA,EACZ,QAAU,EAAA,MAAA;AAAA,EACV,GAAK,EAAA,KAAA;AAAA,EAEL,gCAAkC,EAAA;AAAA,IAChC,aAAe,EAAA,QAAA;AAAA,IACf,KAAO,EAAA,KAAA;AAAA,GACT;AAAA,EAEA,kCAAoC,EAAA;AAAA,IAClC,MAAQ,EAAA,KAAA;AAAA,GACV;AAAA,EAEA,QAAU,EAAA;AAAA,IACR,EAAI,EAAA;AAAA,MACF,MAAM,EAAC;AAAA,KACT;AAAA,IACA,OAAS,EAAA;AAAA,MACP,UAAU,EAAC;AAAA,MACX,MAAM,EAAC;AAAA,KACT;AAAA,GACF;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB;AAAA,MACE,OAAS,EAAA,UAAA;AAAA,MACT,EAAI,EAAA,KAAA;AAAA,MACJ,GAAK,EAAA;AAAA,QACH,eAAiB,EAAA,gCAAA;AAAA,QACjB,SAAW,EAAA,KAAA;AAAA,QACX,YAAc,EAAA,KAAA;AAAA,QACd,OAAS,EAAA,KAAA;AAAA,OACX;AAAA,KACF;AAAA,IACA;AAAA,MACE,OAAS,EAAA,UAAA;AAAA,MACT,EAAI,EAAA,IAAA;AAAA,MACJ,GAAK,EAAA;AAAA,QACH,eAAiB,EAAA,6BAAA;AAAA,QACjB,SAAW,EAAA,wCAAA;AAAA,QACX,MAAQ,EAAA,qCAAA;AAAA,QACR,YAAc,EAAA,MAAA;AAAA,QACd,OAAS,EAAA,KAAA;AAAA,OACX;AAA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,GAAA,IAAA;AAAA,IACP,GAAG,SAAA;AAAA,KAEL,UACG,KAAA;AACH,IAAM,MAAA,CAAC,EAAE,CAAA,GAAI,oBAAqB,EAAA,CAAA;AAElC,IAAA,MAAM,WACJ,GAAA,QAAA,KAAa,KAAY,CAAA,GAAA,OAAA,GAAU,WAAW,MAAS,GAAA,UAAA,CAAA;AAEzD,IACE,uBAAA,GAAA,CAAC,mBAAgB,EACf,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,EAAA;AAAA,QACA,OAAS,EAAA,WAAA;AAAA,QACT,WAAA;AAAA,QACA,GAAA;AAAA,QACA,IAAA;AAAA,QACA,GAAK,EAAA,UAAA;AAAA,QACJ,GAAG,SAAA;AAAA,OAAA;AAAA,KAER,EAAA,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAYA,OAAA,CAAQ,IAAO,GAAA,IAAA,CAAA;AACf,OAAA,CAAQ,IAAO,GAAA,IAAA,CAAA;AACf,OAAA,CAAQ,IAAO,GAAA,IAAA,CAAA;AACf,OAAA,CAAQ,SAAY,GAAA,SAAA;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -7,65 +7,68 @@ import * as _radix_ui_react_toolbar from '@radix-ui/react-toolbar';
|
|
|
7
7
|
import { HoverEvents } from '@react-types/shared';
|
|
8
8
|
import { PressEvents } from '@mirohq/design-system-use-press';
|
|
9
9
|
|
|
10
|
-
declare const StyledToolbar: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_radix_ui_react_toolbar.ToolbarProps & react.RefAttributes<HTMLDivElement>>>, "
|
|
11
|
-
|
|
10
|
+
declare const StyledToolbar: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_radix_ui_react_toolbar.ToolbarProps & react.RefAttributes<HTMLDivElement>>>, "v1" | "variant"> & _stitches_react_types_styled_component.TransformProps<{
|
|
11
|
+
v1?: boolean | "true" | undefined;
|
|
12
|
+
variant?: "flat" | "floating" | undefined;
|
|
12
13
|
}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_radix_ui_react_toolbar.ToolbarProps & react.RefAttributes<HTMLDivElement>>, {
|
|
13
|
-
|
|
14
|
+
v1?: boolean | "true" | undefined;
|
|
15
|
+
variant?: "flat" | "floating" | undefined;
|
|
14
16
|
}, {}>;
|
|
15
17
|
declare type StyledToolbarProps = StrictComponentProps<typeof StyledToolbar>;
|
|
16
18
|
|
|
17
|
-
declare const StyledItem: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_radix_ui_react_toolbar.ToolbarButtonProps & react.RefAttributes<HTMLButtonElement>>>,
|
|
18
|
-
unstyled?: boolean | "true" | "false" | undefined;
|
|
19
|
-
wrapper?: boolean | "true" | undefined;
|
|
20
|
-
active?: boolean | "true" | "false" | undefined;
|
|
21
|
-
}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLButtonElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_radix_ui_react_toolbar.ToolbarButtonProps & react.RefAttributes<HTMLButtonElement>>, {
|
|
22
|
-
unstyled?: boolean | "true" | "false" | undefined;
|
|
23
|
-
wrapper?: boolean | "true" | undefined;
|
|
24
|
-
active?: boolean | "true" | "false" | undefined;
|
|
25
|
-
}, {}>;
|
|
19
|
+
declare const StyledItem: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_radix_ui_react_toolbar.ToolbarButtonProps & react.RefAttributes<HTMLButtonElement>>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLButtonElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_radix_ui_react_toolbar.ToolbarButtonProps & react.RefAttributes<HTMLButtonElement>>, {}, {}>;
|
|
26
20
|
declare type StyledItemProps = StrictComponentProps<typeof StyledItem>;
|
|
27
21
|
|
|
28
22
|
interface ItemProps extends StyledItemProps, HoverEvents, PressEvents {
|
|
29
23
|
/**
|
|
30
|
-
*
|
|
31
|
-
* @default false
|
|
32
|
-
*/
|
|
33
|
-
active?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* It's applied by default when using with asChild attribute.
|
|
36
|
-
* You can still combine default Item styles with your own component by
|
|
37
|
-
* setting this prop to false.
|
|
38
|
-
* Note: Must be used together with asChild
|
|
39
|
-
* @default true
|
|
24
|
+
* @deprecated Toolbar.Item does no longer support any styling
|
|
40
25
|
*/
|
|
41
26
|
unstyled?: boolean;
|
|
42
27
|
disabled?: boolean;
|
|
43
28
|
}
|
|
44
29
|
declare const Item: react__default.ForwardRefExoticComponent<Omit<ItemProps, "ref"> & react__default.RefAttributes<HTMLButtonElement>>;
|
|
45
30
|
|
|
46
|
-
|
|
31
|
+
interface IconProps extends Omit<ItemProps, 'unstyled' | 'v1'> {
|
|
32
|
+
/**
|
|
33
|
+
* Renders item in enabled/toggled state.
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
active?: boolean;
|
|
37
|
+
}
|
|
47
38
|
declare const Icon: react__default.ForwardRefExoticComponent<Omit<IconProps, "ref"> & react__default.RefAttributes<HTMLButtonElement>>;
|
|
48
39
|
|
|
49
|
-
declare const StyledSeparator: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_radix_ui_react_toolbar.ToolbarSeparatorProps & react.RefAttributes<HTMLDivElement>>>,
|
|
40
|
+
declare const StyledSeparator: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_radix_ui_react_toolbar.ToolbarSeparatorProps & react.RefAttributes<HTMLDivElement>>>, "v1"> & _stitches_react_types_styled_component.TransformProps<{
|
|
41
|
+
v1?: boolean | "true" | undefined;
|
|
42
|
+
}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_radix_ui_react_toolbar.ToolbarSeparatorProps & react.RefAttributes<HTMLDivElement>>, {
|
|
43
|
+
v1?: boolean | "true" | undefined;
|
|
44
|
+
}, {}>;
|
|
50
45
|
declare type StyledSeparatorProps = StrictComponentProps<typeof StyledSeparator>;
|
|
51
46
|
|
|
52
|
-
interface SeparatorProps extends StyledSeparatorProps {
|
|
47
|
+
interface SeparatorProps extends Omit<StyledSeparatorProps, 'v1'> {
|
|
53
48
|
}
|
|
54
49
|
declare const Separator: react__default.ForwardRefExoticComponent<Omit<SeparatorProps, "ref"> & react__default.RefAttributes<HTMLDivElement>>;
|
|
55
50
|
|
|
56
|
-
declare const StyledLink: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<Omit<ItemProps, "ref"> & react.RefAttributes<HTMLButtonElement>>>,
|
|
51
|
+
declare const StyledLink: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<Omit<ItemProps, "ref"> & react.RefAttributes<HTMLButtonElement>>>, "v1"> & _stitches_react_types_styled_component.TransformProps<{
|
|
52
|
+
v1?: boolean | "true" | "false" | undefined;
|
|
53
|
+
}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLButtonElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<Omit<ItemProps, "ref"> & react.RefAttributes<HTMLButtonElement>>, {
|
|
54
|
+
v1?: boolean | "true" | "false" | undefined;
|
|
55
|
+
}, {}>;
|
|
57
56
|
|
|
58
|
-
declare type ItemPropsWithAnchor = Omit<ItemProps, 'unstyled'> & AnchorHTMLAttributes<typeof StyledLink>;
|
|
57
|
+
declare type ItemPropsWithAnchor = Omit<ItemProps, 'unstyled' | 'v1' | 'ref'> & AnchorHTMLAttributes<typeof StyledLink>;
|
|
59
58
|
interface LinkProps extends ItemPropsWithAnchor {
|
|
60
59
|
}
|
|
61
|
-
declare const Link: react__default.ForwardRefExoticComponent<
|
|
60
|
+
declare const Link: react__default.ForwardRefExoticComponent<LinkProps & react__default.RefAttributes<HTMLAnchorElement>>;
|
|
62
61
|
|
|
63
|
-
interface ToolbarProps extends StyledToolbarProps {
|
|
62
|
+
interface ToolbarProps extends Omit<StyledToolbarProps, 'v1'> {
|
|
64
63
|
/**
|
|
65
|
-
*
|
|
66
|
-
* @default false
|
|
64
|
+
* @deprecated Please use variant for non-floating toolbar
|
|
67
65
|
*/
|
|
68
66
|
unstyled?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* When floating, the toolbar has shadow and border to differentiate it from the surface
|
|
69
|
+
* @default floating
|
|
70
|
+
*/
|
|
71
|
+
variant?: StyledToolbarProps['variant'];
|
|
69
72
|
/**
|
|
70
73
|
* The orientation of the toolbar
|
|
71
74
|
* @default 'horizontal'
|
|
@@ -76,11 +79,6 @@ interface ToolbarProps extends StyledToolbarProps {
|
|
|
76
79
|
* @default 'ltr'
|
|
77
80
|
*/
|
|
78
81
|
dir?: 'ltr' | 'rtl';
|
|
79
|
-
/**
|
|
80
|
-
* The reading direction of the toolbar
|
|
81
|
-
* @deprecated use dir instead
|
|
82
|
-
*/
|
|
83
|
-
direction?: 'ltr' | 'rtl';
|
|
84
82
|
/**
|
|
85
83
|
* When true, keyboard navigation will loop from last tab to first, and vice versa
|
|
86
84
|
* @default true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirohq/design-system-toolbar",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0-update-toolbar.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Miro",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"@mirohq/design-system-stitches": "^2.6.25",
|
|
35
35
|
"@mirohq/design-system-styles": "^1.2.25",
|
|
36
36
|
"@mirohq/design-system-use-press": "^0.4.1",
|
|
37
|
+
"@mirohq/design-system-experiments": "^0.2.0",
|
|
37
38
|
"@mirohq/design-system-utils": "^0.15.4"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {
|