@transferwise/components 0.0.0-experimental-06b4575 → 0.0.0-experimental-7fec974

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 (134) hide show
  1. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.js +1 -1
  2. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.js.map +1 -1
  3. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.mjs +1 -1
  4. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.mjs.map +1 -1
  5. package/build/dateLookup/yearCalendar/table/YearCalendarTable.js +1 -1
  6. package/build/dateLookup/yearCalendar/table/YearCalendarTable.js.map +1 -1
  7. package/build/dateLookup/yearCalendar/table/YearCalendarTable.mjs +1 -1
  8. package/build/dateLookup/yearCalendar/table/YearCalendarTable.mjs.map +1 -1
  9. package/build/field/Field.js +1 -0
  10. package/build/field/Field.js.map +1 -1
  11. package/build/field/Field.mjs +1 -0
  12. package/build/field/Field.mjs.map +1 -1
  13. package/build/header/Header.js +1 -1
  14. package/build/header/Header.js.map +1 -1
  15. package/build/header/Header.mjs +1 -1
  16. package/build/header/Header.mjs.map +1 -1
  17. package/build/index.js +2 -0
  18. package/build/index.js.map +1 -1
  19. package/build/index.mjs +1 -0
  20. package/build/index.mjs.map +1 -1
  21. package/build/inputs/Input.js.map +1 -1
  22. package/build/inputs/Input.mjs.map +1 -1
  23. package/build/inputs/SearchInput.js.map +1 -1
  24. package/build/inputs/SearchInput.mjs.map +1 -1
  25. package/build/inputs/TextArea.js.map +1 -1
  26. package/build/inputs/TextArea.mjs.map +1 -1
  27. package/build/listItem/Prompt/ListItemPrompt.js +1 -0
  28. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
  29. package/build/listItem/Prompt/ListItemPrompt.mjs +1 -0
  30. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
  31. package/build/main.css +31 -0
  32. package/build/prompt/InfoPrompt/InfoPrompt.js +113 -0
  33. package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -0
  34. package/build/prompt/InfoPrompt/InfoPrompt.mjs +111 -0
  35. package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -0
  36. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  37. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  38. package/build/radioOption/RadioOption.js.map +1 -1
  39. package/build/radioOption/RadioOption.mjs.map +1 -1
  40. package/build/slidingPanel/SlidingPanel.js.map +1 -1
  41. package/build/slidingPanel/SlidingPanel.mjs.map +1 -1
  42. package/build/styles/main.css +31 -0
  43. package/build/styles/prompt/InfoPrompt/InfoPrompt.css +31 -0
  44. package/build/table/TableCell.js.map +1 -1
  45. package/build/table/TableCell.mjs.map +1 -1
  46. package/build/tabs/Tabs.js +1 -1
  47. package/build/tabs/Tabs.js.map +1 -1
  48. package/build/tabs/Tabs.mjs +1 -1
  49. package/build/tabs/Tabs.mjs.map +1 -1
  50. package/build/typeahead/Typeahead.js +1 -0
  51. package/build/typeahead/Typeahead.js.map +1 -1
  52. package/build/typeahead/Typeahead.mjs +1 -0
  53. package/build/typeahead/Typeahead.mjs.map +1 -1
  54. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -1
  55. package/build/types/index.d.ts +2 -1
  56. package/build/types/index.d.ts.map +1 -1
  57. package/build/types/inputs/Input.d.ts.map +1 -1
  58. package/build/types/inputs/SearchInput.d.ts.map +1 -1
  59. package/build/types/inputs/TextArea.d.ts.map +1 -1
  60. package/build/types/primitives/PrimitiveAnchor/PrimitiveAnchor.types.d.ts.map +1 -1
  61. package/build/types/primitives/PrimitiveButton/PrimitiveButton.types.d.ts.map +1 -1
  62. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts +56 -0
  63. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -0
  64. package/build/types/prompt/InfoPrompt/index.d.ts +3 -0
  65. package/build/types/prompt/InfoPrompt/index.d.ts.map +1 -0
  66. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +5 -5
  67. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
  68. package/build/types/prompt/index.d.ts +2 -0
  69. package/build/types/prompt/index.d.ts.map +1 -1
  70. package/build/types/radioOption/RadioOption.d.ts.map +1 -1
  71. package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
  72. package/build/types/table/TableCell.d.ts.map +1 -1
  73. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
  74. package/build/uploadInput/UploadInput.js +1 -1
  75. package/build/uploadInput/UploadInput.js.map +1 -1
  76. package/build/uploadInput/UploadInput.mjs +1 -1
  77. package/build/uploadInput/UploadInput.mjs.map +1 -1
  78. package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
  79. package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
  80. package/package.json +3 -3
  81. package/src/actionButton/ActionButton.story.tsx +9 -2
  82. package/src/avatar/Avatar.story.tsx +8 -2
  83. package/src/avatarLayout/AvatarLayout.story.tsx +3 -3
  84. package/src/avatarView/AvatarView.story.tsx +29 -24
  85. package/src/button/_stories/Button.test.story.tsx +10 -5
  86. package/src/checkbox/Checkbox.story.tsx +16 -3
  87. package/src/circularButton/CircularButton.story.tsx +7 -2
  88. package/src/common/bottomSheet/BottomSheet.story.tsx +32 -6
  89. package/src/common/circle/Circle.story.tsx +14 -3
  90. package/src/criticalBanner/CriticalCommsBanner.story.tsx +16 -3
  91. package/src/dateInput/DateInput.test.story.tsx +13 -3
  92. package/src/dateLookup/DateLookup.story.tsx +7 -9
  93. package/src/dateLookup/monthCalendar/table/MonthCalendarTable.tsx +1 -5
  94. package/src/dateLookup/yearCalendar/table/YearCalendarTable.tsx +1 -1
  95. package/src/header/Header.test.story.tsx +10 -5
  96. package/src/header/Header.tsx +1 -1
  97. package/src/index.ts +2 -1
  98. package/src/info/Info.story.tsx +20 -4
  99. package/src/inputs/Input.tsx +8 -9
  100. package/src/inputs/SearchInput.tsx +8 -9
  101. package/src/inputs/TextArea.tsx +6 -7
  102. package/src/listItem/_stories/variants/ListItem.brightGreen.test.story.tsx +7 -2
  103. package/src/listItem/_stories/variants/ListItem.dark.test.story.tsx +7 -2
  104. package/src/listItem/_stories/variants/ListItem.forestGreen.test.story.tsx +7 -2
  105. package/src/listItem/_stories/variants/ListItem.rtl.test.story.tsx +7 -2
  106. package/src/main.css +31 -0
  107. package/src/main.less +2 -1
  108. package/src/modal/Modal.story.tsx +31 -6
  109. package/src/primitives/PrimitiveAnchor/PrimitiveAnchor.types.ts +1 -3
  110. package/src/primitives/PrimitiveButton/PrimitiveButton.types.ts +1 -3
  111. package/src/prompt/ActionPrompt/ActionPrompt.less +1 -1
  112. package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +7 -2
  113. package/src/prompt/ActionPrompt/ActionPrompt.test.tsx +2 -7
  114. package/src/prompt/InfoPrompt/InfoPrompt.css +31 -0
  115. package/src/prompt/InfoPrompt/InfoPrompt.less +37 -0
  116. package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +312 -0
  117. package/src/prompt/InfoPrompt/InfoPrompt.test.story.tsx +246 -0
  118. package/src/prompt/InfoPrompt/InfoPrompt.test.tsx +224 -0
  119. package/src/prompt/InfoPrompt/InfoPrompt.tsx +148 -0
  120. package/src/prompt/InfoPrompt/index.ts +2 -0
  121. package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +1 -1
  122. package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +5 -5
  123. package/src/prompt/index.ts +5 -0
  124. package/src/radioOption/RadioOption.tsx +2 -1
  125. package/src/select/Select.story.tsx +1 -1
  126. package/src/slidingPanel/SlidingPanel.tsx +4 -2
  127. package/src/snackbar/Snackbar.test.story.tsx +32 -6
  128. package/src/ssr.test.tsx +1 -0
  129. package/src/statusIcon/StatusIcon.story.tsx +9 -5
  130. package/src/table/TableCell.tsx +1 -3
  131. package/src/tabs/Tabs.tsx +1 -1
  132. package/src/tooltip/Tooltip.story.tsx +7 -2
  133. package/src/uploadInput/UploadInput.tsx +1 -1
  134. package/src/withDisplayFormat/WithDisplayFormat.tsx +13 -14
@@ -37,7 +37,7 @@ const MonthCalendarTable = ({
37
37
  });
38
38
  };
39
39
  const isActive = month => {
40
- return !!(selectedDate && month === selectedDate.getMonth() && viewYear === selectedDate.getFullYear());
40
+ return !!(month === selectedDate?.getMonth() && viewYear === selectedDate.getFullYear());
41
41
  };
