@economic/taco 1.16.2 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/components/AlertDialog/Context.d.ts +1 -1
  2. package/dist/components/Banner/Banner.stories.d.ts +2 -20
  3. package/dist/components/Button/Button.d.ts +2 -2
  4. package/dist/components/Button/Button.stories.d.ts +1 -1
  5. package/dist/components/Combobox/useCombobox.d.ts +2 -1
  6. package/dist/components/Datepicker/Datepicker.d.ts +7 -3
  7. package/dist/components/Datepicker/Datepicker.stories.d.ts +2 -2
  8. package/dist/components/Datepicker/useDatepicker.d.ts +2 -1
  9. package/dist/components/Dialog/Context.d.ts +1 -1
  10. package/dist/components/Dialog/Dialog.d.ts +1 -1
  11. package/dist/components/Icon/Icon.stories.d.ts +4 -20
  12. package/dist/components/IconButton/IconButton.stories.d.ts +11 -48
  13. package/dist/components/Input/Input.d.ts +15 -8
  14. package/dist/components/Input/Input.stories.d.ts +15 -41
  15. package/dist/components/Provider/Localization.d.ts +3 -2
  16. package/dist/components/SearchInput/SearchInput.d.ts +5 -10
  17. package/dist/components/SearchInput/SearchInput.stories.d.ts +3 -6
  18. package/dist/components/Select/Select.d.ts +1 -1
  19. package/dist/components/Select/Select.stories.d.ts +1 -1
  20. package/dist/components/Select2/Select2.d.ts +2 -0
  21. package/dist/components/Select2/Select2.stories.d.ts +0 -1
  22. package/dist/components/Select2/components/Search.d.ts +6 -3
  23. package/dist/components/Select2/hooks/useChildren.d.ts +2 -1
  24. package/dist/components/Tooltip/Tooltip.d.ts +4 -4
  25. package/dist/components/Tooltip/Tooltip.stories.d.ts +2 -2
  26. package/dist/esm/index.css +44 -40
  27. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +2 -2
  28. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/AlertDialog/Context.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js +1 -1
  31. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Button/Button.js +1 -2
  33. package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Button/util.js +7 -7
  35. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +1 -1
  37. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +6 -5
  39. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +2 -2
  41. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  43. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +37 -33
  44. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  45. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Dialog/Context.js.map +1 -1
  47. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +1 -1
  49. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js +1 -1
  51. package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Field/Field.js +3 -3
  53. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +3 -4
  55. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/HoverCard/Primitives.js +1 -1
  57. package/dist/esm/packages/taco/src/components/HoverCard/Primitives.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Input/Input.js +110 -58
  59. package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Input/util.js +14 -8
  61. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +2 -2
  63. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/Menu/components/Header.js +1 -1
  65. package/dist/esm/packages/taco/src/components/Menu/components/Header.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +3 -3
  67. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Menu/components/Separator.js +1 -1
  69. package/dist/esm/packages/taco/src/components/Menu/components/Separator.js.map +1 -1
  70. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +7 -7
  71. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/Popover/Popover.js +1 -2
  73. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/Popover/Primitives.js +1 -1
  75. package/dist/esm/packages/taco/src/components/Popover/Primitives.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Popover/util.js +1 -1
  77. package/dist/esm/packages/taco/src/components/Popover/util.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Progress/Progress.js +3 -3
  79. package/dist/esm/packages/taco/src/components/Progress/Progress.js.map +1 -1
  80. package/dist/esm/packages/taco/src/components/Provider/Localization.js +3 -2
  81. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  82. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js +4 -4
  83. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  84. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +1 -1
  85. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  86. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +31 -15
  87. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
  88. package/dist/esm/packages/taco/src/components/Select/Select.js +2 -2
  89. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  90. package/dist/esm/packages/taco/src/components/Select2/Select2.js +8 -9
  91. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  92. package/dist/esm/packages/taco/src/components/Select2/components/Collection.js +1 -1
  93. package/dist/esm/packages/taco/src/components/Select2/components/Collection.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
  95. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +14 -6
  97. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  98. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +3 -2
  99. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
  100. package/dist/esm/packages/taco/src/components/Select2/utilities.js +1 -1
  101. package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
  102. package/dist/esm/packages/taco/src/components/Switch/Switch.js +5 -4
  103. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  104. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +1 -1
  105. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
  106. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +2 -2
  107. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  108. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowDraggable.js +1 -1
  109. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowDraggable.js.map +1 -1
  110. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +1 -1
  111. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
  112. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js +2 -2
  113. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js.map +1 -1
  114. package/dist/esm/packages/taco/src/components/Table/util/sortTypes.js +1 -1
  115. package/dist/esm/packages/taco/src/components/Table/util/sortTypes.js.map +1 -1
  116. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +2 -2
  117. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
  118. package/dist/esm/packages/taco/src/components/Toast/Toast.js +5 -5
  119. package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
  120. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +3 -3
  121. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Tour/Tour.js +3 -3
  123. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  124. package/dist/esm/packages/taco/src/index.js +1 -1
  125. package/dist/esm/packages/taco/src/utils/colors.js +9 -9
  126. package/dist/esm/packages/taco/src/utils/colors.js.map +1 -1
  127. package/dist/index.css +44 -40
  128. package/dist/index.d.ts +0 -1
  129. package/dist/primitives/Sortable/components/Item.d.ts +1 -0
  130. package/dist/taco.cjs.development.js +362 -280
  131. package/dist/taco.cjs.development.js.map +1 -1
  132. package/dist/taco.cjs.production.min.js +1 -1
  133. package/dist/taco.cjs.production.min.js.map +1 -1
  134. package/package.json +3 -3
  135. package/plugins/tailwindcss-group-peer.js +12 -0
  136. package/tailwind.config.js +272 -22
  137. package/types.json +87 -43
