@transferwise/components 0.0.0-experimental-9956441 → 0.0.0-experimental-47c6fe8

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.
Files changed (39) hide show
  1. package/build/dateLookup/dateHeader/DateHeader.js +26 -21
  2. package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
  3. package/build/dateLookup/dateHeader/DateHeader.mjs +26 -21
  4. package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
  5. package/build/i18n/nl.json +73 -0
  6. package/build/index.js +0 -2
  7. package/build/index.js.map +1 -1
  8. package/build/index.mjs +0 -1
  9. package/build/index.mjs.map +1 -1
  10. package/build/main.css +0 -29
  11. package/build/styles/dateLookup/DateLookup.css +0 -5
  12. package/build/styles/main.css +0 -29
  13. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
  14. package/build/types/index.d.ts +0 -2
  15. package/build/types/index.d.ts.map +1 -1
  16. package/package.json +4 -4
  17. package/src/dateLookup/DateLookup.css +0 -5
  18. package/src/dateLookup/DateLookup.less +0 -4
  19. package/src/dateLookup/dateHeader/DateHeader.tsx +23 -25
  20. package/src/i18n/nl.json +73 -0
  21. package/src/index.ts +0 -2
  22. package/src/main.css +0 -29
  23. package/src/main.less +0 -1
  24. package/build/divider/Divider.js +0 -33
  25. package/build/divider/Divider.js.map +0 -1
  26. package/build/divider/Divider.mjs +0 -31
  27. package/build/divider/Divider.mjs.map +0 -1
  28. package/build/styles/divider/Divider.css +0 -24
  29. package/build/types/divider/Divider.d.ts +0 -30
  30. package/build/types/divider/Divider.d.ts.map +0 -1
  31. package/build/types/divider/index.d.ts +0 -3
  32. package/build/types/divider/index.d.ts.map +0 -1
  33. package/src/divider/Divider.accessibility.docs.mdx +0 -61
  34. package/src/divider/Divider.css +0 -24
  35. package/src/divider/Divider.less +0 -31
  36. package/src/divider/Divider.spec.tsx +0 -68
  37. package/src/divider/Divider.story.tsx +0 -132
  38. package/src/divider/Divider.tsx +0 -56
  39. package/src/divider/index.ts +0 -2
@@ -1,13 +1,13 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { useIntl } from 'react-intl';
3
3
 
4
- import Chevron from '../../chevron';
5
- import { Position, Size, Typography } from '../../common';
4
+ import { Typography } from '../../common';
6
5
  import { useLayout } from '../../common/hooks';
7
6
  import Title from '../../title';
8
7
  import messages from '../DateLookup.messages';
9
-
10
- const buttonClasses = 'btn-link p-a-0 text-no-decoration np-text-body-large-bold rounded-sm';
8
+ import Button from '../../button/Button';
9
+ import { ChevronDown, ChevronLeft, ChevronRight } from '@transferwise/icons';
10
+ import IconButton from '../../iconButton';
11
11
 
