@transferwise/components 0.0.0-experimental-d16bb5a → 0.0.0-experimental-fe2498c
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/build/field/Field.js +11 -0
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +11 -0
- package/build/field/Field.mjs.map +1 -1
- package/build/index.js +99 -99
- package/build/index.mjs +25 -25
- package/build/inputs/SelectInput.js +4 -36
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +5 -37
- package/build/inputs/SelectInput.mjs.map +1 -1
- package/build/inputs/_BottomSheet.js +2 -5
- package/build/inputs/_BottomSheet.js.map +1 -1
- package/build/inputs/_BottomSheet.mjs +3 -6
- package/build/inputs/_BottomSheet.mjs.map +1 -1
- package/build/inputs/_Popover.js +0 -2
- package/build/inputs/_Popover.js.map +1 -1
- package/build/inputs/_Popover.mjs +0 -2
- package/build/inputs/_Popover.mjs.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.js +11 -0
- package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.mjs +11 -0
- package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
- package/build/main.css +6 -0
- package/build/styles/main.css +6 -0
- package/build/styles/prompt/ActionPrompt/ActionPrompt.css +3 -0
- package/build/styles/prompt/InfoPrompt/InfoPrompt.css +3 -0
- package/build/typeahead/Typeahead.js +11 -0
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +11 -0
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +1 -2
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/build/types/inputs/_Popover.d.ts.map +1 -1
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +31 -0
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -0
- package/build/types/prompt/ActionPrompt/index.d.ts +3 -0
- package/build/types/prompt/ActionPrompt/index.d.ts.map +1 -0
- package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts +23 -0
- package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -0
- package/build/types/prompt/InfoPrompt/index.d.ts +3 -0
- package/build/types/prompt/InfoPrompt/index.d.ts.map +1 -0
- package/build/types/prompt/index.d.ts +4 -0
- package/build/types/prompt/index.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/inputs/SelectInput.spec.tsx +7 -57
- package/src/inputs/SelectInput.story.tsx +0 -68
- package/src/inputs/SelectInput.tsx +14 -71
- package/src/inputs/_BottomSheet.tsx +4 -7
- package/src/inputs/_Popover.tsx +0 -2
- package/src/main.css +6 -0
- package/src/main.less +2 -0
- package/src/moneyInput/MoneyInput.spec.tsx +7 -26
- package/src/prompt/ActionPrompt/ActionPrompt.css +3 -0
- package/src/prompt/ActionPrompt/ActionPrompt.less +3 -0
- package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +174 -0
- package/src/prompt/ActionPrompt/ActionPrompt.tsx +109 -0
- package/src/prompt/ActionPrompt/index.ts +2 -0
- package/src/prompt/InfoPrompt/InfoPrompt.css +3 -0
- package/src/prompt/InfoPrompt/InfoPrompt.less +3 -0
- package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +216 -0
- package/src/prompt/InfoPrompt/InfoPrompt.tsx +92 -0
- package/src/prompt/InfoPrompt/index.ts +2 -0
- package/src/prompt/index.ts +8 -0
package/build/field/Field.js
CHANGED
|
@@ -26,6 +26,17 @@ require('react-intl');
|
|
|
26
26
|
require('../common/closeButton/CloseButton.messages.js');
|
|
27
27
|
var jsxRuntime = require('react/jsx-runtime');
|
|
28
28
|
var InlinePrompt = require('../prompt/InlinePrompt/InlinePrompt.js');
|
|
29
|
+
require('../statusIcon/StatusIcon.js');
|
|
30
|
+
require('../body/Body.js');
|
|
31
|
+
require('../button/Button.resolver.js');
|
|
32
|
+
require('../title/Title.js');
|
|
33
|
+
require('../badge/Badge.js');
|
|
34
|
+
require('@wise/art');
|
|
35
|
+
require('@transferwise/neptune-validation');
|
|
36
|
+
require('../provider/direction/DirectionProvider.js');
|
|
37
|
+
require('../sentimentSurface/SentimentSurface.js');
|
|
38
|
+
require('../primitives/PrimitiveButton/PrimitiveButton.js');
|
|
39
|
+
require('../primitives/PrimitiveAnchor/PrimitiveAnchor.js');
|
|
29
40
|
var contexts = require('../inputs/contexts.js');
|
|
30
41
|
var Label = require('../label/Label.js');
|
|
31
42
|
|
package/build/field/Field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../src/field/Field.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useRef } from 'react';\n\nimport { Sentiment } from '../common';\nimport { InlinePrompt, type InlinePromptProps } from '../prompt';\nimport {\n FieldLabelContextProvider,\n InputDescribedByProvider,\n InputIdContextProvider,\n InputInvalidProvider,\n} from '../inputs/contexts';\nimport { Label } from '../label';\n\nexport type FieldProps = {\n /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */\n id?: string | null;\n /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */\n label?: React.ReactNode;\n required?: boolean;\n /** @deprecated use `description` prop instead */\n hint?: React.ReactNode;\n message?: React.ReactNode;\n /**\n * Override for the [InlinePrompt icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n messageIconLabel?: string;\n /**\n * If true, shows a loading spinner in place of the message icon of the InlinePrompt\n */\n messageLoading?: boolean;\n description?: React.ReactNode;\n /** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */\n error?: React.ReactNode;\n sentiment?: InlinePromptProps['sentiment'];\n className?: string;\n children?: React.ReactNode;\n};\n\nexport const Field = ({\n id,\n label,\n required = true,\n message: propMessage,\n messageIconLabel,\n messageLoading,\n hint,\n description = hint,\n sentiment: propType = Sentiment.NEUTRAL,\n className,\n children,\n ...props\n}: FieldProps) => {\n const labelRef = useRef<HTMLLabelElement>(null);\n const sentiment = props.error ? Sentiment.NEGATIVE : propType;\n const message = propMessage || props.error;\n const hasError = sentiment === Sentiment.NEGATIVE;\n\n const labelId = useId();\n\n const fallbackInputId = useId();\n const inputId = id !== null ? (id ?? fallbackInputId) : undefined;\n\n const messageId = useId();\n const descriptionId = useId();\n\n /**\n * form control can have multiple messages to describe it,\n * e.g the description underneath the label and inline alert\n */\n function ariaDescribedbyByIds() {\n const messageIds = [];\n if (description) {\n messageIds.push(descriptionId);\n }\n if (message) {\n messageIds.push(messageId);\n }\n return messageIds.length > 0 ? messageIds.join(' ') : undefined;\n }\n\n return (\n <FieldLabelContextProvider value={{ id: labelId, ref: labelRef }}>\n <InputIdContextProvider value={inputId}>\n <InputDescribedByProvider value={ariaDescribedbyByIds()}>\n <InputInvalidProvider value={hasError}>\n <div\n className={clsx(\n 'np-field form-group d-block',\n {\n 'has-success': sentiment === Sentiment.POSITIVE,\n 'has-warning': sentiment === Sentiment.WARNING,\n 'has-error': hasError,\n 'has-info': sentiment === Sentiment.NEUTRAL,\n },\n className,\n )}\n >\n {label != null ? (\n <>\n <Label ref={labelRef} id={labelId} htmlFor={inputId}>\n {required ? label : <Label.Optional>{label}</Label.Optional>}\n </Label>\n <Label.Description id={descriptionId}>{description}</Label.Description>\n <div className=\"np-field-control\">{children}</div>\n </>\n ) : (\n children\n )}\n\n {message && (\n <InlinePrompt\n sentiment={sentiment}\n id={messageId}\n mediaLabel={messageIconLabel}\n className=\"np-field__prompt\"\n loading={messageLoading}\n width=\"full\"\n >\n {message}\n </InlinePrompt>\n )}\n </div>\n </InputInvalidProvider>\n </InputDescribedByProvider>\n </InputIdContextProvider>\n </FieldLabelContextProvider>\n );\n};\n"],"names":["Field","id","label","required","message","propMessage","messageIconLabel","messageLoading","hint","description","sentiment","propType","Sentiment","NEUTRAL","className","children","props","labelRef","useRef","error","NEGATIVE","hasError","labelId","useId","fallbackInputId","inputId","undefined","messageId","descriptionId","ariaDescribedbyByIds","messageIds","push","length","join","_jsx","FieldLabelContextProvider","value","ref","InputIdContextProvider","InputDescribedByProvider","InputInvalidProvider","_jsxs","clsx","POSITIVE","WARNING","_Fragment","Label","htmlFor","Optional","Description","InlinePrompt","mediaLabel","loading","width"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Field.js","sources":["../../src/field/Field.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useRef } from 'react';\n\nimport { Sentiment } from '../common';\nimport { InlinePrompt, type InlinePromptProps } from '../prompt';\nimport {\n FieldLabelContextProvider,\n InputDescribedByProvider,\n InputIdContextProvider,\n InputInvalidProvider,\n} from '../inputs/contexts';\nimport { Label } from '../label';\n\nexport type FieldProps = {\n /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */\n id?: string | null;\n /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */\n label?: React.ReactNode;\n required?: boolean;\n /** @deprecated use `description` prop instead */\n hint?: React.ReactNode;\n message?: React.ReactNode;\n /**\n * Override for the [InlinePrompt icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n messageIconLabel?: string;\n /**\n * If true, shows a loading spinner in place of the message icon of the InlinePrompt\n */\n messageLoading?: boolean;\n description?: React.ReactNode;\n /** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */\n error?: React.ReactNode;\n sentiment?: InlinePromptProps['sentiment'];\n className?: string;\n children?: React.ReactNode;\n};\n\nexport const Field = ({\n id,\n label,\n required = true,\n message: propMessage,\n messageIconLabel,\n messageLoading,\n hint,\n description = hint,\n sentiment: propType = Sentiment.NEUTRAL,\n className,\n children,\n ...props\n}: FieldProps) => {\n const labelRef = useRef<HTMLLabelElement>(null);\n const sentiment = props.error ? Sentiment.NEGATIVE : propType;\n const message = propMessage || props.error;\n const hasError = sentiment === Sentiment.NEGATIVE;\n\n const labelId = useId();\n\n const fallbackInputId = useId();\n const inputId = id !== null ? (id ?? fallbackInputId) : undefined;\n\n const messageId = useId();\n const descriptionId = useId();\n\n /**\n * form control can have multiple messages to describe it,\n * e.g the description underneath the label and inline alert\n */\n function ariaDescribedbyByIds() {\n const messageIds = [];\n if (description) {\n messageIds.push(descriptionId);\n }\n if (message) {\n messageIds.push(messageId);\n }\n return messageIds.length > 0 ? messageIds.join(' ') : undefined;\n }\n\n return (\n <FieldLabelContextProvider value={{ id: labelId, ref: labelRef }}>\n <InputIdContextProvider value={inputId}>\n <InputDescribedByProvider value={ariaDescribedbyByIds()}>\n <InputInvalidProvider value={hasError}>\n <div\n className={clsx(\n 'np-field form-group d-block',\n {\n 'has-success': sentiment === Sentiment.POSITIVE,\n 'has-warning': sentiment === Sentiment.WARNING,\n 'has-error': hasError,\n 'has-info': sentiment === Sentiment.NEUTRAL,\n },\n className,\n )}\n >\n {label != null ? (\n <>\n <Label ref={labelRef} id={labelId} htmlFor={inputId}>\n {required ? label : <Label.Optional>{label}</Label.Optional>}\n </Label>\n <Label.Description id={descriptionId}>{description}</Label.Description>\n <div className=\"np-field-control\">{children}</div>\n </>\n ) : (\n children\n )}\n\n {message && (\n <InlinePrompt\n sentiment={sentiment}\n id={messageId}\n mediaLabel={messageIconLabel}\n className=\"np-field__prompt\"\n loading={messageLoading}\n width=\"full\"\n >\n {message}\n </InlinePrompt>\n )}\n </div>\n </InputInvalidProvider>\n </InputDescribedByProvider>\n </InputIdContextProvider>\n </FieldLabelContextProvider>\n );\n};\n"],"names":["Field","id","label","required","message","propMessage","messageIconLabel","messageLoading","hint","description","sentiment","propType","Sentiment","NEUTRAL","className","children","props","labelRef","useRef","error","NEGATIVE","hasError","labelId","useId","fallbackInputId","inputId","undefined","messageId","descriptionId","ariaDescribedbyByIds","messageIds","push","length","join","_jsx","FieldLabelContextProvider","value","ref","InputIdContextProvider","InputDescribedByProvider","InputInvalidProvider","_jsxs","clsx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AAAC,eACvD,CACP,eAAAgC,cAAA,CAACY,WAAK,CAACG,WAAW,EAAA;AAAChD,gBAAAA,EAAE,EAAE2B,aAAc;AAAAb,gBAAAA,QAAA,EAAEN;eAA+B,CACtE,eAAAyB,cAAA,CAAA,KAAA,EAAA;AAAKpB,gBAAAA,SAAS,EAAC,kBAAkB;AAAAC,gBAAAA,QAAA,EAAEA;AAAQ,eAAM,CACnD;aAAA,CAAG,GAEHA,QACD,EAEAX,OAAO,iBACN8B,cAAA,CAACgB,yBAAY,EAAA;AACXxC,cAAAA,SAAS,EAAEA,WAAU;AACrBT,cAAAA,EAAE,EAAE0B,SAAU;AACdwB,cAAAA,UAAU,EAAE7C,gBAAiB;AAC7BQ,cAAAA,SAAS,EAAC,kBAAkB;AAC5BsC,cAAAA,OAAO,EAAE7C,cAAe;AACxB8C,cAAAA,KAAK,EAAC,MAAM;AAAAtC,cAAAA,QAAA,EAEXX;AAAO,aACI,CACf;WACE;SACe;OACE;KACJ;AAC1B,GAA2B,CAAC;AAEhC;;;;"}
|
package/build/field/Field.mjs
CHANGED
|
@@ -24,6 +24,17 @@ import 'react-intl';
|
|
|
24
24
|
import '../common/closeButton/CloseButton.messages.mjs';
|
|
25
25
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
26
26
|
import { InlinePrompt } from '../prompt/InlinePrompt/InlinePrompt.mjs';
|
|
27
|
+
import '../statusIcon/StatusIcon.mjs';
|
|
28
|
+
import '../body/Body.mjs';
|
|
29
|
+
import '../button/Button.resolver.mjs';
|
|
30
|
+
import '../title/Title.mjs';
|
|
31
|
+
import '../badge/Badge.mjs';
|
|
32
|
+
import '@wise/art';
|
|
33
|
+
import '@transferwise/neptune-validation';
|
|
34
|
+
import '../provider/direction/DirectionProvider.mjs';
|
|
35
|
+
import '../sentimentSurface/SentimentSurface.mjs';
|
|
36
|
+
import '../primitives/PrimitiveButton/PrimitiveButton.mjs';
|
|
37
|
+
import '../primitives/PrimitiveAnchor/PrimitiveAnchor.mjs';
|
|
27
38
|
import { FieldLabelContextProvider, InputIdContextProvider, InputDescribedByProvider, InputInvalidProvider } from '../inputs/contexts.mjs';
|
|
28
39
|
import { Label as LabelNamespace } from '../label/Label.mjs';
|
|
29
40
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.mjs","sources":["../../src/field/Field.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useRef } from 'react';\n\nimport { Sentiment } from '../common';\nimport { InlinePrompt, type InlinePromptProps } from '../prompt';\nimport {\n FieldLabelContextProvider,\n InputDescribedByProvider,\n InputIdContextProvider,\n InputInvalidProvider,\n} from '../inputs/contexts';\nimport { Label } from '../label';\n\nexport type FieldProps = {\n /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */\n id?: string | null;\n /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */\n label?: React.ReactNode;\n required?: boolean;\n /** @deprecated use `description` prop instead */\n hint?: React.ReactNode;\n message?: React.ReactNode;\n /**\n * Override for the [InlinePrompt icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n messageIconLabel?: string;\n /**\n * If true, shows a loading spinner in place of the message icon of the InlinePrompt\n */\n messageLoading?: boolean;\n description?: React.ReactNode;\n /** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */\n error?: React.ReactNode;\n sentiment?: InlinePromptProps['sentiment'];\n className?: string;\n children?: React.ReactNode;\n};\n\nexport const Field = ({\n id,\n label,\n required = true,\n message: propMessage,\n messageIconLabel,\n messageLoading,\n hint,\n description = hint,\n sentiment: propType = Sentiment.NEUTRAL,\n className,\n children,\n ...props\n}: FieldProps) => {\n const labelRef = useRef<HTMLLabelElement>(null);\n const sentiment = props.error ? Sentiment.NEGATIVE : propType;\n const message = propMessage || props.error;\n const hasError = sentiment === Sentiment.NEGATIVE;\n\n const labelId = useId();\n\n const fallbackInputId = useId();\n const inputId = id !== null ? (id ?? fallbackInputId) : undefined;\n\n const messageId = useId();\n const descriptionId = useId();\n\n /**\n * form control can have multiple messages to describe it,\n * e.g the description underneath the label and inline alert\n */\n function ariaDescribedbyByIds() {\n const messageIds = [];\n if (description) {\n messageIds.push(descriptionId);\n }\n if (message) {\n messageIds.push(messageId);\n }\n return messageIds.length > 0 ? messageIds.join(' ') : undefined;\n }\n\n return (\n <FieldLabelContextProvider value={{ id: labelId, ref: labelRef }}>\n <InputIdContextProvider value={inputId}>\n <InputDescribedByProvider value={ariaDescribedbyByIds()}>\n <InputInvalidProvider value={hasError}>\n <div\n className={clsx(\n 'np-field form-group d-block',\n {\n 'has-success': sentiment === Sentiment.POSITIVE,\n 'has-warning': sentiment === Sentiment.WARNING,\n 'has-error': hasError,\n 'has-info': sentiment === Sentiment.NEUTRAL,\n },\n className,\n )}\n >\n {label != null ? (\n <>\n <Label ref={labelRef} id={labelId} htmlFor={inputId}>\n {required ? label : <Label.Optional>{label}</Label.Optional>}\n </Label>\n <Label.Description id={descriptionId}>{description}</Label.Description>\n <div className=\"np-field-control\">{children}</div>\n </>\n ) : (\n children\n )}\n\n {message && (\n <InlinePrompt\n sentiment={sentiment}\n id={messageId}\n mediaLabel={messageIconLabel}\n className=\"np-field__prompt\"\n loading={messageLoading}\n width=\"full\"\n >\n {message}\n </InlinePrompt>\n )}\n </div>\n </InputInvalidProvider>\n </InputDescribedByProvider>\n </InputIdContextProvider>\n </FieldLabelContextProvider>\n );\n};\n"],"names":["Field","id","label","required","message","propMessage","messageIconLabel","messageLoading","hint","description","sentiment","propType","Sentiment","NEUTRAL","className","children","props","labelRef","useRef","error","NEGATIVE","hasError","labelId","useId","fallbackInputId","inputId","undefined","messageId","descriptionId","ariaDescribedbyByIds","messageIds","push","length","join","_jsx","FieldLabelContextProvider","value","ref","InputIdContextProvider","InputDescribedByProvider","InputInvalidProvider","_jsxs","clsx","POSITIVE","WARNING","_Fragment","Label","htmlFor","Optional","Description","InlinePrompt","mediaLabel","loading","width"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Field.mjs","sources":["../../src/field/Field.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useRef } from 'react';\n\nimport { Sentiment } from '../common';\nimport { InlinePrompt, type InlinePromptProps } from '../prompt';\nimport {\n FieldLabelContextProvider,\n InputDescribedByProvider,\n InputIdContextProvider,\n InputInvalidProvider,\n} from '../inputs/contexts';\nimport { Label } from '../label';\n\nexport type FieldProps = {\n /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */\n id?: string | null;\n /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */\n label?: React.ReactNode;\n required?: boolean;\n /** @deprecated use `description` prop instead */\n hint?: React.ReactNode;\n message?: React.ReactNode;\n /**\n * Override for the [InlinePrompt icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n messageIconLabel?: string;\n /**\n * If true, shows a loading spinner in place of the message icon of the InlinePrompt\n */\n messageLoading?: boolean;\n description?: React.ReactNode;\n /** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */\n error?: React.ReactNode;\n sentiment?: InlinePromptProps['sentiment'];\n className?: string;\n children?: React.ReactNode;\n};\n\nexport const Field = ({\n id,\n label,\n required = true,\n message: propMessage,\n messageIconLabel,\n messageLoading,\n hint,\n description = hint,\n sentiment: propType = Sentiment.NEUTRAL,\n className,\n children,\n ...props\n}: FieldProps) => {\n const labelRef = useRef<HTMLLabelElement>(null);\n const sentiment = props.error ? Sentiment.NEGATIVE : propType;\n const message = propMessage || props.error;\n const hasError = sentiment === Sentiment.NEGATIVE;\n\n const labelId = useId();\n\n const fallbackInputId = useId();\n const inputId = id !== null ? (id ?? fallbackInputId) : undefined;\n\n const messageId = useId();\n const descriptionId = useId();\n\n /**\n * form control can have multiple messages to describe it,\n * e.g the description underneath the label and inline alert\n */\n function ariaDescribedbyByIds() {\n const messageIds = [];\n if (description) {\n messageIds.push(descriptionId);\n }\n if (message) {\n messageIds.push(messageId);\n }\n return messageIds.length > 0 ? messageIds.join(' ') : undefined;\n }\n\n return (\n <FieldLabelContextProvider value={{ id: labelId, ref: labelRef }}>\n <InputIdContextProvider value={inputId}>\n <InputDescribedByProvider value={ariaDescribedbyByIds()}>\n <InputInvalidProvider value={hasError}>\n <div\n className={clsx(\n 'np-field form-group d-block',\n {\n 'has-success': sentiment === Sentiment.POSITIVE,\n 'has-warning': sentiment === Sentiment.WARNING,\n 'has-error': hasError,\n 'has-info': sentiment === Sentiment.NEUTRAL,\n },\n className,\n )}\n >\n {label != null ? (\n <>\n <Label ref={labelRef} id={labelId} htmlFor={inputId}>\n {required ? label : <Label.Optional>{label}</Label.Optional>}\n </Label>\n <Label.Description id={descriptionId}>{description}</Label.Description>\n <div className=\"np-field-control\">{children}</div>\n </>\n ) : (\n children\n )}\n\n {message && (\n <InlinePrompt\n sentiment={sentiment}\n id={messageId}\n mediaLabel={messageIconLabel}\n className=\"np-field__prompt\"\n loading={messageLoading}\n width=\"full\"\n >\n {message}\n </InlinePrompt>\n )}\n </div>\n </InputInvalidProvider>\n </InputDescribedByProvider>\n </InputIdContextProvider>\n </FieldLabelContextProvider>\n );\n};\n"],"names":["Field","id","label","required","message","propMessage","messageIconLabel","messageLoading","hint","description","sentiment","propType","Sentiment","NEUTRAL","className","children","props","labelRef","useRef","error","NEGATIVE","hasError","labelId","useId","fallbackInputId","inputId","undefined","messageId","descriptionId","ariaDescribedbyByIds","messageIds","push","length","join","_jsx","FieldLabelContextProvider","value","ref","InputIdContextProvider","InputDescribedByProvider","InputInvalidProvider","_jsxs","clsx","POSITIVE","WARNING","_Fragment","Label","htmlFor","Optional","Description","InlinePrompt","mediaLabel","loading","width"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAMA,KAAK,GAAGA,CAAC;EACpBC,EAAE;EACFC,KAAK;AACLC,EAAAA,QAAQ,GAAG,IAAI;AACfC,EAA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AEA;AAAQ,eAAM,CACnD;aAAA,CAAG,GAEHA,QACD,EAEAX,OAAO,iBACN8B,GAAA,CAACgB,YAAY,EAAA;AACXxC,cAAAA,SAAS,EAAEA,SAAU;AACrBT,cAAAA,EAAE,EAAE0B,SAAU;AACdwB,cAAAA,UAAU,EAAE7C,gBAAiB;AAC7BQ,cAAAA,SAAS,EAAC,kBAAkB;AAC5BsC,cAAAA,OAAO,EAAE7C,cAAe;AACxB8C,cAAAA,KAAK,EAAC,MAAM;AAAAtC,cAAAA,QAAA,EAEXX;AAAO,aACI,CACf;WACE;SACe;OACE;KACJ;AAC1B,GAA2B,CAAC;AAEhC;;;;"}
|
package/build/index.js
CHANGED
|
@@ -52,6 +52,31 @@ var infoPresentations = require('./info/infoPresentations.js');
|
|
|
52
52
|
var Info = require('./info/Info.js');
|
|
53
53
|
var InlineAlert = require('./inlineAlert/InlineAlert.js');
|
|
54
54
|
var InlinePrompt = require('./prompt/InlinePrompt/InlinePrompt.js');
|
|
55
|
+
var documentIosClick = require('./common/domHelpers/documentIosClick.js');
|
|
56
|
+
var theme = require('./common/theme.js');
|
|
57
|
+
var direction = require('./common/direction.js');
|
|
58
|
+
var control = require('./common/propsValues/control.js');
|
|
59
|
+
var size = require('./common/propsValues/size.js');
|
|
60
|
+
var typography = require('./common/propsValues/typography.js');
|
|
61
|
+
var width = require('./common/propsValues/width.js');
|
|
62
|
+
var type = require('./common/propsValues/type.js');
|
|
63
|
+
var dateMode = require('./common/propsValues/dateMode.js');
|
|
64
|
+
var monthFormat = require('./common/propsValues/monthFormat.js');
|
|
65
|
+
var position = require('./common/propsValues/position.js');
|
|
66
|
+
var layouts = require('./common/propsValues/layouts.js');
|
|
67
|
+
var status = require('./common/propsValues/status.js');
|
|
68
|
+
var sentiment = require('./common/propsValues/sentiment.js');
|
|
69
|
+
var profileType = require('./common/propsValues/profileType.js');
|
|
70
|
+
var variant = require('./common/propsValues/variant.js');
|
|
71
|
+
var scroll = require('./common/propsValues/scroll.js');
|
|
72
|
+
var markdownNodeType = require('./common/propsValues/markdownNodeType.js');
|
|
73
|
+
var fileType = require('./common/fileType.js');
|
|
74
|
+
var index = require('./common/locale/index.js');
|
|
75
|
+
var colors = require('./common/colors.js');
|
|
76
|
+
require('react-intl');
|
|
77
|
+
require('./common/closeButton/CloseButton.messages.js');
|
|
78
|
+
var Title = require('./title/Title.js');
|
|
79
|
+
var SentimentSurface = require('./sentimentSurface/SentimentSurface.js');
|
|
55
80
|
var InputWithDisplayFormat = require('./inputWithDisplayFormat/InputWithDisplayFormat.js');
|
|
56
81
|
var Input = require('./inputs/Input.js');
|
|
57
82
|
var InputGroup = require('./inputs/InputGroup.js');
|
|
@@ -91,7 +116,6 @@ var ResponsivePanel = require('./common/responsivePanel/ResponsivePanel.js');
|
|
|
91
116
|
var Section = require('./section/Section.js');
|
|
92
117
|
var SegmentedControl = require('./segmentedControl/SegmentedControl.js');
|
|
93
118
|
var Select = require('./select/Select.js');
|
|
94
|
-
var SentimentSurface = require('./sentimentSurface/SentimentSurface.js');
|
|
95
119
|
var SlidingPanel = require('./slidingPanel/SlidingPanel.js');
|
|
96
120
|
var Snackbar = require('./snackbar/Snackbar.js');
|
|
97
121
|
var SnackbarContext = require('./snackbar/SnackbarContext.js');
|
|
@@ -103,7 +127,6 @@ var Switch = require('./switch/Switch.js');
|
|
|
103
127
|
var SwitchOption = require('./switchOption/SwitchOption.js');
|
|
104
128
|
var Tabs = require('./tabs/Tabs.js');
|
|
105
129
|
var TextareaWithDisplayFormat = require('./textareaWithDisplayFormat/TextareaWithDisplayFormat.js');
|
|
106
|
-
var Title = require('./title/Title.js');
|
|
107
130
|
var Tooltip = require('./tooltip/Tooltip.js');
|
|
108
131
|
var Typeahead = require('./typeahead/Typeahead.js');
|
|
109
132
|
var Upload = require('./upload/Upload.js');
|
|
@@ -116,29 +139,6 @@ var useDirection = require('./common/hooks/useDirection/useDirection.js');
|
|
|
116
139
|
var useLayout = require('./common/hooks/useLayout/useLayout.js');
|
|
117
140
|
var useScreenSize = require('./common/hooks/useScreenSize.js');
|
|
118
141
|
var useSnackbar = require('./snackbar/useSnackbar.js');
|
|
119
|
-
var documentIosClick = require('./common/domHelpers/documentIosClick.js');
|
|
120
|
-
var theme = require('./common/theme.js');
|
|
121
|
-
var direction = require('./common/direction.js');
|
|
122
|
-
var control = require('./common/propsValues/control.js');
|
|
123
|
-
var size = require('./common/propsValues/size.js');
|
|
124
|
-
var typography = require('./common/propsValues/typography.js');
|
|
125
|
-
var width = require('./common/propsValues/width.js');
|
|
126
|
-
var type = require('./common/propsValues/type.js');
|
|
127
|
-
var dateMode = require('./common/propsValues/dateMode.js');
|
|
128
|
-
var monthFormat = require('./common/propsValues/monthFormat.js');
|
|
129
|
-
var position = require('./common/propsValues/position.js');
|
|
130
|
-
var layouts = require('./common/propsValues/layouts.js');
|
|
131
|
-
var status = require('./common/propsValues/status.js');
|
|
132
|
-
var sentiment = require('./common/propsValues/sentiment.js');
|
|
133
|
-
var profileType = require('./common/propsValues/profileType.js');
|
|
134
|
-
var variant = require('./common/propsValues/variant.js');
|
|
135
|
-
var scroll = require('./common/propsValues/scroll.js');
|
|
136
|
-
var markdownNodeType = require('./common/propsValues/markdownNodeType.js');
|
|
137
|
-
var fileType = require('./common/fileType.js');
|
|
138
|
-
var index = require('./common/locale/index.js');
|
|
139
|
-
var colors = require('./common/colors.js');
|
|
140
|
-
require('react-intl');
|
|
141
|
-
require('./common/closeButton/CloseButton.messages.js');
|
|
142
142
|
var index$1 = require('./i18n/index.js');
|
|
143
143
|
var withId = require('./withId/withId.js');
|
|
144
144
|
|
|
@@ -211,80 +211,6 @@ Object.defineProperty(exports, "InfoPresentation", {
|
|
|
211
211
|
exports.Info = Info.default;
|
|
212
212
|
exports.InlineAlert = InlineAlert.default;
|
|
213
213
|
exports.InlinePrompt = InlinePrompt.InlinePrompt;
|
|
214
|
-
exports.InputWithDisplayFormat = InputWithDisplayFormat.default;
|
|
215
|
-
exports.Input = Input.Input;
|
|
216
|
-
exports.InputGroup = InputGroup.InputGroup;
|
|
217
|
-
exports.SearchInput = SearchInput.SearchInput;
|
|
218
|
-
exports.SelectInput = SelectInput.SelectInput;
|
|
219
|
-
exports.SelectInputOptionContent = SelectInput.SelectInputOptionContent;
|
|
220
|
-
exports.SelectInputTriggerButton = SelectInput.SelectInputTriggerButton;
|
|
221
|
-
exports.TextArea = TextArea.TextArea;
|
|
222
|
-
exports.InstructionsList = InstructionsList.default;
|
|
223
|
-
exports.Label = Label.Label;
|
|
224
|
-
exports.Link = Link.default;
|
|
225
|
-
exports.LegacyListItem = LegacyListItem.default;
|
|
226
|
-
exports.Loader = Loader.default;
|
|
227
|
-
exports.Logo = Logo.default;
|
|
228
|
-
Object.defineProperty(exports, "LogoType", {
|
|
229
|
-
enumerable: true,
|
|
230
|
-
get: function () { return Logo.LogoType; }
|
|
231
|
-
});
|
|
232
|
-
exports.Markdown = Markdown.default;
|
|
233
|
-
exports.Modal = Modal.default;
|
|
234
|
-
exports.Money = Money.default;
|
|
235
|
-
exports.MoneyInput = MoneyInput.default;
|
|
236
|
-
exports.ExpressiveMoneyInput = ExpressiveMoneyInput.default;
|
|
237
|
-
exports.NavigationOption = NavigationOption.default;
|
|
238
|
-
exports.NavigationOptionsList = NavigationOptionsList.default;
|
|
239
|
-
exports.Nudge = Nudge.default;
|
|
240
|
-
exports.OverlayHeader = OverlayHeader.default;
|
|
241
|
-
exports.Panel = Panel.default;
|
|
242
|
-
exports.PhoneNumberInput = PhoneNumberInput.default;
|
|
243
|
-
exports.Popover = Popover.default;
|
|
244
|
-
exports.ProcessIndicator = ProcessIndicator.default;
|
|
245
|
-
exports.Progress = Progress.default;
|
|
246
|
-
exports.ProgressBar = ProgressBar.default;
|
|
247
|
-
exports.PromoCard = PromoCard.default;
|
|
248
|
-
exports.PromoCardGroup = PromoCardGroup.default;
|
|
249
|
-
exports.DirectionProvider = DirectionProvider.DirectionProvider;
|
|
250
|
-
exports.LanguageProvider = LanguageProvider.LanguageProvider;
|
|
251
|
-
exports.Provider = Provider.default;
|
|
252
|
-
exports.Radio = Radio.default;
|
|
253
|
-
exports.RadioGroup = RadioGroup.default;
|
|
254
|
-
exports.RadioOption = RadioOption.default;
|
|
255
|
-
exports.ResponsivePanel = ResponsivePanel.default;
|
|
256
|
-
exports.Section = Section.default;
|
|
257
|
-
exports.SegmentedControl = SegmentedControl.default;
|
|
258
|
-
exports.Select = Select.default;
|
|
259
|
-
exports.SentimentSurface = SentimentSurface.default;
|
|
260
|
-
exports.SlidingPanel = SlidingPanel.default;
|
|
261
|
-
exports.SnackbarPortal = Snackbar.default;
|
|
262
|
-
exports.SnackbarConsumer = SnackbarContext.SnackbarConsumer;
|
|
263
|
-
exports.SnackbarContext = SnackbarContext.SnackbarContext;
|
|
264
|
-
exports.SnackbarProvider = SnackbarProvider.default;
|
|
265
|
-
exports.Stepper = Stepper.default;
|
|
266
|
-
exports.Sticky = Sticky.default;
|
|
267
|
-
exports.Summary = Summary.default;
|
|
268
|
-
exports.Switch = Switch.default;
|
|
269
|
-
exports.SwitchOption = SwitchOption.default;
|
|
270
|
-
exports.Tabs = Tabs.default;
|
|
271
|
-
exports.TextareaWithDisplayFormat = TextareaWithDisplayFormat.default;
|
|
272
|
-
exports.Title = Title.default;
|
|
273
|
-
exports.Tooltip = Tooltip.default;
|
|
274
|
-
exports.Typeahead = Typeahead.default;
|
|
275
|
-
exports.Upload = Upload.default;
|
|
276
|
-
Object.defineProperty(exports, "UploadStep", {
|
|
277
|
-
enumerable: true,
|
|
278
|
-
get: function () { return Upload.UploadStep; }
|
|
279
|
-
});
|
|
280
|
-
exports.UploadInput = UploadInput.default;
|
|
281
|
-
exports.Table = Table.default;
|
|
282
|
-
exports.ListItem = ListItem.ListItem;
|
|
283
|
-
exports.List = List.default;
|
|
284
|
-
exports.useDirection = useDirection.useDirection;
|
|
285
|
-
exports.useLayout = useLayout.useLayout;
|
|
286
|
-
exports.useScreenSize = useScreenSize.useScreenSize;
|
|
287
|
-
exports.useSnackbar = useSnackbar.default;
|
|
288
214
|
exports.isBrowser = documentIosClick.isBrowser;
|
|
289
215
|
exports.isServerSide = documentIosClick.isServerSide;
|
|
290
216
|
Object.defineProperty(exports, "Theme", {
|
|
@@ -372,6 +298,80 @@ exports.getCountryFromLocale = index.getCountryFromLocale;
|
|
|
372
298
|
exports.getDirectionFromLocale = index.getDirectionFromLocale;
|
|
373
299
|
exports.getLangFromLocale = index.getLangFromLocale;
|
|
374
300
|
exports.getBrandColorFromSeed = colors.getBrandColorFromSeed;
|
|
301
|
+
exports.Title = Title.default;
|
|
302
|
+
exports.SentimentSurface = SentimentSurface.default;
|
|
303
|
+
exports.InputWithDisplayFormat = InputWithDisplayFormat.default;
|
|
304
|
+
exports.Input = Input.Input;
|
|
305
|
+
exports.InputGroup = InputGroup.InputGroup;
|
|
306
|
+
exports.SearchInput = SearchInput.SearchInput;
|
|
307
|
+
exports.SelectInput = SelectInput.SelectInput;
|
|
308
|
+
exports.SelectInputOptionContent = SelectInput.SelectInputOptionContent;
|
|
309
|
+
exports.SelectInputTriggerButton = SelectInput.SelectInputTriggerButton;
|
|
310
|
+
exports.TextArea = TextArea.TextArea;
|
|
311
|
+
exports.InstructionsList = InstructionsList.default;
|
|
312
|
+
exports.Label = Label.Label;
|
|
313
|
+
exports.Link = Link.default;
|
|
314
|
+
exports.LegacyListItem = LegacyListItem.default;
|
|
315
|
+
exports.Loader = Loader.default;
|
|
316
|
+
exports.Logo = Logo.default;
|
|
317
|
+
Object.defineProperty(exports, "LogoType", {
|
|
318
|
+
enumerable: true,
|
|
319
|
+
get: function () { return Logo.LogoType; }
|
|
320
|
+
});
|
|
321
|
+
exports.Markdown = Markdown.default;
|
|
322
|
+
exports.Modal = Modal.default;
|
|
323
|
+
exports.Money = Money.default;
|
|
324
|
+
exports.MoneyInput = MoneyInput.default;
|
|
325
|
+
exports.ExpressiveMoneyInput = ExpressiveMoneyInput.default;
|
|
326
|
+
exports.NavigationOption = NavigationOption.default;
|
|
327
|
+
exports.NavigationOptionsList = NavigationOptionsList.default;
|
|
328
|
+
exports.Nudge = Nudge.default;
|
|
329
|
+
exports.OverlayHeader = OverlayHeader.default;
|
|
330
|
+
exports.Panel = Panel.default;
|
|
331
|
+
exports.PhoneNumberInput = PhoneNumberInput.default;
|
|
332
|
+
exports.Popover = Popover.default;
|
|
333
|
+
exports.ProcessIndicator = ProcessIndicator.default;
|
|
334
|
+
exports.Progress = Progress.default;
|
|
335
|
+
exports.ProgressBar = ProgressBar.default;
|
|
336
|
+
exports.PromoCard = PromoCard.default;
|
|
337
|
+
exports.PromoCardGroup = PromoCardGroup.default;
|
|
338
|
+
exports.DirectionProvider = DirectionProvider.DirectionProvider;
|
|
339
|
+
exports.LanguageProvider = LanguageProvider.LanguageProvider;
|
|
340
|
+
exports.Provider = Provider.default;
|
|
341
|
+
exports.Radio = Radio.default;
|
|
342
|
+
exports.RadioGroup = RadioGroup.default;
|
|
343
|
+
exports.RadioOption = RadioOption.default;
|
|
344
|
+
exports.ResponsivePanel = ResponsivePanel.default;
|
|
345
|
+
exports.Section = Section.default;
|
|
346
|
+
exports.SegmentedControl = SegmentedControl.default;
|
|
347
|
+
exports.Select = Select.default;
|
|
348
|
+
exports.SlidingPanel = SlidingPanel.default;
|
|
349
|
+
exports.SnackbarPortal = Snackbar.default;
|
|
350
|
+
exports.SnackbarConsumer = SnackbarContext.SnackbarConsumer;
|
|
351
|
+
exports.SnackbarContext = SnackbarContext.SnackbarContext;
|
|
352
|
+
exports.SnackbarProvider = SnackbarProvider.default;
|
|
353
|
+
exports.Stepper = Stepper.default;
|
|
354
|
+
exports.Sticky = Sticky.default;
|
|
355
|
+
exports.Summary = Summary.default;
|
|
356
|
+
exports.Switch = Switch.default;
|
|
357
|
+
exports.SwitchOption = SwitchOption.default;
|
|
358
|
+
exports.Tabs = Tabs.default;
|
|
359
|
+
exports.TextareaWithDisplayFormat = TextareaWithDisplayFormat.default;
|
|
360
|
+
exports.Tooltip = Tooltip.default;
|
|
361
|
+
exports.Typeahead = Typeahead.default;
|
|
362
|
+
exports.Upload = Upload.default;
|
|
363
|
+
Object.defineProperty(exports, "UploadStep", {
|
|
364
|
+
enumerable: true,
|
|
365
|
+
get: function () { return Upload.UploadStep; }
|
|
366
|
+
});
|
|
367
|
+
exports.UploadInput = UploadInput.default;
|
|
368
|
+
exports.Table = Table.default;
|
|
369
|
+
exports.ListItem = ListItem.ListItem;
|
|
370
|
+
exports.List = List.default;
|
|
371
|
+
exports.useDirection = useDirection.useDirection;
|
|
372
|
+
exports.useLayout = useLayout.useLayout;
|
|
373
|
+
exports.useScreenSize = useScreenSize.useScreenSize;
|
|
374
|
+
exports.useSnackbar = useSnackbar.default;
|
|
375
375
|
exports.translations = index$1.default;
|
|
376
376
|
exports.withId = withId.default;
|
|
377
377
|
//# sourceMappingURL=index.js.map
|
package/build/index.mjs
CHANGED
|
@@ -50,6 +50,31 @@ export { InfoPresentation } from './info/infoPresentations.mjs';
|
|
|
50
50
|
export { default as Info } from './info/Info.mjs';
|
|
51
51
|
export { default as InlineAlert } from './inlineAlert/InlineAlert.mjs';
|
|
52
52
|
export { InlinePrompt } from './prompt/InlinePrompt/InlinePrompt.mjs';
|
|
53
|
+
export { isBrowser, isServerSide } from './common/domHelpers/documentIosClick.mjs';
|
|
54
|
+
export { Theme } from './common/theme.mjs';
|
|
55
|
+
export { Direction } from './common/direction.mjs';
|
|
56
|
+
export { ControlType, Priority } from './common/propsValues/control.mjs';
|
|
57
|
+
export { Size } from './common/propsValues/size.mjs';
|
|
58
|
+
export { Typography } from './common/propsValues/typography.mjs';
|
|
59
|
+
export { Width } from './common/propsValues/width.mjs';
|
|
60
|
+
export { Type } from './common/propsValues/type.mjs';
|
|
61
|
+
export { DateMode } from './common/propsValues/dateMode.mjs';
|
|
62
|
+
export { MonthFormat } from './common/propsValues/monthFormat.mjs';
|
|
63
|
+
export { Position } from './common/propsValues/position.mjs';
|
|
64
|
+
export { Layout } from './common/propsValues/layouts.mjs';
|
|
65
|
+
export { Status } from './common/propsValues/status.mjs';
|
|
66
|
+
export { Sentiment } from './common/propsValues/sentiment.mjs';
|
|
67
|
+
export { ProfileType } from './common/propsValues/profileType.mjs';
|
|
68
|
+
export { Variant } from './common/propsValues/variant.mjs';
|
|
69
|
+
export { Scroll } from './common/propsValues/scroll.mjs';
|
|
70
|
+
export { MarkdownNodeType } from './common/propsValues/markdownNodeType.mjs';
|
|
71
|
+
export { FileType } from './common/fileType.mjs';
|
|
72
|
+
export { DEFAULT_LANG, DEFAULT_LOCALE, RTL_LANGUAGES, SUPPORTED_LANGUAGES, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale } from './common/locale/index.mjs';
|
|
73
|
+
export { getBrandColorFromSeed } from './common/colors.mjs';
|
|
74
|
+
import 'react-intl';
|
|
75
|
+
import './common/closeButton/CloseButton.messages.mjs';
|
|
76
|
+
export { default as Title } from './title/Title.mjs';
|
|
77
|
+
export { default as SentimentSurface } from './sentimentSurface/SentimentSurface.mjs';
|
|
53
78
|
export { default as InputWithDisplayFormat } from './inputWithDisplayFormat/InputWithDisplayFormat.mjs';
|
|
54
79
|
export { Input } from './inputs/Input.mjs';
|
|
55
80
|
export { InputGroup } from './inputs/InputGroup.mjs';
|
|
@@ -89,7 +114,6 @@ export { default as ResponsivePanel } from './common/responsivePanel/ResponsiveP
|
|
|
89
114
|
export { default as Section } from './section/Section.mjs';
|
|
90
115
|
export { default as SegmentedControl } from './segmentedControl/SegmentedControl.mjs';
|
|
91
116
|
export { default as Select } from './select/Select.mjs';
|
|
92
|
-
export { default as SentimentSurface } from './sentimentSurface/SentimentSurface.mjs';
|
|
93
117
|
export { default as SlidingPanel } from './slidingPanel/SlidingPanel.mjs';
|
|
94
118
|
export { default as SnackbarPortal } from './snackbar/Snackbar.mjs';
|
|
95
119
|
export { SnackbarConsumer, SnackbarContext } from './snackbar/SnackbarContext.mjs';
|
|
@@ -101,7 +125,6 @@ export { default as Switch } from './switch/Switch.mjs';
|
|
|
101
125
|
export { default as SwitchOption } from './switchOption/SwitchOption.mjs';
|
|
102
126
|
export { default as Tabs } from './tabs/Tabs.mjs';
|
|
103
127
|
export { default as TextareaWithDisplayFormat } from './textareaWithDisplayFormat/TextareaWithDisplayFormat.mjs';
|
|
104
|
-
export { default as Title } from './title/Title.mjs';
|
|
105
128
|
export { default as Tooltip } from './tooltip/Tooltip.mjs';
|
|
106
129
|
export { default as Typeahead } from './typeahead/Typeahead.mjs';
|
|
107
130
|
export { default as Upload, UploadStep } from './upload/Upload.mjs';
|
|
@@ -114,29 +137,6 @@ export { useDirection } from './common/hooks/useDirection/useDirection.mjs';
|
|
|
114
137
|
export { useLayout } from './common/hooks/useLayout/useLayout.mjs';
|
|
115
138
|
export { useScreenSize } from './common/hooks/useScreenSize.mjs';
|
|
116
139
|
export { default as useSnackbar } from './snackbar/useSnackbar.mjs';
|
|
117
|
-
export { isBrowser, isServerSide } from './common/domHelpers/documentIosClick.mjs';
|
|
118
|
-
export { Theme } from './common/theme.mjs';
|
|
119
|
-
export { Direction } from './common/direction.mjs';
|
|
120
|
-
export { ControlType, Priority } from './common/propsValues/control.mjs';
|
|
121
|
-
export { Size } from './common/propsValues/size.mjs';
|
|
122
|
-
export { Typography } from './common/propsValues/typography.mjs';
|
|
123
|
-
export { Width } from './common/propsValues/width.mjs';
|
|
124
|
-
export { Type } from './common/propsValues/type.mjs';
|
|
125
|
-
export { DateMode } from './common/propsValues/dateMode.mjs';
|
|
126
|
-
export { MonthFormat } from './common/propsValues/monthFormat.mjs';
|
|
127
|
-
export { Position } from './common/propsValues/position.mjs';
|
|
128
|
-
export { Layout } from './common/propsValues/layouts.mjs';
|
|
129
|
-
export { Status } from './common/propsValues/status.mjs';
|
|
130
|
-
export { Sentiment } from './common/propsValues/sentiment.mjs';
|
|
131
|
-
export { ProfileType } from './common/propsValues/profileType.mjs';
|
|
132
|
-
export { Variant } from './common/propsValues/variant.mjs';
|
|
133
|
-
export { Scroll } from './common/propsValues/scroll.mjs';
|
|
134
|
-
export { MarkdownNodeType } from './common/propsValues/markdownNodeType.mjs';
|
|
135
|
-
export { FileType } from './common/fileType.mjs';
|
|
136
|
-
export { DEFAULT_LANG, DEFAULT_LOCALE, RTL_LANGUAGES, SUPPORTED_LANGUAGES, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale } from './common/locale/index.mjs';
|
|
137
|
-
export { getBrandColorFromSeed } from './common/colors.mjs';
|
|
138
|
-
import 'react-intl';
|
|
139
|
-
import './common/closeButton/CloseButton.messages.mjs';
|
|
140
140
|
export { default as translations } from './i18n/index.mjs';
|
|
141
141
|
export { default as withId } from './withId/withId.mjs';
|
|
142
142
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -97,24 +97,6 @@ function filterSelectInputItems(items, predicate) {
|
|
|
97
97
|
return false;
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Flattens and sorts filtered options using the provided comparator.
|
|
102
|
-
* Extracts all options from groups, filters out undefined values (deduplicated items),
|
|
103
|
-
* sorts them, and returns as a flat list of option items.
|
|
104
|
-
*/
|
|
105
|
-
function sortSelectInputItems(items, compareFn, searchQuery) {
|
|
106
|
-
const flattenedOption = items.flatMap(item => {
|
|
107
|
-
if (item.type === 'option') {
|
|
108
|
-
return item.value !== undefined ? [item] : [];
|
|
109
|
-
}
|
|
110
|
-
if (item.type === 'group') {
|
|
111
|
-
return item.options.filter(option => option.value !== undefined);
|
|
112
|
-
}
|
|
113
|
-
return [];
|
|
114
|
-
});
|
|
115
|
-
// eslint-disable-next-line functional/immutable-data
|
|
116
|
-
return flattenedOption.sort((a, b) => compareFn(a, b, searchQuery));
|
|
117
|
-
}
|
|
118
100
|
const defaultRenderTrigger = ({
|
|
119
101
|
content,
|
|
120
102
|
placeholderShown,
|
|
@@ -188,7 +170,6 @@ function SelectInput({
|
|
|
188
170
|
renderTrigger = defaultRenderTrigger,
|
|
189
171
|
filterable,
|
|
190
172
|
filterPlaceholder,
|
|
191
|
-
sortFilteredOptions,
|
|
192
173
|
disabled,
|
|
193
174
|
size = 'md',
|
|
194
175
|
className,
|
|
@@ -343,7 +324,6 @@ function SelectInput({
|
|
|
343
324
|
renderFooter: renderFooter,
|
|
344
325
|
filterable: filterable,
|
|
345
326
|
filterPlaceholder: filterPlaceholder,
|
|
346
|
-
sortFilteredOptions: sortFilteredOptions,
|
|
347
327
|
searchInputRef: searchInputRef,
|
|
348
328
|
listboxRef: listboxRef,
|
|
349
329
|
filterQuery: deferredFilterQuery,
|
|
@@ -373,7 +353,7 @@ function SelectInputTriggerButton({
|
|
|
373
353
|
onKeyDown,
|
|
374
354
|
...interactionProps
|
|
375
355
|
} = React.useContext(SelectInputTriggerButtonPropsContext);
|
|
376
|
-
return /*#__PURE__*/jsxRuntime.jsx(react.
|
|
356
|
+
return /*#__PURE__*/jsxRuntime.jsx(react.Listbox.Button, {
|
|
377
357
|
ref: ref,
|
|
378
358
|
as: PolymorphicWithOverrides.PolymorphicWithOverrides,
|
|
379
359
|
role: "combobox",
|
|
@@ -431,7 +411,6 @@ function SelectInputOptions({
|
|
|
431
411
|
renderFooter,
|
|
432
412
|
filterable = false,
|
|
433
413
|
filterPlaceholder,
|
|
434
|
-
sortFilteredOptions,
|
|
435
414
|
searchInputRef,
|
|
436
415
|
listboxRef,
|
|
437
416
|
filterQuery,
|
|
@@ -484,17 +463,7 @@ function SelectInputOptions({
|
|
|
484
463
|
return a === b;
|
|
485
464
|
};
|
|
486
465
|
}, [compareValuesProp]);
|
|
487
|
-
const filteredItems =
|
|
488
|
-
if (needle == null) {
|
|
489
|
-
return items;
|
|
490
|
-
}
|
|
491
|
-
const filtered = filterSelectInputItems(dedupeSelectInputItems(items, compareValues), item => selectInputOptionItemIncludesNeedle(item, needle));
|
|
492
|
-
if (sortFilteredOptions) {
|
|
493
|
-
return sortSelectInputItems(filtered, sortFilteredOptions, filterQuery);
|
|
494
|
-
}
|
|
495
|
-
return filtered;
|
|
496
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
497
|
-
}, [needle, items, compareValues]);
|
|
466
|
+
const filteredItems = needle != null ? filterSelectInputItems(dedupeSelectInputItems(items, compareValues), item => selectInputOptionItemIncludesNeedle(item, needle)) : items;
|
|
498
467
|
const resultsEmpty = needle != null && filteredItems.length === 0;
|
|
499
468
|
const virtualized = filteredItems.length > MAX_ITEMS_WITHOUT_VIRTUALIZATION;
|
|
500
469
|
// Items shown once shall be kept mounted until the needle changes, otherwise
|
|
@@ -540,8 +509,7 @@ function SelectInputOptions({
|
|
|
540
509
|
const fuzzyMatch = flatOptions.find(option => option.filterMatchers?.some(matcher => matcher.toLowerCase().includes(autocompleteValue.toLowerCase())));
|
|
541
510
|
return fuzzyMatch ? fuzzyMatch.value : null;
|
|
542
511
|
};
|
|
543
|
-
return /*#__PURE__*/jsxRuntime.jsxs(react.
|
|
544
|
-
modal: true,
|
|
512
|
+
return /*#__PURE__*/jsxRuntime.jsxs(react.Listbox.Options, {
|
|
545
513
|
as: SelectInputOptionsContainer,
|
|
546
514
|
static: true,
|
|
547
515
|
className: "np-select-input-options-container",
|
|
@@ -756,7 +724,7 @@ function SelectInputOption({
|
|
|
756
724
|
}) {
|
|
757
725
|
const itemsCount = React.useContext(SelectInputItemsCountContext);
|
|
758
726
|
const itemPosition = React.useContext(SelectInputItemPositionContext);
|
|
759
|
-
return /*#__PURE__*/jsxRuntime.jsx(react.
|
|
727
|
+
return /*#__PURE__*/jsxRuntime.jsx(react.Listbox.Option, {
|
|
760
728
|
as: "div",
|
|
761
729
|
value: value,
|
|
762
730
|
"aria-setsize": itemsCount,
|