@@ -1 +1 @@
1
- {"version":3,"file":"Datepicker.js","sources":["../../../../../../../src/components/Datepicker/Datepicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Calendar, CalendarProps } from '../Calendar/Calendar';\nimport { Input, InputProps } from '../Input/Input';\nimport { useLocalization } from '../Provider/Localization';\nimport { useDatepicker } from './useDatepicker';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Popover } from '../Popover/Popover';\n\nexport type DatepickerTexts = {\n /** Aria-label for calendar */\n calendar: string;\n /** Clear button text */\n clear: string;\n /**\n * Aria-label for calendar icon button in the input.\n * Calendar will open when user clicks this icon button.\n */\n expand: string;\n /** Shortcut heading text */\n shortcuts: string;\n};\n\nexport type DatepickerProps = Omit<InputProps, 'value'> & {\n /** [Calendar](component:calendar) component associated with the DatePicker */\n calendar?: CalendarProps;\n /** List of shortcuts */\n shortcuts?: any;\n /** Title for the shortcuts panel */\n shortcutsText?: string;\n /** Handler to be called when the clear button is clicked */\n onReset?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Date value of the calendar.\n * This will be displayed in DatePicker's input in the format given to the [Provider](component:provider) component\n */\n value?: Date;\n};\n\nexport const Datepicker = React.forwardRef(function Datepicker(props: DatepickerProps, ref: React.Ref<HTMLInputElement>) {\n const { className: externalClassName, onReset: handleReset, style, shortcuts, shortcutsText, ...otherProps } = props;\n const { calendar, input } = useDatepicker(otherProps, ref);\n const { texts } = useLocalization();\n const className = cn('inline-flex w-full text-black font-normal', externalClassName);\n\n return (\n <span className={className} data-taco=\"datepicker\" style={style}>\n <Input\n {...input}\n button={\n <Popover>\n <Popover.Trigger>\n <IconButton\n aria-label={texts.datepicker.expand}\n disabled={input.disabled || input.readOnly}\n icon=\"calendar\"\n />\n </Popover.Trigger>\n <Popover.Content>\n {({ close }) => (\n <div className=\"-m-3 flex\">\n <Calendar\n {...calendar}\n onChange={(date: Date, event?: React.MouseEvent<HTMLDivElement>) => {\n calendar.onChange(date, event);\n close();\n }}\n tabIndex={-1}\n />\n {shortcuts && (\n <div className=\"border-grey-dark flex flex-col border-l\">\n <span className=\"m-4 mb-3 flex h-8 w-32 items-center text-xs font-semibold\">\n {shortcutsText ?? texts.datepicker.shortcuts}\n </span>\n <ul>\n {shortcuts.map((shortcut, i) => (\n <li key={i}>\n <button\n className=\"hover:bg-grey-light flex w-full items-start px-4 py-1 text-xs\"\n onClick={event => {\n event.persist();\n shortcut.onClick(event);\n close();\n }}>\n {shortcut.text}\n </button>\n </li>\n ))}\n </ul>\n {handleReset && (\n <button\n className=\"text-blue hover:text-blue-light my-4 mx-auto mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs\"\n onClick={event => {\n event.persist();\n handleReset(event);\n close();\n }}>\n {texts.datepicker.clear}\n </button>\n )}\n </div>\n )}\n </div>\n )}\n </Popover.Content>\n </Popover>\n }\n />\n </span>\n );\n});\n"],"names":["Datepicker","React","props","ref","className","externalClassName","onReset","handleReset","style","shortcuts","shortcutsText","otherProps","calendar","input","useDatepicker","texts","useLocalization","cn","Input","button","Popover","Trigger","IconButton","datepicker","expand","disabled","readOnly","icon","Content","close","Calendar","onChange","date","event","tabIndex","map","shortcut","i","key","onClick","persist","text","clear"],"mappings":";;;;;;;;;MAuCaA,UAAU,gBAAGC,UAAgB,CAAC,SAASD,UAAU,CAACE,KAAsB,EAAEC,GAAgC;EACnH,MAAM;IAAEC,SAAS,EAAEC,iBAAiB;IAAEC,OAAO,EAAEC,WAAW;IAAEC,KAAK;IAAEC,SAAS;IAAEC,aAAa;IAAE,GAAGC;GAAY,GAAGT,KAAK;EACpH,MAAM;IAAEU,QAAQ;IAAEC;GAAO,GAAGC,aAAa,CAACH,UAAU,EAAER,GAAG,CAAC;EAC1D,MAAM;IAAEY;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMZ,SAAS,GAAGa,EAAE,CAAC,2CAA2C,EAAEZ,iBAAiB,CAAC;EAEpF,oBACIJ;IAAMG,SAAS,EAAEA,SAAS;iBAAY,YAAY;IAACI,KAAK,EAAEA;kBACtDP,cAACiB,KAAK,oBACEL,KAAK;IACTM,MAAM,eACFlB,cAACmB,OAAO,qBACJnB,cAACmB,OAAO,CAACC,OAAO,qBACZpB,cAACqB,UAAU;oBACKP,KAAK,CAACQ,UAAU,CAACC,MAAM;MACnCC,QAAQ,EAAEZ,KAAK,CAACY,QAAQ,IAAIZ,KAAK,CAACa,QAAQ;MAC1CC,IAAI,EAAC;MACP,CACY,eAClB1B,cAACmB,OAAO,CAACQ,OAAO,QACX,CAAC;MAAEC;KAAO,kBACP5B;MAAKG,SAAS,EAAC;oBACXH,cAAC6B,QAAQ,oBACDlB,QAAQ;MACZmB,QAAQ,EAAE,CAACC,IAAU,EAAEC,KAAwC;QAC3DrB,QAAQ,CAACmB,QAAQ,CAACC,IAAI,EAAEC,KAAK,CAAC;QAC9BJ,KAAK,EAAE;OACV;MACDK,QAAQ,EAAE,CAAC;OACb,EACDzB,SAAS,iBACNR;MAAKG,SAAS,EAAC;oBACXH;MAAMG,SAAS,EAAC;OACXM,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAIK,KAAK,CAACQ,UAAU,CAACd,SAAS,CACzC,eACPR,0BACKQ,SAAS,CAAC0B,GAAG,CAAC,CAACC,QAAQ,EAAEC,CAAC,kBACvBpC;MAAIqC,GAAG,EAAED;oBACLpC;MACIG,SAAS,EAAC,+DAA+D;MACzEmC,OAAO,EAAEN,KAAK;QACVA,KAAK,CAACO,OAAO,EAAE;QACfJ,QAAQ,CAACG,OAAO,CAACN,KAAK,CAAC;QACvBJ,KAAK,EAAE;;OAEVO,QAAQ,CAACK,IAAI,CACT,CAEhB,CAAC,CACD,EACJlC,WAAW,iBACRN;MACIG,SAAS,EAAC,oHAAoH;MAC9HmC,OAAO,EAAEN,KAAK;QACVA,KAAK,CAACO,OAAO,EAAE;QACfjC,WAAW,CAAC0B,KAAK,CAAC;QAClBJ,KAAK,EAAE;;OAEVd,KAAK,CAACQ,UAAU,CAACmB,KAAK,CAE9B,CAER,CAER,CACa;KAG5B,CACC;AAEf,CAAC;;;;"}
1
+ {"version":3,"file":"Datepicker.js","sources":["../../../../../../../src/components/Datepicker/Datepicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Calendar, CalendarProps } from '../Calendar/Calendar';\nimport { Input, InputProps } from '../Input/Input';\nimport { useLocalization } from '../Provider/Localization';\nimport { useDatepicker } from './useDatepicker';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Popover } from '../Popover/Popover';\n\nexport type DatepickerTexts = {\n /** Aria-label for calendar */\n calendar: string;\n /** Clear button text */\n clear: string;\n /**\n * Aria-label for calendar icon button in the input.\n * Calendar will open when user clicks this icon button.\n */\n expand: string;\n /** Shortcut heading text */\n shortcuts: string;\n};\n\nexport type DatePickerShortcut = {\n onClick: (event: React.MouseEvent) => void;\n text: string;\n};\n\nexport type DatepickerProps = Omit<InputProps, 'value'> & {\n /** [Calendar](component:calendar) component associated with the DatePicker */\n calendar?: CalendarProps;\n /** List of shortcuts */\n shortcuts?: DatePickerShortcut[];\n /** Title for the shortcuts panel */\n shortcutsText?: string;\n /** Handler to be called when the clear button is clicked */\n onReset?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Date value of the calendar.\n * This will be displayed in DatePicker's input in the format given to the [Provider](component:provider) component\n */\n value?: Date;\n};\n\nexport const Datepicker = React.forwardRef(function Datepicker(props: DatepickerProps, ref: React.Ref<HTMLInputElement>) {\n const { className: externalClassName, onReset: handleReset, style, shortcuts, shortcutsText, ...otherProps } = props;\n const { calendar, input } = useDatepicker(otherProps, ref);\n const { texts } = useLocalization();\n const className = cn('inline-flex w-full text-black font-normal', externalClassName);\n\n return (\n <span className={className} data-taco=\"datepicker\" style={style}>\n <Input\n {...input}\n button={\n <IconButton\n aria-label={texts.datepicker.expand}\n disabled={input.disabled || input.readOnly}\n icon=\"calendar\"\n popover={props => (\n <Popover {...props}>\n <Popover.Content>\n {({ close }) => (\n <div className=\"-m-3 flex\">\n <Calendar\n {...calendar}\n onChange={(date: Date, event?: React.MouseEvent<HTMLDivElement>) => {\n calendar.onChange(date, event);\n close();\n }}\n tabIndex={-1}\n />\n {shortcuts && (\n <div className=\"border-grey-300 flex flex-col border-l\">\n <span className=\"m-4 mb-3 flex h-8 w-32 items-center text-xs font-semibold\">\n {shortcutsText ?? texts.datepicker.shortcuts}\n </span>\n <ul>\n {shortcuts.map(shortcut => (\n <li key={shortcut.text}>\n <button\n type=\"button\"\n className=\"hover:bg-grey-100 flex w-full items-start px-4 py-1 text-xs\"\n onClick={event => {\n event.persist();\n shortcut.onClick(event);\n close();\n }}>\n {shortcut.text}\n </button>\n </li>\n ))}\n </ul>\n {handleReset && (\n <button\n type=\"button\"\n className=\"my-4 mx-auto mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300\"\n onClick={event => {\n event.persist();\n handleReset(event);\n close();\n }}>\n {texts.datepicker.clear}\n </button>\n )}\n </div>\n )}\n </div>\n )}\n </Popover.Content>\n </Popover>\n )}\n />\n }\n />\n </span>\n );\n});\nDatepicker.displayName = 'Datepicker';\n"],"names":["Datepicker","React","props","ref","className","externalClassName","onReset","handleReset","style","shortcuts","shortcutsText","otherProps","calendar","input","useDatepicker","texts","useLocalization","cn","Input","button","IconButton","datepicker","expand","disabled","readOnly","icon","popover","Popover","Content","close","Calendar","onChange","date","event","tabIndex","map","shortcut","key","text","type","onClick","persist","clear","displayName"],"mappings":";;;;;;;;;MA4CaA,UAAU,gBAAGC,UAAgB,CAAC,SAASD,UAAU,CAACE,KAAsB,EAAEC,GAAgC;EACnH,MAAM;IAAEC,SAAS,EAAEC,iBAAiB;IAAEC,OAAO,EAAEC,WAAW;IAAEC,KAAK;IAAEC,SAAS;IAAEC,aAAa;IAAE,GAAGC;GAAY,GAAGT,KAAK;EACpH,MAAM;IAAEU,QAAQ;IAAEC;GAAO,GAAGC,aAAa,CAACH,UAAU,EAAER,GAAG,CAAC;EAC1D,MAAM;IAAEY;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMZ,SAAS,GAAGa,EAAE,CAAC,2CAA2C,EAAEZ,iBAAiB,CAAC;EAEpF,oBACIJ;IAAMG,SAAS,EAAEA,SAA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ClBJ,KAAK,EAAE;;SAEVd,KAAK,CAACM,UAAU,CAACqB,KAAK,CAE9B,CAER,CAER,CACa;;KAKpC,CACC;AAEf,CAAC;AACD1C,UAAU,CAAC2C,WAAW,GAAG,YAAY;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDatepicker.js","sources":["../../../../../../../src/components/Datepicker/useDatepicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { parseFromCustomString, format } from '../../utils/date';\nimport { useLocalization } from '../Provider/Localization';\nimport { setInputValueByRef } from '../../utils/input';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { DatepickerProps } from './Datepicker';\nimport { CalendarProps } from '../Calendar/Calendar';\n\ntype InputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.RefObject<HTMLInputElement> };\n\ntype useDatepicker = React.HTMLAttributes<HTMLDivElement> & {\n calendar: CalendarProps;\n input: InputProps;\n};\n\nexport const useDatepicker = (\n { defaultValue: _, calendar, onBlur, onChange, value, ...props }: DatepickerProps,\n ref: React.Ref<HTMLInputElement>\n): useDatepicker => {\n const inputRef = useMergedRef<HTMLInputElement>(ref);\n const { formatting } = useLocalization();\n const [internalValue, setInternalValue] = React.useState(value ? format(value, formatting.date) : '');\n\n // update internal value if it changed 'externally'\n React.useEffect(() => {\n if (value) {\n const formattedValue = format(value, formatting.date);\n\n if (formattedValue !== internalValue) {\n setInternalValue(formattedValue);\n }\n } else {\n setInternalValue('');\n }\n }, [value]);\n\n // event handlers\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\n event.persist();\n\n const valueAsDate = parseFromCustomString(event.target.value);\n const formattedValue = valueAsDate ? format(valueAsDate) || '' : '';\n\n event.target.value = formattedValue;\n\n if (onChange) {\n (event as any).detail = valueAsDate;\n onChange(event);\n } else {\n // update the internal value to use the formatted date\n setInternalValue(formattedValue);\n }\n\n if (onBlur) {\n onBlur(event);\n }\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n setInternalValue(event.target.value);\n };\n\n const handleChange = date => {\n setInputValueByRef(inputRef.current, format(date, formatting.date), 'focusout');\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.target.dispatchEvent(new Event('focusout', { bubbles: true }));\n }\n };\n\n const inputProps: InputProps = {\n ...props,\n autoComplete: 'off',\n onBlur: handleInputBlur,\n onChange: handleInputChange,\n onKeyDown: handleKeyDown,\n ref: inputRef,\n type: 'text',\n value: internalValue,\n };\n\n const calendarProps: CalendarProps = {\n ...calendar,\n onChange: handleChange,\n value,\n };\n\n return {\n input: inputProps,\n calendar: calendarProps,\n };\n};\n"],"names":["useDatepicker","defaultValue","_","calendar","onBlur","onChange","value","props","ref","inputRef","useMergedRef","formatting","useLocalization","internalValue","setInternalValue","React","format","date","formattedValue","handleInputBlur","event","persist","valueAsDate","parseFromCustomString","target","detail","handleInputChange","handleChange","setInputValueByRef","current","handleKeyDown","key","dispatchEvent","Event","bubbles","inputProps","autoComplete","onKeyDown","type","calendarProps","input"],"mappings":";;;;;;MAeaA,aAAa,GAAG,CACzB;EAAEC,YAAY,EAAEC,CAAC;EAAEC,QAAQ;EAAEC,MAAM;EAAEC,QAAQ;EAAEC,KAAK;EAAE,GAAGC;CAAwB,EACjFC,GAAgC;EAEhC,MAAMC,QAAQ,GAAGC,YAAY,CAAmBF,GAAG,CAAC;EACpD,MAAM;IAAEG;GAAY,GAAGC,eAAe,EAAE;EACxC,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGC,QAAc,CAACT,KAAK,GAAGU,MAAM,CAACV,KAAK,EAAEK,UAAU,CAACM,IAAI,CAAC,GAAG,EAAE,CAAC;;EAGrGF,SAAe,CAAC;IACZ,IAAIT,KAAK,EAAE;MACP,MAAMY,cAAc,GAAGF,MAAM,CAACV,KAAK,EAAEK,UAAU,CAACM,IAAI,CAAC;MAErD,IAAIC,cAAc,KAAKL,aAAa,EAAE;QAClCC,gBAAgB,CA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G,EAAEC,QAAQ;IACb6B,IAAI,EAAE,MAAM;IACZhC,KAAK,EAAEO;GACV;EAED,MAAM0B,aAAa,GAAkB;IACjC,GAAGpC,QAAQ;IACXE,QAAQ,EAAEsB,YAAY;IACtBrB;GACH;EAED,OAAO;IACHkC,KAAK,EAAEL,UAAU;IACjBhC,QAAQ,EAAEoC;GACb;AACL;;;;"}
1
+ {"version":3,"file":"useDatepicker.js","sources":["../../../../../../../src/components/Datepicker/useDatepicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { parseFromCustomString, format } from '../../utils/date';\nimport { useLocalization } from '../Provider/Localization';\nimport { setInputValueByRef } from '../../utils/input';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { DatepickerProps } from './Datepicker';\nimport { CalendarProps } from '../Calendar/Calendar';\nimport { InputProps as BaseInputProps } from '../Input/Input';\n\ntype InputProps = BaseInputProps & { ref: React.RefObject<HTMLInputElement> };\ntype useDatepicker = React.HTMLAttributes<HTMLDivElement> & {\n calendar: CalendarProps;\n input: InputProps;\n};\n\nexport const useDatepicker = (\n { defaultValue: _, calendar, onBlur, onChange, value, ...props }: DatepickerProps,\n ref: React.Ref<HTMLInputElement>\n): useDatepicker => {\n const inputRef = useMergedRef<HTMLInputElement>(ref);\n const { formatting } = useLocalization();\n const [internalValue, setInternalValue] = React.useState(value ? format(value, formatting.date) : '');\n\n // update internal value if it changed 'externally'\n React.useEffect(() => {\n if (value) {\n const formattedValue = format(value, formatting.date);\n\n if (formattedValue !== internalValue) {\n setInternalValue(formattedValue);\n }\n } else {\n setInternalValue('');\n }\n }, [value]);\n\n // event handlers\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\n event.persist();\n\n const valueAsDate = parseFromCustomString(event.target.value);\n const formattedValue = valueAsDate ? format(valueAsDate) || '' : '';\n\n event.target.value = formattedValue;\n\n if (onChange) {\n (event as any).detail = valueAsDate;\n onChange(event);\n } else {\n // update the internal value to use the formatted date\n setInternalValue(formattedValue);\n }\n\n if (onBlur) {\n onBlur(event);\n }\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n setInternalValue(event.target.value);\n };\n\n const handleChange = date => {\n setInputValueByRef(inputRef.current, format(date, formatting.date), 'focusout');\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.target.dispatchEvent(new Event('focusout', { bubbles: true }));\n }\n };\n\n const inputProps: InputProps = {\n ...props,\n autoComplete: 'off',\n onBlur: handleInputBlur,\n onChange: handleInputChange,\n onKeyDown: handleKeyDown,\n ref: inputRef,\n type: 'text',\n value: internalValue,\n };\n\n const calendarProps: CalendarProps = {\n ...calendar,\n onChange: handleChange,\n value,\n };\n\n return {\n input: inputProps,\n calendar: calendarProps,\n };\n};\n"],"names":["useDatepicker","defaultValue","_","calendar","onBlur","onChange","value","props","ref","inputRef","useMergedRef","formatting","useLocalization","internalValue","setInternalValue","React","format","date","formattedValue","handleInputBlur","event","persist","valueAsDate","parseFromCustomString","target","detail","handleInputChange","handleChange","setInputValueByRef","current","handleKeyDown","key","dispatchEvent","Event","bubbles","inputProps","autoComplete","onKeyDown","type","calendarProps","input"],"mappings":";;;;;;MAeaA,aAAa,GAAG,CACzB;EAAEC,YAAY,EAAEC,CAAC;EAAEC,QAAQ;EAAEC,MAAM;EAAEC,QAAQ;EAAEC,KAAK;EAAE,GAAGC;CAAwB,EACjFC,GAAgC;EAEhC,MAAMC,QAAQ,GAAGC,YAAY,CAAmBF,GAAG,CAAC;EACpD,MAAM;IAAEG;GAAY,GAAGC,eAAe,EAAE;EACxC,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGC,QAAc,CAACT,KAAK,GAAGU,MAAM,CAACV,KAAK,EAAEK,UAAU,CAACM,IAAI,CAAC,GAAG,EAAE,CAAC;;EAGrGF,SAAe,CAAC;IACZ,IAAIT,KAAK,EAAE;MACP,MAAMY,cAAc,GAAGF,MAAM,CAACV,KAAK,EAAEK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AEe,eAAe;IACvBd,QAAQ,EAAEqB,iBAAiB;IAC3BW,SAAS,EAAEP,aAAa;IACxBtB,GAAG,EAAEC,QAAQ;IACb6B,IAAI,EAAE,MAAM;IACZhC,KAAK,EAAEO;GACV;EAED,MAAM0B,aAAa,GAAkB;IACjC,GAAGpC,QAAQ;IACXE,QAAQ,EAAEsB,YAAY;IACtBrB;GACH;EAED,OAAO;IACHkC,KAAK,EAAEL,UAAU;IACjBhC,QAAQ,EAAEoC;GACb;AACL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Context.js","sources":["../../../../../../../src/components/Dialog/Context.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport * as React from 'react';\nimport { DialogSize } from './types';\n\nexport type DialogContext = {\n closeOnEscape: boolean;\n draggable: boolean;\n drawer: {\n open: boolean;\n toggle: () => void;\n };\n elements: {\n drawer?: React.ReactNode;\n extra?: React.ReactNode;\n };\n onClose?: () => void;\n props: {};\n ref: React.Ref<HTMLElement>;\n showCloseButton: boolean;\n size: DialogSize;\n};\n\nexport const DialogContext = React.createContext<DialogContext>({\n closeOnEscape: true,\n draggable: false,\n drawer: {\n open: false,\n toggle: () => {},\n },\n elements: {\n drawer: undefined,\n extra: undefined,\n },\n onClose: () => {},\n props: {},\n ref: null,\n showCloseButton: true,\n size: 'sm',\n});\n\nexport const useCurrentDialog = () => {\n return React.useContext(DialogContext);\n};\n"],"names":["DialogContext","React","closeOnEscape","draggable","drawer","open","toggle","elements","undefined","extra","onClose","props","ref","showCloseButton","size","useCurrentDialog"],"mappings":";;AAAA;MAsBaA,aAAa,gBAAGC,aAAmB,CAAgB;EAC5DC,aAAa,EAAE,IAAI;EACnBC,SAAS,EAAE,KAAK;EAChBC,MAAM,EAAE;IACJC,IAAI,EAAE,KAAK;IACXC,MAAM,EAAE;GACX;EACDC,QAAQ,EAAE;IACNH,MAAM,EAAEI,SAAS;IACjBC,KAAK,EAAED;GACV;EACDE,OAAO,EAAE,QAAQ;EACjBC,KAAK,EAAE,EAAE;EACTC,GAAG,EAAE,IAAI;EACTC,eAAe,EAAE,IAAI;EACrBC,IAAI,EAAE;CACT;MAEYC,gBAAgB,GAAG;EAC5B,OAAOd,UAAgB,CAACD,aAAa,CAAC;AAC1C;;;;"}
1
+ {"version":3,"file":"Context.js","sources":["../../../../../../../src/components/Dialog/Context.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport * as React from 'react';\nimport { DialogSize } from './types';\n\nexport type DialogContext = {\n closeOnEscape: boolean;\n draggable: boolean;\n drawer: {\n open: boolean;\n toggle: () => void;\n };\n elements: {\n drawer?: React.ReactNode;\n extra?: React.ReactNode;\n };\n onClose?: () => void;\n props: Record<string, any>;\n ref: React.Ref<HTMLElement>;\n showCloseButton: boolean;\n size: DialogSize;\n};\n\nexport const DialogContext = React.createContext<DialogContext>({\n closeOnEscape: true,\n draggable: false,\n drawer: {\n open: false,\n toggle: () => {},\n },\n elements: {\n drawer: undefined,\n extra: undefined,\n },\n onClose: () => {},\n props: {},\n ref: null,\n showCloseButton: true,\n size: 'sm',\n});\n\nexport const useCurrentDialog = () => {\n return React.useContext(DialogContext);\n};\n"],"names":["DialogContext","React","closeOnEscape","draggable","drawer","open","toggle","elements","undefined","extra","onClose","props","ref","showCloseButton","size","useCurrentDialog"],"mappings":";;AAAA;MAsBaA,aAAa,gBAAGC,aAAmB,CAAgB;EAC5DC,aAAa,EAAE,IAAI;EACnBC,SAAS,EAAE,KAAK;EAChBC,MAAM,EAAE;IACJC,IAAI,EAAE,KAAK;IACXC,MAAM,EAAE;GACX;EACDC,QAAQ,EAAE;IACNH,MAAM,EAAEI,SAAS;IACjBC,KAAK,EAAED;GACV;EACDE,OAAO,EAAE,QAAQ;EACjBC,KAAK,EAAE,EAAE;EACTC,GAAG,EAAE,IAAI;EACTC,eAAe,EAAE,IAAI;EACrBC,IAAI,EAAE;CACT;MAEYC,gBAAgB,GAAG;EAC5B,OAAOd,UAAgB,CAACD,aAAa,CAAC;AAC1C;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sources":["../../../../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport './Dialog.css';\nimport { DialogTriggerProps, Trigger } from './components/Trigger';\nimport {\n Content,\n Title,\n Footer,\n Close,\n DialogContentProps,\n DialogContentRenderProps,\n DialogContentDrawerRenderProps,\n DialogTitleProps,\n DialogFooterProps,\n DialogCloseProps,\n} from './components/Content';\nimport { DialogDrawerProps, DialogDrawerRenderProps, Drawer } from './components/Drawer';\nimport { DialogExtraProps, Extra } from './components/Extra';\nimport { DialogContext } from './Context';\nimport { DialogSize } from './types';\n\nexport type {\n DialogCloseProps,\n DialogContentDrawerRenderProps,\n DialogContentProps,\n DialogContentRenderProps,\n DialogDrawerProps,\n DialogDrawerRenderProps,\n DialogFooterProps,\n DialogSize,\n DialogTitleProps,\n};\n\nexport type DialogTexts = {\n /**\n * Aria-label for close icon button in dialog.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n close: string;\n drag: string;\n};\n\nexport type DialogProps = {\n children: React.ReactNode | React.ReactNode[];\n /** When `true`, pressing escape will close the dialog */\n closeOnEscape?: boolean;\n /** Set whether the dialog is open by default or not, use when not providing a trigger */\n defaultOpen?: boolean;\n /** Allows dragging the dialog around the screen (window constrained) */\n draggable?: boolean;\n /** Handler called when dialog closes by user interaction */\n onClose?: () => void;\n /** Called when the dialog opens or closes, must be used in conjunction with open */\n onChange?: (open: boolean) => void;\n /** Control the open state of the dialog from outside the component */\n open?: boolean;\n /** Shows the close icon button of the dialog */\n showCloseButton?: boolean;\n /** Size of the dialog. This is the recommended way to set a size for dialog component. */\n size?: DialogSize;\n /** A trigger to be used for the dialog, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n};\n\nconst useSeparatedChildren = initialChildren => {\n return React.useMemo(() => {\n const children: any[] = [];\n let drawer;\n let extra;\n\n React.Children.toArray(initialChildren).forEach((child: any) => {\n if (child.type?.displayName === Drawer.displayName) {\n drawer = child;\n } else if (child.type?.displayName === Extra.displayName) {\n extra = child;\n } else {\n children.push(child);\n }\n });\n\n return [children, drawer, extra];\n }, [initialChildren]);\n};\n\nexport type ForwardedDialogWithStatics = React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLElement>> & {\n Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n Content: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;\n Title: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n Footer: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;\n Extra: React.ForwardRefExoticComponent<DialogExtraProps & React.RefAttributes<HTMLDivElement>>;\n Drawer: React.ForwardRefExoticComponent<DialogDrawerProps & React.RefAttributes<HTMLDivElement>>;\n Close: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;\n};\n\nexport const Dialog = React.forwardRef(function Dialog(props: DialogProps, ref: React.Ref<HTMLElement>) {\n const {\n children: initialChildren,\n closeOnEscape = true,\n defaultOpen,\n draggable = false,\n onChange,\n onClose,\n open,\n showCloseButton = true,\n size = 'sm',\n trigger,\n ...otherProps\n } = props;\n const [children, drawer, extra] = useSeparatedChildren(initialChildren);\n const [drawerOpen, setDrawerOpen] = React.useState(false);\n\n const context = React.useMemo(\n () => ({\n closeOnEscape,\n draggable,\n drawer: {\n open: drawerOpen,\n toggle: () => setDrawerOpen(isDrawerOpen => !isDrawerOpen),\n },\n elements: {\n drawer,\n extra,\n },\n onClose,\n props: otherProps,\n showCloseButton,\n size,\n ref,\n }),\n [closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]\n );\n\n return (\n <DialogContext.Provider value={context}>\n <DialogPrimitive.Root defaultOpen={defaultOpen} open={open} onOpenChange={onChange}>\n {trigger && <Trigger>{trigger}</Trigger>}\n {children}\n </DialogPrimitive.Root>\n </DialogContext.Provider>\n );\n}) as ForwardedDialogWithStatics;\n\nDialog.Trigger = Trigger;\nDialog.Content = Content;\nDialog.Title = Title;\nDialog.Footer = Footer;\nDialog.Extra = Extra;\nDialog.Drawer = Drawer;\nDialog.Close = Close;\n"],"names":["useSeparatedChildren","initialChildren","React","children","drawer","extra","toArray","forEach","child","type","displayName","Drawer","Extra","push","Dialog","props","ref","closeOnEscape","defaultOpen","draggable","onChange","onClose","open","showCloseButton","size","trigger","otherProps","drawerOpen","setDrawerOpen","context","toggle","isDrawerOpen","elements","DialogContext","Provider","value","DialogPrimitive","onOpenChange","Trigger","Content","Title","Footer","Close"],"mappings":";;;;;;;;AAgEA,MAAMA,oBAAoB,GAAGC,eAAe;EACxC,OAAOC,OAAa,CAAC;IACjB,MAAMC,QAAQ,GAAU,EAAE;IAC1B,IAAIC,MAAM;IACV,IAAIC,KAAK;IAETH,QAAc,CAACI,OAAO,CAACL,eAAe,CAAC,CAACM,OAAO,CAAEC,KAAU;;MACvD,IAAI,gBAAAA,KAAK,CAACC,IAAI,gDAAV,YAAYC,WAAW,MAAKC,MAAM,CAACD,WAAW,EAAE;QAChDN,MAAM,GAAGI,KAAK;OACjB,MAAM,IAAI,iBAAAA,KAAK,CAACC,IAAI,iDAAV,aAAYC,WAAW,MAAKE,KAAK,CAACF,WAAW,EAAE;QACtDL,KAAK,GAAGG,KAAK;OAChB,MAAM;QACHL,QAAQ,CAACU,IAAI,CAACL,KAAK,CAAC;;KAE3B,CAAC;IAEF,OAAO,CAACL,QAAQ,EAAEC,MAAM,EAAEC,KAAK,CAAC;GACnC,EAAE,CAACJ,eAAe,CAAC,CAAC;AACzB,CAAC;MAYYa,MAAM,gBAAGZ,UAAgB,CAAC,SAASY,MAAM,CAACC,KAAkB,EAAEC,GAA2B;EAClG,MAAM;IACFb,QAAQ,EAAEF,eAAe;IACzBgB,aAAa,GAAG,IAAI;IAC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,MAAM,CAACH,MAAM,GAAGA,MAAM;AACtBG,MAAM,CAAC4B,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Dialog.js","sources":["../../../../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport './Dialog.css';\nimport { DialogTriggerProps, Trigger } from './components/Trigger';\nimport {\n Content,\n Title,\n Footer,\n Close,\n DialogContentProps,\n DialogContentRenderProps,\n DialogContentDrawerRenderProps,\n DialogTitleProps,\n DialogFooterProps,\n DialogCloseProps,\n} from './components/Content';\nimport { DialogDrawerProps, DialogDrawerRenderProps, Drawer } from './components/Drawer';\nimport { DialogExtraProps, Extra } from './components/Extra';\nimport { DialogContext } from './Context';\nimport { DialogSize } from './types';\n\nexport type {\n DialogCloseProps,\n DialogContentDrawerRenderProps,\n DialogContentProps,\n DialogContentRenderProps,\n DialogDrawerProps,\n DialogDrawerRenderProps,\n DialogFooterProps,\n DialogSize,\n DialogTitleProps,\n};\n\nexport type DialogTexts = {\n /**\n * Aria-label for close icon button in dialog.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n close: string;\n drag: string;\n};\n\nexport type DialogProps = {\n children: React.ReactNode | React.ReactNode[];\n /** When `true`, pressing escape will close the dialog */\n closeOnEscape?: boolean;\n /** Set whether the dialog is open by default or not */\n defaultOpen?: boolean;\n /** Allows dragging the dialog around the screen (window constrained) */\n draggable?: boolean;\n /** Handler called when dialog closes by user interaction */\n onClose?: () => void;\n /** Called when the dialog opens or closes, must be used in conjunction with open */\n onChange?: (open: boolean) => void;\n /** Control the open state of the dialog from outside the component */\n open?: boolean;\n /** Shows the close icon button of the dialog */\n showCloseButton?: boolean;\n /** Size of the dialog. This is the recommended way to set a size for dialog component. */\n size?: DialogSize;\n /** A trigger to be used for the dialog, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n};\n\nconst useSeparatedChildren = initialChildren => {\n return React.useMemo(() => {\n const children: any[] = [];\n let drawer;\n let extra;\n\n React.Children.toArray(initialChildren).forEach((child: any) => {\n if (child.type?.displayName === Drawer.displayName) {\n drawer = child;\n } else if (child.type?.displayName === Extra.displayName) {\n extra = child;\n } else {\n children.push(child);\n }\n });\n\n return [children, drawer, extra];\n }, [initialChildren]);\n};\n\nexport type ForwardedDialogWithStatics = React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLElement>> & {\n Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n Content: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;\n Title: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n Footer: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;\n Extra: React.ForwardRefExoticComponent<DialogExtraProps & React.RefAttributes<HTMLDivElement>>;\n Drawer: React.ForwardRefExoticComponent<DialogDrawerProps & React.RefAttributes<HTMLDivElement>>;\n Close: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;\n};\n\nexport const Dialog = React.forwardRef(function Dialog(props: DialogProps, ref: React.Ref<HTMLElement>) {\n const {\n children: initialChildren,\n closeOnEscape = true,\n defaultOpen,\n draggable = false,\n onChange,\n onClose,\n open,\n showCloseButton = true,\n size = 'sm',\n trigger,\n ...otherProps\n } = props;\n const [children, drawer, extra] = useSeparatedChildren(initialChildren);\n const [drawerOpen, setDrawerOpen] = React.useState(false);\n\n const context = React.useMemo(\n () => ({\n closeOnEscape,\n draggable,\n drawer: {\n open: drawerOpen,\n toggle: () => setDrawerOpen(isDrawerOpen => !isDrawerOpen),\n },\n elements: {\n drawer,\n extra,\n },\n onClose,\n props: otherProps,\n showCloseButton,\n size,\n ref,\n }),\n [closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]\n );\n\n return (\n <DialogContext.Provider value={context}>\n <DialogPrimitive.Root defaultOpen={defaultOpen} open={open} onOpenChange={onChange}>\n {trigger && <Trigger>{trigger}</Trigger>}\n {children}\n </DialogPrimitive.Root>\n </DialogContext.Provider>\n );\n}) as ForwardedDialogWithStatics;\n\nDialog.Trigger = Trigger;\nDialog.Content = Content;\nDialog.Title = Title;\nDialog.Footer = Footer;\nDialog.Extra = Extra;\nDialog.Drawer = Drawer;\nDialog.Close = Close;\n"],"names":["useSeparatedChildren","initialChildren","React","children","drawer","extra","toArray","forEach","child","type","displayName","Drawer","Extra","push","Dialog","props","ref","closeOnEscape","defaultOpen","draggable","onChange","onClose","open","showCloseButton","size","trigger","otherProps","drawerOpen","setDrawerOpen","context","toggle","isDrawerOpen","elements","DialogContext","Provider","value","DialogPrimitive","onOpenChange","Trigger","Content","Title","Footer","Close"],"mappings":";;;;;;;;AAgEA,MAAMA,oBAAoB,GAAGC,eAAe;EACxC,OAAOC,OAAa,CAAC;IACjB,MAAMC,QAAQ,GAAU,EAAE;IAC1B,IAAIC,MAAM;IACV,IAAIC,KAAK;IAETH,QAAc,CAACI,OAAO,CAACL,eAAe,CAAC,CAACM,OAAO,CAAEC,KAAU;;MACvD,IAAI,gBAAAA,KAAK,CAACC,IAAI,gDAAV,YAAYC,WAAW,MAAKC,MAAM,CAACD,WAAW,EAAE;QAChDN,MAAM,GAAGI,KAAK;OACjB,MAAM,IAAI,iBAAAA,KAAK,CAACC,IAAI,iDAAV,aAAYC,WAAW,MAAKE,KAAK,CAACF,WAAW,EAAE;QACtDL,KAAK,GAAGG,KAAK;OAChB,MAAM;QACHL,QAAQ,CAACU,IAAI,CAACL,KAAK,CAAC;;KAE3B,CAAC;IAEF,OAAO,CAACL,QAAQ,EAAEC,MAAM,EAAEC,KAAK,CAAC;GACnC,EAAE,CAACJ,eAAe,CAAC,CAAC;AACzB,CAAC;MAYYa,MAAM,gBAAGZ,UAAgB,CAAC,SAASY,MAAM,CAACC,KAAkB,EAAEC,GAA2B;EAClG,MAAM;IACFb,QAAQ,EAAEF,eAAe;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ACF,KAAK,GAAGA,KAAK;AACpBE,MAAM,CAACH,MAAM,GAAGA,MAAM;AACtBG,MAAM,CAAC4B,KAAK,GAAGA,KAAK;;;;"}
@@ -102,7 +102,7 @@ const Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
102
102
  draggable: true,