42
42
  const isThisMonth = month => {
43
43
  return viewYear === new Date().getFullYear() && month === new Date().getMonth();
@@ -1 +1 @@
1
- {"version":3,"file":"MonthCalendarTable.js","sources":["../../../../src/dateLookup/monthCalendar/table/MonthCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface MonthCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (date: number) => void;\n}\n\nconst ROWS = 3;\nconst COLS = 4;\nconst MONTH_ONLY_FORMAT: Intl.DateTimeFormatOptions = { month: 'short' };\n\nconst MonthCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: MonthCalendarTableProps) => {\n const { locale } = useIntl();\n\n const getLink = (month: number) => {\n return (\n <TableLink\n item={month}\n type=\"month\"\n title={formatDate(new Date(viewYear, month), locale, MONTH_ONLY_FORMAT)}\n active={isActive(month)}\n disabled={isDisabled(month)}\n today={viewYear === new Date().getFullYear() && month === new Date().getMonth()}\n autofocus={autofocusMonth === month}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (month: number) => {\n return !!(\n selectedDate &&\n month === selectedDate.getMonth() &&\n viewYear === selectedDate.getFullYear()\n );\n };\n\n const isThisMonth = (month: number) => {\n return viewYear === new Date().getFullYear() && month === new Date().getMonth();\n };\n\n const isDisabled = (month: number) => {\n const date = new Date(viewYear, month);\n return !!(\n (min && date < new Date(min.getFullYear(), min.getMonth())) ||\n (max && date > new Date(max.getFullYear(), max.getMonth()))\n );\n };\n\n const autofocusMonth = (() => {\n const months = Array.from({ length: ROWS * COLS }, (_, index) => index);\n return getFocusableTime({ isActive, isNow: isThisMonth, isDisabled, timeSpan: months });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar np-text-body-default-bold m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default MonthCalendarTable;\n"],"names":["ROWS","COLS","MONTH_ONLY_FORMAT","month","MonthCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","getFullYear","getMonth","autofocus","autofocusMonth","onClick","isThisMonth","date","months","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,iBAAiB,GAA+B;AAAEC,EAAAA,KAAK,EAAE;CAAS;AAExE,MAAMC,kBAAkB,GAAGA,CAAC;EAC1BC,YAAY;EACZC,GAAG;EACHC,GAAG;EACHC,QAAQ;EACRC,WAAW;AACXC,EAAAA;AAAQ,CACgB,KAAI;EAC5B,MAAM;AAAEC,IAAAA;GAAQ,GAAGC,iBAAO,EAAE;EAE5B,MAAMC,OAAO,GAAIV,KAAa,IAAI;IAChC,oBACEW,cAAA,CAACC,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EAA9CA,QAAmD,CAC7D;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
1
+ {"version":3,"file":"MonthCalendarTable.js","sources":["../../../../src/dateLookup/monthCalendar/table/MonthCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface MonthCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (date: number) => void;\n}\n\nconst ROWS = 3;\nconst COLS = 4;\nconst MONTH_ONLY_FORMAT: Intl.DateTimeFormatOptions = { month: 'short' };\n\nconst MonthCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: MonthCalendarTableProps) => {\n const { locale } = useIntl();\n\n const getLink = (month: number) => {\n return (\n <TableLink\n item={month}\n type=\"month\"\n title={formatDate(new Date(viewYear, month), locale, MONTH_ONLY_FORMAT)}\n active={isActive(month)}\n disabled={isDisabled(month)}\n today={viewYear === new Date().getFullYear() && month === new Date().getMonth()}\n autofocus={autofocusMonth === month}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (month: number) => {\n return !!(month === selectedDate?.getMonth() && viewYear === selectedDate.getFullYear());\n };\n\n const isThisMonth = (month: number) => {\n return viewYear === new Date().getFullYear() && month === new Date().getMonth();\n };\n\n const isDisabled = (month: number) => {\n const date = new Date(viewYear, month);\n return !!(\n (min && date < new Date(min.getFullYear(), min.getMonth())) ||\n (max && date > new Date(max.getFullYear(), max.getMonth()))\n );\n };\n\n const autofocusMonth = (() => {\n const months = Array.from({ length: ROWS * COLS }, (_, index) => index);\n return getFocusableTime({ isActive, isNow: isThisMonth, isDisabled, timeSpan: months });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar np-text-body-default-bold m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default MonthCalendarTable;\n"],"names":["ROWS","COLS","MONTH_ONLY_FORMAT","month","MonthCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","getFullYear","getMonth","autofocus","autofocusMonth","onClick","isThisMonth","date","months","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,iBAAiB,GAA+B;AAAEC,EAAAA,KAAK,EAAE;CAAS;AAExE,MAAMC,kBAAkB,GAAGA,CAAC;EAC1BC,YAAY;EACZC,GAAG;EACHC,GAAG;EACHC,QAAQ;EACRC,WAAW;AACXC,EAAAA;AAAQ,CACgB,KAAI;EAC5B,MAAM;AAAEC,IAAAA;GAAQ,GAAGC,iBAAO,EAAE;EAE5B,MAAMC,OAAO,GAAIV,KAAa,IAAI;IAChC,oBACEW,cAAA,CAACC,iBAAS,EAAA;AACRC,MAAAA,IAAI,EAAEb,KAAM;AACZc,MAAAA,IAAI,EAAC,OAAO;AACZC,MAAAA,KAAK,EAAEC,qBAAU,CAAC,IAAIC,IAAI,CAACZ,QAAQ,EAAEL,KAAK,CAAC,EAAEQ,MAAM,EAAET,iBAAiB,CAAE;AACxEmB,MAAAA,MAAM,EAAEC,QAAQ,CAACnB,KAAK,CAAE;AACxBoB,MAAAA,QAAQ,EAAEC,UAAU,CAACrB,KAAK,CAAE;MAC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AA,KAAK,EAAET,WAAW;MAAEP,UAAU;AAAEiB,MAAAA,QAAQ,EAAER;AAAM,KAAE,CAAC;AACzF,EAAA,CAAC,GAAG;AAEJ,EAAA,oBACES,eAAA,CAAA,OAAA,EAAA;AAAOC,IAAAA,SAAS,EAAC,8FAA8F;AAAAC,IAAAA,QAAA,gBAC7G9B,cAAA,CAAA,OAAA,EAAA;AAAO6B,MAAAA,SAAS,EAAC,SAAS;AAAAC,MAAAA,QAAA,eACxB9B,cAAA,CAAA,IAAA,EAAA;AAAA8B,QAAAA,QAAA,eACE9B,cAAA,CAAA,IAAA,EAAA;AAAI+B,UAAAA,OAAO,EAAE5C,IAAK;AAAA2C,UAAAA,QAAA,EAAEnC;SAAgB;OAClC;KACC,CACP,eAAAK,cAAA,CAAA,OAAA,EAAA;AAAA8B,MAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,QAAAA,MAAM,EAAEpC;AAAI,OAAE,EAAE,CAACqC,CAAC,EAAES,QAAQ,kBACxChC,cAAA,CAAA,IAAA,EAAA;AAAA8B,QAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,UAAAA,MAAM,EAAEnC;AAAI,SAAE,EAAE,CAACoC,CAAC,EAAEU,QAAQ,kBACxCjC,cAAA,CAAA,IAAA,EAAA;AAAA8B,UAAAA,QAAA,EAAoB/B,OAAO,CAACiC,QAAQ,GAAG7C,IAAI,GAAG8C,QAAQ;AAAC,SAAA,EAA9CA,QAAmD,CAC7D;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
@@ -33,7 +33,7 @@ const MonthCalendarTable = ({
33
33
  });
34
34
  };
35
35
  const isActive = month => {
36
- return !!(selectedDate && month === selectedDate.getMonth() && viewYear === selectedDate.getFullYear());
36
+ return !!(month === selectedDate?.getMonth() && viewYear === selectedDate.getFullYear());
37
37
  };
38
38
  const isThisMonth = month => {
39
39
  return viewYear === new Date().getFullYear() && month === new Date().getMonth();
@@ -1 +1 @@
1
- {"version":3,"file":"MonthCalendarTable.mjs","sources":["../../../../src/dateLookup/monthCalendar/table/MonthCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface MonthCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (date: number) => void;\n}\n\nconst ROWS = 3;\nconst COLS = 4;\nconst MONTH_ONLY_FORMAT: Intl.DateTimeFormatOptions = { month: 'short' };\n\nconst MonthCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: MonthCalendarTableProps) => {\n const { locale } = useIntl();\n\n const getLink = (month: number) => {\n return (\n <TableLink\n item={month}\n type=\"month\"\n title={formatDate(new Date(viewYear, month), locale, MONTH_ONLY_FORMAT)}\n active={isActive(month)}\n disabled={isDisabled(month)}\n today={viewYear === new Date().getFullYear() && month === new Date().getMonth()}\n autofocus={autofocusMonth === month}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (month: number) => {\n return !!(\n selectedDate &&\n month === selectedDate.getMonth() &&\n viewYear === selectedDate.getFullYear()\n );\n };\n\n const isThisMonth = (month: number) => {\n return viewYear === new Date().getFullYear() && month === new Date().getMonth();\n };\n\n const isDisabled = (month: number) => {\n const date = new Date(viewYear, month);\n return !!(\n (min && date < new Date(min.getFullYear(), min.getMonth())) ||\n (max && date > new Date(max.getFullYear(), max.getMonth()))\n );\n };\n\n const autofocusMonth = (() => {\n const months = Array.from({ length: ROWS * COLS }, (_, index) => index);\n return getFocusableTime({ isActive, isNow: isThisMonth, isDisabled, timeSpan: months });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar np-text-body-default-bold m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default MonthCalendarTable;\n"],"names":["ROWS","COLS","MONTH_ONLY_FORMAT","month","MonthCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","getFullYear","getMonth","autofocus","autofocusMonth","onClick","isThisMonth","date","months","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,iBAAiB,GAA+B;AAAEC,EAAAA,KAAK,EAAE;CAAS;AAExE,MAAMC,kBAAkB,GAAGA,CAAC;EAC1BC,YAAY;EACZC,GAAG;EACHC,GAAG;EACHC,QAAQ;EACRC,WAAW;AACXC,EAAAA;AAAQ,CACgB,KAAI;EAC5B,MAAM;AAAEC,IAAAA;GAAQ,GAAGC,OAAO,EAAE;EAE5B,MAAMC,OAAO,GAAIV,KAAa,IAAI;IAChC,oBACEW,GAAA,CAACC,SAAS,EAAA;AACRC,MAAAA,IAAI,EAAEb,KAAM;AACZc,MAAAA,IAAI,EAAC,OAAO;AACZC,MAAAA,KAAK,EAAEC,UAAU,CAAC,IAAIC,IAAI,CAACZ,QAAQ,EAAEL,KAAK,CAAC,EAAEQ,MAAM,EAAET,iBAAiB,CAAE;AACxEmB,MAAAA,MAAM,EAAEC,QAAQ,CAACnB,KAAK,CAAE;AACxBoB,MAAAA,QAAQ,EAAEC,UAAU,CAACrB,KAAK,CAAE;MAC5BsB,KAAK,EAAEjB,QAAQ,KAAK,IAAIY,IAAI,EAAE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MAAAA,QAAQ,EAAER;AAAM,KAAE,CAAC;AACzF,EAAA,CAAC,GAAG;AAEJ,EAAA,oBACES,IAAA,CAAA,OAAA,EAAA;AAAOC,IAAAA,SAAS,EAAC,8FAA8F;AAAAC,IAAAA,QAAA,gBAC7G9B,GAAA,CAAA,OAAA,EAAA;AAAO6B,MAAAA,SAAS,EAAC,SAAS;AAAAC,MAAAA,QAAA,eACxB9B,GAAA,CAAA,IAAA,EAAA;AAAA8B,QAAAA,QAAA,eACE9B,GAAA,CAAA,IAAA,EAAA;AAAI+B,UAAAA,OAAO,EAAE5C,IAAK;AAAA2C,UAAAA,QAAA,EAAEnC;SAAgB;OAClC;KACC,CACP,eAAAK,GAAA,CAAA,OAAA,EAAA;AAAA8B,MAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,QAAAA,MAAM,EAAEpC;AAAI,OAAE,EAAE,CAACqC,CAAC,EAAES,QAAQ,kBACxChC,GAAA,CAAA,IAAA,EAAA;AAAA8B,QAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,UAAAA,MAAM,EAAEnC;AAAI,SAAE,EAAE,CAACoC,CAAC,EAAEU,QAAQ,kBACxCjC,GAAA,CAAA,IAAA,EAAA;AAAA8B,UAAAA,QAAA,EAAoB/B,OAAO,CAACiC,QAAQ,GAAG7C,IAAI,GAAG8C,QAAQ;AAAC,SAAA,EAA9CA,QAAmD,CAC7D;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
1
+ {"version":3,"file":"MonthCalendarTable.mjs","sources":["../../../../src/dateLookup/monthCalendar/table/MonthCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface MonthCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (date: number) => void;\n}\n\nconst ROWS = 3;\nconst COLS = 4;\nconst MONTH_ONLY_FORMAT: Intl.DateTimeFormatOptions = { month: 'short' };\n\nconst MonthCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: MonthCalendarTableProps) => {\n const { locale } = useIntl();\n\n const getLink = (month: number) => {\n return (\n <TableLink\n item={month}\n type=\"month\"\n title={formatDate(new Date(viewYear, month), locale, MONTH_ONLY_FORMAT)}\n active={isActive(month)}\n disabled={isDisabled(month)}\n today={viewYear === new Date().getFullYear() && month === new Date().getMonth()}\n autofocus={autofocusMonth === month}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (month: number) => {\n return !!(month === selectedDate?.getMonth() && viewYear === selectedDate.getFullYear());\n };\n\n const isThisMonth = (month: number) => {\n return viewYear === new Date().getFullYear() && month === new Date().getMonth();\n };\n\n const isDisabled = (month: number) => {\n const date = new Date(viewYear, month);\n return !!(\n (min && date < new Date(min.getFullYear(), min.getMonth())) ||\n (max && date > new Date(max.getFullYear(), max.getMonth()))\n );\n };\n\n const autofocusMonth = (() => {\n const months = Array.from({ length: ROWS * COLS }, (_, index) => index);\n return getFocusableTime({ isActive, isNow: isThisMonth, isDisabled, timeSpan: months });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar np-text-body-default-bold m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default MonthCalendarTable;\n"],"names":["ROWS","COLS","MONTH_ONLY_FORMAT","month","MonthCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","getFullYear","getMonth","autofocus","autofocusMonth","onClick","isThisMonth","date","months","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,iBAAiB,GAA+B;AAAEC,EAAAA,KAAK,EAAE;CAAS;AAExE,MAAMC,kBAAkB,GAAGA,CAAC;EAC1BC,YAAY;EACZC,GAAG;EACHC,GAAG;EACHC,QAAQ;EACRC,WAAW;AACXC,EAAAA;AAAQ,CACgB,KAAI;EAC5B,MAAM;AAAEC,IAAAA;GAAQ,GAAGC,OAAO,EAAE;EAE5B,MAAMC,OAAO,GAAIV,KAAa,IAAI;IAChC,oBACEW,GAAA,CAACC,SAAS,EAAA;AACRC,MAAAA,IAAI,EAAEb,KAAM;AACZc,MAAAA,IAAI,EAAC,OAAO;AACZC,MAAAA,KAAK,EAAEC,UAAU,CAAC,IAAIC,IAAI,CAACZ,QAAQ,EAAEL,KAAK,CAAC,EAAEQ,MAAM,EAAET,iBAAiB,CAAE;AACxEmB,MAAAA,MAAM,EAAEC,QAAQ,CAACnB,KAAK,CAAE;AACxBoB,MAAAA,QAAQ,EAAEC,UAAU,CAACrB,KAAK,CAAE;MAC5BsB,KAAK,EAAEjB,QAAQ,KAAK,IAAIY,IAAI,EAAE,CAACM,WAAW,EAAE,IAAIvB,KAAK,KAAK,IAAIiB,IAAI,EAAE,CAACO,QAAQ,EAAG;MAChFC,SAAS,EAAEC,cAAc,KAAK1B,KAAM;AACpC2B,MAAAA,OAAO,EAAEpB;AAAS,KAAA,CAClB;EAEN,CAAC;EAED,MAAMY,QAAQ,GAAInB,KAAa,IAAI;AACjC,IAAA,OAAO,CAAC,EAAEA,KAAK,KAAKE,YAAY,EAAEsB,QAAQ,EAAE,IAAInB,QAAQ,KAAKH,YAAY,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A,EAAA;AAAI+B,UAAAA,OAAO,EAAE5C,IAAK;AAAA2C,UAAAA,QAAA,EAAEnC;SAAgB;OAClC;KACC,CACP,eAAAK,GAAA,CAAA,OAAA,EAAA;AAAA8B,MAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,QAAAA,MAAM,EAAEpC;AAAI,OAAE,EAAE,CAACqC,CAAC,EAAES,QAAQ,kBACxChC,GAAA,CAAA,IAAA,EAAA;AAAA8B,QAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,UAAAA,MAAM,EAAEnC;AAAI,SAAE,EAAE,CAACoC,CAAC,EAAEU,QAAQ,kBACxCjC,GAAA,CAAA,IAAA,EAAA;AAAA8B,UAAAA,QAAA,EAAoB/B,OAAO,CAACiC,QAAQ,GAAG7C,IAAI,GAAG8C,QAAQ;AAAC,SAAA,EAA9CA,QAAmD,CAC7D;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
@@ -38,7 +38,7 @@ const YearCalendarTable = ({
38
38
  });
39
39
  };
40
40
  const isActive = year => {
41
- return !!(selectedDate && year === selectedDate.getFullYear());
41
+ return !!(year === selectedDate?.getFullYear());
42
42
  };
43
43
  const isThisYear = year => {
44
44
  return year === new Date().getFullYear();
@@ -1 +1 @@
1
- {"version":3,"file":"YearCalendarTable.js","sources":["../../../../src/dateLookup/yearCalendar/table/YearCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface YearCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (year: number) => void;\n}\n\nconst ROWS = 5;\nconst COLS = 4;\nconst YEAR_ONLY_FORMAT: Intl.DateTimeFormatOptions = { year: 'numeric' };\n\nconst YearCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: YearCalendarTableProps) => {\n const { locale } = useIntl();\n const startYear = viewYear - (viewYear % 20);\n const getLink = (year: number) => {\n return (\n <TableLink\n item={year}\n type=\"year\"\n title={formatDate(new Date(year, 0), locale, YEAR_ONLY_FORMAT)}\n active={isActive(year)}\n disabled={isDisabled(year)}\n today={isThisYear(year)}\n autofocus={autofocusYear === year}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (year: number) => {\n return !!(selectedDate && year === selectedDate.getFullYear());\n };\n\n const isThisYear = (year: number) => {\n return year === new Date().getFullYear();\n };\n\n const isDisabled = (year: number) => {\n return !!((min && year < min.getFullYear()) || (max && year > max.getFullYear()));\n };\n\n const autofocusYear = (() => {\n const years = Array.from({ length: ROWS * COLS }, (_, index) => startYear + index);\n return getFocusableTime({ isActive, isNow: isThisYear, isDisabled, timeSpan: years });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(startYear + rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default YearCalendarTable;\n"],"names":["ROWS","COLS","YEAR_ONLY_FORMAT","year","YearCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","startYear","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","isThisYear","autofocus","autofocusYear","onClick","getFullYear","years","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AAC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EAA1DA,QAA+D,CACzE;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
1
+ {"version":3,"file":"YearCalendarTable.js","sources":["../../../../src/dateLookup/yearCalendar/table/YearCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface YearCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (year: number) => void;\n}\n\nconst ROWS = 5;\nconst COLS = 4;\nconst YEAR_ONLY_FORMAT: Intl.DateTimeFormatOptions = { year: 'numeric' };\n\nconst YearCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: YearCalendarTableProps) => {\n const { locale } = useIntl();\n const startYear = viewYear - (viewYear % 20);\n const getLink = (year: number) => {\n return (\n <TableLink\n item={year}\n type=\"year\"\n title={formatDate(new Date(year, 0), locale, YEAR_ONLY_FORMAT)}\n active={isActive(year)}\n disabled={isDisabled(year)}\n today={isThisYear(year)}\n autofocus={autofocusYear === year}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (year: number) => {\n return !!(year === selectedDate?.getFullYear());\n };\n\n const isThisYear = (year: number) => {\n return year === new Date().getFullYear();\n };\n\n const isDisabled = (year: number) => {\n return !!((min && year < min.getFullYear()) || (max && year > max.getFullYear()));\n };\n\n const autofocusYear = (() => {\n const years = Array.from({ length: ROWS * COLS }, (_, index) => startYear + index);\n return getFocusableTime({ isActive, isNow: isThisYear, isDisabled, timeSpan: years });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(startYear + rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default YearCalendarTable;\n"],"names":["ROWS","COLS","YEAR_ONLY_FORMAT","year","YearCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","startYear","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","isThisYear","autofocus","autofocusYear","onClick","getFullYear","years","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,gBAAgB,GAA+B;AAAEC,EAAAA,IAAI,EAAE;CAAW;AAExE,MAAMC,iBAAiB,GAAGA,CAAC;EACzBC,YAAY;EACZC,GAAG;EACHC,GAAG;EACHC,QAAQ;EACRC,WAAW;AACXC,EAAAA;AAAQ,CACe,KAAI;EAC3B,MAAM;AAAEC,IAAAA;GAAQ,GAAGC,iBAAO,EAAE;AAC5B,EAAA,MAAMC,SAAS,GAAGL,QAAQ,GAAIA,QAAQ,GAAG,EAAG;EAC5C,MAAMM,OAAO,GAAIX,IAAY,IAAI;IAC/B,oBACEY,cAAA,CAACC,iBAAS,EAAA;AACRC,MAAAA,IAAI,EAAEd,IAAK;AACXe,MAAAA,IAAI,EAAC,MAAM;AACXC,MAAAA,KAAK,EAAEC,qBAAU,CAAC,IAAIC,IAAI,CAAClB,IAAI,EAAE,CAAC,CAAC,EAAEQ,MAAM,EAAET,gBAAgB,CAAE;AAC/DoB,MAAAA,MAAM,EAAEC,QAAQ,CAACpB,IAAI,CAAE;AACvBqB,MAAAA,QAAQ,EAAEC,UAAU,CAACtB,IAAI,CAAE;AAC3BuB,MAAAA,KAAK,EAAEC,UAAU,CAACxB,IAAI,CAAE;MACx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AElC;SAAgB;OAClC;KACC,CACP,eAAAM,cAAA,CAAA,OAAA,EAAA;AAAA4B,MAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,QAAAA,MAAM,EAAEnC;AAAI,OAAE,EAAE,CAACoC,CAAC,EAAES,QAAQ,kBACxC9B,cAAA,CAAA,IAAA,EAAA;AAAA4B,QAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,UAAAA,MAAM,EAAElC;AAAI,SAAE,EAAE,CAACmC,CAAC,EAAEU,QAAQ,kBACxC/B,cAAA,CAAA,IAAA,EAAA;UAAA4B,QAAA,EAAoB7B,OAAO,CAACD,SAAS,GAAGgC,QAAQ,GAAG5C,IAAI,GAAG6C,QAAQ;AAAC,SAAA,EAA1DA,QAA+D,CACzE;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
@@ -34,7 +34,7 @@ const YearCalendarTable = ({
34
34
  });
35
35
  };
36
36
  const isActive = year => {
37
- return !!(selectedDate && year === selectedDate.getFullYear());
37
+ return !!(year === selectedDate?.getFullYear());
38
38
  };
39
39
  const isThisYear = year => {
40
40
  return year === new Date().getFullYear();
@@ -1 +1 @@
1
- {"version":3,"file":"YearCalendarTable.mjs","sources":["../../../../src/dateLookup/yearCalendar/table/YearCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface YearCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (year: number) => void;\n}\n\nconst ROWS = 5;\nconst COLS = 4;\nconst YEAR_ONLY_FORMAT: Intl.DateTimeFormatOptions = { year: 'numeric' };\n\nconst YearCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: YearCalendarTableProps) => {\n const { locale } = useIntl();\n const startYear = viewYear - (viewYear % 20);\n const getLink = (year: number) => {\n return (\n <TableLink\n item={year}\n type=\"year\"\n title={formatDate(new Date(year, 0), locale, YEAR_ONLY_FORMAT)}\n active={isActive(year)}\n disabled={isDisabled(year)}\n today={isThisYear(year)}\n autofocus={autofocusYear === year}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (year: number) => {\n return !!(selectedDate && year === selectedDate.getFullYear());\n };\n\n const isThisYear = (year: number) => {\n return year === new Date().getFullYear();\n };\n\n const isDisabled = (year: number) => {\n return !!((min && year < min.getFullYear()) || (max && year > max.getFullYear()));\n };\n\n const autofocusYear = (() => {\n const years = Array.from({ length: ROWS * COLS }, (_, index) => startYear + index);\n return getFocusableTime({ isActive, isNow: isThisYear, isDisabled, timeSpan: years });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(startYear + rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default YearCalendarTable;\n"],"names":["ROWS","COLS","YEAR_ONLY_FORMAT","year","YearCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","startYear","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","isThisYear","autofocus","autofocusYear","onClick","getFullYear","years","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,gBAAgB,GAA+B;AAAEC,EAAAA,IAAI,EAAE;CAAW;AAExE,MAA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A,GAAO,CAAC;AAEZ;;;;"}
1
+ {"version":3,"file":"YearCalendarTable.mjs","sources":["../../../../src/dateLookup/yearCalendar/table/YearCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface YearCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (year: number) => void;\n}\n\nconst ROWS = 5;\nconst COLS = 4;\nconst YEAR_ONLY_FORMAT: Intl.DateTimeFormatOptions = { year: 'numeric' };\n\nconst YearCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: YearCalendarTableProps) => {\n const { locale } = useIntl();\n const startYear = viewYear - (viewYear % 20);\n const getLink = (year: number) => {\n return (\n <TableLink\n item={year}\n type=\"year\"\n title={formatDate(new Date(year, 0), locale, YEAR_ONLY_FORMAT)}\n active={isActive(year)}\n disabled={isDisabled(year)}\n today={isThisYear(year)}\n autofocus={autofocusYear === year}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (year: number) => {\n return !!(year === selectedDate?.getFullYear());\n };\n\n const isThisYear = (year: number) => {\n return year === new Date().getFullYear();\n };\n\n const isDisabled = (year: number) => {\n return !!((min && year < min.getFullYear()) || (max && year > max.getFullYear()));\n };\n\n const autofocusYear = (() => {\n const years = Array.from({ length: ROWS * COLS }, (_, index) => startYear + index);\n return getFocusableTime({ isActive, isNow: isThisYear, isDisabled, timeSpan: years });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(startYear + rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default YearCalendarTable;\n"],"names":["ROWS","COLS","YEAR_ONLY_FORMAT","year","YearCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","startYear","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","isThisYear","autofocus","autofocusYear","onClick","getFullYear","years","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,gBAAgB,GAA+B;AAAEC,EAAAA,IAAI,EAAE;CAAW;AAExE,MAAMC,iBAAiB,GAAGA,CAAC;EACzBC,YAAY;EACZC,GAAG;EACHC,GAAG;EACHC,QAAQ;EACRC,WAAW;AACXC,EAAAA;AAAQ,CACe,KAAI;EAC3B,MAAM;AAAEC,IAAAA;GAAQ,GAAGC,OAAO,EAAE;AAC5B,EAAA,MAAMC,SAAS,GAAGL,QAAQ,GAAIA,QAAQ,GAAG,EAAG;EAC5C,MAAMM,OAAO,GAAIX,IAAY,IAAI;IAC/B,oBACEY,GAAA,CAACC,SAAS,EAAA;AACRC,MAAAA,IAAI,EAAEd,IAAK;AACXe,MAAAA,IAAI,EAAC,MAAM;AACXC,MAAAA,KAAK,EAAEC,UAAU,CAAC,IAAIC,IAAI,CAAClB,IAAI,EAAE,CAAC,CAAC,EAAEQ,MAAM,EAAET,gBAAgB,CAAE;AAC/DoB,MAAAA,MAAM,EAAEC,QAAQ,CAACpB,IAAI,CAAE;AACvBqB,MAAAA,QAAQ,EAAEC,UAAU,CAACtB,IAAI,CAAE;AAC3BuB,MAAAA,KAAK,EAAEC,UAAU,CAACxB,IAAI,CAAE;MACxByB,SAAS,EAAEC,aAAa,KAAK1B,IAAK;AAClC2B,MAAAA,OAAO,EAAEpB;AAAS,KAA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AA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,QAAAA,MAAM,EAAEnC;AAAI,OAAE,EAAE,CAACoC,CAAC,EAAES,QAAQ,kBACxC9B,GAAA,CAAA,IAAA,EAAA;AAAA4B,QAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,UAAAA,MAAM,EAAElC;AAAI,SAAE,EAAE,CAACmC,CAAC,EAAEU,QAAQ,kBACxC/B,GAAA,CAAA,IAAA,EAAA;UAAA4B,QAAA,EAAoB7B,OAAO,CAACD,SAAS,GAAGgC,QAAQ,GAAG5C,IAAI,GAAG6C,QAAQ;AAAC,SAAA,EAA1DA,QAA+D,CACzE;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
@@ -36,6 +36,7 @@ require('../provider/direction/DirectionProvider.js');
36
36
  require('../sentimentSurface/SentimentSurface.js');
37
37
  require('../primitives/PrimitiveButton/PrimitiveButton.js');
38
38
  require('../primitives/PrimitiveAnchor/PrimitiveAnchor.js');
39
+ require('../link/Link.messages.js');
39
40
  var contexts = require('../inputs/contexts.js');
40
41
  var Label = require('../label/Label.js');
41
42
 
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAMA,KAAK,GAAGA,CAAC;EACpBC,EAAE;EACFC,KAAK;AACLC,EAAAA,QAAQ,GAAG,IAAI;AACfC,EAAAA,OAAO,EAAEC,WAAW;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,IAAI;AACJC,EAAAA,WAAW,GAAGD,IAAI;AAClBE,EAAAA,SAAS,EAAEC,QAAQ,GAAGC,mBAAS,CAACC,OAAO;EACvCC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAK,CACG,KAAI;AACf,EAAA,MAAMC,QAAQ,GAAGC,YAAM,CAAmB,IAAI,CAAC;EAC/C,MAAMR,WAAS,GAAGM,KAAK,CAACG,KAAK,GAAGP,mBAAS,CAACQ,QAAQ,GAAGT,QAAQ;AAC7D,EAAA,MAAMP,OAAO,GAAGC,WAAW,IAAIW,KAAK,CAACG,KAAK;AAC1C,EAAA,MAAME,QAAQ,GAAGX,WAAS,KAAKE,mBAAS,CAACQ,QAAQ;AAEj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, 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,EAAAA,OAAO,EAAEC,WAAW;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,IAAI;AACJC,EAAAA,WAAW,GAAGD,IAAI;AA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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;;;;"}
@@ -34,6 +34,7 @@ import '../provider/direction/DirectionProvider.mjs';
34
34
  import '../sentimentSurface/SentimentSurface.mjs';
35
35
  import '../primitives/PrimitiveButton/PrimitiveButton.mjs';
36
36
  import '../primitives/PrimitiveAnchor/PrimitiveAnchor.mjs';
37
+ import '../link/Link.messages.mjs';
37
38
  import { FieldLabelContextProvider, InputIdContextProvider, InputDescribedByProvider, InputInvalidProvider } from '../inputs/contexts.mjs';
38
39
  import { Label as LabelNamespace } from '../label/Label.mjs';
39
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAMA,KAAK,GAAGA,CAAC;EACpBC,EAAE;EACFC,KAAK;AACLC,EAAAA,QAAQ,GAAG,IAAI;AACfC,EAAAA,OAAO,EAAEC,WAAW;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,IAAI;AACJC,EAAAA,WAAW,GAAGD,IAAI;AAClBE,EAAAA,SAAS,EAAEC,QAAQ,GAAGC,SAAS,CAACC,OAAO;EACvCC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAK,CACG,KAAI;AACf,EAAA,MAAMC,QAAQ,GAAGC,MAAM,CAAmB,IAAI,CAAC;EAC/C,MAAMR,SAAS,GAAGM,KAAK,CAACG,KAAK,GAAGP,SAAS,CAACQ,QAAQ,GAAGT,QAAQ;AAC7D,EAAA,MAAMP,OAAO,GAAGC,WAAW,IAAIW,KAAK,CAACG,KAAK;AAC1C,EAAA,MAAME,QAAQ,GAAGX,SAAS,KAAKE,SAAS,CAACQ,QAAQ;AAEjD,EAAA,MAAME,OAAO,GAAGC,KAAK,EAAE;AAEvB,EAAA,MAAMC,eAAe,GAAGD,KAAK,EAAE;EAC/B,MAAME,OAAO,GA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AACC;aACrC,EACDC,SAAS,CACT;AAAAC,YAAAA,QAAA,GAEDb,KAAK,IAAI,IAAI,gBACZuC,IAAA,CAAAI,QAAA,EAAA;cAAA9B,QAAA,EAAA,cACEmB,GAAA,CAACY,cAAK,EAAA;AAACT,gBAAAA,GAAG,EAAEpB,QAAS;AAAChB,gBAAAA,EAAE,EAAEqB,OAAQ;AAACyB,gBAAAA,OAAO,EAAEtB,OAAQ;gBAAAV,QAAA,EACjDZ,QAAQ,GAAGD,KAAK,gBAAGgC,GAAA,CAACY,cAAK,CAACE,QAAQ,EAAA;AAAAjC,kBAAAA,QAAA,EAAEb;iBAAsB;AAAC,eACvD,CACP,eAAAgC,GAAA,CAACY,cAAK,CAACG,WAAW,EAAA;AAAChD,gBAAAA,EAAE,EAAE2B,aAAc;AAAAb,gBAAAA,QAAA,EAAEN;eAA+B,CACtE,eAAAyB,GAAA,CAAA,KAAA,EAAA;AAAKpB,gBAAAA,SAAS,EAAC,kBAAkB;AAAAC,gBAAAA,QAAA,EAAEA;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;;;;"}
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,EAAAA,OAAO,EAAEC,WAAW;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,IAAI;AACJC,EAAAA,WAAW,GAAGD,IAAI;AAClBE,EAAAA,SAAS,EAAEC,QAAQ,GAAGC,SAAS,CAACC,OAAO;EACvCC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAK,CACG,KAAI;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AAAA,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;;;;"}
@@ -82,7 +82,7 @@ const Header = /*#__PURE__*/React__default.default.forwardRef(({
82
82
  const {
83
83
  parentElement
84
84
  } = internalRef.current;
85
- if (!parentElement || parentElement.tagName.toLowerCase() !== 'fieldset') {
85
+ if (parentElement?.tagName.toLowerCase() !== 'fieldset') {
86
86
  console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
87
87
  }
88
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Header.js","sources":["../../src/header/Header.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport { AriaLabelProperty, CommonProps, Heading, LinkProps, Typography } from '../common';\nimport Link from '../link';\nimport Title from '../title';\nimport React, { useEffect, useRef, FunctionComponent, ReactNode } from 'react';\n\ntype ActionProps = AriaLabelProperty & {\n text: string;\n onClick?: (event: React.MouseEvent) => void;\n disabled?: boolean;\n};\n\ntype ButtonActionProps = ActionProps;\ntype LinkActionProps = ActionProps & LinkProps;\n\nexport interface HeaderProps extends CommonProps {\n /**\n * Optional prop to define the action for the header. If the `href` property\n * is provided, a `Link` will be rendered instead of a `Button`.\n */\n action?: ButtonActionProps | LinkActionProps;\n\n /**\n * Option prop to specify DOM render element of the title\n *\n * - When `as=\"legend\"`, the `Header` will render as a `<legend>` element.\n * **Note:** `<legend>` elements must be the first child of a `<fieldset>` to comply with HTML semantics.\n * If this condition is not met, a warning will be logged to the console.\n *\n * - Other valid values include standard heading tags (`h1` to `h6`) or `header`.\n */\n as?: Heading | 'legend' | 'header';\n\n /** Required prop to set the title of the Header. */\n title: ReactNode;\n\n /** Optional prop to specify the level of the Header */\n level?: 'section' | 'group';\n\n className?: string;\n testId?: string;\n}\n\n/**\n * Renders a header action which can be either a button or a link.\n *\n * @param {Object} props - The properties object.\n * @param {ButtonActionProps | LinkActionProps} props.action - The action object which can be either a button or a link.\n * @returns {JSX.Element} The rendered header action component.\n */\nconst HeaderAction = React.forwardRef<\n HTMLButtonElement | HTMLAnchorElement,\n { action: ButtonActionProps | LinkActionProps }\n>(({ action }, ref) => {\n return (\n <Link\n className=\"np-header__action-button\"\n aria-label={action['aria-label']}\n href={'href' in action ? action.href : undefined}\n target={'target' in action ? action.target : undefined}\n disabled={action.disabled}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n );\n});\n\nHeaderAction.displayName = 'HeaderAction';\n\n/**\n * @param {ButtonActionProps | LinkActionProps} [action] - Optional prop to specify the action button or link.\n * @param {Heading | 'legend'} [as='h5'] - Optional prop to override the heading element rendered for the title.\n * @param {string} title - Required prop to set the title of the section header.\n * @param {'group' | 'section'} [level='group'] - Optional prop to specify the level of the section header.\n * @param {string} [className]\n * @param {string} [testId]\n *\n * @see {@link Header } for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/typography-header--docs|Storybook Wise Design}\n */\nconst Header: FunctionComponent<HeaderProps> = React.forwardRef(\n (\n { as = 'h5', action, className, testId, title, level = 'group', ...props },\n ref: React.Ref<HTMLDivElement | HTMLHeadingElement | HTMLLegendElement>,\n ) => {\n const internalRef = useRef<HTMLLegendElement>(null);\n const levelTypography =\n level === 'group' ? Typography.TITLE_GROUP : Typography.TITLE_SUBSECTION;\n const headerClasses = clsx('np-header', className, {\n 'np-header--group': level === 'group',\n });\n\n const commonProps = {\n className: headerClasses,\n 'data-testid': testId,\n };\n\n useEffect(() => {\n if (as === 'legend' && internalRef.current) {\n const { parentElement } = internalRef.current;\n if (!parentElement || parentElement.tagName.toLowerCase() !== 'fieldset') {\n console.warn(\n 'Legends should be the first child in a fieldset, and this is not possible when including an action',\n );\n }\n }\n }, [as]);\n\n if (!action) {\n return (\n <Title ref={internalRef} as={as} type={levelTypography} {...commonProps} {...props}>\n {title}\n </Title>\n );\n }\n\n return (\n <div {...commonProps} {...props} ref={ref as React.Ref<HTMLDivElement>}>\n <Title as={as} type={levelTypography} className=\"np-header__title\">\n {title}\n </Title>\n <HeaderAction action={action} />\n </div>\n );\n },\n);\n\nHeader.displayName = 'Header';\n\nexport default Header;\n"],"names":["HeaderAction","React","forwardRef","action","ref","_jsx","Link","className","href","undefined","target","disabled","onClick","children","text","displayName","Header","as","testId","title","level","props","internalRef","useRef","levelTypography","Typography","TITLE_GROUP","TITLE_SUBSECTION","headerClasses","clsx","commonProps","useEffect","current","parentElement","tagName","toLowerCase","console","warn","Title","type","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAMA,YAAY,gBAAGC,sBAAK,CAACC,UAAU,CAGnC,CAAC;AAAEC,EAAAA;AAAM,CAAE,EAAEC,GAAG,KAAI;EACpB,oBACEC,cAAA,CAACC,YAAI,EAAA;AACHC,IAAAA,SAAS,EAAC,0BAA0B;IACpC,YAAA,EAAYJ,MAAM,CAAC,YAAY,CAAE;IACjCK,IAAI,EAAE,MAAM,IAAIL,MAAM,GAAGA,MAAM,CAACK,IAAI,GAAGC,SAAU;IACjDC,MAAM,EAAE,QAAQ,IAAIP,MAAM,GAAGA,MAAM,CAACO,MAAM,GAAGD,SAAU;IACvDE,QAAQ,EAAER,MAAM,CAACQ,QAAS;IAC1BC,OAAO,EAAET,MAAM,CAACS,OAAQ;IAAAC,QAAA,EAEvBV,MAAM,CAACW;AAAI,GACR,CAAC;AAEX,CAAC,CAAC;AAEFd,YAAY,CAACe,WAAW,GAAG,cAAc;AAEzC;;;;;;;;;;AAUG;AACH,MAAMC,MAAM,gBAAmCf,sBAAK,CAACC,UAAU,CAC7D,CACE;AAAEe,EAAAA,EAAE,GAAG,IAAI;EAAEd,MAAM;EAAEI,SAAS;EAAEW,MAAM;EAAEC,KAAK;AAAEC,EAAAA,KAAK,GAAG,OAAO;EAAE,GAAGC;AAAK,CAAE,EAC1EjB,GAAuE,KACr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AAA,EAAE,EAAEA,EAAG;AAACsB,MAAAA,IAAI,EAAEf,eAAgB;AAACjB,MAAAA,SAAS,EAAC,kBAAkB;AAAAM,MAAAA,QAAA,EAC/DM;AAAK,KACD,CACP,eAAAd,cAAA,CAACL,YAAY,EAAA;AAACG,MAAAA,MAAM,EAAEA;AAAO,KAAA,CAC/B;AAAA,GAAK,CAAC;AAEV,CAAC;AAGHa,MAAM,CAACD,WAAW,GAAG,QAAQ;;;;"}
1
+ {"version":3,"file":"Header.js","sources":["../../src/header/Header.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport { AriaLabelProperty, CommonProps, Heading, LinkProps, Typography } from '../common';\nimport Link from '../link';\nimport Title from '../title';\nimport React, { useEffect, useRef, FunctionComponent, ReactNode } from 'react';\n\ntype ActionProps = AriaLabelProperty & {\n text: string;\n onClick?: (event: React.MouseEvent) => void;\n disabled?: boolean;\n};\n\ntype ButtonActionProps = ActionProps;\ntype LinkActionProps = ActionProps & LinkProps;\n\nexport interface HeaderProps extends CommonProps {\n /**\n * Optional prop to define the action for the header. If the `href` property\n * is provided, a `Link` will be rendered instead of a `Button`.\n */\n action?: ButtonActionProps | LinkActionProps;\n\n /**\n * Option prop to specify DOM render element of the title\n *\n * - When `as=\"legend\"`, the `Header` will render as a `<legend>` element.\n * **Note:** `<legend>` elements must be the first child of a `<fieldset>` to comply with HTML semantics.\n * If this condition is not met, a warning will be logged to the console.\n *\n * - Other valid values include standard heading tags (`h1` to `h6`) or `header`.\n */\n as?: Heading | 'legend' | 'header';\n\n /** Required prop to set the title of the Header. */\n title: ReactNode;\n\n /** Optional prop to specify the level of the Header */\n level?: 'section' | 'group';\n\n className?: string;\n testId?: string;\n}\n\n/**\n * Renders a header action which can be either a button or a link.\n *\n * @param {Object} props - The properties object.\n * @param {ButtonActionProps | LinkActionProps} props.action - The action object which can be either a button or a link.\n * @returns {JSX.Element} The rendered header action component.\n */\nconst HeaderAction = React.forwardRef<\n HTMLButtonElement | HTMLAnchorElement,\n { action: ButtonActionProps | LinkActionProps }\n>(({ action }, ref) => {\n return (\n <Link\n className=\"np-header__action-button\"\n aria-label={action['aria-label']}\n href={'href' in action ? action.href : undefined}\n target={'target' in action ? action.target : undefined}\n disabled={action.disabled}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n );\n});\n\nHeaderAction.displayName = 'HeaderAction';\n\n/**\n * @param {ButtonActionProps | LinkActionProps} [action] - Optional prop to specify the action button or link.\n * @param {Heading | 'legend'} [as='h5'] - Optional prop to override the heading element rendered for the title.\n * @param {string} title - Required prop to set the title of the section header.\n * @param {'group' | 'section'} [level='group'] - Optional prop to specify the level of the section header.\n * @param {string} [className]\n * @param {string} [testId]\n *\n * @see {@link Header } for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/typography-header--docs|Storybook Wise Design}\n */\nconst Header: FunctionComponent<HeaderProps> = React.forwardRef(\n (\n { as = 'h5', action, className, testId, title, level = 'group', ...props },\n ref: React.Ref<HTMLDivElement | HTMLHeadingElement | HTMLLegendElement>,\n ) => {\n const internalRef = useRef<HTMLLegendElement>(null);\n const levelTypography =\n level === 'group' ? Typography.TITLE_GROUP : Typography.TITLE_SUBSECTION;\n const headerClasses = clsx('np-header', className, {\n 'np-header--group': level === 'group',\n });\n\n const commonProps = {\n className: headerClasses,\n 'data-testid': testId,\n };\n\n useEffect(() => {\n if (as === 'legend' && internalRef.current) {\n const { parentElement } = internalRef.current;\n if (parentElement?.tagName.toLowerCase() !== 'fieldset') {\n console.warn(\n 'Legends should be the first child in a fieldset, and this is not possible when including an action',\n );\n }\n }\n }, [as]);\n\n if (!action) {\n return (\n <Title ref={internalRef} as={as} type={levelTypography} {...commonProps} {...props}>\n {title}\n </Title>\n );\n }\n\n return (\n <div {...commonProps} {...props} ref={ref as React.Ref<HTMLDivElement>}>\n <Title as={as} type={levelTypography} className=\"np-header__title\">\n {title}\n </Title>\n <HeaderAction action={action} />\n </div>\n );\n },\n);\n\nHeader.displayName = 'Header';\n\nexport default Header;\n"],"names":["HeaderAction","React","forwardRef","action","ref","_jsx","Link","className","href","undefined","target","disabled","onClick","children","text","displayName","Header","as","testId","title","level","props","internalRef","useRef","levelTypography","Typography","TITLE_GROUP","TITLE_SUBSECTION","headerClasses","clsx","commonProps","useEffect","current","parentElement","tagName","toLowerCase","console","warn","Title","type","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAMA,YAAY,gBAAGC,sBAAK,CAACC,UAAU,CAGnC,CAAC;AAAEC,EAAAA;AAAM,CAAE,EAAEC,GAAG,KAAI;EACpB,oBACEC,cAAA,CAACC,YAAI,EAAA;AACHC,IAAAA,SAAS,EAAC,0BAA0B;IACpC,YAAA,EAAYJ,MAAM,CAAC,YAAY,CAAE;IACjCK,IAAI,EAAE,MAAM,IAAIL,MAAM,GAAGA,MAAM,CAACK,IAAI,GAAGC,SAAU;IACjDC,MAAM,EAAE,QAAQ,IAAIP,MAAM,GAAGA,MAAM,CAACO,MAAM,GAAGD,SAAU;IACvDE,QAAQ,EAAER,MAAM,CAACQ,QAAS;IAC1BC,OAAO,EAAET,MAAM,CAACS,OAAQ;IAAAC,QAAA,EAEvBV,MAAM,CAACW;AAAI,GACR,CAAC;AAEX,CAAC,CAAC;AAEFd,YAAY,CAACe,WAAW,GAAG,cAAc;AAEzC;;;;;;;;;;AAUG;AACH,MAAMC,MAAM,gBAAmCf,sBAAK,CAACC,UAAU,CAC7D,CACE;AAAEe,EAAAA,EAAE,GAAG,IAAI;EAAEd,MAAM;EAAEI,SAAS;EAAEW,MAAM;EAAEC,KAAK;AAAEC,EAAAA,KAAK,GAAG,OAAO;EAAE,GAAGC;AAAK,CAAE,EAC1EjB,GAAuE,KACrE;AACF,EAAA,MAAMkB,WAAW,GAAGC,YAAM,CAAoB,IAAI,CAAC;AACnD,EAAA,MAAMC,eAAe,GACnBJ,KAAK,KAAK,OAAO,GAAGK,qBAAU,CAACC,WAAW,GAAGD,qBAAU,CAACE,gBAAgB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EAAEA;AAAO,KAAA,CAC/B;AAAA,GAAK,CAAC;AAEV,CAAC;AAGHa,MAAM,CAACD,WAAW,GAAG,QAAQ;;;;"}
@@ -74,7 +74,7 @@ const Header = /*#__PURE__*/React__default.forwardRef(({
74
74
  const {
75
75
  parentElement
76
76
  } = internalRef.current;
77
- if (!parentElement || parentElement.tagName.toLowerCase() !== 'fieldset') {
77
+ if (parentElement?.tagName.toLowerCase() !== 'fieldset') {
78
78
  console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
79
79
  }
80
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Header.mjs","sources":["../../src/header/Header.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport { AriaLabelProperty, CommonProps, Heading, LinkProps, Typography } from '../common';\nimport Link from '../link';\nimport Title from '../title';\nimport React, { useEffect, useRef, FunctionComponent, ReactNode } from 'react';\n\ntype ActionProps = AriaLabelProperty & {\n text: string;\n onClick?: (event: React.MouseEvent) => void;\n disabled?: boolean;\n};\n\ntype ButtonActionProps = ActionProps;\ntype LinkActionProps = ActionProps & LinkProps;\n\nexport interface HeaderProps extends CommonProps {\n /**\n * Optional prop to define the action for the header. If the `href` property\n * is provided, a `Link` will be rendered instead of a `Button`.\n */\n action?: ButtonActionProps | LinkActionProps;\n\n /**\n * Option prop to specify DOM render element of the title\n *\n * - When `as=\"legend\"`, the `Header` will render as a `<legend>` element.\n * **Note:** `<legend>` elements must be the first child of a `<fieldset>` to comply with HTML semantics.\n * If this condition is not met, a warning will be logged to the console.\n *\n * - Other valid values include standard heading tags (`h1` to `h6`) or `header`.\n */\n as?: Heading | 'legend' | 'header';\n\n /** Required prop to set the title of the Header. */\n title: ReactNode;\n\n /** Optional prop to specify the level of the Header */\n level?: 'section' | 'group';\n\n className?: string;\n testId?: string;\n}\n\n/**\n * Renders a header action which can be either a button or a link.\n *\n * @param {Object} props - The properties object.\n * @param {ButtonActionProps | LinkActionProps} props.action - The action object which can be either a button or a link.\n * @returns {JSX.Element} The rendered header action component.\n */\nconst HeaderAction = React.forwardRef<\n HTMLButtonElement | HTMLAnchorElement,\n { action: ButtonActionProps | LinkActionProps }\n>(({ action }, ref) => {\n return (\n <Link\n className=\"np-header__action-button\"\n aria-label={action['aria-label']}\n href={'href' in action ? action.href : undefined}\n target={'target' in action ? action.target : undefined}\n disabled={action.disabled}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n );\n});\n\nHeaderAction.displayName = 'HeaderAction';\n\n/**\n * @param {ButtonActionProps | LinkActionProps} [action] - Optional prop to specify the action button or link.\n * @param {Heading | 'legend'} [as='h5'] - Optional prop to override the heading element rendered for the title.\n * @param {string} title - Required prop to set the title of the section header.\n * @param {'group' | 'section'} [level='group'] - Optional prop to specify the level of the section header.\n * @param {string} [className]\n * @param {string} [testId]\n *\n * @see {@link Header } for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/typography-header--docs|Storybook Wise Design}\n */\nconst Header: FunctionComponent<HeaderProps> = React.forwardRef(\n (\n { as = 'h5', action, className, testId, title, level = 'group', ...props },\n ref: React.Ref<HTMLDivElement | HTMLHeadingElement | HTMLLegendElement>,\n ) => {\n const internalRef = useRef<HTMLLegendElement>(null);\n const levelTypography =\n level === 'group' ? Typography.TITLE_GROUP : Typography.TITLE_SUBSECTION;\n const headerClasses = clsx('np-header', className, {\n 'np-header--group': level === 'group',\n });\n\n const commonProps = {\n className: headerClasses,\n 'data-testid': testId,\n };\n\n useEffect(() => {\n if (as === 'legend' && internalRef.current) {\n const { parentElement } = internalRef.current;\n if (!parentElement || parentElement.tagName.toLowerCase() !== 'fieldset') {\n console.warn(\n 'Legends should be the first child in a fieldset, and this is not possible when including an action',\n );\n }\n }\n }, [as]);\n\n if (!action) {\n return (\n <Title ref={internalRef} as={as} type={levelTypography} {...commonProps} {...props}>\n {title}\n </Title>\n );\n }\n\n return (\n <div {...commonProps} {...props} ref={ref as React.Ref<HTMLDivElement>}>\n <Title as={as} type={levelTypography} className=\"np-header__title\">\n {title}\n </Title>\n <HeaderAction action={action} />\n </div>\n );\n },\n);\n\nHeader.displayName = 'Header';\n\nexport default Header;\n"],"names":["HeaderAction","React","forwardRef","action","ref","_jsx","Link","className","href","undefined","target","disabled","onClick","children","text","displayName","Header","as","testId","title","level","props","internalRef","useRef","levelTypography","Typography","TITLE_GROUP","TITLE_SUBSECTION","headerClasses","clsx","commonProps","useEffect","current","parentElement","tagName","toLowerCase","console","warn","Title","type","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAMA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAGnC,CAAC;AAAEC,EAAAA;AAAM,CAAE,EAAEC,GAAG,KAAI;EACpB,oBACEC,GAAA,CAACC,IAAI,EAAA;AACHC,IAAAA,SAAS,EAAC,0BAA0B;IACpC,YAAA,EAAYJ,MAAM,CAAC,YAAY,CAAE;IACjCK,IAAI,EAAE,MAAM,IAAIL,MAAM,GAAGA,MAAM,CAACK,IAAI,GAAGC,SAAU;IACjDC,MAAM,EAAE,QAAQ,IAAIP,MAAM,GAAGA,MAAM,CAACO,MAAM,GAAGD,SAAU;IACvDE,QAAQ,EAAER,MAAM,CAACQ,QAAS;IAC1BC,OAAO,EAAET,MAAM,CAACS,OAAQ;IAAAC,QAAA,EAEvBV,MAAM,CAACW;AAAI,GACR,CAAC;AAEX,CAAC,CAAC;AAEFd,YAAY,CAACe,WAAW,GAAG,cAAc;AAEzC;;;;;;;;;;AAUG;AACH,MAAMC,MAAM,gBAAmCf,cAAK,CAACC,UAAU,CAC7D,CACE;AAAEe,EAAAA,EAAE,GAAG,IAAI;EAAEd,MAAM;EAAEI,SAAS;EAAEW,MAAM;EAAEC,KAAK;AAAEC,EAAAA,KAAK,GAAG,OAAO;EAAE,GAAGC;AAAK,CAAE,EAC1EjB,GAAuE,KACrE;AACF,EAAA,MAAMkB,WAAW,GAAGC,MAAM,CAAoB,IAAI,CAAC;AACnD,EAAA,MAAMC,eAAe,GACnBJ,KAAK,KAAK,O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AAA,EAC/DM;AAAK,KACD,CACP,eAAAd,GAAA,CAACL,YAAY,EAAA;AAACG,MAAAA,MAAM,EAAEA;AAAO,KAAA,CAC/B;AAAA,GAAK,CAAC;AAEV,CAAC;AAGHa,MAAM,CAACD,WAAW,GAAG,QAAQ;;;;"}
1
+ {"version":3,"file":"Header.mjs","sources":["../../src/header/Header.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport { AriaLabelProperty, CommonProps, Heading, LinkProps, Typography } from '../common';\nimport Link from '../link';\nimport Title from '../title';\nimport React, { useEffect, useRef, FunctionComponent, ReactNode } from 'react';\n\ntype ActionProps = AriaLabelProperty & {\n text: string;\n onClick?: (event: React.MouseEvent) => void;\n disabled?: boolean;\n};\n\ntype ButtonActionProps = ActionProps;\ntype LinkActionProps = ActionProps & LinkProps;\n\nexport interface HeaderProps extends CommonProps {\n /**\n * Optional prop to define the action for the header. If the `href` property\n * is provided, a `Link` will be rendered instead of a `Button`.\n */\n action?: ButtonActionProps | LinkActionProps;\n\n /**\n * Option prop to specify DOM render element of the title\n *\n * - When `as=\"legend\"`, the `Header` will render as a `<legend>` element.\n * **Note:** `<legend>` elements must be the first child of a `<fieldset>` to comply with HTML semantics.\n * If this condition is not met, a warning will be logged to the console.\n *\n * - Other valid values include standard heading tags (`h1` to `h6`) or `header`.\n */\n as?: Heading | 'legend' | 'header';\n\n /** Required prop to set the title of the Header. */\n title: ReactNode;\n\n /** Optional prop to specify the level of the Header */\n level?: 'section' | 'group';\n\n className?: string;\n testId?: string;\n}\n\n/**\n * Renders a header action which can be either a button or a link.\n *\n * @param {Object} props - The properties object.\n * @param {ButtonActionProps | LinkActionProps} props.action - The action object which can be either a button or a link.\n * @returns {JSX.Element} The rendered header action component.\n */\nconst HeaderAction = React.forwardRef<\n HTMLButtonElement | HTMLAnchorElement,\n { action: ButtonActionProps | LinkActionProps }\n>(({ action }, ref) => {\n return (\n <Link\n className=\"np-header__action-button\"\n aria-label={action['aria-label']}\n href={'href' in action ? action.href : undefined}\n target={'target' in action ? action.target : undefined}\n disabled={action.disabled}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n );\n});\n\nHeaderAction.displayName = 'HeaderAction';\n\n/**\n * @param {ButtonActionProps | LinkActionProps} [action] - Optional prop to specify the action button or link.\n * @param {Heading | 'legend'} [as='h5'] - Optional prop to override the heading element rendered for the title.\n * @param {string} title - Required prop to set the title of the section header.\n * @param {'group' | 'section'} [level='group'] - Optional prop to specify the level of the section header.\n * @param {string} [className]\n * @param {string} [testId]\n *\n * @see {@link Header } for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/typography-header--docs|Storybook Wise Design}\n */\nconst Header: FunctionComponent<HeaderProps> = React.forwardRef(\n (\n { as = 'h5', action, className, testId, title, level = 'group', ...props },\n ref: React.Ref<HTMLDivElement | HTMLHeadingElement | HTMLLegendElement>,\n ) => {\n const internalRef = useRef<HTMLLegendElement>(null);\n const levelTypography =\n level === 'group' ? Typography.TITLE_GROUP : Typography.TITLE_SUBSECTION;\n const headerClasses = clsx('np-header', className, {\n 'np-header--group': level === 'group',\n });\n\n const commonProps = {\n className: headerClasses,\n 'data-testid': testId,\n };\n\n useEffect(() => {\n if (as === 'legend' && internalRef.current) {\n const { parentElement } = internalRef.current;\n if (parentElement?.tagName.toLowerCase() !== 'fieldset') {\n console.warn(\n 'Legends should be the first child in a fieldset, and this is not possible when including an action',\n );\n }\n }\n }, [as]);\n\n if (!action) {\n return (\n <Title ref={internalRef} as={as} type={levelTypography} {...commonProps} {...props}>\n {title}\n </Title>\n );\n }\n\n return (\n <div {...commonProps} {...props} ref={ref as React.Ref<HTMLDivElement>}>\n <Title as={as} type={levelTypography} className=\"np-header__title\">\n {title}\n </Title>\n <HeaderAction action={action} />\n </div>\n );\n },\n);\n\nHeader.displayName = 'Header';\n\nexport default Header;\n"],"names":["HeaderAction","React","forwardRef","action","ref","_jsx","Link","className","href","undefined","target","disabled","onClick","children","text","displayName","Header","as","testId","title","level","props","internalRef","useRef","levelTypography","Typography","TITLE_GROUP","TITLE_SUBSECTION","headerClasses","clsx","commonProps","useEffect","current","parentElement","tagName","toLowerCase","console","warn","Title","type","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAMA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAGnC,CAAC;AAAEC,EAAAA;AAAM,CAAE,EAAEC,GAAG,KAAI;EACpB,oBACEC,GAAA,CAACC,IAAI,EAAA;AACHC,IAAAA,SAAS,EAAC,0BAA0B;IACpC,YAAA,EAAYJ,MAAM,CAAC,YAAY,CAAE;IACjCK,IAAI,EAAE,MAAM,IAAIL,MAAM,GAAGA,MAAM,CAACK,IAAI,GAAGC,SAAU;IACjDC,MAAM,EAAE,QAAQ,IAAIP,MAAM,GAAGA,MAAM,CAACO,MAAM,GAAGD,SAAU;IACvDE,QAAQ,EAAER,MAAM,CAACQ,QAAS;IAC1BC,OAAO,EAAET,MAAM,CAACS,OAAQ;IAAAC,QAAA,EAEvBV,MAAM,CAACW;AAAI,GACR,CAAC;AAEX,CAAC,CAAC;AAEFd,YAAY,CAACe,WAAW,GAAG,cAAc;AAEzC;;;;;;;;;;AAUG;AACH,MAAMC,MAAM,gBAAmCf,cAAK,CAACC,UAAU,CAC7D,CACE;AAAEe,EAAAA,EAAE,GAAG,IAAI;EAAEd,MAAM;EAAEI,SAAS;EAAEW,MAAM;EAAEC,KAAK;AAAEC,EAAAA,KAAK,GAAG,OAAO;EAAE,GAAGC;AAAK,CAAE,EAC1EjB,GAAuE,KACrE;AACF,EAAA,MAAMkB,WAAW,GAAGC,MAAM,CAAoB,IAAI,CAAC;AACnD,EAAA,MAAMC,eAAe,GACnBJ,KAAK,KAAK,OAAO,GAAGK,UAAU,CAACC,WAAW,GAAGD,UAAU,CAACE,gBAAgB;AAC1E,EAAA,MAAMC,aAAa,GAAGC,IAAI,CAAC,WAAW,EAAEtB,SAAS,EAAE;IACjD,kBAAkB,EAAEa,KAAK,KAAK;AAC/B,GAAA,C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-53,6 +53,7 @@ var Info = require('./info/Info.js');
53
53
  var InlineAlert = require('./inlineAlert/InlineAlert.js');
54
54
  var InlinePrompt = require('./prompt/InlinePrompt/InlinePrompt.js');
55
55
  var ActionPrompt = require('./prompt/ActionPrompt/ActionPrompt.js');
56
+ var InfoPrompt = require('./prompt/InfoPrompt/InfoPrompt.js');
56
57
  var InputWithDisplayFormat = require('./inputWithDisplayFormat/InputWithDisplayFormat.js');
57
58
  var Input = require('./inputs/Input.js');
58
59
  var InputGroup = require('./inputs/InputGroup.js');
@@ -213,6 +214,7 @@ exports.Info = Info.default;
213
214
  exports.InlineAlert = InlineAlert.default;
214
215
  exports.InlinePrompt = InlinePrompt.InlinePrompt;
215
216
  exports.ActionPrompt = ActionPrompt.ActionPrompt;
217
+ exports.InfoPrompt = InfoPrompt.InfoPrompt;
216
218
  exports.InputWithDisplayFormat = InputWithDisplayFormat.default;
217
219
  exports.Input = Input.Input;
218
220
  exports.InputGroup = InputGroup.InputGroup;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/build/index.mjs CHANGED
@@ -51,6 +51,7 @@ 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
53
  export { ActionPrompt } from './prompt/ActionPrompt/ActionPrompt.mjs';
54
+ export { InfoPrompt } from './prompt/InfoPrompt/InfoPrompt.mjs';
54
55
  export { default as InputWithDisplayFormat } from './inputWithDisplayFormat/InputWithDisplayFormat.mjs';
55
56
  export { Input } from './inputs/Input.mjs';
56
57
  export { InputGroup } from './inputs/InputGroup.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../src/inputs/Input.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { forwardRef } from 'react';\n\nimport { SizeLarge, SizeMedium, SizeSmall } from '../common';\nimport { Merge } from '../utils';\nimport { inputClassNameBase } from './_common';\nimport { useInputAttributes } from './contexts';\nimport { useInputPaddings } from './InputGroup';\n\nexport interface InputProps\n extends Merge<\n React.ComponentPropsWithRef<'input'>,\n {\n size?: 'auto' | SizeSmall | SizeMedium | SizeLarge;\n shape?: 'rectangle' | 'pill';\n 'aria-invalid'?: boolean;\n }\n > {}\n\nexport const Input = forwardRef(function Input(\n { size = 'auto', shape = 'rectangle', className, ...restProps }: InputProps,\n reference: React.ForwardedRef<HTMLInputElement | null>,\n) {\n const inputAttributes = useInputAttributes();\n const inputPaddings = useInputPaddings();\n\n return (\n <input\n ref={reference}\n className={clsx(className, inputClassNameBase({ size }), 'np-input', {\n 'np-input--shape-rectangle': shape === 'rectangle',\n 'np-input--shape-pill': shape === 'pill',\n })}\n style={inputPaddings}\n {...inputAttributes}\n {...restProps}\n />\n );\n});\n"],"names":["Input","forwardRef","size","shape","className","restProps","reference","inputAttributes","useInputAttributes","inputPaddings","useInputPaddings","_jsx","ref","clsx","inputClassNameBase","style"],"mappings":";;;;;;;;;MAmBaA,KAAK,gBAAGC,gBAAU,CAAC,SAASD,KAAKA,CAC5C;AAAEE,EAAAA,IAAI,GAAG,MAAM;AAAEC,EAAAA,KAAK,GAAG,WAAW;EAAEC,SAAS;EAAE,GAAGC;AAAS,CAAc,EAC3EC,SAAsD,EAAA;AAEtD,EAAA,MAAMC,eAAe,GAAGC,2BAAkB,EAAE;AAC5C,EAAA,MAAMC,aAAa,GAAGC,2BAAgB,EAAE;AAExC,EAAA,oBACEC,cAAA,CAAA,OAAA,EAAA;AACEC,IAAAA,GAAG,EAAEN,SAAU;AACfF,IAAAA,SAAS,EAAES,SAAI,CAACT,SAAS,EAAEU,0BAAkB,CAAC;AAAEZ,MAAAA;KAAM,CAAC,EAAE,UAAU,EAAE;MACnE,2BAA2B,EAAEC,KAAK,KAAK,WAAW;MAClD,sBAAsB,EAAEA,KAAK,KAAK;AACnC,KAAA,CAAE;AACHY,IAAAA,KAAK,EAAEN,aAAc;AAAA,IAAA,GACjBF,eAAe;IAAA,GACfF;AAAS,GAAC,CACd;AAEN,CAAC;;;;"}
1
+ {"version":3,"file":"Input.js","sources":["../../src/inputs/Input.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { forwardRef } from 'react';\n\nimport { SizeLarge, SizeMedium, SizeSmall } from '../common';\nimport { Merge } from '../utils';\nimport { inputClassNameBase } from './_common';\nimport { useInputAttributes } from './contexts';\nimport { useInputPaddings } from './InputGroup';\n\nexport interface InputProps extends Merge<\n React.ComponentPropsWithRef<'input'>,\n {\n size?: 'auto' | SizeSmall | SizeMedium | SizeLarge;\n shape?: 'rectangle' | 'pill';\n 'aria-invalid'?: boolean;\n }\n> {}\n\nexport const Input = forwardRef(function Input(\n { size = 'auto', shape = 'rectangle', className, ...restProps }: InputProps,\n reference: React.ForwardedRef<HTMLInputElement | null>,\n) {\n const inputAttributes = useInputAttributes();\n const inputPaddings = useInputPaddings();\n\n return (\n <input\n ref={reference}\n className={clsx(className, inputClassNameBase({ size }), 'np-input', {\n 'np-input--shape-rectangle': shape === 'rectangle',\n 'np-input--shape-pill': shape === 'pill',\n })}\n style={inputPaddings}\n {...inputAttributes}\n {...restProps}\n />\n );\n});\n"],"names":["Input","forwardRef","size","shape","className","restProps","reference","inputAttributes","useInputAttributes","inputPaddings","useInputPaddings","_jsx","ref","clsx","inputClassNameBase","style"],"mappings":";;;;;;;;;MAkBaA,KAAK,gBAAGC,gBAAU,CAAC,SAASD,KAAKA,CAC5C;AAAEE,EAAAA,IAAI,GAAG,MAAM;AAAEC,EAAAA,KAAK,GAAG,WAAW;EAAEC,SAAS;EAAE,GAAGC;AAAS,CAAc,EAC3EC,SAAsD,EAAA;AAEtD,EAAA,MAAMC,eAAe,GAAGC,2BAAkB,EAAE;AAC5C,EAAA,MAAMC,aAAa,GAAGC,2BAAgB,EAAE;AAExC,EAAA,oBACEC,cAAA,CAAA,OAAA,EAAA;AACEC,IAAAA,GAAG,EAAEN,SAAU;AACfF,IAAAA,SAAS,EAAES,SAAI,CAACT,SAAS,EAAEU,0BAAkB,CAAC;AAAEZ,MAAAA;KAAM,CAAC,EAAE,UAAU,EAAE;MACnE,2BAA2B,EAAEC,KAAK,KAAK,WAAW;MAClD,sBAAsB,EAAEA,KAAK,KAAK;AACnC,KAAA,CAAE;AACHY,IAAAA,KAAK,EAAEN,aAAc;AAAA,IAAA,GACjBF,eAAe;IAAA,GACfF;AAAS,GAAC,CACd;AAEN,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Input.mjs","sources":["../../src/inputs/Input.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { forwardRef } from 'react';\n\nimport { SizeLarge, SizeMedium, SizeSmall } from '../common';\nimport { Merge } from '../utils';\nimport { inputClassNameBase } from './_common';\nimport { useInputAttributes } from './contexts';\nimport { useInputPaddings } from './InputGroup';\n\nexport interface InputProps\n extends Merge<\n React.ComponentPropsWithRef<'input'>,\n {\n size?: 'auto' | SizeSmall | SizeMedium | SizeLarge;\n shape?: 'rectangle' | 'pill';\n 'aria-invalid'?: boolean;\n }\n > {}\n\nexport const Input = forwardRef(function Input(\n { size = 'auto', shape = 'rectangle', className, ...restProps }: InputProps,\n reference: React.ForwardedRef<HTMLInputElement | null>,\n) {\n const inputAttributes = useInputAttributes();\n const inputPaddings = useInputPaddings();\n\n return (\n <input\n ref={reference}\n className={clsx(className, inputClassNameBase({ size }), 'np-input', {\n 'np-input--shape-rectangle': shape === 'rectangle',\n 'np-input--shape-pill': shape === 'pill',\n })}\n style={inputPaddings}\n {...inputAttributes}\n {...restProps}\n />\n );\n});\n"],"names":["Input","forwardRef","size","shape","className","restProps","reference","inputAttributes","useInputAttributes","inputPaddings","useInputPaddings","_jsx","ref","clsx","inputClassNameBase","style"],"mappings":";;;;;;;MAmBaA,KAAK,gBAAGC,UAAU,CAAC,SAASD,KAAKA,CAC5C;AAAEE,EAAAA,IAAI,GAAG,MAAM;AAAEC,EAAAA,KAAK,GAAG,WAAW;EAAEC,SAAS;EAAE,GAAGC;AAAS,CAAc,EAC3EC,SAAsD,EAAA;AAEtD,EAAA,MAAMC,eAAe,GAAGC,kBAAkB,EAAE;AAC5C,EAAA,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;AAExC,EAAA,oBACEC,GAAA,CAAA,OAAA,EAAA;AACEC,IAAAA,GAAG,EAAEN,SAAU;AACfF,IAAAA,SAAS,EAAES,IAAI,CAACT,SAAS,EAAEU,kBAAkB,CAAC;AAAEZ,MAAAA;KAAM,CAAC,EAAE,UAAU,EAAE;MACnE,2BAA2B,EAAEC,KAAK,KAAK,WAAW;MAClD,sBAAsB,EAAEA,KAAK,KAAK;AACnC,KAAA,CAAE;AACHY,IAAAA,KAAK,EAAEN,aAAc;AAAA,IAAA,GACjBF,eAAe;IAAA,GACfF;AAAS,GAAC,CACd;AAEN,CAAC;;;;"}
1
+ {"version":3,"file":"Input.mjs","sources":["../../src/inputs/Input.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { forwardRef } from 'react';\n\nimport { SizeLarge, SizeMedium, SizeSmall } from '../common';\nimport { Merge } from '../utils';\nimport { inputClassNameBase } from './_common';\nimport { useInputAttributes } from './contexts';\nimport { useInputPaddings } from './InputGroup';\n\nexport interface InputProps extends Merge<\n React.ComponentPropsWithRef<'input'>,\n {\n size?: 'auto' | SizeSmall | SizeMedium | SizeLarge;\n shape?: 'rectangle' | 'pill';\n 'aria-invalid'?: boolean;\n }\n> {}\n\nexport const Input = forwardRef(function Input(\n { size = 'auto', shape = 'rectangle', className, ...restProps }: InputProps,\n reference: React.ForwardedRef<HTMLInputElement | null>,\n) {\n const inputAttributes = useInputAttributes();\n const inputPaddings = useInputPaddings();\n\n return (\n <input\n ref={reference}\n className={clsx(className, inputClassNameBase({ size }), 'np-input', {\n 'np-input--shape-rectangle': shape === 'rectangle',\n 'np-input--shape-pill': shape === 'pill',\n })}\n style={inputPaddings}\n {...inputAttributes}\n {...restProps}\n />\n );\n});\n"],"names":["Input","forwardRef","size","shape","className","restProps","reference","inputAttributes","useInputAttributes","inputPaddings","useInputPaddings","_jsx","ref","clsx","inputClassNameBase","style"],"mappings":";;;;;;;MAkBaA,KAAK,gBAAGC,UAAU,CAAC,SAASD,KAAKA,CAC5C;AAAEE,EAAAA,IAAI,GAAG,MAAM;AAAEC,EAAAA,KAAK,GAAG,WAAW;EAAEC,SAAS;EAAE,GAAGC;AAAS,CAAc,EAC3EC,SAAsD,EAAA;AAEtD,EAAA,MAAMC,eAAe,GAAGC,kBAAkB,EAAE;AAC5C,EAAA,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;AAExC,EAAA,oBACEC,GAAA,CAAA,OAAA,EAAA;AACEC,IAAAA,GAAG,EAAEN,SAAU;AACfF,IAAAA,SAAS,EAAES,IAAI,CAACT,SAAS,EAAEU,kBAAkB,CAAC;AAAEZ,MAAAA;KAAM,CAAC,EAAE,UAAU,EAAE;MACnE,2BAA2B,EAAEC,KAAK,KAAK,WAAW;MAClD,sBAAsB,EAAEA,KAAK,KAAK;AACnC,KAAA,CAAE;AACHY,IAAAA,KAAK,EAAEN,aAAc;AAAA,IAAA,GACjBF,eAAe;IAAA,GACfF;AAAS,GAAC,CACd;AAEN,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.js","sources":["../../src/inputs/SearchInput.tsx"],"sourcesContent":["import { Search } from '@transferwise/icons';\nimport { forwardRef } from 'react';\n\nimport { Size } from '../common';\nimport { Merge } from '../utils';\n\nimport { Input } from './Input';\nimport { InputGroup } from './InputGroup';\n\nexport interface SearchInputProps\n extends Merge<\n React.ComponentPropsWithRef<'input'>,\n {\n size?: Size.SMALL | Size.MEDIUM;\n shape?: 'rectangle' | 'pill';\n 'aria-invalid'?: boolean;\n }\n > {}\n\nexport const SearchInput = forwardRef(function SearchInput(\n { shape = 'pill', size = Size.MEDIUM, disabled, className, ...restProps }: SearchInputProps,\n ref: React.ForwardedRef<HTMLInputElement | null>,\n) {\n return (\n <InputGroup\n addonStart={{\n content: <Search size={size === Size.SMALL ? 16 : 24} />,\n initialContentWidth: size === Size.SMALL ? 16 : 24,\n }}\n disabled={disabled}\n className={className}\n >\n <Input\n ref={ref}\n role=\"searchbox\"\n inputMode=\"search\"\n shape={shape}\n size={size}\n {...restProps}\n />\n </InputGroup>\n );\n});\n"],"names":["SearchInput","forwardRef","shape","size","Size","MEDIUM","disabled","className","restProps","ref","_jsx","InputGroup","addonStart","content","Search","SMALL","initialContentWidth","children","Input","role","inputMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAmBaA,WAAW,gBAAGC,gBAAU,CAAC,SAASD,WAAWA,CACxD;AAAEE,EAAAA,KAAK,GAAG,MAAM;QAAEC,MAAI,GAAGC,SAAI,CAACC,MAAM;EAAEC,QAAQ;EAAEC,SAAS;EAAE,GAAGC;AAAS,CAAoB,EAC3FC,GAAgD,EAAA;EAEhD,oBACEC,cAAA,CAACC,qBAAU,EAAA;AACTC,IAAAA,UAAU,EAAE;MACVC,OAAO,eAAEH,cAAA,CAACI,YAAM,EAAA;QAACX,IAAI,EAAEA,MAAI,KAAKC,SAAI,CAACW,KAAK,GAAG,EAAE,GAAG;AAAG,OAAA,CAAG;MACxDC,mBAAmB,EAAEb,MAAI,KAAKC,SAAI,CAACW,KAAK,GAAG,EAAE,GAAG;KAChD;AACFT,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,SAAS,EAAEA,SAAU;IAAAU,QAAA,eAErBP,cAAA,CAACQ,WAAK,EAAA;AACJT,MAAAA,GAAG,EAAEA,GAAI;AACTU,MAAAA,IAAI,EAAC,WAAW;AAChBC,MAAAA,SAAS,EAAC,QAAQ;AAClBlB,MAAAA,KAAK,EAAEA,KAAM;AACbC,MAAAA,IAAI,EAAEA,MAAK;MAAA,GACPK;KAAU;AAElB,GAAY,CAAC;AAEjB,CAAC;;;;"}
1
+ {"version":3,"file":"SearchInput.js","sources":["../../src/inputs/SearchInput.tsx"],"sourcesContent":["import { Search } from '@transferwise/icons';\nimport { forwardRef } from 'react';\n\nimport { Size } from '../common';\nimport { Merge } from '../utils';\n\nimport { Input } from './Input';\nimport { InputGroup } from './InputGroup';\n\nexport interface SearchInputProps extends Merge<\n React.ComponentPropsWithRef<'input'>,\n {\n size?: Size.SMALL | Size.MEDIUM;\n shape?: 'rectangle' | 'pill';\n 'aria-invalid'?: boolean;\n }\n> {}\n\nexport const SearchInput = forwardRef(function SearchInput(\n { shape = 'pill', size = Size.MEDIUM, disabled, className, ...restProps }: SearchInputProps,\n ref: React.ForwardedRef<HTMLInputElement | null>,\n) {\n return (\n <InputGroup\n addonStart={{\n content: <Search size={size === Size.SMALL ? 16 : 24} />,\n initialContentWidth: size === Size.SMALL ? 16 : 24,\n }}\n disabled={disabled}\n className={className}\n >\n <Input\n ref={ref}\n role=\"searchbox\"\n inputMode=\"search\"\n shape={shape}\n size={size}\n {...restProps}\n />\n </InputGroup>\n );\n});\n"],"names":["SearchInput","forwardRef","shape","size","Size","MEDIUM","disabled","className","restProps","ref","_jsx","InputGroup","addonStart","content","Search","SMALL","initialContentWidth","children","Input","role","inputMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAkBaA,WAAW,gBAAGC,gBAAU,CAAC,SAASD,WAAWA,CACxD;AAAEE,EAAAA,KAAK,GAAG,MAAM;QAAEC,MAAI,GAAGC,SAAI,CAACC,MAAM;EAAEC,QAAQ;EAAEC,SAAS;EAAE,GAAGC;AAAS,CAAoB,EAC3FC,GAAgD,EAAA;EAEhD,oBACEC,cAAA,CAACC,qBAAU,EAAA;AACTC,IAAAA,UAAU,EAAE;MACVC,OAAO,eAAEH,cAAA,CAACI,YAAM,EAAA;QAACX,IAAI,EAAEA,MAAI,KAAKC,SAAI,CAACW,KAAK,GAAG,EAAE,GAAG;AAAG,OAAA,CAAG;MACxDC,mBAAmB,EAAEb,MAAI,KAAKC,SAAI,CAACW,KAAK,GAAG,EAAE,GAAG;KAChD;AACFT,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,SAAS,EAAEA,SAAU;IAAAU,QAAA,eAErBP,cAAA,CAACQ,WAAK,EAAA;AACJT,MAAAA,GAAG,EAAEA,GAAI;AACTU,MAAAA,IAAI,EAAC,WAAW;AAChBC,MAAAA,SAAS,EAAC,QAAQ;AAClBlB,MAAAA,KAAK,EAAEA,KAAM;AACbC,MAAAA,IAAI,EAAEA,MAAK;MAAA,GACPK;KAAU;AAElB,GAAY,CAAC;AAEjB,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.mjs","sources":["../../src/inputs/SearchInput.tsx"],"sourcesContent":["import { Search } from '@transferwise/icons';\nimport { forwardRef } from 'react';\n\nimport { Size } from '../common';\nimport { Merge } from '../utils';\n\nimport { Input } from './Input';\nimport { InputGroup } from './InputGroup';\n\nexport interface SearchInputProps\n extends Merge<\n React.ComponentPropsWithRef<'input'>,\n {\n size?: Size.SMALL | Size.MEDIUM;\n shape?: 'rectangle' | 'pill';\n 'aria-invalid'?: boolean;\n }\n > {}\n\nexport const SearchInput = forwardRef(function SearchInput(\n { shape = 'pill', size = Size.MEDIUM, disabled, className, ...restProps }: SearchInputProps,\n ref: React.ForwardedRef<HTMLInputElement | null>,\n) {\n return (\n <InputGroup\n addonStart={{\n content: <Search size={size === Size.SMALL ? 16 : 24} />,\n initialContentWidth: size === Size.SMALL ? 16 : 24,\n }}\n disabled={disabled}\n className={className}\n >\n <Input\n ref={ref}\n role=\"searchbox\"\n inputMode=\"search\"\n shape={shape}\n size={size}\n {...restProps}\n />\n </InputGroup>\n );\n});\n"],"names":["SearchInput","forwardRef","shape","size","Size","MEDIUM","disabled","className","restProps","ref","_jsx","InputGroup","addonStart","content","Search","SMALL","initialContentWidth","children","Input","role","inputMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;MAmBaA,WAAW,gBAAGC,UAAU,CAAC,SAASD,WAAWA,CACxD;AAAEE,EAAAA,KAAK,GAAG,MAAM;EAAEC,IAAI,GAAGC,IAAI,CAACC,MAAM;EAAEC,QAAQ;EAAEC,SAAS;EAAE,GAAGC;AAAS,CAAoB,EAC3FC,GAAgD,EAAA;EAEhD,oBACEC,GAAA,CAACC,UAAU,EAAA;AACTC,IAAAA,UAAU,EAAE;MACVC,OAAO,eAAEH,GAAA,CAACI,MAAM,EAAA;QAACX,IAAI,EAAEA,IAAI,KAAKC,IAAI,CAACW,KAAK,GAAG,EAAE,GAAG;AAAG,OAAA,CAAG;MACxDC,mBAAmB,EAAEb,IAAI,KAAKC,IAAI,CAACW,KAAK,GAAG,EAAE,GAAG;KAChD;AACFT,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,SAAS,EAAEA,SAAU;IAAAU,QAAA,eAErBP,GAAA,CAACQ,KAAK,EAAA;AACJT,MAAAA,GAAG,EAAEA,GAAI;AACTU,MAAAA,IAAI,EAAC,WAAW;AAChBC,MAAAA,SAAS,EAAC,QAAQ;AAClBlB,MAAAA,KAAK,EAAEA,KAAM;AACbC,MAAAA,IAAI,EAAEA,IAAK;MAAA,GACPK;KAAU;AAElB,GAAY,CAAC;AAEjB,CAAC;;;;"}
1
+ {"version":3,"file":"SearchInput.mjs","sources":["../../src/inputs/SearchInput.tsx"],"sourcesContent":["import { Search } from '@transferwise/icons';\nimport { forwardRef } from 'react';\n\nimport { Size } from '../common';\nimport { Merge } from '../utils';\n\nimport { Input } from './Input';\nimport { InputGroup } from './InputGroup';\n\nexport interface SearchInputProps extends Merge<\n React.ComponentPropsWithRef<'input'>,\n {\n size?: Size.SMALL | Size.MEDIUM;\n shape?: 'rectangle' | 'pill';\n 'aria-invalid'?: boolean;\n }\n> {}\n\nexport const SearchInput = forwardRef(function SearchInput(\n { shape = 'pill', size = Size.MEDIUM, disabled, className, ...restProps }: SearchInputProps,\n ref: React.ForwardedRef<HTMLInputElement | null>,\n) {\n return (\n <InputGroup\n addonStart={{\n content: <Search size={size === Size.SMALL ? 16 : 24} />,\n initialContentWidth: size === Size.SMALL ? 16 : 24,\n }}\n disabled={disabled}\n className={className}\n >\n <Input\n ref={ref}\n role=\"searchbox\"\n inputMode=\"search\"\n shape={shape}\n size={size}\n {...restProps}\n />\n </InputGroup>\n );\n});\n"],"names":["SearchInput","forwardRef","shape","size","Size","MEDIUM","disabled","className","restProps","ref","_jsx","InputGroup","addonStart","content","Search","SMALL","initialContentWidth","children","Input","role","inputMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;MAkBaA,WAAW,gBAAGC,UAAU,CAAC,SAASD,WAAWA,CACxD;AAAEE,EAAAA,KAAK,GAAG,MAAM;EAAEC,IAAI,GAAGC,IAAI,CAACC,MAAM;EAAEC,QAAQ;EAAEC,SAAS;EAAE,GAAGC;AAAS,CAAoB,EAC3FC,GAAgD,EAAA;EAEhD,oBACEC,GAAA,CAACC,UAAU,EAAA;AACTC,IAAAA,UAAU,EAAE;MACVC,OAAO,eAAEH,GAAA,CAACI,MAAM,EAAA;QAACX,IAAI,EAAEA,IAAI,KAAKC,IAAI,CAACW,KAAK,GAAG,EAAE,GAAG;AAAG,OAAA,CAAG;MACxDC,mBAAmB,EAAEb,IAAI,KAAKC,IAAI,CAACW,KAAK,GAAG,EAAE,GAAG;KAChD;AACFT,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,SAAS,EAAEA,SAAU;IAAAU,QAAA,eAErBP,GAAA,CAACQ,KAAK,EAAA;AACJT,MAAAA,GAAG,EAAEA,GAAI;AACTU,MAAAA,IAAI,EAAC,WAAW;AAChBC,MAAAA,SAAS,EAAC,QAAQ;AAClBlB,MAAAA,KAAK,EAAEA,KAAM;AACbC,MAAAA,IAAI,EAAEA,IAAK;MAAA,GACPK;KAAU;AAElB,GAAY,CAAC;AAEjB,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sources":["../../src/inputs/TextArea.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { forwardRef } from 'react';\n\nimport { Merge } from '../utils';\nimport { inputClassNameBase } from './_common';\nimport { useInputAttributes } from './contexts';\n\nexport interface TextAreaProps\n extends Merge<\n React.ComponentPropsWithRef<'textarea'>,\n {\n 'aria-invalid'?: boolean;\n }\n > {}\n\nexport const TextArea = forwardRef(function TextArea(\n { className, ...restProps }: TextAreaProps,\n reference: React.ForwardedRef<HTMLTextAreaElement | null>,\n) {\n const inputAttributes = useInputAttributes();\n\n return (\n <textarea\n ref={reference}\n className={clsx(className, inputClassNameBase(), 'np-text-area')}\n {...inputAttributes}\n {...restProps}\n />\n );\n});\n"],"names":["TextArea","forwardRef","className","restProps","reference","inputAttributes","useInputAttributes","_jsx","ref","clsx","inputClassNameBase"],"mappings":";;;;;;;;MAeaA,QAAQ,gBAAGC,gBAAU,CAAC,SAASD,QAAQA,CAClD;EAAEE,SAAS;EAAE,GAAGC;AAAS,CAAiB,EAC1CC,SAAyD,EAAA;AAEzD,EAAA,MAAMC,eAAe,GAAGC,2BAAkB,EAAE;AAE5C,EAAA,oBACEC,cAAA,CAAA,UAAA,EAAA;AACEC,IAAAA,GAAG,EAAEJ,SAAU;IACfF,SAAS,EAAEO,SAAI,CAACP,SAAS,EAAEQ,0BAAkB,EAAE,EAAE,cAAc,CAAE;AAAA,IAAA,GAC7DL,eAAe;IAAA,GACfF;AAAS,GAAC,CACd;AAEN,CAAC;;;;"}
1
+ {"version":3,"file":"TextArea.js","sources":["../../src/inputs/TextArea.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { forwardRef } from 'react';\n\nimport { Merge } from '../utils';\nimport { inputClassNameBase } from './_common';\nimport { useInputAttributes } from './contexts';\n\nexport interface TextAreaProps extends Merge<\n React.ComponentPropsWithRef<'textarea'>,\n {\n 'aria-invalid'?: boolean;\n }\n> {}\n\nexport const TextArea = forwardRef(function TextArea(\n { className, ...restProps }: TextAreaProps,\n reference: React.ForwardedRef<HTMLTextAreaElement | null>,\n) {\n const inputAttributes = useInputAttributes();\n\n return (\n <textarea\n ref={reference}\n className={clsx(className, inputClassNameBase(), 'np-text-area')}\n {...inputAttributes}\n {...restProps}\n />\n );\n});\n"],"names":["TextArea","forwardRef","className","restProps","reference","inputAttributes","useInputAttributes","_jsx","ref","clsx","inputClassNameBase"],"mappings":";;;;;;;;MAcaA,QAAQ,gBAAGC,gBAAU,CAAC,SAASD,QAAQA,CAClD;EAAEE,SAAS;EAAE,GAAGC;AAAS,CAAiB,EAC1CC,SAAyD,EAAA;AAEzD,EAAA,MAAMC,eAAe,GAAGC,2BAAkB,EAAE;AAE5C,EAAA,oBACEC,cAAA,CAAA,UAAA,EAAA;AACEC,IAAAA,GAAG,EAAEJ,SAAU;IACfF,SAAS,EAAEO,SAAI,CAACP,SAAS,EAAEQ,0BAAkB,EAAE,EAAE,cAAc,CAAE;AAAA,IAAA,GAC7DL,eAAe;IAAA,GACfF;AAAS,GAAC,CACd;AAEN,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.mjs","sources":["../../src/inputs/TextArea.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { forwardRef } from 'react';\n\nimport { Merge } from '../utils';\nimport { inputClassNameBase } from './_common';\nimport { useInputAttributes } from './contexts';\n\nexport interface TextAreaProps\n extends Merge<\n React.ComponentPropsWithRef<'textarea'>,\n {\n 'aria-invalid'?: boolean;\n }\n > {}\n\nexport const TextArea = forwardRef(function TextArea(\n { className, ...restProps }: TextAreaProps,\n reference: React.ForwardedRef<HTMLTextAreaElement | null>,\n) {\n const inputAttributes = useInputAttributes();\n\n return (\n <textarea\n ref={reference}\n className={clsx(className, inputClassNameBase(), 'np-text-area')}\n {...inputAttributes}\n {...restProps}\n />\n );\n});\n"],"names":["TextArea","forwardRef","className","restProps","reference","inputAttributes","useInputAttributes","_jsx","ref","clsx","inputClassNameBase"],"mappings":";;;;;;MAeaA,QAAQ,gBAAGC,UAAU,CAAC,SAASD,QAAQA,CAClD;EAAEE,SAAS;EAAE,GAAGC;AAAS,CAAiB,EAC1CC,SAAyD,EAAA;AAEzD,EAAA,MAAMC,eAAe,GAAGC,kBAAkB,EAAE;AAE5C,EAAA,oBACEC,GAAA,CAAA,UAAA,EAAA;AACEC,IAAAA,GAAG,EAAEJ,SAAU;IACfF,SAAS,EAAEO,IAAI,CAACP,SAAS,EAAEQ,kBAAkB,EAAE,EAAE,cAAc,CAAE;AAAA,IAAA,GAC7DL,eAAe;IAAA,GACfF;AAAS,GAAC,CACd;AAEN,CAAC;;;;"}
1
+ {"version":3,"file":"TextArea.mjs","sources":["../../src/inputs/TextArea.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { forwardRef } from 'react';\n\nimport { Merge } from '../utils';\nimport { inputClassNameBase } from './_common';\nimport { useInputAttributes } from './contexts';\n\nexport interface TextAreaProps extends Merge<\n React.ComponentPropsWithRef<'textarea'>,\n {\n 'aria-invalid'?: boolean;\n }\n> {}\n\nexport const TextArea = forwardRef(function TextArea(\n { className, ...restProps }: TextAreaProps,\n reference: React.ForwardedRef<HTMLTextAreaElement | null>,\n) {\n const inputAttributes = useInputAttributes();\n\n return (\n <textarea\n ref={reference}\n className={clsx(className, inputClassNameBase(), 'np-text-area')}\n {...inputAttributes}\n {...restProps}\n />\n );\n});\n"],"names":["TextArea","forwardRef","className","restProps","reference","inputAttributes","useInputAttributes","_jsx","ref","clsx","inputClassNameBase"],"mappings":";;;;;;MAcaA,QAAQ,gBAAGC,UAAU,CAAC,SAASD,QAAQA,CAClD;EAAEE,SAAS;EAAE,GAAGC;AAAS,CAAiB,EAC1CC,SAAyD,EAAA;AAEzD,EAAA,MAAMC,eAAe,GAAGC,kBAAkB,EAAE;AAE5C,EAAA,oBACEC,GAAA,CAAA,UAAA,EAAA;AACEC,IAAAA,GAAG,EAAEJ,SAAU;IACfF,SAAS,EAAEO,IAAI,CAACP,SAAS,EAAEQ,kBAAkB,EAAE,EAAE,cAAc,CAAE;AAAA,IAAA,GAC7DL,eAAe;IAAA,GACfF;AAAS,GAAC,CACd;AAEN,CAAC;;;;"}
@@ -39,6 +39,7 @@ require('../../provider/direction/DirectionProvider.js');
39
39
  require('../../sentimentSurface/SentimentSurface.js');
40
40
  require('../../primitives/PrimitiveButton/PrimitiveButton.js');
41
41
  require('../../primitives/PrimitiveAnchor/PrimitiveAnchor.js');
42
+ require('../../link/Link.messages.js');
42
43
 
43
44
  const Prompt = ({
44
45
  sentiment: sentiment$1 = sentiment.Sentiment.NEUTRAL,
@@ -1 +1 @@
1
- {"version":3,"file":"ListItemPrompt.js","sources":["../../../src/listItem/Prompt/ListItemPrompt.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport { Sentiment } from '../../common';\nimport { ListItemContext, type ListItemContextData } from '../ListItemContext';\nimport { InlinePrompt, type InlinePromptProps } from '../../prompt';\n\nexport type ListItemPromptProps = Pick<InlinePromptProps, 'children' | 'sentiment' | 'mediaLabel'>;\n\n/**\n * This component allows for rendering an Inline Prompt. <br />\n * In the future it will be a thin wrapper around a standalone component.<br />\n *\n * Please refer to the [Design documentation](https://wise.design/components/list-item#prompt) for details.\n */\nexport const Prompt = ({\n sentiment = Sentiment.NEUTRAL,\n mediaLabel,\n children,\n}: ListItemPromptProps) => {\n const { ids, props } = useContext<ListItemContextData>(ListItemContext);\n const isLongLivedMuted = props.disabled && Boolean(props.disabledPromptMessage);\n\n return (\n <InlinePrompt\n id={ids.prompt}\n sentiment={sentiment}\n mediaLabel={mediaLabel}\n muted={isLongLivedMuted}\n className=\"wds-list-item-prompt\"\n >\n {isLongLivedMuted ? props.disabledPromptMessage : children}\n </InlinePrompt>\n );\n};\n\nPrompt.displayName = 'ListItem.Prompt';\nexport default Prompt;\n"],"names":["Prompt","sentiment","Sentiment","NEUTRAL","mediaLabel","children","ids","props","useContext","ListItemContext","isLongLivedMuted","disabled","Boolean","disabledPromptMessage","_jsx","InlinePrompt","id","prompt","muted","className","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAMA,MAAM,GAAGA,CAAC;aACrBC,WAAS,GAAGC,mBAAS,CAACC,OAAO;EAC7BC,UAAU;AACVC,EAAAA;AAAQ,CACY,KAAI;EACxB,MAAM;IAAEC,GAAG;AAAEC,IAAAA;AAAK,GAAE,GAAGC,gBAAU,CAAsBC,+BAAe,CAAC;EACvE,MAAMC,gBAAgB,GAAGH,KAAK,CAACI,QAAQ,IAAIC,OAAO,CAACL,KAAK,CAACM,qBAAqB,CAAC;EAE/E,oBACEC,cAAA,CAACC,yBAAY,EAAA;IACXC,EAAE,EAAEV,GAAG,CAACW,MAAO;AACfhB,IAAAA,SAAS,EAAEA,WAAU;AACrBG,IAAAA,UAAU,EAAEA,UAAW;AACvBc,IAAAA,KAAK,EAAER,gBAAiB;AACxBS,IAAAA,SAAS,EAAC,sBAAsB;AAAAd,IAAAA,QAAA,EAE/BK,gBAAgB,GAAGH,KAAK,CAACM,qBAAqB,GAAGR;AAAQ,GAC9C,CAAC;AAEnB;AAEAL,MAAM,CAACoB,WAAW,GAAG,iBAAiB;;;;;"}
1
+ {"version":3,"file":"ListItemPrompt.js","sources":["../../../src/listItem/Prompt/ListItemPrompt.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport { Sentiment } from '../../common';\nimport { ListItemContext, type ListItemContextData } from '../ListItemContext';\nimport { InlinePrompt, type InlinePromptProps } from '../../prompt';\n\nexport type ListItemPromptProps = Pick<InlinePromptProps, 'children' | 'sentiment' | 'mediaLabel'>;\n\n/**\n * This component allows for rendering an Inline Prompt. <br />\n * In the future it will be a thin wrapper around a standalone component.<br />\n *\n * Please refer to the [Design documentation](https://wise.design/components/list-item#prompt) for details.\n */\nexport const Prompt = ({\n sentiment = Sentiment.NEUTRAL,\n mediaLabel,\n children,\n}: ListItemPromptProps) => {\n const { ids, props } = useContext<ListItemContextData>(ListItemContext);\n const isLongLivedMuted = props.disabled && Boolean(props.disabledPromptMessage);\n\n return (\n <InlinePrompt\n id={ids.prompt}\n sentiment={sentiment}\n mediaLabel={mediaLabel}\n muted={isLongLivedMuted}\n className=\"wds-list-item-prompt\"\n >\n {isLongLivedMuted ? props.disabledPromptMessage : children}\n </InlinePrompt>\n );\n};\n\nPrompt.displayName = 'ListItem.Prompt';\nexport default Prompt;\n"],"names":["Prompt","sentiment","Sentiment","NEUTRAL","mediaLabel","children","ids","props","useContext","ListItemContext","isLongLivedMuted","disabled","Boolean","disabledPromptMessage","_jsx","InlinePrompt","id","prompt","muted","className","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAMA,MAAM,GAAGA,CAAC;aACrBC,WAAS,GAAGC,mBAAS,CAACC,OAAO;EAC7BC,UAAU;AACVC,EAAAA;AAAQ,CACY,KAAI;EACxB,MAAM;IAAEC,GAAG;AAAEC,IAAAA;AAAK,GAAE,GAAGC,gBAAU,CAAsBC,+BAAe,CAAC;EACvE,MAAMC,gBAAgB,GAAGH,KAAK,CAACI,QAAQ,IAAIC,OAAO,CAACL,KAAK,CAACM,qBAAqB,CAAC;EAE/E,oBACEC,cAAA,CAACC,yBAAY,EAAA;IACXC,EAAE,EAAEV,GAAG,CAACW,MAAO;AACfhB,IAAAA,SAAS,EAAEA,WAAU;AACrBG,IAAAA,UAAU,EAAEA,UAAW;AACvBc,IAAAA,KAAK,EAAER,gBAAiB;AACxBS,IAAAA,SAAS,EAAC,sBAAsB;AAAAd,IAAAA,QAAA,EAE/BK,gBAAgB,GAAGH,KAAK,CAACM,qBAAqB,GAAGR;AAAQ,GAC9C,CAAC;AAEnB;AAEAL,MAAM,CAACoB,WAAW,GAAG,iBAAiB;;;;;"}
@@ -35,6 +35,7 @@ import '../../provider/direction/DirectionProvider.mjs';
35
35
  import '../../sentimentSurface/SentimentSurface.mjs';
36
36
  import '../../primitives/PrimitiveButton/PrimitiveButton.mjs';
37
37
  import '../../primitives/PrimitiveAnchor/PrimitiveAnchor.mjs';
38
+ import '../../link/Link.messages.mjs';
38
39
 
39
40
  const Prompt = ({
40
41
  sentiment = Sentiment.NEUTRAL,
@@ -1 +1 @@
1
- {"version":3,"file":"ListItemPrompt.mjs","sources":["../../../src/listItem/Prompt/ListItemPrompt.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport { Sentiment } from '../../common';\nimport { ListItemContext, type ListItemContextData } from '../ListItemContext';\nimport { InlinePrompt, type InlinePromptProps } from '../../prompt';\n\nexport type ListItemPromptProps = Pick<InlinePromptProps, 'children' | 'sentiment' | 'mediaLabel'>;\n\n/**\n * This component allows for rendering an Inline Prompt. <br />\n * In the future it will be a thin wrapper around a standalone component.<br />\n *\n * Please refer to the [Design documentation](https://wise.design/components/list-item#prompt) for details.\n */\nexport const Prompt = ({\n sentiment = Sentiment.NEUTRAL,\n mediaLabel,\n children,\n}: ListItemPromptProps) => {\n const { ids, props } = useContext<ListItemContextData>(ListItemContext);\n const isLongLivedMuted = props.disabled && Boolean(props.disabledPromptMessage);\n\n return (\n <InlinePrompt\n id={ids.prompt}\n sentiment={sentiment}\n mediaLabel={mediaLabel}\n muted={isLongLivedMuted}\n className=\"wds-list-item-prompt\"\n >\n {isLongLivedMuted ? props.disabledPromptMessage : children}\n </InlinePrompt>\n );\n};\n\nPrompt.displayName = 'ListItem.Prompt';\nexport default Prompt;\n"],"names":["Prompt","sentiment","Sentiment","NEUTRAL","mediaLabel","children","ids","props","useContext","ListItemContext","isLongLivedMuted","disabled","Boolean","disabledPromptMessage","_jsx","InlinePrompt","id","prompt","muted","className","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAMA,MAAM,GAAGA,CAAC;EACrBC,SAAS,GAAGC,SAAS,CAACC,OAAO;EAC7BC,UAAU;AACVC,EAAAA;AAAQ,CACY,KAAI;EACxB,MAAM;IAAEC,GAAG;AAAEC,IAAAA;AAAK,GAAE,GAAGC,UAAU,CAAsBC,eAAe,CAAC;EACvE,MAAMC,gBAAgB,GAAGH,KAAK,CAACI,QAAQ,IAAIC,OAAO,CAACL,KAAK,CAACM,qBAAqB,CAAC;EAE/E,oBACEC,GAAA,CAACC,YAAY,EAAA;IACXC,EAAE,EAAEV,GAAG,CAACW,MAAO;AACfhB,IAAAA,SAAS,EAAEA,SAAU;AACrBG,IAAAA,UAAU,EAAEA,UAAW;AACvBc,IAAAA,KAAK,EAAER,gBAAiB;AACxBS,IAAAA,SAAS,EAAC,sBAAsB;AAAAd,IAAAA,QAAA,EAE/BK,gBAAgB,GAAGH,KAAK,CAACM,qBAAqB,GAAGR;AAAQ,GAC9C,CAAC;AAEnB;AAEAL,MAAM,CAACoB,WAAW,GAAG,iBAAiB;;;;"}
1
+ {"version":3,"file":"ListItemPrompt.mjs","sources":["../../../src/listItem/Prompt/ListItemPrompt.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport { Sentiment } from '../../common';\nimport { ListItemContext, type ListItemContextData } from '../ListItemContext';\nimport { InlinePrompt, type InlinePromptProps } from '../../prompt';\n\nexport type ListItemPromptProps = Pick<InlinePromptProps, 'children' | 'sentiment' | 'mediaLabel'>;\n\n/**\n * This component allows for rendering an Inline Prompt. <br />\n * In the future it will be a thin wrapper around a standalone component.<br />\n *\n * Please refer to the [Design documentation](https://wise.design/components/list-item#prompt) for details.\n */\nexport const Prompt = ({\n sentiment = Sentiment.NEUTRAL,\n mediaLabel,\n children,\n}: ListItemPromptProps) => {\n const { ids, props } = useContext<ListItemContextData>(ListItemContext);\n const isLongLivedMuted = props.disabled && Boolean(props.disabledPromptMessage);\n\n return (\n <InlinePrompt\n id={ids.prompt}\n sentiment={sentiment}\n mediaLabel={mediaLabel}\n muted={isLongLivedMuted}\n className=\"wds-list-item-prompt\"\n >\n {isLongLivedMuted ? props.disabledPromptMessage : children}\n </InlinePrompt>\n );\n};\n\nPrompt.displayName = 'ListItem.Prompt';\nexport default Prompt;\n"],"names":["Prompt","sentiment","Sentiment","NEUTRAL","mediaLabel","children","ids","props","useContext","ListItemContext","isLongLivedMuted","disabled","Boolean","disabledPromptMessage","_jsx","InlinePrompt","id","prompt","muted","className","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAMA,MAAM,GAAGA,CAAC;EACrBC,SAAS,GAAGC,SAAS,CAACC,OAAO;EAC7BC,UAAU;AACVC,EAAAA;AAAQ,CACY,KAAI;EACxB,MAAM;IAAEC,GAAG;AAAEC,IAAAA;AAAK,GAAE,GAAGC,UAAU,CAAsBC,eAAe,CAAC;EACvE,MAAMC,gBAAgB,GAAGH,KAAK,CAACI,QAAQ,IAAIC,OAAO,CAACL,KAAK,CAACM,qBAAqB,CAAC;EAE/E,oBACEC,GAAA,CAACC,YAAY,EAAA;IACXC,EAAE,EAAEV,GAAG,CAACW,MAAO;AACfhB,IAAAA,SAAS,EAAEA,SAAU;AACrBG,IAAAA,UAAU,EAAEA,UAAW;AACvBc,IAAAA,KAAK,EAAER,gBAAiB;AACxBS,IAAAA,SAAS,EAAC,sBAAsB;AAAAd,IAAAA,QAAA,EAE/BK,gBAAgB,GAAGH,KAAK,CAACM,qBAAqB,GAAGR;AAAQ,GAC9C,CAAC;AAEnB;AAEAL,MAAM,CAACoB,WAAW,GAAG,iBAAiB;;;;"}