@sproutsocial/seeds-react-input 1.5.30 → 1.5.31
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/esm/index.js +239 -18
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +22 -30
- package/dist/index.d.ts +22 -30
- package/dist/index.js +240 -19
- package/dist/index.js.map +1 -1
- package/dist/input.css +133 -0
- package/package.json +17 -5
package/dist/esm/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
// src/InputHybrid.tsx
|
|
2
|
+
import "react";
|
|
3
|
+
import { hasStyledProps } from "@sproutsocial/seeds-react-system-props";
|
|
4
|
+
|
|
5
|
+
// src/InputStyledComponents.tsx
|
|
6
|
+
import * as React2 from "react";
|
|
4
7
|
import { mergeRefs } from "@sproutsocial/seeds-react-utilities";
|
|
5
|
-
import
|
|
6
|
-
import Button from "@sproutsocial/seeds-react-button";
|
|
7
|
-
import Icon from "@sproutsocial/seeds-react-icon";
|
|
8
|
+
import Icon2 from "@sproutsocial/seeds-react-icon";
|
|
8
9
|
|
|
9
10
|
// src/styles.ts
|
|
10
11
|
import styled, { css } from "styled-components";
|
|
@@ -150,8 +151,13 @@ Container.displayName = "InputContainer";
|
|
|
150
151
|
Accessory.displayName = "InputAccessory";
|
|
151
152
|
var styles_default = Container;
|
|
152
153
|
|
|
153
|
-
// src/
|
|
154
|
-
import
|
|
154
|
+
// src/shared.tsx
|
|
155
|
+
import * as React from "react";
|
|
156
|
+
import styled2 from "styled-components";
|
|
157
|
+
import { useInteractiveColor } from "@sproutsocial/seeds-react-hooks";
|
|
158
|
+
import Button from "@sproutsocial/seeds-react-button";
|
|
159
|
+
import Icon from "@sproutsocial/seeds-react-icon";
|
|
160
|
+
import { jsx } from "react/jsx-runtime";
|
|
155
161
|
var InputContext = React.createContext({});
|
|
156
162
|
var StyledButton = styled2(Button)`
|
|
157
163
|
&:hover,
|
|
@@ -198,7 +204,10 @@ var isClearButton = (elem) => {
|
|
|
198
204
|
}
|
|
199
205
|
return false;
|
|
200
206
|
};
|
|
201
|
-
|
|
207
|
+
|
|
208
|
+
// src/InputStyledComponents.tsx
|
|
209
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
210
|
+
var InputStyledComponents = class extends React2.Component {
|
|
202
211
|
constructor(props) {
|
|
203
212
|
super(props);
|
|
204
213
|
this.state = {
|
|
@@ -220,10 +229,9 @@ var Input = class extends React.Component {
|
|
|
220
229
|
size: "default",
|
|
221
230
|
appearance: "primary"
|
|
222
231
|
};
|
|
223
|
-
static ClearButton = ClearButton;
|
|
224
232
|
// Define our own ref for use in handleClear.
|
|
225
233
|
// We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.
|
|
226
|
-
inputRef =
|
|
234
|
+
inputRef = React2.createRef();
|
|
227
235
|
handleBlur = (e) => this.props.onBlur?.(e);
|
|
228
236
|
handleClear = (e) => {
|
|
229
237
|
const input = this.inputRef.current;
|
|
@@ -301,9 +309,9 @@ var Input = class extends React.Component {
|
|
|
301
309
|
if (autoComplete !== void 0) {
|
|
302
310
|
autoCompleteValue = autoComplete ? "on" : "off";
|
|
303
311
|
}
|
|
304
|
-
const elementBefore = type === "search" && !elemBefore ? /* @__PURE__ */
|
|
305
|
-
const elementAfter = type === "search" && !elemAfter ? /* @__PURE__ */
|
|
306
|
-
return /* @__PURE__ */
|
|
312
|
+
const elementBefore = type === "search" && !elemBefore ? /* @__PURE__ */ jsx2(Icon2, { name: "magnifying-glass-outline", "aria-hidden": true, color: "icon.base" }) : elemBefore;
|
|
313
|
+
const elementAfter = type === "search" && !elemAfter ? /* @__PURE__ */ jsx2(ClearButton, {}) : elemAfter;
|
|
314
|
+
return /* @__PURE__ */ jsx2(
|
|
307
315
|
styles_default,
|
|
308
316
|
{
|
|
309
317
|
hasBeforeElement: !!elementBefore,
|
|
@@ -324,8 +332,8 @@ var Input = class extends React.Component {
|
|
|
324
332
|
size
|
|
325
333
|
},
|
|
326
334
|
children: [
|
|
327
|
-
elementBefore && /* @__PURE__ */
|
|
328
|
-
/* @__PURE__ */
|
|
335
|
+
elementBefore && /* @__PURE__ */ jsx2(Accessory, { before: true, children: elementBefore }),
|
|
336
|
+
/* @__PURE__ */ jsx2(
|
|
329
337
|
"input",
|
|
330
338
|
{
|
|
331
339
|
"aria-invalid": !!isInvalid,
|
|
@@ -357,7 +365,7 @@ var Input = class extends React.Component {
|
|
|
357
365
|
...inputProps
|
|
358
366
|
}
|
|
359
367
|
),
|
|
360
|
-
elementAfter && /* @__PURE__ */
|
|
368
|
+
elementAfter && /* @__PURE__ */ jsx2(Accessory, { after: true, isClearButton: isClearButton(elementAfter), children: elementAfter })
|
|
361
369
|
]
|
|
362
370
|
}
|
|
363
371
|
)
|
|
@@ -365,7 +373,220 @@ var Input = class extends React.Component {
|
|
|
365
373
|
);
|
|
366
374
|
}
|
|
367
375
|
};
|
|
368
|
-
var
|
|
376
|
+
var InputStyledComponents_default = InputStyledComponents;
|
|
377
|
+
|
|
378
|
+
// src/InputTailwind.tsx
|
|
379
|
+
import * as React3 from "react";
|
|
380
|
+
import { mergeRefs as mergeRefs2 } from "@sproutsocial/seeds-react-utilities";
|
|
381
|
+
import Icon3 from "@sproutsocial/seeds-react-icon";
|
|
382
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
383
|
+
function cn(...inputs) {
|
|
384
|
+
const classes = [];
|
|
385
|
+
for (const input of inputs) {
|
|
386
|
+
if (!input) continue;
|
|
387
|
+
if (typeof input === "string") {
|
|
388
|
+
classes.push(input);
|
|
389
|
+
} else if (typeof input === "object") {
|
|
390
|
+
for (const [key, value] of Object.entries(input)) {
|
|
391
|
+
if (value) {
|
|
392
|
+
classes.push(key);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return classes.join(" ");
|
|
398
|
+
}
|
|
399
|
+
var InputTailwind = class extends React3.Component {
|
|
400
|
+
constructor(props) {
|
|
401
|
+
super(props);
|
|
402
|
+
this.state = {
|
|
403
|
+
// Tracking hasValue in state allows us to hide ClearButton when there is no value to clear
|
|
404
|
+
// for both controlled and uncontrolled inputs.
|
|
405
|
+
hasValue: !!props.value
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
componentDidUpdate({ value: prevValue }) {
|
|
409
|
+
const { value } = this.props;
|
|
410
|
+
if (value !== prevValue) {
|
|
411
|
+
this.updateState(value || "");
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
static defaultProps = {
|
|
415
|
+
autoFocus: false,
|
|
416
|
+
disabled: false,
|
|
417
|
+
type: "text",
|
|
418
|
+
size: "default",
|
|
419
|
+
appearance: "primary"
|
|
420
|
+
};
|
|
421
|
+
// Define our own ref for use in handleClear.
|
|
422
|
+
// We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.
|
|
423
|
+
inputRef = React3.createRef();
|
|
424
|
+
handleBlur = (e) => this.props.onBlur?.(e);
|
|
425
|
+
handleClear = (e) => {
|
|
426
|
+
const input = this.inputRef.current;
|
|
427
|
+
if (input) {
|
|
428
|
+
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
|
|
429
|
+
window.HTMLInputElement.prototype,
|
|
430
|
+
"value"
|
|
431
|
+
)?.set;
|
|
432
|
+
nativeInputValueSetter?.call(input, "");
|
|
433
|
+
const inputEvent = new Event("input", {
|
|
434
|
+
bubbles: true
|
|
435
|
+
});
|
|
436
|
+
input.dispatchEvent(inputEvent);
|
|
437
|
+
this.props.onClear?.(e);
|
|
438
|
+
setTimeout(() => {
|
|
439
|
+
input.focus();
|
|
440
|
+
}, 0);
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
handleChange = (e) => {
|
|
444
|
+
this.props.onChange?.(e, e.currentTarget.value);
|
|
445
|
+
this.updateState(e.currentTarget.value);
|
|
446
|
+
};
|
|
447
|
+
handleFocus = (e) => this.props.onFocus?.(e);
|
|
448
|
+
handleKeyDown = (e) => this.props.onKeyDown?.(e, e.currentTarget.value);
|
|
449
|
+
handleKeyUp = (e) => this.props.onKeyUp?.(e, e.currentTarget.value);
|
|
450
|
+
handlePaste = (e) => this.props.onPaste?.(e, e.currentTarget.value);
|
|
451
|
+
updateState = (inputValue) => {
|
|
452
|
+
const hasValue = inputValue !== "";
|
|
453
|
+
const previousHasValue = this.state.hasValue;
|
|
454
|
+
if (hasValue !== previousHasValue) {
|
|
455
|
+
this.setState({
|
|
456
|
+
hasValue
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
render() {
|
|
461
|
+
const {
|
|
462
|
+
autoComplete,
|
|
463
|
+
autoFocus,
|
|
464
|
+
disabled,
|
|
465
|
+
readOnly,
|
|
466
|
+
isInvalid,
|
|
467
|
+
hasWarning,
|
|
468
|
+
id,
|
|
469
|
+
name,
|
|
470
|
+
placeholder,
|
|
471
|
+
type,
|
|
472
|
+
required,
|
|
473
|
+
value,
|
|
474
|
+
elemBefore,
|
|
475
|
+
elemAfter,
|
|
476
|
+
maxLength,
|
|
477
|
+
ariaLabel,
|
|
478
|
+
ariaDescribedby,
|
|
479
|
+
clearButtonLabel,
|
|
480
|
+
innerRef = null,
|
|
481
|
+
// These functions are used in the class functions above, but need to be extracted in order for `rest` to be correct
|
|
482
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
483
|
+
onBlur,
|
|
484
|
+
onChange,
|
|
485
|
+
onClear,
|
|
486
|
+
onFocus,
|
|
487
|
+
onKeyDown,
|
|
488
|
+
onKeyUp,
|
|
489
|
+
onPaste,
|
|
490
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
491
|
+
inputProps = {},
|
|
492
|
+
qa = {},
|
|
493
|
+
appearance,
|
|
494
|
+
size,
|
|
495
|
+
className,
|
|
496
|
+
...rest
|
|
497
|
+
} = this.props;
|
|
498
|
+
let autoCompleteValue;
|
|
499
|
+
if (autoComplete !== void 0) {
|
|
500
|
+
autoCompleteValue = autoComplete ? "on" : "off";
|
|
501
|
+
}
|
|
502
|
+
const elementBefore = type === "search" && !elemBefore ? /* @__PURE__ */ jsx3(Icon3, { name: "magnifying-glass-outline", "aria-hidden": true, color: "icon.base" }) : elemBefore;
|
|
503
|
+
const elementAfter = type === "search" && !elemAfter ? /* @__PURE__ */ jsx3(ClearButton, {}) : elemAfter;
|
|
504
|
+
const containerClasses = cn(
|
|
505
|
+
"seeds-input",
|
|
506
|
+
appearance === "primary" && "seeds-input-primary",
|
|
507
|
+
size === "large" && "seeds-input-lg",
|
|
508
|
+
size === "small" && "seeds-input-sm",
|
|
509
|
+
{
|
|
510
|
+
"seeds-input-disabled": !!disabled,
|
|
511
|
+
"seeds-input-invalid": !!isInvalid,
|
|
512
|
+
"seeds-input-warning": !!hasWarning,
|
|
513
|
+
"seeds-input-has-before": !!elementBefore,
|
|
514
|
+
"seeds-input-has-after": !!elementAfter
|
|
515
|
+
},
|
|
516
|
+
className
|
|
517
|
+
);
|
|
518
|
+
const Wrapper = "div";
|
|
519
|
+
return /* @__PURE__ */ jsx3(Wrapper, { className: containerClasses, ...rest, children: /* @__PURE__ */ jsxs2(
|
|
520
|
+
InputContext.Provider,
|
|
521
|
+
{
|
|
522
|
+
value: {
|
|
523
|
+
handleClear: this.handleClear,
|
|
524
|
+
hasValue: this.state.hasValue,
|
|
525
|
+
clearButtonLabel,
|
|
526
|
+
size
|
|
527
|
+
},
|
|
528
|
+
children: [
|
|
529
|
+
elementBefore && /* @__PURE__ */ jsx3("span", { className: "seeds-input-accessory seeds-input-accessory-before", children: elementBefore }),
|
|
530
|
+
/* @__PURE__ */ jsx3(
|
|
531
|
+
"input",
|
|
532
|
+
{
|
|
533
|
+
"aria-invalid": !!isInvalid,
|
|
534
|
+
"aria-label": ariaLabel,
|
|
535
|
+
"aria-describedby": ariaDescribedby,
|
|
536
|
+
"aria-required": required,
|
|
537
|
+
autoComplete: autoCompleteValue,
|
|
538
|
+
autoFocus,
|
|
539
|
+
disabled,
|
|
540
|
+
readOnly,
|
|
541
|
+
id,
|
|
542
|
+
name,
|
|
543
|
+
placeholder,
|
|
544
|
+
type,
|
|
545
|
+
required,
|
|
546
|
+
value,
|
|
547
|
+
maxLength,
|
|
548
|
+
onBlur: this.handleBlur,
|
|
549
|
+
onChange: this.handleChange,
|
|
550
|
+
onFocus: this.handleFocus,
|
|
551
|
+
onKeyDown: this.handleKeyDown,
|
|
552
|
+
onKeyUp: this.handleKeyUp,
|
|
553
|
+
onPaste: this.handlePaste,
|
|
554
|
+
ref: mergeRefs2(innerRef, this.inputRef),
|
|
555
|
+
"data-qa-input": name || "",
|
|
556
|
+
"data-qa-input-isdisabled": disabled === true,
|
|
557
|
+
"data-qa-input-isrequired": required === true,
|
|
558
|
+
...qa,
|
|
559
|
+
...inputProps
|
|
560
|
+
}
|
|
561
|
+
),
|
|
562
|
+
elementAfter && /* @__PURE__ */ jsx3(
|
|
563
|
+
"span",
|
|
564
|
+
{
|
|
565
|
+
className: cn(
|
|
566
|
+
"seeds-input-accessory",
|
|
567
|
+
isClearButton(elementAfter) ? "seeds-input-accessory-clear" : "seeds-input-accessory-after"
|
|
568
|
+
),
|
|
569
|
+
children: elementAfter
|
|
570
|
+
}
|
|
571
|
+
)
|
|
572
|
+
]
|
|
573
|
+
}
|
|
574
|
+
) });
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
var InputTailwind_default = InputTailwind;
|
|
578
|
+
|
|
579
|
+
// src/InputHybrid.tsx
|
|
580
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
581
|
+
var InputHybrid = Object.assign(
|
|
582
|
+
(props) => hasStyledProps(props) ? /* @__PURE__ */ jsx4(InputStyledComponents_default, { ...props }) : /* @__PURE__ */ jsx4(InputTailwind_default, { ...props }),
|
|
583
|
+
{ ClearButton }
|
|
584
|
+
);
|
|
585
|
+
InputHybrid.displayName = "Input";
|
|
586
|
+
var InputHybrid_default = InputHybrid;
|
|
587
|
+
|
|
588
|
+
// src/Input.tsx
|
|
589
|
+
var Input_default = InputHybrid_default;
|
|
369
590
|
|
|
370
591
|
// src/InputTypes.ts
|
|
371
592
|
import "react";
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Input.tsx","../../src/styles.ts","../../src/InputTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport styled from \"styled-components\";\nimport { mergeRefs } from \"@sproutsocial/seeds-react-utilities\";\nimport { useInteractiveColor } from \"@sproutsocial/seeds-react-hooks\";\nimport Button from \"@sproutsocial/seeds-react-button\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container, { Accessory } from \"./styles\";\nimport type { TypeInputProps } from \"./InputTypes\";\n\ninterface TypeState {\n hasValue: boolean;\n}\n\n// Using Context so that Input's Input.ClearButton-specific props can be passed to Input.ClearButton,\n// regardless of whether it is manually included as elemAfter or automatically included for type=\"search\" Inputs.\ntype TypeInputContext = Partial<{\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n handleClear: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n clearButtonLabel: string;\n hasValue: boolean;\n size: \"large\" | \"small\" | \"default\";\n}>;\n\nconst InputContext = React.createContext<TypeInputContext>({});\n\nconst StyledButton = styled(Button)`\n &:hover,\n &:active {\n color: ${(props) => useInteractiveColor(props.theme.colors.icon.base)};\n }\n`;\n\nconst ClearButton = () => {\n const {\n handleClear,\n clearButtonLabel,\n hasValue,\n size: inputSize,\n } = React.useContext(InputContext);\n\n // Hide the button when there is no text to clear.\n if (!hasValue) {\n return null;\n }\n\n // Warn if clearButtonLabel is not included, so that the unlocalized fallback will not be mistaken for a proper label.\n if (!clearButtonLabel) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Warning: clearButtonLabel prop is required when using Input.ClearButton. Please pass a localized clearButtonLabel to Input.\"\n );\n }\n\n // Reduce Button padding for size small Inputs so that the Button won't go outside the bounds of the Input.\n // This adjustment is handled automatically for default and large Inputs via Button's size. There is no \"small\" Button.\n const py = inputSize === \"small\" ? 100 : undefined;\n const px = inputSize === \"small\" ? 200 : undefined;\n const buttonSize = inputSize === \"small\" ? \"default\" : inputSize;\n return (\n <StyledButton\n onClick={handleClear}\n size={buttonSize}\n py={py}\n px={px}\n title={clearButtonLabel || \"Clear\"}\n ariaLabel={clearButtonLabel || \"Clear\"}\n color=\"icon.base\"\n >\n <Icon name=\"circle-x-outline\" aria-hidden />\n </StyledButton>\n );\n};\n\nClearButton.displayName = \"Input.ClearButton\";\n\n// Used for positioning elementAfter. This logic will detect if the element is a ClearButton,\n// regardless of whether it was manually passed as elemAfter or automatically added to a search Input.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isClearButton = (elem: any) => {\n if (elem?.type) {\n return elem.type.displayName === \"Input.ClearButton\";\n }\n\n return false;\n};\n\nclass Input extends React.Component<TypeInputProps, TypeState> {\n constructor(props: TypeInputProps) {\n super(props);\n this.state = {\n // Tracking hasValue in state allows us to hide ClearButton when there is no value to clear\n // for both controlled and uncontrolled inputs.\n hasValue: !!props.value,\n };\n }\n\n override componentDidUpdate({ value: prevValue }: TypeInputProps) {\n // Update hasValue state whenever props value changes\n const { value } = this.props;\n if (value !== prevValue) {\n this.updateState(value || \"\");\n }\n }\n\n static defaultProps = {\n autoFocus: false,\n disabled: false,\n type: \"text\",\n size: \"default\",\n appearance: \"primary\",\n };\n\n static ClearButton = ClearButton;\n // Define our own ref for use in handleClear.\n // We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.\n inputRef = React.createRef<HTMLInputElement>();\n\n handleBlur = (e: React.FocusEvent<HTMLInputElement>) =>\n this.props.onBlur?.(e);\n\n handleClear = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n const input = this.inputRef.current;\n\n if (input) {\n // Clear the value via the input prototype, then dispatch an input event in order to trigger handleChange\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n \"value\"\n )?.set;\n\n nativeInputValueSetter?.call(input, \"\");\n const inputEvent = new Event(\"input\", {\n bubbles: true,\n });\n input.dispatchEvent(inputEvent);\n\n // call any onClear callback\n this.props.onClear?.(e);\n\n // wait for next cycle to update focus\n setTimeout(() => {\n input.focus();\n }, 0);\n }\n };\n\n handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n this.props.onChange?.(e, e.currentTarget.value);\n // needed for uncontrolled inputs\n this.updateState(e.currentTarget.value);\n };\n\n handleFocus = (e: React.FocusEvent<HTMLInputElement>) =>\n this.props.onFocus?.(e);\n\n handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) =>\n this.props.onKeyDown?.(e, e.currentTarget.value);\n\n handleKeyUp = (e: React.KeyboardEvent<HTMLInputElement>) =>\n this.props.onKeyUp?.(e, e.currentTarget.value);\n\n handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) =>\n this.props.onPaste?.(e, e.currentTarget.value);\n\n updateState = (inputValue: string) => {\n const hasValue = inputValue !== \"\";\n const previousHasValue = this.state.hasValue;\n\n // Only update state if the value of `hasValue` has changed to avoid unnecessary renders.\n if (hasValue !== previousHasValue) {\n this.setState({\n hasValue,\n });\n }\n };\n\n override render() {\n const {\n autoComplete,\n autoFocus,\n disabled,\n readOnly,\n isInvalid,\n hasWarning,\n id,\n name,\n placeholder,\n type,\n required,\n value,\n elemBefore,\n elemAfter,\n maxLength,\n ariaLabel,\n ariaDescribedby,\n clearButtonLabel,\n innerRef = null,\n // These functions are used in the class functions above, but need to be extracted in order for `rest` to be correct\n /* eslint-disable @typescript-eslint/no-unused-vars */\n onBlur,\n onChange,\n onClear,\n onFocus,\n onKeyDown,\n onKeyUp,\n onPaste,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n inputProps = {},\n qa = {},\n appearance,\n size,\n ...rest\n } = this.props;\n\n // Convert autoComplete from a boolean prop to a string value.\n let autoCompleteValue: \"on\" | \"off\" | undefined;\n\n if (autoComplete !== undefined) {\n autoCompleteValue = autoComplete ? \"on\" : \"off\";\n }\n\n // Add default elemBefore and elemAfter elements if type is search.\n const elementBefore =\n type === \"search\" && !elemBefore ? (\n <Icon name=\"magnifying-glass-outline\" aria-hidden color=\"icon.base\" />\n ) : (\n elemBefore\n );\n\n // Do not add a ClearButton if an elemAfter prop was passed.\n const elementAfter =\n type === \"search\" && !elemAfter ? <ClearButton /> : elemAfter;\n\n return (\n <Container\n hasBeforeElement={!!elementBefore}\n hasAfterElement={!!elementAfter}\n disabled={disabled}\n invalid={!!isInvalid}\n warning={hasWarning}\n appearance={appearance}\n size={size}\n {...rest}\n >\n <InputContext.Provider\n value={{\n handleClear: this.handleClear,\n hasValue: this.state.hasValue,\n clearButtonLabel,\n size,\n }}\n >\n {elementBefore && <Accessory before>{elementBefore}</Accessory>}\n\n <input\n aria-invalid={!!isInvalid}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-required={required}\n autoComplete={autoCompleteValue}\n autoFocus={autoFocus}\n disabled={disabled}\n readOnly={readOnly}\n id={id}\n name={name}\n placeholder={placeholder}\n type={type}\n required={required}\n value={value}\n maxLength={maxLength}\n onBlur={this.handleBlur}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onKeyDown={this.handleKeyDown}\n onKeyUp={this.handleKeyUp}\n onPaste={this.handlePaste}\n ref={mergeRefs<HTMLInputElement>(innerRef, this.inputRef)}\n data-qa-input={name || \"\"}\n data-qa-input-isdisabled={disabled === true}\n data-qa-input-isrequired={required === true}\n {...qa}\n {...inputProps}\n />\n\n {elementAfter && (\n <Accessory after isClearButton={isClearButton(elementAfter)}>\n {elementAfter}\n </Accessory>\n )}\n </InputContext.Provider>\n </Container>\n );\n }\n}\n\nexport default Input;\n","import styled, { css } from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { focusRing } from \"@sproutsocial/seeds-react-mixins\";\nimport type { TypeInputContainerProps } from \"./InputTypes\";\n\nconst Container = styled.div<TypeInputContainerProps>`\n box-sizing: border-box;\n position: relative;\n\n input {\n box-sizing: border-box;\n width: 100%;\n border: 1px solid transparent;\n border-radius: ${(props) => props.theme.radii[500]};\n background-color: ${(props) => props.theme.colors.form.background.base};\n color: ${(props) => props.theme.colors.text.body};\n outline: none;\n transition: border-color ${(props) => props.theme.duration.fast}\n ${(props) => props.theme.easing.ease_in},\n box-shadow ${(props) => props.theme.duration.fast}\n ${(props) => props.theme.easing.ease_in};\n font-family: ${(props) => props.theme.fontFamily};\n font-weight: ${(props) => props.theme.fontWeights.normal};\n appearance: none;\n /** This matches the overall height of Button and Select */\n margin: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n\n padding: ${(props) => {\n switch (props.size) {\n case \"large\":\n return `${props.theme.space[350]} ${props.theme.space[400]}`;\n\n case \"small\":\n return props.theme.space[200];\n\n case \"default\":\n default:\n return props.theme.space[300];\n }\n }};\n\n font-size: ${(props) => {\n switch (props.size) {\n case \"large\":\n return props.theme.typography[300].fontSize;\n\n case \"small\":\n case \"default\":\n default:\n return props.theme.typography[200].fontSize;\n }\n }};\n\n line-height: ${(props) => {\n switch (props.size) {\n case \"large\":\n return props.theme.typography[300].lineHeight;\n\n /* 16px was the value prior to this change to 'large'. Leaving as-is but it is a non-Seeds typography line-height. It may have a big impact though */\n case \"small\":\n case \"default\":\n default:\n return \"16px\";\n }\n }};\n\n /* https://stackoverflow.com/questions/14007655/remove-ie10s-clear-field-x-button-on-certain-inputs */\n &::-ms-clear {\n display: none;\n }\n\n &::-webkit-search-cancel-button {\n appearance: none;\n }\n\n &:focus {\n ${focusRing}\n }\n\n /* Fix for red ring when input is marked required in Firefox */\n &:not(output):not(:focus):-moz-ui-invalid {\n box-shadow: none;\n }\n\n &::placeholder {\n color: ${(props) => props.theme.colors.form.placeholder.base};\n font-style: italic;\n }\n\n ${(props) =>\n props.hasBeforeElement &&\n css`\n padding-left: 40px;\n `}\n\n ${(props) =>\n props.hasAfterElement &&\n css`\n padding-right: 40px;\n `}\n }\n\n ${(props) =>\n props.disabled &&\n css`\n opacity: 0.4;\n\n input {\n cursor: not-allowed;\n }\n `}\n\n ${(props) =>\n props.appearance === \"primary\" &&\n css`\n input {\n border: 1px solid ${(props) => props.theme.colors.form.border.base};\n }\n `}\n\n ${(props) =>\n props.invalid &&\n css`\n input {\n border-color: ${(props) => props.theme.colors.form.border.error};\n }\n `}\n\n\t${(props) =>\n props.warning &&\n css`\n input {\n border-color: ${(props) => props.theme.colors.form.border.warning};\n }\n `}\n\n ${COMMON}\n`;\n\nexport const Accessory = styled.div<{\n before?: boolean;\n after?: boolean;\n isClearButton?: boolean;\n}>`\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n color: ${(props) => props.theme.colors.icon.base};\n display: flex;\n align-items: center;\n\n ${(props) =>\n props.before &&\n css`\n left: ${props.theme.space[300]};\n `};\n\n ${(props) =>\n props.after &&\n css`\n right: ${props.isClearButton ? 0 : props.theme.space[300]};\n `};\n`;\n\nContainer.displayName = \"InputContainer\";\nAccessory.displayName = \"InputAccessory\";\n\nexport default Container;\n","import * as React from \"react\";\nimport type {\n TypeSystemCommonProps,\n TypeStyledComponentsCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\ninterface TypeBaseInputProps {\n /** ID of the form element, should match the \"for\" value of the associated label */\n id: string;\n name: string;\n\n /** Label used to describe the input if not used with an accompanying visual label */\n ariaLabel?: string;\n\n /** Attribute used to associate other elements that describe the Input, like an error */\n ariaDescribedby?: string;\n\n /** Label for Input.ClearButton. Required when using Input.ClearButton. */\n clearButtonLabel?: string;\n\n /** Placeholder text for when value is undefined or empty */\n placeholder?: string;\n\n /** Current value of the input */\n value?: string;\n\n /** HTML type attribute */\n type?: \"date\" | \"email\" | \"number\" | \"password\" | \"text\" | \"url\" | \"search\";\n\n /** Set option to display earlier typed values */\n autoComplete?: boolean | \"on\" | \"off\";\n\n /** Will autofocus the element when mounted to the DOM */\n autoFocus?: boolean;\n\n /** HTML disabled attribute */\n disabled?: boolean;\n\n /** HTML readonly attribute */\n readOnly?: boolean;\n\n /** Whether or not the current contents of the input are invalid */\n isInvalid?: boolean;\n\n /** Whether or not the current contents of the input has any warnings */\n hasWarning?: boolean;\n\n /** HTML required attribute */\n required?: boolean;\n\n /** 16x16 element, such as an icon */\n elemBefore?: React.ReactNode;\n\n /** 16x16 element, such as an icon */\n elemAfter?: React.ReactNode;\n\n /** Max length of the input */\n maxLength?: number;\n\n /** Props to spread onto the underlying input element */\n inputProps?: React.ComponentPropsWithoutRef<\"input\">;\n\n /** Used to get a reference to the underlying element */\n innerRef?:\n | {\n current: null | HTMLInputElement;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | ((arg0: React.ElementRef<any> | HTMLElement) => void)\n | React.Ref<HTMLInputElement>;\n onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;\n onChange?: (e: React.ChangeEvent<HTMLInputElement>, value: string) => void;\n onClear?: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, value: string) => void;\n onKeyUp?: (e: React.KeyboardEvent<HTMLInputElement>, value: string) => void;\n onPaste?: (e: React.ClipboardEvent<HTMLInputElement>, value: string) => void;\n size?: \"large\" | \"small\" | \"default\";\n qa?: object;\n\n /**\n Controls the styles of the input. Primary is our standard input styles and secondary is a borderless input.\n Note that this prop should only be used to alter styles and not functionality.\n */\n appearance?: \"primary\" | \"secondary\";\n}\n\nexport interface TypeInputProps\n extends TypeBaseInputProps,\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<\n React.ComponentPropsWithoutRef<\"div\">,\n keyof TypeBaseInputProps | \"color\"\n > {}\n\nexport interface TypeInputContainerProps {\n size: TypeInputProps[\"size\"];\n appearance: TypeInputProps[\"appearance\"];\n hasBeforeElement: boolean;\n hasAfterElement: boolean;\n invalid?: boolean;\n warning?: boolean;\n disabled?: boolean;\n}\n","import Input from \"./Input\";\n\nexport default Input;\nexport { Input };\nexport { Accessory } from \"./styles\";\nexport * from \"./InputTypes\";\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,OAAOA,aAAY;AACnB,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AACpC,OAAO,YAAY;AACnB,OAAO,UAAU;;;ACLjB,OAAO,UAAU,WAAW;AAC5B,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAG1B,IAAM,YAAY,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAQJ,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA,wBAC9B,CAAC,UAAU,MAAM,MAAM,OAAO,KAAK,WAAW,IAAI;AAAA,aAC7D,CAAC,UAAU,MAAM,MAAM,OAAO,KAAK,IAAI;AAAA;AAAA,+BAErB,CAAC,UAAU,MAAM,MAAM,SAAS,IAAI;AAAA,UACzD,CAAC,UAAU,MAAM,MAAM,OAAO,OAAO;AAAA,mBAC5B,CAAC,UAAU,MAAM,MAAM,SAAS,IAAI;AAAA,UAC7C,CAAC,UAAU,MAAM,MAAM,OAAO,OAAO;AAAA,mBAC5B,CAAC,UAAU,MAAM,MAAM,UAAU;AAAA,mBACjC,CAAC,UAAU,MAAM,MAAM,YAAY,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAQ7C,CAAC,UAAU;AACpB,UAAQ,MAAM,MAAM;AAAA,IAClB,KAAK;AACH,aAAO,GAAG,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA,IAE5D,KAAK;AACH,aAAO,MAAM,MAAM,MAAM,GAAG;AAAA,IAE9B,KAAK;AAAA,IACL;AACE,aAAO,MAAM,MAAM,MAAM,GAAG;AAAA,EAChC;AACF,CAAC;AAAA;AAAA,iBAEY,CAAC,UAAU;AACtB,UAAQ,MAAM,MAAM;AAAA,IAClB,KAAK;AACH,a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AAAA,UAAb;AAAA,YACC,OAAO;AAAA,cACL,aAAa,KAAK;AAAA,cAClB,UAAU,KAAK,MAAM;AAAA,cACrB;AAAA,cACA;AAAA,YACF;AAAA,YAEC;AAAA,+BAAiB,oBAAC,aAAU,QAAM,MAAE,yBAAc;AAAA,cAEnD;AAAA,gBAAC;AAAA;AAAA,kBACC,gBAAc,CAAC,CAAC;AAAA,kBAChB,cAAY;AAAA,kBACZ,oBAAkB;AAAA,kBAClB,iBAAe;AAAA,kBACf,cAAc;AAAA,kBACd;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA,QAAQ,KAAK;AAAA,kBACb,UAAU,KAAK;AAAA,kBACf,SAAS,KAAK;AAAA,kBACd,WAAW,KAAK;AAAA,kBAChB,SAAS,KAAK;AAAA,kBACd,SAAS,KAAK;AAAA,kBACd,KAAK,UAA4B,UAAU,KAAK,QAAQ;AAAA,kBACxD,iBAAe,QAAQ;AAAA,kBACvB,4BAA0B,aAAa;AAAA,kBACvC,4BAA0B,aAAa;AAAA,kBACtC,GAAG;AAAA,kBACH,GAAG;AAAA;AAAA,cACN;AAAA,cAEC,gBACC,oBAAC,aAAU,OAAK,MAAC,eAAe,cAAc,YAAY,GACvD,wBACH;AAAA;AAAA;AAAA,QAEJ;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,IAAO,gBAAQ;;;AEvSf,OAAuB;;;ACEvB,IAAO,gBAAQ;","names":["styled","props","styled"]}
|
|
1
|
+
{"version":3,"sources":["../../src/InputHybrid.tsx","../../src/InputStyledComponents.tsx","../../src/styles.ts","../../src/shared.tsx","../../src/InputTailwind.tsx","../../src/Input.tsx","../../src/InputTypes.ts","../../src/index.ts"],"sourcesContent":["/**\n * Hybrid Input Component\n * Automatically chooses between the Tailwind/CSS-class implementation (preferred,\n * better performance) and the styled-components implementation (for consumers\n * using system props or a styled() extension), based on props.\n *\n * Input uses an `innerRef` prop rather than forwardRef, so both paths receive it\n * through props — no forwardRef wrapper is introduced here.\n */\nimport * as React from \"react\";\nimport { hasStyledProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeInputProps } from \"./InputTypes\";\nimport InputStyledComponents from \"./InputStyledComponents\";\nimport InputTailwind from \"./InputTailwind\";\nimport { ClearButton } from \"./shared\";\n\ntype TypeInputComponent = ((props: TypeInputProps) => React.ReactElement) & {\n displayName?: string;\n ClearButton: typeof ClearButton;\n};\n\nconst InputHybrid: TypeInputComponent = Object.assign(\n (props: TypeInputProps) =>\n hasStyledProps(props) ? (\n <InputStyledComponents {...props} />\n ) : (\n <InputTailwind {...props} />\n ),\n { ClearButton }\n);\n\nInputHybrid.displayName = \"Input\";\n\nexport default InputHybrid;\n","import * as React from \"react\";\nimport { mergeRefs } from \"@sproutsocial/seeds-react-utilities\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container, { Accessory } from \"./styles\";\nimport type { TypeInputProps } from \"./InputTypes\";\nimport {\n InputContext,\n ClearButton,\n isClearButton,\n type TypeState,\n} from \"./shared\";\n\n/**\n * Styled-components implementation of Input. This is the legacy/SC path the\n * hybrid routes to when a consumer passes styled-system props or extends Input\n * via styled(). It is the verbatim implementation Input.tsx previously held.\n */\nclass InputStyledComponents extends React.Component<TypeInputProps, TypeState> {\n constructor(props: TypeInputProps) {\n super(props);\n this.state = {\n // Tracking hasValue in state allows us to hide ClearButton when there is no value to clear\n // for both controlled and uncontrolled inputs.\n hasValue: !!props.value,\n };\n }\n\n override componentDidUpdate({ value: prevValue }: TypeInputProps) {\n // Update hasValue state whenever props value changes\n const { value } = this.props;\n if (value !== prevValue) {\n this.updateState(value || \"\");\n }\n }\n\n static defaultProps = {\n autoFocus: false,\n disabled: false,\n type: \"text\",\n size: \"default\",\n appearance: \"primary\",\n };\n\n // Define our own ref for use in handleClear.\n // We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.\n inputRef = React.createRef<HTMLInputElement>();\n\n handleBlur = (e: React.FocusEvent<HTMLInputElement>) =>\n this.props.onBlur?.(e);\n\n handleClear = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n const input = this.inputRef.current;\n\n if (input) {\n // Clear the value via the input prototype, then dispatch an input event in order to trigger handleChange\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n \"value\"\n )?.set;\n\n nativeInputValueSetter?.call(input, \"\");\n const inputEvent = new Event(\"input\", {\n bubbles: true,\n });\n input.dispatchEvent(inputEvent);\n\n // call any onClear callback\n this.props.onClear?.(e);\n\n // wait for next cycle to update focus\n setTimeout(() => {\n input.focus();\n }, 0);\n }\n };\n\n handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n this.props.onChange?.(e, e.currentTarget.value);\n // needed for uncontrolled inputs\n this.updateState(e.currentTarget.value);\n };\n\n handleFocus = (e: React.FocusEvent<HTMLInputElement>) =>\n this.props.onFocus?.(e);\n\n handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) =>\n this.props.onKeyDown?.(e, e.currentTarget.value);\n\n handleKeyUp = (e: React.KeyboardEvent<HTMLInputElement>) =>\n this.props.onKeyUp?.(e, e.currentTarget.value);\n\n handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) =>\n this.props.onPaste?.(e, e.currentTarget.value);\n\n updateState = (inputValue: string) => {\n const hasValue = inputValue !== \"\";\n const previousHasValue = this.state.hasValue;\n\n // Only update state if the value of `hasValue` has changed to avoid unnecessary renders.\n if (hasValue !== previousHasValue) {\n this.setState({\n hasValue,\n });\n }\n };\n\n override render() {\n const {\n autoComplete,\n autoFocus,\n disabled,\n readOnly,\n isInvalid,\n hasWarning,\n id,\n name,\n placeholder,\n type,\n required,\n value,\n elemBefore,\n elemAfter,\n maxLength,\n ariaLabel,\n ariaDescribedby,\n clearButtonLabel,\n innerRef = null,\n // These functions are used in the class functions above, but need to be extracted in order for `rest` to be correct\n /* eslint-disable @typescript-eslint/no-unused-vars */\n onBlur,\n onChange,\n onClear,\n onFocus,\n onKeyDown,\n onKeyUp,\n onPaste,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n inputProps = {},\n qa = {},\n appearance,\n size,\n ...rest\n } = this.props;\n\n // Convert autoComplete from a boolean prop to a string value.\n let autoCompleteValue: \"on\" | \"off\" | undefined;\n\n if (autoComplete !== undefined) {\n autoCompleteValue = autoComplete ? \"on\" : \"off\";\n }\n\n // Add default elemBefore and elemAfter elements if type is search.\n const elementBefore =\n type === \"search\" && !elemBefore ? (\n <Icon name=\"magnifying-glass-outline\" aria-hidden color=\"icon.base\" />\n ) : (\n elemBefore\n );\n\n // Do not add a ClearButton if an elemAfter prop was passed.\n const elementAfter =\n type === \"search\" && !elemAfter ? <ClearButton /> : elemAfter;\n\n return (\n <Container\n hasBeforeElement={!!elementBefore}\n hasAfterElement={!!elementAfter}\n disabled={disabled}\n invalid={!!isInvalid}\n warning={hasWarning}\n appearance={appearance}\n size={size}\n {...rest}\n >\n <InputContext.Provider\n value={{\n handleClear: this.handleClear,\n hasValue: this.state.hasValue,\n clearButtonLabel,\n size,\n }}\n >\n {elementBefore && <Accessory before>{elementBefore}</Accessory>}\n\n <input\n aria-invalid={!!isInvalid}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-required={required}\n autoComplete={autoCompleteValue}\n autoFocus={autoFocus}\n disabled={disabled}\n readOnly={readOnly}\n id={id}\n name={name}\n placeholder={placeholder}\n type={type}\n required={required}\n value={value}\n maxLength={maxLength}\n onBlur={this.handleBlur}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onKeyDown={this.handleKeyDown}\n onKeyUp={this.handleKeyUp}\n onPaste={this.handlePaste}\n ref={mergeRefs<HTMLInputElement>(innerRef, this.inputRef)}\n data-qa-input={name || \"\"}\n data-qa-input-isdisabled={disabled === true}\n data-qa-input-isrequired={required === true}\n {...qa}\n {...inputProps}\n />\n\n {elementAfter && (\n <Accessory after isClearButton={isClearButton(elementAfter)}>\n {elementAfter}\n </Accessory>\n )}\n </InputContext.Provider>\n </Container>\n );\n }\n}\n\nexport default InputStyledComponents;\n","import styled, { css } from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { focusRing } from \"@sproutsocial/seeds-react-mixins\";\nimport type { TypeInputContainerProps } from \"./InputTypes\";\n\nconst Container = styled.div<TypeInputContainerProps>`\n box-sizing: border-box;\n position: relative;\n\n input {\n box-sizing: border-box;\n width: 100%;\n border: 1px solid transparent;\n border-radius: ${(props) => props.theme.radii[500]};\n background-color: ${(props) => props.theme.colors.form.background.base};\n color: ${(props) => props.theme.colors.text.body};\n outline: none;\n transition: border-color ${(props) => props.theme.duration.fast}\n ${(props) => props.theme.easing.ease_in},\n box-shadow ${(props) => props.theme.duration.fast}\n ${(props) => props.theme.easing.ease_in};\n font-family: ${(props) => props.theme.fontFamily};\n font-weight: ${(props) => props.theme.fontWeights.normal};\n appearance: none;\n /** This matches the overall height of Button and Select */\n margin: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n\n padding: ${(props) => {\n switch (props.size) {\n case \"large\":\n return `${props.theme.space[350]} ${props.theme.space[400]}`;\n\n case \"small\":\n return props.theme.space[200];\n\n case \"default\":\n default:\n return props.theme.space[300];\n }\n }};\n\n font-size: ${(props) => {\n switch (props.size) {\n case \"large\":\n return props.theme.typography[300].fontSize;\n\n case \"small\":\n case \"default\":\n default:\n return props.theme.typography[200].fontSize;\n }\n }};\n\n line-height: ${(props) => {\n switch (props.size) {\n case \"large\":\n return props.theme.typography[300].lineHeight;\n\n /* 16px was the value prior to this change to 'large'. Leaving as-is but it is a non-Seeds typography line-height. It may have a big impact though */\n case \"small\":\n case \"default\":\n default:\n return \"16px\";\n }\n }};\n\n /* https://stackoverflow.com/questions/14007655/remove-ie10s-clear-field-x-button-on-certain-inputs */\n &::-ms-clear {\n display: none;\n }\n\n &::-webkit-search-cancel-button {\n appearance: none;\n }\n\n &:focus {\n ${focusRing}\n }\n\n /* Fix for red ring when input is marked required in Firefox */\n &:not(output):not(:focus):-moz-ui-invalid {\n box-shadow: none;\n }\n\n &::placeholder {\n color: ${(props) => props.theme.colors.form.placeholder.base};\n font-style: italic;\n }\n\n ${(props) =>\n props.hasBeforeElement &&\n css`\n padding-left: 40px;\n `}\n\n ${(props) =>\n props.hasAfterElement &&\n css`\n padding-right: 40px;\n `}\n }\n\n ${(props) =>\n props.disabled &&\n css`\n opacity: 0.4;\n\n input {\n cursor: not-allowed;\n }\n `}\n\n ${(props) =>\n props.appearance === \"primary\" &&\n css`\n input {\n border: 1px solid ${(props) => props.theme.colors.form.border.base};\n }\n `}\n\n ${(props) =>\n props.invalid &&\n css`\n input {\n border-color: ${(props) => props.theme.colors.form.border.error};\n }\n `}\n\n\t${(props) =>\n props.warning &&\n css`\n input {\n border-color: ${(props) => props.theme.colors.form.border.warning};\n }\n `}\n\n ${COMMON}\n`;\n\nexport const Accessory = styled.div<{\n before?: boolean;\n after?: boolean;\n isClearButton?: boolean;\n}>`\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n color: ${(props) => props.theme.colors.icon.base};\n display: flex;\n align-items: center;\n\n ${(props) =>\n props.before &&\n css`\n left: ${props.theme.space[300]};\n `};\n\n ${(props) =>\n props.after &&\n css`\n right: ${props.isClearButton ? 0 : props.theme.space[300]};\n `};\n`;\n\nContainer.displayName = \"InputContainer\";\nAccessory.displayName = \"InputAccessory\";\n\nexport default Container;\n","import * as React from \"react\";\nimport styled from \"styled-components\";\nimport { useInteractiveColor } from \"@sproutsocial/seeds-react-hooks\";\nimport Button from \"@sproutsocial/seeds-react-button\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\n\nexport interface TypeState {\n hasValue: boolean;\n}\n\n// Using Context so that Input's Input.ClearButton-specific props can be passed to Input.ClearButton,\n// regardless of whether it is manually included as elemAfter or automatically included for type=\"search\" Inputs.\nexport type TypeInputContext = Partial<{\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n handleClear: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n clearButtonLabel: string;\n hasValue: boolean;\n size: \"large\" | \"small\" | \"default\";\n}>;\n\n// Shared by both the styled-components and Tailwind paths so that a single\n// ClearButton identity exists, keeping isClearButton detection and the static\n// Input.ClearButton consistent regardless of which path renders.\nexport const InputContext = React.createContext<TypeInputContext>({});\n\nconst StyledButton = styled(Button)`\n &:hover,\n &:active {\n color: ${(props) => useInteractiveColor(props.theme.colors.icon.base)};\n }\n`;\n\nexport const ClearButton = () => {\n const {\n handleClear,\n clearButtonLabel,\n hasValue,\n size: inputSize,\n } = React.useContext(InputContext);\n\n // Hide the button when there is no text to clear.\n if (!hasValue) {\n return null;\n }\n\n // Warn if clearButtonLabel is not included, so that the unlocalized fallback will not be mistaken for a proper label.\n if (!clearButtonLabel) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Warning: clearButtonLabel prop is required when using Input.ClearButton. Please pass a localized clearButtonLabel to Input.\"\n );\n }\n\n // Reduce Button padding for size small Inputs so that the Button won't go outside the bounds of the Input.\n // This adjustment is handled automatically for default and large Inputs via Button's size. There is no \"small\" Button.\n const py = inputSize === \"small\" ? 100 : undefined;\n const px = inputSize === \"small\" ? 200 : undefined;\n const buttonSize = inputSize === \"small\" ? \"default\" : inputSize;\n return (\n <StyledButton\n onClick={handleClear}\n size={buttonSize}\n py={py}\n px={px}\n title={clearButtonLabel || \"Clear\"}\n ariaLabel={clearButtonLabel || \"Clear\"}\n color=\"icon.base\"\n >\n <Icon name=\"circle-x-outline\" aria-hidden />\n </StyledButton>\n );\n};\n\nClearButton.displayName = \"Input.ClearButton\";\n\n// Used for positioning elementAfter. This logic will detect if the element is a ClearButton,\n// regardless of whether it was manually passed as elemAfter or automatically added to a search Input.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isClearButton = (elem: any) => {\n if (elem?.type) {\n return elem.type.displayName === \"Input.ClearButton\";\n }\n\n return false;\n};\n","/**\n * Tailwind / CSS-class implementation of Input.\n * Renders plain DOM with the Seeds input CSS classes from input.css instead of\n * styled-components. Behavior (state, context, handlers, search affordances and\n * data-qa attributes) is identical to the styled-components path.\n */\nimport * as React from \"react\";\nimport { mergeRefs } from \"@sproutsocial/seeds-react-utilities\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport type { TypeInputProps } from \"./InputTypes\";\nimport {\n InputContext,\n ClearButton,\n isClearButton,\n type TypeState,\n} from \"./shared\";\n\n// Utility for merging class names properly (mirrors ButtonTailwind's local helper;\n// `cn` is intentionally not exported from @sproutsocial/seeds-react-utilities).\nfunction cn(\n ...inputs: (string | undefined | null | false | Record<string, boolean>)[]\n): string {\n const classes: string[] = [];\n\n for (const input of inputs) {\n if (!input) continue;\n\n if (typeof input === \"string\") {\n classes.push(input);\n } else if (typeof input === \"object\") {\n for (const [key, value] of Object.entries(input)) {\n if (value) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(\" \");\n}\n\nclass InputTailwind extends React.Component<TypeInputProps, TypeState> {\n constructor(props: TypeInputProps) {\n super(props);\n this.state = {\n // Tracking hasValue in state allows us to hide ClearButton when there is no value to clear\n // for both controlled and uncontrolled inputs.\n hasValue: !!props.value,\n };\n }\n\n override componentDidUpdate({ value: prevValue }: TypeInputProps) {\n // Update hasValue state whenever props value changes\n const { value } = this.props;\n if (value !== prevValue) {\n this.updateState(value || \"\");\n }\n }\n\n static defaultProps = {\n autoFocus: false,\n disabled: false,\n type: \"text\",\n size: \"default\",\n appearance: \"primary\",\n };\n\n // Define our own ref for use in handleClear.\n // We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.\n inputRef = React.createRef<HTMLInputElement>();\n\n handleBlur = (e: React.FocusEvent<HTMLInputElement>) =>\n this.props.onBlur?.(e);\n\n handleClear = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n const input = this.inputRef.current;\n\n if (input) {\n // Clear the value via the input prototype, then dispatch an input event in order to trigger handleChange\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n \"value\"\n )?.set;\n\n nativeInputValueSetter?.call(input, \"\");\n const inputEvent = new Event(\"input\", {\n bubbles: true,\n });\n input.dispatchEvent(inputEvent);\n\n // call any onClear callback\n this.props.onClear?.(e);\n\n // wait for next cycle to update focus\n setTimeout(() => {\n input.focus();\n }, 0);\n }\n };\n\n handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n this.props.onChange?.(e, e.currentTarget.value);\n // needed for uncontrolled inputs\n this.updateState(e.currentTarget.value);\n };\n\n handleFocus = (e: React.FocusEvent<HTMLInputElement>) =>\n this.props.onFocus?.(e);\n\n handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) =>\n this.props.onKeyDown?.(e, e.currentTarget.value);\n\n handleKeyUp = (e: React.KeyboardEvent<HTMLInputElement>) =>\n this.props.onKeyUp?.(e, e.currentTarget.value);\n\n handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) =>\n this.props.onPaste?.(e, e.currentTarget.value);\n\n updateState = (inputValue: string) => {\n const hasValue = inputValue !== \"\";\n const previousHasValue = this.state.hasValue;\n\n // Only update state if the value of `hasValue` has changed to avoid unnecessary renders.\n if (hasValue !== previousHasValue) {\n this.setState({\n hasValue,\n });\n }\n };\n\n override render() {\n const {\n autoComplete,\n autoFocus,\n disabled,\n readOnly,\n isInvalid,\n hasWarning,\n id,\n name,\n placeholder,\n type,\n required,\n value,\n elemBefore,\n elemAfter,\n maxLength,\n ariaLabel,\n ariaDescribedby,\n clearButtonLabel,\n innerRef = null,\n // These functions are used in the class functions above, but need to be extracted in order for `rest` to be correct\n /* eslint-disable @typescript-eslint/no-unused-vars */\n onBlur,\n onChange,\n onClear,\n onFocus,\n onKeyDown,\n onKeyUp,\n onPaste,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n inputProps = {},\n qa = {},\n appearance,\n size,\n className,\n ...rest\n } = this.props;\n\n // Convert autoComplete from a boolean prop to a string value.\n let autoCompleteValue: \"on\" | \"off\" | undefined;\n\n if (autoComplete !== undefined) {\n autoCompleteValue = autoComplete ? \"on\" : \"off\";\n }\n\n // Add default elemBefore and elemAfter elements if type is search.\n const elementBefore =\n type === \"search\" && !elemBefore ? (\n <Icon name=\"magnifying-glass-outline\" aria-hidden color=\"icon.base\" />\n ) : (\n elemBefore\n );\n\n // Do not add a ClearButton if an elemAfter prop was passed.\n const elementAfter =\n type === \"search\" && !elemAfter ? <ClearButton /> : elemAfter;\n\n // Compose the wrapper class. className is forwarded so styled(Input)\n // extensions (which generate a className and route to this Tailwind path)\n // still apply their styles on top of the base classes.\n const containerClasses = cn(\n \"seeds-input\",\n appearance === \"primary\" && \"seeds-input-primary\",\n size === \"large\" && \"seeds-input-lg\",\n size === \"small\" && \"seeds-input-sm\",\n {\n \"seeds-input-disabled\": !!disabled,\n \"seeds-input-invalid\": !!isInvalid,\n \"seeds-input-warning\": !!hasWarning,\n \"seeds-input-has-before\": !!elementBefore,\n \"seeds-input-has-after\": !!elementAfter,\n },\n className\n );\n\n // Render the wrapper through an `any`-typed element variable so the styled-system\n // remainder (`...rest`: forwardedAs/as/css/px/py/color/... from TypeInputProps) is not\n // type-checked against a literal <div>. Mirrors ButtonTailwind's `const Component = ... as any`.\n const Wrapper = \"div\" as any;\n\n return (\n <Wrapper className={containerClasses} {...rest}>\n <InputContext.Provider\n value={{\n handleClear: this.handleClear,\n hasValue: this.state.hasValue,\n clearButtonLabel,\n size,\n }}\n >\n {elementBefore && (\n <span className=\"seeds-input-accessory seeds-input-accessory-before\">\n {elementBefore}\n </span>\n )}\n\n <input\n aria-invalid={!!isInvalid}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-required={required}\n autoComplete={autoCompleteValue}\n autoFocus={autoFocus}\n disabled={disabled}\n readOnly={readOnly}\n id={id}\n name={name}\n placeholder={placeholder}\n type={type}\n required={required}\n value={value}\n maxLength={maxLength}\n onBlur={this.handleBlur}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onKeyDown={this.handleKeyDown}\n onKeyUp={this.handleKeyUp}\n onPaste={this.handlePaste}\n ref={mergeRefs<HTMLInputElement>(innerRef, this.inputRef)}\n data-qa-input={name || \"\"}\n data-qa-input-isdisabled={disabled === true}\n data-qa-input-isrequired={required === true}\n {...qa}\n {...inputProps}\n />\n\n {elementAfter && (\n <span\n className={cn(\n \"seeds-input-accessory\",\n isClearButton(elementAfter)\n ? \"seeds-input-accessory-clear\"\n : \"seeds-input-accessory-after\"\n )}\n >\n {elementAfter}\n </span>\n )}\n </InputContext.Provider>\n </Wrapper>\n );\n }\n}\n\nexport default InputTailwind;\n","import InputHybrid from \"./InputHybrid\";\n\n/**\n * Input component. Automatically routes between the Tailwind/CSS-class\n * implementation (preferred) and the styled-components implementation (for\n * consumers using system props or a styled() extension). The static\n * Input.ClearButton is preserved via the hybrid.\n */\nexport default InputHybrid;\nexport { InputHybrid as Input };\n","import * as React from \"react\";\nimport type {\n TypeSystemCommonProps,\n TypeStyledComponentsCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\ninterface TypeBaseInputProps {\n /** ID of the form element, should match the \"for\" value of the associated label */\n id: string;\n name: string;\n\n /** Label used to describe the input if not used with an accompanying visual label */\n ariaLabel?: string;\n\n /** Attribute used to associate other elements that describe the Input, like an error */\n ariaDescribedby?: string;\n\n /** Label for Input.ClearButton. Required when using Input.ClearButton. */\n clearButtonLabel?: string;\n\n /** Placeholder text for when value is undefined or empty */\n placeholder?: string;\n\n /** Current value of the input */\n value?: string;\n\n /** HTML type attribute */\n type?: \"date\" | \"email\" | \"number\" | \"password\" | \"text\" | \"url\" | \"search\";\n\n /** Set option to display earlier typed values */\n autoComplete?: boolean | \"on\" | \"off\";\n\n /** Will autofocus the element when mounted to the DOM */\n autoFocus?: boolean;\n\n /** HTML disabled attribute */\n disabled?: boolean;\n\n /** HTML readonly attribute */\n readOnly?: boolean;\n\n /** Whether or not the current contents of the input are invalid */\n isInvalid?: boolean;\n\n /** Whether or not the current contents of the input has any warnings */\n hasWarning?: boolean;\n\n /** HTML required attribute */\n required?: boolean;\n\n /** 16x16 element, such as an icon */\n elemBefore?: React.ReactNode;\n\n /** 16x16 element, such as an icon */\n elemAfter?: React.ReactNode;\n\n /** Max length of the input */\n maxLength?: number;\n\n /** Props to spread onto the underlying input element */\n inputProps?: React.ComponentPropsWithoutRef<\"input\">;\n\n /** Used to get a reference to the underlying element */\n innerRef?:\n | {\n current: null | HTMLInputElement;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | ((arg0: React.ElementRef<any> | HTMLElement) => void)\n | React.Ref<HTMLInputElement>;\n onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;\n onChange?: (e: React.ChangeEvent<HTMLInputElement>, value: string) => void;\n onClear?: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, value: string) => void;\n onKeyUp?: (e: React.KeyboardEvent<HTMLInputElement>, value: string) => void;\n onPaste?: (e: React.ClipboardEvent<HTMLInputElement>, value: string) => void;\n size?: \"large\" | \"small\" | \"default\";\n qa?: object;\n\n /**\n Controls the styles of the input. Primary is our standard input styles and secondary is a borderless input.\n Note that this prop should only be used to alter styles and not functionality.\n */\n appearance?: \"primary\" | \"secondary\";\n}\n\nexport interface TypeInputProps\n extends TypeBaseInputProps,\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<\n React.ComponentPropsWithoutRef<\"div\">,\n keyof TypeBaseInputProps | \"color\"\n > {}\n\nexport interface TypeInputContainerProps {\n size: TypeInputProps[\"size\"];\n appearance: TypeInputProps[\"appearance\"];\n hasBeforeElement: boolean;\n hasAfterElement: boolean;\n invalid?: boolean;\n warning?: boolean;\n disabled?: boolean;\n}\n","import Input from \"./Input\";\n\nexport default Input;\nexport { Input };\nexport { Accessory } from \"./styles\";\nexport * from \"./InputTypes\";\n"],"mappings":";AASA,OAAuB;AACvB,SAAS,s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c,YAAY,IACtB,gCACA;AAAA,cACN;AAAA,cAEC;AAAA;AAAA,UACH;AAAA;AAAA;AAAA,IAEJ,GACF;AAAA,EAEJ;AACF;AAEA,IAAO,wBAAQ;;;AJ3PT,gBAAAI,YAAA;AAHN,IAAM,cAAkC,OAAO;AAAA,EAC7C,CAAC,UACC,eAAe,KAAK,IAClB,gBAAAA,KAAC,iCAAuB,GAAG,OAAO,IAElC,gBAAAA,KAAC,yBAAe,GAAG,OAAO;AAAA,EAE9B,EAAE,YAAY;AAChB;AAEA,YAAY,cAAc;AAE1B,IAAO,sBAAQ;;;AKzBf,IAAO,gBAAQ;;;ACRf,OAAuB;;;ACEvB,IAAO,gBAAQ;","names":["React","Icon","props","styled","jsx","Icon","React","mergeRefs","Icon","jsx","jsxs","Icon","mergeRefs","jsx"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { TypeStyledComponentsCommonProps, TypeSystemCommonProps } from '@sproutsocial/seeds-react-system-props';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as styled_components from 'styled-components';
|
|
5
5
|
|
|
6
6
|
interface TypeBaseInputProps {
|
|
@@ -72,34 +72,26 @@ interface TypeInputContainerProps {
|
|
|
72
72
|
disabled?: boolean;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
96
|
-
handleFocus: (e: React.FocusEvent<HTMLInputElement>) => void | undefined;
|
|
97
|
-
handleKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void | undefined;
|
|
98
|
-
handleKeyUp: (e: React.KeyboardEvent<HTMLInputElement>) => void | undefined;
|
|
99
|
-
handlePaste: (e: React.ClipboardEvent<HTMLInputElement>) => void | undefined;
|
|
100
|
-
updateState: (inputValue: string) => void;
|
|
101
|
-
render(): react_jsx_runtime.JSX.Element;
|
|
102
|
-
}
|
|
75
|
+
declare const ClearButton: {
|
|
76
|
+
(): react_jsx_runtime.JSX.Element | null;
|
|
77
|
+
displayName: string;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Hybrid Input Component
|
|
82
|
+
* Automatically chooses between the Tailwind/CSS-class implementation (preferred,
|
|
83
|
+
* better performance) and the styled-components implementation (for consumers
|
|
84
|
+
* using system props or a styled() extension), based on props.
|
|
85
|
+
*
|
|
86
|
+
* Input uses an `innerRef` prop rather than forwardRef, so both paths receive it
|
|
87
|
+
* through props — no forwardRef wrapper is introduced here.
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
type TypeInputComponent = ((props: TypeInputProps) => React.ReactElement) & {
|
|
91
|
+
displayName?: string;
|
|
92
|
+
ClearButton: typeof ClearButton;
|
|
93
|
+
};
|
|
94
|
+
declare const InputHybrid: TypeInputComponent;
|
|
103
95
|
|
|
104
96
|
declare const Accessory: styled_components.StyledComponent<"div", any, {
|
|
105
97
|
before?: boolean;
|
|
@@ -107,4 +99,4 @@ declare const Accessory: styled_components.StyledComponent<"div", any, {
|
|
|
107
99
|
isClearButton?: boolean;
|
|
108
100
|
}, never>;
|
|
109
101
|
|
|
110
|
-
export { Accessory, Input, type TypeInputContainerProps, type TypeInputProps,
|
|
102
|
+
export { Accessory, InputHybrid as Input, type TypeInputContainerProps, type TypeInputProps, InputHybrid as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { TypeStyledComponentsCommonProps, TypeSystemCommonProps } from '@sproutsocial/seeds-react-system-props';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as styled_components from 'styled-components';
|
|
5
5
|
|
|
6
6
|
interface TypeBaseInputProps {
|
|
@@ -72,34 +72,26 @@ interface TypeInputContainerProps {
|
|
|
72
72
|
disabled?: boolean;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
96
|
-
handleFocus: (e: React.FocusEvent<HTMLInputElement>) => void | undefined;
|
|
97
|
-
handleKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void | undefined;
|
|
98
|
-
handleKeyUp: (e: React.KeyboardEvent<HTMLInputElement>) => void | undefined;
|
|
99
|
-
handlePaste: (e: React.ClipboardEvent<HTMLInputElement>) => void | undefined;
|
|
100
|
-
updateState: (inputValue: string) => void;
|
|
101
|
-
render(): react_jsx_runtime.JSX.Element;
|
|
102
|
-
}
|
|
75
|
+
declare const ClearButton: {
|
|
76
|
+
(): react_jsx_runtime.JSX.Element | null;
|
|
77
|
+
displayName: string;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Hybrid Input Component
|
|
82
|
+
* Automatically chooses between the Tailwind/CSS-class implementation (preferred,
|
|
83
|
+
* better performance) and the styled-components implementation (for consumers
|
|
84
|
+
* using system props or a styled() extension), based on props.
|
|
85
|
+
*
|
|
86
|
+
* Input uses an `innerRef` prop rather than forwardRef, so both paths receive it
|
|
87
|
+
* through props — no forwardRef wrapper is introduced here.
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
type TypeInputComponent = ((props: TypeInputProps) => React.ReactElement) & {
|
|
91
|
+
displayName?: string;
|
|
92
|
+
ClearButton: typeof ClearButton;
|
|
93
|
+
};
|
|
94
|
+
declare const InputHybrid: TypeInputComponent;
|
|
103
95
|
|
|
104
96
|
declare const Accessory: styled_components.StyledComponent<"div", any, {
|
|
105
97
|
before?: boolean;
|
|
@@ -107,4 +99,4 @@ declare const Accessory: styled_components.StyledComponent<"div", any, {
|
|
|
107
99
|
isClearButton?: boolean;
|
|
108
100
|
}, never>;
|
|
109
101
|
|
|
110
|
-
export { Accessory, Input, type TypeInputContainerProps, type TypeInputProps,
|
|
102
|
+
export { Accessory, InputHybrid as Input, type TypeInputContainerProps, type TypeInputProps, InputHybrid as default };
|
package/dist/index.js
CHANGED
|
@@ -36,13 +36,14 @@ __export(index_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(index_exports);
|
|
38
38
|
|
|
39
|
-
// src/
|
|
40
|
-
var
|
|
41
|
-
var
|
|
39
|
+
// src/InputHybrid.tsx
|
|
40
|
+
var React4 = require("react");
|
|
41
|
+
var import_seeds_react_system_props2 = require("@sproutsocial/seeds-react-system-props");
|
|
42
|
+
|
|
43
|
+
// src/InputStyledComponents.tsx
|
|
44
|
+
var React2 = __toESM(require("react"));
|
|
42
45
|
var import_seeds_react_utilities = require("@sproutsocial/seeds-react-utilities");
|
|
43
|
-
var
|
|
44
|
-
var import_seeds_react_button = __toESM(require("@sproutsocial/seeds-react-button"));
|
|
45
|
-
var import_seeds_react_icon = __toESM(require("@sproutsocial/seeds-react-icon"));
|
|
46
|
+
var import_seeds_react_icon2 = __toESM(require("@sproutsocial/seeds-react-icon"));
|
|
46
47
|
|
|
47
48
|
// src/styles.ts
|
|
48
49
|
var import_styled_components = __toESM(require("styled-components"));
|
|
@@ -188,7 +189,12 @@ Container.displayName = "InputContainer";
|
|
|
188
189
|
Accessory.displayName = "InputAccessory";
|
|
189
190
|
var styles_default = Container;
|
|
190
191
|
|
|
191
|
-
// src/
|
|
192
|
+
// src/shared.tsx
|
|
193
|
+
var React = __toESM(require("react"));
|
|
194
|
+
var import_styled_components2 = __toESM(require("styled-components"));
|
|
195
|
+
var import_seeds_react_hooks = require("@sproutsocial/seeds-react-hooks");
|
|
196
|
+
var import_seeds_react_button = __toESM(require("@sproutsocial/seeds-react-button"));
|
|
197
|
+
var import_seeds_react_icon = __toESM(require("@sproutsocial/seeds-react-icon"));
|
|
192
198
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
193
199
|
var InputContext = React.createContext({});
|
|
194
200
|
var StyledButton = (0, import_styled_components2.default)(import_seeds_react_button.default)`
|
|
@@ -236,7 +242,10 @@ var isClearButton = (elem) => {
|
|
|
236
242
|
}
|
|
237
243
|
return false;
|
|
238
244
|
};
|
|
239
|
-
|
|
245
|
+
|
|
246
|
+
// src/InputStyledComponents.tsx
|
|
247
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
248
|
+
var InputStyledComponents = class extends React2.Component {
|
|
240
249
|
constructor(props) {
|
|
241
250
|
super(props);
|
|
242
251
|
this.state = {
|
|
@@ -258,10 +267,9 @@ var Input = class extends React.Component {
|
|
|
258
267
|
size: "default",
|
|
259
268
|
appearance: "primary"
|
|
260
269
|
};
|
|
261
|
-
static ClearButton = ClearButton;
|
|
262
270
|
// Define our own ref for use in handleClear.
|
|
263
271
|
// We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.
|
|
264
|
-
inputRef =
|
|
272
|
+
inputRef = React2.createRef();
|
|
265
273
|
handleBlur = (e) => this.props.onBlur?.(e);
|
|
266
274
|
handleClear = (e) => {
|
|
267
275
|
const input = this.inputRef.current;
|
|
@@ -339,9 +347,9 @@ var Input = class extends React.Component {
|
|
|
339
347
|
if (autoComplete !== void 0) {
|
|
340
348
|
autoCompleteValue = autoComplete ? "on" : "off";
|
|
341
349
|
}
|
|
342
|
-
const elementBefore = type === "search" && !elemBefore ? /* @__PURE__ */ (0,
|
|
343
|
-
const elementAfter = type === "search" && !elemAfter ? /* @__PURE__ */ (0,
|
|
344
|
-
return /* @__PURE__ */ (0,
|
|
350
|
+
const elementBefore = type === "search" && !elemBefore ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_seeds_react_icon2.default, { name: "magnifying-glass-outline", "aria-hidden": true, color: "icon.base" }) : elemBefore;
|
|
351
|
+
const elementAfter = type === "search" && !elemAfter ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ClearButton, {}) : elemAfter;
|
|
352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
345
353
|
styles_default,
|
|
346
354
|
{
|
|
347
355
|
hasBeforeElement: !!elementBefore,
|
|
@@ -352,7 +360,7 @@ var Input = class extends React.Component {
|
|
|
352
360
|
appearance,
|
|
353
361
|
size,
|
|
354
362
|
...rest,
|
|
355
|
-
children: /* @__PURE__ */ (0,
|
|
363
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
356
364
|
InputContext.Provider,
|
|
357
365
|
{
|
|
358
366
|
value: {
|
|
@@ -362,8 +370,8 @@ var Input = class extends React.Component {
|
|
|
362
370
|
size
|
|
363
371
|
},
|
|
364
372
|
children: [
|
|
365
|
-
elementBefore && /* @__PURE__ */ (0,
|
|
366
|
-
/* @__PURE__ */ (0,
|
|
373
|
+
elementBefore && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Accessory, { before: true, children: elementBefore }),
|
|
374
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
367
375
|
"input",
|
|
368
376
|
{
|
|
369
377
|
"aria-invalid": !!isInvalid,
|
|
@@ -395,7 +403,7 @@ var Input = class extends React.Component {
|
|
|
395
403
|
...inputProps
|
|
396
404
|
}
|
|
397
405
|
),
|
|
398
|
-
elementAfter && /* @__PURE__ */ (0,
|
|
406
|
+
elementAfter && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Accessory, { after: true, isClearButton: isClearButton(elementAfter), children: elementAfter })
|
|
399
407
|
]
|
|
400
408
|
}
|
|
401
409
|
)
|
|
@@ -403,10 +411,223 @@ var Input = class extends React.Component {
|
|
|
403
411
|
);
|
|
404
412
|
}
|
|
405
413
|
};
|
|
406
|
-
var
|
|
414
|
+
var InputStyledComponents_default = InputStyledComponents;
|
|
415
|
+
|
|
416
|
+
// src/InputTailwind.tsx
|
|
417
|
+
var React3 = __toESM(require("react"));
|
|
418
|
+
var import_seeds_react_utilities2 = require("@sproutsocial/seeds-react-utilities");
|
|
419
|
+
var import_seeds_react_icon3 = __toESM(require("@sproutsocial/seeds-react-icon"));
|
|
420
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
421
|
+
function cn(...inputs) {
|
|
422
|
+
const classes = [];
|
|
423
|
+
for (const input of inputs) {
|
|
424
|
+
if (!input) continue;
|
|
425
|
+
if (typeof input === "string") {
|
|
426
|
+
classes.push(input);
|
|
427
|
+
} else if (typeof input === "object") {
|
|
428
|
+
for (const [key, value] of Object.entries(input)) {
|
|
429
|
+
if (value) {
|
|
430
|
+
classes.push(key);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return classes.join(" ");
|
|
436
|
+
}
|
|
437
|
+
var InputTailwind = class extends React3.Component {
|
|
438
|
+
constructor(props) {
|
|
439
|
+
super(props);
|
|
440
|
+
this.state = {
|
|
441
|
+
// Tracking hasValue in state allows us to hide ClearButton when there is no value to clear
|
|
442
|
+
// for both controlled and uncontrolled inputs.
|
|
443
|
+
hasValue: !!props.value
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
componentDidUpdate({ value: prevValue }) {
|
|
447
|
+
const { value } = this.props;
|
|
448
|
+
if (value !== prevValue) {
|
|
449
|
+
this.updateState(value || "");
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
static defaultProps = {
|
|
453
|
+
autoFocus: false,
|
|
454
|
+
disabled: false,
|
|
455
|
+
type: "text",
|
|
456
|
+
size: "default",
|
|
457
|
+
appearance: "primary"
|
|
458
|
+
};
|
|
459
|
+
// Define our own ref for use in handleClear.
|
|
460
|
+
// We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.
|
|
461
|
+
inputRef = React3.createRef();
|
|
462
|
+
handleBlur = (e) => this.props.onBlur?.(e);
|
|
463
|
+
handleClear = (e) => {
|
|
464
|
+
const input = this.inputRef.current;
|
|
465
|
+
if (input) {
|
|
466
|
+
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
|
|
467
|
+
window.HTMLInputElement.prototype,
|
|
468
|
+
"value"
|
|
469
|
+
)?.set;
|
|
470
|
+
nativeInputValueSetter?.call(input, "");
|
|
471
|
+
const inputEvent = new Event("input", {
|
|
472
|
+
bubbles: true
|
|
473
|
+
});
|
|
474
|
+
input.dispatchEvent(inputEvent);
|
|
475
|
+
this.props.onClear?.(e);
|
|
476
|
+
setTimeout(() => {
|
|
477
|
+
input.focus();
|
|
478
|
+
}, 0);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
handleChange = (e) => {
|
|
482
|
+
this.props.onChange?.(e, e.currentTarget.value);
|
|
483
|
+
this.updateState(e.currentTarget.value);
|
|
484
|
+
};
|
|
485
|
+
handleFocus = (e) => this.props.onFocus?.(e);
|
|
486
|
+
handleKeyDown = (e) => this.props.onKeyDown?.(e, e.currentTarget.value);
|
|
487
|
+
handleKeyUp = (e) => this.props.onKeyUp?.(e, e.currentTarget.value);
|
|
488
|
+
handlePaste = (e) => this.props.onPaste?.(e, e.currentTarget.value);
|
|
489
|
+
updateState = (inputValue) => {
|
|
490
|
+
const hasValue = inputValue !== "";
|
|
491
|
+
const previousHasValue = this.state.hasValue;
|
|
492
|
+
if (hasValue !== previousHasValue) {
|
|
493
|
+
this.setState({
|
|
494
|
+
hasValue
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
render() {
|
|
499
|
+
const {
|
|
500
|
+
autoComplete,
|
|
501
|
+
autoFocus,
|
|
502
|
+
disabled,
|
|
503
|
+
readOnly,
|
|
504
|
+
isInvalid,
|
|
505
|
+
hasWarning,
|
|
506
|
+
id,
|
|
507
|
+
name,
|
|
508
|
+
placeholder,
|
|
509
|
+
type,
|
|
510
|
+
required,
|
|
511
|
+
value,
|
|
512
|
+
elemBefore,
|
|
513
|
+
elemAfter,
|
|
514
|
+
maxLength,
|
|
515
|
+
ariaLabel,
|
|
516
|
+
ariaDescribedby,
|
|
517
|
+
clearButtonLabel,
|
|
518
|
+
innerRef = null,
|
|
519
|
+
// These functions are used in the class functions above, but need to be extracted in order for `rest` to be correct
|
|
520
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
521
|
+
onBlur,
|
|
522
|
+
onChange,
|
|
523
|
+
onClear,
|
|
524
|
+
onFocus,
|
|
525
|
+
onKeyDown,
|
|
526
|
+
onKeyUp,
|
|
527
|
+
onPaste,
|
|
528
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
529
|
+
inputProps = {},
|
|
530
|
+
qa = {},
|
|
531
|
+
appearance,
|
|
532
|
+
size,
|
|
533
|
+
className,
|
|
534
|
+
...rest
|
|
535
|
+
} = this.props;
|
|
536
|
+
let autoCompleteValue;
|
|
537
|
+
if (autoComplete !== void 0) {
|
|
538
|
+
autoCompleteValue = autoComplete ? "on" : "off";
|
|
539
|
+
}
|
|
540
|
+
const elementBefore = type === "search" && !elemBefore ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_seeds_react_icon3.default, { name: "magnifying-glass-outline", "aria-hidden": true, color: "icon.base" }) : elemBefore;
|
|
541
|
+
const elementAfter = type === "search" && !elemAfter ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ClearButton, {}) : elemAfter;
|
|
542
|
+
const containerClasses = cn(
|
|
543
|
+
"seeds-input",
|
|
544
|
+
appearance === "primary" && "seeds-input-primary",
|
|
545
|
+
size === "large" && "seeds-input-lg",
|
|
546
|
+
size === "small" && "seeds-input-sm",
|
|
547
|
+
{
|
|
548
|
+
"seeds-input-disabled": !!disabled,
|
|
549
|
+
"seeds-input-invalid": !!isInvalid,
|
|
550
|
+
"seeds-input-warning": !!hasWarning,
|
|
551
|
+
"seeds-input-has-before": !!elementBefore,
|
|
552
|
+
"seeds-input-has-after": !!elementAfter
|
|
553
|
+
},
|
|
554
|
+
className
|
|
555
|
+
);
|
|
556
|
+
const Wrapper = "div";
|
|
557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Wrapper, { className: containerClasses, ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
558
|
+
InputContext.Provider,
|
|
559
|
+
{
|
|
560
|
+
value: {
|
|
561
|
+
handleClear: this.handleClear,
|
|
562
|
+
hasValue: this.state.hasValue,
|
|
563
|
+
clearButtonLabel,
|
|
564
|
+
size
|
|
565
|
+
},
|
|
566
|
+
children: [
|
|
567
|
+
elementBefore && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "seeds-input-accessory seeds-input-accessory-before", children: elementBefore }),
|
|
568
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
569
|
+
"input",
|
|
570
|
+
{
|
|
571
|
+
"aria-invalid": !!isInvalid,
|
|
572
|
+
"aria-label": ariaLabel,
|
|
573
|
+
"aria-describedby": ariaDescribedby,
|
|
574
|
+
"aria-required": required,
|
|
575
|
+
autoComplete: autoCompleteValue,
|
|
576
|
+
autoFocus,
|
|
577
|
+
disabled,
|
|
578
|
+
readOnly,
|
|
579
|
+
id,
|
|
580
|
+
name,
|
|
581
|
+
placeholder,
|
|
582
|
+
type,
|
|
583
|
+
required,
|
|
584
|
+
value,
|
|
585
|
+
maxLength,
|
|
586
|
+
onBlur: this.handleBlur,
|
|
587
|
+
onChange: this.handleChange,
|
|
588
|
+
onFocus: this.handleFocus,
|
|
589
|
+
onKeyDown: this.handleKeyDown,
|
|
590
|
+
onKeyUp: this.handleKeyUp,
|
|
591
|
+
onPaste: this.handlePaste,
|
|
592
|
+
ref: (0, import_seeds_react_utilities2.mergeRefs)(innerRef, this.inputRef),
|
|
593
|
+
"data-qa-input": name || "",
|
|
594
|
+
"data-qa-input-isdisabled": disabled === true,
|
|
595
|
+
"data-qa-input-isrequired": required === true,
|
|
596
|
+
...qa,
|
|
597
|
+
...inputProps
|
|
598
|
+
}
|
|
599
|
+
),
|
|
600
|
+
elementAfter && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
601
|
+
"span",
|
|
602
|
+
{
|
|
603
|
+
className: cn(
|
|
604
|
+
"seeds-input-accessory",
|
|
605
|
+
isClearButton(elementAfter) ? "seeds-input-accessory-clear" : "seeds-input-accessory-after"
|
|
606
|
+
),
|
|
607
|
+
children: elementAfter
|
|
608
|
+
}
|
|
609
|
+
)
|
|
610
|
+
]
|
|
611
|
+
}
|
|
612
|
+
) });
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
var InputTailwind_default = InputTailwind;
|
|
616
|
+
|
|
617
|
+
// src/InputHybrid.tsx
|
|
618
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
619
|
+
var InputHybrid = Object.assign(
|
|
620
|
+
(props) => (0, import_seeds_react_system_props2.hasStyledProps)(props) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InputStyledComponents_default, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InputTailwind_default, { ...props }),
|
|
621
|
+
{ ClearButton }
|
|
622
|
+
);
|
|
623
|
+
InputHybrid.displayName = "Input";
|
|
624
|
+
var InputHybrid_default = InputHybrid;
|
|
625
|
+
|
|
626
|
+
// src/Input.tsx
|
|
627
|
+
var Input_default = InputHybrid_default;
|
|
407
628
|
|
|
408
629
|
// src/InputTypes.ts
|
|
409
|
-
var
|
|
630
|
+
var React5 = require("react");
|
|
410
631
|
|
|
411
632
|
// src/index.ts
|
|
412
633
|
var index_default = Input_default;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/Input.tsx","../src/styles.ts","../src/InputTypes.ts"],"sourcesContent":["import Input from \"./Input\";\n\nexport default Input;\nexport { Input };\nexport { Accessory } from \"./styles\";\nexport * from \"./InputTypes\";\n","import * as React from \"react\";\nimport styled from \"styled-components\";\nimport { mergeRefs } from \"@sproutsocial/seeds-react-utilities\";\nimport { useInteractiveColor } from \"@sproutsocial/seeds-react-hooks\";\nimport Button from \"@sproutsocial/seeds-react-button\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container, { Accessory } from \"./styles\";\nimport type { TypeInputProps } from \"./InputTypes\";\n\ninterface TypeState {\n hasValue: boolean;\n}\n\n// Using Context so that Input's Input.ClearButton-specific props can be passed to Input.ClearButton,\n// regardless of whether it is manually included as elemAfter or automatically included for type=\"search\" Inputs.\ntype TypeInputContext = Partial<{\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n handleClear: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n clearButtonLabel: string;\n hasValue: boolean;\n size: \"large\" | \"small\" | \"default\";\n}>;\n\nconst InputContext = React.createContext<TypeInputContext>({});\n\nconst StyledButton = styled(Button)`\n &:hover,\n &:active {\n color: ${(props) => useInteractiveColor(props.theme.colors.icon.base)};\n }\n`;\n\nconst ClearButton = () => {\n const {\n handleClear,\n clearButtonLabel,\n hasValue,\n size: inputSize,\n } = React.useContext(InputContext);\n\n // Hide the button when there is no text to clear.\n if (!hasValue) {\n return null;\n }\n\n // Warn if clearButtonLabel is not included, so that the unlocalized fallback will not be mistaken for a proper label.\n if (!clearButtonLabel) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Warning: clearButtonLabel prop is required when using Input.ClearButton. Please pass a localized clearButtonLabel to Input.\"\n );\n }\n\n // Reduce Button padding for size small Inputs so that the Button won't go outside the bounds of the Input.\n // This adjustment is handled automatically for default and large Inputs via Button's size. There is no \"small\" Button.\n const py = inputSize === \"small\" ? 100 : undefined;\n const px = inputSize === \"small\" ? 200 : undefined;\n const buttonSize = inputSize === \"small\" ? \"default\" : inputSize;\n return (\n <StyledButton\n onClick={handleClear}\n size={buttonSize}\n py={py}\n px={px}\n title={clearButtonLabel || \"Clear\"}\n ariaLabel={clearButtonLabel || \"Clear\"}\n color=\"icon.base\"\n >\n <Icon name=\"circle-x-outline\" aria-hidden />\n </StyledButton>\n );\n};\n\nClearButton.displayName = \"Input.ClearButton\";\n\n// Used for positioning elementAfter. This logic will detect if the element is a ClearButton,\n// regardless of whether it was manually passed as elemAfter or automatically added to a search Input.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isClearButton = (elem: any) => {\n if (elem?.type) {\n return elem.type.displayName === \"Input.ClearButton\";\n }\n\n return false;\n};\n\nclass Input extends React.Component<TypeInputProps, TypeState> {\n constructor(props: TypeInputProps) {\n super(props);\n this.state = {\n // Tracking hasValue in state allows us to hide ClearButton when there is no value to clear\n // for both controlled and uncontrolled inputs.\n hasValue: !!props.value,\n };\n }\n\n override componentDidUpdate({ value: prevValue }: TypeInputProps) {\n // Update hasValue state whenever props value changes\n const { value } = this.props;\n if (value !== prevValue) {\n this.updateState(value || \"\");\n }\n }\n\n static defaultProps = {\n autoFocus: false,\n disabled: false,\n type: \"text\",\n size: \"default\",\n appearance: \"primary\",\n };\n\n static ClearButton = ClearButton;\n // Define our own ref for use in handleClear.\n // We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.\n inputRef = React.createRef<HTMLInputElement>();\n\n handleBlur = (e: React.FocusEvent<HTMLInputElement>) =>\n this.props.onBlur?.(e);\n\n handleClear = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n const input = this.inputRef.current;\n\n if (input) {\n // Clear the value via the input prototype, then dispatch an input event in order to trigger handleChange\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n \"value\"\n )?.set;\n\n nativeInputValueSetter?.call(input, \"\");\n const inputEvent = new Event(\"input\", {\n bubbles: true,\n });\n input.dispatchEvent(inputEvent);\n\n // call any onClear callback\n this.props.onClear?.(e);\n\n // wait for next cycle to update focus\n setTimeout(() => {\n input.focus();\n }, 0);\n }\n };\n\n handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n this.props.onChange?.(e, e.currentTarget.value);\n // needed for uncontrolled inputs\n this.updateState(e.currentTarget.value);\n };\n\n handleFocus = (e: React.FocusEvent<HTMLInputElement>) =>\n this.props.onFocus?.(e);\n\n handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) =>\n this.props.onKeyDown?.(e, e.currentTarget.value);\n\n handleKeyUp = (e: React.KeyboardEvent<HTMLInputElement>) =>\n this.props.onKeyUp?.(e, e.currentTarget.value);\n\n handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) =>\n this.props.onPaste?.(e, e.currentTarget.value);\n\n updateState = (inputValue: string) => {\n const hasValue = inputValue !== \"\";\n const previousHasValue = this.state.hasValue;\n\n // Only update state if the value of `hasValue` has changed to avoid unnecessary renders.\n if (hasValue !== previousHasValue) {\n this.setState({\n hasValue,\n });\n }\n };\n\n override render() {\n const {\n autoComplete,\n autoFocus,\n disabled,\n readOnly,\n isInvalid,\n hasWarning,\n id,\n name,\n placeholder,\n type,\n required,\n value,\n elemBefore,\n elemAfter,\n maxLength,\n ariaLabel,\n ariaDescribedby,\n clearButtonLabel,\n innerRef = null,\n // These functions are used in the class functions above, but need to be extracted in order for `rest` to be correct\n /* eslint-disable @typescript-eslint/no-unused-vars */\n onBlur,\n onChange,\n onClear,\n onFocus,\n onKeyDown,\n onKeyUp,\n onPaste,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n inputProps = {},\n qa = {},\n appearance,\n size,\n ...rest\n } = this.props;\n\n // Convert autoComplete from a boolean prop to a string value.\n let autoCompleteValue: \"on\" | \"off\" | undefined;\n\n if (autoComplete !== undefined) {\n autoCompleteValue = autoComplete ? \"on\" : \"off\";\n }\n\n // Add default elemBefore and elemAfter elements if type is search.\n const elementBefore =\n type === \"search\" && !elemBefore ? (\n <Icon name=\"magnifying-glass-outline\" aria-hidden color=\"icon.base\" />\n ) : (\n elemBefore\n );\n\n // Do not add a ClearButton if an elemAfter prop was passed.\n const elementAfter =\n type === \"search\" && !elemAfter ? <ClearButton /> : elemAfter;\n\n return (\n <Container\n hasBeforeElement={!!elementBefore}\n hasAfterElement={!!elementAfter}\n disabled={disabled}\n invalid={!!isInvalid}\n warning={hasWarning}\n appearance={appearance}\n size={size}\n {...rest}\n >\n <InputContext.Provider\n value={{\n handleClear: this.handleClear,\n hasValue: this.state.hasValue,\n clearButtonLabel,\n size,\n }}\n >\n {elementBefore && <Accessory before>{elementBefore}</Accessory>}\n\n <input\n aria-invalid={!!isInvalid}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-required={required}\n autoComplete={autoCompleteValue}\n autoFocus={autoFocus}\n disabled={disabled}\n readOnly={readOnly}\n id={id}\n name={name}\n placeholder={placeholder}\n type={type}\n required={required}\n value={value}\n maxLength={maxLength}\n onBlur={this.handleBlur}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onKeyDown={this.handleKeyDown}\n onKeyUp={this.handleKeyUp}\n onPaste={this.handlePaste}\n ref={mergeRefs<HTMLInputElement>(innerRef, this.inputRef)}\n data-qa-input={name || \"\"}\n data-qa-input-isdisabled={disabled === true}\n data-qa-input-isrequired={required === true}\n {...qa}\n {...inputProps}\n />\n\n {elementAfter && (\n <Accessory after isClearButton={isClearButton(elementAfter)}>\n {elementAfter}\n </Accessory>\n )}\n </InputContext.Provider>\n </Container>\n );\n }\n}\n\nexport default Input;\n","import styled, { css } from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { focusRing } from \"@sproutsocial/seeds-react-mixins\";\nimport type { TypeInputContainerProps } from \"./InputTypes\";\n\nconst Container = styled.div<TypeInputContainerProps>`\n box-sizing: border-box;\n position: relative;\n\n input {\n box-sizing: border-box;\n width: 100%;\n border: 1px solid transparent;\n border-radius: ${(props) => props.theme.radii[500]};\n background-color: ${(props) => props.theme.colors.form.background.base};\n color: ${(props) => props.theme.colors.text.body};\n outline: none;\n transition: border-color ${(props) => props.theme.duration.fast}\n ${(props) => props.theme.easing.ease_in},\n box-shadow ${(props) => props.theme.duration.fast}\n ${(props) => props.theme.easing.ease_in};\n font-family: ${(props) => props.theme.fontFamily};\n font-weight: ${(props) => props.theme.fontWeights.normal};\n appearance: none;\n /** This matches the overall height of Button and Select */\n margin: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n\n padding: ${(props) => {\n switch (props.size) {\n case \"large\":\n return `${props.theme.space[350]} ${props.theme.space[400]}`;\n\n case \"small\":\n return props.theme.space[200];\n\n case \"default\":\n default:\n return props.theme.space[300];\n }\n }};\n\n font-size: ${(props) => {\n switch (props.size) {\n case \"large\":\n return props.theme.typography[300].fontSize;\n\n case \"small\":\n case \"default\":\n default:\n return props.theme.typography[200].fontSize;\n }\n }};\n\n line-height: ${(props) => {\n switch (props.size) {\n case \"large\":\n return props.theme.typography[300].lineHeight;\n\n /* 16px was the value prior to this change to 'large'. Leaving as-is but it is a non-Seeds typography line-height. It may have a big impact though */\n case \"small\":\n case \"default\":\n default:\n return \"16px\";\n }\n }};\n\n /* https://stackoverflow.com/questions/14007655/remove-ie10s-clear-field-x-button-on-certain-inputs */\n &::-ms-clear {\n display: none;\n }\n\n &::-webkit-search-cancel-button {\n appearance: none;\n }\n\n &:focus {\n ${focusRing}\n }\n\n /* Fix for red ring when input is marked required in Firefox */\n &:not(output):not(:focus):-moz-ui-invalid {\n box-shadow: none;\n }\n\n &::placeholder {\n color: ${(props) => props.theme.colors.form.placeholder.base};\n font-style: italic;\n }\n\n ${(props) =>\n props.hasBeforeElement &&\n css`\n padding-left: 40px;\n `}\n\n ${(props) =>\n props.hasAfterElement &&\n css`\n padding-right: 40px;\n `}\n }\n\n ${(props) =>\n props.disabled &&\n css`\n opacity: 0.4;\n\n input {\n cursor: not-allowed;\n }\n `}\n\n ${(props) =>\n props.appearance === \"primary\" &&\n css`\n input {\n border: 1px solid ${(props) => props.theme.colors.form.border.base};\n }\n `}\n\n ${(props) =>\n props.invalid &&\n css`\n input {\n border-color: ${(props) => props.theme.colors.form.border.error};\n }\n `}\n\n\t${(props) =>\n props.warning &&\n css`\n input {\n border-color: ${(props) => props.theme.colors.form.border.warning};\n }\n `}\n\n ${COMMON}\n`;\n\nexport const Accessory = styled.div<{\n before?: boolean;\n after?: boolean;\n isClearButton?: boolean;\n}>`\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n color: ${(props) => props.theme.colors.icon.base};\n display: flex;\n align-items: center;\n\n ${(props) =>\n props.before &&\n css`\n left: ${props.theme.space[300]};\n `};\n\n ${(props) =>\n props.after &&\n css`\n right: ${props.isClearButton ? 0 : props.theme.space[300]};\n `};\n`;\n\nContainer.displayName = \"InputContainer\";\nAccessory.displayName = \"InputAccessory\";\n\nexport default Container;\n","import * as React from \"react\";\nimport type {\n TypeSystemCommonProps,\n TypeStyledComponentsCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\ninterface TypeBaseInputProps {\n /** ID of the form element, should match the \"for\" value of the associated label */\n id: string;\n name: string;\n\n /** Label used to describe the input if not used with an accompanying visual label */\n ariaLabel?: string;\n\n /** Attribute used to associate other elements that describe the Input, like an error */\n ariaDescribedby?: string;\n\n /** Label for Input.ClearButton. Required when using Input.ClearButton. */\n clearButtonLabel?: string;\n\n /** Placeholder text for when value is undefined or empty */\n placeholder?: string;\n\n /** Current value of the input */\n value?: string;\n\n /** HTML type attribute */\n type?: \"date\" | \"email\" | \"number\" | \"password\" | \"text\" | \"url\" | \"search\";\n\n /** Set option to display earlier typed values */\n autoComplete?: boolean | \"on\" | \"off\";\n\n /** Will autofocus the element when mounted to the DOM */\n autoFocus?: boolean;\n\n /** HTML disabled attribute */\n disabled?: boolean;\n\n /** HTML readonly attribute */\n readOnly?: boolean;\n\n /** Whether or not the current contents of the input are invalid */\n isInvalid?: boolean;\n\n /** Whether or not the current contents of the input has any warnings */\n hasWarning?: boolean;\n\n /** HTML required attribute */\n required?: boolean;\n\n /** 16x16 element, such as an icon */\n elemBefore?: React.ReactNode;\n\n /** 16x16 element, such as an icon */\n elemAfter?: React.ReactNode;\n\n /** Max length of the input */\n maxLength?: number;\n\n /** Props to spread onto the underlying input element */\n inputProps?: React.ComponentPropsWithoutRef<\"input\">;\n\n /** Used to get a reference to the underlying element */\n innerRef?:\n | {\n current: null | HTMLInputElement;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | ((arg0: React.ElementRef<any> | HTMLElement) => void)\n | React.Ref<HTMLInputElement>;\n onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;\n onChange?: (e: React.ChangeEvent<HTMLInputElement>, value: string) => void;\n onClear?: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, value: string) => void;\n onKeyUp?: (e: React.KeyboardEvent<HTMLInputElement>, value: string) => void;\n onPaste?: (e: React.ClipboardEvent<HTMLInputElement>, value: string) => void;\n size?: \"large\" | \"small\" | \"default\";\n qa?: object;\n\n /**\n Controls the styles of the input. Primary is our standard input styles and secondary is a borderless input.\n Note that this prop should only be used to alter styles and not functionality.\n */\n appearance?: \"primary\" | \"secondary\";\n}\n\nexport interface TypeInputProps\n extends TypeBaseInputProps,\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<\n React.ComponentPropsWithoutRef<\"div\">,\n keyof TypeBaseInputProps | \"color\"\n > {}\n\nexport interface TypeInputContainerProps {\n size: TypeInputProps[\"size\"];\n appearance: TypeInputProps[\"appearance\"];\n hasBeforeElement: boolean;\n hasAfterElement: boolean;\n invalid?: boolean;\n warning?: boolean;\n disabled?: boolean;\n}\n"],"mappings":";;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,UAAb;AAAA,YACC,OAAO;AAAA,cACL,aAAa,KAAK;AAAA,cAClB,UAAU,KAAK,MAAM;AAAA,cACrB;AAAA,cACA;AAAA,YACF;AAAA,YAEC;AAAA,+BAAiB,4CAAC,aAAU,QAAM,MAAE,yBAAc;AAAA,cAEnD;AAAA,gBAAC;AAAA;AAAA,kBACC,gBAAc,CAAC,CAAC;AAAA,kBAChB,cAAY;AAAA,kBACZ,oBAAkB;AAAA,kBAClB,iBAAe;AAAA,kBACf,cAAc;AAAA,kBACd;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA,QAAQ,KAAK;AAAA,kBACb,UAAU,KAAK;AAAA,kBACf,SAAS,KAAK;AAAA,kBACd,WAAW,KAAK;AAAA,kBAChB,SAAS,KAAK;AAAA,kBACd,SAAS,KAAK;AAAA,kBACd,SAAK,wCAA4B,UAAU,KAAK,QAAQ;AAAA,kBACxD,iBAAe,QAAQ;AAAA,kBACvB,4BAA0B,aAAa;AAAA,kBACvC,4BAA0B,aAAa;AAAA,kBACtC,GAAG;AAAA,kBACH,GAAG;AAAA;AAAA,cACN;AAAA,cAEC,gBACC,4CAAC,aAAU,OAAK,MAAC,eAAe,cAAc,YAAY,GACvD,wBACH;AAAA;AAAA;AAAA,QAEJ;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,IAAO,gBAAQ;;;AEvSf,IAAAC,SAAuB;;;AHEvB,IAAO,gBAAQ;","names":["import_styled_components","styled","props","styled","Button","Icon","React"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/InputHybrid.tsx","../src/InputStyledComponents.tsx","../src/styles.ts","../src/shared.tsx","../src/InputTailwind.tsx","../src/Input.tsx","../src/InputTypes.ts"],"sourcesContent":["import Input from \"./Input\";\n\nexport default Input;\nexport { Input };\nexport { Accessory } from \"./styles\";\nexport * from \"./InputTypes\";\n","/**\n * Hybrid Input Component\n * Automatically chooses between the Tailwind/CSS-class implementation (preferred,\n * better performance) and the styled-components implementation (for consumers\n * using system props or a styled() extension), based on props.\n *\n * Input uses an `innerRef` prop rather than forwardRef, so both paths receive it\n * through props — no forwardRef wrapper is introduced here.\n */\nimport * as React from \"react\";\nimport { hasStyledProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeInputProps } from \"./InputTypes\";\nimport InputStyledComponents from \"./InputStyledComponents\";\nimport InputTailwind from \"./InputTailwind\";\nimport { ClearButton } from \"./shared\";\n\ntype TypeInputComponent = ((props: TypeInputProps) => React.ReactElement) & {\n displayName?: string;\n ClearButton: typeof ClearButton;\n};\n\nconst InputHybrid: TypeInputComponent = Object.assign(\n (props: TypeInputProps) =>\n hasStyledProps(props) ? (\n <InputStyledComponents {...props} />\n ) : (\n <InputTailwind {...props} />\n ),\n { ClearButton }\n);\n\nInputHybrid.displayName = \"Input\";\n\nexport default InputHybrid;\n","import * as React from \"react\";\nimport { mergeRefs } from \"@sproutsocial/seeds-react-utilities\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container, { Accessory } from \"./styles\";\nimport type { TypeInputProps } from \"./InputTypes\";\nimport {\n InputContext,\n ClearButton,\n isClearButton,\n type TypeState,\n} from \"./shared\";\n\n/**\n * Styled-components implementation of Input. This is the legacy/SC path the\n * hybrid routes to when a consumer passes styled-system props or extends Input\n * via styled(). It is the verbatim implementation Input.tsx previously held.\n */\nclass InputStyledComponents extends React.Component<TypeInputProps, TypeState> {\n constructor(props: TypeInputProps) {\n super(props);\n this.state = {\n // Tracking hasValue in state allows us to hide ClearButton when there is no value to clear\n // for both controlled and uncontrolled inputs.\n hasValue: !!props.value,\n };\n }\n\n override componentDidUpdate({ value: prevValue }: TypeInputProps) {\n // Update hasValue state whenever props value changes\n const { value } = this.props;\n if (value !== prevValue) {\n this.updateState(value || \"\");\n }\n }\n\n static defaultProps = {\n autoFocus: false,\n disabled: false,\n type: \"text\",\n size: \"default\",\n appearance: \"primary\",\n };\n\n // Define our own ref for use in handleClear.\n // We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.\n inputRef = React.createRef<HTMLInputElement>();\n\n handleBlur = (e: React.FocusEvent<HTMLInputElement>) =>\n this.props.onBlur?.(e);\n\n handleClear = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n const input = this.inputRef.current;\n\n if (input) {\n // Clear the value via the input prototype, then dispatch an input event in order to trigger handleChange\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n \"value\"\n )?.set;\n\n nativeInputValueSetter?.call(input, \"\");\n const inputEvent = new Event(\"input\", {\n bubbles: true,\n });\n input.dispatchEvent(inputEvent);\n\n // call any onClear callback\n this.props.onClear?.(e);\n\n // wait for next cycle to update focus\n setTimeout(() => {\n input.focus();\n }, 0);\n }\n };\n\n handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n this.props.onChange?.(e, e.currentTarget.value);\n // needed for uncontrolled inputs\n this.updateState(e.currentTarget.value);\n };\n\n handleFocus = (e: React.FocusEvent<HTMLInputElement>) =>\n this.props.onFocus?.(e);\n\n handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) =>\n this.props.onKeyDown?.(e, e.currentTarget.value);\n\n handleKeyUp = (e: React.KeyboardEvent<HTMLInputElement>) =>\n this.props.onKeyUp?.(e, e.currentTarget.value);\n\n handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) =>\n this.props.onPaste?.(e, e.currentTarget.value);\n\n updateState = (inputValue: string) => {\n const hasValue = inputValue !== \"\";\n const previousHasValue = this.state.hasValue;\n\n // Only update state if the value of `hasValue` has changed to avoid unnecessary renders.\n if (hasValue !== previousHasValue) {\n this.setState({\n hasValue,\n });\n }\n };\n\n override render() {\n const {\n autoComplete,\n autoFocus,\n disabled,\n readOnly,\n isInvalid,\n hasWarning,\n id,\n name,\n placeholder,\n type,\n required,\n value,\n elemBefore,\n elemAfter,\n maxLength,\n ariaLabel,\n ariaDescribedby,\n clearButtonLabel,\n innerRef = null,\n // These functions are used in the class functions above, but need to be extracted in order for `rest` to be correct\n /* eslint-disable @typescript-eslint/no-unused-vars */\n onBlur,\n onChange,\n onClear,\n onFocus,\n onKeyDown,\n onKeyUp,\n onPaste,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n inputProps = {},\n qa = {},\n appearance,\n size,\n ...rest\n } = this.props;\n\n // Convert autoComplete from a boolean prop to a string value.\n let autoCompleteValue: \"on\" | \"off\" | undefined;\n\n if (autoComplete !== undefined) {\n autoCompleteValue = autoComplete ? \"on\" : \"off\";\n }\n\n // Add default elemBefore and elemAfter elements if type is search.\n const elementBefore =\n type === \"search\" && !elemBefore ? (\n <Icon name=\"magnifying-glass-outline\" aria-hidden color=\"icon.base\" />\n ) : (\n elemBefore\n );\n\n // Do not add a ClearButton if an elemAfter prop was passed.\n const elementAfter =\n type === \"search\" && !elemAfter ? <ClearButton /> : elemAfter;\n\n return (\n <Container\n hasBeforeElement={!!elementBefore}\n hasAfterElement={!!elementAfter}\n disabled={disabled}\n invalid={!!isInvalid}\n warning={hasWarning}\n appearance={appearance}\n size={size}\n {...rest}\n >\n <InputContext.Provider\n value={{\n handleClear: this.handleClear,\n hasValue: this.state.hasValue,\n clearButtonLabel,\n size,\n }}\n >\n {elementBefore && <Accessory before>{elementBefore}</Accessory>}\n\n <input\n aria-invalid={!!isInvalid}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-required={required}\n autoComplete={autoCompleteValue}\n autoFocus={autoFocus}\n disabled={disabled}\n readOnly={readOnly}\n id={id}\n name={name}\n placeholder={placeholder}\n type={type}\n required={required}\n value={value}\n maxLength={maxLength}\n onBlur={this.handleBlur}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onKeyDown={this.handleKeyDown}\n onKeyUp={this.handleKeyUp}\n onPaste={this.handlePaste}\n ref={mergeRefs<HTMLInputElement>(innerRef, this.inputRef)}\n data-qa-input={name || \"\"}\n data-qa-input-isdisabled={disabled === true}\n data-qa-input-isrequired={required === true}\n {...qa}\n {...inputProps}\n />\n\n {elementAfter && (\n <Accessory after isClearButton={isClearButton(elementAfter)}>\n {elementAfter}\n </Accessory>\n )}\n </InputContext.Provider>\n </Container>\n );\n }\n}\n\nexport default InputStyledComponents;\n","import styled, { css } from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { focusRing } from \"@sproutsocial/seeds-react-mixins\";\nimport type { TypeInputContainerProps } from \"./InputTypes\";\n\nconst Container = styled.div<TypeInputContainerProps>`\n box-sizing: border-box;\n position: relative;\n\n input {\n box-sizing: border-box;\n width: 100%;\n border: 1px solid transparent;\n border-radius: ${(props) => props.theme.radii[500]};\n background-color: ${(props) => props.theme.colors.form.background.base};\n color: ${(props) => props.theme.colors.text.body};\n outline: none;\n transition: border-color ${(props) => props.theme.duration.fast}\n ${(props) => props.theme.easing.ease_in},\n box-shadow ${(props) => props.theme.duration.fast}\n ${(props) => props.theme.easing.ease_in};\n font-family: ${(props) => props.theme.fontFamily};\n font-weight: ${(props) => props.theme.fontWeights.normal};\n appearance: none;\n /** This matches the overall height of Button and Select */\n margin: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n\n padding: ${(props) => {\n switch (props.size) {\n case \"large\":\n return `${props.theme.space[350]} ${props.theme.space[400]}`;\n\n case \"small\":\n return props.theme.space[200];\n\n case \"default\":\n default:\n return props.theme.space[300];\n }\n }};\n\n font-size: ${(props) => {\n switch (props.size) {\n case \"large\":\n return props.theme.typography[300].fontSize;\n\n case \"small\":\n case \"default\":\n default:\n return props.theme.typography[200].fontSize;\n }\n }};\n\n line-height: ${(props) => {\n switch (props.size) {\n case \"large\":\n return props.theme.typography[300].lineHeight;\n\n /* 16px was the value prior to this change to 'large'. Leaving as-is but it is a non-Seeds typography line-height. It may have a big impact though */\n case \"small\":\n case \"default\":\n default:\n return \"16px\";\n }\n }};\n\n /* https://stackoverflow.com/questions/14007655/remove-ie10s-clear-field-x-button-on-certain-inputs */\n &::-ms-clear {\n display: none;\n }\n\n &::-webkit-search-cancel-button {\n appearance: none;\n }\n\n &:focus {\n ${focusRing}\n }\n\n /* Fix for red ring when input is marked required in Firefox */\n &:not(output):not(:focus):-moz-ui-invalid {\n box-shadow: none;\n }\n\n &::placeholder {\n color: ${(props) => props.theme.colors.form.placeholder.base};\n font-style: italic;\n }\n\n ${(props) =>\n props.hasBeforeElement &&\n css`\n padding-left: 40px;\n `}\n\n ${(props) =>\n props.hasAfterElement &&\n css`\n padding-right: 40px;\n `}\n }\n\n ${(props) =>\n props.disabled &&\n css`\n opacity: 0.4;\n\n input {\n cursor: not-allowed;\n }\n `}\n\n ${(props) =>\n props.appearance === \"primary\" &&\n css`\n input {\n border: 1px solid ${(props) => props.theme.colors.form.border.base};\n }\n `}\n\n ${(props) =>\n props.invalid &&\n css`\n input {\n border-color: ${(props) => props.theme.colors.form.border.error};\n }\n `}\n\n\t${(props) =>\n props.warning &&\n css`\n input {\n border-color: ${(props) => props.theme.colors.form.border.warning};\n }\n `}\n\n ${COMMON}\n`;\n\nexport const Accessory = styled.div<{\n before?: boolean;\n after?: boolean;\n isClearButton?: boolean;\n}>`\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n color: ${(props) => props.theme.colors.icon.base};\n display: flex;\n align-items: center;\n\n ${(props) =>\n props.before &&\n css`\n left: ${props.theme.space[300]};\n `};\n\n ${(props) =>\n props.after &&\n css`\n right: ${props.isClearButton ? 0 : props.theme.space[300]};\n `};\n`;\n\nContainer.displayName = \"InputContainer\";\nAccessory.displayName = \"InputAccessory\";\n\nexport default Container;\n","import * as React from \"react\";\nimport styled from \"styled-components\";\nimport { useInteractiveColor } from \"@sproutsocial/seeds-react-hooks\";\nimport Button from \"@sproutsocial/seeds-react-button\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\n\nexport interface TypeState {\n hasValue: boolean;\n}\n\n// Using Context so that Input's Input.ClearButton-specific props can be passed to Input.ClearButton,\n// regardless of whether it is manually included as elemAfter or automatically included for type=\"search\" Inputs.\nexport type TypeInputContext = Partial<{\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n handleClear: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n clearButtonLabel: string;\n hasValue: boolean;\n size: \"large\" | \"small\" | \"default\";\n}>;\n\n// Shared by both the styled-components and Tailwind paths so that a single\n// ClearButton identity exists, keeping isClearButton detection and the static\n// Input.ClearButton consistent regardless of which path renders.\nexport const InputContext = React.createContext<TypeInputContext>({});\n\nconst StyledButton = styled(Button)`\n &:hover,\n &:active {\n color: ${(props) => useInteractiveColor(props.theme.colors.icon.base)};\n }\n`;\n\nexport const ClearButton = () => {\n const {\n handleClear,\n clearButtonLabel,\n hasValue,\n size: inputSize,\n } = React.useContext(InputContext);\n\n // Hide the button when there is no text to clear.\n if (!hasValue) {\n return null;\n }\n\n // Warn if clearButtonLabel is not included, so that the unlocalized fallback will not be mistaken for a proper label.\n if (!clearButtonLabel) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Warning: clearButtonLabel prop is required when using Input.ClearButton. Please pass a localized clearButtonLabel to Input.\"\n );\n }\n\n // Reduce Button padding for size small Inputs so that the Button won't go outside the bounds of the Input.\n // This adjustment is handled automatically for default and large Inputs via Button's size. There is no \"small\" Button.\n const py = inputSize === \"small\" ? 100 : undefined;\n const px = inputSize === \"small\" ? 200 : undefined;\n const buttonSize = inputSize === \"small\" ? \"default\" : inputSize;\n return (\n <StyledButton\n onClick={handleClear}\n size={buttonSize}\n py={py}\n px={px}\n title={clearButtonLabel || \"Clear\"}\n ariaLabel={clearButtonLabel || \"Clear\"}\n color=\"icon.base\"\n >\n <Icon name=\"circle-x-outline\" aria-hidden />\n </StyledButton>\n );\n};\n\nClearButton.displayName = \"Input.ClearButton\";\n\n// Used for positioning elementAfter. This logic will detect if the element is a ClearButton,\n// regardless of whether it was manually passed as elemAfter or automatically added to a search Input.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isClearButton = (elem: any) => {\n if (elem?.type) {\n return elem.type.displayName === \"Input.ClearButton\";\n }\n\n return false;\n};\n","/**\n * Tailwind / CSS-class implementation of Input.\n * Renders plain DOM with the Seeds input CSS classes from input.css instead of\n * styled-components. Behavior (state, context, handlers, search affordances and\n * data-qa attributes) is identical to the styled-components path.\n */\nimport * as React from \"react\";\nimport { mergeRefs } from \"@sproutsocial/seeds-react-utilities\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport type { TypeInputProps } from \"./InputTypes\";\nimport {\n InputContext,\n ClearButton,\n isClearButton,\n type TypeState,\n} from \"./shared\";\n\n// Utility for merging class names properly (mirrors ButtonTailwind's local helper;\n// `cn` is intentionally not exported from @sproutsocial/seeds-react-utilities).\nfunction cn(\n ...inputs: (string | undefined | null | false | Record<string, boolean>)[]\n): string {\n const classes: string[] = [];\n\n for (const input of inputs) {\n if (!input) continue;\n\n if (typeof input === \"string\") {\n classes.push(input);\n } else if (typeof input === \"object\") {\n for (const [key, value] of Object.entries(input)) {\n if (value) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(\" \");\n}\n\nclass InputTailwind extends React.Component<TypeInputProps, TypeState> {\n constructor(props: TypeInputProps) {\n super(props);\n this.state = {\n // Tracking hasValue in state allows us to hide ClearButton when there is no value to clear\n // for both controlled and uncontrolled inputs.\n hasValue: !!props.value,\n };\n }\n\n override componentDidUpdate({ value: prevValue }: TypeInputProps) {\n // Update hasValue state whenever props value changes\n const { value } = this.props;\n if (value !== prevValue) {\n this.updateState(value || \"\");\n }\n }\n\n static defaultProps = {\n autoFocus: false,\n disabled: false,\n type: \"text\",\n size: \"default\",\n appearance: \"primary\",\n };\n\n // Define our own ref for use in handleClear.\n // We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.\n inputRef = React.createRef<HTMLInputElement>();\n\n handleBlur = (e: React.FocusEvent<HTMLInputElement>) =>\n this.props.onBlur?.(e);\n\n handleClear = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n const input = this.inputRef.current;\n\n if (input) {\n // Clear the value via the input prototype, then dispatch an input event in order to trigger handleChange\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n \"value\"\n )?.set;\n\n nativeInputValueSetter?.call(input, \"\");\n const inputEvent = new Event(\"input\", {\n bubbles: true,\n });\n input.dispatchEvent(inputEvent);\n\n // call any onClear callback\n this.props.onClear?.(e);\n\n // wait for next cycle to update focus\n setTimeout(() => {\n input.focus();\n }, 0);\n }\n };\n\n handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n this.props.onChange?.(e, e.currentTarget.value);\n // needed for uncontrolled inputs\n this.updateState(e.currentTarget.value);\n };\n\n handleFocus = (e: React.FocusEvent<HTMLInputElement>) =>\n this.props.onFocus?.(e);\n\n handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) =>\n this.props.onKeyDown?.(e, e.currentTarget.value);\n\n handleKeyUp = (e: React.KeyboardEvent<HTMLInputElement>) =>\n this.props.onKeyUp?.(e, e.currentTarget.value);\n\n handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) =>\n this.props.onPaste?.(e, e.currentTarget.value);\n\n updateState = (inputValue: string) => {\n const hasValue = inputValue !== \"\";\n const previousHasValue = this.state.hasValue;\n\n // Only update state if the value of `hasValue` has changed to avoid unnecessary renders.\n if (hasValue !== previousHasValue) {\n this.setState({\n hasValue,\n });\n }\n };\n\n override render() {\n const {\n autoComplete,\n autoFocus,\n disabled,\n readOnly,\n isInvalid,\n hasWarning,\n id,\n name,\n placeholder,\n type,\n required,\n value,\n elemBefore,\n elemAfter,\n maxLength,\n ariaLabel,\n ariaDescribedby,\n clearButtonLabel,\n innerRef = null,\n // These functions are used in the class functions above, but need to be extracted in order for `rest` to be correct\n /* eslint-disable @typescript-eslint/no-unused-vars */\n onBlur,\n onChange,\n onClear,\n onFocus,\n onKeyDown,\n onKeyUp,\n onPaste,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n inputProps = {},\n qa = {},\n appearance,\n size,\n className,\n ...rest\n } = this.props;\n\n // Convert autoComplete from a boolean prop to a string value.\n let autoCompleteValue: \"on\" | \"off\" | undefined;\n\n if (autoComplete !== undefined) {\n autoCompleteValue = autoComplete ? \"on\" : \"off\";\n }\n\n // Add default elemBefore and elemAfter elements if type is search.\n const elementBefore =\n type === \"search\" && !elemBefore ? (\n <Icon name=\"magnifying-glass-outline\" aria-hidden color=\"icon.base\" />\n ) : (\n elemBefore\n );\n\n // Do not add a ClearButton if an elemAfter prop was passed.\n const elementAfter =\n type === \"search\" && !elemAfter ? <ClearButton /> : elemAfter;\n\n // Compose the wrapper class. className is forwarded so styled(Input)\n // extensions (which generate a className and route to this Tailwind path)\n // still apply their styles on top of the base classes.\n const containerClasses = cn(\n \"seeds-input\",\n appearance === \"primary\" && \"seeds-input-primary\",\n size === \"large\" && \"seeds-input-lg\",\n size === \"small\" && \"seeds-input-sm\",\n {\n \"seeds-input-disabled\": !!disabled,\n \"seeds-input-invalid\": !!isInvalid,\n \"seeds-input-warning\": !!hasWarning,\n \"seeds-input-has-before\": !!elementBefore,\n \"seeds-input-has-after\": !!elementAfter,\n },\n className\n );\n\n // Render the wrapper through an `any`-typed element variable so the styled-system\n // remainder (`...rest`: forwardedAs/as/css/px/py/color/... from TypeInputProps) is not\n // type-checked against a literal <div>. Mirrors ButtonTailwind's `const Component = ... as any`.\n const Wrapper = \"div\" as any;\n\n return (\n <Wrapper className={containerClasses} {...rest}>\n <InputContext.Provider\n value={{\n handleClear: this.handleClear,\n hasValue: this.state.hasValue,\n clearButtonLabel,\n size,\n }}\n >\n {elementBefore && (\n <span className=\"seeds-input-accessory seeds-input-accessory-before\">\n {elementBefore}\n </span>\n )}\n\n <input\n aria-invalid={!!isInvalid}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-required={required}\n autoComplete={autoCompleteValue}\n autoFocus={autoFocus}\n disabled={disabled}\n readOnly={readOnly}\n id={id}\n name={name}\n placeholder={placeholder}\n type={type}\n required={required}\n value={value}\n maxLength={maxLength}\n onBlur={this.handleBlur}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onKeyDown={this.handleKeyDown}\n onKeyUp={this.handleKeyUp}\n onPaste={this.handlePaste}\n ref={mergeRefs<HTMLInputElement>(innerRef, this.inputRef)}\n data-qa-input={name || \"\"}\n data-qa-input-isdisabled={disabled === true}\n data-qa-input-isrequired={required === true}\n {...qa}\n {...inputProps}\n />\n\n {elementAfter && (\n <span\n className={cn(\n \"seeds-input-accessory\",\n isClearButton(elementAfter)\n ? \"seeds-input-accessory-clear\"\n : \"seeds-input-accessory-after\"\n )}\n >\n {elementAfter}\n </span>\n )}\n </InputContext.Provider>\n </Wrapper>\n );\n }\n}\n\nexport default InputTailwind;\n","import InputHybrid from \"./InputHybrid\";\n\n/**\n * Input component. Automatically routes between the Tailwind/CSS-class\n * implementation (preferred) and the styled-components implementation (for\n * consumers using system props or a styled() extension). The static\n * Input.ClearButton is preserved via the hybrid.\n */\nexport default InputHybrid;\nexport { InputHybrid as Input };\n","import * as React from \"react\";\nimport type {\n TypeSystemCommonProps,\n TypeStyledComponentsCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\ninterface TypeBaseInputProps {\n /** ID of the form element, should match the \"for\" value of the associated label */\n id: string;\n name: string;\n\n /** Label used to describe the input if not used with an accompanying visual label */\n ariaLabel?: string;\n\n /** Attribute used to associate other elements that describe the Input, like an error */\n ariaDescribedby?: string;\n\n /** Label for Input.ClearButton. Required when using Input.ClearButton. */\n clearButtonLabel?: string;\n\n /** Placeholder text for when value is undefined or empty */\n placeholder?: string;\n\n /** Current value of the input */\n value?: string;\n\n /** HTML type attribute */\n type?: \"date\" | \"email\" | \"number\" | \"password\" | \"text\" | \"url\" | \"search\";\n\n /** Set option to display earlier typed values */\n autoComplete?: boolean | \"on\" | \"off\";\n\n /** Will autofocus the element when mounted to the DOM */\n autoFocus?: boolean;\n\n /** HTML disabled attribute */\n disabled?: boolean;\n\n /** HTML readonly attribute */\n readOnly?: boolean;\n\n /** Whether or not the current contents of the input are invalid */\n isInvalid?: boolean;\n\n /** Whether or not the current contents of the input has any warnings */\n hasWarning?: boolean;\n\n /** HTML required attribute */\n required?: boolean;\n\n /** 16x16 element, such as an icon */\n elemBefore?: React.ReactNode;\n\n /** 16x16 element, such as an icon */\n elemAfter?: React.ReactNode;\n\n /** Max length of the input */\n maxLength?: number;\n\n /** Props to spread onto the underlying input element */\n inputProps?: React.ComponentPropsWithoutRef<\"input\">;\n\n /** Used to get a reference to the underlying element */\n innerRef?:\n | {\n current: null | HTMLInputElement;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | ((arg0: React.ElementRef<any> | HTMLElement) => void)\n | React.Ref<HTMLInputElement>;\n onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;\n onChange?: (e: React.ChangeEvent<HTMLInputElement>, value: string) => void;\n onClear?: (e: React.SyntheticEvent<HTMLButtonElement>) => void;\n onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, value: string) => void;\n onKeyUp?: (e: React.KeyboardEvent<HTMLInputElement>, value: string) => void;\n onPaste?: (e: React.ClipboardEvent<HTMLInputElement>, value: string) => void;\n size?: \"large\" | \"small\" | \"default\";\n qa?: object;\n\n /**\n Controls the styles of the input. Primary is our standard input styles and secondary is a borderless input.\n Note that this prop should only be used to alter styles and not functionality.\n */\n appearance?: \"primary\" | \"secondary\";\n}\n\nexport interface TypeInputProps\n extends TypeBaseInputProps,\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<\n React.ComponentPropsWithoutRef<\"div\">,\n keyof TypeBaseInputProps | \"color\"\n > {}\n\nexport interface TypeInputContainerProps {\n size: TypeInputProps[\"size\"];\n appearance: TypeInputProps[\"appearance\"];\n hasBeforeElement: boolean;\n hasAfterElement: boolean;\n invalid?: boolean;\n warning?: boolean;\n disabled?: boolean;\n}\n"],"mappings":";;;;;;;;;;;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BACA,cAAc,YAAY,IACtB,gCACA;AAAA,cACN;AAAA,cAEC;AAAA;AAAA,UACH;AAAA;AAAA;AAAA,IAEJ,GACF;AAAA,EAEJ;AACF;AAEA,IAAO,wBAAQ;;;AJ3PT,IAAAC,sBAAA;AAHN,IAAM,cAAkC,OAAO;AAAA,EAC7C,CAAC,cACC,iDAAe,KAAK,IAClB,6CAAC,iCAAuB,GAAG,OAAO,IAElC,6CAAC,yBAAe,GAAG,OAAO;AAAA,EAE9B,EAAE,YAAY;AAChB;AAEA,YAAY,cAAc;AAE1B,IAAO,sBAAQ;;;AKzBf,IAAO,gBAAQ;;;ACRf,IAAAC,SAAuB;;;APEvB,IAAO,gBAAQ;","names":["React","import_seeds_react_system_props","React","import_seeds_react_icon","styled","props","import_styled_components","styled","Button","Icon","import_jsx_runtime","Icon","React","import_seeds_react_utilities","import_seeds_react_icon","import_jsx_runtime","Icon","import_jsx_runtime","React"]}
|
package/dist/input.css
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds Input component classes
|
|
3
|
+
* Use these instead of writing out individual Tailwind utility classes.
|
|
4
|
+
*
|
|
5
|
+
* Requires @sproutsocial/seeds-react-theme/dist/theme-all.css imported for
|
|
6
|
+
* CSS variable definitions and dark mode support.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* <div class="seeds-input seeds-input-primary"><input /></div>
|
|
10
|
+
* <div class="seeds-input seeds-input-primary seeds-input-lg"><input /></div>
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
@layer components {
|
|
14
|
+
.seeds-input {
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
position: relative;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.seeds-input input {
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
width: 100%;
|
|
22
|
+
border: 1px solid transparent;
|
|
23
|
+
border-radius: var(--radius-500);
|
|
24
|
+
background-color: var(--color-form-bg-base);
|
|
25
|
+
color: var(--color-text-body);
|
|
26
|
+
outline: none;
|
|
27
|
+
transition:
|
|
28
|
+
border-color var(--duration-fast) var(--ease-ease_in),
|
|
29
|
+
box-shadow var(--duration-fast) var(--ease-ease_in);
|
|
30
|
+
font-family: var(--font-family);
|
|
31
|
+
font-weight: var(--font-weight-normal);
|
|
32
|
+
appearance: none;
|
|
33
|
+
/* This matches the overall height of Button and Select */
|
|
34
|
+
margin: 0;
|
|
35
|
+
text-overflow: ellipsis;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
padding: var(--space-300);
|
|
39
|
+
font-size: var(--font-size-200);
|
|
40
|
+
line-height: 16px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* https://stackoverflow.com/questions/14007655/remove-ie10s-clear-field-x-button-on-certain-inputs */
|
|
44
|
+
.seeds-input input::-ms-clear {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.seeds-input input::-webkit-search-cancel-button {
|
|
49
|
+
appearance: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.seeds-input input:focus {
|
|
53
|
+
outline: none;
|
|
54
|
+
box-shadow:
|
|
55
|
+
0 0 0 1px var(--color-button-primary-bg-base),
|
|
56
|
+
0 0 0 4px color-mix(in srgb, var(--color-button-primary-bg-base) 30%, transparent);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Fix for red ring when input is marked required in Firefox */
|
|
60
|
+
.seeds-input input:not(output):not(:focus):-moz-ui-invalid {
|
|
61
|
+
box-shadow: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.seeds-input input::placeholder {
|
|
65
|
+
color: var(--color-form-placeholder-base);
|
|
66
|
+
font-style: italic;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Size modifiers */
|
|
70
|
+
.seeds-input-lg input {
|
|
71
|
+
padding: var(--space-350) var(--space-400);
|
|
72
|
+
font-size: var(--font-size-300);
|
|
73
|
+
line-height: var(--line-height-300);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.seeds-input-sm input {
|
|
77
|
+
padding: var(--space-200);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Accessory spacing */
|
|
81
|
+
.seeds-input-has-before input {
|
|
82
|
+
padding-left: 40px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.seeds-input-has-after input {
|
|
86
|
+
padding-right: 40px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Appearance */
|
|
90
|
+
.seeds-input-primary input {
|
|
91
|
+
border: 1px solid var(--color-form-border-base);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* State borders — declared after appearance so border-color wins */
|
|
95
|
+
.seeds-input-invalid input {
|
|
96
|
+
border-color: var(--color-form-border-error);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.seeds-input-warning input {
|
|
100
|
+
border-color: var(--color-form-border-warning);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Disabled */
|
|
104
|
+
.seeds-input-disabled {
|
|
105
|
+
opacity: 0.4;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.seeds-input-disabled input {
|
|
109
|
+
cursor: not-allowed;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Accessories (before / after / clear button) */
|
|
113
|
+
.seeds-input-accessory {
|
|
114
|
+
position: absolute;
|
|
115
|
+
top: 50%;
|
|
116
|
+
transform: translateY(-50%);
|
|
117
|
+
color: var(--color-icon-base);
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.seeds-input-accessory-before {
|
|
123
|
+
left: var(--space-300);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.seeds-input-accessory-after {
|
|
127
|
+
right: var(--space-300);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.seeds-input-accessory-clear {
|
|
131
|
+
right: 0;
|
|
132
|
+
}
|
|
133
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/seeds-react-input",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.31",
|
|
4
4
|
"description": "Seeds Input",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -10,13 +10,23 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/esm/index.js",
|
|
16
|
+
"require": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./dist/input.css": "./dist/input.css"
|
|
20
|
+
},
|
|
13
21
|
"scripts": {
|
|
14
|
-
"build": "tsup --dts",
|
|
15
|
-
"build:debug": "tsup --dts --metafile",
|
|
22
|
+
"build": "tsup --dts && cp src/input.css dist/input.css",
|
|
23
|
+
"build:debug": "tsup --dts --metafile && cp src/input.css dist/input.css",
|
|
16
24
|
"dev": "tsup --watch --dts",
|
|
17
25
|
"clean": "rm -rf .turbo dist",
|
|
18
26
|
"clean:modules": "rm -rf node_modules",
|
|
19
|
-
"typecheck": "tsc --noEmit"
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"test": "jest",
|
|
29
|
+
"test:watch": "jest --watch --coverage=false"
|
|
20
30
|
},
|
|
21
31
|
"dependencies": {
|
|
22
32
|
"@sproutsocial/seeds-react-utilities": "^4.3.0",
|
|
@@ -30,11 +40,13 @@
|
|
|
30
40
|
},
|
|
31
41
|
"devDependencies": {
|
|
32
42
|
"@sproutsocial/eslint-config-seeds": "*",
|
|
43
|
+
"@types/react": "^18.0.0",
|
|
33
44
|
"react-dom": "^18.0.0",
|
|
34
45
|
"styled-components": "^5.2.3",
|
|
35
46
|
"typescript": "^5.6.2",
|
|
36
47
|
"tsup": "^8.3.4",
|
|
37
|
-
"@sproutsocial/seeds-tsconfig": "*"
|
|
48
|
+
"@sproutsocial/seeds-tsconfig": "*",
|
|
49
|
+
"@sproutsocial/seeds-testing": "*"
|
|
38
50
|
},
|
|
39
51
|
"peerDependencies": {
|
|
40
52
|
"styled-components": "^5.2.3"
|