103
103
  "aria-grabbed": dragging,
104
104
  "aria-label": texts.dialog.drag,
105
- className: "yt-dialog__drag absolute-center-x bg-grey-light top-1.5 h-3 w-24 cursor-move rounded text-center"
105
+ className: "yt-dialog__drag absolute-center-x bg-grey-100 top-1.5 h-3 w-24 cursor-move rounded text-center"
106
106
  })), dialog.showCloseButton ? /*#__PURE__*/createElement(Close$1, {
107
107
  onClick: dialog.onClose,
108
108
  asChild: true
@@ -1 +1 @@
1
- {"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/Dialog/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { DialogContext, useCurrentDialog } from '../Context';\nimport { useLocalization } from '../../Provider/Localization';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Backdrop } from '../../Backdrop/Backdrop';\nimport { getDialogPositionClassnames, getDialogSizeClassnames } from '../util';\n\nexport type DialogContentDrawerRenderProps = DialogContext['drawer'];\n\nexport type DialogContentRenderProps = {\n close: () => void;\n drawer?: DialogContentDrawerRenderProps;\n};\n\nexport type DialogTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: DialogTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('text-center', props.className);\n return <DialogPrimitive.Title {...props} className={className} ref={ref} />;\n});\n\nexport type DialogFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DialogFooter(props: DialogFooterProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('mt-8 flex justify-end', props.className);\n return (\n <div {...props} className={className} ref={ref}>\n {props.children}\n </div>\n );\n});\n\nexport type DialogCloseProps = React.HTMLAttributes<HTMLButtonElement>;\n\nexport const Close = React.forwardRef(function DialogClose(props: DialogCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const dialog = useCurrentDialog();\n\n return <DialogPrimitive.Close onClick={dialog.onClose} {...props} ref={ref} asChild />;\n});\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick, renderProps }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('close'));\n };\n\n return children({ close, ref, ...renderProps });\n});\n\nexport type DialogContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the dialog is opened */\n 'aria-label': string;\n children: Omit<React.ReactNode, 'Function'> | ((props: DialogContentRenderProps) => JSX.Element);\n};\nexport const Content = React.forwardRef(function DialogContent(props: DialogContentProps, ref: React.Ref<HTMLDivElement>) {\n const dialog = useCurrentDialog();\n const internalRef = useMergedRef<HTMLDivElement>(ref);\n const { position, dragging, handleProps: dragHandleProps } = useDraggable(internalRef);\n const { texts } = useLocalization();\n\n const className = cn(\n 'relative bg-white animate-[fade-in_150ms]',\n getDialogPositionClassnames(),\n getDialogSizeClassnames(dialog.size)\n );\n\n const containerClassName = cn(\n 'bg-white p-6 rounded relative z-10',\n 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]',\n {\n 'rounded-b-none': !!dialog.elements.extra,\n },\n props.className\n );\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n if (!dialog.closeOnEscape) {\n event.preventDefault();\n } else if (dialog.onClose) {\n dialog.onClose();\n }\n };\n\n // the chosen behaviour in taco is that outside clicks do not close the dialog\n const handleInteractOutside = event => event.preventDefault();\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <DialogPrimitive.Close asChild>\n <RenderPropWrapper renderProps={{ drawer: dialog.drawer }}>{props.children}</RenderPropWrapper>\n </DialogPrimitive.Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay asChild>\n <Backdrop>\n <DialogPrimitive.Content\n {...props}\n className={className}\n onEscapeKeyDown={handleEscapeKeyDown}\n onInteractOutside={handleInteractOutside}\n ref={internalRef}\n style={{\n ...props.style,\n left: dialog.draggable ? `${position.x}px` : undefined,\n top: dialog.draggable ? `${position.y}px` : undefined,\n }}>\n <div className={containerClassName} data-taco=\"dialog\">\n {output}\n {dialog.draggable && (\n <div\n {...dragHandleProps}\n role=\"button\"\n draggable={true}\n aria-grabbed={dragging}\n aria-label={texts.dialog.drag}\n className=\"yt-dialog__drag absolute-center-x bg-grey-light top-1.5 h-3 w-24 cursor-move rounded text-center\"\n />\n )}\n {dialog.showCloseButton ? (\n <DialogPrimitive.Close onClick={dialog.onClose} asChild>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.dialog.close}\n className=\"absolute top-0 right-0 mt-2 mr-2\"\n icon=\"close\"\n />\n </DialogPrimitive.Close>\n ) : null}\n </div>\n {dialog.elements.drawer}\n {dialog.elements.extra}\n </DialogPrimitive.Content>\n </Backdrop>\n </DialogPrimitive.Overlay>\n </DialogPrimitive.Portal>\n );\n});\n"],"names":["Title","React","DialogTitle","props","ref","className","cn","DialogPrimitive","Footer","DialogFooter","children","Close","DialogClose","dialog","useCurrentDialog","onClick","onClose","asChild","RenderPropWrapper","renderProps","close","CustomEvent","Content","DialogContent","internalRef","useMergedRef","position","dragging","handleProps","dragHandleProps","useDraggable","texts","useLocalization","getDialogPositionClassnames","getDialogSizeClassnames","size","containerClassName","elements","extra","handleEscapeKeyDown","event","closeOnEscape","preventDefault","handleInteractOutside","output","drawer","Backdrop","onEscapeKeyDown","onInteractOutside","style","left","draggable","x","undefined","top","y","role","drag","showCloseButton","IconButton","appearance","icon"],"mappings":";;;;;;;;;;;MAmBaA,KAAK,gBAAGC,UAAgB,CAAC,SAASC,WAAW,C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ByB,KAAK,EAAE;MACH,GAAG9C,KAAK,CAAC8C,KAAK;MACdC,IAAI,EAAErC,MAAM,CAACsC,SAAS,MAAMzB,QAAQ,CAAC0B,KAAK,GAAGC,SAAS;MACtDC,GAAG,EAAEzC,MAAM,CAACsC,SAAS,MAAMzB,QAAQ,CAAC6B,KAAK,GAAGF;;mBAEhDpD;IAAKI,SAAS,EAAE+B,kBAAkB;iBAAY;KACzCQ,MAAM,EACN/B,MAAM,CAACsC,SAAS,iBACblD,uCACQ4B,eAAe;IACnB2B,IAAI,EAAC,QAAQ;IACbL,SAAS,EAAE,IAAI;oBACDxB,QAAQ;kBACVI,KAAK,CAAClB,MAAM,CAAC4C,IAAI;IAC7BpD,SAAS,EAAC;KAEjB,EACAQ,MAAM,CAAC6C,eAAe,gBACnBzD,cAACM,OAAqB;IAACQ,OAAO,EAAEF,MAAM,CAACG,OAAO;IAAEC,OAAO;kBACnDhB,cAAC0D,UAAU;IACPC,UAAU,EAAC,UAAU;kBACT7B,KAAK,CAAClB,MAAM,CAACO,KAAK;IAC9Bf,SAAS,EAAC,kCAAkC;IAC5CwD,IAAI,EAAC;IACP,CACkB,GACxB,IAAI,CACN,EACLhD,MAAM,CAACwB,QAAQ,CAACQ,MAAM,EACtBhC,MAAM,CAACwB,QAAQ,CAACC,KAAK,CACA,CACnB,CACW,CACL;AAEjC,CAAC;;;;"}
1
+ {"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/Dialog/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { DialogContext, useCurrentDialog } from '../Context';\nimport { useLocalization } from '../../Provider/Localization';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Backdrop } from '../../Backdrop/Backdrop';\nimport { getDialogPositionClassnames, getDialogSizeClassnames } from '../util';\n\nexport type DialogContentDrawerRenderProps = DialogContext['drawer'];\n\nexport type DialogContentRenderProps = {\n close: () => void;\n drawer?: DialogContentDrawerRenderProps;\n};\n\nexport type DialogTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: DialogTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('text-center', props.className);\n return <DialogPrimitive.Title {...props} className={className} ref={ref} />;\n});\n\nexport type DialogFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DialogFooter(props: DialogFooterProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('mt-8 flex justify-end', props.className);\n return (\n <div {...props} className={className} ref={ref}>\n {props.children}\n </div>\n );\n});\n\nexport type DialogCloseProps = React.HTMLAttributes<HTMLButtonElement>;\n\nexport const Close = React.forwardRef(function DialogClose(props: DialogCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const dialog = useCurrentDialog();\n\n return <DialogPrimitive.Close onClick={dialog.onClose} {...props} ref={ref} asChild />;\n});\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick, renderProps }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('close'));\n };\n\n return children({ close, ref, ...renderProps });\n});\n\nexport type DialogContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the dialog is opened */\n 'aria-label': string;\n children: Omit<React.ReactNode, 'Function'> | ((props: DialogContentRenderProps) => JSX.Element);\n};\nexport const Content = React.forwardRef(function DialogContent(props: DialogContentProps, ref: React.Ref<HTMLDivElement>) {\n const dialog = useCurrentDialog();\n const internalRef = useMergedRef<HTMLDivElement>(ref);\n const { position, dragging, handleProps: dragHandleProps } = useDraggable(internalRef);\n const { texts } = useLocalization();\n\n const className = cn(\n 'relative bg-white animate-[fade-in_150ms]',\n getDialogPositionClassnames(),\n getDialogSizeClassnames(dialog.size)\n );\n\n const containerClassName = cn(\n 'bg-white p-6 rounded relative z-10',\n 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]',\n {\n 'rounded-b-none': !!dialog.elements.extra,\n },\n props.className\n );\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n if (!dialog.closeOnEscape) {\n event.preventDefault();\n } else if (dialog.onClose) {\n dialog.onClose();\n }\n };\n\n // the chosen behaviour in taco is that outside clicks do not close the dialog\n const handleInteractOutside = event => event.preventDefault();\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <DialogPrimitive.Close asChild>\n <RenderPropWrapper renderProps={{ drawer: dialog.drawer }}>{props.children}</RenderPropWrapper>\n </DialogPrimitive.Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay asChild>\n <Backdrop>\n <DialogPrimitive.Content\n {...props}\n className={className}\n onEscapeKeyDown={handleEscapeKeyDown}\n onInteractOutside={handleInteractOutside}\n ref={internalRef}\n style={{\n ...props.style,\n left: dialog.draggable ? `${position.x}px` : undefined,\n top: dialog.draggable ? `${position.y}px` : undefined,\n }}>\n <div className={containerClassName} data-taco=\"dialog\">\n {output}\n {dialog.draggable && (\n <div\n {...dragHandleProps}\n role=\"button\"\n draggable\n aria-grabbed={dragging}\n aria-label={texts.dialog.drag}\n className=\"yt-dialog__drag absolute-center-x bg-grey-100 top-1.5 h-3 w-24 cursor-move rounded text-center\"\n />\n )}\n {dialog.showCloseButton ? (\n <DialogPrimitive.Close onClick={dialog.onClose} asChild>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.dialog.close}\n className=\"absolute top-0 right-0 mt-2 mr-2\"\n icon=\"close\"\n />\n </DialogPrimitive.Close>\n ) : null}\n </div>\n {dialog.elements.drawer}\n {dialog.elements.extra}\n </DialogPrimitive.Content>\n </Backdrop>\n </DialogPrimitive.Overlay>\n </DialogPrimitive.Portal>\n );\n});\n"],"names":["Title","React","DialogTitle","props","ref","className","cn","DialogPrimitive","Footer","DialogFooter","children","Close","DialogClose","dialog","useCurrentDialog","onClick","onClose","asChild","RenderPropWrapper","renderProps","close","CustomEvent","Content","DialogContent","internalRef","useMergedRef","position","dragging","handleProps","dragHandleProps","useDraggable","texts","useLocalization","getDialogPositionClassnames","getDialogSizeClassnames","size","containerClassName","elements","extra","handleEscapeKeyDown","event","closeOnEscape","preventDefault","handleInteractOutside","output","drawer","Backdrop","onEscapeKeyDown","onInteractOutside","style","left","draggable","x","undefined","top","y","role","drag","showCloseButton","IconButton","appearance","icon"],"mappings":";;;;;;;;;;;MAmBaA,KAAK,gBAAGC,UAAgB,CAAC,SAASC,WAAW,CAACC,KAAuB,EAAEC,GAAkC;EAClH,MAAMC,SAAS,GAAGC,EAAE,CAAC,aAAa,EAAEH,KAAK,CAACE,SAAS,CAAC;EACpD,oBAAOJ,cAACM,OAAqB,oBAAKJ,KAAK;IAAEE,SAAS,EAAEA,SAAS;IAAED,GAAG,EAAEA;KAAO;AAC/E,CAAC;MAGYI,MAAM,gBAAGP,UAAgB,CAAC,SAASQ,YAAY,CAACN,KAAwB,EAAEC,GAA8B;EACjH,MAAMC,SAAS,GAAGC,EAAE,CAAC,uBAAuB,EAAEH,KAAK,CAACE,SAAS,CAAC;EAC9D,oBACIJ,uCAASE,KAAK;IAAEE,SAAS,EAAEA,SAAS;IAAED,GAAG,EAAEA;MACtCD,KAAK,CAACO,QAAQ,CACb;AAEd,CAAC;MAIYC,KAAK,gBAAGV,UAAgB,CAAC,SAASW,WAAW,CAACT,KAAuB,EAAEC,GAAiC;EACjH,MAAMS,MAAM,GAAGC,gBAAgB,EAAE;EAEjC,oBAAOb,cAACM,OAAqB;IAACQ,OAAO,EAAEF,MAAM,CAACG;KAAab,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEa,OAAO;KAAG;AAC1F,CAAC;AAED,MAAMC,iBAAiB,gBAAGjB,UAAgB,CAAC,SAASiB,iBAAiB,CAAC;EAAER,QAAQ;EAAEK,OAAO;EAAEI;CAAkB,EAAEf,GAAG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+2,7 @@ import { forwardRef, createElement } from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
4
  const Extra = /*#__PURE__*/forwardRef(function DialogExtra(props, ref) {
5
- const className = cn('bg-grey-light yt-shadow-inset absolute top-full left-0 -mt-px w-full rounded-t-none rounded-b p-6 text-left', props.className);
5
+ const className = cn('bg-grey-100 yt-shadow-inset absolute top-full left-0 -mt-px w-full rounded-t-none rounded-b p-6 text-left', props.className);
6
6
  return /*#__PURE__*/createElement("div", Object.assign({}, props, {
7
7
  className: className,
8
8
  "data-taco": "dialog-extra",
@@ -1 +1 @@
1
- {"version":3,"file":"Extra.js","sources":["../../../../../../../../src/components/Dialog/components/Extra.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nexport type DialogExtraProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst Extra = React.forwardRef(function DialogExtra(props: DialogExtraProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn(\n 'bg-grey-light yt-shadow-inset absolute top-full left-0 -mt-px w-full rounded-t-none rounded-b p-6 text-left',\n props.className\n );\n\n return <div {...props} className={className} data-taco=\"dialog-extra\" ref={ref} />;\n});\nExtra.displayName = 'DialogExtra';\n\nexport { Extra };\n"],"names":["Extra","React","DialogExtra","props","ref","className","cn","displayName"],"mappings":";;;MAKMA,KAAK,gBAAGC,UAAgB,CAAC,SAASC,WAAW,CAACC,KAAuB,EAAEC,GAA8B;EACvG,MAAMC,SAAS,GAAGC,EAAE,CAChB,6GAA6G,EAC7GH,KAAK,CAACE,SAAS,CAClB;EAED,oBAAOJ,uCAASE,KAAK;IAAEE,SAAS,EAAEA,SAAS;iBAAY,cAAc;IAACD,GAAG,EAAEA;KAAO;AACtF,CAAC;AACDJ,KAAK,CAACO,WAAW,GAAG,aAAa;;;;"}
1
+ {"version":3,"file":"Extra.js","sources":["../../../../../../../../src/components/Dialog/components/Extra.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nexport type DialogExtraProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst Extra = React.forwardRef(function DialogExtra(props: DialogExtraProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn(\n 'bg-grey-100 yt-shadow-inset absolute top-full left-0 -mt-px w-full rounded-t-none rounded-b p-6 text-left',\n props.className\n );\n\n return <div {...props} className={className} data-taco=\"dialog-extra\" ref={ref} />;\n});\nExtra.displayName = 'DialogExtra';\n\nexport { Extra };\n"],"names":["Extra","React","DialogExtra","props","ref","className","cn","displayName"],"mappings":";;;MAKMA,KAAK,gBAAGC,UAAgB,CAAC,SAASC,WAAW,CAACC,KAAuB,EAAEC,GAA8B;EACvG,MAAMC,SAAS,GAAGC,EAAE,CAChB,2GAA2G,EAC3GH,KAAK,CAACE,SAAS,CAClB;EAED,oBAAOJ,uCAASE,KAAK;IAAEE,SAAS,EAAEA,SAAS;iBAAY,cAAc;IAACD,GAAG,EAAEA;KAAO;AACtF,CAAC;AACDJ,KAAK,CAACO,WAAW,GAAG,aAAa;;;;"}
@@ -10,11 +10,11 @@ const Field = /*#__PURE__*/forwardRef(function Field(props, ref) {
10
10
  ...otherProps
11
11
  } = props;
12
12
  const className = cn('flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]', {
13
- 'text-grey-dark': disabled
13
+ 'text-grey-300': disabled
14
14
  }, props.className);
15
15
  const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {
16
- 'text-grey-darkest': !invalid,
17
- 'text-red': invalid,
16
+ 'text-grey-700': !invalid,
17
+ 'text-red-500': invalid,
18
18
  'opacity-50': disabled
19
19
  }, props.className);
20
20
  return /*#__PURE__*/createElement("label", Object.assign({}, otherProps, {
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../../../../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nimport './Field.css';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const { disabled, children, invalid = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-grey-dark': disabled,\n },\n props.className\n );\n const messageClassName = cn(\n 'h-4 text-xs text-left leading-normal font-normal truncate -mb-4',\n {\n 'text-grey-darkest': !invalid,\n 'text-red': invalid,\n 'opacity-50': disabled,\n },\n props.className\n );\n\n return (\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\n {children}\n {message && (\n <span className={messageClassName} role={invalid ? 'alert' : undefined}>\n {message}\n </span>\n )}\n </label>\n );\n});\n"],"names":["Field","React","props","ref","disabled","children","invalid","message","otherProps","className","cn","messageClassName","role","undefined"],"mappings":";;;MAmBaA,KAAK,gBAAGC,UAAgB,CAAC,SAASD,KAAK,CAACE,KAAiB,EAAEC,GAAgC;EACpG,MAAM;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,OAAO,GAAG,KAAK;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC7E,MAAMO,SAAS,GAAGC,EAAE,CAChB,8EAA8E,EAC9E;IACI,gBAAgB,EAAEN;GACrB,EACDF,KAAK,CAACO,SAAS,CAClB;EACD,MAAME,gBAAgB,GAAGD,EAAE,CACvB,iEAAiE,EACjE;IACI,mBAAmB,EAAE,CAACJ,OAAO;IAC7B,UAAU,EAAEA,OAAO;IACnB,YAAY,EAAEF;GACjB,EACDF,KAAK,CAACO,SAAS,CAClB;EAED,oBACIR,yCAAWO,UAAU;IAAEC,SAAS,EAAEA,SAAS;iBAAY,OAAO;IAACN,GAAG,EAAEA;MAC/DE,QAAQ,EACRE,OAAO,iBACJN;IAAMQ,SAAS,EAAEE,gBAAgB;IAAEC,IAAI,EAAEN,OAAO,GAAG,OAAO,GAAGO;KACxDN,OAAO,CAEf,CACG;AAEhB,CAAC;;;;"}
1
+ {"version":3,"file":"Field.js","sources":["../../../../../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nimport './Field.css';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const { disabled, children, invalid = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-grey-300': disabled,\n },\n props.className\n );\n const messageClassName = cn(\n 'h-4 text-xs text-left leading-normal font-normal truncate -mb-4',\n {\n 'text-grey-700': !invalid,\n 'text-red-500': invalid,\n 'opacity-50': disabled,\n },\n props.className\n );\n\n return (\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\n {children}\n {message && (\n <span className={messageClassName} role={invalid ? 'alert' : undefined}>\n {message}\n </span>\n )}\n </label>\n );\n});\n"],"names":["Field","React","props","ref","disabled","children","invalid","message","otherProps","className","cn","messageClassName","role","undefined"],"mappings":";;;MAmBaA,KAAK,gBAAGC,UAAgB,CAAC,SAASD,KAAK,CAACE,KAAiB,EAAEC,GAAgC;EACpG,MAAM;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,OAAO,GAAG,KAAK;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC7E,MAAMO,SAAS,GAAGC,EAAE,CAChB,8EAA8E,EAC9E;IACI,eAAe,EAAEN;GACpB,EACDF,KAAK,CAACO,SAAS,CAClB;EACD,MAAME,gBAAgB,GAAGD,EAAE,CACvB,iEAAiE,EACjE;IACI,eAAe,EAAE,CAACJ,OAAO;IACzB,cAAc,EAAEA,OAAO;IACvB,YAAY,EAAEF;GACjB,EACDF,KAAK,CAACO,SAAS,CAClB;EAED,oBACIR,yCAAWO,UAAU;IAAEC,SAAS,EAAEA,SAAS;iBAAY,OAAO;IAACN,GAAG,EAAEA;MAC/DE,QAAQ,EACRE,OAAO,iBACJN;IAAMQ,SAAS,EAAEE,gBAAgB;IAAEC,IAAI,EAAEN,OAAO,GAAG,OAAO,GAAGO;KACxDN,OAAO,CAEf,CACG;AAEhB,CAAC;;;;"}
@@ -24,10 +24,9 @@ const Anchor = /*#__PURE__*/forwardRef(function HangerAnchor(props, externalRef)
24
24
  children = /*#__PURE__*/createElement("span", null, props.children);
25
25
  }
26
26
  return /*#__PURE__*/createElement(Anchor$1, Object.assign({}, parentProps, props, {
27
- children: children,
28
27
  ref: refCallback,
29
28
  asChild: true
30
- }));
29
+ }), children);
31
30
  });
32
31
  const Title = /*#__PURE__*/forwardRef(function DialogTitle(props, ref) {
33
32
  const className = cn('mb-1 text-base font-bold flex w-full', props.className);
@@ -44,7 +43,7 @@ const Content = /*#__PURE__*/forwardRef(function HangerContent(props, ref) {
44
43
  const {
45
44
  texts
46
45
  } = useLocalization();
47
- const className = cn('wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm', props.className);
46
+ const className = cn('wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm', props.className);
48
47
  const handleInteractOutside = event => {
49
48
  event.preventDefault();
50
49
  };
@@ -56,7 +55,7 @@ const Content = /*#__PURE__*/forwardRef(function HangerContent(props, ref) {
56
55
  sideOffset: 1,
57
56
  ref: ref
58
57
  }, props.children, /*#__PURE__*/createElement(UnstyledArrow, {
59
- className: "text-blue"
58
+ className: "text-blue-500"
60
59
  }), /*#__PURE__*/createElement(Close, {
61
60
  asChild: true
62
61
  }, /*#__PURE__*/createElement(IconButton, {
@@ -1 +1 @@
1
- {"version":3,"file":"Hanger.js","sources":["../../../../../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow } from '../Popover/Primitives';\nimport { useLocalization } from '../Provider/Localization';\nimport './Hanger.css';\nimport { mergeRefs } from '../../utils/mergeRefs';\n\ntype HangerContextValue = {\n /** Handler called when hanger closes by user interaction */\n onClose?: () => void;\n props: any;\n ref: React.Ref<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n onClose: undefined,\n props: {},\n ref: null,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;\nconst Anchor = React.forwardRef(function HangerAnchor(props: HangerAnchorProps, externalRef: React.Ref<HTMLDivElement>) {\n const { ref: parentRef, props: parentProps } = React.useContext(HangerContext);\n const refCallback = mergeRefs([parentRef, externalRef]);\n\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n console.warn(\n `Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\n );\n children = <span>{props.children}</span>;\n }\n\n return <PopoverPrimitive.Anchor {...parentProps} {...props} children={children} ref={refCallback} asChild />;\n});\n\nexport type HangerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: HangerTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('mb-1 text-base font-bold flex w-full', props.className);\n return <span {...props} className={className} ref={ref} />;\n});\n\nexport type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the Hanger relative to its achor. Default value is `bottom` */\n placement?: Placement;\n};\n\nconst Content = React.forwardRef(function HangerContent(props: HangerContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side } = props;\n const context = React.useContext(HangerContext);\n const { texts } = useLocalization();\n const className = cn(\n 'wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm',\n props.className\n );\n const handleInteractOutside = (event: CustomEvent): void => {\n event.preventDefault();\n };\n\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n className={className}\n data-taco=\"hanger\"\n onInteractOutside={handleInteractOutside}\n side={side}\n sideOffset={1}\n ref={ref}>\n {props.children}\n <UnstyledArrow className=\"text-blue\" />\n <PopoverPrimitive.Close asChild>\n <IconButton\n appearance=\"primary\"\n aria-label={texts.hanger.close}\n className=\"absolute top-0 right-0 ml-2 mr-2 mt-2 text-white\"\n icon=\"close\"\n onClick={context.onClose}\n />\n </PopoverPrimitive.Close>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n});\n\nexport type HangerProps = React.PropsWithChildren<{\n /** An anchor to be used for the hanger, should not be set if `children` already contains an anchor */\n anchor?: JSX.Element;\n /**\n * Shows or hides hanger depending on the value\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Handler called when user closes the hanger */\n onClose?: () => void;\n}>;\n\nexport type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;\n Content: React.ForwardRefExoticComponent<HangerContentProps>;\n Title: React.ForwardRefExoticComponent<HangerTitleProps>;\n};\n\nexport const Hanger = React.forwardRef<HTMLElement, HangerProps>(function Hanger(props, ref) {\n const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;\n const context = React.useMemo(() => ({ onClose, props: otherProps, ref }), [onClose, otherProps]);\n\n // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n if (defaultOpen) {\n setOpen(defaultOpen);\n }\n }, []);\n\n return (\n <HangerContext.Provider value={context}>\n <PopoverPrimitive.Root key={String(open)} defaultOpen={open}>\n {anchor && <Anchor>{anchor}</Anchor>}\n {children}\n </PopoverPrimitive.Root>\n </HangerContext.Provider>\n );\n}) as ForwardedHangerWithStatics;\nHanger.Anchor = Anchor;\nHanger.Content = Content;\nHanger.Title = Title;\n"],"names":["HangerContext","React","onClose","undefined","props","ref","Anchor","HangerAnchor","externalRef","parentRef","parentProps","refCallback","mergeRefs","children","type","console","warn","name","PopoverPrimitive","asChild","Title","DialogTitle","className","cn","Content","HangerContent","placement","side","context","texts","useLocalization","handleInteractOutside","event","preventDefault","onInteractOutside","sideOffset","UnstyledArrow","IconButton","appearance","hanger","close","icon","onClick","Hanger","anchor","defaultOpen","otherProps","open","setOpen","Provider","value","key","String"],"mappings":";;;;;;;;AAgBA,MAAMA,aAAa,gBAAGC,aAAmB,CAAqB;EAC1DC,OAAO,EAAEC,SAAS;EAClBC,KAAK,EAAE,EAAE;EACTC,GAAG,EAAE;CACR,CAAC;AAQF,MAAMC,MAAM,gBAAGL,UAAgB,CAAC,SAASM,YAAY,CAACH,KAAwB,EAAEI,WAAsC;;EAClH,MAAM;IAAEH,GAAG,EAAEI,SAAS;IAAEL,KAAK,EAAEM;GAAa,GAAGT,UAAgB,CAACD,aAAa,CAAC;EAC9E,MAAMW,WAAW,GAAGC,SAAS,CAAC,CAACH,SAAS,EAAED,WAAW,CAAC,CAAC;EAEvD,IAAIK,QAAQ,GAAGT,KAAK,CAACS,QAAQ;EAE7B,kBAAIZ,cAAoB,CAACG,KAAK,CAACS,QAAQ,CAAC,IAAI,2BAAOT,KAAK,CAACS,QAAQ,oDAAd,gBAAgBC,IAAI,MAAK,UAAU,EAAE;IACpFC,OAAO,CAACC,IAAI,mHAC0GZ,KAAK,CAACS,QAAQ,CAACC,IAAI,CAACG,kDAAkDb,KAAK,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AAU;IACPC,UAAU,EAAC,SAAS;kBACRT,KAAK,CAACU,MAAM,CAACC,KAAK;IAC9BlB,SAAS,EAAC,kDAAkD;IAC5DmB,IAAI,EAAC,OAAO;IACZC,OAAO,EAAEd,OAAO,CAAC1B;IACnB,CACmB,CACF,CACL;AAElC,CAAC,CAAC;MAoBWyC,MAAM,gBAAG1C,UAAgB,CAA2B,SAAS0C,MAAM,CAACvC,KAAK,EAAEC,GAAG;EACvF,MAAM;IAAEuC,MAAM;IAAE/B,QAAQ;IAAEgC,WAAW,GAAG,IAAI;IAAE3C,OAAO;IAAE,GAAG4C;GAAY,GAAG1C,KAAK;EAC9E,MAAMwB,OAAO,GAAG3B,OAAa,CAAC,OAAO;IAAEC,OAAO;IAAEE,KAAK,EAAE0C,UAAU;IAAEzC;GAAK,CAAC,EAAE,CAACH,OAAO,EAAE4C,UAAU,CAAC,CAAC;;EAGjG,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAG/C,QAAc,CAAC,KAAK,CAAC;EAC7CA,SAAe,CAAC;IACZ,IAAI4C,WAAW,EAAE;MACbG,OAAO,CAACH,WAAW,CAAC;;GAE3B,EAAE,EAAE,CAAC;EAEN,oBACI5C,cAACD,aAAa,CAACiD,QAAQ;IAACC,KAAK,EAAEtB;kBAC3B3B,cAACiB,IAAqB;IAACiC,GAAG,EAAEC,MAAM,CAACL,IAAI,CAAC;IAAEF,WAAW,EAAEE;KAClDH,MAAM,iBAAI3C,cAACK,MAAM,QAAEsC,MAAM,CAAU,EACnC/B,QAAQ,CACW,CACH;AAEjC,CAAC;AACD8B,MAAM,CAACrC,MAAM,GAAGA,MAAM;AACtBqC,MAAM,CAACnB,OAAO,GAAGA,OAAO;AACxBmB,MAAM,CAACvB,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Hanger.js","sources":["../../../../../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow } from '../Popover/Primitives';\nimport { useLocalization } from '../Provider/Localization';\nimport './Hanger.css';\nimport { mergeRefs } from '../../utils/mergeRefs';\n\ntype HangerContextValue = {\n /** Handler called when hanger closes by user interaction */\n onClose?: () => void;\n props: Record<string, any>;\n ref: React.Ref<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n onClose: undefined,\n props: {},\n ref: null,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;\nconst Anchor = React.forwardRef(function HangerAnchor(props: HangerAnchorProps, externalRef: React.Ref<HTMLDivElement>) {\n const { ref: parentRef, props: parentProps } = React.useContext(HangerContext);\n const refCallback = mergeRefs([parentRef, externalRef]);\n\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n console.warn(\n `Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\n );\n children = <span>{props.children}</span>;\n }\n\n return (\n <PopoverPrimitive.Anchor {...parentProps} {...props} ref={refCallback} asChild>\n {children}\n </PopoverPrimitive.Anchor>\n );\n});\n\nexport type HangerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: HangerTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('mb-1 text-base font-bold flex w-full', props.className);\n return <span {...props} className={className} ref={ref} />;\n});\n\nexport type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the Hanger relative to its achor. Default value is `bottom` */\n placement?: Placement;\n};\n\nconst Content = React.forwardRef(function HangerContent(props: HangerContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side } = props;\n const context = React.useContext(HangerContext);\n const { texts } = useLocalization();\n const className = cn(\n 'wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm',\n props.className\n );\n const handleInteractOutside = (event: CustomEvent): void => {\n event.preventDefault();\n };\n\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n className={className}\n data-taco=\"hanger\"\n onInteractOutside={handleInteractOutside}\n side={side}\n sideOffset={1}\n ref={ref}>\n {props.children}\n <UnstyledArrow className=\"text-blue-500\" />\n <PopoverPrimitive.Close asChild>\n <IconButton\n appearance=\"primary\"\n aria-label={texts.hanger.close}\n className=\"absolute top-0 right-0 ml-2 mr-2 mt-2 text-white\"\n icon=\"close\"\n onClick={context.onClose}\n />\n </PopoverPrimitive.Close>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n});\n\nexport type HangerProps = React.PropsWithChildren<{\n /** An anchor to be used for the hanger, should not be set if `children` already contains an anchor */\n anchor?: JSX.Element;\n /**\n * Shows or hides hanger depending on the value\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Handler called when user closes the hanger */\n onClose?: () => void;\n}>;\n\nexport type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;\n Content: React.ForwardRefExoticComponent<HangerContentProps>;\n Title: React.ForwardRefExoticComponent<HangerTitleProps>;\n};\n\nexport const Hanger = React.forwardRef<HTMLElement, HangerProps>(function Hanger(props, ref) {\n const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;\n const context = React.useMemo(() => ({ onClose, props: otherProps, ref }), [onClose, otherProps]);\n\n // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n if (defaultOpen) {\n setOpen(defaultOpen);\n }\n }, []);\n\n return (\n <HangerContext.Provider value={context}>\n <PopoverPrimitive.Root key={String(open)} defaultOpen={open}>\n {anchor && <Anchor>{anchor}</Anchor>}\n {children}\n </PopoverPrimitive.Root>\n </HangerContext.Provider>\n );\n}) as ForwardedHangerWithStatics;\nHanger.Anchor = Anchor;\nHanger.Content = Content;\nHanger.Title = Title;\n"],"names":["HangerContext","React","onClose","undefined","props","ref","Anchor","HangerAnchor","externalRef","parentRef","parentProps","refCallback","mergeRefs","children","type","console","warn","name","PopoverPrimitive","asChild","Title","DialogTitle","className","cn","Content","HangerContent","placement","side","context","texts","useLocalization","handleInteractOutside","event","preventDefault","onInteractOutside","sideOffset","UnstyledArrow","IconButton","appearance","hanger","close","icon","onClick","Hanger","anchor","defaultOpen","otherProps","open","setOpen","Provider","value","key","String"],"mappings":";;;;;;;;AAgBA,MAAMA,aAAa,gBAAGC,aAAmB,CAAqB;EAC1DC,OAAO,EAAEC,SAAS;EAClBC,KAAK,EAAE,EAAE;EACTC,GAAG,EAAE;CACR,CAAC;AAQF,MAAMC,MAAM,gBAAGL,UAAgB,CAAC,SAASM,YAAY,CAACH,KAAwB,EAAEI,WAAsC;;EAClH,MAAM;IAAEH,GAAG,EAAEI,SAAS;IAAEL,KAAK,EAAEM;GAAa,GAAGT,UAAgB,CAACD,aAAa,CAAC;EAC9E,MAAMW,WAAW,GAAGC,SAAS,CAAC,CAACH,SAAS,EAAED,WAAW,CAAC,CAAC;EAEvD,IAAIK,QAAQ,GAAGT,KAAK,CAACS,QAAQ;EAE7B,kBAAIZ,cAAoB,CAACG,KAAK,CAACS,QAAQ,CAAC,IAAI,2BAAOT,KAAK,CAACS,QAAQ,oDAAd,gBAAgBC,IAAI,MAAK,UAAU,EAAE;IACpFC,OAAO,CAACC,IAAI,mHAC0GZ,KAAK,CAACS,QAAQ,CAACC,IAAI,CAACG,kDAAkDb,KAAK,CAACS,QAAQ,CAACC,IAAI,CAACG,sFAAsF,CACrS;IACDJ,QAAQ,gBAAGZ,4BAAOG,KAAK,CAACS,QAAQ,CAAQ;;EAG5C,oBACIZ,cAACiB,QAAuB,oBAAKR,W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IACnB,CACmB,CACF,CACL;AAElC,CAAC,CAAC;MAoBWyC,MAAM,gBAAG1C,UAAgB,CAA2B,SAAS0C,MAAM,CAACvC,KAAK,EAAEC,GAAG;EACvF,MAAM;IAAEuC,MAAM;IAAE/B,QAAQ;IAAEgC,WAAW,GAAG,IAAI;IAAE3C,OAAO;IAAE,GAAG4C;GAAY,GAAG1C,KAAK;EAC9E,MAAMwB,OAAO,GAAG3B,OAAa,CAAC,OAAO;IAAEC,OAAO;IAAEE,KAAK,EAAE0C,UAAU;IAAEzC;GAAK,CAAC,EAAE,CAACH,OAAO,EAAE4C,UAAU,CAAC,CAAC;;EAGjG,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAG/C,QAAc,CAAC,KAAK,CAAC;EAC7CA,SAAe,CAAC;IACZ,IAAI4C,WAAW,EAAE;MACbG,OAAO,CAACH,WAAW,CAAC;;GAE3B,EAAE,EAAE,CAAC;EAEN,oBACI5C,cAACD,aAAa,CAACiD,QAAQ;IAACC,KAAK,EAAEtB;kBAC3B3B,cAACiB,IAAqB;IAACiC,GAAG,EAAEC,MAAM,CAACL,IAAI,CAAC;IAAEF,WAAW,EAAEE;KAClDH,MAAM,iBAAI3C,cAACK,MAAM,QAAEsC,MAAM,CAAU,EACnC/B,QAAQ,CACW,CACH;AAEjC,CAAC;AACD8B,MAAM,CAACrC,MAAM,GAAGA,MAAM;AACtBqC,MAAM,CAACnB,OAAO,GAAGA,OAAO;AACxBmB,MAAM,CAACvB,KAAK,GAAGA,KAAK;;;;"}
@@ -15,7 +15,7 @@ const UnstyledArrow = /*#__PURE__*/forwardRef(function HoverCardArrow(props, ref
15
15
  transform: 'rotateZ(180deg)'
16
16
  }
17
17
  }), /*#__PURE__*/createElement("path", {
18
- className: "text-grey-dark group-focus:text-blue-light fill-current",
18
+ className: "text-grey-300 fill-current group-focus:text-blue-300",
19
19
  d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
20
20
  }), /*#__PURE__*/createElement("path", {
21
21
  className: "fill-current",
@@ -1 +1 @@
1
- {"version":3,"file":"Primitives.js","sources":["../../../../../../../src/components/HoverCard/Primitives.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as HoverCardPrimitive from '@radix-ui/react-hover-card';\n\nexport const UnstyledArrow = React.forwardRef(function HoverCardArrow(\n props: React.SVGAttributes<SVGElement>,\n ref: React.Ref<SVGSVGElement>\n) {\n return (\n <HoverCardPrimitive.Arrow className=\"pointer-events-none -mt-px\" asChild offset={2} width={30} height={11}>\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\" style={{ transform: 'rotateZ(180deg)' }}>\n <path\n className=\"text-grey-dark group-focus:text-blue-light fill-current\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"></path>\n <path\n className=\"fill-current\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"></path>\n </svg>\n </HoverCardPrimitive.Arrow>\n );\n});\n"],"names":["UnstyledArrow","React","HoverCardArrow","props","ref","HoverCardPrimitive","className","asChild","offset","width","height","viewBox","style","transform","d"],"mappings":";;;MAGaA,aAAa,gBAAGC,UAAgB,CAAC,SAASC,cAAc,CACjEC,KAAsC,EACtCC,GAA6B;EAE7B,oBACIH,cAACI,KAAwB;IAACC,SAAS,EAAC,4BAA4B;IAACC,OAAO;IAACC,MAAM,EAAE,CAAC;IAAEC,KAAK,EAAE,EAAE;IAAEC,MAAM,EAAE;kBACnGT,uCAASE,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEO,OAAO,EAAC,YAAY;IAACC,KAAK,EAAE;MAAEC,SAAS,EAAE;;mBAC/DZ;IACIK,SAAS,EAAC,yDAAyD;IACnEQ,CAAC,EAAC;IAAoI,eAC1Ib;IACIK,SAAS,EAAC,cAAc;IACxBQ,CAAC,EAAC;IAA6G,CACjH,CACiB;AAEnC,CAAC;;;;"}
1
+ {"version":3,"file":"Primitives.js","sources":["../../../../../../../src/components/HoverCard/Primitives.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as HoverCardPrimitive from '@radix-ui/react-hover-card';\n\nexport const UnstyledArrow = React.forwardRef(function HoverCardArrow(\n props: React.SVGAttributes<SVGElement>,\n ref: React.Ref<SVGSVGElement>\n) {\n return (\n <HoverCardPrimitive.Arrow className=\"pointer-events-none -mt-px\" asChild offset={2} width={30} height={11}>\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\" style={{ transform: 'rotateZ(180deg)' }}>\n <path\n className=\"text-grey-300 fill-current group-focus:text-blue-300\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"></path>\n <path\n className=\"fill-current\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"></path>\n </svg>\n </HoverCardPrimitive.Arrow>\n );\n});\n"],"names":["UnstyledArrow","React","HoverCardArrow","props","ref","HoverCardPrimitive","className","asChild","offset","width","height","viewBox","style","transform","d"],"mappings":";;;MAGaA,aAAa,gBAAGC,UAAgB,CAAC,SAASC,cAAc,CACjEC,KAAsC,EACtCC,GAA6B;EAE7B,oBACIH,cAACI,KAAwB;IAACC,SAAS,EAAC,4BAA4B;IAACC,OAAO;IAACC,MAAM,EAAE,CAAC;IAAEC,KAAK,EAAE,EAAE;IAAEC,MAAM,EAAE;kBACnGT,uCAASE,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEO,OAAO,EAAC,YAAY;IAACC,KAAK,EAAE;MAAEC,SAAS,EAAE;;mBAC/DZ;IACIK,SAAS,EAAC,sDAAsD;IAChEQ,CAAC,EAAC;IAAoI,eAC1Ib;IACIK,SAAS,EAAC,cAAc;IACxBQ,CAAC,EAAC;IAA6G,CACjH,CACiB;AAEnC,CAAC;;;;"}
@@ -1,78 +1,130 @@
1
- import { forwardRef, useEffect, createElement, cloneElement } from 'react';
1
+ import { forwardRef, createElement, useRef, memo, isValidElement, cloneElement } from 'react';
2
2
  import cn from 'classnames';
3
3
  import { Icon } from '../Icon/Icon.js';
4
+ import { getButtonStateClasses, getInputClasses } from './util.js';
5
+ import { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener.js';
4
6
  import { useMergedRef } from '../../hooks/useMergedRef.js';
5
- import { getInputClasses, getButtonStateClasses } from './util.js';
6
7
 
7
- const Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
8
+ const validSetSelectionRangeTypes = ['text', 'search', 'url', 'tel', 'password'];
9
+ const InputWithoutDeprecatedFeatures = /*#__PURE__*/forwardRef(function InputWithoutDeprecatedFeatures(props, ref) {
8
10
  const {
9
- button,
10
- icon,
11
11
  highlighted,
12
12
  invalid,
13
13
  onKeyDown,
14
- autoFocus,
15
- ...otherProps
14
+ postfix,
15
+ prefix,
16
+ type = 'text',
17
+ ...attributes
16
18
  } = props;
17
- const inputRef = useMergedRef(ref);
18
- const hasContainer = button || icon;
19
- const className = cn(getInputClasses(props), 'min-h-[theme(spacing.8)] pointer-events-all', {
20
- 'pr-8': !!hasContainer
21
- }, !hasContainer && otherProps.className);
22
- useEffect(() => {
23
- if (autoFocus && inputRef.current) {
24
- inputRef.current.focus();
25
- }
26
- }, []);
19
+ const internalRef = useMergedRef(ref);
20
+ let handleKeyDown = onKeyDown;
27
21
  // home and end keys only navigate to the start/end of input value if the input container does not scroll
28
22
  // if it has scroll height then the browser reverts to native scrolling behaviour only
29
23
  // so we manually override it to ensure _our_ desired behaviour remains intact
30
- const handleKeyDown = event => {
31
- if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {
32
- event.preventDefault();
33
- const position = event.key === 'End' ? event.currentTarget.value.length : 0;
34
- event.currentTarget.setSelectionRange(position, position);
35
- }
36
- if (onKeyDown) {
37
- onKeyDown(event);
38
- }
39
- };
40
- const input = /*#__PURE__*/createElement("input", Object.assign({}, otherProps, {
24
+ // only the 'text', 'search', 'url', 'tel', 'password' input types support setSelectionRange
25
+ if (validSetSelectionRangeTypes.includes(type)) {
26
+ handleKeyDown = event => {
27
+ if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {
28
+ event.preventDefault();
29
+ const position = event.key === 'End' ? event.currentTarget.value.length : 0;
30
+ event.currentTarget.setSelectionRange(position, position);
31
+ }
32
+ if (typeof onKeyDown === 'function') {
33
+ onKeyDown(event);
34
+ }
35
+ };
36
+ }
37
+ const prefixRef = useRef(null);
38
+ const prefixRect = useBoundingClientRectListener(prefixRef);
39
+ const postfixRef = useRef(null);
40
+ const postfixRect = useBoundingClientRectListener(postfixRef);
41
+ const className = cn(getInputClasses(props), {
42
+ 'pl-8': !!prefix,
43
+ 'pr-8': !!postfix
44
+ }, attributes.className);
45
+ return /*#__PURE__*/createElement("div", {
46
+ className: "relative inline-flex"
47
+ }, /*#__PURE__*/createElement("input", Object.assign({}, attributes, {
41
48
  className: className,
42
49
  "data-taco": "input",
43
50
  onKeyDown: handleKeyDown,
44
- ref: inputRef
45
- }));
46
- if (hasContainer) {
47
- let extra;
48
- if (button) {
49
- const disabled = button.props.disabled || otherProps.disabled;
50
- const buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', {
51
- [getButtonStateClasses(invalid)]: !props.disabled
52
- }, button.props.className);
53
- extra = /*#__PURE__*/cloneElement(button, {
54
- className: buttonClassName,
55
- disabled
56
- });
57
- } else if (icon) {
58
- const iconClassName = cn('items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2', {
59
- 'text-grey-dark': props.disabled,
60
- 'text-grey-darkest': !props.disabled
61
- });
62
- extra = typeof icon === 'string' ? /*#__PURE__*/createElement(Icon, {
63
- className: iconClassName,
64
- name: icon
65
- }) : /*#__PURE__*/cloneElement(icon, {
66
- className: cn(iconClassName, icon.props.className)
67
- });
51
+ ref: internalRef,
52
+ style: {
53
+ paddingLeft: prefixRect ? `${prefixRect.width - 1}px` : undefined,
54
+ paddingRight: postfixRect ? `${postfixRect.width - 1}px` : undefined
55
+ },
56
+ type: type
57
+ })), prefix ? /*#__PURE__*/createElement(Affix, {
58
+ type: "prefix",
59
+ children: prefix,
60
+ disabled: attributes.disabled,
61
+ ref: prefixRef
62
+ }) : null, postfix ? /*#__PURE__*/createElement(Affix, {
63
+ type: "postfix",
64
+ children: postfix,
65
+ disabled: attributes.disabled,
66
+ ref: postfixRef
67
+ }) : null);
68
+ });
69
+ const Affix = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Affix(props, ref) {
70
+ const {
71
+ children,
72
+ disabled,
73
+ type
74
+ } = props;
75
+ let displayName;
76
+ if (children) {
77
+ let el = children;
78
+ if ( /*#__PURE__*/isValidElement(children)) {
79
+ var _children$type;
80
+ displayName = children === null || children === void 0 ? void 0 : (_children$type = children.type) === null || _children$type === void 0 ? void 0 : _children$type.displayName;
81
+ if (displayName === 'Icon') {
82
+ el = /*#__PURE__*/cloneElement(children, {
83
+ className: cn('!h-5 !w-5', children.props.className)
84
+ });
85
+ }
68
86
  }
69
- const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);
70
- return /*#__PURE__*/createElement("div", {
71
- className: containerClassName,
72
- "data-taco": "input-container"
73
- }, input, extra);
87
+ return /*#__PURE__*/createElement("span", {
88
+ className: cn('group absolute top-0 flex h-full items-center justify-center', {
89
+ 'text-grey-300': disabled,
90
+ 'text-grey-700': !disabled,
91
+ 'left-0': type === 'prefix',
92
+ 'right-0': type === 'postfix',
93
+ 'px-0': displayName === 'IconButton',
94
+ 'px-1.5': displayName === 'Icon',
95
+ 'px-2': displayName !== 'IconButton' && displayName !== 'Icon'
96
+ }),
97
+ ref: ref
98
+ }, el);
99
+ }
100
+ return null;
101
+ }));
102
+ const Input = /*#__PURE__*/forwardRef(function LegacyInput(props, ref) {
103
+ var _attributes$postfix;
104
+ const {
105
+ button,
106
+ icon,
107
+ ...attributes
108
+ } = props;
109
+ let postfix;
110
+ if (button) {
111
+ const disabled = button.props.disabled || attributes.disabled;
112
+ const buttonClassName = cn('items-center focus:z-10 flex justify-center border rounded-l-none rounded-r h-full focus:rounded focus:outline-none', {
113
+ [getButtonStateClasses(attributes.invalid)]: !props.disabled
114
+ }, button.props.className);
115
+ postfix = /*#__PURE__*/cloneElement(button, {
116
+ className: buttonClassName,
117
+ disabled
118
+ });
119
+ } else if (icon) {
120
+ postfix = typeof icon === 'string' ? /*#__PURE__*/createElement(Icon, {
121
+ name: icon
122
+ }) : icon;
74
123
  }
75
- return input;
124
+ return /*#__PURE__*/createElement(InputWithoutDeprecatedFeatures, Object.assign({}, attributes, {
125
+ postfix: (_attributes$postfix = attributes.postfix) !== null && _attributes$postfix !== void 0 ? _attributes$postfix : postfix,
126
+ ref: ref
127
+ }));
76
128
  });
77
129
 
78
130
  export { Input };
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../../../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { getButtonStateClasses, getInputClasses } from './util';\n\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {\n /** Shows a button within the input field */\n button?: React.ReactElement;\n /** Shows an icon within the input field */\n icon?: IconName | JSX.Element;\n /** Draws attention to the input by changing its style and making it visually prominent */\n highlighted?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n};\n\nexport const Input = React.forwardRef(function Input(props: InputProps, ref: React.Ref<HTMLInputElement>) {\n const { button, icon, highlighted, invalid, onKeyDown, autoFocus, ...otherProps } = props;\n const inputRef = useMergedRef<HTMLInputElement>(ref);\n const hasContainer = button || icon;\n const className = cn(\n getInputClasses(props),\n 'min-h-[theme(spacing.8)] pointer-events-all',\n {\n 'pr-8': !!hasContainer,\n },\n !hasContainer && otherProps.className\n );\n\n React.useEffect(() => {\n if (autoFocus && inputRef.current) {\n inputRef.current.focus();\n }\n }, []);\n\n // home and end keys only navigate to the start/end of input value if the input container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n const input = <input {...otherProps} className={className} data-taco=\"input\" onKeyDown={handleKeyDown} ref={inputRef} />;\n\n if (hasContainer) {\n let extra: any;\n\n if (button) {\n const disabled = button.props.disabled || otherProps.disabled;\n const buttonClassName = cn(\n 'items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none',\n {\n [getButtonStateClasses(invalid)]: !props.disabled,\n },\n button.props.className\n );\n extra = React.cloneElement(button, {\n className: buttonClassName,\n disabled,\n });\n } else if (icon) {\n const iconClassName = cn(\n 'items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2',\n {\n 'text-grey-dark': props.disabled,\n 'text-grey-darkest': !props.disabled,\n }\n );\n extra =\n typeof icon === 'string' ? (\n <Icon className={iconClassName} name={icon} />\n ) : (\n React.cloneElement(icon, { className: cn(iconClassName, icon.props.className) })\n );\n }\n\n const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);\n\n return (\n <div className={containerClassName} data-taco=\"input-container\">\n {input}\n {extra}\n </div>\n );\n }\n\n return input;\n});\n"],"names":["Input","React","props","ref","button","icon","highlighted","invalid","onKeyDown","autoFocus","otherProps","inputRef","useMergedRef","hasContainer","className","cn","getInputClasses","current","focus","handleKeyDown","event","shiftKey","key","preventDefault","position","currentTarget","value","length","setSelectionRange","input","extra","disabled","buttonClassName","getButtonStateClasses","iconClassName","Icon","name","containerClassName"],"mappings":";;;;;;MAiBaA,KAAK,gBAAGC,UAAgB,CAAC,SAASD,KAAK,CAACE,KAAiB,EAAEC,GAAgC;EACpG,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC,WAAW;IAAEC,OAAO;IAAEC,SAAS;IAAEC,SAAS;IAAE,GAAGC;GAAY,GAAGR,KAAK;EACzF,MAAMS,QAAQ,GAAGC,YAAY,CAAmBT,GAAG,CAAC;EACpD,MAAMU,YAAY,GAAGT,MAAM,IAAIC,IAAI;EACnC,MAAMS,SAAS,GAAGC,EAAE,CAChBC,eAAe,CAACd,KAAK,CAAC,EACtB,6CAA6C,EAC7C;IACI,MAAM,EAAE,CAAC,CAACW;GACb,EACD,CAACA,YAAY,IAAIH,UAAU,CAACI,SAAS,CACxC;EAEDb,SAAe,CAAC;IACZ,IAAIQ,SAAS,IAAIE,QAAQ,CAACM,OAAO,EAAE;MAC/BN,QAAQ,CAACM,OAAO,CAACC,KAAK,EAAE;;GAE/B,EAAE,EAAE,CAAC;;;;EAKN,MAAMC,aAAa,GAAIC,KAA4C;IAC/D,IAAI,CAACA,KAAK,CAACC,QAAQ,KAAKD,KAAK,CAACE,GAAG,KAAK,MAAM,IAAIF,KAAK,CAACE,GAAG,KAAK,KAAK,CAAC,EAAE;MAClEF,KAAK,CAACG,cAAc,EAAE;MACtB,MAAMC,QAAQ,GAAGJ,KAAK,CAACE,GAAG,KAAK,KAAK,GAAGF,KAAK,CAACK,aAAa,CAACC,KAAK,CAACC,MAAM,GAAG,CAAC;MAC3EP,KAAK,CAACK,aAAa,CAACG,iBAAiB,CAACJ,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Y;OACzCR,KAAK,EACLC,KAAK,CACJ;;EAId,OAAOD,KAAK;AAChB,CAAC;;;;"}
1
+ {"version":3,"file":"Input.js","sources":["../../../../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName, IconProps } from '../Icon/Icon';\nimport { getButtonStateClasses, getInputClasses } from './util';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { useMergedRef } from '../../hooks/useMergedRef';\n\nexport type InputWithoutDeprecatedFeaturesProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'prefix'> & {\n /** Draws attention to the input by changing its style and making it visually prominent */\n highlighted?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n postfix?: string | JSX.Element;\n prefix?: string | JSX.Element;\n};\n\nconst validSetSelectionRangeTypes = ['text', 'search', 'url', 'tel', 'password'];\n\nconst InputWithoutDeprecatedFeatures = React.forwardRef(function InputWithoutDeprecatedFeatures(\n props: InputWithoutDeprecatedFeaturesProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { highlighted, invalid, onKeyDown, postfix, prefix, type = 'text', ...attributes } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n\n let handleKeyDown = onKeyDown;\n\n // home and end keys only navigate to the start/end of input value if the input container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n // only the 'text', 'search', 'url', 'tel', 'password' input types support setSelectionRange\n if (validSetSelectionRangeTypes.includes(type)) {\n handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n }\n\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n };\n }\n\n const prefixRef = React.useRef<HTMLSpanElement>(null);\n const prefixRect = useBoundingClientRectListener(prefixRef);\n const postfixRef = React.useRef<HTMLSpanElement>(null);\n const postfixRect = useBoundingClientRectListener(postfixRef);\n\n const className = cn(\n getInputClasses(props),\n {\n 'pl-8': !!prefix,\n 'pr-8': !!postfix,\n },\n attributes.className\n );\n\n return (\n <div className=\"relative inline-flex\">\n <input\n {...attributes}\n className={className}\n data-taco=\"input\"\n onKeyDown={handleKeyDown}\n ref={internalRef}\n style={{\n paddingLeft: prefixRect ? `${prefixRect.width - 1}px` : undefined,\n paddingRight: postfixRect ? `${postfixRect.width - 1}px` : undefined,\n }}\n type={type}\n />\n {prefix ? <Affix type=\"prefix\" children={prefix} disabled={attributes.disabled} ref={prefixRef} /> : null}\n {postfix ? <Affix type=\"postfix\" children={postfix} disabled={attributes.disabled} ref={postfixRef} /> : null}\n </div>\n );\n});\n\ntype AffixProps = {\n children?: string | JSX.Element;\n disabled?: boolean;\n type: 'prefix' | 'postfix';\n};\nconst Affix = React.memo(\n React.forwardRef(function Affix(props: AffixProps, ref: React.Ref<HTMLSpanElement>) {\n const { children, disabled, type } = props;\n\n let displayName: string | undefined;\n\n if (children) {\n let el = children;\n\n if (React.isValidElement<IconProps>(children)) {\n displayName = (children?.type as React.FunctionComponent)?.displayName;\n\n if (displayName === 'Icon') {\n el = React.cloneElement(children, {\n className: cn('!h-5 !w-5', children.props.className),\n } as any);\n }\n }\n\n return (\n <span\n className={cn('group absolute top-0 flex h-full items-center justify-center', {\n 'text-grey-300': disabled,\n 'text-grey-700': !disabled,\n 'left-0': type === 'prefix',\n 'right-0': type === 'postfix',\n 'px-0': displayName === 'IconButton',\n 'px-1.5': displayName === 'Icon',\n 'px-2': displayName !== 'IconButton' && displayName !== 'Icon',\n })}\n ref={ref}>\n {el}\n </span>\n );\n }\n\n return null;\n })\n);\n\nexport type InputProps = InputWithoutDeprecatedFeaturesProps & {\n /** Shows a button within the input field */\n button?: React.ReactElement;\n /** Shows an icon within the input field */\n icon?: IconName | JSX.Element;\n};\n\nexport const Input = React.forwardRef(function LegacyInput(props: InputProps, ref: React.Ref<HTMLInputElement>) {\n const { button, icon, ...attributes } = props;\n\n let postfix;\n\n if (button) {\n const disabled = button.props.disabled || attributes.disabled;\n const buttonClassName = cn(\n 'items-center focus:z-10 flex justify-center border rounded-l-none rounded-r h-full focus:rounded focus:outline-none',\n {\n [getButtonStateClasses(attributes.invalid)]: !props.disabled,\n },\n button.props.className\n );\n postfix = React.cloneElement(button, {\n className: buttonClassName,\n disabled,\n });\n } else if (icon) {\n postfix = typeof icon === 'string' ? <Icon name={icon} /> : icon;\n }\n\n return <InputWithoutDeprecatedFeatures {...attributes} postfix={attributes.postfix ?? postfix} ref={ref} />;\n});\n"],"names":["validSetSelectionRangeTypes","InputWithoutDeprecatedFeatures","React","props","ref","highlighted","invalid","onKeyDown","postfix","prefix","type","attributes","internalRef","useMergedRef","handleKeyDown","includes","event","shiftKey","key","preventDefault","position","currentTarget","value","length","setSelectionRange","prefixRef","prefixRect","useBoundingClientRectListener","postfixRef","postfixRect","className","cn","getInputClasses","style","paddingLeft","width","undefined","paddingRight","Affix","children","disabled","displayName","el","Input","LegacyInput","button","icon","buttonClassName","getButtonStateClasses","Icon","name"],"mappings":";;;;;;;AAgBA,MAAMA,2BAA2B,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;AAEhF,MAAMC,8BAA8B,gBAAGC,UAAgB,CAAC,SAASD,8BAA8B,CAC3FE,KAA0C,EAC1CC,GAAgC;EAEhC,MAAM;IAAEC,WAAW;IAAEC,OAAO;IAAEC,SAAS;IAAEC,OAAO;IAAEC,MAAM;IAAEC,IAAI,GAAG,MAAM;IAAE,GAAGC;GAAY,GAAGR,KAAK;EAChG,MAAMS,WAAW,GAAGC,YAAY,CAAmBT,GAAG,CAAC;EAEvD,IAAIU,aAAa,GAAGP,SAAS;;;;;EAM7B,IAAIP,2BAA2B,CAACe,QAAQ,CAACL,IAAI,CAAC,EAAE;IAC5CI,aAAa,GAAIE,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