@transferwise/components 0.0.0-experimental-8b0167a → 0.0.0-experimental-a0d696c
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/index.js +77 -62
- package/build/index.js.map +1 -1
- package/build/index.mjs +76 -61
- package/build/index.mjs.map +1 -1
- package/build/types/checkbox/Checkbox.d.ts +20 -16
- package/build/types/checkbox/Checkbox.d.ts.map +1 -1
- package/build/types/checkbox/index.d.ts +2 -2
- package/build/types/checkbox/index.d.ts.map +1 -1
- package/build/types/definitionList/DefinitionList.d.ts +20 -24
- package/build/types/definitionList/DefinitionList.d.ts.map +1 -1
- package/build/types/definitionList/index.d.ts +2 -1
- package/build/types/definitionList/index.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/checkbox/{Checkbox.tsx → Checkbox.js} +41 -19
- package/src/checkbox/{Checkbox.spec.tsx → Checkbox.spec.js} +5 -5
- package/src/checkbox/index.js +3 -0
- package/src/definitionList/{DefinitionList.story.js → DefinitionList.story.tsx} +22 -2
- package/src/definitionList/DefinitionList.tsx +95 -0
- package/src/definitionList/index.ts +2 -0
- package/src/index.ts +1 -1
- package/src/checkbox/index.ts +0 -2
- package/src/definitionList/DefinitionList.js +0 -100
- package/src/definitionList/index.js +0 -1
- /package/src/checkbox/__snapshots__/{Checkbox.spec.tsx.snap → Checkbox.spec.js.snap} +0 -0
package/build/index.mjs
CHANGED
|
@@ -2283,8 +2283,9 @@ const CheckboxButton = /*#__PURE__*/forwardRef(({
|
|
|
2283
2283
|
})
|
|
2284
2284
|
})]
|
|
2285
2285
|
}));
|
|
2286
|
+
var CheckboxButton$1 = CheckboxButton;
|
|
2286
2287
|
|
|
2287
|
-
|
|
2288
|
+
const Checkbox = ({
|
|
2288
2289
|
id,
|
|
2289
2290
|
checked,
|
|
2290
2291
|
required,
|
|
@@ -2296,11 +2297,14 @@ function Checkbox({
|
|
|
2296
2297
|
onChange,
|
|
2297
2298
|
onFocus,
|
|
2298
2299
|
onBlur
|
|
2299
|
-
}) {
|
|
2300
|
+
}) => {
|
|
2301
|
+
const {
|
|
2302
|
+
isModern
|
|
2303
|
+
} = useTheme();
|
|
2300
2304
|
const classList = classNames('np-checkbox', {
|
|
2301
2305
|
checkbox: true,
|
|
2302
2306
|
'checkbox-lg': secondary,
|
|
2303
|
-
disabled
|
|
2307
|
+
disabled: isModern && disabled
|
|
2304
2308
|
}, className);
|
|
2305
2309
|
const innerDisabled = disabled || readOnly;
|
|
2306
2310
|
return /*#__PURE__*/jsx("div", {
|
|
@@ -2310,7 +2314,7 @@ function Checkbox({
|
|
|
2310
2314
|
className: classNames({
|
|
2311
2315
|
disabled
|
|
2312
2316
|
}),
|
|
2313
|
-
children: [/*#__PURE__*/jsx(CheckboxButton, {
|
|
2317
|
+
children: [/*#__PURE__*/jsx(CheckboxButton$1, {
|
|
2314
2318
|
className: "p-r-2",
|
|
2315
2319
|
checked: checked,
|
|
2316
2320
|
disabled: innerDisabled,
|
|
@@ -2327,12 +2331,39 @@ function Checkbox({
|
|
|
2327
2331
|
children: label
|
|
2328
2332
|
}), secondary && /*#__PURE__*/jsx(Body, {
|
|
2329
2333
|
as: "span",
|
|
2334
|
+
className: classNames({
|
|
2335
|
+
secondary: !isModern
|
|
2336
|
+
}),
|
|
2330
2337
|
children: secondary
|
|
2331
2338
|
})]
|
|
2332
2339
|
})]
|
|
2333
2340
|
})
|
|
2334
2341
|
});
|
|
2335
|
-
}
|
|
2342
|
+
};
|
|
2343
|
+
Checkbox.propTypes = {
|
|
2344
|
+
id: PropTypes.string,
|
|
2345
|
+
checked: PropTypes.bool,
|
|
2346
|
+
required: PropTypes.bool,
|
|
2347
|
+
disabled: PropTypes.bool,
|
|
2348
|
+
readOnly: PropTypes.bool,
|
|
2349
|
+
label: PropTypes.node.isRequired,
|
|
2350
|
+
secondary: PropTypes.string,
|
|
2351
|
+
onFocus: PropTypes.func,
|
|
2352
|
+
onChange: PropTypes.func.isRequired,
|
|
2353
|
+
onBlur: PropTypes.func,
|
|
2354
|
+
className: PropTypes.string
|
|
2355
|
+
};
|
|
2356
|
+
Checkbox.defaultProps = {
|
|
2357
|
+
id: null,
|
|
2358
|
+
checked: false,
|
|
2359
|
+
required: false,
|
|
2360
|
+
disabled: false,
|
|
2361
|
+
readOnly: false,
|
|
2362
|
+
secondary: null,
|
|
2363
|
+
onFocus: null,
|
|
2364
|
+
onBlur: null,
|
|
2365
|
+
className: undefined
|
|
2366
|
+
};
|
|
2336
2367
|
|
|
2337
2368
|
const CheckboxOption = /*#__PURE__*/forwardRef(({
|
|
2338
2369
|
checked,
|
|
@@ -2344,7 +2375,7 @@ const CheckboxOption = /*#__PURE__*/forwardRef(({
|
|
|
2344
2375
|
...rest,
|
|
2345
2376
|
ref: reference,
|
|
2346
2377
|
disabled: disabled,
|
|
2347
|
-
button: /*#__PURE__*/jsx(CheckboxButton, {
|
|
2378
|
+
button: /*#__PURE__*/jsx(CheckboxButton$1, {
|
|
2348
2379
|
checked: checked,
|
|
2349
2380
|
disabled: disabled,
|
|
2350
2381
|
onChange: () => onChange?.(!checked)
|
|
@@ -4777,9 +4808,9 @@ const Decision = ({
|
|
|
4777
4808
|
return null;
|
|
4778
4809
|
};
|
|
4779
4810
|
|
|
4780
|
-
const isLayoutHorizontal = layout =>
|
|
4811
|
+
const isLayoutHorizontal = layout => layout === Layout.HORIZONTAL_LEFT_ALIGNED || layout === Layout.HORIZONTAL_RIGHT_ALIGNED || layout === Layout.HORIZONTAL_JUSTIFIED;
|
|
4781
4812
|
const getAlignmentClasses = (layout, action) => {
|
|
4782
|
-
|
|
4813
|
+
const classes = ['d-flex'];
|
|
4783
4814
|
if (action) {
|
|
4784
4815
|
if (isLayoutHorizontal(layout)) {
|
|
4785
4816
|
classes.push('align-items-center');
|
|
@@ -4797,60 +4828,44 @@ const getAlignmentClasses = (layout, action) => {
|
|
|
4797
4828
|
}
|
|
4798
4829
|
return classes;
|
|
4799
4830
|
};
|
|
4800
|
-
const
|
|
4801
|
-
|
|
4802
|
-
|
|
4831
|
+
const defaultDefinitions = [];
|
|
4832
|
+
function DefinitionList({
|
|
4833
|
+
definitions = defaultDefinitions,
|
|
4834
|
+
layout = 'VERTICAL_TWO_COLUMN',
|
|
4803
4835
|
muted
|
|
4804
|
-
})
|
|
4805
|
-
|
|
4806
|
-
'
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
children: definitions.filter(definition => definition).map(({
|
|
4812
|
-
action,
|
|
4813
|
-
title,
|
|
4814
|
-
value,
|
|
4815
|
-
key
|
|
4816
|
-
}) => /*#__PURE__*/jsxs("div", {
|
|
4817
|
-
className: "tw-definition-list__item",
|
|
4818
|
-
children: [/*#__PURE__*/jsx("dt", {
|
|
4819
|
-
children: title
|
|
4820
|
-
}), /*#__PURE__*/jsxs("dd", {
|
|
4821
|
-
className: classNames(...getAlignmentClasses(layout, action)),
|
|
4822
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
4823
|
-
children: value
|
|
4824
|
-
}), action ? /*#__PURE__*/jsx("div", {
|
|
4825
|
-
className: classNames(isLayoutHorizontal(layout) ? 'p-l-2' : 'p-x-2', 'tw-definition-list__action'),
|
|
4826
|
-
children: /*#__PURE__*/jsx(ActionButton, {
|
|
4827
|
-
className: "tw-definition-list__button",
|
|
4828
|
-
onClick: action.onClick,
|
|
4829
|
-
children: action.label
|
|
4830
|
-
})
|
|
4831
|
-
}) : null]
|
|
4832
|
-
})]
|
|
4833
|
-
}, key))
|
|
4834
|
-
});
|
|
4835
|
-
DefinitionList.propTypes = {
|
|
4836
|
-
definitions: PropTypes.arrayOf(PropTypes.shape({
|
|
4837
|
-
action: PropTypes.shape({
|
|
4838
|
-
label: PropTypes.string.isRequired,
|
|
4839
|
-
onClick: PropTypes.func
|
|
4836
|
+
}) {
|
|
4837
|
+
return /*#__PURE__*/jsx("dl", {
|
|
4838
|
+
className: classNames('tw-definition-list d-flex ', {
|
|
4839
|
+
'text-muted': muted,
|
|
4840
|
+
'flex-column': layout === Layout.VERTICAL_ONE_COLUMN,
|
|
4841
|
+
'tw-definition-list--columns flex-column flex-row--sm': layout === Layout.VERTICAL_TWO_COLUMN,
|
|
4842
|
+
'tw-definition-list--horizontal flex-column': isLayoutHorizontal(layout)
|
|
4840
4843
|
}),
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4844
|
+
children: definitions.filter(definition => definition).map(({
|
|
4845
|
+
action,
|
|
4846
|
+
title,
|
|
4847
|
+
value,
|
|
4848
|
+
key
|
|
4849
|
+
}) => /*#__PURE__*/jsxs("div", {
|
|
4850
|
+
className: "tw-definition-list__item",
|
|
4851
|
+
children: [/*#__PURE__*/jsx("dt", {
|
|
4852
|
+
children: title
|
|
4853
|
+
}), /*#__PURE__*/jsxs("dd", {
|
|
4854
|
+
className: classNames(...getAlignmentClasses(layout, action)),
|
|
4855
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
4856
|
+
children: value
|
|
4857
|
+
}), action ? /*#__PURE__*/jsx("div", {
|
|
4858
|
+
className: classNames(isLayoutHorizontal(layout) ? 'p-l-2' : 'p-x-2', 'tw-definition-list__action'),
|
|
4859
|
+
children: /*#__PURE__*/jsx(ActionButton, {
|
|
4860
|
+
className: "tw-definition-list__button",
|
|
4861
|
+
onClick: action.onClick,
|
|
4862
|
+
children: action.label
|
|
4863
|
+
})
|
|
4864
|
+
}) : null]
|
|
4865
|
+
})]
|
|
4866
|
+
}, key))
|
|
4867
|
+
});
|
|
4868
|
+
}
|
|
4854
4869
|
|
|
4855
4870
|
const DropFade = ({
|
|
4856
4871
|
children,
|
|
@@ -14714,5 +14729,5 @@ const translations = {
|
|
|
14714
14729
|
'zh-HK': zhHK
|
|
14715
14730
|
};
|
|
14716
14731
|
|
|
14717
|
-
export { Accordion, ActionButton, ActionOption, Alert, AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card$2 as BaseCard, Body, BottomSheet$1 as BottomSheet, Breakpoint, Button, Card$1 as Card, Carousel, Checkbox, CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList
|
|
14732
|
+
export { Accordion, ActionButton, ActionOption, Alert, AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card$2 as BaseCard, Body, BottomSheet$1 as BottomSheet, Breakpoint, Button, Card$1 as Card, Carousel, Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, Emphasis, Field, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, Label, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCardGroup$1 as PromoCardGroup, Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip, Type, Typeahead$1 as Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
|
|
14718
14733
|
//# sourceMappingURL=index.mjs.map
|