@salt-ds/lab 1.0.0-alpha.6 → 1.0.0-alpha.7
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-cjs/packages/lab/src/form-field-context/FormFieldContextNext.js.map +1 -1
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldControlWrapper.css.js +9 -0
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldControlWrapper.css.js.map +1 -0
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldControlWrapper.js +16 -0
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldControlWrapper.js.map +1 -0
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldHelperText.css.js +1 -1
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldHelperText.js +24 -9
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldHelperText.js.map +1 -1
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldLabel.css.js +1 -1
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldLabel.js +16 -10
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldLabel.js.map +1 -1
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldNext.css.js +1 -1
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldNext.js +11 -44
- package/dist-cjs/packages/lab/src/form-field-next/FormFieldNext.js.map +1 -1
- package/dist-cjs/packages/lab/src/index.js +6 -2
- package/dist-cjs/packages/lab/src/index.js.map +1 -1
- package/dist-cjs/packages/lab/src/input-next/InputNext.css.js +1 -1
- package/dist-cjs/packages/lab/src/input-next/InputNext.js +46 -36
- package/dist-cjs/packages/lab/src/input-next/InputNext.js.map +1 -1
- package/dist-cjs/packages/lab/src/status-adornment/ErrorAdornment.js +24 -0
- package/dist-cjs/packages/lab/src/status-adornment/ErrorAdornment.js.map +1 -0
- package/dist-cjs/packages/lab/src/status-adornment/StatusAdornment.css.js +9 -0
- package/dist-cjs/packages/lab/src/status-adornment/StatusAdornment.css.js.map +1 -0
- package/dist-cjs/packages/lab/src/status-adornment/StatusAdornment.js +39 -0
- package/dist-cjs/packages/lab/src/status-adornment/StatusAdornment.js.map +1 -0
- package/dist-cjs/packages/lab/src/status-adornment/SuccessAdornment.js +24 -0
- package/dist-cjs/packages/lab/src/status-adornment/SuccessAdornment.js.map +1 -0
- package/dist-cjs/packages/lab/src/status-adornment/WarningAdornment.js +22 -0
- package/dist-cjs/packages/lab/src/status-adornment/WarningAdornment.js.map +1 -0
- package/dist-es/packages/lab/src/form-field-context/FormFieldContextNext.js.map +1 -1
- package/dist-es/packages/lab/src/form-field-next/FormFieldControlWrapper.css.js +7 -0
- package/dist-es/packages/lab/src/form-field-next/FormFieldControlWrapper.css.js.map +1 -0
- package/dist-es/packages/lab/src/form-field-next/FormFieldControlWrapper.js +12 -0
- package/dist-es/packages/lab/src/form-field-next/FormFieldControlWrapper.js.map +1 -0
- package/dist-es/packages/lab/src/form-field-next/FormFieldHelperText.css.js +1 -1
- package/dist-es/packages/lab/src/form-field-next/FormFieldHelperText.js +26 -11
- package/dist-es/packages/lab/src/form-field-next/FormFieldHelperText.js.map +1 -1
- package/dist-es/packages/lab/src/form-field-next/FormFieldLabel.css.js +1 -1
- package/dist-es/packages/lab/src/form-field-next/FormFieldLabel.js +16 -10
- package/dist-es/packages/lab/src/form-field-next/FormFieldLabel.js.map +1 -1
- package/dist-es/packages/lab/src/form-field-next/FormFieldNext.css.js +1 -1
- package/dist-es/packages/lab/src/form-field-next/FormFieldNext.js +12 -45
- package/dist-es/packages/lab/src/form-field-next/FormFieldNext.js.map +1 -1
- package/dist-es/packages/lab/src/index.js +3 -2
- package/dist-es/packages/lab/src/index.js.map +1 -1
- package/dist-es/packages/lab/src/input-next/InputNext.css.js +1 -1
- package/dist-es/packages/lab/src/input-next/InputNext.js +47 -37
- package/dist-es/packages/lab/src/input-next/InputNext.js.map +1 -1
- package/dist-es/packages/lab/src/status-adornment/ErrorAdornment.js +20 -0
- package/dist-es/packages/lab/src/status-adornment/ErrorAdornment.js.map +1 -0
- package/dist-es/packages/lab/src/status-adornment/StatusAdornment.css.js +7 -0
- package/dist-es/packages/lab/src/status-adornment/StatusAdornment.css.js.map +1 -0
- package/dist-es/packages/lab/src/status-adornment/StatusAdornment.js +35 -0
- package/dist-es/packages/lab/src/status-adornment/StatusAdornment.js.map +1 -0
- package/dist-es/packages/lab/src/status-adornment/SuccessAdornment.js +20 -0
- package/dist-es/packages/lab/src/status-adornment/SuccessAdornment.js.map +1 -0
- package/dist-es/packages/lab/src/status-adornment/WarningAdornment.js +18 -0
- package/dist-es/packages/lab/src/status-adornment/WarningAdornment.js.map +1 -0
- package/dist-types/form-field-context/FormFieldContextNext.d.ts +5 -2
- package/dist-types/form-field-next/FormFieldControlWrapper.d.ts +3 -0
- package/dist-types/form-field-next/FormFieldHelperText.d.ts +1 -6
- package/dist-types/form-field-next/FormFieldLabel.d.ts +1 -11
- package/dist-types/form-field-next/FormFieldNext.d.ts +9 -19
- package/dist-types/form-field-next/index.d.ts +1 -0
- package/dist-types/index.d.ts +1 -1
- package/dist-types/input-next/InputNext.d.ts +14 -7
- package/dist-types/status-adornment/ErrorAdornment.d.ts +4 -0
- package/dist-types/status-adornment/StatusAdornment.d.ts +13 -0
- package/dist-types/status-adornment/SuccessAdornment.d.ts +4 -0
- package/dist-types/status-adornment/WarningAdornment.d.ts +4 -0
- package/dist-types/status-adornment/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputNext.js","sources":["../src/input-next/InputNext.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n AriaAttributes,\n ChangeEvent,\n
|
|
1
|
+
{"version":3,"file":"InputNext.js","sources":["../src/input-next/InputNext.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n AriaAttributes,\n ChangeEvent,\n FocusEvent,\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n ReactNode,\n useState,\n} from \"react\";\nimport { makePrefixer, useControlled } from \"@salt-ds/core\";\nimport { useFormFieldPropsNext } from \"../form-field-context\";\nimport { StatusAdornment } from \"../status-adornment\";\n\nimport \"./InputNext.css\";\n\nconst withBaseName = makePrefixer(\"saltInputNext\");\n\n// TODO: Double confirm whether this should be extending DivElement given root is `<div>`.\n// And forwarded ref is not assigned to the root like other components.\nexport interface InputProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"defaultValue\"> {\n /**\n * The value of the `input` element, required for an uncontrolled component.\n */\n defaultValue?: HTMLInputElement[\"defaultValue\"];\n /**\n * If `true`, the component is disabled.\n */\n disabled?: HTMLInputElement[\"disabled\"];\n /**\n * End adornment component\n */\n endAdornment?: ReactNode;\n /**\n * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.\n */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n /**\n * If `true`, the component is read only.\n */\n readOnly?: boolean;\n /**\n * Start adornment component\n */\n startAdornment?: ReactNode;\n /**\n * Validation status.\n */\n validationStatus?: \"error\" | \"warning\" | \"success\";\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value?: HTMLInputElement[\"value\"];\n /**\n * Styling variant. Defaults to \"primary\".\n */\n variant?: \"primary\" | \"secondary\";\n}\n\nfunction mergeA11yProps(\n a11yProps: Partial<\n ReturnType<typeof useFormFieldPropsNext>[\"a11yProps\"]\n > = {},\n inputProps: InputProps[\"inputProps\"] = {},\n misplacedAriaProps: AriaAttributes\n) {\n const ariaLabelledBy = clsx(\n a11yProps[\"aria-labelledby\"],\n inputProps[\"aria-labelledby\"]\n );\n\n return {\n ...misplacedAriaProps,\n ...a11yProps,\n ...inputProps,\n // TODO: look at this - The weird filtering is due to TokenizedInputBase\n \"aria-label\": ariaLabelledBy\n ? Array.from(new Set(ariaLabelledBy.split(\" \"))).join(\" \")\n : undefined,\n };\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n \"aria-activedescendant\": ariaActiveDescendant,\n \"aria-expanded\": ariaExpanded,\n \"aria-owns\": ariaOwns,\n className: classNameProp,\n disabled,\n endAdornment,\n id,\n inputProps: inputPropsProp,\n readOnly: readOnlyProp,\n role,\n startAdornment,\n style,\n value: valueProp,\n // If we leave both value and defaultValue undefined, we will get a React warning on first edit\n // (uncontrolled to controlled warning) from the React input\n defaultValue: defaultValueProp = valueProp === undefined ? \"\" : undefined,\n validationStatus: validationStatusProp,\n variant = \"primary\",\n ...other\n },\n ref\n) {\n const {\n disabled: formFieldDisabled,\n readOnly: formFieldReadOnly,\n validationStatus: formFieldValidationStatus,\n a11yProps,\n } = useFormFieldPropsNext();\n\n const isDisabled = disabled || formFieldDisabled;\n const isReadOnly = readOnlyProp || formFieldReadOnly;\n\n const validationStatus = formFieldValidationStatus ?? validationStatusProp;\n\n const [focused, setFocused] = useState(false);\n\n const misplacedAriaProps = {\n \"aria-activedescendant\": ariaActiveDescendant,\n \"aria-expanded\": ariaExpanded,\n \"aria-owns\": ariaOwns,\n role,\n };\n const inputProps = mergeA11yProps(\n a11yProps,\n inputPropsProp,\n misplacedAriaProps\n );\n\n const { onBlur, onChange, onFocus, ...restInputProps } = inputProps;\n\n const [value, setValue] = useControlled({\n controlled: valueProp,\n default: defaultValueProp,\n name: \"Input\",\n state: \"value\",\n });\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const value = event.target.value;\n setValue(value);\n onChange?.(event);\n };\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n onBlur?.(event);\n setFocused(false);\n };\n\n const handleFocus = (event: FocusEvent<HTMLInputElement>) => {\n onFocus?.(event);\n setFocused(true);\n };\n\n return (\n <div\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"focused\")]: !isDisabled && focused,\n [withBaseName(\"disabled\")]: isDisabled,\n [withBaseName(\"readOnly\")]: isReadOnly,\n [withBaseName(validationStatus || \"\")]: validationStatus,\n [withBaseName(variant)]: variant,\n },\n classNameProp\n )}\n style={style}\n {...other}\n >\n {startAdornment && (\n <div className={withBaseName(\"startAdornmentContainer\")}>\n {startAdornment}\n </div>\n )}\n <input\n id={id}\n className={clsx(\n withBaseName(\"input\"),\n { [withBaseName(\"withAdornment\")]: validationStatus },\n inputProps?.className\n )}\n disabled={isDisabled}\n readOnly={isReadOnly}\n ref={ref}\n value={value}\n tabIndex={isReadOnly || isDisabled ? -1 : 0}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={!isDisabled ? handleFocus : undefined}\n {...restInputProps}\n />\n {!isDisabled && !isReadOnly && validationStatus && (\n <StatusAdornment status={validationStatus} />\n )}\n {endAdornment && (\n <div className={withBaseName(\"endAdornmentContainer\")}>\n {endAdornment}\n </div>\n )}\n </div>\n );\n});\n"],"names":["Input","value"],"mappings":";;;;;;;;;;AAiBA,MAAM,YAAA,GAAe,aAAa,eAAe,CAAA,CAAA;AA4CjD,SAAS,eACP,SAEI,GAAA,IACJ,UAAuC,GAAA,IACvC,kBACA,EAAA;AACA,EAAA,MAAM,cAAiB,GAAA,IAAA;AAAA,IACrB,SAAU,CAAA,iBAAA,CAAA;AAAA,IACV,UAAW,CAAA,iBAAA,CAAA;AAAA,GACb,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,GAAG,kBAAA;AAAA,IACH,GAAG,SAAA;AAAA,IACH,GAAG,UAAA;AAAA,IAEH,YAAc,EAAA,cAAA,GACV,KAAM,CAAA,IAAA,CAAK,IAAI,GAAI,CAAA,cAAA,CAAe,KAAM,CAAA,GAAG,CAAC,CAAC,CAAE,CAAA,IAAA,CAAK,GAAG,CACvD,GAAA,KAAA,CAAA;AAAA,GACN,CAAA;AACF,CAAA;AAEa,MAAA,KAAA,GAAQ,UAAyC,CAAA,SAASA,MACrE,CAAA;AAAA,EACE,uBAAyB,EAAA,oBAAA;AAAA,EACzB,eAAiB,EAAA,YAAA;AAAA,EACjB,WAAa,EAAA,QAAA;AAAA,EACb,SAAW,EAAA,aAAA;AAAA,EACX,QAAA;AAAA,EACA,YAAA;AAAA,EAC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(function ErrorAdornmentIcon2({ children, className, ...rest }, ref) {
|
|
5
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
6
|
+
className,
|
|
7
|
+
...rest,
|
|
8
|
+
role: "img",
|
|
9
|
+
ref,
|
|
10
|
+
viewBox: "0 0 8 8",
|
|
11
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
12
|
+
"fill-rule": "evenodd",
|
|
13
|
+
"clip-rule": "evenodd",
|
|
14
|
+
d: "M4 8C6.20914 8 8 6.20914 8 4C8 1.79086 6.20914 0 4 0C1.79086 0 0 1.79086 0 4C0 6.20914 1.79086 8 4 8Z"
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export { ErrorAdornmentIcon };
|
|
20
|
+
//# sourceMappingURL=ErrorAdornment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorAdornment.js","sources":["../src/status-adornment/ErrorAdornment.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { IconProps } from \"@salt-ds/icons\";\n\nexport type ErrorAdornmentIconProps = IconProps;\n\nexport const ErrorAdornmentIcon = forwardRef<\n SVGSVGElement,\n ErrorAdornmentIconProps\n>(function ErrorAdornmentIcon(\n { children, className, ...rest }: ErrorAdornmentIconProps,\n ref\n) {\n return (\n <svg className={className} {...rest} role=\"img\" ref={ref} viewBox=\"0 0 8 8\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M4 8C6.20914 8 8 6.20914 8 4C8 1.79086 6.20914 0 4 0C1.79086 0 0 1.79086 0 4C0 6.20914 1.79086 8 4 8Z\"\n />\n </svg>\n );\n});\n"],"names":["ErrorAdornmentIcon"],"mappings":";;;AAKa,MAAA,kBAAA,GAAqB,WAGhC,SAASA,mBAAAA,CACT,EAAE,QAAU,EAAA,SAAA,EAAA,GAAc,IAAK,EAAA,EAC/B,GACA,EAAA;AACA,EAAA,uBACG,GAAA,CAAA,KAAA,EAAA;AAAA,IAAI,SAAA;AAAA,IAAuB,GAAG,IAAA;AAAA,IAAM,IAAK,EAAA,KAAA;AAAA,IAAM,GAAA;AAAA,IAAU,OAAQ,EAAA,SAAA;AAAA,IAChE,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA;AAAA,MACC,WAAU,EAAA,SAAA;AAAA,MACV,WAAU,EAAA,SAAA;AAAA,MACV,CAAE,EAAA,uGAAA;AAAA,KACJ,CAAA;AAAA,GACF,CAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import styleInject from '../../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".saltStatusAdornment {\n fill: var(--saltStatusAdornment-color, var(--statusAdornment-color));\n display: inline-block;\n position: relative;\n height: var(--salt-icon-size-status-adornment);\n min-height: var(--salt-icon-size-status-adornment);\n}\n\n.saltStatusAdornment-error {\n --statusAdornment-color: var(--salt-status-error-foreground);\n}\n\n.saltStatusAdornment-warning {\n --statusAdornment-color: var(--salt-status-warning-foreground);\n}\n";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
|
|
6
|
+
export { css_248z as default };
|
|
7
|
+
//# sourceMappingURL=StatusAdornment.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusAdornment.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { makePrefixer } from '@salt-ds/core';
|
|
5
|
+
import { ErrorAdornmentIcon } from './ErrorAdornment.js';
|
|
6
|
+
import { SuccessAdornmentIcon } from './SuccessAdornment.js';
|
|
7
|
+
import { WarningAdornmentIcon } from './WarningAdornment.js';
|
|
8
|
+
import './StatusAdornment.css.js';
|
|
9
|
+
|
|
10
|
+
const icons = {
|
|
11
|
+
error: ErrorAdornmentIcon,
|
|
12
|
+
warning: WarningAdornmentIcon,
|
|
13
|
+
success: SuccessAdornmentIcon
|
|
14
|
+
};
|
|
15
|
+
const statusToAriaLabelMap = {
|
|
16
|
+
error: "error",
|
|
17
|
+
warning: "warning",
|
|
18
|
+
success: "success"
|
|
19
|
+
};
|
|
20
|
+
const withBaseName = makePrefixer("saltStatusAdornment");
|
|
21
|
+
const StatusAdornment = forwardRef(
|
|
22
|
+
function StatusAdornment2({ className, status, ...restProps }, ref) {
|
|
23
|
+
const AdornmentComponent = icons[status];
|
|
24
|
+
const ariaLabel = statusToAriaLabelMap[status];
|
|
25
|
+
return /* @__PURE__ */ jsx(AdornmentComponent, {
|
|
26
|
+
className: clsx(withBaseName(), withBaseName(status), className),
|
|
27
|
+
"aria-label": ariaLabel,
|
|
28
|
+
...restProps,
|
|
29
|
+
ref
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export { StatusAdornment };
|
|
35
|
+
//# sourceMappingURL=StatusAdornment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusAdornment.js","sources":["../src/status-adornment/StatusAdornment.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { forwardRef } from \"react\";\nimport { makePrefixer, ValidationStatus } from \"@salt-ds/core\";\nimport { IconProps } from \"@salt-ds/icons\";\nimport { ErrorAdornmentIcon } from \"./ErrorAdornment\";\nimport { SuccessAdornmentIcon } from \"./SuccessAdornment\";\nimport { WarningAdornmentIcon } from \"./WarningAdornment\";\n\nimport \"./StatusAdornment.css\";\n\nconst icons = {\n error: ErrorAdornmentIcon,\n warning: WarningAdornmentIcon,\n success: SuccessAdornmentIcon,\n};\n\ntype AdornmentValidationStatus = Exclude<ValidationStatus, \"info\">;\n\nexport interface StatusAdornmentProps extends IconProps {\n /**\n * Status adornment to be displayed.\n */\n status: AdornmentValidationStatus;\n}\n\nconst statusToAriaLabelMap: Record<AdornmentValidationStatus, string> = {\n error: \"error\",\n warning: \"warning\",\n success: \"success\",\n};\n\nconst withBaseName = makePrefixer(\"saltStatusAdornment\");\n\nexport const StatusAdornment = forwardRef<SVGSVGElement, StatusAdornmentProps>(\n function StatusAdornment({ className, status, ...restProps }, ref) {\n const AdornmentComponent = icons[status];\n const ariaLabel = statusToAriaLabelMap[status];\n\n return (\n <AdornmentComponent\n className={clsx(withBaseName(), withBaseName(status), className)}\n aria-label={ariaLabel}\n {...restProps}\n ref={ref}\n />\n );\n }\n);\n"],"names":["StatusAdornment"],"mappings":";;;;;;;;;AAUA,MAAM,KAAQ,GAAA;AAAA,EACZ,KAAO,EAAA,kBAAA;AAAA,EACP,OAAS,EAAA,oBAAA;AAAA,EACT,OAAS,EAAA,oBAAA;AACX,CAAA,CAAA;AAWA,MAAM,oBAAkE,GAAA;AAAA,EACtE,KAAO,EAAA,OAAA;AAAA,EACP,OAAS,EAAA,SAAA;AAAA,EACT,OAAS,EAAA,SAAA;AACX,CAAA,CAAA;AAEA,MAAM,YAAA,GAAe,aAAa,qBAAqB,CAAA,CAAA;AAEhD,MAAM,eAAkB,GAAA,UAAA;AAAA,EAC7B,SAASA,gBAAgB,CAAA,EAAE,WAAW,MAAW,EAAA,GAAA,SAAA,IAAa,GAAK,EAAA;AACjE,IAAA,MAAM,qBAAqB,KAAM,CAAA,MAAA,CAAA,CAAA;AACjC,IAAA,MAAM,YAAY,oBAAqB,CAAA,MAAA,CAAA,CAAA;AAEvC,IAAA,uBACG,GAAA,CAAA,kBAAA,EAAA;AAAA,MACC,WAAW,IAAK,CAAA,YAAA,IAAgB,YAAa,CAAA,MAAM,GAAG,SAAS,CAAA;AAAA,MAC/D,YAAY,EAAA,SAAA;AAAA,MACX,GAAG,SAAA;AAAA,MACJ,GAAA;AAAA,KACF,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
|
|
4
|
+
const SuccessAdornmentIcon = forwardRef(function SuccessAdornmentIcon2({ children, className, ...rest }, ref) {
|
|
5
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
6
|
+
className,
|
|
7
|
+
...rest,
|
|
8
|
+
role: "img",
|
|
9
|
+
viewBox: "0 0 10 8",
|
|
10
|
+
ref,
|
|
11
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
12
|
+
"fill-rule": "evenodd",
|
|
13
|
+
"clip-rule": "evenodd",
|
|
14
|
+
d: "M2.92089 5.95735L8.96399 0L10 1.02133L2.92088 8L0 5.1205L1.03602 4.09918L2.92089 5.95735Z"
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export { SuccessAdornmentIcon };
|
|
20
|
+
//# sourceMappingURL=SuccessAdornment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuccessAdornment.js","sources":["../src/status-adornment/SuccessAdornment.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { IconProps } from \"@salt-ds/icons\";\n\nexport type SuccessAdornmentIconProps = IconProps;\n\nexport const SuccessAdornmentIcon = forwardRef<\n SVGSVGElement,\n SuccessAdornmentIconProps\n>(function SuccessAdornmentIcon(\n { children, className, ...rest }: SuccessAdornmentIconProps,\n ref\n) {\n return (\n <svg\n className={className}\n {...rest}\n role=\"img\"\n viewBox=\"0 0 10 8\"\n ref={ref}\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M2.92089 5.95735L8.96399 0L10 1.02133L2.92088 8L0 5.1205L1.03602 4.09918L2.92089 5.95735Z\"\n />\n </svg>\n );\n});\n"],"names":["SuccessAdornmentIcon"],"mappings":";;;AAKa,MAAA,oBAAA,GAAuB,WAGlC,SAASA,qBAAAA,CACT,EAAE,QAAU,EAAA,SAAA,EAAA,GAAc,IAAK,EAAA,EAC/B,GACA,EAAA;AACA,EAAA,uBACG,GAAA,CAAA,KAAA,EAAA;AAAA,IACC,SAAA;AAAA,IACC,GAAG,IAAA;AAAA,IACJ,IAAK,EAAA,KAAA;AAAA,IACL,OAAQ,EAAA,UAAA;AAAA,IACR,GAAA;AAAA,IAEA,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA;AAAA,MACC,WAAU,EAAA,SAAA;AAAA,MACV,WAAU,EAAA,SAAA;AAAA,MACV,CAAE,EAAA,2FAAA;AAAA,KACJ,CAAA;AAAA,GACF,CAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
|
|
4
|
+
const WarningAdornmentIcon = forwardRef(function WarningAdornmentIcon2({ children, className, ...rest }, ref) {
|
|
5
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
6
|
+
className,
|
|
7
|
+
...rest,
|
|
8
|
+
role: "img",
|
|
9
|
+
viewBox: "0 0 9 8",
|
|
10
|
+
ref,
|
|
11
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
12
|
+
d: "M0 8L4.5 0L9 8H0Z"
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export { WarningAdornmentIcon };
|
|
18
|
+
//# sourceMappingURL=WarningAdornment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WarningAdornment.js","sources":["../src/status-adornment/WarningAdornment.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { IconProps } from \"@salt-ds/icons\";\n\nexport type WarningAdornmentIconProps = IconProps;\n\nexport const WarningAdornmentIcon = forwardRef<\n SVGSVGElement,\n WarningAdornmentIconProps\n>(function WarningAdornmentIcon(\n { children, className, ...rest }: WarningAdornmentIconProps,\n ref\n) {\n return (\n <svg className={className} {...rest} role=\"img\" viewBox=\"0 0 9 8\" ref={ref}>\n <path d=\"M0 8L4.5 0L9 8H0Z\" />\n </svg>\n );\n});\n"],"names":["WarningAdornmentIcon"],"mappings":";;;AAKa,MAAA,oBAAA,GAAuB,WAGlC,SAASA,qBAAAA,CACT,EAAE,QAAU,EAAA,SAAA,EAAA,GAAc,IAAK,EAAA,EAC/B,GACA,EAAA;AACA,EAAA,uBACG,GAAA,CAAA,KAAA,EAAA;AAAA,IAAI,SAAA;AAAA,IAAuB,GAAG,IAAA;AAAA,IAAM,IAAK,EAAA,KAAA;AAAA,IAAM,OAAQ,EAAA,SAAA;AAAA,IAAU,GAAA;AAAA,IAChE,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA;AAAA,MAAK,CAAE,EAAA,mBAAA;AAAA,KAAoB,CAAA;AAAA,GAC9B,CAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { a11yValueAriaProps } from "../form-field-next";
|
|
3
3
|
export interface FormFieldContextNextValue {
|
|
4
|
-
a11yProps:
|
|
4
|
+
a11yProps: a11yValueAriaProps;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
readOnly: boolean;
|
|
7
|
+
validationStatus: "error" | "warning" | "success" | undefined;
|
|
5
8
|
}
|
|
6
9
|
export declare const FormFieldContextNext: import("react").Context<FormFieldContextNextValue>;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TextProps } from "@salt-ds/core";
|
|
3
|
-
import { FormFieldProps } from "./FormFieldNext";
|
|
4
3
|
import "./FormFieldHelperText.css";
|
|
5
|
-
export
|
|
6
|
-
helperText: FormFieldProps["helperText"];
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare const FormFieldHelperText: ({ className, disabled, helperText, ...restProps }: FormFieldHelperTextProps) => JSX.Element;
|
|
4
|
+
export declare const FormFieldHelperText: ({ className, children, ...restProps }: Omit<TextProps<"label">, "variant" | "styleAs">) => JSX.Element;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TextProps } from "@salt-ds/core";
|
|
3
3
|
import "./FormFieldLabel.css";
|
|
4
|
-
export
|
|
5
|
-
/**
|
|
6
|
-
* Whether the Form Field is disabled.
|
|
7
|
-
*/
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* The label value for the FormFieldLabel
|
|
11
|
-
*/
|
|
12
|
-
label?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare const FormFieldLabel: ({ className, disabled, label, ...restProps }: FormFieldLabelProps) => JSX.Element;
|
|
4
|
+
export declare const FormFieldLabel: ({ className, children, ...restProps }: Omit<TextProps<"label">, "variant" | "styleAs">) => JSX.Element;
|
|
@@ -7,15 +7,7 @@ export interface FormFieldProps extends HTMLAttributes<HTMLDivElement>, A11yValu
|
|
|
7
7
|
*/
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
helperText?: string;
|
|
13
|
-
/**
|
|
14
|
-
* The label value for the FormField
|
|
15
|
-
*/
|
|
16
|
-
label?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Location the label, values: 'top' (default) or 'left'
|
|
10
|
+
* Location of the label, values: 'top' (default) or 'left'
|
|
19
11
|
*/
|
|
20
12
|
labelPlacement?: FormFieldLabelPlacement;
|
|
21
13
|
/**
|
|
@@ -26,25 +18,23 @@ export interface FormFieldProps extends HTMLAttributes<HTMLDivElement>, A11yValu
|
|
|
26
18
|
* Optional id prop
|
|
27
19
|
*/
|
|
28
20
|
id?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Validation status
|
|
23
|
+
*/
|
|
24
|
+
validationStatus?: "error" | "warning" | "success";
|
|
29
25
|
}
|
|
30
26
|
export interface A11yValueProps {
|
|
31
27
|
/**
|
|
32
|
-
*
|
|
28
|
+
* id for FormFieldHelperText
|
|
33
29
|
*/
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
/** Helper Text */
|
|
36
30
|
helperTextId?: string;
|
|
37
|
-
/** id of the label node */
|
|
38
|
-
labelId?: string;
|
|
39
31
|
/**
|
|
40
|
-
*
|
|
32
|
+
* id for FormFieldLabel
|
|
41
33
|
*/
|
|
42
|
-
|
|
34
|
+
labelId?: string;
|
|
43
35
|
}
|
|
44
|
-
export interface
|
|
36
|
+
export interface a11yValueAriaProps {
|
|
45
37
|
"aria-labelledby": A11yValueProps["labelId"];
|
|
46
38
|
"aria-describedby": A11yValueProps["helperTextId"] | undefined;
|
|
47
|
-
disabled: A11yValueProps["disabled"];
|
|
48
|
-
readOnly: A11yValueProps["readOnly"];
|
|
49
39
|
}
|
|
50
40
|
export declare const FormField: import("react").ForwardRefExoticComponent<FormFieldProps & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export * from "./dropdown";
|
|
|
23
23
|
export * from "./editable-label";
|
|
24
24
|
export * from "./file-drop-zone";
|
|
25
25
|
export * from "./form-field";
|
|
26
|
-
export { FormField as FormFieldNext } from "./form-field-next";
|
|
26
|
+
export { FormField as FormFieldNext, FormFieldHelperText, FormFieldLabel, FormFieldControlWrapper, } from "./form-field-next";
|
|
27
27
|
export * from "./form-field-context";
|
|
28
28
|
export * from "./form-group";
|
|
29
29
|
export * from "./formatted-input";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HTMLAttributes, InputHTMLAttributes, ReactNode } from "react";
|
|
2
2
|
import "./InputNext.css";
|
|
3
|
-
export interface InputProps extends Omit<HTMLAttributes<HTMLDivElement>, "
|
|
3
|
+
export interface InputProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"> {
|
|
4
4
|
/**
|
|
5
5
|
* The value of the `input` element, required for an uncontrolled component.
|
|
6
6
|
*/
|
|
@@ -10,18 +10,25 @@ export interface InputProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChan
|
|
|
10
10
|
*/
|
|
11
11
|
disabled?: HTMLInputElement["disabled"];
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* End adornment component
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
endAdornment?: ReactNode;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
20
20
|
/**
|
|
21
21
|
* If `true`, the component is read only.
|
|
22
22
|
*/
|
|
23
23
|
readOnly?: boolean;
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Start adornment component
|
|
26
|
+
*/
|
|
27
|
+
startAdornment?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Validation status.
|
|
30
|
+
*/
|
|
31
|
+
validationStatus?: "error" | "warning" | "success";
|
|
25
32
|
/**
|
|
26
33
|
* The value of the `input` element, required for a controlled component.
|
|
27
34
|
*/
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconProps } from "@salt-ds/icons";
|
|
3
|
+
export declare type ErrorAdornmentIconProps = IconProps;
|
|
4
|
+
export declare const ErrorAdornmentIcon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ValidationStatus } from "@salt-ds/core";
|
|
3
|
+
import { IconProps } from "@salt-ds/icons";
|
|
4
|
+
import "./StatusAdornment.css";
|
|
5
|
+
declare type AdornmentValidationStatus = Exclude<ValidationStatus, "info">;
|
|
6
|
+
export interface StatusAdornmentProps extends IconProps {
|
|
7
|
+
/**
|
|
8
|
+
* Status adornment to be displayed.
|
|
9
|
+
*/
|
|
10
|
+
status: AdornmentValidationStatus;
|
|
11
|
+
}
|
|
12
|
+
export declare const StatusAdornment: import("react").ForwardRefExoticComponent<StatusAdornmentProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconProps } from "@salt-ds/icons";
|
|
3
|
+
export declare type SuccessAdornmentIconProps = IconProps;
|
|
4
|
+
export declare const SuccessAdornmentIcon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconProps } from "@salt-ds/icons";
|
|
3
|
+
export declare type WarningAdornmentIconProps = IconProps;
|
|
4
|
+
export declare const WarningAdornmentIcon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StatusAdornment";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salt-ds/lab",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist-cjs/packages/lab/src/index.js",
|
|
6
6
|
"sideEffects": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"module": "dist-es/packages/lab/src/index.js",
|
|
24
24
|
"typings": "dist-types/index.d.ts",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@salt-ds/core": "1.
|
|
26
|
+
"@salt-ds/core": "1.7.0",
|
|
27
27
|
"clsx": "^1.2.1",
|
|
28
28
|
"react-window": "^1.8.6",
|
|
29
29
|
"compute-scroll-into-view": "^3.0.0",
|