@veeqo/ui 14.5.0 → 14.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DimensionsInput/DimensionsInput.d.ts +1 -0
- package/dist/components/FeatureBanner/FeatureBanner.cjs +11 -10
- package/dist/components/FeatureBanner/FeatureBanner.cjs.map +1 -1
- package/dist/components/FeatureBanner/FeatureBanner.d.ts +4 -2
- package/dist/components/FeatureBanner/FeatureBanner.js +11 -10
- package/dist/components/FeatureBanner/FeatureBanner.js.map +1 -1
- package/dist/components/FeatureBanner/FeatureBanner.module.scss.cjs +2 -2
- package/dist/components/FeatureBanner/FeatureBanner.module.scss.cjs.map +1 -1
- package/dist/components/FeatureBanner/FeatureBanner.module.scss.js +2 -2
- package/dist/components/FeatureBanner/FeatureBanner.module.scss.js.map +1 -1
- package/dist/components/FeatureBanner/index.d.ts +1 -1
- package/dist/components/FeatureBanner/types.d.ts +10 -8
- package/dist/components/Pagination/styled.d.ts +1 -0
- package/dist/components/PhoneInput/index.d.ts +1 -0
- package/dist/components/Search/Search.d.ts +1 -0
- package/dist/components/Search/styled.d.ts +1 -0
- package/dist/components/Select/Select.cjs +20 -3
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.d.ts +11 -0
- package/dist/components/Select/Select.js +20 -3
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/Select.module.scss.cjs +9 -0
- package/dist/components/Select/Select.module.scss.cjs.map +1 -0
- package/dist/components/Select/Select.module.scss.js +7 -0
- package/dist/components/Select/Select.module.scss.js.map +1 -0
- package/dist/components/TextField/TextField.cjs +23 -6
- package/dist/components/TextField/TextField.cjs.map +1 -1
- package/dist/components/TextField/TextField.d.ts +1 -0
- package/dist/components/TextField/TextField.js +23 -6
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField/TextField.module.scss.cjs +9 -0
- package/dist/components/TextField/TextField.module.scss.cjs.map +1 -0
- package/dist/components/TextField/TextField.module.scss.js +7 -0
- package/dist/components/TextField/TextField.module.scss.js.map +1 -0
- package/dist/components/TextField/index.d.ts +1 -0
- package/dist/components/TextField/types.d.ts +12 -1
- package/dist/hoc/withLabels/withLabels.cjs +3 -3
- package/dist/hoc/withLabels/withLabels.cjs.map +1 -1
- package/dist/hoc/withLabels/withLabels.js +3 -3
- package/dist/hoc/withLabels/withLabels.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/Select/styled.cjs +0 -16
- package/dist/components/Select/styled.cjs.map +0 -1
- package/dist/components/Select/styled.d.ts +0 -2
- package/dist/components/Select/styled.js +0 -9
- package/dist/components/Select/styled.js.map +0 -1
- package/dist/components/TextField/styled.cjs +0 -16
- package/dist/components/TextField/styled.cjs.map +0 -1
- package/dist/components/TextField/styled.d.ts +0 -2
- package/dist/components/TextField/styled.js +0 -9
- package/dist/components/TextField/styled.js.map +0 -1
|
@@ -296,6 +296,7 @@ export declare const DimensionsInput: React.ForwardRefExoticComponent<{
|
|
|
296
296
|
type?: import("../TextField").TextFieldType | undefined;
|
|
297
297
|
onChange?: ((value: string) => void) | undefined;
|
|
298
298
|
hasError?: boolean | undefined;
|
|
299
|
+
disabledMessage?: React.ReactNode;
|
|
299
300
|
size?: "base" | "sm" | undefined;
|
|
300
301
|
multiline?: boolean | undefined;
|
|
301
302
|
} & {
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
+
var withTokens = require('../../hoc/withTokens/withTokens.cjs');
|
|
5
|
+
var CrossIcon = require('../../icons/design-system/components/CrossIcon.cjs');
|
|
4
6
|
var buildClassnames = require('../../utils/buildClassnames.cjs');
|
|
5
7
|
require('uid/secure');
|
|
6
|
-
var
|
|
7
|
-
var FlexRow = require('../Flex/FlexRow/FlexRow.cjs');
|
|
8
|
+
var Action = require('../Action/Action.cjs');
|
|
8
9
|
var FlexCol = require('../Flex/FlexCol/FlexCol.cjs');
|
|
10
|
+
var FlexRow = require('../Flex/FlexRow/FlexRow.cjs');
|
|
9
11
|
var Text = require('../Text/Text.cjs');
|
|
10
|
-
var Button = require('../Button/Button.cjs');
|
|
11
|
-
var CrossIcon = require('../../icons/design-system/components/CrossIcon.cjs');
|
|
12
12
|
var FeatureBanner_module = require('./FeatureBanner.module.scss.cjs');
|
|
13
13
|
|
|
14
14
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
15
|
|
|
16
16
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
17
17
|
|
|
18
|
-
const FeatureBannerBase = ({ variant = 'primary', size = '
|
|
19
|
-
return (React__default.default.createElement(FlexRow.FlexRow, { flexWrap: "nowrap", alignItems: "flex-start",
|
|
18
|
+
const FeatureBannerBase = ({ variant = 'primary', size = 'base', direction = 'vertical', title, contentSlot, iconSlot, actions, onClose, className, ...divProps }) => {
|
|
19
|
+
return (React__default.default.createElement(FlexRow.FlexRow, { flexWrap: "nowrap", alignItems: "flex-start", gap: "none", justifyContent: "space-between", className: buildClassnames.buildClassnames([
|
|
20
20
|
FeatureBanner_module.featureBanner,
|
|
21
21
|
FeatureBanner_module[`${size}-size`],
|
|
22
22
|
FeatureBanner_module[`${variant}-variant`],
|
|
23
|
+
FeatureBanner_module[`${direction}-layout`],
|
|
23
24
|
className,
|
|
24
25
|
]), role: "region", "aria-label": title, ...divProps },
|
|
25
26
|
iconSlot && React__default.default.createElement("div", { className: FeatureBanner_module.iconBackground }, iconSlot),
|
|
26
|
-
React__default.default.createElement(FlexCol.FlexCol, { gap:
|
|
27
|
+
React__default.default.createElement(FlexCol.FlexCol, { gap: size === 'base' ? 'base' : '3', flexGrow: "1", className: FeatureBanner_module[direction] },
|
|
27
28
|
React__default.default.createElement(FlexCol.FlexCol, { gap: "xs" },
|
|
28
29
|
React__default.default.createElement(Text.Text, { variant: "headingSmall" }, title),
|
|
29
|
-
contentSlot && React__default.default.createElement(FlexCol.FlexCol, { gap:
|
|
30
|
-
actions && actions.length > 0 && (React__default.default.createElement(FlexRow.FlexRow, { flexWrap: "nowrap", gap: "sm" }, actions.map(({ label, variant: actionVariant = 'default', ...actionProps }) => (React__default.default.createElement(
|
|
31
|
-
onClose && (React__default.default.createElement(
|
|
30
|
+
contentSlot && React__default.default.createElement(FlexCol.FlexCol, { gap: "sm" }, contentSlot)),
|
|
31
|
+
actions && actions.length > 0 && (React__default.default.createElement(FlexRow.FlexRow, { flexWrap: "nowrap", gap: "sm", className: FeatureBanner_module[`actions-${direction}`] }, actions.map(({ label, variant: actionVariant = 'default', ...actionProps }) => (React__default.default.createElement(Action.Action, { key: label, size: "sm", variant: actionVariant, ...actionProps }, label)))))),
|
|
32
|
+
onClose && (React__default.default.createElement(Action.Action, { variant: "flat", size: "sm", iconSlot: React__default.default.createElement(CrossIcon.ReactComponent, null), onClick: onClose, "aria-label": "Close banner", className: direction === 'horizontal' ? FeatureBanner_module.centerButton : undefined }))));
|
|
32
33
|
};
|
|
33
34
|
const FeatureBanner = withTokens.withTokens(FeatureBannerBase, 'default');
|
|
34
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureBanner.cjs","sources":["../../../src/components/FeatureBanner/FeatureBanner.tsx"],"sourcesContent":["import React from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"FeatureBanner.cjs","sources":["../../../src/components/FeatureBanner/FeatureBanner.tsx"],"sourcesContent":["import React from 'react';\n\nimport { withTokens } from '../../hoc/withTokens';\nimport { CrossIcon } from '../../icons';\nimport { buildClassnames } from '../../utils';\nimport { Action } from '../Action';\nimport { FlexCol } from '../Flex/FlexCol';\nimport { FlexRow } from '../Flex/FlexRow';\nimport { Text } from '../Text';\nimport { FeatureBannerProps } from './types';\n\nimport styles from './FeatureBanner.module.scss';\n\nconst FeatureBannerBase = ({\n variant = 'primary',\n size = 'base',\n direction = 'vertical',\n title,\n contentSlot,\n iconSlot,\n actions,\n onClose,\n className,\n ...divProps\n}: FeatureBannerProps) => {\n return (\n <FlexRow\n flexWrap=\"nowrap\"\n alignItems=\"flex-start\"\n gap=\"none\"\n justifyContent=\"space-between\"\n className={buildClassnames([\n styles.featureBanner,\n styles[`${size}-size`],\n styles[`${variant}-variant`],\n styles[`${direction}-layout`],\n className,\n ])}\n role=\"region\"\n aria-label={title}\n {...divProps}\n >\n {iconSlot && <div className={styles.iconBackground}>{iconSlot}</div>}\n\n <FlexCol gap={size === 'base' ? 'base' : '3'} flexGrow=\"1\" className={styles[direction]}>\n <FlexCol gap=\"xs\">\n <Text variant=\"headingSmall\">{title}</Text>\n\n {contentSlot && <FlexCol gap=\"sm\">{contentSlot}</FlexCol>}\n </FlexCol>\n\n {actions && actions.length > 0 && (\n <FlexRow flexWrap=\"nowrap\" gap=\"sm\" className={styles[`actions-${direction}`]}>\n {actions.map(({ label, variant: actionVariant = 'default', ...actionProps }) => (\n <Action key={label} size=\"sm\" variant={actionVariant} {...actionProps}>\n {label}\n </Action>\n ))}\n </FlexRow>\n )}\n </FlexCol>\n\n {onClose && (\n <Action\n variant=\"flat\"\n size=\"sm\"\n iconSlot={<CrossIcon />}\n onClick={onClose}\n aria-label=\"Close banner\"\n className={direction === 'horizontal' ? styles.centerButton : undefined}\n />\n )}\n </FlexRow>\n );\n};\n\nexport const FeatureBanner = withTokens(FeatureBannerBase, 'default');\n"],"names":["React","FlexRow","buildClassnames","styles","FlexCol","Text","Action","CrossIcon","withTokens"],"mappings":";;;;;;;;;;;;;;;;;AAaA,MAAM,iBAAiB,GAAG,CAAC,EACzB,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,MAAM,EACb,SAAS,GAAG,UAAU,EACtB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,GAAG,QAAQ,EACQ,KAAI;IACvB,QACEA,qCAACC,eAAO,EAAA,EACN,QAAQ,EAAC,QAAQ,EACjB,UAAU,EAAC,YAAY,EACvB,GAAG,EAAC,MAAM,EAC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AE,aAAa,GAAG,SAAS,EAAE,GAAG,WAAW,EAAE,MACzEH,sBAAA,CAAA,aAAA,CAACM,aAAM,EAAA,EAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,aAAa,EAAA,GAAM,WAAW,EAAA,EAClE,KAAK,CACC,CACV,CAAC,CACM,CACX,CACO;QAET,OAAO,KACNN,sBAAA,CAAA,aAAA,CAACM,aAAM,IACL,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,IAAI,EACT,QAAQ,EAAEN,sBAAA,CAAA,aAAA,CAACO,wBAAS,EAAA,IAAA,CAAG,EACvB,OAAO,EAAE,OAAO,gBACL,cAAc,EACzB,SAAS,EAAE,SAAS,KAAK,YAAY,GAAGJ,oBAAM,CAAC,YAAY,GAAG,SAAS,GACvE,CACH,CACO;AAEd,CAAC;AAEM,MAAM,aAAa,GAAGK,qBAAU,CAAC,iBAAiB,EAAE,SAAS;;;;"}
|
|
@@ -2,10 +2,12 @@ import React from 'react';
|
|
|
2
2
|
export declare const FeatureBanner: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & import("../../hoc/withTokens").WithTokensProps & {
|
|
3
3
|
variant?: import("./types").FeatureBannerVariant | undefined;
|
|
4
4
|
size?: import("./types").FeatureBannerSize | undefined;
|
|
5
|
-
|
|
5
|
+
direction?: import("./types").FeatureBannerDirection | undefined;
|
|
6
6
|
title: string;
|
|
7
7
|
contentSlot?: React.ReactNode;
|
|
8
8
|
iconSlot?: React.ReactNode;
|
|
9
|
-
actions?: import("
|
|
9
|
+
actions?: ((Omit<import("../Action").ActionProps<"button">, "children" | "size"> | Omit<import("../Action").ActionProps<"a">, "children" | "size">) & {
|
|
10
|
+
label: string;
|
|
11
|
+
})[] | undefined;
|
|
10
12
|
onClose?: (() => void) | undefined;
|
|
11
13
|
} & React.RefAttributes<never>>;
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
+
import { withTokens } from '../../hoc/withTokens/withTokens.js';
|
|
3
|
+
import { ReactComponent as CrossIcon } from '../../icons/design-system/components/CrossIcon.js';
|
|
2
4
|
import { buildClassnames } from '../../utils/buildClassnames.js';
|
|
3
5
|
import 'uid/secure';
|
|
4
|
-
import {
|
|
5
|
-
import { FlexRow } from '../Flex/FlexRow/FlexRow.js';
|
|
6
|
+
import { Action } from '../Action/Action.js';
|
|
6
7
|
import { FlexCol } from '../Flex/FlexCol/FlexCol.js';
|
|
8
|
+
import { FlexRow } from '../Flex/FlexRow/FlexRow.js';
|
|
7
9
|
import { Text } from '../Text/Text.js';
|
|
8
|
-
import { Button } from '../Button/Button.js';
|
|
9
|
-
import { ReactComponent as CrossIcon } from '../../icons/design-system/components/CrossIcon.js';
|
|
10
10
|
import styles from './FeatureBanner.module.scss.js';
|
|
11
11
|
|
|
12
|
-
const FeatureBannerBase = ({ variant = 'primary', size = '
|
|
13
|
-
return (React__default.createElement(FlexRow, { flexWrap: "nowrap", alignItems: "flex-start",
|
|
12
|
+
const FeatureBannerBase = ({ variant = 'primary', size = 'base', direction = 'vertical', title, contentSlot, iconSlot, actions, onClose, className, ...divProps }) => {
|
|
13
|
+
return (React__default.createElement(FlexRow, { flexWrap: "nowrap", alignItems: "flex-start", gap: "none", justifyContent: "space-between", className: buildClassnames([
|
|
14
14
|
styles.featureBanner,
|
|
15
15
|
styles[`${size}-size`],
|
|
16
16
|
styles[`${variant}-variant`],
|
|
17
|
+
styles[`${direction}-layout`],
|
|
17
18
|
className,
|
|
18
19
|
]), role: "region", "aria-label": title, ...divProps },
|
|
19
20
|
iconSlot && React__default.createElement("div", { className: styles.iconBackground }, iconSlot),
|
|
20
|
-
React__default.createElement(FlexCol, { gap:
|
|
21
|
+
React__default.createElement(FlexCol, { gap: size === 'base' ? 'base' : '3', flexGrow: "1", className: styles[direction] },
|
|
21
22
|
React__default.createElement(FlexCol, { gap: "xs" },
|
|
22
23
|
React__default.createElement(Text, { variant: "headingSmall" }, title),
|
|
23
|
-
contentSlot && React__default.createElement(FlexCol, { gap:
|
|
24
|
-
actions && actions.length > 0 && (React__default.createElement(FlexRow, { flexWrap: "nowrap", gap: "sm" }, actions.map(({ label, variant: actionVariant = 'default', ...actionProps }) => (React__default.createElement(
|
|
25
|
-
onClose && (React__default.createElement(
|
|
24
|
+
contentSlot && React__default.createElement(FlexCol, { gap: "sm" }, contentSlot)),
|
|
25
|
+
actions && actions.length > 0 && (React__default.createElement(FlexRow, { flexWrap: "nowrap", gap: "sm", className: styles[`actions-${direction}`] }, actions.map(({ label, variant: actionVariant = 'default', ...actionProps }) => (React__default.createElement(Action, { key: label, size: "sm", variant: actionVariant, ...actionProps }, label)))))),
|
|
26
|
+
onClose && (React__default.createElement(Action, { variant: "flat", size: "sm", iconSlot: React__default.createElement(CrossIcon, null), onClick: onClose, "aria-label": "Close banner", className: direction === 'horizontal' ? styles.centerButton : undefined }))));
|
|
26
27
|
};
|
|
27
28
|
const FeatureBanner = withTokens(FeatureBannerBase, 'default');
|
|
28
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureBanner.js","sources":["../../../src/components/FeatureBanner/FeatureBanner.tsx"],"sourcesContent":["import React from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"FeatureBanner.js","sources":["../../../src/components/FeatureBanner/FeatureBanner.tsx"],"sourcesContent":["import React from 'react';\n\nimport { withTokens } from '../../hoc/withTokens';\nimport { CrossIcon } from '../../icons';\nimport { buildClassnames } from '../../utils';\nimport { Action } from '../Action';\nimport { FlexCol } from '../Flex/FlexCol';\nimport { FlexRow } from '../Flex/FlexRow';\nimport { Text } from '../Text';\nimport { FeatureBannerProps } from './types';\n\nimport styles from './FeatureBanner.module.scss';\n\nconst FeatureBannerBase = ({\n variant = 'primary',\n size = 'base',\n direction = 'vertical',\n title,\n contentSlot,\n iconSlot,\n actions,\n onClose,\n className,\n ...divProps\n}: FeatureBannerProps) => {\n return (\n <FlexRow\n flexWrap=\"nowrap\"\n alignItems=\"flex-start\"\n gap=\"none\"\n justifyContent=\"space-between\"\n className={buildClassnames([\n styles.featureBanner,\n styles[`${size}-size`],\n styles[`${variant}-variant`],\n styles[`${direction}-layout`],\n className,\n ])}\n role=\"region\"\n aria-label={title}\n {...divProps}\n >\n {iconSlot && <div className={styles.iconBackground}>{iconSlot}</div>}\n\n <FlexCol gap={size === 'base' ? 'base' : '3'} flexGrow=\"1\" className={styles[direction]}>\n <FlexCol gap=\"xs\">\n <Text variant=\"headingSmall\">{title}</Text>\n\n {contentSlot && <FlexCol gap=\"sm\">{contentSlot}</FlexCol>}\n </FlexCol>\n\n {actions && actions.length > 0 && (\n <FlexRow flexWrap=\"nowrap\" gap=\"sm\" className={styles[`actions-${direction}`]}>\n {actions.map(({ label, variant: actionVariant = 'default', ...actionProps }) => (\n <Action key={label} size=\"sm\" variant={actionVariant} {...actionProps}>\n {label}\n </Action>\n ))}\n </FlexRow>\n )}\n </FlexCol>\n\n {onClose && (\n <Action\n variant=\"flat\"\n size=\"sm\"\n iconSlot={<CrossIcon />}\n onClick={onClose}\n aria-label=\"Close banner\"\n className={direction === 'horizontal' ? styles.centerButton : undefined}\n />\n )}\n </FlexRow>\n );\n};\n\nexport const FeatureBanner = withTokens(FeatureBannerBase, 'default');\n"],"names":["React"],"mappings":";;;;;;;;;;;AAaA,MAAM,iBAAiB,GAAG,CAAC,EACzB,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,MAAM,EACb,SAAS,GAAG,UAAU,EACtB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,GAAG,QAAQ,EACQ,KAAI;IACvB,QACEA,6BAAC,OAAO,EAAA,EACN,QAAQ,EAAC,QAAQ,EACjB,UAAU,EAAC,YAAY,EACvB,GAAG,EAAC,MAAM,EACV,cAAc,EAAC,eAAe,EAC9B,SAAS,EAAE,eAAe,CAAC;AACzB,YAAA,MAAM,CAAC,aAAa;AACpB,YAAA,M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AI,EAAC,IAAI,EAAC,OAAO,EAAE,aAAa,EAAA,GAAM,WAAW,EAAA,EAClE,KAAK,CACC,CACV,CAAC,CACM,CACX,CACO;QAET,OAAO,KACNA,cAAA,CAAA,aAAA,CAAC,MAAM,IACL,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,IAAI,EACT,QAAQ,EAAEA,cAAA,CAAA,aAAA,CAAC,SAAS,EAAA,IAAA,CAAG,EACvB,OAAO,EAAE,OAAO,gBACL,cAAc,EACzB,SAAS,EAAE,SAAS,KAAK,YAAY,GAAG,MAAM,CAAC,YAAY,GAAG,SAAS,GACvE,CACH,CACO;AAEd,CAAC;AAEM,MAAM,aAAa,GAAG,UAAU,CAAC,iBAAiB,EAAE,SAAS;;;;"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
4
|
|
|
5
|
-
___$insertStyle("
|
|
6
|
-
var styles = {"
|
|
5
|
+
___$insertStyle("._base-size_i33v4_1 {\n --banner-padding: var(--sizes-base);\n --banner-gap: var(--sizes-base);\n --horizontal-gap: var(--sizes-none);\n --horizontal-padding-left: var(--sizes-base);\n --horizontal-action-padding: var(--sizes-sm);\n --icon-size: var(--sizes-base);\n}\n\n._sm-size_i33v4_10 {\n --banner-padding: var(--sizes-3);\n --banner-gap: var(--sizes-3);\n --horizontal-gap: var(--sizes-none);\n --horizontal-padding-left: var(--sizes-3);\n --horizontal-action-padding: var(--sizes-sm);\n --icon-size: var(--sizes-3);\n}\n\n._xs-size_i33v4_19 {\n --banner-padding: var(--sizes-sm);\n --banner-gap: var(--sizes-2);\n --horizontal-gap: var(--sizes-2);\n --horizontal-padding-left: var(--sizes-none);\n --horizontal-action-padding: var(--sizes-none);\n --icon-size: var(--sizes-3);\n}\n\n._primary-variant_i33v4_28 {\n --feature-banner-bg: var(--theme-surface);\n --icon-bg-color: var(--theme-primary);\n --icon-color: var(--theme-on-primary);\n}\n\n._secondary-variant_i33v4_34 {\n --feature-banner-bg: var(--theme-surface-secondary);\n --icon-bg-color: var(--theme-surface);\n --icon-color: var(--theme-primary);\n}\n\n._featureBanner_i33v4_40 {\n border: var(--sizes-line) solid var(--theme-surface-alt);\n border-radius: var(--radius-base);\n background-color: var(--feature-banner-bg);\n padding: var(--banner-padding);\n}\n._featureBanner_i33v4_40._vertical-layout_i33v4_46 {\n gap: var(--banner-gap);\n}\n._featureBanner_i33v4_40._horizontal-layout_i33v4_49 {\n gap: var(--horizontal-gap);\n}\n\n._featureBanner_i33v4_40 ._vertical_i33v4_46 {\n flex-direction: column;\n align-items: flex-start;\n}\n\n._featureBanner_i33v4_40 ._horizontal_i33v4_49 {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding-left: var(--horizontal-padding-left);\n}\n\n._actions-vertical_i33v4_65 {\n padding: var(--sizes-none);\n}\n\n._actions-horizontal_i33v4_69 {\n padding: var(--horizontal-action-padding);\n}\n\n._iconBackground_i33v4_73 {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n padding: var(--sizes-xs);\n border-radius: var(--radius-base);\n background-color: var(--icon-bg-color);\n}\n._iconBackground_i33v4_73 svg {\n width: var(--icon-size);\n height: var(--icon-size);\n color: var(--icon-color);\n}\n\n._centerButton_i33v4_88 {\n align-self: center;\n}");
|
|
6
|
+
var styles = {"base-size":"_base-size_i33v4_1","sm-size":"_sm-size_i33v4_10","xs-size":"_xs-size_i33v4_19","primary-variant":"_primary-variant_i33v4_28","secondary-variant":"_secondary-variant_i33v4_34","featureBanner":"_featureBanner_i33v4_40","vertical-layout":"_vertical-layout_i33v4_46","horizontal-layout":"_horizontal-layout_i33v4_49","vertical":"_vertical_i33v4_46","horizontal":"_horizontal_i33v4_49","actions-vertical":"_actions-vertical_i33v4_65","actions-horizontal":"_actions-horizontal_i33v4_69","iconBackground":"_iconBackground_i33v4_73","centerButton":"_centerButton_i33v4_88"};
|
|
7
7
|
|
|
8
8
|
module.exports = styles;
|
|
9
9
|
//# sourceMappingURL=FeatureBanner.module.scss.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureBanner.module.scss.cjs","sources":["../../../src/components/FeatureBanner/FeatureBanner.module.scss"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"FeatureBanner.module.scss.cjs","sources":["../../../src/components/FeatureBanner/FeatureBanner.module.scss"],"sourcesContent":[".base-size {\n --banner-padding: var(--sizes-base);\n --banner-gap: var(--sizes-base);\n --horizontal-gap: var(--sizes-none);\n --horizontal-padding-left: var(--sizes-base);\n --horizontal-action-padding: var(--sizes-sm);\n --icon-size: var(--sizes-base);\n}\n\n.sm-size {\n --banner-padding: var(--sizes-3);\n --banner-gap: var(--sizes-3);\n --horizontal-gap: var(--sizes-none);\n --horizontal-padding-left: var(--sizes-3);\n --horizontal-action-padding: var(--sizes-sm);\n --icon-size: var(--sizes-3);\n}\n\n.xs-size {\n --banner-padding: var(--sizes-sm);\n --banner-gap: var(--sizes-2);\n --horizontal-gap: var(--sizes-2);\n --horizontal-padding-left: var(--sizes-none);\n --horizontal-action-padding: var(--sizes-none);\n --icon-size: var(--sizes-3);\n}\n\n.primary-variant {\n --feature-banner-bg: var(--theme-surface);\n --icon-bg-color: var(--theme-primary);\n --icon-color: var(--theme-on-primary);\n}\n\n.secondary-variant {\n --feature-banner-bg: var(--theme-surface-secondary);\n --icon-bg-color: var(--theme-surface);\n --icon-color: var(--theme-primary);\n}\n\n.featureBanner {\n border: var(--sizes-line) solid var(--theme-surface-alt);\n border-radius: var(--radius-base);\n background-color: var(--feature-banner-bg);\n padding: var(--banner-padding);\n\n &.vertical-layout {\n gap: var(--banner-gap);\n }\n\n &.horizontal-layout {\n gap: var(--horizontal-gap);\n }\n}\n\n.featureBanner .vertical {\n flex-direction: column;\n align-items: flex-start;\n}\n\n.featureBanner .horizontal {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding-left: var(--horizontal-padding-left);\n}\n\n.actions-vertical {\n padding: var(--sizes-none);\n}\n\n.actions-horizontal {\n padding: var(--horizontal-action-padding);\n}\n\n.iconBackground {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n padding: var(--sizes-xs);\n border-radius: var(--radius-base);\n background-color: var(--icon-bg-color);\n\n & svg {\n width: var(--icon-size);\n height: var(--icon-size);\n color: var(--icon-color);\n }\n}\n\n.centerButton {\n align-self: center;\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,q1EAAA;AACA,aAAA,CAAA,WAAA,CAAA,oBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,iBAAA,CAAA,2BAAA,CAAA,mBAAA,CAAA,6BAAA,CAAA,eAAA,CAAA,yBAAA,CAAA,iBAAA,CAAA,2BAAA,CAAA,mBAAA,CAAA,6BAAA,CAAA,UAAA,CAAA,oBAAA,CAAA,YAAA,CAAA,sBAAA,CAAA,kBAAA,CAAA,4BAAA,CAAA,oBAAA,CAAA,8BAAA,CAAA,gBAAA,CAAA,0BAAA,CAAA,cAAA,CAAA,wBAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import insertStyle from '../../_virtual/____insertStyle.js';
|
|
2
2
|
|
|
3
|
-
insertStyle("
|
|
4
|
-
var styles = {"
|
|
3
|
+
insertStyle("._base-size_i33v4_1 {\n --banner-padding: var(--sizes-base);\n --banner-gap: var(--sizes-base);\n --horizontal-gap: var(--sizes-none);\n --horizontal-padding-left: var(--sizes-base);\n --horizontal-action-padding: var(--sizes-sm);\n --icon-size: var(--sizes-base);\n}\n\n._sm-size_i33v4_10 {\n --banner-padding: var(--sizes-3);\n --banner-gap: var(--sizes-3);\n --horizontal-gap: var(--sizes-none);\n --horizontal-padding-left: var(--sizes-3);\n --horizontal-action-padding: var(--sizes-sm);\n --icon-size: var(--sizes-3);\n}\n\n._xs-size_i33v4_19 {\n --banner-padding: var(--sizes-sm);\n --banner-gap: var(--sizes-2);\n --horizontal-gap: var(--sizes-2);\n --horizontal-padding-left: var(--sizes-none);\n --horizontal-action-padding: var(--sizes-none);\n --icon-size: var(--sizes-3);\n}\n\n._primary-variant_i33v4_28 {\n --feature-banner-bg: var(--theme-surface);\n --icon-bg-color: var(--theme-primary);\n --icon-color: var(--theme-on-primary);\n}\n\n._secondary-variant_i33v4_34 {\n --feature-banner-bg: var(--theme-surface-secondary);\n --icon-bg-color: var(--theme-surface);\n --icon-color: var(--theme-primary);\n}\n\n._featureBanner_i33v4_40 {\n border: var(--sizes-line) solid var(--theme-surface-alt);\n border-radius: var(--radius-base);\n background-color: var(--feature-banner-bg);\n padding: var(--banner-padding);\n}\n._featureBanner_i33v4_40._vertical-layout_i33v4_46 {\n gap: var(--banner-gap);\n}\n._featureBanner_i33v4_40._horizontal-layout_i33v4_49 {\n gap: var(--horizontal-gap);\n}\n\n._featureBanner_i33v4_40 ._vertical_i33v4_46 {\n flex-direction: column;\n align-items: flex-start;\n}\n\n._featureBanner_i33v4_40 ._horizontal_i33v4_49 {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding-left: var(--horizontal-padding-left);\n}\n\n._actions-vertical_i33v4_65 {\n padding: var(--sizes-none);\n}\n\n._actions-horizontal_i33v4_69 {\n padding: var(--horizontal-action-padding);\n}\n\n._iconBackground_i33v4_73 {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n padding: var(--sizes-xs);\n border-radius: var(--radius-base);\n background-color: var(--icon-bg-color);\n}\n._iconBackground_i33v4_73 svg {\n width: var(--icon-size);\n height: var(--icon-size);\n color: var(--icon-color);\n}\n\n._centerButton_i33v4_88 {\n align-self: center;\n}");
|
|
4
|
+
var styles = {"base-size":"_base-size_i33v4_1","sm-size":"_sm-size_i33v4_10","xs-size":"_xs-size_i33v4_19","primary-variant":"_primary-variant_i33v4_28","secondary-variant":"_secondary-variant_i33v4_34","featureBanner":"_featureBanner_i33v4_40","vertical-layout":"_vertical-layout_i33v4_46","horizontal-layout":"_horizontal-layout_i33v4_49","vertical":"_vertical_i33v4_46","horizontal":"_horizontal_i33v4_49","actions-vertical":"_actions-vertical_i33v4_65","actions-horizontal":"_actions-horizontal_i33v4_69","iconBackground":"_iconBackground_i33v4_73","centerButton":"_centerButton_i33v4_88"};
|
|
5
5
|
|
|
6
6
|
export { styles as default };
|
|
7
7
|
//# sourceMappingURL=FeatureBanner.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureBanner.module.scss.js","sources":["../../../src/components/FeatureBanner/FeatureBanner.module.scss"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"FeatureBanner.module.scss.js","sources":["../../../src/components/FeatureBanner/FeatureBanner.module.scss"],"sourcesContent":[".base-size {\n --banner-padding: var(--sizes-base);\n --banner-gap: var(--sizes-base);\n --horizontal-gap: var(--sizes-none);\n --horizontal-padding-left: var(--sizes-base);\n --horizontal-action-padding: var(--sizes-sm);\n --icon-size: var(--sizes-base);\n}\n\n.sm-size {\n --banner-padding: var(--sizes-3);\n --banner-gap: var(--sizes-3);\n --horizontal-gap: var(--sizes-none);\n --horizontal-padding-left: var(--sizes-3);\n --horizontal-action-padding: var(--sizes-sm);\n --icon-size: var(--sizes-3);\n}\n\n.xs-size {\n --banner-padding: var(--sizes-sm);\n --banner-gap: var(--sizes-2);\n --horizontal-gap: var(--sizes-2);\n --horizontal-padding-left: var(--sizes-none);\n --horizontal-action-padding: var(--sizes-none);\n --icon-size: var(--sizes-3);\n}\n\n.primary-variant {\n --feature-banner-bg: var(--theme-surface);\n --icon-bg-color: var(--theme-primary);\n --icon-color: var(--theme-on-primary);\n}\n\n.secondary-variant {\n --feature-banner-bg: var(--theme-surface-secondary);\n --icon-bg-color: var(--theme-surface);\n --icon-color: var(--theme-primary);\n}\n\n.featureBanner {\n border: var(--sizes-line) solid var(--theme-surface-alt);\n border-radius: var(--radius-base);\n background-color: var(--feature-banner-bg);\n padding: var(--banner-padding);\n\n &.vertical-layout {\n gap: var(--banner-gap);\n }\n\n &.horizontal-layout {\n gap: var(--horizontal-gap);\n }\n}\n\n.featureBanner .vertical {\n flex-direction: column;\n align-items: flex-start;\n}\n\n.featureBanner .horizontal {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding-left: var(--horizontal-padding-left);\n}\n\n.actions-vertical {\n padding: var(--sizes-none);\n}\n\n.actions-horizontal {\n padding: var(--horizontal-action-padding);\n}\n\n.iconBackground {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n padding: var(--sizes-xs);\n border-radius: var(--radius-base);\n background-color: var(--icon-bg-color);\n\n & svg {\n width: var(--icon-size);\n height: var(--icon-size);\n color: var(--icon-color);\n }\n}\n\n.centerButton {\n align-self: center;\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,q1EAAA;AACA,aAAA,CAAA,WAAA,CAAA,oBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,iBAAA,CAAA,2BAAA,CAAA,mBAAA,CAAA,6BAAA,CAAA,eAAA,CAAA,yBAAA,CAAA,iBAAA,CAAA,2BAAA,CAAA,mBAAA,CAAA,6BAAA,CAAA,UAAA,CAAA,oBAAA,CAAA,YAAA,CAAA,sBAAA,CAAA,kBAAA,CAAA,4BAAA,CAAA,oBAAA,CAAA,8BAAA,CAAA,gBAAA,CAAA,0BAAA,CAAA,cAAA,CAAA,wBAAA;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { FeatureBanner } from './FeatureBanner';
|
|
2
|
-
export type {
|
|
2
|
+
export type { FeatureBannerDirection, FeatureBannerProps, FeatureBannerSize, FeatureBannerVariant, } from './types';
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { WithTokensProps } from '../../hoc/withTokens/withTokens';
|
|
3
|
-
import {
|
|
3
|
+
import type { ActionProps } from '../Action/types';
|
|
4
4
|
/** Visual style of the banner */
|
|
5
5
|
export type FeatureBannerVariant = 'primary' | 'secondary';
|
|
6
6
|
/** Controls the padding density of the banner */
|
|
7
|
-
export type FeatureBannerSize = '
|
|
7
|
+
export type FeatureBannerSize = 'base' | 'sm' | 'xs';
|
|
8
8
|
/** Direction of the banner content flow */
|
|
9
|
-
export type
|
|
10
|
-
export type FeatureBannerProps = Omit<
|
|
9
|
+
export type FeatureBannerDirection = 'vertical' | 'horizontal';
|
|
10
|
+
export type FeatureBannerProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & WithTokensProps & {
|
|
11
11
|
/** Visual style of the banner. `'primary'` has a solid icon background, `'secondary'` has a white background */
|
|
12
12
|
variant?: FeatureBannerVariant;
|
|
13
13
|
/** Controls padding density */
|
|
14
14
|
size?: FeatureBannerSize;
|
|
15
15
|
/** Direction of content flow. `'vertical'` stacks content, `'horizontal'` places content side-by-side */
|
|
16
|
-
|
|
16
|
+
direction?: FeatureBannerDirection;
|
|
17
17
|
/** Banner heading text, also used as the `aria-label` for the region */
|
|
18
18
|
title: string;
|
|
19
19
|
/** Flexible content area below the title for message text, links, or any custom content */
|
|
20
20
|
contentSlot?: ReactNode;
|
|
21
21
|
/** Icon displayed in a themed background container */
|
|
22
22
|
iconSlot?: ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
actions?:
|
|
23
|
+
/** Actions rendered below the content. Supports both button and link actions. */
|
|
24
|
+
actions?: ((Omit<ActionProps<'button'>, 'children' | 'size'> | Omit<ActionProps<'a'>, 'children' | 'size'>) & {
|
|
25
|
+
label: string;
|
|
26
|
+
})[];
|
|
25
27
|
/** Close handler. When provided, renders a close button */
|
|
26
28
|
onClose?: () => void;
|
|
27
29
|
};
|
|
@@ -312,6 +312,7 @@ export declare const PageInput: import("styled-components").StyledComponent<impo
|
|
|
312
312
|
type?: import("../TextField").TextFieldType | undefined;
|
|
313
313
|
onChange?: ((value: string) => void) | undefined;
|
|
314
314
|
hasError?: boolean | undefined;
|
|
315
|
+
disabledMessage?: import("react").ReactNode;
|
|
315
316
|
size?: "base" | "sm" | undefined;
|
|
316
317
|
multiline?: boolean | undefined;
|
|
317
318
|
} & import("react").RefAttributes<HTMLInputElement> & import("../../hoc/withLabels/withLabels").WithLabelsProps, "ref"> & import("react").RefAttributes<unknown>>, any, {}, never>;
|
|
@@ -296,6 +296,7 @@ export declare const PhoneInput: import("react").ForwardRefExoticComponent<{
|
|
|
296
296
|
type?: import("..").TextFieldType | undefined;
|
|
297
297
|
onChange?: ((value: string) => void) | undefined;
|
|
298
298
|
hasError?: boolean | undefined;
|
|
299
|
+
disabledMessage?: import("react").ReactNode;
|
|
299
300
|
size?: "base" | "sm" | undefined;
|
|
300
301
|
multiline?: boolean | undefined;
|
|
301
302
|
} & {
|
|
@@ -296,6 +296,7 @@ export declare const Search: React.ForwardRefExoticComponent<{
|
|
|
296
296
|
type?: import("..").TextFieldType | undefined;
|
|
297
297
|
onChange?: ((value: string) => void) | undefined;
|
|
298
298
|
hasError?: boolean | undefined;
|
|
299
|
+
disabledMessage?: React.ReactNode;
|
|
299
300
|
size?: "base" | "sm" | undefined;
|
|
300
301
|
multiline?: boolean | undefined;
|
|
301
302
|
} & {
|
|
@@ -297,6 +297,7 @@ declare const Input: import("styled-components").StyledComponent<import("react")
|
|
|
297
297
|
type?: import("../TextField").TextFieldType | undefined;
|
|
298
298
|
onChange?: ((value: string) => void) | undefined;
|
|
299
299
|
hasError?: boolean | undefined;
|
|
300
|
+
disabledMessage?: import("react").ReactNode;
|
|
300
301
|
size?: "base" | "sm" | undefined;
|
|
301
302
|
multiline?: boolean | undefined;
|
|
302
303
|
} & import("react").RefAttributes<HTMLInputElement> & import("../../hoc/withLabels/withLabels").WithLabelsProps, "ref"> & import("react").RefAttributes<unknown>>, any, {}, never>;
|
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var styled = require('./styled.cjs');
|
|
5
4
|
var withLabels = require('../../hoc/withLabels/withLabels.cjs');
|
|
5
|
+
var buildClassnames = require('../../utils/buildClassnames.cjs');
|
|
6
|
+
require('uid/secure');
|
|
7
|
+
var form_module = require('../../utils/forms/form.module.scss.cjs');
|
|
8
|
+
var Select_module = require('./Select.module.scss.cjs');
|
|
6
9
|
|
|
7
10
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
11
|
|
|
9
12
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
10
13
|
|
|
11
|
-
const Select = withLabels.withLabels(React.forwardRef(({ className, options, value, onChange, size, disabled, hasError, ...otherProps }, ref) => {
|
|
14
|
+
const Select = withLabels.withLabels(React.forwardRef(({ className, options, value, onChange, size, disabled, disabledMessage, hasError, id, ...otherProps }, ref) => {
|
|
12
15
|
const handleChange = React.useCallback((e) => {
|
|
13
16
|
if (!onChange)
|
|
14
17
|
return;
|
|
15
18
|
onChange(e.currentTarget.value);
|
|
16
19
|
}, [onChange]);
|
|
17
|
-
|
|
20
|
+
const getAriaDescribedBy = () => {
|
|
21
|
+
if (hasError && id)
|
|
22
|
+
return `${id}-error`;
|
|
23
|
+
if (disabledMessage && id)
|
|
24
|
+
return `${id}-disabled`;
|
|
25
|
+
return undefined;
|
|
26
|
+
};
|
|
27
|
+
return (React__default.default.createElement("select", { className: buildClassnames.buildClassnames([
|
|
28
|
+
form_module.base,
|
|
29
|
+
form_module.fullStyles,
|
|
30
|
+
Select_module.select,
|
|
31
|
+
size === 'sm' && form_module.compact,
|
|
32
|
+
hasError && form_module.error,
|
|
33
|
+
className,
|
|
34
|
+
]), id: id, value: value !== null && value !== void 0 ? value : undefined, onChange: handleChange, disabled: disabled, "aria-describedby": getAriaDescribedBy(), ref: ref, ...otherProps }, !!options &&
|
|
18
35
|
options.map((option) => (React__default.default.createElement("option", { key: option.label, value: option.value, disabled: option.disabled, hidden: option.hidden }, option.label)))));
|
|
19
36
|
}));
|
|
20
37
|
Select.displayName = 'Select';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.cjs","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React, { ChangeEvent, forwardRef, useCallback } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"Select.cjs","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React, { ChangeEvent, forwardRef, useCallback } from 'react';\n\nimport { withLabels } from '../../hoc';\nimport { buildClassnames } from '../../utils';\n\nimport formStyles from '../../utils/forms/form.module.scss';\nimport styles from './Select.module.scss';\n\nexport type SelectOption = {\n label: string;\n value: string;\n disabled?: boolean;\n hidden?: boolean;\n};\n\nexport interface SelectProps\n extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size' | 'onChange'> {\n id?: string;\n className?: string;\n /** Array of options to render in the select dropdown. */\n options: Array<SelectOption>;\n /** Currently selected value. */\n value?: string;\n /** Component size variant. Defaults to `'base'`. */\n size?: 'sm' | 'base';\n /** Disables the select element. */\n disabled?: boolean;\n /**\n * When provided, links the select to the disabled message element via `aria-describedby`.\n * Passed through from `withLabels` — the HOC renders the visible message and sets `disabled`.\n */\n disabledMessage?: React.ReactNode;\n /** When true, applies error styling. Used with `withLabels` to display an error message. */\n hasError?: boolean;\n /** Callback fired with the new value on change. */\n onChange?: (value: string) => void;\n}\n\nexport const Select = withLabels(\n forwardRef<HTMLSelectElement, SelectProps>(\n (\n {\n className,\n options,\n value,\n onChange,\n size,\n disabled,\n disabledMessage,\n hasError,\n id,\n ...otherProps\n }: SelectProps,\n ref,\n ) => {\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLSelectElement>) => {\n if (!onChange) return;\n onChange(e.currentTarget.value);\n },\n [onChange],\n );\n\n const getAriaDescribedBy = () => {\n if (hasError && id) return `${id}-error`;\n if (disabledMessage && id) return `${id}-disabled`;\n return undefined;\n };\n\n return (\n <select\n className={buildClassnames([\n formStyles.base,\n formStyles.fullStyles,\n styles.select,\n size === 'sm' && formStyles.compact,\n hasError && formStyles.error,\n className,\n ])}\n id={id}\n value={value ?? undefined}\n onChange={handleChange}\n disabled={disabled}\n aria-describedby={getAriaDescribedBy()}\n ref={ref}\n {...otherProps}\n >\n {!!options &&\n options.map((option) => (\n <option\n key={option.label}\n value={option.value}\n disabled={option.disabled}\n hidden={option.hidden}\n >\n {option.label}\n </option>\n ))}\n </select>\n );\n },\n ),\n);\n\nSelect.displayName = 'Select';\n"],"names":["withLabels","forwardRef","useCallback","React","buildClassnames","formStyles","styles"],"mappings":";;;;;;;;;;;;;AAsCO,MAAM,MAAM,GAAGA,qBAAU,CAC9BC,gBAAU,CACR,CACE,EACE,SAAS,EACT,OAAO,EACP,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,EAAE,EACF,GAAG,UAAU,EACD,EACd,GAAG,KACD;AACF,IAAA,MAAM,YAAY,GAAGC,iBAAW,CAC9B,CAAC,CAAiC,KAAI;AACpC,QAAA,IAAI,CAAC,QAAQ;YAAE;AACf,QAAA,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;AACjC,IAAA,CAAC,EACD,CAAC,QAAQ,CAAC,CACX;IAED,MAAM,kBAAkB,GAAG,MAAK;QAC9B,IAAI,QAAQ,IAAI,EAAE;YAAE,OAAO,CAAA,EAAG,EAAE,CAAA,MAAA,CAAQ;QACxC,IAAI,eAAe,IAAI,EAAE;YAAE,OAAO,CAAA,EAAG,EAAE,CAAA,SAAA,CAAW;AAClD,QAAA,OAAO,SAAS;AAClB,IAAA,CAAC;AAED,IAAA,QACEC,sBAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EACE,SAAS,EAAEC,+BAAe,CAAC;AACzB,YAAAC,WAAU,CAAC,IAAI;AACf,YAAAA,WAAU,CAAC,UAAU;AACrB,YAAAC,aAAM,CAAC,MAAM;AACb,YAAA,IAAI,KAAK,IAAI,IAAID,WAAU,CAAC,OAAO;YACnC,QAAQ,IAAIA,WAAU,CAAC,KAAK;YAC5B,SAAS;AACV,SAAA,CAAC,EACF,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,KAAA,IAAA,IAAL,KAAK,KAAA,MAAA,GAAL,KAAK,GAAI,SAAS,EACzB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,EAAA,kBAAA,EACA,kBAAkB,EAAE,EACtC,GAAG,EAAE,GAAG,EAAA,GACJ,UAAU,EAAA,EAEb,CAAC,CAAC,OAAO;AACR,QAAA,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MACjBF,iDACE,GAAG,EAAE,MAAM,CAAC,KAAK,EACjB,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAA,EAEpB,MAAM,CAAC,KAAK,CACN,CACV,CAAC,CACG;AAEb,CAAC,CACF;AAGH,MAAM,CAAC,WAAW,GAAG,QAAQ;;;;"}
|
|
@@ -8,11 +8,22 @@ export type SelectOption = {
|
|
|
8
8
|
export interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size' | 'onChange'> {
|
|
9
9
|
id?: string;
|
|
10
10
|
className?: string;
|
|
11
|
+
/** Array of options to render in the select dropdown. */
|
|
11
12
|
options: Array<SelectOption>;
|
|
13
|
+
/** Currently selected value. */
|
|
12
14
|
value?: string;
|
|
15
|
+
/** Component size variant. Defaults to `'base'`. */
|
|
13
16
|
size?: 'sm' | 'base';
|
|
17
|
+
/** Disables the select element. */
|
|
14
18
|
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* When provided, links the select to the disabled message element via `aria-describedby`.
|
|
21
|
+
* Passed through from `withLabels` — the HOC renders the visible message and sets `disabled`.
|
|
22
|
+
*/
|
|
23
|
+
disabledMessage?: React.ReactNode;
|
|
24
|
+
/** When true, applies error styling. Used with `withLabels` to display an error message. */
|
|
15
25
|
hasError?: boolean;
|
|
26
|
+
/** Callback fired with the new value on change. */
|
|
16
27
|
onChange?: (value: string) => void;
|
|
17
28
|
}
|
|
18
29
|
export declare const Select: React.ForwardRefExoticComponent<Omit<SelectProps & React.RefAttributes<HTMLSelectElement> & import("../../hoc/withLabels/withLabels").WithLabelsProps, "ref"> & React.RefAttributes<unknown>>;
|
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
import React__default, { forwardRef, useCallback } from 'react';
|
|
2
|
-
import { SelectInput } from './styled.js';
|
|
3
2
|
import { withLabels } from '../../hoc/withLabels/withLabels.js';
|
|
3
|
+
import { buildClassnames } from '../../utils/buildClassnames.js';
|
|
4
|
+
import 'uid/secure';
|
|
5
|
+
import formStyles from '../../utils/forms/form.module.scss.js';
|
|
6
|
+
import styles from './Select.module.scss.js';
|
|
4
7
|
|
|
5
|
-
const Select = withLabels(forwardRef(({ className, options, value, onChange, size, disabled, hasError, ...otherProps }, ref) => {
|
|
8
|
+
const Select = withLabels(forwardRef(({ className, options, value, onChange, size, disabled, disabledMessage, hasError, id, ...otherProps }, ref) => {
|
|
6
9
|
const handleChange = useCallback((e) => {
|
|
7
10
|
if (!onChange)
|
|
8
11
|
return;
|
|
9
12
|
onChange(e.currentTarget.value);
|
|
10
13
|
}, [onChange]);
|
|
11
|
-
|
|
14
|
+
const getAriaDescribedBy = () => {
|
|
15
|
+
if (hasError && id)
|
|
16
|
+
return `${id}-error`;
|
|
17
|
+
if (disabledMessage && id)
|
|
18
|
+
return `${id}-disabled`;
|
|
19
|
+
return undefined;
|
|
20
|
+
};
|
|
21
|
+
return (React__default.createElement("select", { className: buildClassnames([
|
|
22
|
+
formStyles.base,
|
|
23
|
+
formStyles.fullStyles,
|
|
24
|
+
styles.select,
|
|
25
|
+
size === 'sm' && formStyles.compact,
|
|
26
|
+
hasError && formStyles.error,
|
|
27
|
+
className,
|
|
28
|
+
]), id: id, value: value !== null && value !== void 0 ? value : undefined, onChange: handleChange, disabled: disabled, "aria-describedby": getAriaDescribedBy(), ref: ref, ...otherProps }, !!options &&
|
|
12
29
|
options.map((option) => (React__default.createElement("option", { key: option.label, value: option.value, disabled: option.disabled, hidden: option.hidden }, option.label)))));
|
|
13
30
|
}));
|
|
14
31
|
Select.displayName = 'Select';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React, { ChangeEvent, forwardRef, useCallback } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React, { ChangeEvent, forwardRef, useCallback } from 'react';\n\nimport { withLabels } from '../../hoc';\nimport { buildClassnames } from '../../utils';\n\nimport formStyles from '../../utils/forms/form.module.scss';\nimport styles from './Select.module.scss';\n\nexport type SelectOption = {\n label: string;\n value: string;\n disabled?: boolean;\n hidden?: boolean;\n};\n\nexport interface SelectProps\n extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size' | 'onChange'> {\n id?: string;\n className?: string;\n /** Array of options to render in the select dropdown. */\n options: Array<SelectOption>;\n /** Currently selected value. */\n value?: string;\n /** Component size variant. Defaults to `'base'`. */\n size?: 'sm' | 'base';\n /** Disables the select element. */\n disabled?: boolean;\n /**\n * When provided, links the select to the disabled message element via `aria-describedby`.\n * Passed through from `withLabels` — the HOC renders the visible message and sets `disabled`.\n */\n disabledMessage?: React.ReactNode;\n /** When true, applies error styling. Used with `withLabels` to display an error message. */\n hasError?: boolean;\n /** Callback fired with the new value on change. */\n onChange?: (value: string) => void;\n}\n\nexport const Select = withLabels(\n forwardRef<HTMLSelectElement, SelectProps>(\n (\n {\n className,\n options,\n value,\n onChange,\n size,\n disabled,\n disabledMessage,\n hasError,\n id,\n ...otherProps\n }: SelectProps,\n ref,\n ) => {\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLSelectElement>) => {\n if (!onChange) return;\n onChange(e.currentTarget.value);\n },\n [onChange],\n );\n\n const getAriaDescribedBy = () => {\n if (hasError && id) return `${id}-error`;\n if (disabledMessage && id) return `${id}-disabled`;\n return undefined;\n };\n\n return (\n <select\n className={buildClassnames([\n formStyles.base,\n formStyles.fullStyles,\n styles.select,\n size === 'sm' && formStyles.compact,\n hasError && formStyles.error,\n className,\n ])}\n id={id}\n value={value ?? undefined}\n onChange={handleChange}\n disabled={disabled}\n aria-describedby={getAriaDescribedBy()}\n ref={ref}\n {...otherProps}\n >\n {!!options &&\n options.map((option) => (\n <option\n key={option.label}\n value={option.value}\n disabled={option.disabled}\n hidden={option.hidden}\n >\n {option.label}\n </option>\n ))}\n </select>\n );\n },\n ),\n);\n\nSelect.displayName = 'Select';\n"],"names":["React"],"mappings":";;;;;;;AAsCO,MAAM,MAAM,GAAG,UAAU,CAC9B,UAAU,CACR,CACE,EACE,SAAS,EACT,OAAO,EACP,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,EAAE,EACF,GAAG,UAAU,EACD,EACd,GAAG,KACD;AACF,IAAA,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,CAAiC,KAAI;AACpC,QAAA,IAAI,CAAC,QAAQ;YAAE;AACf,QAAA,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;AACjC,IAAA,CAAC,EACD,CAAC,QAAQ,CAAC,CACX;IAED,MAAM,kBAAkB,GAAG,MAAK;QAC9B,IAAI,QAAQ,IAAI,EAAE;YAAE,OAAO,CAAA,EAAG,EAAE,CAAA,MAAA,CAAQ;QACxC,IAAI,eAAe,IAAI,EAAE;YAAE,OAAO,CAAA,EAAG,EAAE,CAAA,SAAA,CAAW;AAClD,QAAA,OAAO,SAAS;AAClB,IAAA,CAAC;AAED,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EACE,SAAS,EAAE,eAAe,CAAC;AACzB,YAAA,UAAU,CAAC,IAAI;AACf,YAAA,UAAU,CAAC,UAAU;AACrB,YAAA,MAAM,CAAC,MAAM;AACb,YAAA,IAAI,KAAK,IAAI,IAAI,UAAU,CAAC,OAAO;YACnC,QAAQ,IAAI,UAAU,CAAC,KAAK;YAC5B,SAAS;AACV,SAAA,CAAC,EACF,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,KAAA,IAAA,IAAL,KAAK,KAAA,MAAA,GAAL,KAAK,GAAI,SAAS,EACzB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,EAAA,kBAAA,EACA,kBAAkB,EAAE,EACtC,GAAG,EAAE,GAAG,EAAA,GACJ,UAAU,EAAA,EAEb,CAAC,CAAC,OAAO;AACR,QAAA,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MACjBA,yCACE,GAAG,EAAE,MAAM,CAAC,KAAK,EACjB,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAA,EAEpB,MAAM,CAAC,KAAK,CACN,CACV,CAAC,CACG;AAEb,CAAC,CACF;AAGH,MAAM,CAAC,WAAW,GAAG,QAAQ;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
|
+
|
|
5
|
+
___$insertStyle("._select_1kp7e_1 {\n --padding-right: var(--sizes-9);\n padding-right: var(--padding-right);\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: right var(--sizes-3) top 50%, 0 0;\n}\n._select_1kp7e_1:has(option:disabled:checked) {\n color: var(--colors-neutral-ink-light);\n}");
|
|
6
|
+
var styles = {"select":"_select_1kp7e_1"};
|
|
7
|
+
|
|
8
|
+
module.exports = styles;
|
|
9
|
+
//# sourceMappingURL=Select.module.scss.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.module.scss.cjs","sources":["../../../src/components/Select/Select.module.scss"],"sourcesContent":[".select {\n --padding-right: var(--sizes-9);\n\n padding-right: var(--padding-right);\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position:\n right var(--sizes-3) top 50%,\n 0 0;\n\n &:has(option:disabled:checked) {\n color: var(--colors-neutral-ink-light);\n }\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,0hBAAA;AAEA,aAAA,CAAA,QAAA,CAAA,iBAAA;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import insertStyle from '../../_virtual/____insertStyle.js';
|
|
2
|
+
|
|
3
|
+
insertStyle("._select_1kp7e_1 {\n --padding-right: var(--sizes-9);\n padding-right: var(--padding-right);\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: right var(--sizes-3) top 50%, 0 0;\n}\n._select_1kp7e_1:has(option:disabled:checked) {\n color: var(--colors-neutral-ink-light);\n}");
|
|
4
|
+
var styles = {"select":"_select_1kp7e_1"};
|
|
5
|
+
|
|
6
|
+
export { styles as default };
|
|
7
|
+
//# sourceMappingURL=Select.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.module.scss.js","sources":["../../../src/components/Select/Select.module.scss"],"sourcesContent":[".select {\n --padding-right: var(--sizes-9);\n\n padding-right: var(--padding-right);\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position:\n right var(--sizes-3) top 50%,\n 0 0;\n\n &:has(option:disabled:checked) {\n color: var(--colors-neutral-ink-light);\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,0hBAAA;AAEA,aAAA,CAAA,QAAA,CAAA,iBAAA;;;;"}
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var generateId = require('../../utils/generateId.cjs');
|
|
5
|
-
var
|
|
5
|
+
var buildClassnames = require('../../utils/buildClassnames.cjs');
|
|
6
|
+
var form_module = require('../../utils/forms/form.module.scss.cjs');
|
|
7
|
+
var TextField_module = require('./TextField.module.scss.cjs');
|
|
6
8
|
|
|
7
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
10
|
|
|
9
11
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
10
12
|
|
|
11
13
|
const NUMBER_REGEX = /^-?[0-9]*\.?[0-9]+$/;
|
|
12
|
-
const TextField = React.forwardRef(({ id, className, disabled = false, hasError, multiline = false, spellCheck = false, name, onChange, placeholder, size = 'base', type = 'text', value, ...otherProps }, ref) => {
|
|
14
|
+
const TextField = React.forwardRef(({ id, className, disabled = false, disabledMessage, hasError, multiline = false, spellCheck = false, name, onChange, placeholder, size = 'base', type = 'text', value, ...otherProps }, ref) => {
|
|
13
15
|
const handleChange = React.useCallback((event) => {
|
|
14
16
|
if (!onChange)
|
|
15
17
|
return;
|
|
@@ -32,14 +34,29 @@ const TextField = React.forwardRef(({ id, className, disabled = false, hasError,
|
|
|
32
34
|
const ariaDescribedBy = React.useMemo(() => {
|
|
33
35
|
if (hasError)
|
|
34
36
|
return `${componentId}-error`;
|
|
35
|
-
if (
|
|
37
|
+
if (disabledMessage)
|
|
36
38
|
return `${componentId}-disabled`;
|
|
37
39
|
return undefined;
|
|
38
|
-
}, [hasError,
|
|
40
|
+
}, [hasError, disabledMessage, componentId]);
|
|
41
|
+
const isCompact = size === 'sm';
|
|
39
42
|
if (type === 'text' && multiline) {
|
|
40
|
-
return (React__default.default.createElement(
|
|
43
|
+
return (React__default.default.createElement("textarea", { className: buildClassnames.buildClassnames([
|
|
44
|
+
form_module.base,
|
|
45
|
+
form_module.fullStyles,
|
|
46
|
+
TextField_module.textarea,
|
|
47
|
+
isCompact && form_module.compact,
|
|
48
|
+
hasError && form_module.error,
|
|
49
|
+
className,
|
|
50
|
+
]), disabled: disabled, id: componentId, name: name, onChange: handleChange, placeholder: placeholder, value: value, ref: ref, spellCheck: spellCheck, "aria-describedby": ariaDescribedBy, ...otherProps }));
|
|
41
51
|
}
|
|
42
|
-
return (React__default.default.createElement(
|
|
52
|
+
return (React__default.default.createElement("input", { className: buildClassnames.buildClassnames([
|
|
53
|
+
form_module.base,
|
|
54
|
+
form_module.fullStyles,
|
|
55
|
+
TextField_module.input,
|
|
56
|
+
isCompact && form_module.compact,
|
|
57
|
+
hasError && form_module.error,
|
|
58
|
+
className,
|
|
59
|
+
]), disabled: disabled, id: componentId, name: name, "aria-label": name, onChange: handleChange, placeholder: placeholder, type: type, value: value, ref: ref, spellCheck: spellCheck, "aria-describedby": ariaDescribedBy, ...otherProps }));
|
|
43
60
|
});
|
|
44
61
|
|
|
45
62
|
exports.TextField = TextField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.cjs","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React, { useCallback, ChangeEvent, forwardRef, useMemo } from 'react';\nimport { TextFieldProps } from './types';\nimport { generateId } from '../../utils/generateId';\n\nimport
|
|
1
|
+
{"version":3,"file":"TextField.cjs","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React, { useCallback, ChangeEvent, forwardRef, useMemo } from 'react';\nimport { TextFieldProps } from './types';\nimport { generateId } from '../../utils/generateId';\nimport { buildClassnames } from '../../utils';\n\nimport formStyles from '../../utils/forms/form.module.scss';\nimport styles from './TextField.module.scss';\n\nconst NUMBER_REGEX = /^-?[0-9]*\\.?[0-9]+$/;\n\nexport const TextField = forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n id,\n className,\n disabled = false,\n disabledMessage,\n hasError,\n multiline = false,\n spellCheck = false,\n name,\n onChange,\n placeholder,\n size = 'base',\n type = 'text',\n value,\n ...otherProps\n }: TextFieldProps,\n ref,\n ) => {\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (!onChange) return;\n const newValue = event.currentTarget.value;\n\n if (newValue === '') {\n onChange(newValue);\n return;\n }\n\n if (type !== 'number') {\n onChange(newValue);\n return;\n }\n\n const reg = new RegExp(NUMBER_REGEX);\n if (!reg.test(newValue)) {\n return;\n }\n\n onChange(newValue);\n },\n [onChange, type],\n );\n\n const componentId = useMemo(() => id ?? generateId('textfield'), [id]);\n const ariaDescribedBy = useMemo(() => {\n if (hasError) return `${componentId}-error`;\n if (disabledMessage) return `${componentId}-disabled`;\n return undefined;\n }, [hasError, disabledMessage, componentId]);\n\n const isCompact = size === 'sm';\n\n if (type === 'text' && multiline) {\n return (\n <textarea\n className={buildClassnames([\n formStyles.base,\n formStyles.fullStyles,\n styles.textarea,\n isCompact && formStyles.compact,\n hasError && formStyles.error,\n className,\n ])}\n disabled={disabled}\n id={componentId}\n name={name}\n onChange={handleChange}\n placeholder={placeholder}\n value={value}\n ref={ref as React.Ref<HTMLTextAreaElement>}\n spellCheck={spellCheck}\n aria-describedby={ariaDescribedBy}\n {...otherProps}\n />\n );\n }\n\n return (\n <input\n className={buildClassnames([\n formStyles.base,\n formStyles.fullStyles,\n styles.input,\n isCompact && formStyles.compact,\n hasError && formStyles.error,\n className,\n ])}\n disabled={disabled}\n id={componentId}\n name={name}\n aria-label={name}\n onChange={handleChange}\n placeholder={placeholder}\n type={type}\n value={value}\n ref={ref}\n spellCheck={spellCheck}\n aria-describedby={ariaDescribedBy}\n {...otherProps}\n />\n );\n },\n);\n"],"names":["forwardRef","useCallback","useMemo","generateId","React","buildClassnames","formStyles","styles"],"mappings":";;;;;;;;;;;;AAQA,MAAM,YAAY,GAAG,qBAAqB;MAE7B,SAAS,GAAGA,gBAAU,CACjC,CACE,EACE,EAAE,EACF,SAAS,EACT,QAAQ,GAAG,KAAK,EAChB,eAAe,EACf,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,IAAI,GAAG,MAAM,EACb,IAAI,GAAG,MAAM,EACb,KAAK,EACL,GAAG,UAAU,EACE,EACjB,GAAG,KACD;AACF,IAAA,MAAM,YAAY,GAAGC,iBAAW,CAC9B,CAAC,KAA0D,KAAI;AAC7D,QAAA,IAAI,CAAC,QAAQ;YAAE;AACf,QAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK;QAE1C,IAAI,QAAQ,KAAK,EAAE,EAAE;YACnB,QAAQ,CAAC,QAAQ,CAAC;YAClB;AACD,QAAA;QAED,IAAI,IAAI,KAAK,QAAQ,EAAE;YACrB,QAAQ,CAAC,QAAQ,CAAC;YAClB;AACD,QAAA;AAED,QAAA,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC;AACpC,QAAA,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACvB;AACD,QAAA;QAED,QAAQ,CAAC,QAAQ,CAAC;AACpB,IAAA,CAAC,EACD,CAAC,QAAQ,EAAE,IAAI,CAAC,CACjB;IAED,MAAM,WAAW,GAAGC,aAAO,CAAC,MAAM,EAAE,KAAA,IA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AAS,IAAID,WAAU,CAAC,OAAO;YAC/B,QAAQ,IAAIA,WAAU,CAAC,KAAK;YAC5B,SAAS;SACV,CAAC,EACF,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,WAAW,EACf,IAAI,EAAE,IAAI,EAAA,YAAA,EACE,IAAI,EAChB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EAAA,kBAAA,EACJ,eAAe,KAC7B,UAAU,EAAA,CACd;AAEN,CAAC;;;;"}
|
|
@@ -296,6 +296,7 @@ export declare const TextField: React.ForwardRefExoticComponent<{
|
|
|
296
296
|
type?: import("./types").TextFieldType | undefined;
|
|
297
297
|
onChange?: ((value: string) => void) | undefined;
|
|
298
298
|
hasError?: boolean | undefined;
|
|
299
|
+
disabledMessage?: React.ReactNode;
|
|
299
300
|
size?: "base" | "sm" | undefined;
|
|
300
301
|
multiline?: boolean | undefined;
|
|
301
302
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React__default, { forwardRef, useCallback, useMemo } from 'react';
|
|
2
2
|
import { generateId } from '../../utils/generateId.js';
|
|
3
|
-
import {
|
|
3
|
+
import { buildClassnames } from '../../utils/buildClassnames.js';
|
|
4
|
+
import formStyles from '../../utils/forms/form.module.scss.js';
|
|
5
|
+
import styles from './TextField.module.scss.js';
|
|
4
6
|
|
|
5
7
|
const NUMBER_REGEX = /^-?[0-9]*\.?[0-9]+$/;
|
|
6
|
-
const TextField = forwardRef(({ id, className, disabled = false, hasError, multiline = false, spellCheck = false, name, onChange, placeholder, size = 'base', type = 'text', value, ...otherProps }, ref) => {
|
|
8
|
+
const TextField = forwardRef(({ id, className, disabled = false, disabledMessage, hasError, multiline = false, spellCheck = false, name, onChange, placeholder, size = 'base', type = 'text', value, ...otherProps }, ref) => {
|
|
7
9
|
const handleChange = useCallback((event) => {
|
|
8
10
|
if (!onChange)
|
|
9
11
|
return;
|
|
@@ -26,14 +28,29 @@ const TextField = forwardRef(({ id, className, disabled = false, hasError, multi
|
|
|
26
28
|
const ariaDescribedBy = useMemo(() => {
|
|
27
29
|
if (hasError)
|
|
28
30
|
return `${componentId}-error`;
|
|
29
|
-
if (
|
|
31
|
+
if (disabledMessage)
|
|
30
32
|
return `${componentId}-disabled`;
|
|
31
33
|
return undefined;
|
|
32
|
-
}, [hasError,
|
|
34
|
+
}, [hasError, disabledMessage, componentId]);
|
|
35
|
+
const isCompact = size === 'sm';
|
|
33
36
|
if (type === 'text' && multiline) {
|
|
34
|
-
return (React__default.createElement(
|
|
37
|
+
return (React__default.createElement("textarea", { className: buildClassnames([
|
|
38
|
+
formStyles.base,
|
|
39
|
+
formStyles.fullStyles,
|
|
40
|
+
styles.textarea,
|
|
41
|
+
isCompact && formStyles.compact,
|
|
42
|
+
hasError && formStyles.error,
|
|
43
|
+
className,
|
|
44
|
+
]), disabled: disabled, id: componentId, name: name, onChange: handleChange, placeholder: placeholder, value: value, ref: ref, spellCheck: spellCheck, "aria-describedby": ariaDescribedBy, ...otherProps }));
|
|
35
45
|
}
|
|
36
|
-
return (React__default.createElement(
|
|
46
|
+
return (React__default.createElement("input", { className: buildClassnames([
|
|
47
|
+
formStyles.base,
|
|
48
|
+
formStyles.fullStyles,
|
|
49
|
+
styles.input,
|
|
50
|
+
isCompact && formStyles.compact,
|
|
51
|
+
hasError && formStyles.error,
|
|
52
|
+
className,
|
|
53
|
+
]), disabled: disabled, id: componentId, name: name, "aria-label": name, onChange: handleChange, placeholder: placeholder, type: type, value: value, ref: ref, spellCheck: spellCheck, "aria-describedby": ariaDescribedBy, ...otherProps }));
|
|
37
54
|
});
|
|
38
55
|
|
|
39
56
|
export { TextField };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React, { useCallback, ChangeEvent, forwardRef, useMemo } from 'react';\nimport { TextFieldProps } from './types';\nimport { generateId } from '../../utils/generateId';\n\nimport
|
|
1
|
+
{"version":3,"file":"TextField.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React, { useCallback, ChangeEvent, forwardRef, useMemo } from 'react';\nimport { TextFieldProps } from './types';\nimport { generateId } from '../../utils/generateId';\nimport { buildClassnames } from '../../utils';\n\nimport formStyles from '../../utils/forms/form.module.scss';\nimport styles from './TextField.module.scss';\n\nconst NUMBER_REGEX = /^-?[0-9]*\\.?[0-9]+$/;\n\nexport const TextField = forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n id,\n className,\n disabled = false,\n disabledMessage,\n hasError,\n multiline = false,\n spellCheck = false,\n name,\n onChange,\n placeholder,\n size = 'base',\n type = 'text',\n value,\n ...otherProps\n }: TextFieldProps,\n ref,\n ) => {\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (!onChange) return;\n const newValue = event.currentTarget.value;\n\n if (newValue === '') {\n onChange(newValue);\n return;\n }\n\n if (type !== 'number') {\n onChange(newValue);\n return;\n }\n\n const reg = new RegExp(NUMBER_REGEX);\n if (!reg.test(newValue)) {\n return;\n }\n\n onChange(newValue);\n },\n [onChange, type],\n );\n\n const componentId = useMemo(() => id ?? generateId('textfield'), [id]);\n const ariaDescribedBy = useMemo(() => {\n if (hasError) return `${componentId}-error`;\n if (disabledMessage) return `${componentId}-disabled`;\n return undefined;\n }, [hasError, disabledMessage, componentId]);\n\n const isCompact = size === 'sm';\n\n if (type === 'text' && multiline) {\n return (\n <textarea\n className={buildClassnames([\n formStyles.base,\n formStyles.fullStyles,\n styles.textarea,\n isCompact && formStyles.compact,\n hasError && formStyles.error,\n className,\n ])}\n disabled={disabled}\n id={componentId}\n name={name}\n onChange={handleChange}\n placeholder={placeholder}\n value={value}\n ref={ref as React.Ref<HTMLTextAreaElement>}\n spellCheck={spellCheck}\n aria-describedby={ariaDescribedBy}\n {...otherProps}\n />\n );\n }\n\n return (\n <input\n className={buildClassnames([\n formStyles.base,\n formStyles.fullStyles,\n styles.input,\n isCompact && formStyles.compact,\n hasError && formStyles.error,\n className,\n ])}\n disabled={disabled}\n id={componentId}\n name={name}\n aria-label={name}\n onChange={handleChange}\n placeholder={placeholder}\n type={type}\n value={value}\n ref={ref}\n spellCheck={spellCheck}\n aria-describedby={ariaDescribedBy}\n {...otherProps}\n />\n );\n },\n);\n"],"names":["React"],"mappings":";;;;;;AAQA,MAAM,YAAY,GAAG,qBAAqB;MAE7B,SAAS,GAAG,UAAU,CACjC,CACE,EACE,EAAE,EACF,SAAS,EACT,QAAQ,GAAG,KAAK,EAChB,eAAe,EACf,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,IAAI,GAAG,MAAM,EACb,IAAI,GAAG,MAAM,EACb,KAAK,EACL,GAAG,UAAU,EACE,EACjB,GAAG,KACD;AACF,IAAA,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,KAA0D,KAAI;AAC7D,QAAA,IAAI,CAAC,QAAQ;YAAE;AACf,QAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK;QAE1C,IAAI,QAAQ,KAAK,EAAE,EAAE;YACnB,QAAQ,CAAC,QAAQ,CAAC;YAClB;AACD,QAAA;QAED,IAAI,IAAI,KAAK,QAAQ,EAAE;YACrB,QAAQ,CAAC,QAAQ,CAAC;YAClB;AACD,QAAA;AAED,QAAA,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC;AACpC,QAAA,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACvB;AACD,QAAA;QAED,QAAQ,CAAC,QAAQ,CAAC;AACpB,IAAA,CAAC,EACD,CAAC,QAAQ,EAAE,IAAI,CAAC,CACjB;IAED,MAAM,WAAW,GAAG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AAK;YACZ,SAAS,IAAI,UAAU,CAAC,OAAO;YAC/B,QAAQ,IAAI,UAAU,CAAC,KAAK;YAC5B,SAAS;SACV,CAAC,EACF,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,WAAW,EACf,IAAI,EAAE,IAAI,EAAA,YAAA,EACE,IAAI,EAChB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EAAA,kBAAA,EACJ,eAAe,KAC7B,UAAU,EAAA,CACd;AAEN,CAAC;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
|
+
|
|
5
|
+
___$insertStyle("._input_qtip3_1 {\n /* Overrides browser default width - note: this breaks the native [size] attribute */\n width: 100%;\n /* Hide number arrows/spinners */\n}\n._input_qtip3_1::-webkit-outer-spin-button, ._input_qtip3_1::-webkit-inner-spin-button {\n appearance: none;\n margin: 0;\n}\n._input_qtip3_1[type=number] {\n appearance: textfield;\n min-width: 8ch;\n text-align: right;\n}\n\n._textarea_qtip3_16 {\n padding-block: var(--sizes-2);\n}");
|
|
6
|
+
var styles = {"input":"_input_qtip3_1","textarea":"_textarea_qtip3_16"};
|
|
7
|
+
|
|
8
|
+
module.exports = styles;
|
|
9
|
+
//# sourceMappingURL=TextField.module.scss.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.module.scss.cjs","sources":["../../../src/components/TextField/TextField.module.scss"],"sourcesContent":[".input {\n /* Overrides browser default width - note: this breaks the native [size] attribute */\n width: 100%;\n\n /* Hide number arrows/spinners */\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n appearance: none;\n margin: 0;\n }\n\n &[type='number'] {\n appearance: textfield;\n min-width: 8ch;\n text-align: right;\n }\n}\n\n.textarea {\n padding-block: var(--sizes-2);\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,ycAAA;AACA,aAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,UAAA,CAAA,oBAAA;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import insertStyle from '../../_virtual/____insertStyle.js';
|
|
2
|
+
|
|
3
|
+
insertStyle("._input_qtip3_1 {\n /* Overrides browser default width - note: this breaks the native [size] attribute */\n width: 100%;\n /* Hide number arrows/spinners */\n}\n._input_qtip3_1::-webkit-outer-spin-button, ._input_qtip3_1::-webkit-inner-spin-button {\n appearance: none;\n margin: 0;\n}\n._input_qtip3_1[type=number] {\n appearance: textfield;\n min-width: 8ch;\n text-align: right;\n}\n\n._textarea_qtip3_16 {\n padding-block: var(--sizes-2);\n}");
|
|
4
|
+
var styles = {"input":"_input_qtip3_1","textarea":"_textarea_qtip3_16"};
|
|
5
|
+
|
|
6
|
+
export { styles as default };
|
|
7
|
+
//# sourceMappingURL=TextField.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.module.scss.js","sources":["../../../src/components/TextField/TextField.module.scss"],"sourcesContent":[".input {\n /* Overrides browser default width - note: this breaks the native [size] attribute */\n width: 100%;\n\n /* Hide number arrows/spinners */\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n appearance: none;\n margin: 0;\n }\n\n &[type='number'] {\n appearance: textfield;\n min-width: 8ch;\n text-align: right;\n }\n}\n\n.textarea {\n padding-block: var(--sizes-2);\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,ycAAA;AACA,aAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,UAAA,CAAA,oBAAA;;;;"}
|
|
@@ -297,6 +297,7 @@ export declare const TextField: import("react").ForwardRefExoticComponent<Omit<{
|
|
|
297
297
|
type?: import("./types").TextFieldType | undefined;
|
|
298
298
|
onChange?: ((value: string) => void) | undefined;
|
|
299
299
|
hasError?: boolean | undefined;
|
|
300
|
+
disabledMessage?: import("react").ReactNode;
|
|
300
301
|
size?: "base" | "sm" | undefined;
|
|
301
302
|
multiline?: boolean | undefined;
|
|
302
303
|
} & import("react").RefAttributes<HTMLInputElement> & import("../../hoc/withLabels/withLabels").WithLabelsProps, "ref"> & import("react").RefAttributes<unknown>>;
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { ComponentSizeType } from '../types';
|
|
3
3
|
export type TextFieldType = 'text' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'url' | 'date' | 'datetime-local' | 'month' | 'time' | 'week' | 'currency';
|
|
4
4
|
export declare const textFieldTypes: readonly ["text", "email", "number", "password", "search", "tel", "url", "date", "datetime-local", "month", "time", "week", "currency"];
|
|
5
5
|
type CommonAttributes = Omit<React.InputHTMLAttributes<HTMLInputElement> & React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'onChange' | 'size' | 'type' | 'value'>;
|
|
6
6
|
export type TextFieldProps = CommonAttributes & {
|
|
7
|
+
/** Current input value. */
|
|
7
8
|
value?: string;
|
|
9
|
+
/** HTML input type. Defaults to `'text'`. */
|
|
8
10
|
type?: TextFieldType;
|
|
11
|
+
/** Callback fired with the new value on change. */
|
|
9
12
|
onChange?: (value: string) => void;
|
|
13
|
+
/** When true, applies error styling. Used with `withLabels` to display an error message. */
|
|
10
14
|
hasError?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* When provided, links the input to the disabled message element via `aria-describedby`.
|
|
17
|
+
* Passed through from `withLabels` — the HOC renders the visible message and sets `disabled`.
|
|
18
|
+
*/
|
|
19
|
+
disabledMessage?: React.ReactNode;
|
|
20
|
+
/** Component size variant. Defaults to `'base'`. */
|
|
11
21
|
size?: ComponentSizeType;
|
|
22
|
+
/** Renders a `<textarea>` instead of `<input>` when `type` is `'text'`. */
|
|
12
23
|
multiline?: boolean;
|
|
13
24
|
};
|
|
14
25
|
export {};
|
|
@@ -21,14 +21,14 @@ const withLabels = (Component) => {
|
|
|
21
21
|
const ComponentWithLabels = React.forwardRef(({ label, hint, error, disabledMessage, tooltip, tooltipContent, id, ...otherProps }, ref) => {
|
|
22
22
|
const componentId = useId.useId({ id, prefix: Component.name });
|
|
23
23
|
if (!label)
|
|
24
|
-
return (React__default.default.createElement(Component, { ref: ref, id: componentId, hasError: !!error, disabled: !!disabledMessage, ...otherProps }));
|
|
24
|
+
return (React__default.default.createElement(Component, { ref: ref, id: componentId, hasError: !!error, disabled: !!disabledMessage, disabledMessage: disabledMessage, ...otherProps }));
|
|
25
25
|
return (React__default.default.createElement(FlexCol.FlexCol, { className: withLabels_module.rootStack },
|
|
26
26
|
React__default.default.createElement(FlexRow.FlexRow, null,
|
|
27
27
|
React__default.default.createElement(Text.Text, { variant: "inputLabel", id: `${componentId}-label`, htmlFor: componentId }, label),
|
|
28
28
|
(tooltip || tooltipContent) && (React__default.default.createElement(styled.BlockTooltip, { text: tooltip, content: tooltipContent },
|
|
29
29
|
React__default.default.createElement(HelpIcon.ReactComponent, { "data-testid": "tooltip-help", width: index.theme.sizes.base, height: index.theme.sizes.base, color: index.theme.colors.neutral.ink.light })))),
|
|
30
|
-
hint && React__default.default.createElement(Text.Text, { variant: "hintText", as: "span", className: withLabels_module.hint, id: `${componentId}-hint` }, hint),
|
|
31
|
-
React__default.default.createElement(Component, { ref: ref, id: componentId, hasError: !!error, disabled: !!disabledMessage, ...otherProps }),
|
|
30
|
+
hint && (React__default.default.createElement(Text.Text, { variant: "hintText", as: "span", className: withLabels_module.hint, id: `${componentId}-hint` }, hint)),
|
|
31
|
+
React__default.default.createElement(Component, { ref: ref, id: componentId, hasError: !!error, disabled: !!disabledMessage, disabledMessage: disabledMessage, ...otherProps }),
|
|
32
32
|
error && (React__default.default.createElement(FlexRow.FlexRow, { id: `${componentId}-error`, gap: "xs" },
|
|
33
33
|
React__default.default.createElement(CriticalIcon.ReactComponent, { width: 16, height: 16, color: index.theme.colors.secondary.red.base }),
|
|
34
34
|
React__default.default.createElement(Text.Text, { variant: "error", as: "span", className: withLabels_module.error }, error))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLabels.cjs","sources":["../../../src/hoc/withLabels/withLabels.tsx"],"sourcesContent":["import React, { ComponentType, forwardRef, ReactNode } from 'react';\n\nimport { FlexCol } from '../../components/Flex/FlexCol';\nimport { FlexRow } from '../../components/Flex/FlexRow';\nimport { Text } from '../../components/Text';\nimport { useId } from '../../hooks/useId';\nimport { CriticalIcon, HelpIcon, LockIcon } from '../../icons';\nimport { theme } from '../../theme';\n\nimport { BlockTooltip } from './styled';\nimport styles from './withLabels.module.scss';\n\nexport interface WithLabelsProps {\n id?: string;\n label?: ReactNode;\n hint?: ReactNode;\n error?: ReactNode;\n disabledMessage?: ReactNode;\n tooltip?: string;\n tooltipContent?: ReactNode;\n}\n\n// eslint-disable-next-line @typescript-eslint/comma-dangle -- comma is required so TS knows this is a generic, not JSX\nexport const withLabels = <P, R = unknown>(Component: ComponentType<P>) => {\n const ComponentWithLabels = forwardRef<R, P & WithLabelsProps>(\n ({ label, hint, error, disabledMessage, tooltip, tooltipContent, id, ...otherProps }, ref) => {\n const componentId = useId({ id, prefix: Component.name });\n\n if (!label)\n return (\n <Component\n ref={ref}\n id={componentId}\n hasError={!!error}\n disabled={!!disabledMessage}\n {...(otherProps as P)}\n />\n );\n\n return (\n <FlexCol className={styles.rootStack}>\n <FlexRow>\n <Text variant=\"inputLabel\" id={`${componentId}-label`} htmlFor={componentId}>\n {label}\n </Text>\n {(tooltip || tooltipContent) && (\n <BlockTooltip text={tooltip} content={tooltipContent}>\n <HelpIcon\n data-testid=\"tooltip-help\"\n width={theme.sizes.base}\n height={theme.sizes.base}\n color={theme.colors.neutral.ink.light}\n />\n </BlockTooltip>\n )}\n </FlexRow>\n {hint && <Text variant=\"hintText\" as=\"span\" className={styles.hint} id={`${componentId}-hint`}
|
|
1
|
+
{"version":3,"file":"withLabels.cjs","sources":["../../../src/hoc/withLabels/withLabels.tsx"],"sourcesContent":["import React, { ComponentType, forwardRef, ReactNode } from 'react';\n\nimport { FlexCol } from '../../components/Flex/FlexCol';\nimport { FlexRow } from '../../components/Flex/FlexRow';\nimport { Text } from '../../components/Text';\nimport { useId } from '../../hooks/useId';\nimport { CriticalIcon, HelpIcon, LockIcon } from '../../icons';\nimport { theme } from '../../theme';\n\nimport { BlockTooltip } from './styled';\nimport styles from './withLabels.module.scss';\n\nexport interface WithLabelsProps {\n id?: string;\n label?: ReactNode;\n hint?: ReactNode;\n error?: ReactNode;\n disabledMessage?: ReactNode;\n tooltip?: string;\n tooltipContent?: ReactNode;\n}\n\n// eslint-disable-next-line @typescript-eslint/comma-dangle -- comma is required so TS knows this is a generic, not JSX\nexport const withLabels = <P, R = unknown>(Component: ComponentType<P>) => {\n const ComponentWithLabels = forwardRef<R, P & WithLabelsProps>(\n ({ label, hint, error, disabledMessage, tooltip, tooltipContent, id, ...otherProps }, ref) => {\n const componentId = useId({ id, prefix: Component.name });\n\n if (!label)\n return (\n <Component\n ref={ref}\n id={componentId}\n hasError={!!error}\n disabled={!!disabledMessage}\n disabledMessage={disabledMessage}\n {...(otherProps as P)}\n />\n );\n\n return (\n <FlexCol className={styles.rootStack}>\n <FlexRow>\n <Text variant=\"inputLabel\" id={`${componentId}-label`} htmlFor={componentId}>\n {label}\n </Text>\n {(tooltip || tooltipContent) && (\n <BlockTooltip text={tooltip} content={tooltipContent}>\n <HelpIcon\n data-testid=\"tooltip-help\"\n width={theme.sizes.base}\n height={theme.sizes.base}\n color={theme.colors.neutral.ink.light}\n />\n </BlockTooltip>\n )}\n </FlexRow>\n {hint && (\n <Text variant=\"hintText\" as=\"span\" className={styles.hint} id={`${componentId}-hint`}>\n {hint}\n </Text>\n )}\n <Component\n ref={ref}\n id={componentId}\n hasError={!!error}\n disabled={!!disabledMessage}\n disabledMessage={disabledMessage}\n {...(otherProps as P)}\n />\n {error && (\n <FlexRow id={`${componentId}-error`} gap=\"xs\">\n <CriticalIcon width={16} height={16} color={theme.colors.secondary.red.base} />\n <Text variant=\"error\" as=\"span\" className={styles.error}>\n {error}\n </Text>\n </FlexRow>\n )}\n {disabledMessage && (\n <FlexRow id={`${componentId}-disabled`} gap=\"xs\">\n <LockIcon width={16} height={16} color={theme.colors.neutral.ink.light} />\n <Text variant=\"bodyBold\" as=\"span\">\n {disabledMessage}\n </Text>\n </FlexRow>\n )}\n </FlexCol>\n );\n },\n );\n\n ComponentWithLabels.displayName = `withLabels(${Component.displayName || Component.name || 'Component'})`;\n\n return ComponentWithLabels;\n};\n"],"names":["forwardRef","useId","React","FlexCol","styles","FlexRow","Text","BlockTooltip","HelpIcon","theme","CriticalIcon","LockIcon"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA;AACO,MAAM,UAAU,GAAG,CAAiB,SAA2B,KAAI;IACxE,MAAM,mBAAmB,GAAGA,gBAAU,CACpC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,GAAG,UAAU,EAAE,EAAE,GAAG,KAAI;AAC3F,QAAA,MAAM,WAAW,GAAGC,WAAK,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;AAEzD,QAAA,IAAI,CAAC,KAAK;AACR,YAAA,QACEC,sBAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EACR,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,WAAW,EACf,QAAQ,EAAE,CAAC,CAAC,KAAK,EACjB,QAAQ,EAAE,CAAC,CAAC,eAAe,EAC3B,eAAe,EAAE,eAAe,EAAA,GAC3B,UAAgB,EAAA,CACrB;QAGN,QACEA,qCAACC,eAAO,EAAA,EAAC,SAAS,EAAEC,iBAAM,CAAC,SAAS,EAAA;AAClC,YAAAF,sBAAA,CAAA,aAAA,CAACG,eAAO,EAAA,IAAA;AACN,gBAAAH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AM,EAAE,EAAE,EAAE,KAAK,EAAED,WAAK,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAA,CAAI;AAC/E,gBAAAP,sBAAA,CAAA,aAAA,CAACI,SAAI,EAAA,EAAC,OAAO,EAAC,OAAO,EAAC,EAAE,EAAC,MAAM,EAAC,SAAS,EAAEF,iBAAM,CAAC,KAAK,IACpD,KAAK,CACD,CACC,CACX;AACA,YAAA,eAAe,KACdF,sBAAA,CAAA,aAAA,CAACG,eAAO,EAAA,EAAC,EAAE,EAAE,CAAA,EAAG,WAAW,CAAA,SAAA,CAAW,EAAE,GAAG,EAAC,IAAI,EAAA;gBAC9CH,sBAAA,CAAA,aAAA,CAACS,uBAAQ,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAEF,WAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAA,CAAI;AAC1E,gBAAAP,sBAAA,CAAA,aAAA,CAACI,SAAI,EAAA,EAAC,OAAO,EAAC,UAAU,EAAC,EAAE,EAAC,MAAM,EAAA,EAC/B,eAAe,CACX,CACC,CACX,CACO;AAEd,IAAA,CAAC,CACF;AAED,IAAA,mBAAmB,CAAC,WAAW,GAAG,CAAA,WAAA,EAAc,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAAW,GAAG;AAEzG,IAAA,OAAO,mBAAmB;AAC5B;;;;"}
|
|
@@ -15,14 +15,14 @@ const withLabels = (Component) => {
|
|
|
15
15
|
const ComponentWithLabels = forwardRef(({ label, hint, error, disabledMessage, tooltip, tooltipContent, id, ...otherProps }, ref) => {
|
|
16
16
|
const componentId = useId({ id, prefix: Component.name });
|
|
17
17
|
if (!label)
|
|
18
|
-
return (React__default.createElement(Component, { ref: ref, id: componentId, hasError: !!error, disabled: !!disabledMessage, ...otherProps }));
|
|
18
|
+
return (React__default.createElement(Component, { ref: ref, id: componentId, hasError: !!error, disabled: !!disabledMessage, disabledMessage: disabledMessage, ...otherProps }));
|
|
19
19
|
return (React__default.createElement(FlexCol, { className: labelStyles.rootStack },
|
|
20
20
|
React__default.createElement(FlexRow, null,
|
|
21
21
|
React__default.createElement(Text, { variant: "inputLabel", id: `${componentId}-label`, htmlFor: componentId }, label),
|
|
22
22
|
(tooltip || tooltipContent) && (React__default.createElement(BlockTooltip, { text: tooltip, content: tooltipContent },
|
|
23
23
|
React__default.createElement(HelpIcon, { "data-testid": "tooltip-help", width: theme.sizes.base, height: theme.sizes.base, color: theme.colors.neutral.ink.light })))),
|
|
24
|
-
hint && React__default.createElement(Text, { variant: "hintText", as: "span", className: labelStyles.hint, id: `${componentId}-hint` }, hint),
|
|
25
|
-
React__default.createElement(Component, { ref: ref, id: componentId, hasError: !!error, disabled: !!disabledMessage, ...otherProps }),
|
|
24
|
+
hint && (React__default.createElement(Text, { variant: "hintText", as: "span", className: labelStyles.hint, id: `${componentId}-hint` }, hint)),
|
|
25
|
+
React__default.createElement(Component, { ref: ref, id: componentId, hasError: !!error, disabled: !!disabledMessage, disabledMessage: disabledMessage, ...otherProps }),
|
|
26
26
|
error && (React__default.createElement(FlexRow, { id: `${componentId}-error`, gap: "xs" },
|
|
27
27
|
React__default.createElement(CriticalIcon, { width: 16, height: 16, color: theme.colors.secondary.red.base }),
|
|
28
28
|
React__default.createElement(Text, { variant: "error", as: "span", className: labelStyles.error }, error))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLabels.js","sources":["../../../src/hoc/withLabels/withLabels.tsx"],"sourcesContent":["import React, { ComponentType, forwardRef, ReactNode } from 'react';\n\nimport { FlexCol } from '../../components/Flex/FlexCol';\nimport { FlexRow } from '../../components/Flex/FlexRow';\nimport { Text } from '../../components/Text';\nimport { useId } from '../../hooks/useId';\nimport { CriticalIcon, HelpIcon, LockIcon } from '../../icons';\nimport { theme } from '../../theme';\n\nimport { BlockTooltip } from './styled';\nimport styles from './withLabels.module.scss';\n\nexport interface WithLabelsProps {\n id?: string;\n label?: ReactNode;\n hint?: ReactNode;\n error?: ReactNode;\n disabledMessage?: ReactNode;\n tooltip?: string;\n tooltipContent?: ReactNode;\n}\n\n// eslint-disable-next-line @typescript-eslint/comma-dangle -- comma is required so TS knows this is a generic, not JSX\nexport const withLabels = <P, R = unknown>(Component: ComponentType<P>) => {\n const ComponentWithLabels = forwardRef<R, P & WithLabelsProps>(\n ({ label, hint, error, disabledMessage, tooltip, tooltipContent, id, ...otherProps }, ref) => {\n const componentId = useId({ id, prefix: Component.name });\n\n if (!label)\n return (\n <Component\n ref={ref}\n id={componentId}\n hasError={!!error}\n disabled={!!disabledMessage}\n {...(otherProps as P)}\n />\n );\n\n return (\n <FlexCol className={styles.rootStack}>\n <FlexRow>\n <Text variant=\"inputLabel\" id={`${componentId}-label`} htmlFor={componentId}>\n {label}\n </Text>\n {(tooltip || tooltipContent) && (\n <BlockTooltip text={tooltip} content={tooltipContent}>\n <HelpIcon\n data-testid=\"tooltip-help\"\n width={theme.sizes.base}\n height={theme.sizes.base}\n color={theme.colors.neutral.ink.light}\n />\n </BlockTooltip>\n )}\n </FlexRow>\n {hint && <Text variant=\"hintText\" as=\"span\" className={styles.hint} id={`${componentId}-hint`}
|
|
1
|
+
{"version":3,"file":"withLabels.js","sources":["../../../src/hoc/withLabels/withLabels.tsx"],"sourcesContent":["import React, { ComponentType, forwardRef, ReactNode } from 'react';\n\nimport { FlexCol } from '../../components/Flex/FlexCol';\nimport { FlexRow } from '../../components/Flex/FlexRow';\nimport { Text } from '../../components/Text';\nimport { useId } from '../../hooks/useId';\nimport { CriticalIcon, HelpIcon, LockIcon } from '../../icons';\nimport { theme } from '../../theme';\n\nimport { BlockTooltip } from './styled';\nimport styles from './withLabels.module.scss';\n\nexport interface WithLabelsProps {\n id?: string;\n label?: ReactNode;\n hint?: ReactNode;\n error?: ReactNode;\n disabledMessage?: ReactNode;\n tooltip?: string;\n tooltipContent?: ReactNode;\n}\n\n// eslint-disable-next-line @typescript-eslint/comma-dangle -- comma is required so TS knows this is a generic, not JSX\nexport const withLabels = <P, R = unknown>(Component: ComponentType<P>) => {\n const ComponentWithLabels = forwardRef<R, P & WithLabelsProps>(\n ({ label, hint, error, disabledMessage, tooltip, tooltipContent, id, ...otherProps }, ref) => {\n const componentId = useId({ id, prefix: Component.name });\n\n if (!label)\n return (\n <Component\n ref={ref}\n id={componentId}\n hasError={!!error}\n disabled={!!disabledMessage}\n disabledMessage={disabledMessage}\n {...(otherProps as P)}\n />\n );\n\n return (\n <FlexCol className={styles.rootStack}>\n <FlexRow>\n <Text variant=\"inputLabel\" id={`${componentId}-label`} htmlFor={componentId}>\n {label}\n </Text>\n {(tooltip || tooltipContent) && (\n <BlockTooltip text={tooltip} content={tooltipContent}>\n <HelpIcon\n data-testid=\"tooltip-help\"\n width={theme.sizes.base}\n height={theme.sizes.base}\n color={theme.colors.neutral.ink.light}\n />\n </BlockTooltip>\n )}\n </FlexRow>\n {hint && (\n <Text variant=\"hintText\" as=\"span\" className={styles.hint} id={`${componentId}-hint`}>\n {hint}\n </Text>\n )}\n <Component\n ref={ref}\n id={componentId}\n hasError={!!error}\n disabled={!!disabledMessage}\n disabledMessage={disabledMessage}\n {...(otherProps as P)}\n />\n {error && (\n <FlexRow id={`${componentId}-error`} gap=\"xs\">\n <CriticalIcon width={16} height={16} color={theme.colors.secondary.red.base} />\n <Text variant=\"error\" as=\"span\" className={styles.error}>\n {error}\n </Text>\n </FlexRow>\n )}\n {disabledMessage && (\n <FlexRow id={`${componentId}-disabled`} gap=\"xs\">\n <LockIcon width={16} height={16} color={theme.colors.neutral.ink.light} />\n <Text variant=\"bodyBold\" as=\"span\">\n {disabledMessage}\n </Text>\n </FlexRow>\n )}\n </FlexCol>\n );\n },\n );\n\n ComponentWithLabels.displayName = `withLabels(${Component.displayName || Component.name || 'Component'})`;\n\n return ComponentWithLabels;\n};\n"],"names":["React","styles"],"mappings":";;;;;;;;;;;;AAsBA;AACO,MAAM,UAAU,GAAG,CAA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AAC,KAAK,EAAA,CAAI;AAC1E,gBAAAA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,OAAO,EAAC,UAAU,EAAC,EAAE,EAAC,MAAM,EAAA,EAC/B,eAAe,CACX,CACC,CACX,CACO;AAEd,IAAA,CAAC,CACF;AAED,IAAA,mBAAmB,CAAC,WAAW,GAAG,CAAA,WAAA,EAAc,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAAW,GAAG;AAEzG,IAAA,OAAO,mBAAmB;AAC5B;;;;"}
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var styled = require('styled-components');
|
|
4
|
-
var inputStyles = require('../../utils/forms/inputStyles.cjs');
|
|
5
|
-
var index = require('../../theme/index.cjs');
|
|
6
|
-
|
|
7
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
10
|
-
|
|
11
|
-
const dropdownIndicatorStyles = styled.css `--padding-right:${index.theme.sizes[9]};padding-right:var(--padding-right);background-image:url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right ${index.theme.sizes[3]} top 50%,0 0;`;
|
|
12
|
-
const SelectInput = styled__default.default.select.withConfig({ displayName: "vui--SelectInput", componentId: "vui--1v4mu6a" }) `${inputStyles.inputFullStyles} ${dropdownIndicatorStyles} &:has(option:disabled:checked){color:${index.theme.colors.neutral.ink.light};}`;
|
|
13
|
-
|
|
14
|
-
exports.SelectInput = SelectInput;
|
|
15
|
-
exports.dropdownIndicatorStyles = dropdownIndicatorStyles;
|
|
16
|
-
//# sourceMappingURL=styled.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styled.cjs","sources":["../../../src/components/Select/styled.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { inputFullStyles } from '../../utils/forms/inputStyles';\nimport { theme } from '../../theme';\n\nexport const dropdownIndicatorStyles = css`\n --padding-right: ${theme.sizes[9]};\n\n padding-right: var(--padding-right);\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position:\n right ${theme.sizes[3]} top 50%,\n 0 0;\n`;\n\nexport const SelectInput = styled.select<any>`\n ${inputFullStyles}\n ${dropdownIndicatorStyles}\n\n /* Simulate placeholder styles when a disabled option is selected */\n &:has(option:disabled:checked) {\n color: ${theme.colors.neutral.ink.light};\n }\n`;\n"],"names":["css","theme","styled","inputFullStyles"],"mappings":";;;;;;;;;;MAIa,uBAAuB,GAAGA,UAAG,CAAA,CAAA,gBAAA,EACrBC,WAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,+UAAA,EAMvBA,WAAK,CAAC,KAAK,CAAC,CAAC,CAAC;MAIb,WAAW,GAAGC,uBAAM,CAAC,MAAM,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,kBAAA,EAAA,WAAA,EAAA,cAAA,EAAA,CAAA,CAAA,CAAA,EACpCC,2BAAe,CAAA,CAAA,EACf,uBAAuB,yCAIdF,WAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAA,EAAA;;;;;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
2
|
-
import { inputFullStyles } from '../../utils/forms/inputStyles.js';
|
|
3
|
-
import { theme } from '../../theme/index.js';
|
|
4
|
-
|
|
5
|
-
const dropdownIndicatorStyles = css `--padding-right:${theme.sizes[9]};padding-right:var(--padding-right);background-image:url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right ${theme.sizes[3]} top 50%,0 0;`;
|
|
6
|
-
const SelectInput = styled.select.withConfig({ displayName: "vui--SelectInput", componentId: "vui--1v4mu6a" }) `${inputFullStyles} ${dropdownIndicatorStyles} &:has(option:disabled:checked){color:${theme.colors.neutral.ink.light};}`;
|
|
7
|
-
|
|
8
|
-
export { SelectInput, dropdownIndicatorStyles };
|
|
9
|
-
//# sourceMappingURL=styled.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sources":["../../../src/components/Select/styled.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { inputFullStyles } from '../../utils/forms/inputStyles';\nimport { theme } from '../../theme';\n\nexport const dropdownIndicatorStyles = css`\n --padding-right: ${theme.sizes[9]};\n\n padding-right: var(--padding-right);\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position:\n right ${theme.sizes[3]} top 50%,\n 0 0;\n`;\n\nexport const SelectInput = styled.select<any>`\n ${inputFullStyles}\n ${dropdownIndicatorStyles}\n\n /* Simulate placeholder styles when a disabled option is selected */\n &:has(option:disabled:checked) {\n color: ${theme.colors.neutral.ink.light};\n }\n`;\n"],"names":[],"mappings":";;;;MAIa,uBAAuB,GAAG,GAAG,CAAA,CAAA,gBAAA,EACrB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,+UAAA,EAMvB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;MAIb,WAAW,GAAG,MAAM,CAAC,MAAM,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,kBAAA,EAAA,WAAA,EAAA,cAAA,EAAA,CAAA,CAAA,CAAA,EACpC,eAAe,CAAA,CAAA,EACf,uBAAuB,yCAId,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAA,EAAA;;;;"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var styled = require('styled-components');
|
|
4
|
-
var inputStyles = require('../../utils/forms/inputStyles.cjs');
|
|
5
|
-
var index = require('../../theme/index.cjs');
|
|
6
|
-
|
|
7
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
10
|
-
|
|
11
|
-
const Input = styled__default.default.input.withConfig({ displayName: "vui--Input", componentId: "vui--3jt15a" }) `${inputStyles.inputFullStyles} width:100%;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}&[type='number']{-moz-appearance:textfield;min-width:8ch;text-align:right;}`;
|
|
12
|
-
const Textarea = styled__default.default.textarea.withConfig({ displayName: "vui--Textarea", componentId: "vui--1k04ik" }) `${inputStyles.inputFullStyles} padding-block:${index.theme.sizes[2]};`;
|
|
13
|
-
|
|
14
|
-
exports.Input = Input;
|
|
15
|
-
exports.Textarea = Textarea;
|
|
16
|
-
//# sourceMappingURL=styled.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styled.cjs","sources":["../../../src/components/TextField/styled.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { inputFullStyles } from '../../utils/forms/inputStyles';\nimport { theme } from '../../theme';\n\nexport const Input = styled.input<any>`\n ${inputFullStyles}\n\n /* Overrides browser default width - note: this breaks the native [size] attribute */\n width: 100%;\n\n /* Hide number arrows/spinners */\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n &[type='number'] {\n -moz-appearance: textfield;\n min-width: 8ch;\n text-align: right;\n }\n`;\n\nexport const Textarea = styled.textarea<any>`\n ${inputFullStyles}\n\n padding-block: ${theme.sizes[2]};\n`;\n"],"names":["styled","inputFullStyles","theme"],"mappings":";;;;;;;;;;AAIO,MAAM,KAAK,GAAGA,uBAAM,CAAC,KAAK,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,YAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,EAC7BC,2BAAe,CAAA,mLAAA;AAkBZ,MAAM,QAAQ,GAAGD,uBAAM,CAAC,QAAQ,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,eAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,EACnCC,2BAAe,CAAA,eAAA,EAEAC,WAAK,CAAC,KAAK,CAAC,CAAC,CAAC;;;;;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { inputFullStyles } from '../../utils/forms/inputStyles.js';
|
|
3
|
-
import { theme } from '../../theme/index.js';
|
|
4
|
-
|
|
5
|
-
const Input = styled.input.withConfig({ displayName: "vui--Input", componentId: "vui--3jt15a" }) `${inputFullStyles} width:100%;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}&[type='number']{-moz-appearance:textfield;min-width:8ch;text-align:right;}`;
|
|
6
|
-
const Textarea = styled.textarea.withConfig({ displayName: "vui--Textarea", componentId: "vui--1k04ik" }) `${inputFullStyles} padding-block:${theme.sizes[2]};`;
|
|
7
|
-
|
|
8
|
-
export { Input, Textarea };
|
|
9
|
-
//# sourceMappingURL=styled.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sources":["../../../src/components/TextField/styled.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { inputFullStyles } from '../../utils/forms/inputStyles';\nimport { theme } from '../../theme';\n\nexport const Input = styled.input<any>`\n ${inputFullStyles}\n\n /* Overrides browser default width - note: this breaks the native [size] attribute */\n width: 100%;\n\n /* Hide number arrows/spinners */\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n &[type='number'] {\n -moz-appearance: textfield;\n min-width: 8ch;\n text-align: right;\n }\n`;\n\nexport const Textarea = styled.textarea<any>`\n ${inputFullStyles}\n\n padding-block: ${theme.sizes[2]};\n`;\n"],"names":[],"mappings":";;;;AAIO,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,YAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,EAC7B,eAAe,CAAA,mLAAA;AAkBZ,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,eAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,EACnC,eAAe,CAAA,eAAA,EAEA,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;;;;"}
|