12
12
  interface DateHeaderProps {
13
13
  label?: string;
@@ -29,44 +29,42 @@ const DateHeader: React.FC<DateHeaderProps> = ({
29
29
  return (
30
30
  <div className={clsx('text-xs-center', !isMobile && ['clearfix', 'p-y-1'])}>
31
31
  <div className="pull-left-single-direction">
32
- <button
33
- type="button"
34
- className={`d-inline-flex ${buttonClasses}`}
32
+ <IconButton
33
+ size={40}
34
+ priority="minimal"
35
+ className="d-inline-flex"
35
36
  aria-label={`${intl.formatMessage(messages.previous)} ${dateMode}`}
36
37
  onClick={onPreviousClick}
37
38
  >
38
- <Chevron
39
- orientation={Position.LEFT}
40
- className="left-single-direction"
41
- size={Size.MEDIUM}
42
- />
43
- </button>
39
+ <ChevronLeft className="left-single-direction" />
40
+ </IconButton>
44
41
  </div>
45
42
  {label && (
46
43
  <Title type={Typography.TITLE_BODY} className="tw-date-lookup-header-current-container">
47
- <button
44
+ <Button
45
+ v2
46
+ size="md"
48
47
  type="button"
49
- className={`tw-date-lookup-header-current ${buttonClasses}`}
48
+ priority="tertiary"
49
+ className="tw-date-lookup-header-current"
50
50
  aria-label={intl.formatMessage(messages.goTo20YearView)}
51
+ addonEnd={{ type: 'icon', value: <ChevronDown /> }}
51
52
  onClick={onLabelClick}
52
53
  >
53
54
  {label}
54
- </button>
55
+ </Button>
55
56
  </Title>
56
57
  )}
57
58
  <div className="pull-right-single-direction">
58
- <button
59
- type="button"
60
- className={`d-inline-flex ${buttonClasses}`}
59
+ <IconButton
60
+ size={40}
61
+ className="d-inline-flex"
61
62
  aria-label={`${useIntl().formatMessage(messages.next)} ${dateMode}`}
63
+ priority="minimal"
62
64
  onClick={onNextClick}
63
65
  >
64
- <Chevron
65
- orientation={Position.RIGHT}
66
- className="right-single-direction"
67
- size={Size.MEDIUM}
68
- />
69
- </button>
66
+ <ChevronRight className="right-single-direction" />
67
+ </IconButton>
70
68
  </div>
71
69
  </div>
72
70
  );
@@ -0,0 +1,73 @@
1
+ {
2
+ "neptune.Button.loadingAriaLabel": "laden",
3
+ "neptune.Chips.ariaLabel": "{choice} wissen",
4
+ "neptune.ClearButton.ariaLabel": "Wissen",
5
+ "neptune.CloseButton.ariaLabel": "Sluiten",
6
+ "neptune.DateInput.day.label": "Dag",
7
+ "neptune.DateInput.day.placeholder": "DD",
8
+ "neptune.DateInput.month.label": "Maand",
9
+ "neptune.DateInput.year.label": "Jaar",
10
+ "neptune.DateInput.year.placeholder": "JJJJ",
11
+ "neptune.DateLookup.day": "dag",
12
+ "neptune.DateLookup.goTo20YearView": "Naar 20-jaarsoverzicht",
13
+ "neptune.DateLookup.month": "maand",
14
+ "neptune.DateLookup.next": "volgende",
15
+ "neptune.DateLookup.previous": "vorige",
16
+ "neptune.DateLookup.selected": "geselecteerd",
17
+ "neptune.DateLookup.twentyYears": "20 jaar",
18
+ "neptune.DateLookup.year": "jaar",
19
+ "neptune.FlowNavigation.back": "terug naar vorige stap",
20
+ "neptune.Info.ariaLabel": "Meer informatie",
21
+ "neptune.Label.optional": "(Optioneel)",
22
+ "neptune.Link.opensInNewTab": "(wordt geopend in een nieuw tabblad)",
23
+ "neptune.MoneyInput.Select.placeholder": "Selecteer een optie...",
24
+ "neptune.MoneyInput.Select.selectCurrencyLabel": "Selecteer valuta",
25
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Selecteer een optie...",
26
+ "neptune.Select.searchPlaceholder": "Zoeken...",
27
+ "neptune.SelectInput.noResultsFound": "Geen resultaten gevonden",
28
+ "neptune.SelectOption.action.label": "Kiezen",
29
+ "neptune.SelectOption.selected.action.label": "Gekozen optie wijzigen",
30
+ "neptune.StatusIcon.iconLabel.error": "Fout:",
31
+ "neptune.StatusIcon.iconLabel.information": "Informatie:",
32
+ "neptune.StatusIcon.iconLabel.pending": "In behandeling:",
33
+ "neptune.StatusIcon.iconLabel.success": "Gelukt:",
34
+ "neptune.StatusIcon.iconLabel.warning": "Waarschuwing:",
35
+ "neptune.Summary.statusDone": "Item klaar",
36
+ "neptune.Summary.statusNotDone": "Item te doen",
37
+ "neptune.Summary.statusPending": "Item in behandeling",
38
+ "neptune.Table.actionHeader": "Actie",
39
+ "neptune.Table.emptyData": "Geen resultaten gevonden",
40
+ "neptune.Table.loaded": "Tabelgegevens zijn geladen",
41
+ "neptune.Table.loading": "Tabelgegevens worden geladen",
42
+ "neptune.Table.refreshPage": "Pagina vernieuwen",
43
+ "neptune.Upload.csButtonText": "Nog een bestand uploaden?",
44
+ "neptune.Upload.csFailureText": "Uploaden mislukt. Probeer het opnieuw",
45
+ "neptune.Upload.csSuccessText": "Uploaden voltooid!",
46
+ "neptune.Upload.csTooLargeMessage": "Upload een bestand kleiner dan {maxSize} MB",
47
+ "neptune.Upload.csWrongTypeMessage": "Het bestandstype wordt niet ondersteund. Probeer het opnieuw met een ander bestand.",
48
+ "neptune.Upload.psButtonText": "Annuleren",
49
+ "neptune.Upload.psProcessingText": "Uploaden...",
50
+ "neptune.Upload.retry": "Opnieuw proberen",
51
+ "neptune.Upload.usButtonText": "Of selecteer een bestand",
52
+ "neptune.Upload.usDropMessage": "Sleep het bestand hierheen om het te uploaden",
53
+ "neptune.Upload.usPlaceholder": "Sleep een bestand van maximaal {maxSize} MB",
54
+ "neptune.UploadButton.allFileTypes": "Alle bestandstypen",
55
+ "neptune.UploadButton.dropFiles": "Sleep het bestand hierheen om het te uploaden",
56
+ "neptune.UploadButton.instructions": "{fileTypes}, kleiner dan {size} MB",
57
+ "neptune.UploadButton.maximumFiles": "Maximaal {maxFiles} bestanden.",
58
+ "neptune.UploadButton.uploadFile": "Bestand uploaden",
59
+ "neptune.UploadButton.uploadFiles": "Bestanden uploaden",
60
+ "neptune.UploadInput.deleteModalBody": "Door dit bestand te verwijderen, wordt het uit ons systeem verwijderd.",
61
+ "neptune.UploadInput.deleteModalCancelButtonText": "Annuleren",
62
+ "neptune.UploadInput.deleteModalConfirmButtonText": "Verwijderen",
63
+ "neptune.UploadInput.deleteModalTitle": "Weet je zeker dat je dit bestand wilt verwijderen?",
64
+ "neptune.UploadInput.fileIsTooLarge": "Bestand is te groot",
65
+ "neptune.UploadInput.fileTypeNotSupported": "Bestandstype niet ondersteund",
66
+ "neptune.UploadInput.maximumFilesAlreadyUploaded": "Deze upload is mislukt omdat we maar {maxFilesAllowed} bestanden tegelijk kunnen accepteren.",
67
+ "neptune.UploadItem.deleting": "Verwijderen...",
68
+ "neptune.UploadItem.removeFile": "Bestand {filename} verwijderen",
69
+ "neptune.UploadItem.uploaded": "Geüpload",
70
+ "neptune.UploadItem.uploadedFile": "Geüpload bestand",
71
+ "neptune.UploadItem.uploading": "Uploaden...",
72
+ "neptune.UploadItem.uploadingFailed": "Uploaden mislukt"
73
+ }
package/src/index.ts CHANGED
@@ -31,7 +31,6 @@ export type { DecisionProps } from './decision/Decision';
31
31
  export type { DefinitionListProps, DefinitionListDefinition } from './definitionList';
32
32
  export type { DimmerProps } from './dimmer';
33
33
  export type { DrawerProps } from './drawer';
34
- export type { DividerProps } from './divider';
35
34
  export type { EmphasisProps } from './emphasis';
36
35
  export type { FieldProps } from './field/Field';
37
36
  export type { InfoProps } from './info';
@@ -144,7 +143,6 @@ export { default as Decision } from './decision';
144
143
  export { default as DefinitionList } from './definitionList';
145
144
  export { default as Dimmer } from './dimmer';
146
145
  export { default as Display } from './display';
147
- export { default as Divider } from './divider';
148
146
  export { default as Drawer } from './drawer';
149
147
  export { default as DropFade } from './dropFade';
150
148
  export { default as Emphasis } from './emphasis';
package/src/main.css CHANGED
@@ -2009,11 +2009,6 @@ button.np-option {
2009
2009
  .np-theme-personal .tw-date-lookup-menu td {
2010
2010
  border: none;
2011
2011
  }
2012
- .np-theme-personal.tw-date-lookup-menu .tw-date-lookup-header-current,
2013
- .np-theme-personal .tw-date-lookup-menu .tw-date-lookup-header-current {
2014
- color: #37517e;
2015
- color: var(--color-content-primary);
2016
- }
2017
2012
  .np-date-trigger {
2018
2013
  overflow: hidden;
2019
2014
  text-overflow: ellipsis;
@@ -2286,30 +2281,6 @@ button.np-option {
2286
2281
  padding: var(--size-24);
2287
2282
  }
2288
2283
  }
2289
- .wds-Divider {
2290
- --Divider-border-width: var(--size-4);
2291
- --Divider-border-color: var(--color-border-neutral);
2292
- --Divider-border-style: solid;
2293
- --Divider-dash-length: var(--size-4);
2294
- --Divider-dash-spacing: var(--size-4);
2295
- border-top: 4px solid rgba(0,0,0,0.10196);
2296
- border-top: var(--Divider-border-width) var(--Divider-border-style) var(--Divider-border-color);
2297
- display: inline-block;
2298
- margin: 0;
2299
- padding: 0;
2300
- height: 4px;
2301
- height: var(--Divider-border-width);
2302
- width: 100%;
2303
- }
2304
- .wds-Divider--content {
2305
- border-top: none;
2306
- background: repeating-linear-gradient(to right, var(--Divider-border-color), var(--Divider-border-color) var(--Divider-dash-length), transparent var(--Divider-dash-length), transparent calc(var(--Divider-dash-length) + var(--Divider-dash-spacing)));
2307
- height: var(--Divider-border-width);
2308
- }
2309
- .wds-Divider--content,
2310
- .wds-Divider--subsection {
2311
- --Divider-border-width: 1px;
2312
- }
2313
2284
  .np-dropfade,
2314
2285
  .np-dropfade-enter {
2315
2286
  opacity: 0;
package/src/main.less CHANGED
@@ -30,7 +30,6 @@
30
30
  @import "./definitionList/DefinitionList.less";
31
31
  @import "./dimmer/Dimmer.less";
32
32
  @import "./drawer/Drawer.less";
33
- @import "./divider/Divider.less";
34
33
  @import "./dropFade/DropFade.less";
35
34
  @import "./emphasis/Emphasis.less";
36
35
  @import "./flowNavigation/animatedLabel/AnimatedLabel.less";
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- var clsx = require('clsx');
4
- require('react');
5
- var jsxRuntime = require('react/jsx-runtime');
6
-
7
- const Divider = ({
8
- className,
9
- isContent = false,
10
- testId,
11
- variant = 'section',
12
- ...props
13
- }) => {
14
- const variantClass = variant && variant !== 'section' ? `wds-Divider--${variant}` : '';
15
- const commonProps = {
16
- className: clsx.clsx('wds-Divider', variantClass, className),
17
- 'data-testid': testId
18
- };
19
- const divProps = {
20
- ...commonProps,
21
- role: 'presentation'
22
- };
23
- return isContent ? /*#__PURE__*/jsxRuntime.jsx("hr", {
24
- ...commonProps,
25
- ...props
26
- }) : /*#__PURE__*/jsxRuntime.jsx("div", {
27
- ...divProps,
28
- ...props
29
- });
30
- };
31
-
32
- module.exports = Divider;
33
- //# sourceMappingURL=Divider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Divider.js","sources":["../../src/divider/Divider.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport React, { FunctionComponent } from 'react';\n\nexport interface DividerProps {\n /**\n * If `true`, renders the Divider as a semantic `<hr>`, providing clear separation to assistive technologies.\n * Otherwise, a non-semantic `<div role=\"presentation\">` is used for purely visual separation.\n * @default false\n */\n isContent?: boolean;\n\n /**\n * Appends additional class names to style the `Divider`.\n */\n className?: string;\n\n /**\n * Provides a `data-testid` attribute for testing.\n */\n testId?: string;\n\n /**\n * Alters the visual style of the divider, accommodating different types\n * of separated content. Accepts `'section'`, `'subsection'`, or `'content'`.\n * @default 'section'\n */\n variant?: 'section' | 'subsection' | 'content';\n}\n\n/**\n * @see {@link Divider} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/layouts-divider--docs|Storybook Wise Design}\n */\nconst Divider: FunctionComponent<DividerProps> = ({\n className,\n isContent = false,\n testId,\n variant = 'section',\n ...props\n}) => {\n const variantClass = variant && variant !== 'section' ? `wds-Divider--${variant}` : '';\n\n const commonProps = {\n className: clsx('wds-Divider', variantClass, className),\n 'data-testid': testId,\n };\n\n const divProps = {\n ...commonProps,\n role: 'presentation',\n };\n\n return isContent ? <hr {...commonProps} {...props} /> : <div {...divProps} {...props} />;\n};\n\nexport default Divider;\n"],"names":["Divider","className","isContent","testId","variant","props","variantClass","commonProps","clsx","divProps","role","_jsx"],"mappings":";;;;;;AAiCMA,MAAAA,OAAO,GAAoCA,CAAC;EAChDC,SAAS;AACTC,EAAAA,SAAS,GAAG,KAAK;EACjBC,MAAM;AACNC,EAAAA,OAAO,GAAG,SAAS;EACnB,GAAGC,KAAAA;AAAK,CACT,KAAI;AACH,EAAA,MAAMC,YAAY,GAAGF,OAAO,IAAIA,OAAO,KAAK,SAAS,GAAG,CAAgBA,aAAAA,EAAAA,OAAO,CAAE,CAAA,GAAG,EAAE,CAAA;AAEtF,EAAA,MAAMG,WAAW,GAAG;IAClBN,SAAS,EAAEO,SAAI,CAAC,aAAa,EAAEF,YAAY,EAAEL,SAAS,CAAC;AACvD,IAAA,aAAa,EAAEE,MAAAA;GAChB,CAAA;AAED,EAAA,MAAMM,QAAQ,GAAG;AACf,IAAA,GAAGF,WAAW;AACdG,IAAAA,IAAI,EAAE,cAAA;GACP,CAAA;EAED,OAAOR,SAAS,gBAAGS,cAAA,CAAA,IAAA,EAAA;AAAA,IAAA,GAAQJ,WAAW;IAAA,GAAMF,KAAAA;GAAS,CAAA,gBAAGM,cAAA,CAAA,KAAA,EAAA;AAAA,IAAA,GAASF,QAAQ;IAAA,GAAMJ,KAAAA;AAAK,IAAI,CAAA;AAC1F;;;;"}
@@ -1,31 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import 'react';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- const Divider = ({
6
- className,
7
- isContent = false,
8
- testId,
9
- variant = 'section',
10
- ...props
11
- }) => {
12
- const variantClass = variant && variant !== 'section' ? `wds-Divider--${variant}` : '';
13
- const commonProps = {
14
- className: clsx('wds-Divider', variantClass, className),
15
- 'data-testid': testId
16
- };
17
- const divProps = {
18
- ...commonProps,
19
- role: 'presentation'
20
- };
21
- return isContent ? /*#__PURE__*/jsx("hr", {
22
- ...commonProps,
23
- ...props
24
- }) : /*#__PURE__*/jsx("div", {
25
- ...divProps,
26
- ...props
27
- });
28
- };
29
-
30
- export { Divider as default };
31
- //# sourceMappingURL=Divider.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Divider.mjs","sources":["../../src/divider/Divider.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport React, { FunctionComponent } from 'react';\n\nexport interface DividerProps {\n /**\n * If `true`, renders the Divider as a semantic `<hr>`, providing clear separation to assistive technologies.\n * Otherwise, a non-semantic `<div role=\"presentation\">` is used for purely visual separation.\n * @default false\n */\n isContent?: boolean;\n\n /**\n * Appends additional class names to style the `Divider`.\n */\n className?: string;\n\n /**\n * Provides a `data-testid` attribute for testing.\n */\n testId?: string;\n\n /**\n * Alters the visual style of the divider, accommodating different types\n * of separated content. Accepts `'section'`, `'subsection'`, or `'content'`.\n * @default 'section'\n */\n variant?: 'section' | 'subsection' | 'content';\n}\n\n/**\n * @see {@link Divider} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/layouts-divider--docs|Storybook Wise Design}\n */\nconst Divider: FunctionComponent<DividerProps> = ({\n className,\n isContent = false,\n testId,\n variant = 'section',\n ...props\n}) => {\n const variantClass = variant && variant !== 'section' ? `wds-Divider--${variant}` : '';\n\n const commonProps = {\n className: clsx('wds-Divider', variantClass, className),\n 'data-testid': testId,\n };\n\n const divProps = {\n ...commonProps,\n role: 'presentation',\n };\n\n return isContent ? <hr {...commonProps} {...props} /> : <div {...divProps} {...props} />;\n};\n\nexport default Divider;\n"],"names":["Divider","className","isContent","testId","variant","props","variantClass","commonProps","clsx","divProps","role","_jsx"],"mappings":";;;;AAiCMA,MAAAA,OAAO,GAAoCA,CAAC;EAChDC,SAAS;AACTC,EAAAA,SAAS,GAAG,KAAK;EACjBC,MAAM;AACNC,EAAAA,OAAO,GAAG,SAAS;EACnB,GAAGC,KAAAA;AAAK,CACT,KAAI;AACH,EAAA,MAAMC,YAAY,GAAGF,OAAO,IAAIA,OAAO,KAAK,SAAS,GAAG,CAAgBA,aAAAA,EAAAA,OAAO,CAAE,CAAA,GAAG,EAAE,CAAA;AAEtF,EAAA,MAAMG,WAAW,GAAG;IAClBN,SAAS,EAAEO,IAAI,CAAC,aAAa,EAAEF,YAAY,EAAEL,SAAS,CAAC;AACvD,IAAA,aAAa,EAAEE,MAAAA;GAChB,CAAA;AAED,EAAA,MAAMM,QAAQ,GAAG;AACf,IAAA,GAAGF,WAAW;AACdG,IAAAA,IAAI,EAAE,cAAA;GACP,CAAA;EAED,OAAOR,SAAS,gBAAGS,GAAA,CAAA,IAAA,EAAA;AAAA,IAAA,GAAQJ,WAAW;IAAA,GAAMF,KAAAA;GAAS,CAAA,gBAAGM,GAAA,CAAA,KAAA,EAAA;AAAA,IAAA,GAASF,QAAQ;IAAA,GAAMJ,KAAAA;AAAK,IAAI,CAAA;AAC1F;;;;"}
@@ -1,24 +0,0 @@
1
- .wds-Divider {
2
- --Divider-border-width: var(--size-4);
3
- --Divider-border-color: var(--color-border-neutral);
4
- --Divider-border-style: solid;
5
- --Divider-dash-length: var(--size-4);
6
- --Divider-dash-spacing: var(--size-4);
7
- border-top: 4px solid rgba(0,0,0,0.10196);
8
- border-top: var(--Divider-border-width) var(--Divider-border-style) var(--Divider-border-color);
9
- display: inline-block;
10
- margin: 0;
11
- padding: 0;
12
- height: 4px;
13
- height: var(--Divider-border-width);
14
- width: 100%;
15
- }
16
- .wds-Divider--content {
17
- border-top: none;
18
- background: repeating-linear-gradient(to right, var(--Divider-border-color), var(--Divider-border-color) var(--Divider-dash-length), transparent var(--Divider-dash-length), transparent calc(var(--Divider-dash-length) + var(--Divider-dash-spacing)));
19
- height: var(--Divider-border-width);
20
- }
21
- .wds-Divider--content,
22
- .wds-Divider--subsection {
23
- --Divider-border-width: 1px;
24
- }
@@ -1,30 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- export interface DividerProps {
3
- /**
4
- * If `true`, renders the Divider as a semantic `<hr>`, providing clear separation to assistive technologies.
5
- * Otherwise, a non-semantic `<div role="presentation">` is used for purely visual separation.
6
- * @default false
7
- */
8
- isContent?: boolean;
9
- /**
10
- * Appends additional class names to style the `Divider`.
11
- */
12
- className?: string;
13
- /**
14
- * Provides a `data-testid` attribute for testing.
15
- */
16
- testId?: string;
17
- /**
18
- * Alters the visual style of the divider, accommodating different types
19
- * of separated content. Accepts `'section'`, `'subsection'`, or `'content'`.
20
- * @default 'section'
21
- */
22
- variant?: 'section' | 'subsection' | 'content';
23
- }
24
- /**
25
- * @see {@link Divider} for further information.
26
- * @see {@link https://storybook.wise.design/?path=/docs/layouts-divider--docs|Storybook Wise Design}
27
- */
28
- declare const Divider: FunctionComponent<DividerProps>;
29
- export default Divider;
30
- //# sourceMappingURL=Divider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../../src/divider/Divider.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,SAAS,CAAC;CAChD;AAED;;;GAGG;AACH,QAAA,MAAM,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAoB5C,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1,3 +0,0 @@
1
- export { default } from './Divider';
2
- export type { DividerProps } from './Divider';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/divider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
@@ -1,61 +0,0 @@
1
- import { Meta, Canvas, Source } from '@storybook/blocks';
2
- import { NavigationOption } from '..';
3
- import { Bulb } from '@transferwise/icons';
4
-
5
- <Meta title="Layouts/Divider/Accessibility" />
6
-
7
- # Accessibility
8
-
9
- A Divider is used to separate sections of content. While it doesn't directly announce anything to screen readers, there are a few considerations:
10
-
11
- <NavigationOption
12
- media={<Bulb size={24} />}
13
- title="Design guidance"
14
- content="Before you start, please review the documentation on how separators should be used, announced or hidden from assistive tech."
15
- href="https://wise.design/components/divider"
16
- />
17
-
18
- <br />
19
- <br />
20
-
21
- ## Using `<hr />` vs `<div />`
22
-
23
- By default, our Divider is rendered as `<div role="presentation" />`. However, you can optionally set `isContent` to true, which many screen readers interpret as a “separator.”
24
-
25
- <Source dark code={`
26
- // By default: non-semantic divider
27
- <Divider isContent={false} />
28
-
29
- // Alternatively, to provide a semantic HR:
30
-
31
- <Divider isContent={true} />
32
- `}/>
33
-
34
- Compared to a `<div>`, `<hr>` tells assistive technologies that a thematic break or separation has occurred. However, sometimes you may not want an audible separation. In that case, using `<div>` (which omits semantic meaning) might be preferable.
35
-
36
- <br />
37
-
38
- ## Variants
39
-
40
- The Divider supports variants like “section”, “subsection”, or “content” to visually change the separation style:
41
-
42
- <Source
43
- dark
44
- code={`
45
- // A few variant examples
46
- <>
47
- <Divider variant="section" />
48
- <Divider variant="subsection" />
49
- <Divider variant="content" />
50
- </>
51
- `}
52
- />
53
-
54
- Screen readers generally ignore these visual styling changes unless you explicitly provide more context (e.g., additional text or heading tags).
55
-
56
- <br />
57
-
58
- **Additional resources:**
59
-
60
- 1. [WAI-ARIA Authoring Practices: Separator Role](https://www.w3.org/TR/wai-aria-practices-1.2/#separator)
61
- 2. [MDN Web Docs: &lt;hr /&gt;](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr)
@@ -1,24 +0,0 @@
1
- .wds-Divider {
2
- --Divider-border-width: var(--size-4);
3
- --Divider-border-color: var(--color-border-neutral);
4
- --Divider-border-style: solid;
5
- --Divider-dash-length: var(--size-4);
6
- --Divider-dash-spacing: var(--size-4);
7
- border-top: 4px solid rgba(0,0,0,0.10196);
8
- border-top: var(--Divider-border-width) var(--Divider-border-style) var(--Divider-border-color);
9
- display: inline-block;
10
- margin: 0;
11
- padding: 0;
12
- height: 4px;
13
- height: var(--Divider-border-width);
14
- width: 100%;
15
- }
16
- .wds-Divider--content {
17
- border-top: none;
18
- background: repeating-linear-gradient(to right, var(--Divider-border-color), var(--Divider-border-color) var(--Divider-dash-length), transparent var(--Divider-dash-length), transparent calc(var(--Divider-dash-length) + var(--Divider-dash-spacing)));
19
- height: var(--Divider-border-width);
20
- }
21
- .wds-Divider--content,
22
- .wds-Divider--subsection {
23
- --Divider-border-width: 1px;
24
- }
@@ -1,31 +0,0 @@
1
- .wds-Divider {
2
- --Divider-border-width: var(--size-4);
3
- --Divider-border-color: var(--color-border-neutral);
4
- --Divider-border-style: solid;
5
- --Divider-dash-length: var(--size-4);
6
- --Divider-dash-spacing: var(--size-4);
7
-
8
- border-top: var(--Divider-border-width) var(--Divider-border-style) var(--Divider-border-color);
9
- display: inline-block;
10
- margin: 0;
11
- padding: 0;
12
- height: var(--Divider-border-width);
13
- width: 100%;
14
-
15
- &--content {
16
- border-top: none;
17
- background: repeating-linear-gradient(
18
- to right,
19
- var(--Divider-border-color),
20
- var(--Divider-border-color) var(--Divider-dash-length),
21
- transparent var(--Divider-dash-length),
22
- transparent calc(var(--Divider-dash-length) + var(--Divider-dash-spacing))
23
- );
24
- height: var(--Divider-border-width);
25
- }
26
-
27
- &--content,
28
- &--subsection {
29
- --Divider-border-width: 1px;
30
- }
31
- }
@@ -1,68 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import Divider, { DividerProps } from './Divider';
4
-
5
- describe('Divider', () => {
6
- const defaultProps: DividerProps = {
7
- testId: 'test-divider',
8
- };
9
-
10
- let rerenderDivider: (props?: DividerProps) => void;
11
-
12
- beforeEach(() => {
13
- const { rerender } = render(<Divider {...defaultProps} />);
14
- rerenderDivider = (props?: DividerProps) => {
15
- rerender(<Divider {...defaultProps} {...props} />);
16
- };
17
- });
18
-
19
- const renderDivider = (props: Partial<DividerProps> = {}) => {
20
- return render(<Divider {...props} />);
21
- };
22
-
23
- it('should render the Divider component', () => {
24
- expect(screen.getByTestId('test-divider')).toBeInTheDocument();
25
- expect(screen.getByTestId('test-divider')).toHaveClass('wds-Divider');
26
- });
27
-
28
- it('should render as a semantic <hr> when `isContent` is true', () => {
29
- const props: DividerProps = { isContent: true };
30
- rerenderDivider(props);
31
-
32
- expect(screen.getByTestId('test-divider')).not.toHaveAttribute('role', 'presentation');
33
- });
34
-
35
- it('should render as a non-semantic <div> when `isContent` is false', () => {
36
- const props: DividerProps = { isContent: false };
37
- rerenderDivider(props);
38
-
39
- expect(screen.getByTestId('test-divider')).toHaveAttribute('role', 'presentation');
40
- });
41
-
42
- it('should apply custom class names when provided', () => {
43
- const props: DividerProps = { className: 'custom-class' };
44
- expect(screen.getByTestId('test-divider')).not.toHaveClass('custom-class');
45
-
46
- rerenderDivider(props);
47
- expect(screen.getByTestId('test-divider')).toHaveClass('custom-class');
48
- });
49
-
50
- it('should apply the "content" variant styling', () => {
51
- const props: DividerProps = { variant: 'content' };
52
- expect(screen.getByTestId('test-divider')).not.toHaveClass('wds-Divider--content');
53
-
54
- rerenderDivider(props);
55
- expect(screen.getByTestId('test-divider')).toHaveClass('wds-Divider', 'wds-Divider--content');
56
- });
57
-
58
- it('should apply the "subsection" variant styling', () => {
59
- const props: DividerProps = { variant: 'subsection' };
60
- expect(screen.getByTestId('test-divider')).not.toHaveClass('wds-Divider--subsection');
61
-
62
- rerenderDivider(props);
63
- expect(screen.getByTestId('test-divider')).toHaveClass(
64
- 'wds-Divider',
65
- 'wds-Divider--subsection',
66
- );
67
- });
68
- });