@mirohq/design-system-base-input 0.0.1-input.1 → 0.0.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 CHANGED
@@ -2,45 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var React = require('react');
7
- var designSystemUtils = require('@mirohq/design-system-utils');
8
- var interactions = require('@react-aria/interactions');
9
- var designSystemPrimitive = require('@mirohq/design-system-primitive');
10
- var designSystemStitches = require('@mirohq/design-system-stitches');
11
- var designSystemIcons = require('@mirohq/design-system-icons');
12
- var utils = require('@react-aria/utils');
13
-
14
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
-
16
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
17
-
18
- const StyledIconExclamationPointCircle = designSystemStitches.styled(
19
- designSystemIcons.IconExclamationPointCircle,
20
- {
21
- color: "$icon-danger"
22
- }
23
- );
24
- const StyledIconCheckMark = designSystemStitches.styled(designSystemIcons.IconCheckMark, {
25
- color: "$icon-success"
26
- });
27
- const StyledValidityBox = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
28
- order: 3,
29
- display: "flex",
30
- alignItems: "center"
31
- });
32
- const StyledBaseInput = designSystemStitches.styled("div", {
33
- alignItems: "center",
34
- background: "$background-neutrals-container",
35
- border: "1px solid $border-neutrals",
36
- borderRadius: "$50",
37
- display: "flex",
38
- height: "max-content",
39
- justifyContent: "flex-end",
40
- position: "relative",
41
- verticalAlign: "middle",
42
- boxSizing: "border-box",
43
- width: "100%",
5
+ const styles = {
44
6
  variants: {
45
7
  hovered: {
46
8
  true: {},
@@ -159,244 +121,7 @@ const StyledBaseInput = designSystemStitches.styled("div", {
159
121
  }
160
122
  }
161
123
  ]
162
- });
163
-
164
- const disabledAndReadonlySelectors = ':read-only, :disabled, [aria-disabled="true"], [data-disabled]';
165
- const StyledInput = designSystemStitches.styled(designSystemPrimitive.Primitive.input, {
166
- all: "unset",
167
- background: "transparent",
168
- color: "$text-neutrals",
169
- width: "100%",
170
- borderRadius: "$50",
171
- order: 2,
172
- "&::placeholder": {
173
- fontStyle: "italic"
174
- },
175
- ["&:not(".concat(disabledAndReadonlySelectors, ")::placeholder")]: {
176
- color: "$text-neutrals-subtle"
177
- },
178
- "&:read-only": {
179
- color: "$text-neutrals-subtle"
180
- },
181
- "&:disabled, &[aria-disabled=true], &[data-disabled]": {
182
- caretColor: "transparent",
183
- "&, &::placeholder": {
184
- color: "$text-neutrals-disabled"
185
- },
186
- "&:selection": {
187
- background: "transparent"
188
- }
189
- }
190
- });
191
-
192
- const InputContext = React.createContext({
193
- actionSlotRef: { current: null },
194
- setFocused: () => {
195
- },
196
- setHovered: () => {
197
- },
198
- setActive: () => {
199
- }
200
- });
201
- const InputProvider = ({
202
- children,
203
- disabled,
204
- ariaDisabled,
205
- readOnly,
206
- ...restProps
207
- }) => {
208
- const actionSlotRef = React.useRef(null);
209
- const [focused, setFocused] = React.useState(false);
210
- const [hovered, setHovered] = React.useState(false);
211
- const [active, setActive] = React.useState(false);
212
- const editable = !designSystemUtils.booleanify(disabled) && !designSystemUtils.booleanify(ariaDisabled) && !designSystemUtils.booleanify(readOnly);
213
- return /* @__PURE__ */ jsxRuntime.jsx(
214
- InputContext.Provider,
215
- {
216
- value: {
217
- ...restProps,
218
- setFocused,
219
- setHovered,
220
- setActive,
221
- active,
222
- hovered,
223
- focused,
224
- actionSlotRef,
225
- disabled,
226
- ariaDisabled,
227
- readOnly,
228
- editable
229
- },
230
- children
231
- }
232
- );
233
- };
234
- const useInputContext = () => React.useContext(InputContext);
235
-
236
- const keyboardEventHandler = (e) => {
237
- if (e.key !== "Tab") {
238
- e.preventDefault();
239
- }
240
124
  };
241
- const Input = React__default["default"].forwardRef((props, forwardRef) => {
242
- const { ariaDisabled, disabled, readOnly, setFocused } = useInputContext();
243
- let elementProps = props;
244
- if (designSystemUtils.booleanify(ariaDisabled)) {
245
- elementProps = designSystemUtils.removeEventProps(props, [
246
- "onFocus",
247
- "onBlur",
248
- "onPointerMove"
249
- ]);
250
- elementProps.onKeyDown = keyboardEventHandler;
251
- elementProps.onKeyUp = keyboardEventHandler;
252
- }
253
- const onBlurEventHandler = () => {
254
- setFocused == null ? void 0 : setFocused(false);
255
- };
256
- const onFocusEventHandler = () => {
257
- setFocused == null ? void 0 : setFocused(true);
258
- };
259
- elementProps = utils.mergeProps(elementProps, {
260
- onBlur: onBlurEventHandler,
261
- onFocus: onFocusEventHandler
262
- });
263
- return /* @__PURE__ */ jsxRuntime.jsx(
264
- StyledInput,
265
- {
266
- ...elementProps,
267
- "aria-disabled": ariaDisabled,
268
- disabled,
269
- readOnly,
270
- ref: forwardRef
271
- }
272
- );
273
- });
274
-
275
- const StyledActionSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
276
- variants: {
277
- readOnly: {
278
- true: {
279
- "& svg[data-icon-component], & img[data-icon-component]": {
280
- color: "$icon-neutrals-subtle"
281
- }
282
- }
283
- }
284
- }
285
- });
286
-
287
- const ActionSlot = React__default["default"].forwardRef(({ children, ...restProps }, forwardRef) => {
288
- const { valid, hovered, editable, actionSlotRef, active, readOnly } = useInputContext();
289
- const showInputSlot = valid === void 0 || designSystemUtils.booleanify(hovered) || designSystemUtils.booleanify(active);
290
- let formattedChildren = children;
291
- if (!designSystemUtils.booleanify(editable)) {
292
- formattedChildren = designSystemUtils.addPropsToChildren(children, () => true, {
293
- disabled: true
294
- });
295
- }
296
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: showInputSlot && /* @__PURE__ */ jsxRuntime.jsx(
297
- StyledActionSlot,
298
- {
299
- ...restProps,
300
- readOnly,
301
- ref: designSystemUtils.mergeRefs([forwardRef, actionSlotRef]),
302
- children: formattedChildren
303
- }
304
- ) });
305
- });
306
-
307
- const StyledIconSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
308
- alignContent: "center",
309
- display: "flex",
310
- justifyContent: "center",
311
- color: "$icon-neutrals-subtle",
312
- variants: {
313
- disabled: {
314
- true: {
315
- "& svg": {
316
- color: "$icon-neutrals-disabled"
317
- }
318
- }
319
- }
320
- }
321
- });
322
-
323
- const IconSlot = React__default["default"].forwardRef((props, forwardRef) => {
324
- const { ariaDisabled, disabled } = useInputContext();
325
- return /* @__PURE__ */ jsxRuntime.jsx(
326
- StyledIconSlot,
327
- {
328
- ...props,
329
- disabled: designSystemUtils.booleanify(disabled != null ? disabled : ariaDisabled),
330
- ref: forwardRef
331
- }
332
- );
333
- });
334
-
335
- const Root = React__default["default"].forwardRef(({ children, ...restProps }, forwardRef) => {
336
- const {
337
- valid,
338
- ariaDisabled,
339
- disabled,
340
- readOnly,
341
- focused,
342
- active,
343
- setHovered,
344
- setActive
345
- } = useInputContext();
346
- const ref = React.useRef(null);
347
- const { hoverProps, isHovered: hovered } = interactions.useHover({
348
- onHoverChange: setHovered
349
- });
350
- const ariaDisabledOrDisabled = designSystemUtils.booleanify(ariaDisabled) || designSystemUtils.booleanify(disabled);
351
- const showValidityIcon = !ariaDisabledOrDisabled && !designSystemUtils.booleanify(readOnly) && !designSystemUtils.booleanify(hovered) && !designSystemUtils.booleanify(focused) && !designSystemUtils.booleanify(active) && (valid === true || valid === false);
352
- const ValidIcon = valid === true ? StyledIconCheckMark : StyledIconExclamationPointCircle;
353
- return /* @__PURE__ */ jsxRuntime.jsxs(
354
- StyledBaseInput,
355
- {
356
- ...restProps,
357
- ...hoverProps,
358
- ref: designSystemUtils.mergeRefs([ref, forwardRef]),
359
- hovered,
360
- focused,
361
- valid,
362
- disabled: designSystemUtils.booleanify(disabled),
363
- ariaDisabled: designSystemUtils.booleanify(ariaDisabled),
364
- readOnly: designSystemUtils.booleanify(readOnly),
365
- "data-invalid": valid === false ? "" : void 0,
366
- "data-valid": valid === true ? "" : void 0,
367
- onFocus: () => {
368
- setActive(true);
369
- },
370
- onBlur: () => {
371
- setTimeout(() => {
372
- var _a;
373
- if ((ref == null ? void 0 : ref.current) != null && !((_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.contains(document.activeElement))) {
374
- setActive(false);
375
- }
376
- }, 0);
377
- },
378
- children: [
379
- children,
380
- showValidityIcon && /* @__PURE__ */ jsxRuntime.jsx(StyledValidityBox, { children: /* @__PURE__ */ jsxRuntime.jsx(ValidIcon, { size: "small" }) })
381
- ]
382
- }
383
- );
384
- });
385
- const BaseInput = React__default["default"].forwardRef(
386
- ({ "aria-disabled": ariaDisabled, disabled, valid, readOnly, ...restProps }, forwardRef) => /* @__PURE__ */ jsxRuntime.jsx(
387
- InputProvider,
388
- {
389
- valid,
390
- disabled,
391
- ariaDisabled,
392
- readOnly,
393
- children: /* @__PURE__ */ jsxRuntime.jsx(Root, { ...restProps, ref: forwardRef })
394
- }
395
- )
396
- );
397
- BaseInput.ActionSlot = ActionSlot;
398
- BaseInput.IconSlot = IconSlot;
399
- BaseInput.Input = Input;
400
125
 
401
- exports.BaseInput = BaseInput;
126
+ exports.styles = styles;
402
127
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sources":["../src/base-input.styled.tsx","../src/partials/input.styled.tsx","../hooks/use-input-context.tsx","../src/partials/input.tsx","../src/partials/action-slot.styled.tsx","../src/partials/action-slot.tsx","../src/partials/icon-slot.styled.tsx","../src/partials/icon-slot.tsx","../src/base-input.tsx"],"sourcesContent":["import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { ComponentPropsWithRef } from 'react'\nimport {\n IconExclamationPointCircle,\n IconCheckMark,\n} from '@mirohq/design-system-icons'\n\nexport const StyledIconExclamationPointCircle = styled(\n IconExclamationPointCircle,\n {\n color: '$icon-danger',\n }\n)\n\nexport const StyledIconCheckMark = styled(IconCheckMark, {\n color: '$icon-success',\n})\n\nexport const StyledValidityBox = styled(Primitive.div, {\n order: 3,\n display: 'flex',\n alignItems: 'center',\n})\n\nexport const StyledBaseInput = styled('div', {\n alignItems: 'center',\n background: '$background-neutrals-container',\n border: '1px solid $border-neutrals',\n borderRadius: '$50',\n display: 'flex',\n height: 'max-content',\n justifyContent: 'flex-end',\n position: 'relative',\n verticalAlign: 'middle',\n boxSizing: 'border-box',\n width: '100%',\n variants: {\n hovered: {\n true: {},\n false: {},\n },\n focused: {\n true: {\n boxShadow: '$focus-controls',\n },\n false: {},\n },\n valid: {\n true: {},\n false: {},\n },\n readOnly: {\n true: {\n background: '$background-neutrals-disabled',\n color: '$text-neutrals-subtle',\n },\n false: {},\n },\n disabled: {\n true: {\n background: '$background-neutrals-disabled',\n },\n false: {},\n },\n ariaDisabled: {\n true: {\n background: '$background-neutrals-disabled',\n },\n false: {},\n },\n },\n compoundVariants: [\n /** Idle states */\n {\n valid: false,\n readOnly: false,\n disabled: false,\n ariaDisabled: false,\n css: {\n borderColor: '$border-danger',\n },\n },\n {\n valid: true,\n readOnly: false,\n disabled: false,\n ariaDisabled: false,\n css: {\n borderColor: '$border-success',\n },\n },\n /** Focus States */\n {\n focused: true,\n readOnly: false,\n css: {\n borderColor: '$border-neutrals',\n },\n },\n {\n focused: true,\n readOnly: false,\n valid: false,\n disabled: false,\n ariaDisabled: false,\n css: {\n borderColor: '$border-danger',\n boxShadow: '$focus-controls-error',\n },\n },\n {\n focused: true,\n readOnly: false,\n valid: true,\n disabled: false,\n ariaDisabled: false,\n css: {\n borderColor: '$border-success',\n boxShadow: '$focus-controls-success',\n },\n },\n /** Hover states */\n {\n hovered: true,\n disabled: false,\n ariaDisabled: false,\n readOnly: false,\n css: {\n borderColor: '$border-primary-hover',\n },\n },\n {\n hovered: true,\n focused: false,\n valid: false,\n readOnly: false,\n disabled: false,\n ariaDisabled: false,\n css: {\n borderColor: '$border-danger-hover',\n },\n },\n {\n hovered: true,\n focused: false,\n valid: true,\n readOnly: false,\n disabled: false,\n ariaDisabled: false,\n css: {\n borderColor: '$border-success-hover',\n },\n },\n ],\n})\n\nexport type StyledBaseInputProps = ComponentPropsWithRef<typeof StyledBaseInput>\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { ComponentPropsWithRef } from 'react'\n\nconst disabledAndReadonlySelectors =\n ':read-only, :disabled, [aria-disabled=\"true\"], [data-disabled]'\n\nexport const StyledInput = styled(Primitive.input, {\n all: 'unset',\n background: 'transparent',\n color: '$text-neutrals',\n width: '100%',\n borderRadius: '$50',\n order: 2,\n\n '&::placeholder': {\n fontStyle: 'italic',\n },\n\n [`&:not(${disabledAndReadonlySelectors})::placeholder`]: {\n color: '$text-neutrals-subtle',\n },\n\n '&:read-only': {\n color: '$text-neutrals-subtle',\n },\n\n '&:disabled, &[aria-disabled=true], &[data-disabled]': {\n caretColor: 'transparent',\n '&, &::placeholder': {\n color: '$text-neutrals-disabled',\n },\n '&:selection': {\n background: 'transparent',\n },\n },\n})\n\nexport type StyledInputProps = ComponentPropsWithRef<typeof StyledInput>\n","import React, { createContext, useContext, useState, useRef } from 'react'\nimport type { PropsWithChildren } from 'react'\nimport { booleanify } from '@mirohq/design-system-utils'\nimport type { Booleanish } from '@mirohq/design-system-types'\n\nexport interface InputContextProps {\n disabled?: boolean\n ariaDisabled?: Booleanish\n readOnly?: boolean\n valid?: boolean\n hovered?: boolean\n focused?: boolean\n active?: boolean\n actionSlotRef: React.RefObject<HTMLDivElement>\n setFocused: React.Dispatch<React.SetStateAction<boolean>>\n setHovered: React.Dispatch<React.SetStateAction<boolean>>\n setActive: React.Dispatch<React.SetStateAction<boolean>>\n editable?: boolean\n}\n\nconst InputContext = createContext<InputContextProps>({\n actionSlotRef: { current: null },\n setFocused: () => {},\n setHovered: () => {},\n setActive: () => {},\n})\n\nexport const InputProvider = ({\n children,\n disabled,\n ariaDisabled,\n readOnly,\n ...restProps\n}: PropsWithChildren<\n Omit<\n InputContextProps,\n 'setFocused' | 'setHovered' | 'actionSlotRef' | 'setActive'\n >\n>): any => {\n const actionSlotRef = useRef<HTMLDivElement>(null)\n const [focused, setFocused] = useState(false)\n const [hovered, setHovered] = useState(false)\n const [active, setActive] = useState(false)\n const editable =\n !booleanify(disabled) && !booleanify(ariaDisabled) && !booleanify(readOnly)\n\n return (\n <InputContext.Provider\n value={{\n ...restProps,\n setFocused,\n setHovered,\n setActive,\n active,\n hovered,\n focused,\n actionSlotRef,\n disabled,\n ariaDisabled,\n readOnly,\n editable,\n }}\n >\n {children}\n </InputContext.Provider>\n )\n}\n\nexport const useInputContext = (): InputContextProps => useContext(InputContext)\n","import React from 'react'\nimport type { FocusEventHandler, KeyboardEventHandler, ElementRef } from 'react'\nimport { booleanify, removeEventProps } from '@mirohq/design-system-utils'\nimport { mergeProps } from '@react-aria/utils'\n\nimport { StyledInput } from './input.styled'\nimport type { StyledInputProps } from './input.styled'\nimport { useInputContext } from '../../hooks/use-input-context'\n\nexport interface InputProps extends StyledInputProps {}\n\nconst keyboardEventHandler: KeyboardEventHandler<HTMLInputElement> = e => {\n if (e.key !== 'Tab') {\n e.preventDefault()\n }\n}\n\nexport const Input = React.forwardRef<\n ElementRef<typeof StyledInput>,\n StyledInputProps\n>((props, forwardRef) => {\n const { ariaDisabled, disabled, readOnly, setFocused } = useInputContext()\n let elementProps = props\n\n if (booleanify(ariaDisabled)) {\n elementProps = removeEventProps(props, [\n 'onFocus',\n 'onBlur',\n 'onPointerMove',\n ])\n\n elementProps.onKeyDown = keyboardEventHandler\n elementProps.onKeyUp = keyboardEventHandler\n }\n\n const onBlurEventHandler: FocusEventHandler<HTMLInputElement> = (): void => {\n setFocused?.(false)\n }\n\n const onFocusEventHandler: FocusEventHandler<HTMLInputElement> = (): void => {\n setFocused?.(true)\n }\n\n elementProps = mergeProps(elementProps, {\n onBlur: onBlurEventHandler,\n onFocus: onFocusEventHandler,\n })\n\n return (\n <StyledInput\n {...elementProps}\n aria-disabled={ariaDisabled}\n disabled={disabled}\n readOnly={readOnly}\n ref={forwardRef}\n />\n )\n})\n","import type { ComponentPropsWithRef } from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const StyledActionSlot = styled(Primitive.div, {\n variants: {\n readOnly: {\n true: {\n '& svg[data-icon-component], & img[data-icon-component]': {\n color: '$icon-neutrals-subtle',\n },\n },\n },\n },\n})\n\nexport type StyledActionSlotProps = ComponentPropsWithRef<\n typeof StyledActionSlot\n>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport {\n mergeRefs,\n booleanify,\n addPropsToChildren,\n} from '@mirohq/design-system-utils'\n\nimport { StyledActionSlot } from './action-slot.styled'\nimport { useInputContext } from '../../hooks/use-input-context'\nimport type { StyledActionSlotProps } from './action-slot.styled'\n\nexport interface ActionSlotProps extends StyledActionSlotProps {}\n\nexport const ActionSlot = React.forwardRef<\n ElementRef<typeof StyledActionSlot>,\n StyledActionSlotProps\n>(({ children, ...restProps }, forwardRef) => {\n const { valid, hovered, editable, actionSlotRef, active, readOnly } =\n useInputContext()\n\n const showInputSlot =\n valid === undefined || booleanify(hovered) || booleanify(active)\n\n let formattedChildren = children\n\n if (!booleanify(editable)) {\n formattedChildren = addPropsToChildren(children, () => true, {\n disabled: true,\n })\n }\n\n return (\n <>\n {showInputSlot && (\n <StyledActionSlot\n {...restProps}\n readOnly={readOnly}\n ref={mergeRefs([forwardRef, actionSlotRef])}\n >\n {formattedChildren}\n </StyledActionSlot>\n )}\n </>\n )\n})\n","import { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport type { ComponentPropsWithRef } from 'react'\n\nexport const StyledIconSlot = styled(Primitive.div, {\n alignContent: 'center',\n display: 'flex',\n justifyContent: 'center',\n color: '$icon-neutrals-subtle',\n variants: {\n disabled: {\n true: {\n '& svg': {\n color: '$icon-neutrals-disabled',\n },\n },\n },\n },\n})\n\nexport type StyledIconSlotProps = ComponentPropsWithRef<typeof StyledIconSlot>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { booleanify } from '@mirohq/design-system-utils'\n\nimport { StyledIconSlot } from './icon-slot.styled'\nimport { useInputContext } from '../../hooks/use-input-context'\nimport type { StyledIconSlotProps } from './icon-slot.styled'\n\nexport interface IconSlotProps extends StyledIconSlotProps {}\n\nexport const IconSlot = React.forwardRef<\n ElementRef<typeof StyledIconSlot>,\n StyledIconSlotProps\n>((props, forwardRef) => {\n const { ariaDisabled, disabled } = useInputContext()\n return (\n <StyledIconSlot\n {...props}\n disabled={booleanify(disabled ?? ariaDisabled)}\n ref={forwardRef}\n />\n )\n})\n","import React, { useRef } from 'react'\nimport type {\n DOMAttributes,\n ElementRef,\n ForwardRefExoticComponent,\n} from 'react'\nimport { booleanify, mergeRefs } from '@mirohq/design-system-utils'\nimport type { Booleanish } from '@mirohq/design-system-types'\nimport { useHover } from '@react-aria/interactions'\n\nimport {\n StyledBaseInput,\n StyledValidityBox,\n StyledIconExclamationPointCircle,\n StyledIconCheckMark,\n} from './base-input.styled'\nimport { Input } from './partials/input'\nimport { ActionSlot } from './partials/action-slot'\nimport { IconSlot } from './partials/icon-slot'\nimport { InputProvider, useInputContext } from '../hooks/use-input-context'\nimport type { StyledBaseInputProps } from './base-input.styled'\n\nexport interface BaseInputProps\n extends Omit<StyledBaseInputProps, keyof DOMAttributes<Element>> {\n 'aria-disabled'?: Booleanish | undefined\n disabled?: boolean | undefined\n readOnly?: boolean | undefined\n valid?: boolean | undefined\n hovered?: boolean | undefined\n focused?: boolean | undefined\n children: React.ReactNode\n}\n\nconst Root = React.forwardRef<\n ElementRef<typeof StyledBaseInput>,\n BaseInputProps\n>(({ children, ...restProps }, forwardRef) => {\n const {\n valid,\n ariaDisabled,\n disabled,\n readOnly,\n focused,\n active,\n setHovered,\n setActive,\n } = useInputContext()\n\n const ref = useRef<HTMLDivElement>(null)\n\n const { hoverProps, isHovered: hovered } = useHover({\n onHoverChange: setHovered,\n })\n\n const ariaDisabledOrDisabled =\n booleanify(ariaDisabled) || booleanify(disabled)\n\n const showValidityIcon =\n !ariaDisabledOrDisabled &&\n !booleanify(readOnly) &&\n !booleanify(hovered) &&\n !booleanify(focused) &&\n !booleanify(active) &&\n (valid === true || valid === false)\n\n const ValidIcon =\n valid === true ? StyledIconCheckMark : StyledIconExclamationPointCircle\n\n return (\n <StyledBaseInput\n {...restProps}\n {...hoverProps}\n ref={mergeRefs([ref, forwardRef])}\n hovered={hovered}\n focused={focused}\n valid={valid}\n disabled={booleanify(disabled)}\n ariaDisabled={booleanify(ariaDisabled)}\n readOnly={booleanify(readOnly)}\n data-invalid={valid === false ? '' : undefined}\n data-valid={valid === true ? '' : undefined}\n onFocus={() => {\n setActive(true)\n }}\n onBlur={() => {\n setTimeout(() => {\n if (\n ref?.current != null &&\n !ref?.current?.contains(document.activeElement)\n ) {\n setActive(false)\n }\n }, 0)\n }}\n >\n {children}\n {showValidityIcon && (\n <StyledValidityBox>\n <ValidIcon size='small' />\n </StyledValidityBox>\n )}\n </StyledBaseInput>\n )\n})\n\nexport const BaseInput = React.forwardRef<\n ElementRef<typeof StyledBaseInput>,\n BaseInputProps\n>(\n (\n { 'aria-disabled': ariaDisabled, disabled, valid, readOnly, ...restProps },\n forwardRef\n ) => (\n <InputProvider\n valid={valid}\n disabled={disabled}\n ariaDisabled={ariaDisabled}\n readOnly={readOnly}\n >\n <Root {...restProps} ref={forwardRef} />\n </InputProvider>\n )\n) as ForwardRefExoticComponent<BaseInputProps> & Partials\n\n// Partials\n// -----------------------------------------------------------------------------\nexport interface Partials {\n ActionSlot: typeof ActionSlot\n IconSlot: typeof IconSlot\n Input: typeof Input\n}\n\nBaseInput.ActionSlot = ActionSlot\nBaseInput.IconSlot = IconSlot\nBaseInput.Input = Input\n"],"names":["styled","IconExclamationPointCircle","IconCheckMark","Primitive","createContext","useRef","useState","booleanify","jsx","useContext","React","removeEventProps","mergeProps","addPropsToChildren","mergeRefs","useHover","jsxs"],"mappings":";;;;;;;;;;;;;;;;;AAQO,MAAM,gCAAmC,GA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 {"version":3,"file":"main.js","sources":["../src/styles.ts"],"sourcesContent":["export const styles = {\n variants: {\n hovered: {\n true: {},\n false: {},\n },\n focused: {\n true: {\n boxShadow: '$focus-controls',\n },\n false: {},\n },\n valid: {\n true: {},\n false: {},\n },\n readOnly: {\n true: {\n background: '$background-neutrals-disabled',\n color: '$text-neutrals-subtle',\n },\n false: {},\n },\n disabled: {\n true: {\n background: '$background-neutrals-disabled',\n },\n false: {},\n },\n ariaDisabled: {\n true: {\n background: '$background-neutrals-disabled',\n },\n false: {},\n },\n },\n compoundVariants: [\n /** Idle states */\n {\n valid: false,\n readOnly: false,\n disabled: false,\n ariaDisabled: false,\n css: {\n borderColor: '$border-danger',\n },\n },\n {\n valid: true,\n readOnly: false,\n disabled: false,\n ariaDisabled: false,\n css: {\n borderColor: '$border-success',\n },\n },\n /** Focus States */\n {\n focused: true,\n readOnly: false,\n css: {\n borderColor: '$border-neutrals',\n },\n },\n {\n focused: true,\n readOnly: false,\n valid: false,\n disabled: false,\n ariaDisabled: false,\n css: {\n borderColor: '$border-danger',\n boxShadow: '$focus-controls-error',\n },\n },\n {\n focused: true,\n readOnly: false,\n valid: true,\n disabled: false,\n ariaDisabled: false,\n css: {\n borderColor: '$border-success',\n boxShadow: '$focus-controls-success',\n },\n },\n /** Hover states */\n {\n hovered: true,\n disabled: false,\n ariaDisabled: false,\n readOnly: false,\n css: {\n borderColor: '$border-primary-hover',\n },\n },\n {\n hovered: true,\n focused: false,\n valid: false,\n readOnly: false,\n disabled: false,\n ariaDisabled: false,\n css: {\n borderColor: '$border-danger-hover',\n },\n },\n {\n hovered: true,\n focused: false,\n valid: true,\n readOnly: false,\n disabled: false,\n ariaDisabled: false,\n css: {\n borderColor: '$border-success-hover',\n },\n },\n ],\n}\n"],"names":[],"mappings":";;;;AAAO,MAAM,MAAS,GAAA;AAAA,EACpB,QAAU,EAAA;AAAA,IACR,OAAS,EAAA;AAAA,MACP,MAAM,EAAC;AAAA,MACP,OAAO,EAAC;AAAA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;"}
package/dist/module.js CHANGED
@@ -1,38 +1,4 @@
1
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
- import React, { createContext, useRef, useState, useContext } from 'react';
3
- import { booleanify, removeEventProps, addPropsToChildren, mergeRefs } from '@mirohq/design-system-utils';
4
- import { useHover } from '@react-aria/interactions';
5
- import { Primitive } from '@mirohq/design-system-primitive';
6
- import { styled } from '@mirohq/design-system-stitches';
7
- import { IconExclamationPointCircle, IconCheckMark } from '@mirohq/design-system-icons';
8
- import { mergeProps } from '@react-aria/utils';
9
-
10
- const StyledIconExclamationPointCircle = styled(
11
- IconExclamationPointCircle,
12
- {
13
- color: "$icon-danger"
14
- }
15
- );
16
- const StyledIconCheckMark = styled(IconCheckMark, {
17
- color: "$icon-success"
18
- });
19
- const StyledValidityBox = styled(Primitive.div, {
20
- order: 3,
21
- display: "flex",
22
- alignItems: "center"
23
- });
24
- const StyledBaseInput = styled("div", {
25
- alignItems: "center",
26
- background: "$background-neutrals-container",
27
- border: "1px solid $border-neutrals",
28
- borderRadius: "$50",
29
- display: "flex",
30
- height: "max-content",
31
- justifyContent: "flex-end",
32
- position: "relative",
33
- verticalAlign: "middle",
34
- boxSizing: "border-box",
35
- width: "100%",
1
+ const styles = {
36
2
  variants: {
37
3
  hovered: {
38
4
  true: {},
@@ -151,244 +117,7 @@ const StyledBaseInput = styled("div", {
151
117
  }
152
118
  }
153
119
  ]
154
- });
155
-
156
- const disabledAndReadonlySelectors = ':read-only, :disabled, [aria-disabled="true"], [data-disabled]';
157
- const StyledInput = styled(Primitive.input, {
158
- all: "unset",
159
- background: "transparent",
160
- color: "$text-neutrals",
161
- width: "100%",
162
- borderRadius: "$50",
163
- order: 2,
164
- "&::placeholder": {
165
- fontStyle: "italic"
166
- },
167
- ["&:not(".concat(disabledAndReadonlySelectors, ")::placeholder")]: {
168
- color: "$text-neutrals-subtle"
169
- },
170
- "&:read-only": {
171
- color: "$text-neutrals-subtle"
172
- },
173
- "&:disabled, &[aria-disabled=true], &[data-disabled]": {
174
- caretColor: "transparent",
175
- "&, &::placeholder": {
176
- color: "$text-neutrals-disabled"
177
- },
178
- "&:selection": {
179
- background: "transparent"
180
- }
181
- }
182
- });
183
-
184
- const InputContext = createContext({
185
- actionSlotRef: { current: null },
186
- setFocused: () => {
187
- },
188
- setHovered: () => {
189
- },
190
- setActive: () => {
191
- }
192
- });
193
- const InputProvider = ({
194
- children,
195
- disabled,
196
- ariaDisabled,
197
- readOnly,
198
- ...restProps
199
- }) => {
200
- const actionSlotRef = useRef(null);
201
- const [focused, setFocused] = useState(false);
202
- const [hovered, setHovered] = useState(false);
203
- const [active, setActive] = useState(false);
204
- const editable = !booleanify(disabled) && !booleanify(ariaDisabled) && !booleanify(readOnly);
205
- return /* @__PURE__ */ jsx(
206
- InputContext.Provider,
207
- {
208
- value: {
209
- ...restProps,
210
- setFocused,
211
- setHovered,
212
- setActive,
213
- active,
214
- hovered,
215
- focused,
216
- actionSlotRef,
217
- disabled,
218
- ariaDisabled,
219
- readOnly,
220
- editable
221
- },
222
- children
223
- }
224
- );
225
120
  };
226
- const useInputContext = () => useContext(InputContext);
227
-
228
- const keyboardEventHandler = (e) => {
229
- if (e.key !== "Tab") {
230
- e.preventDefault();
231
- }
232
- };
233
- const Input = React.forwardRef((props, forwardRef) => {
234
- const { ariaDisabled, disabled, readOnly, setFocused } = useInputContext();
235
- let elementProps = props;
236
- if (booleanify(ariaDisabled)) {
237
- elementProps = removeEventProps(props, [
238
- "onFocus",
239
- "onBlur",
240
- "onPointerMove"
241
- ]);
242
- elementProps.onKeyDown = keyboardEventHandler;
243
- elementProps.onKeyUp = keyboardEventHandler;
244
- }
245
- const onBlurEventHandler = () => {
246
- setFocused == null ? void 0 : setFocused(false);
247
- };
248
- const onFocusEventHandler = () => {
249
- setFocused == null ? void 0 : setFocused(true);
250
- };
251
- elementProps = mergeProps(elementProps, {
252
- onBlur: onBlurEventHandler,
253
- onFocus: onFocusEventHandler
254
- });
255
- return /* @__PURE__ */ jsx(
256
- StyledInput,
257
- {
258
- ...elementProps,
259
- "aria-disabled": ariaDisabled,
260
- disabled,
261
- readOnly,
262
- ref: forwardRef
263
- }
264
- );
265
- });
266
-
267
- const StyledActionSlot = styled(Primitive.div, {
268
- variants: {
269
- readOnly: {
270
- true: {
271
- "& svg[data-icon-component], & img[data-icon-component]": {
272
- color: "$icon-neutrals-subtle"
273
- }
274
- }
275
- }
276
- }
277
- });
278
-
279
- const ActionSlot = React.forwardRef(({ children, ...restProps }, forwardRef) => {
280
- const { valid, hovered, editable, actionSlotRef, active, readOnly } = useInputContext();
281
- const showInputSlot = valid === void 0 || booleanify(hovered) || booleanify(active);
282
- let formattedChildren = children;
283
- if (!booleanify(editable)) {
284
- formattedChildren = addPropsToChildren(children, () => true, {
285
- disabled: true
286
- });
287
- }
288
- return /* @__PURE__ */ jsx(Fragment, { children: showInputSlot && /* @__PURE__ */ jsx(
289
- StyledActionSlot,
290
- {
291
- ...restProps,
292
- readOnly,
293
- ref: mergeRefs([forwardRef, actionSlotRef]),
294
- children: formattedChildren
295
- }
296
- ) });
297
- });
298
-
299
- const StyledIconSlot = styled(Primitive.div, {
300
- alignContent: "center",
301
- display: "flex",
302
- justifyContent: "center",
303
- color: "$icon-neutrals-subtle",
304
- variants: {
305
- disabled: {
306
- true: {
307
- "& svg": {
308
- color: "$icon-neutrals-disabled"
309
- }
310
- }
311
- }
312
- }
313
- });
314
-
315
- const IconSlot = React.forwardRef((props, forwardRef) => {
316
- const { ariaDisabled, disabled } = useInputContext();
317
- return /* @__PURE__ */ jsx(
318
- StyledIconSlot,
319
- {
320
- ...props,
321
- disabled: booleanify(disabled != null ? disabled : ariaDisabled),
322
- ref: forwardRef
323
- }
324
- );
325
- });
326
-
327
- const Root = React.forwardRef(({ children, ...restProps }, forwardRef) => {
328
- const {
329
- valid,
330
- ariaDisabled,
331
- disabled,
332
- readOnly,
333
- focused,
334
- active,
335
- setHovered,
336
- setActive
337
- } = useInputContext();
338
- const ref = useRef(null);
339
- const { hoverProps, isHovered: hovered } = useHover({
340
- onHoverChange: setHovered
341
- });
342
- const ariaDisabledOrDisabled = booleanify(ariaDisabled) || booleanify(disabled);
343
- const showValidityIcon = !ariaDisabledOrDisabled && !booleanify(readOnly) && !booleanify(hovered) && !booleanify(focused) && !booleanify(active) && (valid === true || valid === false);
344
- const ValidIcon = valid === true ? StyledIconCheckMark : StyledIconExclamationPointCircle;
345
- return /* @__PURE__ */ jsxs(
346
- StyledBaseInput,
347
- {
348
- ...restProps,
349
- ...hoverProps,
350
- ref: mergeRefs([ref, forwardRef]),
351
- hovered,
352
- focused,
353
- valid,
354
- disabled: booleanify(disabled),
355
- ariaDisabled: booleanify(ariaDisabled),
356
- readOnly: booleanify(readOnly),
357
- "data-invalid": valid === false ? "" : void 0,
358
- "data-valid": valid === true ? "" : void 0,
359
- onFocus: () => {
360
- setActive(true);
361
- },
362
- onBlur: () => {
363
- setTimeout(() => {
364
- var _a;
365
- if ((ref == null ? void 0 : ref.current) != null && !((_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.contains(document.activeElement))) {
366
- setActive(false);
367
- }
368
- }, 0);
369
- },
370
- children: [
371
- children,
372
- showValidityIcon && /* @__PURE__ */ jsx(StyledValidityBox, { children: /* @__PURE__ */ jsx(ValidIcon, { size: "small" }) })
373
- ]
374
- }
375
- );
376
- });
377
- const BaseInput = React.forwardRef(
378
- ({ "aria-disabled": ariaDisabled, disabled, valid, readOnly, ...restProps }, forwardRef) => /* @__PURE__ */ jsx(
379
- InputProvider,
380
- {
381
- valid,
382
- disabled,
383
- ariaDisabled,
384
- readOnly,
385
- children: /* @__PURE__ */ jsx(Root, { ...restProps, ref: forwardRef })
386
- }
387
- )
388
- );
389
- BaseInput.ActionSlot = ActionSlot;
390
- BaseInput.IconSlot = IconSlot;
391
- BaseInput.Input = Input;
392
121
 
393
- export { BaseInput };
122
+ export { styles };
394
123
  //# sourceMappingURL=module.js.map