@oracle/oraclejet-preact 17.0.7 → 17.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/amd/CheckboxSet-9c883a32.js +2 -0
- package/amd/CheckboxSet-9c883a32.js.map +1 -0
- package/amd/InputDatePicker-da5d8728.js +2 -0
- package/amd/{InputDatePicker-0012b304.js.map → InputDatePicker-da5d8728.js.map} +1 -1
- package/amd/NavigationListItem-0a4f8a9c.js +2 -0
- package/amd/{NavigationListItem-c96ac144.js.map → NavigationListItem-0a4f8a9c.js.map} +1 -1
- package/amd/{OverflowTabBarItem-f781e527.js → OverflowTabBarItem-aae4eb2f.js} +2 -2
- package/amd/{OverflowTabBarItem-f781e527.js.map → OverflowTabBarItem-aae4eb2f.js.map} +1 -1
- package/amd/TextArea-2c7af40c.js +2 -0
- package/amd/TextArea-2c7af40c.js.map +1 -0
- package/amd/TextAreaAutosize-9dc5bffe.js +2 -0
- package/amd/{TextAreaAutosize-0a023972.js.map → TextAreaAutosize-9dc5bffe.js.map} +1 -1
- package/amd/Theme-redwood/theme.css +302 -302
- package/amd/Theme-stable/theme.css +289 -289
- package/amd/UNSAFE_CheckboxItem.js +1 -1
- package/amd/UNSAFE_CheckboxItem.js.map +1 -1
- package/amd/UNSAFE_CheckboxSet.js +1 -1
- package/amd/UNSAFE_CheckboxSet.js.map +1 -1
- package/amd/UNSAFE_InputDatePicker.js +1 -1
- package/amd/UNSAFE_NavigationList.js +1 -1
- package/amd/UNSAFE_OverflowTabBar.js +1 -1
- package/amd/UNSAFE_TabBar.js +1 -1
- package/amd/UNSAFE_TabBarCommon.js +1 -1
- package/amd/UNSAFE_TabBarMixed.js +1 -1
- package/amd/UNSAFE_TextArea.js +1 -1
- package/amd/UNSAFE_TextAreaAutosize.js +1 -1
- package/amd/hooks/UNSAFE_useContainerBreakpointValues.js +1 -1
- package/cjs/{BaseCardView-99f89fbf.js → BaseCardView-badf6df3.js} +2 -2
- package/cjs/{BaseCardView-99f89fbf.js.map → BaseCardView-badf6df3.js.map} +1 -1
- package/cjs/{CardFlexView-48f39ef2.js → CardFlexView-d44dfed5.js} +2 -2
- package/cjs/{CardFlexView-48f39ef2.js.map → CardFlexView-d44dfed5.js.map} +1 -1
- package/cjs/{CardGridView-6bb427fe.js → CardGridView-dd7c777f.js} +2 -2
- package/cjs/{CardGridView-6bb427fe.js.map → CardGridView-dd7c777f.js.map} +1 -1
- package/cjs/GroupLoadingIndicator-3c9d8341.js +1 -1
- package/cjs/{Indexer-0663a593.js → Indexer-563ea09d.js} +2 -2
- package/cjs/{Indexer-0663a593.js.map → Indexer-563ea09d.js.map} +1 -1
- package/cjs/{List-8802ce35.js → List-bd9ecebb.js} +4 -3
- package/cjs/{List-8802ce35.js.map → List-bd9ecebb.js.map} +1 -1
- package/cjs/{ListView-f7871b48.js → ListView-d67f49db.js} +2 -2
- package/cjs/{ListView-f7871b48.js.map → ListView-d67f49db.js.map} +1 -1
- package/cjs/{LoadMoreCollection-69bc038c.js → LoadMoreCollection-73112ff0.js} +2 -2
- package/cjs/{LoadMoreCollection-69bc038c.js.map → LoadMoreCollection-73112ff0.js.map} +1 -1
- package/cjs/PRIVATE_BaseCardView.js +3 -3
- package/cjs/PRIVATE_List.js +4 -4
- package/cjs/PRIVATE_LoadMoreCollection.js +2 -2
- package/cjs/PRIVATE_SelectCommon.js +5 -5
- package/cjs/PRIVATE_Table.js +3 -3
- package/cjs/PRIVATE_VirtualizedCollection.js +2 -2
- package/cjs/{SelectMultiple-fcfb029a.js → SelectMultiple-3af44d48.js} +2 -2
- package/cjs/{SelectMultiple-fcfb029a.js.map → SelectMultiple-3af44d48.js.map} +1 -1
- package/cjs/{SelectSingle-40cb868a.js → SelectSingle-315c9871.js} +2 -2
- package/cjs/{SelectSingle-40cb868a.js.map → SelectSingle-315c9871.js.map} +1 -1
- package/cjs/{Table-17b3dbc3.js → Table-ecf57a09.js} +2 -2
- package/cjs/{Table-17b3dbc3.js.map → Table-ecf57a09.js.map} +1 -1
- package/cjs/{TableView-26f85ff8.js → TableView-756b9d98.js} +2 -2
- package/cjs/{TableView-26f85ff8.js.map → TableView-756b9d98.js.map} +1 -1
- package/cjs/{TextArea-b2646d51.js → TextArea-aff8b46e.js} +22 -4
- package/cjs/TextArea-aff8b46e.js.map +1 -0
- package/cjs/{TextAreaAutosize-d8cad6ce.js → TextAreaAutosize-c12ae7e7.js} +3 -3
- package/cjs/{TextAreaAutosize-d8cad6ce.js.map → TextAreaAutosize-c12ae7e7.js.map} +1 -1
- package/cjs/Theme-redwood/theme.css +252 -252
- package/cjs/Theme-stable/theme.css +248 -248
- package/cjs/UNSAFE_BaseButton/themes/stable/BaseButtonTheme.js +1 -0
- package/cjs/UNSAFE_BaseButton/themes/stable/BaseButtonTheme.js.map +1 -1
- package/cjs/UNSAFE_CardFlexView.js +4 -4
- package/cjs/UNSAFE_CardGridView.js +4 -4
- package/cjs/UNSAFE_ExpandableList.js +3 -3
- package/cjs/UNSAFE_Indexer.js +2 -2
- package/cjs/UNSAFE_ListView.js +5 -5
- package/cjs/UNSAFE_SelectMultiple.js +6 -6
- package/cjs/UNSAFE_SelectSingle.js +6 -6
- package/cjs/UNSAFE_TableView.js +4 -4
- package/cjs/UNSAFE_TextArea.js +3 -4
- package/cjs/UNSAFE_TextArea.js.map +1 -1
- package/cjs/UNSAFE_TextAreaAutosize.js +2 -2
- package/cjs/UNSAFE_VirtualizedListView.js +5 -5
- package/cjs/{VirtualizedCollection-9e8c48b9.js → VirtualizedCollection-00aedb8b.js} +2 -2
- package/cjs/{VirtualizedCollection-9e8c48b9.js.map → VirtualizedCollection-00aedb8b.js.map} +1 -1
- package/cjs/{VirtualizedListView-b4147305.js → VirtualizedListView-a07fe73b.js} +2 -2
- package/cjs/{VirtualizedListView-b4147305.js.map → VirtualizedListView-a07fe73b.js.map} +1 -1
- package/cjs/{useSelectCommon-d39e90e2.js → useSelectCommon-8aaf62bd.js} +2 -2
- package/cjs/{useSelectCommon-d39e90e2.js.map → useSelectCommon-8aaf62bd.js.map} +1 -1
- package/es/AvatarVariants.styles.css +25 -25
- package/es/AvatarVariants.styles2.css +25 -25
- package/es/BaseNavigationListItem-f3bf5d85.js +47 -0
- package/es/BaseNavigationListItem-f3bf5d85.js.map +1 -0
- package/es/ConveyorBeltVariants.styles.css +6 -6
- package/es/ConveyorBeltVariants.styles2.css +6 -6
- package/es/FilePickerVariants.styles.css +2 -2
- package/es/FilePickerVariants.styles2.css +2 -2
- package/es/FormLayoutVariants.styles.css +14 -14
- package/es/FormLayoutVariants.styles2.css +14 -14
- package/es/{InputDatePicker-7f9852d0.js → InputDatePicker-aa02a34c.js} +2 -2
- package/es/{InputDatePicker-7f9852d0.js.map → InputDatePicker-aa02a34c.js.map} +1 -1
- package/es/LabelledLinkVariants.styles.css +3 -3
- package/es/LabelledLinkVariants.styles2.css +3 -3
- package/es/LinkVariants.styles.css +14 -14
- package/es/LinkVariants.styles2.css +14 -14
- package/es/{NavigationListItem-f44c1083.js → NavigationList-40cfa2f7.js} +13 -7
- package/es/NavigationList-40cfa2f7.js.map +1 -0
- package/es/NavigationListItem-1efd88f0.js +10 -0
- package/es/NavigationListItem-1efd88f0.js.map +1 -0
- package/es/{OverflowTabBarItem-f4360269.js → OverflowTabBarItem-d0a9dae6.js} +4 -3
- package/es/{OverflowTabBarItem-f4360269.js.map → OverflowTabBarItem-d0a9dae6.js.map} +1 -1
- package/es/PRIVATE_SelectCommon.js +1 -1
- package/es/ReadonlyTextFieldVariants.styles.css +14 -14
- package/es/ReadonlyTextFieldVariants.styles2.css +14 -14
- package/es/{RemovableNavigationListItem-4c86bec8.js → RemovableNavigationListItem-d55724ff.js} +3 -2
- package/es/{RemovableNavigationListItem-4c86bec8.js.map → RemovableNavigationListItem-d55724ff.js.map} +1 -1
- package/es/{ReorderableTabBar-84640a66.js → ReorderableTabBar-aae17355.js} +2 -2
- package/es/{ReorderableTabBar-84640a66.js.map → ReorderableTabBar-aae17355.js.map} +1 -1
- package/es/{TabBar-e39e8dbd.js → TabBar-935be8eb.js} +6 -1
- package/es/{TabBar-e39e8dbd.js.map → TabBar-935be8eb.js.map} +1 -1
- package/es/{TabBarMixed-3658d3d2.js → TabBarMixed-1742d71e.js} +6 -1
- package/es/{TabBarMixed-3658d3d2.js.map → TabBarMixed-1742d71e.js.map} +1 -1
- package/es/{TextArea-d97aac1f.js → TextArea-979496a0.js} +25 -8
- package/es/TextArea-979496a0.js.map +1 -0
- package/es/{TextAreaAutosize-68a4786d.js → TextAreaAutosize-b73aaa2f.js} +2 -2
- package/es/{TextAreaAutosize-68a4786d.js.map → TextAreaAutosize-b73aaa2f.js.map} +1 -1
- package/es/Theme-redwood/theme.css +345 -345
- package/es/Theme-stable/theme.css +974 -974
- package/es/UNSAFE_Avatar/themes/redwood/AvatarTheme.js +1 -1
- package/es/UNSAFE_Avatar/themes/redwood/AvatarVariants.css.js +1 -1
- package/es/UNSAFE_Avatar/themes/stable/AvatarTheme.js +1 -1
- package/es/UNSAFE_Avatar/themes/stable/AvatarVariants.css.js +1 -1
- package/es/UNSAFE_Avatar.js +1 -1
- package/es/UNSAFE_ConveyorBelt/themes/redwood/ConveyorBeltTheme.js +1 -1
- package/es/UNSAFE_ConveyorBelt/themes/redwood/ConveyorBeltVariants.css.js +1 -1
- package/es/UNSAFE_ConveyorBelt/themes/stable/ConveyorBeltTheme.js +1 -1
- package/es/UNSAFE_ConveyorBelt/themes/stable/ConveyorBeltVariants.css.js +1 -1
- package/es/UNSAFE_ConveyorBelt.js +1 -1
- package/es/UNSAFE_FilePicker/themes/redwood/FilePickerTheme.js +1 -1
- package/es/UNSAFE_FilePicker/themes/redwood/FilePickerVariants.css.js +1 -1
- package/es/UNSAFE_FilePicker/themes/stable/FilePickerTheme.js +1 -1
- package/es/UNSAFE_FilePicker/themes/stable/FilePickerVariants.css.js +1 -1
- package/es/UNSAFE_FilePicker.js +1 -1
- package/es/UNSAFE_FormLayout/themes/redwood/FormLayoutTheme.js +1 -1
- package/es/UNSAFE_FormLayout/themes/redwood/FormLayoutVariants.css.js +1 -1
- package/es/UNSAFE_FormLayout/themes/stable/FormLayoutTheme.js +1 -1
- package/es/UNSAFE_FormLayout/themes/stable/FormLayoutVariants.css.js +1 -1
- package/es/UNSAFE_FormLayout.js +1 -1
- package/es/UNSAFE_InputDateMask.js +1 -1
- package/es/UNSAFE_InputDatePicker.js +89 -89
- package/es/UNSAFE_InputPassword.js +1 -1
- package/es/UNSAFE_InputSensitiveText.js +1 -1
- package/es/UNSAFE_InputText.js +1 -1
- package/es/UNSAFE_LabelledLink/themes/redwood/LabelledLinkTheme.js +1 -1
- package/es/UNSAFE_LabelledLink/themes/redwood/LabelledLinkVariants.css.js +1 -1
- package/es/UNSAFE_LabelledLink/themes/stable/LabelledLinkTheme.js +1 -1
- package/es/UNSAFE_LabelledLink/themes/stable/LabelledLinkVariants.css.js +1 -1
- package/es/UNSAFE_LabelledLink.js +3 -3
- package/es/UNSAFE_Link/themes/redwood/LinkTheme.js +1 -1
- package/es/UNSAFE_Link/themes/redwood/LinkVariants.css.js +1 -1
- package/es/UNSAFE_Link/themes/stable/LinkTheme.js +1 -1
- package/es/UNSAFE_Link/themes/stable/LinkVariants.css.js +1 -1
- package/es/UNSAFE_Link.js +1 -1
- package/es/UNSAFE_NavigationList.js +16 -14
- package/es/UNSAFE_NavigationList.js.map +1 -1
- package/es/UNSAFE_NavigationListCommon.js +54 -53
- package/es/UNSAFE_NavigationListCommon.js.map +1 -1
- package/es/UNSAFE_NumberInputText.js +1 -1
- package/es/UNSAFE_OverflowTabBar.js +23 -21
- package/es/UNSAFE_OverflowTabBar.js.map +1 -1
- package/es/UNSAFE_ReorderableTabBar.js +21 -7
- package/es/UNSAFE_ReorderableTabBar.js.map +1 -1
- package/es/UNSAFE_SelectMultiple.js +2 -2
- package/es/UNSAFE_SelectSingle.js +2 -2
- package/es/UNSAFE_TabBar.js +24 -22
- package/es/UNSAFE_TabBar.js.map +1 -1
- package/es/UNSAFE_TabBarCommon.js +20 -18
- package/es/UNSAFE_TabBarCommon.js.map +1 -1
- package/es/UNSAFE_TabBarMixed.js +24 -22
- package/es/UNSAFE_TabBarMixed.js.map +1 -1
- package/es/UNSAFE_TextArea.js +3 -4
- package/es/UNSAFE_TextArea.js.map +1 -1
- package/es/UNSAFE_TextAreaAutosize.js +3 -3
- package/es/UNSAFE_TextField/themes/redwood/ReadonlyTextFieldTheme.js +1 -1
- package/es/UNSAFE_TextField/themes/redwood/ReadonlyTextFieldVariants.css.js +1 -1
- package/es/UNSAFE_TextField/themes/stable/ReadonlyTextFieldTheme.js +1 -1
- package/es/UNSAFE_TextField/themes/stable/ReadonlyTextFieldVariants.css.js +1 -1
- package/es/UNSAFE_TextField.js +1 -1
- package/es/{BaseNavigationListItem-3a377d46.js → useNavigationListItem-5f7cd66b.js} +3 -41
- package/es/useNavigationListItem-5f7cd66b.js.map +1 -0
- package/package.json +2 -2
- package/amd/CheckboxSetContext-2e486ea8.js +0 -2
- package/amd/CheckboxSetContext-2e486ea8.js.map +0 -1
- package/amd/InputDatePicker-0012b304.js +0 -2
- package/amd/MaxLengthCounter-caafceef.js +0 -2
- package/amd/MaxLengthCounter-caafceef.js.map +0 -1
- package/amd/NavigationListItem-c96ac144.js +0 -2
- package/amd/TextArea-44c90bc4.js +0 -2
- package/amd/TextArea-44c90bc4.js.map +0 -1
- package/amd/TextAreaAutosize-0a023972.js +0 -2
- package/cjs/MaxLengthCounter-a5370f66.js +0 -27
- package/cjs/MaxLengthCounter-a5370f66.js.map +0 -1
- package/cjs/TextArea-b2646d51.js.map +0 -1
- package/es/BaseNavigationListItem-3a377d46.js.map +0 -1
- package/es/MaxLengthCounter-cead2dac.js +0 -25
- package/es/MaxLengthCounter-cead2dac.js.map +0 -1
- package/es/NavigationListItem-f44c1083.js.map +0 -1
- package/es/TextArea-d97aac1f.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
define(['exports', 'preact/jsx-runtime', 'preact', 'preact/hooks', 'preact/compat', './FormContext-5130e198', './useFormContext-30acdd33', './FormFieldContext-3c44aaaa', './useFormFieldContextProps-4e36b4c3', 'css!./CheckboxSetStyles.styles.css', './useId-c9578d26', './CheckboxRadioField-da88bd6f'], (function(e,s,t,i,o,a,l,r,d,n,c,u){"use strict";const x=t.createContext({});var b="CheckboxSetStyles_styles_ul__68p6630";const h=o.forwardRef((({"aria-describedby":e,assistiveText:o,columnSpan:a,direction:n="column",helpSourceLink:h,helpSourceText:m,isDisabled:C,isReadonly:p,isRequired:S=!1,label:y,labelEdge:F,labelStartWidth:k,messages:v,onCommit:R,userAssistanceDensity:f,value:D,children:g,testId:j},I)=>{const A=void 0!==D&&D.size>0,P=c.useId(),{isDisabled:T,isReadonly:_,labelEdge:E,labelStartWidth:V,userAssistanceDensity:W}=l.useFormContext(),q=C??T,L=p??_,w=F??E,z=k??V,B=f??W,M=d.useFormFieldContextProps({hasValue:A,isDisabled:q,isReadonly:L}),N=i.useMemo((()=>({name:P,value:D,onCommit:R})),[P,R,D]),G=t.toChildArray(g).filter(Boolean).map((e=>s.jsx("li",{children:e})));return s.jsx(r.FormFieldContext.Provider,{value:M,children:s.jsx(u.CheckboxRadioField,{"aria-describedby":e,assistiveText:o,baseId:P,columnSpan:a,direction:n,helpSourceLink:h,helpSourceText:m,isDisabled:q,isReadonly:L,isRequired:S,label:y,labelEdge:w,labelStartWidth:z,parentComponentVariant:"checkboxSet",messages:v,userAssistanceDensity:B,hasValue:A,role:"group",testId:j,ref:I,children:s.jsx(x.Provider,{value:N,children:s.jsx("ul",{className:b,children:G})})})})}));e.CheckboxSet=h,e.CheckboxSetContext=x,e.useCheckboxSetContext=()=>i.useContext(x)}));
|
|
2
|
+
//# sourceMappingURL=CheckboxSet-9c883a32.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxSet-9c883a32.js","sources":["../../src/UNSAFE_CheckboxSet/CheckboxSetContext.ts","../../src/UNSAFE_CheckboxSet/CheckboxSet.tsx"],"sourcesContent":["import { createContext } from 'preact';\nimport { useContext } from 'preact/hooks';\n\nimport { ValueUpdateDetail } from '../utils/UNSAFE_valueUpdateDetail';\n\ntype CheckboxSetContextValue = {\n name: string;\n value?: Set<string | number>;\n onCommit?: (detail: ValueUpdateDetail<Set<string | number>>) => void;\n};\n\nconst CheckboxSetContext = createContext<CheckboxSetContextValue>({} as CheckboxSetContextValue);\nconst useCheckboxSetContext = () => useContext(CheckboxSetContext);\n\nexport { CheckboxSetContext, useCheckboxSetContext };\n","import { ComponentChildren, ComponentProps, Ref, toChildArray } from 'preact';\nimport { useMemo } from 'preact/hooks';\nimport { forwardRef } from 'preact/compat';\n\nimport { CheckboxSetContext } from './CheckboxSetContext';\nimport { CheckboxRadioField } from '#PRIVATE_CheckboxRadioField';\nimport { InlineUserAssistance, UserAssistanceDensityType } from '#UNSAFE_UserAssistance';\nimport { useFormContext } from '#hooks/UNSAFE_useFormContext';\nimport { FormFieldContext } from '#hooks/UNSAFE_useFormFieldContext';\nimport { useFormFieldContextProps } from '#hooks/UNSAFE_useFormFieldContextProps';\nimport { FlexboxProps } from '#utils/UNSAFE_interpolations/flexbox';\nimport { Size } from '#utils/UNSAFE_size';\nimport { ValueUpdateDetail } from '#utils/UNSAFE_valueUpdateDetail';\nimport { FocusableHandle } from '#hooks/UNSAFE_useFocusableTextField';\nimport { styles } from './CheckboxSetStyles.css';\nimport { AriaAttributesSignalExcluded } from '#utils/UNSAFE_attributeUtils';\nimport { useId } from '#hooks/UNSAFE_useId';\nimport { LayoutColumnSpan } from '#utils/UNSAFE_styles/Layout';\nimport { TestIdProps } from '#hooks/UNSAFE_useTestId';\n\ntype InlineUserAssistanceProps = ComponentProps<typeof InlineUserAssistance>;\n\ntype Props = {\n /**\n * The ID of an element (or space separated IDs of multiple elements) that\n * describes the input.\n */\n 'aria-describedby'?: AriaAttributesSignalExcluded['aria-describedby'];\n /**\n * Text to provide guidance to help the user understand what data to enter.\n */\n assistiveText?: InlineUserAssistanceProps['assistiveText'];\n /**\n * set of CheckboxItems\n */\n children: ComponentChildren;\n /**\n * Specifies how many columns to span in a FormLayout with direction === 'row'\n */\n columnSpan?: LayoutColumnSpan;\n /**\n * layout direction of the children elements\n */\n direction?: FlexboxProps['direction'];\n /**\n * Help source URL associated with the component.\n */\n helpSourceLink?: InlineUserAssistanceProps['helpSourceLink'];\n /**\n * Custom text to be rendered for the <code>helpSourceLink</code>.\n */\n helpSourceText?: InlineUserAssistanceProps['helpSourceText'];\n /**\n * Specifies whether the checkbox set requires a selection to be made.\n */\n isRequired?: boolean;\n /**\n * Specifies if the checkbox set is read-only.\n */\n isReadonly?: boolean;\n /**\n * Specifies if the checkbox set is disabled.\n */\n isDisabled?: boolean;\n /**\n * Label text for the group of checkbox items.\n */\n label: string;\n /**\n * Specifies where the label is positioned relative to the field.\n */\n labelEdge?: 'none' | 'top' | 'start' | 'inside';\n /**\n * Specifies the width of the label when <code>labelEdge</code> is <code>\"start\"</code>.\n */\n labelStartWidth?: Size;\n /**\n * Messages to show on screen that are associated with the component.\n */\n messages?: InlineUserAssistanceProps['messages'];\n /**\n * Callback invoked each time the user changes selected option.\n */\n onCommit: (detail: ValueUpdateDetail<Set<string | number>>) => void;\n /**\n * Specifies the density of the user assistance presentation. It can be set to:\n * <ul>\n * <li><code>'reflow'</code>: Show inline. Layout will reflow when text is displayed.</li>\n * <li><code>'efficient'</code>: Show inline and reserve space to prevent layout reflow when user\n * assistance text is displayed.</li>\n * <li><code>'compact'</code>: Show inline and reserve space to prevent layout reflow when user\n * assistance text is displayed.</li>\n * </ul>\n */\n userAssistanceDensity?: UserAssistanceDensityType;\n /**\n * Value of the selected checkbox option.\n */\n value?: Set<string | number>;\n} & TestIdProps;\n/**\n * A CheckboxSet set allows the user to select one or more options from a set.\n */\nexport const CheckboxSet = forwardRef(\n (\n {\n 'aria-describedby': ariaDescribedBy,\n assistiveText,\n columnSpan,\n direction = 'column',\n helpSourceLink,\n helpSourceText,\n isDisabled: propIsDisabled,\n isReadonly: propIsReadonly,\n isRequired = false,\n label,\n labelEdge: propLabelEdge,\n labelStartWidth: propLabelStartWidth,\n messages,\n onCommit,\n userAssistanceDensity: propUserAssistanceDensity,\n value,\n children,\n testId\n }: Props,\n ref?: Ref<FocusableHandle>\n ) => {\n const hasValue = value !== undefined ? value.size > 0 : false;\n const baseId = useId();\n\n const {\n isDisabled: isFormDisabled,\n isReadonly: isFormReadonly,\n labelEdge: formLabelEdge,\n labelStartWidth: formLabelStartWidth,\n userAssistanceDensity: formUserAssistanceDensity\n } = useFormContext();\n\n // default to FormContext values if component properties are not specified\n const isDisabled = propIsDisabled ?? isFormDisabled;\n const isReadonly = propIsReadonly ?? isFormReadonly;\n const labelEdge = propLabelEdge ?? formLabelEdge;\n const labelStartWidth = propLabelStartWidth ?? formLabelStartWidth;\n const userAssistanceDensity = propUserAssistanceDensity ?? formUserAssistanceDensity;\n\n const formFieldContext = useFormFieldContextProps({\n hasValue,\n isDisabled,\n isReadonly\n });\n\n const checkboxSetContext = useMemo(\n () => ({\n name: baseId,\n value,\n onCommit\n }),\n [baseId, onCommit, value]\n );\n\n // wrap each CheckboxItem in an <li> tag and the entire set with <ul>\n const childrenArray = toChildArray(children).filter(Boolean);\n const wrappedChildren = childrenArray.map((item) => <li>{item}</li>);\n\n return (\n <FormFieldContext.Provider value={formFieldContext}>\n <CheckboxRadioField\n aria-describedby={ariaDescribedBy}\n assistiveText={assistiveText}\n baseId={baseId}\n columnSpan={columnSpan}\n direction={direction}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n isDisabled={isDisabled}\n isReadonly={isReadonly}\n isRequired={isRequired}\n label={label}\n labelEdge={labelEdge}\n labelStartWidth={labelStartWidth}\n parentComponentVariant=\"checkboxSet\"\n messages={messages}\n userAssistanceDensity={userAssistanceDensity}\n hasValue={hasValue}\n role=\"group\"\n testId={testId}\n ref={ref}>\n <CheckboxSetContext.Provider value={checkboxSetContext}>\n <ul className={styles.ul}>{wrappedChildren}</ul>\n </CheckboxSetContext.Provider>\n </CheckboxRadioField>\n </FormFieldContext.Provider>\n );\n }\n);\n"],"names":["CheckboxSetContext","createContext","CheckboxSet","forwardRef","ariaDescribedBy","assistiveText","columnSpan","direction","helpSourceLink","helpSourceText","isDisabled","propIsDisabled","isReadonly","propIsReadonly","isRequired","label","labelEdge","propLabelEdge","labelStartWidth","propLabelStartWidth","messages","onCommit","userAssistanceDensity","propUserAssistanceDensity","value","children","testId","ref","hasValue","undefined","size","baseId","useId","isFormDisabled","isFormReadonly","formLabelEdge","formLabelStartWidth","formUserAssistanceDensity","useFormContext","formFieldContext","useFormFieldContextProps","checkboxSetContext","useMemo","name","wrappedChildren","toChildArray","filter","Boolean","map","item","_jsx","FormFieldContext","Provider","CheckboxRadioField","parentComponentVariant","role","jsx","className","styles","useContext"],"mappings":"6UAWA,MAAMA,EAAqBC,EAAaA,cAA0B,iDC4F3D,MAAMC,EAAcC,EAAUA,YACnC,EAEI,mBAAoBC,EACpBC,gBACAC,aACAC,YAAY,SACZC,iBACAC,iBACAC,WAAYC,EACZC,WAAYC,EACZC,cAAa,EACbC,QACAC,UAAWC,EACXC,gBAAiBC,EACjBC,WACAC,WACAC,sBAAuBC,EACvBC,QACAC,WACAC,UAEFC,KAEA,MAAMC,OAAqBC,IAAVL,GAAsBA,EAAMM,KAAO,EAC9CC,EAASC,EAAAA,SAGbtB,WAAYuB,EACZrB,WAAYsB,EACZlB,UAAWmB,EACXjB,gBAAiBkB,EACjBd,sBAAuBe,GACrBC,EAAcA,iBAGZ5B,EAAaC,GAAkBsB,EAC/BrB,EAAaC,GAAkBqB,EAC/BlB,EAAYC,GAAiBkB,EAC7BjB,EAAkBC,GAAuBiB,EACzCd,EAAwBC,GAA6Bc,EAErDE,EAAmBC,EAAAA,yBAAyB,CAChDZ,WACAlB,aACAE,eAGI6B,EAAqBC,EAAAA,SACzB,KAAO,CACLC,KAAMZ,EACNP,QACAH,cAEF,CAACU,EAAQV,EAAUG,IAKfoB,EADgBC,EAAAA,aAAapB,GAAUqB,OAAOC,SACdC,KAAKC,GAASC,MAAA,KAAA,CAAAzB,SAAKwB,MAEzD,OACEC,EAAAA,IAACC,EAAAA,iBAAiBC,UAAS5B,MAAOe,EAAgBd,SAChDyB,EAAAA,IAACG,EAAAA,uCACmBjD,EAClBC,cAAeA,EACf0B,OAAQA,EACRzB,WAAYA,EACZC,UAAWA,EACXC,eAAgBA,EAChBC,eAAgBA,EAChBC,WAAYA,EACZE,WAAYA,EACZE,WAAYA,EACZC,MAAOA,EACPC,UAAWA,EACXE,gBAAiBA,EACjBoC,uBAAuB,cACvBlC,SAAUA,EACVE,sBAAuBA,EACvBM,SAAUA,EACV2B,KAAK,QACL7B,OAAQA,EACRC,IAAKA,EACLF,SAAAyB,EAAAM,IAACxD,EAAmBoD,SAAQ,CAAC5B,MAAOiB,EAAkBhB,SACpDyB,EAAAA,UAAIO,UAAWC,EAASjC,SAAGmB,SAIjC,mEDpLwB,IAAMe,EAAAA,WAAW3D"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
define(['exports', 'preact/jsx-runtime', 'preact/compat', 'preact/hooks', './Calendar-d1c38937', './HiddenAccessible-037ef42d', './IconButton-1b328b69', './clientHints-030d25aa', './FormFieldContext-3c44aaaa', './logger-0f873e29', './TabbableModeContext-a9c97640', './useTranslationBundle-6ef0dab6', 'css!./UserAssistanceStyles.styles.css', 'module', './UNSAFE_UserAssistance/themes/redwood/UserAssistanceVariants.css', './InlineUserAssistance-f4d1fa1b', './Flex-1f27b601', 'css!./MessageBannerStyles.styles.css', 'module', './UNSAFE_MessageBanner/themes/redwood/MessageBannerVariants.css', 'preact', './useTooltipControlled-abf886f2', 'css!./IconStyle.styles.css', 'css!./MessageStyles.styles.css', './MessageFormattingUtils-2e19d8de', './LayerHost-eab40731', './TransitionGroup-3b9d81b6', './MessagesContext-602a69a2', 'css!./HiddenAccessibleStyles.styles.css', 'css!./ComponentMessageStyles.styles.css', 'module', './UNSAFE_ComponentMessage/themes/redwood/ComponentMessageVariants.css', './Popup-249d77c3', './UNSAFE_Separator/themes/SeparatorStyles.css', 'css!./LabelStyles.styles.css', 'module', './UNSAFE_Label/themes/redwood/LabelVariants.css', './InputGroupContext-372087af', 'module', './UNSAFE_Popup/themes/redwood/PopupVariants.css', './UNSAFE_InputDatePicker/themes/InputDatePickerDropdownStyles.css', './Sheet-6447f399', './UNSAFE_DatePicker/themes/DatePickerContract.css', './DatePicker-3996fc76', './SectionedContent-655a773a', './stringUtils-0ae982c2', './FormContext-5130e198', './useFormContext-30acdd33', './useId-c9578d26', './getFormatParse-b7ff0219', './maskUtils-86dd685a', './calendarDateUtils-1f56aaf5', './InputDateMask-b7a27faa'], (function(e,t,s,a,n,r,o,i,l,d,c,u,m,p,h,f,y,b,C,D,S,x,A,k,v,g,F,V,I,T,P,R,M,U,w,j,_,B,H,E,N,L,O,W,Y,Z,z,G,q,J,K,Q,X){"use strict";const $=({anchorRef:e,assistiveText:s,dayFormatter:n,daysOutsideMonth:r,helpSourceLink:o,helpSourceText:i,isDisabled:d,isOpen:c,isReadonly:m,label:p,onClose:h,onCommit:y,max:b,messages:C,min:D,monthAndYearPicker:S,testId:x,todayButton:A,todayTimeZone:k,userAssistanceDensity:v,value:g})=>{const[F,V]=a.useState(!1),[I,T]=a.useState(c),P=a.useCallback((e=>{V(e.placement.startsWith("top"))}),[]);I!==c&&(T(c),c||V(!1));const R=ee(),{datePicker_label:M}=u.useTranslationBundle("@oracle/oraclejet-preact"),U=M(),w=t.jsx(W.DatePicker,{dayFormatter:n,daysOutsideMonth:r,onCommit:y,max:b,min:D,maxWidth:R?"100%":void 0,width:R?"100%":O.datePickerPropVars.maxWidth,monthAndYearPicker:S,testId:x,todayTimeZone:k,todayButton:A,value:g}),j=!c||F&&!R||d||m||!(s||o||C&&C.length>0)||"efficient"!==v&&"reflow"!==v?void 0:t.jsx(l.FormFieldContext.Provider,{value:{isFocused:!0},children:t.jsx("div",{class:N.userAssistanceStyles,children:t.jsx(f.InlineUserAssistance,{assistiveText:s,fieldLabel:p,helpSourceLink:o,helpSourceText:i,messages:C,userAssistanceDensity:v})})}),_=x?x+(R?"_sheet":"_dropdown"):void 0,B=t.jsx("div",{class:N.dropdownStyles,children:t.jsx(Y.SectionedContent,{"aria-label":U,footer:j,hasFocusTrap:!0,main:w,role:"dialog",testId:_})});return R?t.jsx(L.Sheet,{initialFocus:"firstFocusable",isOpen:c,onClose:h,children:t.jsx(Y.SectionedContent,{"aria-label":U,footer:j,hasFocusTrap:!0,main:w,role:"dialog",testId:_})}):t.jsx(Y.StickyPositioningDropdown,{anchorRef:e,initialFocus:"firstFocusable",isOpen:c,onClose:h,onPosition:P,sizeOptions:{isMaxWidthAdjusted:!1,isMaxHeightAdjusted:!0},children:B})},ee=()=>"phone"===i.getClientHints().deviceType,te=e=>e&&Q.isCompleteCalendarDate(e)?e:void 0,se=(e,t)=>{switch(t.type){case"dateChanged":return{...e,dateValue:t.data,completeDateValue:te(t.data)};case"dateSelected":return{...e,dateValue:t.data,completeDateValue:t.data};case"reset":return{completeDateValue:te(t.data),dateValue:t.data};default:return e}},ae=({onCommit:e,onInput:t,value:s})=>{const[n,r]=a.useState(!1),o=a.useRef(null),i=a.useRef(null),l=a.useRef(!1),d=a.useRef(),c=a.useRef(!1),u=a.useRef(),m=a.useRef(s),p=a.useRef(s),h=a.useRef(s),f=a.useRef(!1),{state:y,dispatch:b}=(({value:e})=>{const[t,s]=a.useReducer(se,{completeDateValue:te(e),dateValue:e});return{state:t,dispatch:s}})({value:s});K.calendarDatesAreDifferent(h.current,s)&&(h.current=s,K.calendarDatesAreDifferent(s,y.dateValue)&&(b({type:"reset",data:s}),p.current=s,m.current=s)),a.useEffect((()=>{K.calendarDatesAreDifferent(y.dateValue,p.current)&&(t({previousValue:p.current,value:y.dateValue}),p.current=y.dateValue),f.current&&K.calendarDatesAreDifferent(y.dateValue,m.current)&&(e?.({previousValue:m.current,value:y.dateValue}),m.current=y.dateValue,f.current=!1)}),[e,t,y.dateValue]);const C=a.useCallback((e=>{b({type:"dateChanged",data:e.value})}),[b]),D=a.useCallback((()=>{K.calendarDatesAreDifferent(m.current,y.dateValue)&&(e?.({value:y.dateValue,previousValue:m.current}),m.current=y.dateValue)}),[e,y.dateValue]),S=a.useCallback((()=>{l.current||c.current||r((e=>!e)),l.current=!1,c.current=!1}),[]),x=a.useCallback((e=>{"outsideMousedown"===e.reason?(l.current=!0,clearTimeout(d.current),d.current=setTimeout((()=>{l.current=!1}),200)):"dismissed"!==e.reason&&"keyboardDismissed"!==e.reason||o.current?.focus(),r(!1)}),[]);return{calendarIconActionHandler:S,datePickerCommitHandler:a.useCallback((e=>{o.current?.focus(),c.current=!0,clearTimeout(u.current),u.current=setTimeout((()=>{c.current=!1}),500),f.current=!0,b({type:"dateSelected",data:e.value}),r(!1)}),[b]),dropdownCloseHandler:x,completeDateValue:y.completeDateValue,dateValue:y.dateValue,iconRef:o,isOpen:n,maskCommitHandler:D,maskInputHandler:C,maskRef:i}},ne=s.forwardRef((({"aria-describedby":e,assistiveText:s,dayFormatter:i,daysOutsideMonth:l,helpSourceLink:d,helpSourceText:c,isDisabled:m,isReadonly:p,label:h,max:f,messages:y,min:b,monthAndYearPicker:C,todayTimeZone:D,todayButton:S,value:x,onCommit:A,onInput:k,testId:v,userAssistanceDensity:g,...F},V)=>{const{calendarIconActionHandler:I,datePickerCommitHandler:T,completeDateValue:P,dateValue:R,dropdownCloseHandler:M,iconRef:U,isOpen:w,maskCommitHandler:j,maskInputHandler:_,maskRef:B}=ae({onCommit:A,onInput:k,value:x}),H=a.useRef(null),{inputDatePicker_selectDate:E,inputDatePicker_instruction:N}=u.useTranslationBundle("@oracle/oraclejet-preact"),L=E(),{userAssistanceDensity:O}=G.useFormContext(),W=g??O;a.useImperativeHandle(V,(()=>({focus:()=>{B.current?.focus()},blur:()=>{B.current?.blur()}})));const Y=q.useId(),z=N(),J=m||p?void 0:t.jsx(r.HiddenAccessible,{id:Y,isHidden:!0,children:z}),K=m||p?e:Z.merge([e,Y]),Q=t.jsx(o.IconButton,{"aria-haspopup":"dialog","aria-label":L,isDisabled:m,ref:U,size:"sm",testId:v?v+"_calendarIcon":void 0,variant:"ghost",onAction:I,children:t.jsx(n.SvgCalendar,{})}),ee=w;return t.jsxs(t.Fragment,{children:[t.jsx(X.InputDateMaskContext.Provider,{value:{isDropdownOpen:w,isInputDatePickerParent:!0},children:t.jsx(X.InputDateMask,{"aria-describedby":K,assistiveText:s,endContent:Q,helpSourceLink:d,helpSourceText:c,isDisabled:m,isReadonly:p,label:h,onCommit:j,onInput:_,mainFieldRef:H,messages:y,testId:v,ref:B,userAssistanceDensity:g,value:R,...F})}),J,ee&&t.jsx($,{anchorRef:H,assistiveText:s,dayFormatter:i,daysOutsideMonth:l,helpSourceLink:d,helpSourceText:c,isDisabled:m,isReadonly:p,isOpen:w,label:h,onClose:M,onCommit:T,max:f,messages:y,min:b,monthAndYearPicker:C,testId:v?v+"_datePicker":void 0,todayTimeZone:D,todayButton:S,userAssistanceDensity:W,value:P})]})}));e.InputDatePicker=ne}));
|
|
2
|
+
//# sourceMappingURL=InputDatePicker-da5d8728.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputDatePicker-0012b304.js","sources":["../../src/UNSAFE_InputDatePicker/InputDatePickerDropdown.tsx","../../src/UNSAFE_InputDatePicker/useInputDatePickerState.ts","../../src/UNSAFE_InputDatePicker/useInputDatePicker.ts","../../src/UNSAFE_InputDatePicker/InputDatePicker.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { ComponentProps } from 'preact';\nimport { useCallback, useState } from 'preact/hooks';\nimport { BundleType } from '../resources/nls/bundle';\nimport { DatePicker } from '#UNSAFE_DatePicker';\nimport { type CloseDetail as DropdownCloseDetail } from '#UNSAFE_Dropdown';\nimport { getClientHints } from '#utils/PRIVATE_clientHints';\nimport { FormFieldContext } from '../hooks/UNSAFE_useFormFieldContext';\nimport { InlineUserAssistance } from '../UNSAFE_UserAssistance';\nimport { InputDatePicker } from './InputDatePicker';\nimport { dropdownStyles, userAssistanceStyles } from './themes/InputDatePickerDropdownStyles.css';\nimport { PositionData } from '../UNSAFE_Floating';\nimport { StickyPositioningDropdown } from '#PRIVATE_FormControls';\nimport { SectionedContent } from '#PRIVATE_FormControls';\nimport { type CloseDetail as SheetCloseDetail, Sheet } from '#UNSAFE_Sheet';\nimport type { TestIdProps } from '#hooks/UNSAFE_useTestId';\nimport { useTranslationBundle } from '#hooks/UNSAFE_useTranslationBundle';\nimport { SizeOptions } from '#UNSAFE_Floating/Floating';\nimport { datePickerPropVars } from '#UNSAFE_DatePicker/themes/DatePickerContract.css';\n\ntype StickyPositioningDropdownProps = ComponentProps<typeof StickyPositioningDropdown>;\ntype InputDatePickerProps = ComponentProps<typeof InputDatePicker>;\ntype PickedPropsFromInputDatePicker = Pick<\n InputDatePickerProps,\n | 'assistiveText'\n | 'dayFormatter'\n | 'daysOutsideMonth'\n | 'helpSourceLink'\n | 'helpSourceText'\n | 'isDisabled'\n | 'isReadonly'\n | 'label'\n | 'messages'\n | 'min'\n | 'max'\n | 'monthAndYearPicker'\n | 'todayButton'\n | 'todayTimeZone'\n | 'userAssistanceDensity'\n | 'value'\n>;\ntype DatePickerProps = ComponentProps<typeof DatePicker>;\ntype PickedPropsFromDatePicker = Pick<DatePickerProps, 'value' | 'onCommit'>;\ntype PickedPropsFromDropdown = Omit<StickyPositioningDropdownProps, 'onClose'>;\ntype CloseDetail = SheetCloseDetail | DropdownCloseDetail;\n\ntype Props = PickedPropsFromDatePicker &\n PickedPropsFromInputDatePicker &\n PickedPropsFromDropdown &\n TestIdProps & {\n /**\n * Called when the dropdown or sheet is supposed to be closed.\n */\n onClose?: (detail: CloseDetail) => void;\n };\n\n/**\n * Component that renders DatePicker either inside a dropdown or sheet; at small screen\n * widths, it renders inside a sheet. Additionally, when a dropdown is being shown beneath\n * the component, we also show any user assistance text or messages below the picker\n * because otherwise that information would be obscured from view. When a sheet is being\n * shown, it will always display UA and messages at the bottom of the sheet.\n */\nconst InputDatePickerDropdown = ({\n anchorRef,\n assistiveText,\n dayFormatter,\n daysOutsideMonth,\n helpSourceLink,\n helpSourceText,\n isDisabled,\n isOpen,\n isReadonly,\n label,\n onClose,\n onCommit,\n max,\n messages,\n min,\n monthAndYearPicker,\n testId,\n todayButton,\n todayTimeZone,\n userAssistanceDensity,\n value\n}: Props) => {\n // If the dropdown opens above the component, we don't want to show UA or messages.\n const [isDropdownAbove, setDropdownAbove] = useState(false);\n const [prevIsOpen, setPrevIsOpen] = useState(isOpen);\n const handleDropdownPosition = useCallback<\n NonNullable<StickyPositioningDropdownProps['onPosition']>\n >((data: PositionData) => {\n setDropdownAbove(data.placement.startsWith('top'));\n }, []);\n // Reset the flag when the dropdown is closed.\n if (prevIsOpen !== isOpen) {\n setPrevIsOpen(isOpen);\n if (!isOpen) {\n setDropdownAbove(false);\n }\n }\n\n const sizeOptions: SizeOptions = {\n isMaxWidthAdjusted: false,\n isMaxHeightAdjusted: true\n };\n\n // On mobile phones, the dropdown becomes a sheet.\n const shouldShowSheet = isPhone();\n\n const { datePicker_label } = useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n const datePickerAriaLabel = datePicker_label();\n\n const datePickerMainContent = (\n <DatePicker\n dayFormatter={dayFormatter}\n daysOutsideMonth={daysOutsideMonth}\n onCommit={onCommit}\n max={max}\n min={min}\n // for sheet, we want the width to grow to the width of the sheet, otherwise it will use the theme default.\n maxWidth={shouldShowSheet ? '100%' : undefined}\n // for dropdown, we want a fixed width, so set width to the same var used for default maxWidth\n width={!shouldShowSheet ? datePickerPropVars.maxWidth : '100%'}\n monthAndYearPicker={monthAndYearPicker}\n testId={testId}\n todayTimeZone={todayTimeZone}\n todayButton={todayButton}\n value={value}\n />\n );\n\n const inlineUserAssistanceFooter =\n isOpen &&\n (!isDropdownAbove || shouldShowSheet) &&\n !isDisabled &&\n !isReadonly &&\n (assistiveText || helpSourceLink || (messages && messages.length > 0)) &&\n (userAssistanceDensity === 'efficient' || userAssistanceDensity === 'reflow') ? (\n <FormFieldContext.Provider value={{ isFocused: true }}>\n <div class={userAssistanceStyles}>\n <InlineUserAssistance\n assistiveText={assistiveText}\n fieldLabel={label}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n messages={messages}\n userAssistanceDensity={userAssistanceDensity}\n />\n </div>\n </FormFieldContext.Provider>\n ) : undefined;\n\n const contentTestId = testId ? testId + (shouldShowSheet ? '_sheet' : '_dropdown') : undefined;\n\n // The same content is displayed either in a dropdown or sheet: date picker and inline UA.\n // Add styling to the dropdown to enforce a fixed width.\n const dropdownContent = (\n <div class={dropdownStyles}>\n <SectionedContent\n aria-label={datePickerAriaLabel}\n footer={inlineUserAssistanceFooter}\n hasFocusTrap={true}\n main={datePickerMainContent}\n role=\"dialog\"\n testId={contentTestId}\n />\n </div>\n );\n\n const dropdown = shouldShowSheet ? (\n <Sheet initialFocus=\"firstFocusable\" isOpen={isOpen} onClose={onClose}>\n <SectionedContent\n aria-label={datePickerAriaLabel}\n footer={inlineUserAssistanceFooter}\n hasFocusTrap={true}\n main={datePickerMainContent}\n role=\"dialog\"\n testId={contentTestId}\n />\n </Sheet>\n ) : (\n <StickyPositioningDropdown\n anchorRef={anchorRef}\n initialFocus=\"firstFocusable\"\n isOpen={isOpen}\n onClose={onClose}\n onPosition={handleDropdownPosition}\n sizeOptions={sizeOptions}>\n {dropdownContent}\n </StickyPositioningDropdown>\n );\n\n return dropdown;\n};\n\nconst isPhone = () => {\n return getClientHints().deviceType === 'phone';\n};\n\nexport { InputDatePickerDropdown, type CloseDetail };\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { useReducer } from 'preact/hooks';\nimport type { CalendarDate, CalendarDateRequired } from '#utils/UNSAFE_calendarDateUtils';\nimport { isCompleteCalendarDate } from '#utils/UNSAFE_calendarDateUtils';\n\ntype InputDatePickerState = {\n /**\n * If dateValue is a complete date, then completeDateValue is the same as dateValue\n * otherwise is is undefined. We need to maintain separate states because\n * InputDateMask uses CalendarDate, but DatePicker uses CalendarDateRequired.\n * If the user types a partial date then opens the picker, we treat that as\n * no selection. The picker opens to the current month showing today.\n */\n completeDateValue?: CalendarDateRequired;\n\n /**\n * Represents the current date value of the component. The user either selected\n * the date in the picker, or typed it into the date field.\n */\n dateValue?: CalendarDate;\n};\n\ntype DateChangedAction = { type: 'dateChanged'; data?: CalendarDate };\ntype DateResetAction = { type: 'reset'; data?: CalendarDate };\ntype DateSelectedAction = { type: 'dateSelected'; data?: CalendarDateRequired };\ntype InputDatePickerReducerAction = DateChangedAction | DateResetAction | DateSelectedAction;\n\n// If dateVal is a complete date, return it as a CalendarDateRequired\n// otherwise return undefined.\nconst convertToCalendarDateRequired = (dateVal?: CalendarDate) => {\n return !dateVal || !isCompleteCalendarDate(dateVal)\n ? undefined\n : (dateVal as CalendarDateRequired);\n};\n\n// Use a reducer function to manage InputDatePickerState.\nconst inputDatePickerReducer = (\n state: InputDatePickerState,\n action: InputDatePickerReducerAction\n): InputDatePickerState => {\n switch (action.type) {\n case 'dateChanged': {\n return {\n ...state,\n dateValue: action.data,\n completeDateValue: convertToCalendarDateRequired(action.data)\n };\n }\n case 'dateSelected': {\n return { ...state, dateValue: action.data, completeDateValue: action.data };\n }\n case 'reset': {\n return {\n completeDateValue: convertToCalendarDateRequired(action.data),\n dateValue: action.data\n };\n }\n default:\n return state;\n }\n};\n\ntype Props = {\n /**\n * The value of the InputDatePicker, or undefined.\n */\n value?: CalendarDate;\n};\n\n/**\n * useInputDatePickerState calls useReducer to determine the initial state. Any changes to that state\n * are managed by dispatching actions to the reducer function.\n */\nconst useInputDatePickerState = ({ value }: Props) => {\n const [state, dispatch] = useReducer(inputDatePickerReducer, {\n completeDateValue: convertToCalendarDateRequired(value),\n dateValue: value\n });\n\n return { state, dispatch };\n};\n\nexport { useInputDatePickerState };\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { ComponentProps, RefObject } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport type { CalendarDate, CalendarDateRequired } from '#utils/UNSAFE_calendarDateUtils';\nimport { calendarDatesAreDifferent } from '#utils/PRIVATE_dayUtils';\nimport { DatePicker } from '#UNSAFE_DatePicker';\nimport { CloseDetail, InputDatePickerDropdown } from './InputDatePickerDropdown';\nimport { IconButton } from '#UNSAFE_IconButton';\nimport { InputDateMask } from '#UNSAFE_InputDateMask';\nimport { InputDatePicker } from './InputDatePicker';\nimport { useInputDatePickerState } from './useInputDatePickerState';\nimport type { ValueUpdateDetail } from '#utils/UNSAFE_valueUpdateDetail';\n\ntype InputDatePickerProps = ComponentProps<typeof InputDatePicker>;\ntype InputDateMaskProps = ComponentProps<typeof InputDateMask>;\ntype DatePickerProps = ComponentProps<typeof DatePicker>;\ntype IconButtonProps = ComponentProps<typeof IconButton>;\ntype DropdownProps = ComponentProps<typeof InputDatePickerDropdown>;\n\ntype Props = {\n onCommit: InputDatePickerProps['onCommit'];\n onInput: InputDatePickerProps['onInput'];\n value: InputDatePickerProps['value'];\n};\n\n/**\n * Hook that provides handlers and other functionality for InputDatePicker.\n */\nconst useInputDatePicker = ({ onCommit, onInput, value: currentValue }: Props) => {\n // Whether the dropdown is open.\n const [isOpen, setIsOpen] = useState(false);\n\n // Ref to the calendar icon button.\n const iconRef: RefObject<HTMLButtonElement> = useRef<HTMLButtonElement>(null);\n\n // Ref to the InputDateMask component.\n const maskRef: RefObject<HTMLElement> = useRef<HTMLElement>(null);\n\n // Keep track of whether the dropdown was just dismissed from an outside mousedown event.\n const outsideMousedownRef = useRef<boolean>(false);\n const outsideMousedownTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>();\n\n // Keep track of whether the calendar icon is focused after a date is selected\n // and the date picker is closed.\n const calendarFocusAfterSelect = useRef<boolean>(false);\n const calendarFocusAfterSelectTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>();\n\n // Keep track of the last date values passed to onInput and onCommit.\n const lastCommittedDateRef = useRef<CalendarDate | undefined>(currentValue);\n const lastDateRef = useRef<CalendarDate | undefined>(currentValue);\n\n // Keep track of the last controlled value passed from the parent, so we can detect a programmatic change.\n const lastValueFromParentRef = useRef<CalendarDate | undefined>(currentValue);\n\n // Keep track of whether a date was selected in the date picker.\n const dateSelectedRef = useRef<boolean>(false);\n\n const { state, dispatch } = useInputDatePickerState({ value: currentValue });\n\n // If a new value is being pushed from the parent, and that value differs from\n // the current value of the reducer, then this is a programmatic update\n // and we need to call 'reset' to update the reducer state. Otherwise, the only\n // time the reducer state is updated from the value is on mount.\n if (calendarDatesAreDifferent(lastValueFromParentRef.current, currentValue)) {\n lastValueFromParentRef.current = currentValue;\n if (calendarDatesAreDifferent(currentValue, state.dateValue)) {\n dispatch({ type: 'reset', data: currentValue });\n lastDateRef.current = currentValue;\n lastCommittedDateRef.current = currentValue;\n }\n }\n\n // Reducer updates are async, so wait until the state updates and then call our callbacks.\n useEffect(() => {\n if (calendarDatesAreDifferent(state.dateValue, lastDateRef.current)) {\n onInput({ previousValue: lastDateRef.current, value: state.dateValue });\n lastDateRef.current = state.dateValue;\n }\n if (\n dateSelectedRef.current &&\n calendarDatesAreDifferent(state.dateValue, lastCommittedDateRef.current)\n ) {\n onCommit?.({ previousValue: lastCommittedDateRef.current, value: state.dateValue });\n lastCommittedDateRef.current = state.dateValue;\n dateSelectedRef.current = false;\n }\n }, [onCommit, onInput, state.dateValue]);\n\n // Handle onInput from InputDateMask as segment values are being added or changed in the input field.\n // We wait for the state to update before calling onInput.\n const maskInputHandler = useCallback<InputDateMaskProps['onInput']>(\n (detail: ValueUpdateDetail<CalendarDate>) => {\n dispatch({ type: 'dateChanged', data: detail.value });\n },\n [dispatch]\n );\n\n // Handle onCommit from InputDateMask, which is called when the user presses Enter or the field is blurred.\n const maskCommitHandler = useCallback<NonNullable<InputDateMaskProps['onCommit']>>(() => {\n // If the current date value differs from the last committed value, then call onCommit.\n if (calendarDatesAreDifferent(lastCommittedDateRef.current, state.dateValue)) {\n onCommit?.({ value: state.dateValue, previousValue: lastCommittedDateRef.current });\n lastCommittedDateRef.current = state.dateValue;\n }\n }, [onCommit, state.dateValue]);\n\n // Respond to onAction event from the calendar icon button. Toggles the date picker dropdown.\n const calendarIconActionHandler = useCallback<NonNullable<IconButtonProps['onAction']>>(() => {\n // Only toggle the value of isOpen if we didn't just dismiss the dropdown.\n if (!outsideMousedownRef.current && !calendarFocusAfterSelect.current) {\n setIsOpen((prevIsOpen) => !prevIsOpen);\n }\n outsideMousedownRef.current = false;\n calendarFocusAfterSelect.current = false;\n }, []);\n\n const dropdownCloseHandler = useCallback<NonNullable<DropdownProps['onClose']>>(\n (detail: CloseDetail) => {\n // Keep track of when the dropdown is closed via outside mousedown, including when the calendar icon\n // is clicked. We need this in order to toggle visibility of the picker and dropdown.\n if (detail.reason === 'outsideMousedown') {\n outsideMousedownRef.current = true;\n clearTimeout(outsideMousedownTimerRef.current);\n\n // Clear the flag after a short delay to ensure the dropdown can be opened again.\n outsideMousedownTimerRef.current = setTimeout(() => {\n outsideMousedownRef.current = false;\n }, 200);\n } else if (detail.reason === 'dismissed' || detail.reason === 'keyboardDismissed') {\n // Focus the calendar icon when the dropdown is closed.\n iconRef.current?.focus();\n }\n setIsOpen(false);\n },\n []\n );\n\n // Handle date selection in the picker.\n // - Updates the value in state.\n // - Closes the dropdown.\n // - Sets focus to the date field.\n const datePickerCommitHandler = useCallback<DatePickerProps['onCommit']>(\n (detail: ValueUpdateDetail<CalendarDateRequired>) => {\n // Set focus to the calendar icon when a date is selected.\n iconRef.current?.focus();\n\n // If user is using the keyboard, date selection happens on keyDown.\n // If we transfer focus to the calendar icon, it then sees the corresponding\n // keyUp and thinks the button was triggered again (usePress reacts to\n // keyUp, not keyDown). Maintain a flag that prevents this from happening,\n // and clear it after a short delay in case selection was made with the mouse.\n // TODO: Investigate a better way to prevent the dropdown from reopening (JET-67580).\n calendarFocusAfterSelect.current = true;\n clearTimeout(calendarFocusAfterSelectTimerRef.current);\n calendarFocusAfterSelectTimerRef.current = setTimeout(() => {\n calendarFocusAfterSelect.current = false;\n }, 500);\n\n // Set a ref indicating a date was selected.\n dateSelectedRef.current = true;\n dispatch({ type: 'dateSelected', data: detail.value });\n setIsOpen(false);\n },\n [dispatch]\n );\n\n return {\n calendarIconActionHandler,\n datePickerCommitHandler,\n dropdownCloseHandler,\n completeDateValue: state.completeDateValue,\n dateValue: state.dateValue,\n iconRef,\n isOpen,\n maskCommitHandler,\n maskInputHandler,\n maskRef\n };\n};\n\nexport { useInputDatePicker };\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\nimport { ComponentProps, Ref } from 'preact';\nimport { forwardRef } from 'preact/compat';\nimport { useImperativeHandle, useRef } from 'preact/hooks';\nimport { BundleType } from '../resources/nls/bundle';\nimport { CalendarIcon } from '#PRIVATE_ThemedIcons/CalendarIcon';\nimport {\n CalendarDate,\n CalendarDatePlaceholders,\n InputDateMask,\n InputDateMaskContext\n} from '#UNSAFE_InputDateMask';\nimport { DatePicker } from '#UNSAFE_DatePicker';\nimport { HiddenAccessible } from '#UNSAFE_HiddenAccessible';\nimport { IconButton } from '#UNSAFE_IconButton';\nimport { InputDatePickerDropdown } from './InputDatePickerDropdown';\nimport { FocusableHandle } from '#hooks/UNSAFE_useFocusableTextField';\nimport { merge } from '#utils/UNSAFE_stringUtils';\nimport { useFormContext } from '#hooks/UNSAFE_useFormContext';\nimport { useId } from '#hooks/UNSAFE_useId';\nimport { useInputDatePicker } from './useInputDatePicker';\nimport { useTranslationBundle } from '#hooks/UNSAFE_useTranslationBundle';\nimport { ValueUpdateDetail } from '#utils/UNSAFE_valueUpdateDetail';\n\ntype InputDateMaskProps = ComponentProps<typeof InputDateMask>;\ntype PickedPropsFromInputDateMask = Pick<\n InputDateMaskProps,\n | 'aria-describedby'\n | 'assistiveText'\n | 'columnSpan'\n | 'helpSourceLink'\n | 'helpSourceText'\n | 'isDisabled'\n | 'isReadonly'\n | 'isRequired'\n | 'isRequiredShown'\n | 'label'\n | 'labelEdge'\n | 'labelStartWidth'\n | 'messages'\n | 'textAlign'\n | 'testId'\n | 'userAssistanceDensity'\n | 'variant'\n>;\n\ntype DatePickerProps = ComponentProps<typeof DatePicker>;\ntype PickedPropsFromDatePicker = Pick<\n DatePickerProps,\n | 'dayFormatter'\n | 'daysOutsideMonth'\n | 'max'\n | 'min'\n | 'monthAndYearPicker'\n | 'todayTimeZone'\n | 'todayButton'\n>;\n\ntype Props = PickedPropsFromInputDateMask &\n PickedPropsFromDatePicker & {\n /**\n * If specified, overrides the locale specific order of the individual date segments\n * in the date field as well as the locale specific separator. The value of each placeholder\n * is only used when the type is 'literal', otherwise it is replaced with a translated\n * placeholder for month, day, or year. The placeholders must include month, day, and year.\n */\n masks?: CalendarDatePlaceholders;\n\n /**\n * The current display value of the component.\n * This is a CalendarDate, not CalendarDateRequired, because this is a controlled component and\n * the user may type the month, day, and year separately. If a selection is made in the date\n * picker, then the value is a complete date.\n */\n value?: CalendarDate;\n\n /**\n * Callback invoked when the user commits the entered value by blurring or hitting the enter key.\n * It is also called when a selection is made in the date picker.\n */\n onCommit?: (detail: ValueUpdateDetail<CalendarDate>) => void;\n\n /**\n * Callback invoked each time the user changes the value of a segment. For example, if the user\n * types '12' into the month segment, this callback will be called twice to change the month\n * first to '1' and then '12'.\n */\n onInput: (detail: ValueUpdateDetail<CalendarDate>) => void;\n };\n\n/**\n * InputDatePicker allows users to enter or select a single date using a calendar interface.\n */\nexport const InputDatePicker = forwardRef(\n (\n {\n 'aria-describedby': propDescribedBy,\n assistiveText,\n dayFormatter,\n daysOutsideMonth,\n helpSourceLink,\n helpSourceText,\n isDisabled,\n isReadonly,\n label,\n max,\n messages,\n min,\n monthAndYearPicker,\n todayTimeZone,\n todayButton,\n value,\n onCommit,\n onInput,\n testId,\n userAssistanceDensity: propUserAssistanceDensity,\n ...dateMaskProps\n }: Props,\n ref?: Ref<FocusableHandle>\n ) => {\n const {\n calendarIconActionHandler,\n datePickerCommitHandler,\n completeDateValue,\n dateValue,\n dropdownCloseHandler,\n iconRef,\n isOpen,\n maskCommitHandler,\n maskInputHandler,\n maskRef\n } = useInputDatePicker({\n onCommit,\n onInput,\n value\n });\n\n const mainFieldRef = useRef<HTMLDivElement>(null);\n const { inputDatePicker_selectDate, inputDatePicker_instruction } =\n useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n const calendarIconAriaLabel = inputDatePicker_selectDate();\n\n // We need this to determine if UA/messaging should be shown in the dropdown.\n const { userAssistanceDensity: formUserAssistanceDensity } = useFormContext();\n const userAssistanceDensity = propUserAssistanceDensity ?? formUserAssistanceDensity;\n\n useImperativeHandle(ref!, () => ({\n focus: () => {\n maskRef.current?.focus();\n },\n blur: () => {\n maskRef.current?.blur();\n }\n }));\n\n const maskFieldInstructionId = useId();\n const maskFieldInstructionText = inputDatePicker_instruction();\n const maskFieldInstruction =\n !isDisabled && !isReadonly ? (\n <HiddenAccessible id={maskFieldInstructionId} isHidden={true}>\n {maskFieldInstructionText}\n </HiddenAccessible>\n ) : undefined;\n const ariaDescribedBy =\n !isDisabled && !isReadonly\n ? merge([propDescribedBy, maskFieldInstructionId])\n : propDescribedBy;\n\n const endContent = (\n <IconButton\n aria-haspopup=\"dialog\"\n aria-label={calendarIconAriaLabel}\n isDisabled={isDisabled}\n ref={iconRef}\n size=\"sm\"\n testId={testId ? testId + '_calendarIcon' : undefined}\n variant=\"ghost\"\n onAction={calendarIconActionHandler}>\n <CalendarIcon />\n </IconButton>\n );\n\n const shouldShowDropdown = isOpen as boolean;\n\n return (\n <>\n <InputDateMaskContext.Provider\n value={{ isDropdownOpen: isOpen, isInputDatePickerParent: true }}>\n <InputDateMask\n aria-describedby={ariaDescribedBy}\n assistiveText={assistiveText}\n endContent={endContent}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n isDisabled={isDisabled}\n isReadonly={isReadonly}\n label={label}\n onCommit={maskCommitHandler}\n onInput={maskInputHandler}\n mainFieldRef={mainFieldRef}\n messages={messages}\n testId={testId}\n ref={maskRef}\n userAssistanceDensity={propUserAssistanceDensity}\n value={dateValue}\n {...dateMaskProps}\n />\n </InputDateMaskContext.Provider>\n\n {maskFieldInstruction}\n\n {shouldShowDropdown && (\n <InputDatePickerDropdown\n anchorRef={mainFieldRef}\n assistiveText={assistiveText}\n dayFormatter={dayFormatter}\n daysOutsideMonth={daysOutsideMonth}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n isDisabled={isDisabled}\n isReadonly={isReadonly}\n isOpen={isOpen}\n label={label}\n onClose={dropdownCloseHandler}\n onCommit={datePickerCommitHandler}\n max={max}\n messages={messages}\n min={min}\n monthAndYearPicker={monthAndYearPicker}\n testId={testId ? testId + '_datePicker' : undefined}\n todayTimeZone={todayTimeZone}\n todayButton={todayButton}\n userAssistanceDensity={userAssistanceDensity}\n value={completeDateValue}\n />\n )}\n </>\n );\n }\n);\n"],"names":["InputDatePickerDropdown","anchorRef","assistiveText","dayFormatter","daysOutsideMonth","helpSourceLink","helpSourceText","isDisabled","isOpen","isReadonly","label","onClose","onCommit","max","messages","min","monthAndYearPicker","testId","todayButton","todayTimeZone","userAssistanceDensity","value","isDropdownAbove","setDropdownAbove","useState","prevIsOpen","setPrevIsOpen","handleDropdownPosition","useCallback","data","placement","startsWith","shouldShowSheet","isPhone","datePicker_label","useTranslationBundle","datePickerAriaLabel","datePickerMainContent","_jsx","jsx","DatePicker","maxWidth","undefined","width","datePickerPropVars","inlineUserAssistanceFooter","length","FormFieldContext","Provider","isFocused","children","class","userAssistanceStyles","InlineUserAssistance","fieldLabel","contentTestId","dropdownContent","dropdownStyles","SectionedContent","footer","hasFocusTrap","main","role","Sheet","initialFocus","StickyPositioningDropdown","onPosition","sizeOptions","isMaxWidthAdjusted","isMaxHeightAdjusted","getClientHints","deviceType","convertToCalendarDateRequired","dateVal","isCompleteCalendarDate","inputDatePickerReducer","state","action","type","dateValue","completeDateValue","useInputDatePicker","onInput","currentValue","setIsOpen","iconRef","useRef","maskRef","outsideMousedownRef","outsideMousedownTimerRef","calendarFocusAfterSelect","calendarFocusAfterSelectTimerRef","lastCommittedDateRef","lastDateRef","lastValueFromParentRef","dateSelectedRef","dispatch","useReducer","useInputDatePickerState","calendarDatesAreDifferent","current","useEffect","previousValue","maskInputHandler","detail","maskCommitHandler","calendarIconActionHandler","dropdownCloseHandler","reason","clearTimeout","setTimeout","focus","datePickerCommitHandler","InputDatePicker","forwardRef","propDescribedBy","propUserAssistanceDensity","dateMaskProps","ref","mainFieldRef","inputDatePicker_selectDate","inputDatePicker_instruction","calendarIconAriaLabel","formUserAssistanceDensity","useFormContext","useImperativeHandle","blur","maskFieldInstructionId","useId","maskFieldInstructionText","maskFieldInstruction","HiddenAccessible","id","isHidden","ariaDescribedBy","merge","endContent","IconButton","size","variant","onAction","CalendarIcon","shouldShowDropdown","_jsxs","InputDateMaskContext","isDropdownOpen","isInputDatePickerParent","InputDateMask"],"mappings":"w9DAsEA,MAAMA,EAA0B,EAC9BC,YACAC,gBACAC,eACAC,mBACAC,iBACAC,iBACAC,aACAC,SACAC,aACAC,QACAC,UACAC,WACAC,MACAC,WACAC,MACAC,qBACAC,SACAC,cACAC,gBACAC,wBACAC,YAGA,MAAOC,EAAiBC,GAAoBC,EAAQA,UAAC,IAC9CC,EAAYC,GAAiBF,EAAQA,SAAChB,GACv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AAInF,SACzD+E,IAGDK,EACH/H,GAAeE,EAEZ0G,EADAoB,QAAM,CAACpB,EAAiBY,IAGxBS,EACJlG,EAAAC,IAACkG,EAAUA,WACK,CAAA,gBAAA,SACF,aAAAf,EACZnH,WAAYA,EACZ+G,IAAKjC,EACLqD,KAAK,KACLzH,OAAQA,EAASA,EAAS,qBAAkByB,EAC5CiG,QAAQ,QACRC,SAAUlC,EAAyBxD,SACnCZ,EAAAA,IAACuG,EAAAA,YAAY,CAAA,KAIXC,GAAqBtI,EAE3B,OACEuI,6BACEzG,EAACC,IAAAyG,uBAAqBhG,SAAQ,CAC5B3B,MAAO,CAAE4H,eAAgBzI,EAAQ0I,yBAAyB,GAAMhG,SAChEZ,MAAC6G,EAAAA,cAAa,CAAA,mBACMb,EAClBpI,cAAeA,EACfsI,WAAYA,EACZnI,eAAgBA,EAChBC,eAAgBA,EAChBC,WAAYA,EACZE,WAAYA,EACZC,MAAOA,EACPE,SAAU6F,EACVvB,QAASqB,EACTgB,aAAcA,EACdzG,SAAUA,EACVG,OAAQA,EACRqG,IAAK/B,EACLnE,sBAAuBgG,EACvB/F,MAAO0D,KACHsC,MAIPa,EAEAY,IACCxG,EAAAA,IAACtC,EAAuB,CACtBC,UAAWsH,EACXrH,cAAeA,EACfC,aAAcA,EACdC,iBAAkBA,EAClBC,eAAgBA,EAChBC,eAAgBA,EAChBC,WAAYA,EACZE,WAAYA,EACZD,OAAQA,EACRE,MAAOA,EACPC,QAASgG,EACT/F,SAAUoG,EACVnG,IAAKA,EACLC,SAAUA,EACVC,IAAKA,EACLC,mBAAoBA,EACpBC,OAAQA,EAASA,EAAS,mBAAgByB,EAC1CvB,cAAeA,EACfD,YAAaA,EACbE,sBAAuBA,EACvBC,MAAO2D,MAIb"}
|
|
1
|
+
{"version":3,"file":"InputDatePicker-da5d8728.js","sources":["../../src/UNSAFE_InputDatePicker/InputDatePickerDropdown.tsx","../../src/UNSAFE_InputDatePicker/useInputDatePickerState.ts","../../src/UNSAFE_InputDatePicker/useInputDatePicker.ts","../../src/UNSAFE_InputDatePicker/InputDatePicker.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { ComponentProps } from 'preact';\nimport { useCallback, useState } from 'preact/hooks';\nimport { BundleType } from '../resources/nls/bundle';\nimport { DatePicker } from '#UNSAFE_DatePicker';\nimport { type CloseDetail as DropdownCloseDetail } from '#UNSAFE_Dropdown';\nimport { getClientHints } from '#utils/PRIVATE_clientHints';\nimport { FormFieldContext } from '../hooks/UNSAFE_useFormFieldContext';\nimport { InlineUserAssistance } from '../UNSAFE_UserAssistance';\nimport { InputDatePicker } from './InputDatePicker';\nimport { dropdownStyles, userAssistanceStyles } from './themes/InputDatePickerDropdownStyles.css';\nimport { PositionData } from '../UNSAFE_Floating';\nimport { StickyPositioningDropdown } from '#PRIVATE_FormControls';\nimport { SectionedContent } from '#PRIVATE_FormControls';\nimport { type CloseDetail as SheetCloseDetail, Sheet } from '#UNSAFE_Sheet';\nimport type { TestIdProps } from '#hooks/UNSAFE_useTestId';\nimport { useTranslationBundle } from '#hooks/UNSAFE_useTranslationBundle';\nimport { SizeOptions } from '#UNSAFE_Floating/Floating';\nimport { datePickerPropVars } from '#UNSAFE_DatePicker/themes/DatePickerContract.css';\n\ntype StickyPositioningDropdownProps = ComponentProps<typeof StickyPositioningDropdown>;\ntype InputDatePickerProps = ComponentProps<typeof InputDatePicker>;\ntype PickedPropsFromInputDatePicker = Pick<\n InputDatePickerProps,\n | 'assistiveText'\n | 'dayFormatter'\n | 'daysOutsideMonth'\n | 'helpSourceLink'\n | 'helpSourceText'\n | 'isDisabled'\n | 'isReadonly'\n | 'label'\n | 'messages'\n | 'min'\n | 'max'\n | 'monthAndYearPicker'\n | 'todayButton'\n | 'todayTimeZone'\n | 'userAssistanceDensity'\n | 'value'\n>;\ntype DatePickerProps = ComponentProps<typeof DatePicker>;\ntype PickedPropsFromDatePicker = Pick<DatePickerProps, 'value' | 'onCommit'>;\ntype PickedPropsFromDropdown = Omit<StickyPositioningDropdownProps, 'onClose'>;\ntype CloseDetail = SheetCloseDetail | DropdownCloseDetail;\n\ntype Props = PickedPropsFromDatePicker &\n PickedPropsFromInputDatePicker &\n PickedPropsFromDropdown &\n TestIdProps & {\n /**\n * Called when the dropdown or sheet is supposed to be closed.\n */\n onClose?: (detail: CloseDetail) => void;\n };\n\n/**\n * Component that renders DatePicker either inside a dropdown or sheet; at small screen\n * widths, it renders inside a sheet. Additionally, when a dropdown is being shown beneath\n * the component, we also show any user assistance text or messages below the picker\n * because otherwise that information would be obscured from view. When a sheet is being\n * shown, it will always display UA and messages at the bottom of the sheet.\n */\nconst InputDatePickerDropdown = ({\n anchorRef,\n assistiveText,\n dayFormatter,\n daysOutsideMonth,\n helpSourceLink,\n helpSourceText,\n isDisabled,\n isOpen,\n isReadonly,\n label,\n onClose,\n onCommit,\n max,\n messages,\n min,\n monthAndYearPicker,\n testId,\n todayButton,\n todayTimeZone,\n userAssistanceDensity,\n value\n}: Props) => {\n // If the dropdown opens above the component, we don't want to show UA or messages.\n const [isDropdownAbove, setDropdownAbove] = useState(false);\n const [prevIsOpen, setPrevIsOpen] = useState(isOpen);\n const handleDropdownPosition = useCallback<\n NonNullable<StickyPositioningDropdownProps['onPosition']>\n >((data: PositionData) => {\n setDropdownAbove(data.placement.startsWith('top'));\n }, []);\n // Reset the flag when the dropdown is closed.\n if (prevIsOpen !== isOpen) {\n setPrevIsOpen(isOpen);\n if (!isOpen) {\n setDropdownAbove(false);\n }\n }\n\n const sizeOptions: SizeOptions = {\n isMaxWidthAdjusted: false,\n isMaxHeightAdjusted: true\n };\n\n // On mobile phones, the dropdown becomes a sheet.\n const shouldShowSheet = isPhone();\n\n const { datePicker_label } = useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n const datePickerAriaLabel = datePicker_label();\n\n const datePickerMainContent = (\n <DatePicker\n dayFormatter={dayFormatter}\n daysOutsideMonth={daysOutsideMonth}\n onCommit={onCommit}\n max={max}\n min={min}\n // for sheet, we want the width to grow to the width of the sheet, otherwise it will use the theme default.\n maxWidth={shouldShowSheet ? '100%' : undefined}\n // for dropdown, we want a fixed width, so set width to the same var used for default maxWidth\n width={!shouldShowSheet ? datePickerPropVars.maxWidth : '100%'}\n monthAndYearPicker={monthAndYearPicker}\n testId={testId}\n todayTimeZone={todayTimeZone}\n todayButton={todayButton}\n value={value}\n />\n );\n\n const inlineUserAssistanceFooter =\n isOpen &&\n (!isDropdownAbove || shouldShowSheet) &&\n !isDisabled &&\n !isReadonly &&\n (assistiveText || helpSourceLink || (messages && messages.length > 0)) &&\n (userAssistanceDensity === 'efficient' || userAssistanceDensity === 'reflow') ? (\n <FormFieldContext.Provider value={{ isFocused: true }}>\n <div class={userAssistanceStyles}>\n <InlineUserAssistance\n assistiveText={assistiveText}\n fieldLabel={label}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n messages={messages}\n userAssistanceDensity={userAssistanceDensity}\n />\n </div>\n </FormFieldContext.Provider>\n ) : undefined;\n\n const contentTestId = testId ? testId + (shouldShowSheet ? '_sheet' : '_dropdown') : undefined;\n\n // The same content is displayed either in a dropdown or sheet: date picker and inline UA.\n // Add styling to the dropdown to enforce a fixed width.\n const dropdownContent = (\n <div class={dropdownStyles}>\n <SectionedContent\n aria-label={datePickerAriaLabel}\n footer={inlineUserAssistanceFooter}\n hasFocusTrap={true}\n main={datePickerMainContent}\n role=\"dialog\"\n testId={contentTestId}\n />\n </div>\n );\n\n const dropdown = shouldShowSheet ? (\n <Sheet initialFocus=\"firstFocusable\" isOpen={isOpen} onClose={onClose}>\n <SectionedContent\n aria-label={datePickerAriaLabel}\n footer={inlineUserAssistanceFooter}\n hasFocusTrap={true}\n main={datePickerMainContent}\n role=\"dialog\"\n testId={contentTestId}\n />\n </Sheet>\n ) : (\n <StickyPositioningDropdown\n anchorRef={anchorRef}\n initialFocus=\"firstFocusable\"\n isOpen={isOpen}\n onClose={onClose}\n onPosition={handleDropdownPosition}\n sizeOptions={sizeOptions}>\n {dropdownContent}\n </StickyPositioningDropdown>\n );\n\n return dropdown;\n};\n\nconst isPhone = () => {\n return getClientHints().deviceType === 'phone';\n};\n\nexport { InputDatePickerDropdown, type CloseDetail };\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { useReducer } from 'preact/hooks';\nimport type { CalendarDate, CalendarDateRequired } from '#utils/UNSAFE_calendarDateUtils';\nimport { isCompleteCalendarDate } from '#utils/UNSAFE_calendarDateUtils';\n\ntype InputDatePickerState = {\n /**\n * If dateValue is a complete date, then completeDateValue is the same as dateValue\n * otherwise is is undefined. We need to maintain separate states because\n * InputDateMask uses CalendarDate, but DatePicker uses CalendarDateRequired.\n * If the user types a partial date then opens the picker, we treat that as\n * no selection. The picker opens to the current month showing today.\n */\n completeDateValue?: CalendarDateRequired;\n\n /**\n * Represents the current date value of the component. The user either selected\n * the date in the picker, or typed it into the date field.\n */\n dateValue?: CalendarDate;\n};\n\ntype DateChangedAction = { type: 'dateChanged'; data?: CalendarDate };\ntype DateResetAction = { type: 'reset'; data?: CalendarDate };\ntype DateSelectedAction = { type: 'dateSelected'; data?: CalendarDateRequired };\ntype InputDatePickerReducerAction = DateChangedAction | DateResetAction | DateSelectedAction;\n\n// If dateVal is a complete date, return it as a CalendarDateRequired\n// otherwise return undefined.\nconst convertToCalendarDateRequired = (dateVal?: CalendarDate) => {\n return !dateVal || !isCompleteCalendarDate(dateVal)\n ? undefined\n : (dateVal as CalendarDateRequired);\n};\n\n// Use a reducer function to manage InputDatePickerState.\nconst inputDatePickerReducer = (\n state: InputDatePickerState,\n action: InputDatePickerReducerAction\n): InputDatePickerState => {\n switch (action.type) {\n case 'dateChanged': {\n return {\n ...state,\n dateValue: action.data,\n completeDateValue: convertToCalendarDateRequired(action.data)\n };\n }\n case 'dateSelected': {\n return { ...state, dateValue: action.data, completeDateValue: action.data };\n }\n case 'reset': {\n return {\n completeDateValue: convertToCalendarDateRequired(action.data),\n dateValue: action.data\n };\n }\n default:\n return state;\n }\n};\n\ntype Props = {\n /**\n * The value of the InputDatePicker, or undefined.\n */\n value?: CalendarDate;\n};\n\n/**\n * useInputDatePickerState calls useReducer to determine the initial state. Any changes to that state\n * are managed by dispatching actions to the reducer function.\n */\nconst useInputDatePickerState = ({ value }: Props) => {\n const [state, dispatch] = useReducer(inputDatePickerReducer, {\n completeDateValue: convertToCalendarDateRequired(value),\n dateValue: value\n });\n\n return { state, dispatch };\n};\n\nexport { useInputDatePickerState };\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { ComponentProps, RefObject } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport type { CalendarDate, CalendarDateRequired } from '#utils/UNSAFE_calendarDateUtils';\nimport { calendarDatesAreDifferent } from '#utils/PRIVATE_dayUtils';\nimport { DatePicker } from '#UNSAFE_DatePicker';\nimport { CloseDetail, InputDatePickerDropdown } from './InputDatePickerDropdown';\nimport { IconButton } from '#UNSAFE_IconButton';\nimport { InputDateMask } from '#UNSAFE_InputDateMask';\nimport { InputDatePicker } from './InputDatePicker';\nimport { useInputDatePickerState } from './useInputDatePickerState';\nimport type { ValueUpdateDetail } from '#utils/UNSAFE_valueUpdateDetail';\n\ntype InputDatePickerProps = ComponentProps<typeof InputDatePicker>;\ntype InputDateMaskProps = ComponentProps<typeof InputDateMask>;\ntype DatePickerProps = ComponentProps<typeof DatePicker>;\ntype IconButtonProps = ComponentProps<typeof IconButton>;\ntype DropdownProps = ComponentProps<typeof InputDatePickerDropdown>;\n\ntype Props = {\n onCommit: InputDatePickerProps['onCommit'];\n onInput: InputDatePickerProps['onInput'];\n value: InputDatePickerProps['value'];\n};\n\n/**\n * Hook that provides handlers and other functionality for InputDatePicker.\n */\nconst useInputDatePicker = ({ onCommit, onInput, value: currentValue }: Props) => {\n // Whether the dropdown is open.\n const [isOpen, setIsOpen] = useState(false);\n\n // Ref to the calendar icon button.\n const iconRef: RefObject<HTMLButtonElement> = useRef<HTMLButtonElement>(null);\n\n // Ref to the InputDateMask component.\n const maskRef: RefObject<HTMLElement> = useRef<HTMLElement>(null);\n\n // Keep track of whether the dropdown was just dismissed from an outside mousedown event.\n const outsideMousedownRef = useRef<boolean>(false);\n const outsideMousedownTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>();\n\n // Keep track of whether the calendar icon is focused after a date is selected\n // and the date picker is closed.\n const calendarFocusAfterSelect = useRef<boolean>(false);\n const calendarFocusAfterSelectTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>();\n\n // Keep track of the last date values passed to onInput and onCommit.\n const lastCommittedDateRef = useRef<CalendarDate | undefined>(currentValue);\n const lastDateRef = useRef<CalendarDate | undefined>(currentValue);\n\n // Keep track of the last controlled value passed from the parent, so we can detect a programmatic change.\n const lastValueFromParentRef = useRef<CalendarDate | undefined>(currentValue);\n\n // Keep track of whether a date was selected in the date picker.\n const dateSelectedRef = useRef<boolean>(false);\n\n const { state, dispatch } = useInputDatePickerState({ value: currentValue });\n\n // If a new value is being pushed from the parent, and that value differs from\n // the current value of the reducer, then this is a programmatic update\n // and we need to call 'reset' to update the reducer state. Otherwise, the only\n // time the reducer state is updated from the value is on mount.\n if (calendarDatesAreDifferent(lastValueFromParentRef.current, currentValue)) {\n lastValueFromParentRef.current = currentValue;\n if (calendarDatesAreDifferent(currentValue, state.dateValue)) {\n dispatch({ type: 'reset', data: currentValue });\n lastDateRef.current = currentValue;\n lastCommittedDateRef.current = currentValue;\n }\n }\n\n // Reducer updates are async, so wait until the state updates and then call our callbacks.\n useEffect(() => {\n if (calendarDatesAreDifferent(state.dateValue, lastDateRef.current)) {\n onInput({ previousValue: lastDateRef.current, value: state.dateValue });\n lastDateRef.current = state.dateValue;\n }\n if (\n dateSelectedRef.current &&\n calendarDatesAreDifferent(state.dateValue, lastCommittedDateRef.current)\n ) {\n onCommit?.({ previousValue: lastCommittedDateRef.current, value: state.dateValue });\n lastCommittedDateRef.current = state.dateValue;\n dateSelectedRef.current = false;\n }\n }, [onCommit, onInput, state.dateValue]);\n\n // Handle onInput from InputDateMask as segment values are being added or changed in the input field.\n // We wait for the state to update before calling onInput.\n const maskInputHandler = useCallback<InputDateMaskProps['onInput']>(\n (detail: ValueUpdateDetail<CalendarDate>) => {\n dispatch({ type: 'dateChanged', data: detail.value });\n },\n [dispatch]\n );\n\n // Handle onCommit from InputDateMask, which is called when the user presses Enter or the field is blurred.\n const maskCommitHandler = useCallback<NonNullable<InputDateMaskProps['onCommit']>>(() => {\n // If the current date value differs from the last committed value, then call onCommit.\n if (calendarDatesAreDifferent(lastCommittedDateRef.current, state.dateValue)) {\n onCommit?.({ value: state.dateValue, previousValue: lastCommittedDateRef.current });\n lastCommittedDateRef.current = state.dateValue;\n }\n }, [onCommit, state.dateValue]);\n\n // Respond to onAction event from the calendar icon button. Toggles the date picker dropdown.\n const calendarIconActionHandler = useCallback<NonNullable<IconButtonProps['onAction']>>(() => {\n // Only toggle the value of isOpen if we didn't just dismiss the dropdown.\n if (!outsideMousedownRef.current && !calendarFocusAfterSelect.current) {\n setIsOpen((prevIsOpen) => !prevIsOpen);\n }\n outsideMousedownRef.current = false;\n calendarFocusAfterSelect.current = false;\n }, []);\n\n const dropdownCloseHandler = useCallback<NonNullable<DropdownProps['onClose']>>(\n (detail: CloseDetail) => {\n // Keep track of when the dropdown is closed via outside mousedown, including when the calendar icon\n // is clicked. We need this in order to toggle visibility of the picker and dropdown.\n if (detail.reason === 'outsideMousedown') {\n outsideMousedownRef.current = true;\n clearTimeout(outsideMousedownTimerRef.current);\n\n // Clear the flag after a short delay to ensure the dropdown can be opened again.\n outsideMousedownTimerRef.current = setTimeout(() => {\n outsideMousedownRef.current = false;\n }, 200);\n } else if (detail.reason === 'dismissed' || detail.reason === 'keyboardDismissed') {\n // Focus the calendar icon when the dropdown is closed.\n iconRef.current?.focus();\n }\n setIsOpen(false);\n },\n []\n );\n\n // Handle date selection in the picker.\n // - Updates the value in state.\n // - Closes the dropdown.\n // - Sets focus to the date field.\n const datePickerCommitHandler = useCallback<DatePickerProps['onCommit']>(\n (detail: ValueUpdateDetail<CalendarDateRequired>) => {\n // Set focus to the calendar icon when a date is selected.\n iconRef.current?.focus();\n\n // If user is using the keyboard, date selection happens on keyDown.\n // If we transfer focus to the calendar icon, it then sees the corresponding\n // keyUp and thinks the button was triggered again (usePress reacts to\n // keyUp, not keyDown). Maintain a flag that prevents this from happening,\n // and clear it after a short delay in case selection was made with the mouse.\n // TODO: Investigate a better way to prevent the dropdown from reopening (JET-67580).\n calendarFocusAfterSelect.current = true;\n clearTimeout(calendarFocusAfterSelectTimerRef.current);\n calendarFocusAfterSelectTimerRef.current = setTimeout(() => {\n calendarFocusAfterSelect.current = false;\n }, 500);\n\n // Set a ref indicating a date was selected.\n dateSelectedRef.current = true;\n dispatch({ type: 'dateSelected', data: detail.value });\n setIsOpen(false);\n },\n [dispatch]\n );\n\n return {\n calendarIconActionHandler,\n datePickerCommitHandler,\n dropdownCloseHandler,\n completeDateValue: state.completeDateValue,\n dateValue: state.dateValue,\n iconRef,\n isOpen,\n maskCommitHandler,\n maskInputHandler,\n maskRef\n };\n};\n\nexport { useInputDatePicker };\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\nimport { ComponentProps, Ref } from 'preact';\nimport { forwardRef } from 'preact/compat';\nimport { useImperativeHandle, useRef } from 'preact/hooks';\nimport { BundleType } from '../resources/nls/bundle';\nimport { CalendarIcon } from '#PRIVATE_ThemedIcons/CalendarIcon';\nimport {\n CalendarDate,\n CalendarDatePlaceholders,\n InputDateMask,\n InputDateMaskContext\n} from '#UNSAFE_InputDateMask';\nimport { DatePicker } from '#UNSAFE_DatePicker';\nimport { HiddenAccessible } from '#UNSAFE_HiddenAccessible';\nimport { IconButton } from '#UNSAFE_IconButton';\nimport { InputDatePickerDropdown } from './InputDatePickerDropdown';\nimport { FocusableHandle } from '#hooks/UNSAFE_useFocusableTextField';\nimport { merge } from '#utils/UNSAFE_stringUtils';\nimport { useFormContext } from '#hooks/UNSAFE_useFormContext';\nimport { useId } from '#hooks/UNSAFE_useId';\nimport { useInputDatePicker } from './useInputDatePicker';\nimport { useTranslationBundle } from '#hooks/UNSAFE_useTranslationBundle';\nimport { ValueUpdateDetail } from '#utils/UNSAFE_valueUpdateDetail';\n\ntype InputDateMaskProps = ComponentProps<typeof InputDateMask>;\ntype PickedPropsFromInputDateMask = Pick<\n InputDateMaskProps,\n | 'aria-describedby'\n | 'assistiveText'\n | 'columnSpan'\n | 'helpSourceLink'\n | 'helpSourceText'\n | 'isDisabled'\n | 'isReadonly'\n | 'isRequired'\n | 'isRequiredShown'\n | 'label'\n | 'labelEdge'\n | 'labelStartWidth'\n | 'messages'\n | 'textAlign'\n | 'testId'\n | 'userAssistanceDensity'\n | 'variant'\n>;\n\ntype DatePickerProps = ComponentProps<typeof DatePicker>;\ntype PickedPropsFromDatePicker = Pick<\n DatePickerProps,\n | 'dayFormatter'\n | 'daysOutsideMonth'\n | 'max'\n | 'min'\n | 'monthAndYearPicker'\n | 'todayTimeZone'\n | 'todayButton'\n>;\n\ntype Props = PickedPropsFromInputDateMask &\n PickedPropsFromDatePicker & {\n /**\n * If specified, overrides the locale specific order of the individual date segments\n * in the date field as well as the locale specific separator. The value of each placeholder\n * is only used when the type is 'literal', otherwise it is replaced with a translated\n * placeholder for month, day, or year. The placeholders must include month, day, and year.\n */\n masks?: CalendarDatePlaceholders;\n\n /**\n * The current display value of the component.\n * This is a CalendarDate, not CalendarDateRequired, because this is a controlled component and\n * the user may type the month, day, and year separately. If a selection is made in the date\n * picker, then the value is a complete date.\n */\n value?: CalendarDate;\n\n /**\n * Callback invoked when the user commits the entered value by blurring or hitting the enter key.\n * It is also called when a selection is made in the date picker.\n */\n onCommit?: (detail: ValueUpdateDetail<CalendarDate>) => void;\n\n /**\n * Callback invoked each time the user changes the value of a segment. For example, if the user\n * types '12' into the month segment, this callback will be called twice to change the month\n * first to '1' and then '12'.\n */\n onInput: (detail: ValueUpdateDetail<CalendarDate>) => void;\n };\n\n/**\n * InputDatePicker allows users to enter or select a single date using a calendar interface.\n */\nexport const InputDatePicker = forwardRef(\n (\n {\n 'aria-describedby': propDescribedBy,\n assistiveText,\n dayFormatter,\n daysOutsideMonth,\n helpSourceLink,\n helpSourceText,\n isDisabled,\n isReadonly,\n label,\n max,\n messages,\n min,\n monthAndYearPicker,\n todayTimeZone,\n todayButton,\n value,\n onCommit,\n onInput,\n testId,\n userAssistanceDensity: propUserAssistanceDensity,\n ...dateMaskProps\n }: Props,\n ref?: Ref<FocusableHandle>\n ) => {\n const {\n calendarIconActionHandler,\n datePickerCommitHandler,\n completeDateValue,\n dateValue,\n dropdownCloseHandler,\n iconRef,\n isOpen,\n maskCommitHandler,\n maskInputHandler,\n maskRef\n } = useInputDatePicker({\n onCommit,\n onInput,\n value\n });\n\n const mainFieldRef = useRef<HTMLDivElement>(null);\n const { inputDatePicker_selectDate, inputDatePicker_instruction } =\n useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n const calendarIconAriaLabel = inputDatePicker_selectDate();\n\n // We need this to determine if UA/messaging should be shown in the dropdown.\n const { userAssistanceDensity: formUserAssistanceDensity } = useFormContext();\n const userAssistanceDensity = propUserAssistanceDensity ?? formUserAssistanceDensity;\n\n useImperativeHandle(ref!, () => ({\n focus: () => {\n maskRef.current?.focus();\n },\n blur: () => {\n maskRef.current?.blur();\n }\n }));\n\n const maskFieldInstructionId = useId();\n const maskFieldInstructionText = inputDatePicker_instruction();\n const maskFieldInstruction =\n !isDisabled && !isReadonly ? (\n <HiddenAccessible id={maskFieldInstructionId} isHidden={true}>\n {maskFieldInstructionText}\n </HiddenAccessible>\n ) : undefined;\n const ariaDescribedBy =\n !isDisabled && !isReadonly\n ? merge([propDescribedBy, maskFieldInstructionId])\n : propDescribedBy;\n\n const endContent = (\n <IconButton\n aria-haspopup=\"dialog\"\n aria-label={calendarIconAriaLabel}\n isDisabled={isDisabled}\n ref={iconRef}\n size=\"sm\"\n testId={testId ? testId + '_calendarIcon' : undefined}\n variant=\"ghost\"\n onAction={calendarIconActionHandler}>\n <CalendarIcon />\n </IconButton>\n );\n\n const shouldShowDropdown = isOpen as boolean;\n\n return (\n <>\n <InputDateMaskContext.Provider\n value={{ isDropdownOpen: isOpen, isInputDatePickerParent: true }}>\n <InputDateMask\n aria-describedby={ariaDescribedBy}\n assistiveText={assistiveText}\n endContent={endContent}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n isDisabled={isDisabled}\n isReadonly={isReadonly}\n label={label}\n onCommit={maskCommitHandler}\n onInput={maskInputHandler}\n mainFieldRef={mainFieldRef}\n messages={messages}\n testId={testId}\n ref={maskRef}\n userAssistanceDensity={propUserAssistanceDensity}\n value={dateValue}\n {...dateMaskProps}\n />\n </InputDateMaskContext.Provider>\n\n {maskFieldInstruction}\n\n {shouldShowDropdown && (\n <InputDatePickerDropdown\n anchorRef={mainFieldRef}\n assistiveText={assistiveText}\n dayFormatter={dayFormatter}\n daysOutsideMonth={daysOutsideMonth}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n isDisabled={isDisabled}\n isReadonly={isReadonly}\n isOpen={isOpen}\n label={label}\n onClose={dropdownCloseHandler}\n onCommit={datePickerCommitHandler}\n max={max}\n messages={messages}\n min={min}\n monthAndYearPicker={monthAndYearPicker}\n testId={testId ? testId + '_datePicker' : undefined}\n todayTimeZone={todayTimeZone}\n todayButton={todayButton}\n userAssistanceDensity={userAssistanceDensity}\n value={completeDateValue}\n />\n )}\n </>\n );\n }\n);\n"],"names":["InputDatePickerDropdown","anchorRef","assistiveText","dayFormatter","daysOutsideMonth","helpSourceLink","helpSourceText","isDisabled","isOpen","isReadonly","label","onClose","onCommit","max","messages","min","monthAndYearPicker","testId","todayButton","todayTimeZone","userAssistanceDensity","value","isDropdownAbove","setDropdownAbove","useState","prevIsOpen","setPrevIsOpen","handleDropdownPosition","useCallback","data","placement","startsWith","shouldShowSheet","isPhone","datePicker_label","useTranslationBundle","datePickerAriaLabel","datePickerMainContent","_jsx","jsx","DatePicker","maxWidth","undefined","width","datePickerPropVars","inlineUserAssistanceFooter","length","FormFieldContext","Provider","isFocused","children","class","userAssistanceStyles","InlineUserAssistance","fieldLabel","contentTestId","dropdownContent","dropdownStyles","SectionedContent","footer","hasFocusTrap","main","role","Sheet","initialFocus","StickyPositioningDropdown","onPosition","sizeOptions","isMaxWidthAdjusted","isMaxHeightAdjusted","getClientHints","deviceType","convertToCalendarDateRequired","dateVal","isCompleteCalendarDate","inputDatePickerReducer","state","action","type","dateValue","completeDateValue","useInputDatePicker","onInput","currentValue","setIsOpen","iconRef","useRef","maskRef","outsideMousedownRef","outsideMousedownTimerRef","calendarFocusAfterSelect","calendarFocusAfterSelectTimerRef","lastCommittedDateRef","lastDateRef","lastValueFromParentRef","dateSelectedRef","dispatch","useReducer","useInputDatePickerState","calendarDatesAreDifferent","current","useEffect","previousValue","maskInputHandler","detail","maskCommitHandler","calendarIconActionHandler","dropdownCloseHandler","reason","clearTimeout","setTimeout","focus","datePickerCommitHandler","InputDatePicker","forwardRef","propDescribedBy","propUserAssistanceDensity","dateMaskProps","ref","mainFieldRef","inputDatePicker_selectDate","inputDatePicker_instruction","calendarIconAriaLabel","formUserAssistanceDensity","useFormContext","useImperativeHandle","blur","maskFieldInstructionId","useId","maskFieldInstructionText","maskFieldInstruction","HiddenAccessible","id","isHidden","ariaDescribedBy","merge","endContent","IconButton","size","variant","onAction","CalendarIcon","shouldShowDropdown","_jsxs","InputDateMaskContext","isDropdownOpen","isInputDatePickerParent","InputDateMask"],"mappings":"w9DAsEA,MAAMA,EAA0B,EAC9BC,YACAC,gBACAC,eACAC,mBACAC,iBACAC,iBACAC,aACAC,SACAC,aACAC,QACAC,UACAC,WACAC,MACAC,WACAC,MACAC,qBACAC,SACAC,cACAC,gBACAC,wBACAC,YAGA,MAAOC,EAAiBC,GAAoBC,EAAQA,UAAC,IAC9CC,EAAYC,GAAiBF,EAAQA,SAAChB,GACvCmB,EAAyBC,eAE5BC,IACDN,EAAiBM,EAAKC,UAAUC,WAAW,OAAO,GACjD,IAECN,IAAejB,IACjBkB,EAAclB,GACTA,GACHe,GAAiB,IAIrB,MAMMS,EAAkBC,MAElBC,iBAAEA,GAAqBC,EAAoBA,qBAAa,4BACxDC,EAAsBF,IAEtBG,EACJC,EAACC,IAAAC,EAAUA,YACTrC,aAAcA,EACdC,iBAAkBA,EAClBQ,SAAUA,EACVC,IAAKA,EACLE,IAAKA,EAEL0B,SAAUT,EAAkB,YAASU,EAErCC,MAAQX,EAAgD,OAA9BY,EAAkBA,mBAACH,SAC7CzB,mBAAoBA,EACpBC,OAAQA,EACRE,cAAeA,EACfD,YAAaA,EACbG,MAAOA,IAILwB,GACJrC,GACEc,IAAmBU,GACpBzB,GACAE,KACAP,GAAiBG,GAAmBS,GAAYA,EAASgC,OAAS,IACxC,cAA1B1B,GAAmE,WAA1BA,OAatCsB,EAZFJ,MAACS,EAAAA,iBAAiBC,SAAQ,CAAC3B,MAAO,CAAE4B,WAAW,GAAMC,SACnDZ,EAAKC,IAAA,MAAA,CAAAY,MAAOC,gCACVd,EAAAA,IAACe,EAAAA,qBACC,CAAAnD,cAAeA,EACfoD,WAAY5C,EACZL,eAAgBA,EAChBC,eAAgBA,EAChBQ,SAAUA,EACVM,sBAAuBA,QAM3BmC,EAAgBtC,EAASA,GAAUe,EAAkB,SAAW,kBA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YA,EACZD,OAAQA,EACRE,MAAOA,EACPC,QAASgG,EACT/F,SAAUoG,EACVnG,IAAKA,EACLC,SAAUA,EACVC,IAAKA,EACLC,mBAAoBA,EACpBC,OAAQA,EAASA,EAAS,mBAAgByB,EAC1CvB,cAAeA,EACfD,YAAaA,EACbE,sBAAuBA,EACvBC,MAAO2D,MAIb"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
define(['exports', 'preact/jsx-runtime', 'preact/hooks', './mergeProps-bcfa6a92', './classNames-08d99695', './useId-c9578d26', './UNSAFE_NavigationList/themes/NavigationListStyles.css', './collectionUtils-6740111c', './useCollectionFocusRing-64636529', './useCurrentKey-00f81f0b', 'preact/compat', './useTestId-82cf22a4', './UNSAFE_Text/themes/TextStyles.css', './BaseNavigationListItem-4a940426', './Flex-1f27b601', './logger-0f873e29', 'preact', './useTooltipControlled-abf886f2', 'css!./IconStyle.styles.css', './UNSAFE_NavigationList/themes/NavigationListItemStyles.css', 'module', './UNSAFE_NavigationList/themes/redwood/NavigationListItemVariants.css', './LayerHost-eab40731'], (function(e,t,n,o,r,s,i,a,c,l,u,d,y,g,f,m,v,b,h,N,I,K,x){"use strict";const C=(e,t,n)=>{const o=e.closest(t),r=e.closest(n);return o?.contains(r)?null:a.keyExtractor(e,t)},S=(e,t,n)=>{const o=n.indexOf(e);if(o>0){const e=n[o===n.length-1?o-1:o+1];if(-1!==t.indexOf(e))return e}return t[0]},L=u.forwardRef((({children:e,selection:y,onSelectionChange:f,onRemove:m,"aria-label":v,"aria-labelledby":b,testId:h},N)=>{const I=n.useRef(null),{showFocusRing:K,currentKey:x,onCurrentKeyChange:L,containerHandlers:R,onKeyDown:w}=function({containerRef:e,selection:t,onRemove:r,onSelectionChange:s,children:i}){const u='[role="tab"]',[d,y]=n.useState(t),g=n.useCallback((e=>{y(e.value)}),[]),{currentKeyProps:f}=l.useCurrentKey((e=>r?C(e,u,"[data-oj-navigationlist-item-remove-icon]"):a.keyExtractor(e,u)),!1,a.getPrevNextKeyUsingRef(e,d,!0,u),a.getPrevNextKeyUsingRef(e,d,!1,u),void 0,void 0,d,g),[m,v]=c.useCollectionFocusRing(e,["Home","End","ArrowUp","ArrowDown"]),b={onFocus:n.useCallback((()=>{if(e.current&&void 0===d){const t=a.getFirstVisibleKey(e.current,u);t&&y(t)}}),[d,e])},h=n.useRef();n.useEffect((()=>{if(e.current){const t=Array.from(e.current.querySelectorAll(u),(e=>a.getKey(e)));if(null!=d&&-1!==t.indexOf(d)){const t=a.findElementByKey(e.current,d,u);t.scrollIntoViewIfNeeded?t.scrollIntoViewIfNeeded():t.scrollIntoView({block:"nearest"})}else d&&-1===t.indexOf(d)&&(h.current?y(S(d,t,h.current)):y(t[0])),h.current=t}}),[i,d,e]);const N=n.useCallback((t=>{if(("Home"===t.key||"End"===t.key)&&e.current&&d){const n=Array.from(e.current.querySelectorAll(u),(e=>a.getKey(e)));g?.({value:n["Home"===t.key?0:n.length-1]})}d&&"Enter"===t.key&&s?.({value:d,reason:"keyboard"}),d&&"Delete"===t.key&&r?.({value:d})}),[d,s,r,g,e]);return{showFocusRing:m,currentKey:d,onCurrentKeyChange:g,onKeyDown:N,containerHandlers:o.mergeProps(v,f,b)}}({containerRef:I,selection:y,onRemove:m,onSelectionChange:f,children:e}),k={onKeyDown:w},p=r.classNames([i.navigationListStyles.uListStyle]),F=s.useId()+"_",E=d.useTestId(h);return u.useImperativeHandle(N,(()=>({focus:()=>{I.current&&I.current.focus()},blur:()=>{I.current&&I.current.focus()}}))),t.jsx("ul",{"aria-label":v,"aria-labelledby":b,role:"tablist",ref:I,"aria-orientation":"vertical",tabIndex:0,"aria-activedescendant":x?F+x:"",...o.mergeProps(k,R),...E,class:p,children:t.jsx(g.NavigationListContext.Provider,{value:{selection:y,onSelectionChange:f,onCurrentKeyChange:L,currentKey:x,showFocusRing:K,navigationListItemPrefix:F,onRemove:m},children:e})})}));e.NavigationList=L,e.NavigationListItem=function({itemKey:e,label:n,badge:o,metadata:r,severity:s}){return t.jsx(g.BaseNavigationListItem,{itemKey:e,label:n,badge:o,metadata:r,severity:s})}}));
|
|
2
|
+
//# sourceMappingURL=NavigationListItem-0a4f8a9c.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationListItem-c96ac144.js","sources":["../../src/UNSAFE_NavigationList/useNavigationList.ts","../../src/UNSAFE_NavigationList/NavigationList.tsx","../../src/UNSAFE_NavigationList/NavigationListItem.tsx"],"sourcesContent":["import { useState, useCallback, MutableRef, useRef, useEffect } from 'preact/hooks';\nimport {\n keyExtractor,\n getFirstVisibleKey,\n getKey,\n getPrevNextKeyUsingRef,\n findElementByKey\n} from '../utils/PRIVATE_collectionUtils';\nimport { mergeProps } from '../utils/UNSAFE_mergeProps';\nimport { useCollectionFocusRing } from '../hooks/PRIVATE_useCollectionFocusRing';\nimport { useCurrentKey } from '../hooks/PRIVATE_useCurrentKey';\nimport { NavigationListContextProps } from '../UNSAFE_NavigationListCommon';\n\nimport { ComponentChildren } from 'preact';\n\n/**\n * type for payload of current key change event handler\n */\ntype CurrentKeyDetail<K> = {\n value: K;\n};\n/**\n * type for payload of selection change event handler\n */\ntype SelectionDetail<K> = {\n value: K;\n reason: 'pointer' | 'keyboard';\n};\n/**\n * type for payload of remove event handler\n */\ntype RemoveDetail<K> = {\n value: K;\n};\n\n/*TODO: JET-58534. Create a hook to share some logic between navlist and tabbar. Hook will be used inside this one. */\nexport function useNavigationList<K extends string | number>({\n containerRef,\n selection,\n onRemove,\n onSelectionChange,\n children\n}: {\n containerRef: MutableRef<HTMLUListElement>;\n selection?: K;\n onRemove?: <K extends string | number>(detail: RemoveDetail<K>) => void;\n onSelectionChange?: <K extends string | number>(detail: SelectionDetail<K>) => void;\n children: ComponentChildren;\n}) {\n const ITEM_SELECTOR = '[role=\"tab\"]';\n const REMOVAL_ICON_SELECTOR = '[data-oj-navigationlist-item-remove-icon]';\n const [currentKey, setCurrentKey] = useState<K | undefined>(selection);\n\n const onCurrentKeyChange = useCallback((detail: CurrentKeyDetail<K | undefined>) => {\n setCurrentKey(detail.value);\n }, []) as NavigationListContextProps<K>['onCurrentKeyChange'];\n\n const { currentKeyProps } = useCurrentKey(\n (element) =>\n onRemove\n ? (extractOnlyItemKey(element, ITEM_SELECTOR, REMOVAL_ICON_SELECTOR) as K)\n : keyExtractor(element, ITEM_SELECTOR),\n false,\n getPrevNextKeyUsingRef(containerRef, currentKey, true, ITEM_SELECTOR),\n getPrevNextKeyUsingRef(containerRef, currentKey, false, ITEM_SELECTOR),\n undefined,\n undefined,\n currentKey,\n onCurrentKeyChange\n );\n\n const [showFocusRing, focusRingProps] = useCollectionFocusRing(containerRef, [\n 'Home',\n 'End',\n 'ArrowUp',\n 'ArrowDown'\n ]);\n\n const onFocus = useCallback(() => {\n if (containerRef.current && currentKey === undefined) {\n const key = getFirstVisibleKey(containerRef.current, ITEM_SELECTOR);\n if (key) {\n setCurrentKey(key as K);\n }\n }\n }, [currentKey, containerRef]);\n\n const onFocusProps = { onFocus };\n const prevNavItems = useRef<K[]>();\n\n useEffect(() => {\n if (containerRef.current) {\n const navListItemKeys = Array.from(\n containerRef.current.querySelectorAll(ITEM_SELECTOR),\n (elem) => getKey(elem as HTMLElement) as K\n );\n if (currentKey != null && navListItemKeys.indexOf(currentKey) !== -1) {\n const navListItem = findElementByKey(\n containerRef.current,\n currentKey,\n ITEM_SELECTOR\n ) as any;\n if (navListItem.scrollIntoViewIfNeeded) {\n // for some browsers, we'll need the non-standard scrollIntoViewIfNeeded\n navListItem.scrollIntoViewIfNeeded();\n } else {\n navListItem.scrollIntoView({ block: 'nearest' });\n }\n } else {\n if (currentKey && navListItemKeys.indexOf(currentKey) === -1) {\n prevNavItems.current\n ? setCurrentKey(findNextCurrentKey(currentKey, navListItemKeys, prevNavItems.current))\n : setCurrentKey(navListItemKeys[0] as K);\n }\n prevNavItems.current = navListItemKeys;\n }\n }\n }, [children, currentKey, containerRef]);\n\n const onKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if ((event.key === 'Home' || event.key === 'End') && containerRef.current && currentKey) {\n const navListItemKey = Array.from(\n containerRef.current.querySelectorAll(ITEM_SELECTOR),\n (elem) => getKey(elem as HTMLElement) as K\n );\n onCurrentKeyChange?.({\n value: navListItemKey[event.key === 'Home' ? 0 : navListItemKey.length - 1] as K\n });\n }\n if (currentKey && event.key === 'Enter') {\n onSelectionChange?.({\n value: currentKey as K,\n reason: 'keyboard'\n });\n }\n if (currentKey && event.key === 'Delete') {\n onRemove?.({ value: currentKey as K });\n }\n },\n [currentKey, onSelectionChange, onRemove, onCurrentKeyChange, containerRef]\n );\n\n return {\n showFocusRing,\n currentKey,\n onCurrentKeyChange,\n onKeyDown,\n containerHandlers: mergeProps(focusRingProps, currentKeyProps, onFocusProps)\n };\n}\n\nconst extractOnlyItemKey = (element: HTMLElement, itemSelector: string, itemEliminator: string) => {\n const navigationListItem = element.closest(itemSelector);\n const removeButton = element.closest(itemEliminator);\n return navigationListItem?.contains(removeButton) ? null : keyExtractor(element, itemSelector);\n};\n\nconst findNextCurrentKey = <K>(currentKey: K, currNavs: K[], prevNavs: K[]) => {\n const index = prevNavs.indexOf(currentKey);\n if (index > 0) {\n const nextIndex = index === prevNavs.length - 1 ? index - 1 : index + 1;\n const nextKey = prevNavs[nextIndex];\n if (currNavs.indexOf(nextKey) !== -1) {\n return nextKey;\n }\n }\n // update current key to be the first one if we can't find a suitable next key\n return currNavs[0];\n};\n","import { Ref } from 'preact';\nimport { MutableRef, useRef } from 'preact/hooks';\nimport { mergeProps } from '../utils/UNSAFE_mergeProps';\nimport { classNames } from '../utils/UNSAFE_classNames';\nimport { useId } from '../hooks/UNSAFE_useId';\nimport { navigationListStyles } from './themes/NavigationListStyles.css';\nimport { useNavigationList } from './useNavigationList';\nimport { forwardRef, useImperativeHandle } from 'preact/compat';\nimport { useTestId, TestIdProps } from '../hooks/UNSAFE_useTestId';\nimport { NavigationListProps, NavigationListContext } from '../UNSAFE_NavigationListCommon';\nexport { RemovableNavigationListItem } from '../UNSAFE_NavigationListCommon';\n\nexport type FocusableHandle = {\n focus: () => void;\n blur: () => void;\n};\n\nexport const NavigationList = forwardRef(\n <K extends string | number>(\n {\n children,\n selection,\n onSelectionChange,\n onRemove,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelLedBy,\n testId\n }: NavigationListProps<K> & TestIdProps,\n ref?: Ref<FocusableHandle>\n ) => {\n const containerRef = useRef<HTMLUListElement>(null);\n\n const { showFocusRing, currentKey, onCurrentKeyChange, containerHandlers, onKeyDown } =\n useNavigationList({\n containerRef: containerRef as MutableRef<HTMLUListElement>,\n selection,\n onRemove,\n onSelectionChange,\n children\n });\n\n const eventProps = { onKeyDown };\n const navigationListClass = classNames([navigationListStyles.uListStyle]);\n const navigationListItemPrefix = useId() + '_';\n const testIdProps = useTestId(testId);\n\n //Allows to call focus on rootRef without having to expose it\n useImperativeHandle(ref!, () => ({\n focus: () => {\n if (containerRef.current) {\n containerRef.current.focus();\n }\n },\n blur: () => {\n if (containerRef.current) {\n containerRef.current.focus();\n }\n }\n }));\n\n return (\n <ul\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelLedBy}\n role=\"tablist\"\n ref={containerRef}\n aria-orientation={'vertical'}\n tabIndex={0}\n aria-activedescendant={currentKey ? navigationListItemPrefix + currentKey : ''}\n {...mergeProps(eventProps, containerHandlers)}\n {...testIdProps}\n class={navigationListClass}>\n <NavigationListContext.Provider\n value={{\n selection,\n onSelectionChange,\n onCurrentKeyChange,\n currentKey,\n showFocusRing,\n navigationListItemPrefix,\n onRemove\n }}>\n {children}\n </NavigationListContext.Provider>\n </ul>\n );\n }\n);\n","import {\n BaseNavigationListItem,\n BaseNavigationListItemProps\n} from '../UNSAFE_NavigationListCommon/BaseNavigationListItem';\n\nexport type NavigationListItemProps<K extends string | number> = Omit<\n BaseNavigationListItemProps<K>,\n 'removeIcon'\n>;\n\nexport function NavigationListItem<K extends string | number>({\n itemKey,\n label,\n badge,\n metadata,\n severity\n}: NavigationListItemProps<K>) {\n return (\n <BaseNavigationListItem\n itemKey={itemKey}\n label={label}\n badge={badge}\n metadata={metadata}\n severity={severity}\n />\n );\n}\n"],"names":["extractOnlyItemKey","element","itemSelector","itemEliminator","navigationListItem","closest","removeButton","contains","keyExtractor","findNextCurrentKey","currentKey","currNavs","prevNavs","index","indexOf","nextKey","length","NavigationList","forwardRef","children","selection","onSelectionChange","onRemove","ariaLabel","ariaLabelLedBy","testId","ref","containerRef","useRef","showFocusRing","onCurrentKeyChange","containerHandlers","onKeyDown","ITEM_SELECTOR","setCurrentKey","useState","useCallback","detail","value","currentKeyProps","useCurrentKey","getPrevNextKeyUsingRef","undefined","focusRingProps","useCollectionFocusRing","onFocusProps","onFocus","current","key","getFirstVisibleKey","prevNavItems","useEffect","navListItemKeys","Array","from","querySelectorAll","elem","getKey","navListItem","findElementByKey","scrollIntoViewIfNeeded","scrollIntoView","block","event","navListItemKey","reason","mergeProps","useNavigationList","eventProps","navigationListClass","classNames","navigationListStyles","uListStyle","navigationListItemPrefix","useId","testIdProps","useTestId","useImperativeHandle","focus","blur","_jsx","role","tabIndex","class","NavigationListContext","Provider","itemKey","label","badge","metadata","severity","jsx","BaseNavigationListItem"],"mappings":"6YAwJA,MAAMA,EAAqB,CAACC,EAAsBC,EAAsBC,KACtE,MAAMC,EAAqBH,EAAQI,QAAQH,GACrCI,EAAeL,EAAQI,QAAQF,GACrC,OAAOC,GAAoBG,SAASD,GAAgB,KAAOE,eAAaP,EAASC,EAAa,EAG1FO,EAAqB,CAAIC,EAAeC,EAAeC,KAC3D,MAAMC,EAAQD,EAASE,QAAQJ,GAC/B,GAAIG,EAAQ,EAAG,CACb,MACME,EAAUH,EADEC,IAAUD,EAASI,OAAS,EAAIH,EAAQ,EAAIA,EAAQ,GAEtE,IAAmC,IAA/BF,EAASG,QAAQC,GACnB,OAAOA,CAEV,CAED,OAAOJ,EAAS,EAAE,ECvJPM,EAAiBC,EAAAA,YAC5B,EAEIC,WACAC,YACAC,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B4C,EACJQ,MAAOd,EACPlD,SAAA6D,EAAAA,IAACI,EAAAA,sBAAsBC,SACrB,CAAA/C,MAAO,CACLlB,YACAC,oBACAS,qBACApB,aACAmB,gBACA4C,2BACAnD,YACDH,SACAA,KAGL,4CC3EU,UAA8CmE,QAC5DA,EAAOC,MACPA,EAAKC,MACLA,EAAKC,SACLA,EAAQC,SACRA,IAEA,OACEV,EAACW,IAAAC,EAAsBA,uBACrB,CAAAN,QAASA,EACTC,MAAOA,EACPC,MAAOA,EACPC,SAAUA,EACVC,SAAUA,GAGhB"}
|
|
1
|
+
{"version":3,"file":"NavigationListItem-0a4f8a9c.js","sources":["../../src/UNSAFE_NavigationList/useNavigationList.ts","../../src/UNSAFE_NavigationList/NavigationList.tsx","../../src/UNSAFE_NavigationList/NavigationListItem.tsx"],"sourcesContent":["import { useState, useCallback, MutableRef, useRef, useEffect } from 'preact/hooks';\nimport {\n keyExtractor,\n getFirstVisibleKey,\n getKey,\n getPrevNextKeyUsingRef,\n findElementByKey\n} from '../utils/PRIVATE_collectionUtils';\nimport { mergeProps } from '../utils/UNSAFE_mergeProps';\nimport { useCollectionFocusRing } from '../hooks/PRIVATE_useCollectionFocusRing';\nimport { useCurrentKey } from '../hooks/PRIVATE_useCurrentKey';\nimport { NavigationListContextProps } from '../UNSAFE_NavigationListCommon';\n\nimport { ComponentChildren } from 'preact';\n\n/**\n * type for payload of current key change event handler\n */\ntype CurrentKeyDetail<K> = {\n value: K;\n};\n/**\n * type for payload of selection change event handler\n */\ntype SelectionDetail<K> = {\n value: K;\n reason: 'pointer' | 'keyboard';\n};\n/**\n * type for payload of remove event handler\n */\ntype RemoveDetail<K> = {\n value: K;\n};\n\n/*TODO: JET-58534. Create a hook to share some logic between navlist and tabbar. Hook will be used inside this one. */\nexport function useNavigationList<K extends string | number>({\n containerRef,\n selection,\n onRemove,\n onSelectionChange,\n children\n}: {\n containerRef: MutableRef<HTMLUListElement>;\n selection?: K;\n onRemove?: <K extends string | number>(detail: RemoveDetail<K>) => void;\n onSelectionChange?: <K extends string | number>(detail: SelectionDetail<K>) => void;\n children: ComponentChildren;\n}) {\n const ITEM_SELECTOR = '[role=\"tab\"]';\n const REMOVAL_ICON_SELECTOR = '[data-oj-navigationlist-item-remove-icon]';\n const [currentKey, setCurrentKey] = useState<K | undefined>(selection);\n\n const onCurrentKeyChange = useCallback((detail: CurrentKeyDetail<K | undefined>) => {\n setCurrentKey(detail.value);\n }, []) as NavigationListContextProps<K>['onCurrentKeyChange'];\n\n const { currentKeyProps } = useCurrentKey(\n (element) =>\n onRemove\n ? (extractOnlyItemKey(element, ITEM_SELECTOR, REMOVAL_ICON_SELECTOR) as K)\n : keyExtractor(element, ITEM_SELECTOR),\n false,\n getPrevNextKeyUsingRef(containerRef, currentKey, true, ITEM_SELECTOR),\n getPrevNextKeyUsingRef(containerRef, currentKey, false, ITEM_SELECTOR),\n undefined,\n undefined,\n currentKey,\n onCurrentKeyChange\n );\n\n const [showFocusRing, focusRingProps] = useCollectionFocusRing(containerRef, [\n 'Home',\n 'End',\n 'ArrowUp',\n 'ArrowDown'\n ]);\n\n const onFocus = useCallback(() => {\n if (containerRef.current && currentKey === undefined) {\n const key = getFirstVisibleKey(containerRef.current, ITEM_SELECTOR);\n if (key) {\n setCurrentKey(key as K);\n }\n }\n }, [currentKey, containerRef]);\n\n const onFocusProps = { onFocus };\n const prevNavItems = useRef<K[]>();\n\n useEffect(() => {\n if (containerRef.current) {\n const navListItemKeys = Array.from(\n containerRef.current.querySelectorAll(ITEM_SELECTOR),\n (elem) => getKey(elem as HTMLElement) as K\n );\n if (currentKey != null && navListItemKeys.indexOf(currentKey) !== -1) {\n const navListItem = findElementByKey(\n containerRef.current,\n currentKey,\n ITEM_SELECTOR\n ) as any;\n if (navListItem.scrollIntoViewIfNeeded) {\n // for some browsers, we'll need the non-standard scrollIntoViewIfNeeded\n navListItem.scrollIntoViewIfNeeded();\n } else {\n navListItem.scrollIntoView({ block: 'nearest' });\n }\n } else {\n if (currentKey && navListItemKeys.indexOf(currentKey) === -1) {\n prevNavItems.current\n ? setCurrentKey(findNextCurrentKey(currentKey, navListItemKeys, prevNavItems.current))\n : setCurrentKey(navListItemKeys[0] as K);\n }\n prevNavItems.current = navListItemKeys;\n }\n }\n }, [children, currentKey, containerRef]);\n\n const onKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if ((event.key === 'Home' || event.key === 'End') && containerRef.current && currentKey) {\n const navListItemKey = Array.from(\n containerRef.current.querySelectorAll(ITEM_SELECTOR),\n (elem) => getKey(elem as HTMLElement) as K\n );\n onCurrentKeyChange?.({\n value: navListItemKey[event.key === 'Home' ? 0 : navListItemKey.length - 1] as K\n });\n }\n if (currentKey && event.key === 'Enter') {\n onSelectionChange?.({\n value: currentKey as K,\n reason: 'keyboard'\n });\n }\n if (currentKey && event.key === 'Delete') {\n onRemove?.({ value: currentKey as K });\n }\n },\n [currentKey, onSelectionChange, onRemove, onCurrentKeyChange, containerRef]\n );\n\n return {\n showFocusRing,\n currentKey,\n onCurrentKeyChange,\n onKeyDown,\n containerHandlers: mergeProps(focusRingProps, currentKeyProps, onFocusProps)\n };\n}\n\nconst extractOnlyItemKey = (element: HTMLElement, itemSelector: string, itemEliminator: string) => {\n const navigationListItem = element.closest(itemSelector);\n const removeButton = element.closest(itemEliminator);\n return navigationListItem?.contains(removeButton) ? null : keyExtractor(element, itemSelector);\n};\n\nconst findNextCurrentKey = <K>(currentKey: K, currNavs: K[], prevNavs: K[]) => {\n const index = prevNavs.indexOf(currentKey);\n if (index > 0) {\n const nextIndex = index === prevNavs.length - 1 ? index - 1 : index + 1;\n const nextKey = prevNavs[nextIndex];\n if (currNavs.indexOf(nextKey) !== -1) {\n return nextKey;\n }\n }\n // update current key to be the first one if we can't find a suitable next key\n return currNavs[0];\n};\n","import { Ref } from 'preact';\nimport { MutableRef, useRef } from 'preact/hooks';\nimport { mergeProps } from '../utils/UNSAFE_mergeProps';\nimport { classNames } from '../utils/UNSAFE_classNames';\nimport { useId } from '../hooks/UNSAFE_useId';\nimport { navigationListStyles } from './themes/NavigationListStyles.css';\nimport { useNavigationList } from './useNavigationList';\nimport { forwardRef, useImperativeHandle } from 'preact/compat';\nimport { useTestId, TestIdProps } from '../hooks/UNSAFE_useTestId';\nimport { NavigationListProps, NavigationListContext } from '../UNSAFE_NavigationListCommon';\nexport { RemovableNavigationListItem } from '../UNSAFE_NavigationListCommon';\n\nexport type FocusableHandle = {\n focus: () => void;\n blur: () => void;\n};\n\nexport const NavigationList = forwardRef(\n <K extends string | number>(\n {\n children,\n selection,\n onSelectionChange,\n onRemove,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelLedBy,\n testId\n }: NavigationListProps<K> & TestIdProps,\n ref?: Ref<FocusableHandle>\n ) => {\n const containerRef = useRef<HTMLUListElement>(null);\n\n const { showFocusRing, currentKey, onCurrentKeyChange, containerHandlers, onKeyDown } =\n useNavigationList({\n containerRef: containerRef as MutableRef<HTMLUListElement>,\n selection,\n onRemove,\n onSelectionChange,\n children\n });\n\n const eventProps = { onKeyDown };\n const navigationListClass = classNames([navigationListStyles.uListStyle]);\n const navigationListItemPrefix = useId() + '_';\n const testIdProps = useTestId(testId);\n\n //Allows to call focus on rootRef without having to expose it\n useImperativeHandle(ref!, () => ({\n focus: () => {\n if (containerRef.current) {\n containerRef.current.focus();\n }\n },\n blur: () => {\n if (containerRef.current) {\n containerRef.current.focus();\n }\n }\n }));\n\n return (\n <ul\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelLedBy}\n role=\"tablist\"\n ref={containerRef}\n aria-orientation={'vertical'}\n tabIndex={0}\n aria-activedescendant={currentKey ? navigationListItemPrefix + currentKey : ''}\n {...mergeProps(eventProps, containerHandlers)}\n {...testIdProps}\n class={navigationListClass}>\n <NavigationListContext.Provider\n value={{\n selection,\n onSelectionChange,\n onCurrentKeyChange,\n currentKey,\n showFocusRing,\n navigationListItemPrefix,\n onRemove\n }}>\n {children}\n </NavigationListContext.Provider>\n </ul>\n );\n }\n);\n","import {\n BaseNavigationListItem,\n BaseNavigationListItemProps\n} from '../UNSAFE_NavigationListCommon/BaseNavigationListItem';\n\nexport type NavigationListItemProps<K extends string | number> = Omit<\n BaseNavigationListItemProps<K>,\n 'removeIcon'\n>;\n\nexport function NavigationListItem<K extends string | number>({\n itemKey,\n label,\n badge,\n metadata,\n severity\n}: NavigationListItemProps<K>) {\n return (\n <BaseNavigationListItem\n itemKey={itemKey}\n label={label}\n badge={badge}\n metadata={metadata}\n severity={severity}\n />\n );\n}\n"],"names":["extractOnlyItemKey","element","itemSelector","itemEliminator","navigationListItem","closest","removeButton","contains","keyExtractor","findNextCurrentKey","currentKey","currNavs","prevNavs","index","indexOf","nextKey","length","NavigationList","forwardRef","children","selection","onSelectionChange","onRemove","ariaLabel","ariaLabelLedBy","testId","ref","containerRef","useRef","showFocusRing","onCurrentKeyChange","containerHandlers","onKeyDown","ITEM_SELECTOR","setCurrentKey","useState","useCallback","detail","value","currentKeyProps","useCurrentKey","getPrevNextKeyUsingRef","undefined","focusRingProps","useCollectionFocusRing","onFocusProps","onFocus","current","key","getFirstVisibleKey","prevNavItems","useEffect","navListItemKeys","Array","from","querySelectorAll","elem","getKey","navListItem","findElementByKey","scrollIntoViewIfNeeded","scrollIntoView","block","event","navListItemKey","reason","mergeProps","useNavigationList","eventProps","navigationListClass","classNames","navigationListStyles","uListStyle","navigationListItemPrefix","useId","testIdProps","useTestId","useImperativeHandle","focus","blur","_jsx","role","tabIndex","class","NavigationListContext","Provider","itemKey","label","badge","metadata","severity","jsx","BaseNavigationListItem"],"mappings":"8xBAwJA,MAAMA,EAAqB,CAACC,EAAsBC,EAAsBC,KACtE,MAAMC,EAAqBH,EAAQI,QAAQH,GACrCI,EAAeL,EAAQI,QAAQF,GACrC,OAAOC,GAAoBG,SAASD,GAAgB,KAAOE,eAAaP,EAASC,EAAa,EAG1FO,EAAqB,CAAIC,EAAeC,EAAeC,KAC3D,MAAMC,EAAQD,EAASE,QAAQJ,GAC/B,G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EAEHC,KAAM,KACApD,EAAaoB,SACfpB,EAAaoB,QAAQ+B,OACtB,MAKHE,EAAAA,uBACczD,EAAS,kBACJC,EACjByD,KAAK,UACLvD,IAAKC,EAAY,mBACC,WAClBuD,SAAU,EACa,wBAAAxE,EAAa+D,EAA2B/D,EAAa,MACxEwD,EAAAA,WAAWE,EAAYrC,MACvB4C,EACJQ,MAAOd,EACPlD,SAAA6D,EAAAA,IAACI,EAAAA,sBAAsBC,SACrB,CAAA/C,MAAO,CACLlB,YACAC,oBACAS,qBACApB,aACAmB,gBACA4C,2BACAnD,YACDH,SACAA,KAGL,4CC3EU,UAA8CmE,QAC5DA,EAAOC,MACPA,EAAKC,MACLA,EAAKC,SACLA,EAAQC,SACRA,IAEA,OACEV,EAACW,IAAAC,EAAsBA,uBACrB,CAAAN,QAASA,EACTC,MAAOA,EACPC,MAAOA,EACPC,SAAUA,EACVC,SAAUA,GAGhB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(['exports', 'preact/jsx-runtime', 'preact', 'preact/hooks', './useTranslationBundle-6ef0dab6', './clientHints-030d25aa', './mergeInterpolations-9ede4cf7', './flexitem-5db48325', './classNames-08d99695', './Icon-599f55f3', './useTabBarContext-15a23bb6', './Dropdown-de472a1d', './Sheet-6447f399', './TabBarItem-7f4a5e0b', './UNSAFE_TabBarCommon/themes/OverflowTabBarItemStyles.css', './NavigationListItem-
|
|
2
|
-
//# sourceMappingURL=OverflowTabBarItem-
|
|
1
|
+
define(['exports', 'preact/jsx-runtime', 'preact', 'preact/hooks', './useTranslationBundle-6ef0dab6', './clientHints-030d25aa', './mergeInterpolations-9ede4cf7', './flexitem-5db48325', './classNames-08d99695', './Icon-599f55f3', './useTabBarContext-15a23bb6', './Dropdown-de472a1d', './Sheet-6447f399', './TabBarItem-7f4a5e0b', './UNSAFE_TabBarCommon/themes/OverflowTabBarItemStyles.css', './NavigationListItem-0a4f8a9c', './RemovableNavigationListItem-87ecbae7'], (function(e,a,t,n,s,o,i,l,r,c,d,m,u,b,f,v,p){"use strict";const x=e=>a.jsx(c.Icon,{viewBox:"0 0 24 24",...e,children:a.jsx("g",{fill:"none",children:a.jsx("path",{d:"M6 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm8 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm8 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0z",fill:"currentcolor"})})});const g=()=>{const{deviceType:e}=o.getClientHints();return"phone"===e};e.OverflowTabBarItem=function({overflowItemKey:e,icon:o,badge:c,overflowItems:h,isOpen:y,onClose:I}){const{selection:j,showFocusRing:C,isEdgeBottom:w,onSelect:B,onRemove:R,layout:T}=d.useTabBarContext(),K=n.useRef(!1),O=n.useRef(null),N=t.createRef(),k=n.useCallback((e=>{"pointer"===e.reason&&(K.current=!0),B?.({value:e.value}),I?.({reason:"itemAction"})}),[B,I]),F=n.useCallback((e=>{I?.({reason:e.reason})}),[I]),L=n.useCallback((()=>{I?.({reason:"dismissed"})}),[I]),S=C&&!K.current&&!g(),D=h?.find((e=>e.itemKey===j))?.tabPanelId,z=s.useTranslationBundle("@oracle/oraclejet-preact"),A=void 0!==j&&(E=j,null!=h?.find((e=>e.itemKey===E)));var E;const H=i.mergeInterpolations([...Object.values(l.flexitemInterpolations)])({flex:"stretch"===T?"1 0 auto":"0 0 auto"}),M=r.classNames([f.styles.navContainerBase]),P=n.useRef(null),U=n.useCallback((e=>{"ArrowDown"===e.key&&(e.preventDefault(),N.current?.focus())}),[N]),_=n.useCallback((()=>a.jsx("div",{onKeyDown:U,tabIndex:0,ref:P,class:M,children:a.jsx(v.NavigationList,{ref:N,selection:j,onSelectionChange:k,onRemove:R,children:h?.map((e=>e.isRemovable?a.jsx(p.RemovableNavigationListItem,{itemKey:e.itemKey,label:e.label,badge:e.badge,metadata:e.metadata,severity:e.severity}):a.jsx(v.NavigationListItem,{itemKey:e.itemKey,label:e.label,badge:e.badge,metadata:e.metadata,severity:e.severity})))})})),[U,M,N,j,k,R,h]);return a.jsxs(a.Fragment,{children:[h&&h.length>0&&a.jsx("div",{ref:O,style:H,children:a.jsx(b.BaseTabBarItem,{"aria-controls":D,itemKey:e,label:z.overflowItemLabel(),icon:o||a.jsx(x,{}),badge:c,showFocusRingOverride:S,selectionOverride:A,displayOverride:"icons","aria-haspopup":!0})}),g()?a.jsx(u.Sheet,{isOpen:y,onClose:L,children:_()}):a.jsx(m.Dropdown,{initialFocus:"firstFocusable",isOpen:y,onClose:F,placement:w?"top-end":"bottom-end",anchorRef:O,children:_()})]})}}));
|
|
2
|
+
//# sourceMappingURL=OverflowTabBarItem-aae4eb2f.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverflowTabBarItem-f781e527.js","sources":["../../src/UNSAFE_RedwoodIcons/OverflowH/OverflowH.tsx","../../src/UNSAFE_TabBarCommon/OverflowTabBarItem.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * Licensed under The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n// DO NOT MODIFY THIS FILE MANUALLY!\n// This file is automatically generated based on the corresponding SVG image in\n// the packages/oraclejet-preact/resources/icons folder.\nimport { ComponentProps } from 'preact';\nimport { Icon } from '../../UNSAFE_Icon';\ntype Props = Omit<ComponentProps<typeof Icon>, 'viewBox'>;\nconst SvgOverflowH = (props: Props) => (\n <Icon viewBox=\"0 0 24 24\" {...props}>\n <g fill=\"none\">\n <path\n d=\"M6 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm8 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm8 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0z\"\n fill=\"currentcolor\"\n />\n </g>\n </Icon>\n);\nexport { SvgOverflowH as OverflowH };\n","import { ComponentChild, ComponentProps, createRef } from 'preact';\nimport { useCallback, useRef } from 'preact/hooks';\nimport type { BundleType } from '../resources/nls/bundle';\nimport { useTranslationBundle } from '../hooks/UNSAFE_useTranslationBundle';\nimport { getClientHints } from '../utils/PRIVATE_clientHints';\nimport { mergeInterpolations } from '../utils/UNSAFE_mergeInterpolations';\nimport { flexitemInterpolations } from '../utils/UNSAFE_interpolations/flexitem';\nimport type { FlexitemProps } from '../utils/UNSAFE_interpolations/flexitem';\nimport { classNames } from '../utils/UNSAFE_classNames';\nimport {\n NavigationListItem,\n NavigationList,\n RemovableNavigationListItem,\n FocusableHandle\n} from '../UNSAFE_NavigationList';\nimport { OverflowH } from '../UNSAFE_RedwoodIcons/OverflowH';\nimport { useTabBarContext } from './useTabBarContext';\nimport { Dropdown } from '../UNSAFE_Dropdown';\nimport { Sheet } from '../UNSAFE_Sheet';\nimport { BaseTabBarItem } from './BaseTabBarItem';\nimport { styles } from './themes/OverflowTabBarItemStyles.css';\nimport { TabBarItem } from './TabBarItem';\n\nexport type OverflowSelectionDetail<K> = {\n value: K;\n};\n\nexport type CloseDetail = {\n /**\n * dismissed represents dismissing the DropDown\n */\n reason: 'dismissed' | 'itemAction' | 'outsideMousedown';\n};\n\nexport type Item<K extends string | number> = Omit<\n ComponentProps<typeof TabBarItem<K>>,\n 'testId' | 'aria-controls'\n> & {\n isRemovable?: boolean;\n /**\n * Accepts the tabpanel element's ID associated with the tab item\n **/\n tabPanelId?: string;\n};\n\nexport type OverflowTabBarItemProps<K extends string | number> = {\n /**\n * Key of the TabBarItem\n */\n overflowItemKey: K;\n /**\n * Whether to open the popup\n */\n isOpen: boolean;\n /**\n * Property that triggers a callback when DropDown is supposed to be closed.\n */\n onClose?: (detail: CloseDetail) => void;\n /**\n * The icon of the OverflowTabBarItem\n */\n icon?: ComponentChild;\n /**\n * The content to be rendered inside the Badge component.\n */\n badge?: string;\n /**\n * An array of data used by NavigationList to render individual overflow items.\n */\n overflowItems?: Item<K>[];\n};\n\n/**\n * An OverflowTabBarItem renders TabBarItems in a device appropriate popup. OverflowTabBarItem is used internally in an OverflowTabBar.\n */\n\nexport function OverflowTabBarItem<K extends string | number>({\n overflowItemKey,\n icon,\n badge,\n overflowItems,\n isOpen,\n onClose\n}: OverflowTabBarItemProps<K>) {\n const { selection, showFocusRing, isEdgeBottom, onSelect, onRemove, layout } = useTabBarContext();\n\n const isPointerSelection = useRef<boolean>(false);\n\n const overflowTabBarItemRef = useRef<HTMLDivElement>(null);\n const navigationListRef = createRef<FocusableHandle>();\n\n const handleSelectionChange = useCallback<\n Required<ComponentProps<typeof NavigationList>>['onSelectionChange']\n >(\n (detail: { value: string | number; reason?: 'pointer' | 'keyboard' }) => {\n if (detail.reason === 'pointer') {\n isPointerSelection.current = true;\n }\n onSelect?.({ value: detail.value });\n onClose?.({ reason: 'itemAction' });\n },\n [onSelect, onClose]\n );\n\n const handleDropdownClose = useCallback(\n (e: CloseDetail) => {\n onClose?.({ reason: e.reason });\n },\n [onClose]\n );\n\n const handleSheetClose = useCallback(() => {\n onClose?.({ reason: 'dismissed' });\n }, [onClose]);\n\n //When NavigationList steals focus the app resets it. Not always would it be reset to\n //parent of OverflowTabBarItem. Though currentKey would be correct, but focusRing would would not be visible\n //Hence we check for isPointerSelection.current\n\n const focusRingRequirement = showFocusRing && !isPointerSelection.current && !getIsMobile();\n\n const overflowContainsKey = (searchKey: K) => {\n return overflowItems?.find((item) => item.itemKey === searchKey) != null;\n };\n\n const currentPanelId = overflowItems?.find((item) => item.itemKey === selection)?.tabPanelId;\n\n const translations = useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n\n const isSelected = selection !== undefined && overflowContainsKey(selection as K);\n\n //instead of specifying flex: '1 0 auto' in cssProps var\n const styleInterpolations = mergeInterpolations<FlexitemProps>([\n ...Object.values(flexitemInterpolations)\n ]);\n const flexDimensions = styleInterpolations({\n flex: layout === 'stretch' ? '1 0 auto' : '0 0 auto'\n });\n\n const navContainerClasses = classNames([styles.navContainerBase]);\n\n const navContainerRef = useRef<HTMLDivElement>(null);\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n navigationListRef.current?.focus();\n }\n },\n [navigationListRef]\n );\n const getNavigationList = useCallback(() => {\n return (\n <div onKeyDown={handleKeyDown} tabIndex={0} ref={navContainerRef} class={navContainerClasses}>\n <NavigationList\n ref={navigationListRef}\n selection={selection}\n onSelectionChange={handleSelectionChange}\n onRemove={onRemove}>\n {overflowItems?.map((item) =>\n item.isRemovable ? (\n <RemovableNavigationListItem\n itemKey={item.itemKey}\n label={item.label}\n badge={item.badge}\n metadata={item.metadata}\n severity={item.severity}\n />\n ) : (\n <NavigationListItem\n itemKey={item.itemKey}\n label={item.label}\n badge={item.badge}\n metadata={item.metadata}\n severity={item.severity}\n />\n )\n )}\n </NavigationList>\n </div>\n );\n }, [\n handleKeyDown,\n navContainerClasses,\n navigationListRef,\n selection,\n handleSelectionChange,\n onRemove,\n overflowItems\n ]);\n\n return (\n <>\n {overflowItems && overflowItems.length > 0 && (\n <div ref={overflowTabBarItemRef} style={flexDimensions}>\n <BaseTabBarItem\n aria-controls={currentPanelId}\n itemKey={overflowItemKey}\n label={translations.overflowItemLabel()}\n icon={icon ? icon : <OverflowH />}\n badge={badge}\n showFocusRingOverride={focusRingRequirement}\n selectionOverride={isSelected}\n displayOverride={'icons'}\n aria-haspopup={true}\n />\n </div>\n )}\n {getIsMobile() ? (\n <Sheet isOpen={isOpen} onClose={handleSheetClose}>\n {getNavigationList()}\n </Sheet>\n ) : (\n <Dropdown\n initialFocus=\"firstFocusable\"\n isOpen={isOpen}\n onClose={handleDropdownClose}\n placement={isEdgeBottom ? 'top-end' : 'bottom-end'}\n anchorRef={overflowTabBarItemRef}>\n {getNavigationList()}\n </Dropdown>\n )}\n </>\n );\n}\n\nconst getIsMobile = () => {\n const { deviceType } = getClientHints();\n return deviceType === 'phone';\n};\n"],"names":["SvgOverflowH","props","_jsx","jsx","Icon","viewBox","children","fill","d","getIsMobile","deviceType","getClientHints","overflowItemKey","icon","badge","overflowItems","isOpen","onClose","selection","showFocusRing","isEdgeBottom","onSelect","onRemove","layout","useTabBarContext","isPointerSelection","useRef","overflowTabBarItemRef","navigationListRef","createRef","handleSelectionChange","useCallback","detail","reason","current","value","handleDropdownClose","e","handleSheetClose","focusRingRequirement","currentPanelId","find","item","itemKey","tabPanelId","translations","useTranslationBundle","isSelected","undefined","searchKey","flexDimensions","mergeInterpolations","Object","values","flexitemInterpolations","styleInterpolations","flex","navContainerClasses","classNames","styles","navContainerBase","navContainerRef","handleKeyDown","event","key","preventDefault","focus","getNavigationList","onKeyDown","tabIndex","ref","class","NavigationList","onSelectionChange","map","isRemovable","RemovableNavigationListItem","label","metadata","severity","NavigationListItem","_jsxs","_Fragment","length","style","BaseTabBarItem","overflowItemLabel","OverflowH","showFocusRingOverride","selectionOverride","displayOverride","Sheet","Dropdown","initialFocus","placement","anchorRef"],"mappings":"0fAaA,MAAMA,EAAgBC,GACpBC,EAAAC,IAACC,EAAIA,KAAC,CAAAC,QAAQ,eAAgBJ,EAAKK,SACjCJ,EAAAA,IAAG,IAAA,CAAAK,KAAK,OACND,SAAAJ,MAAA,OAAA,CACEM,EAAE,uGACFD,KAAK,qBCgNb,MAAME,EAAc,KAClB,MAAMC,WAAEA,GAAeC,EAAAA,iBACvB,MAAsB,UAAfD,CAAsB,uBAxJf,UAA8CE,gBAC5DA,EAAeC,KACfA,EAAIC,MACJA,EAAKC,cACLA,EAAaC,OACbA,EAAMC,QACNA,IAEA,MAAMC,UAAEA,EAASC,cAAEA,EAAaC,aAAEA,EAAYC,SAAEA,EAAQC,SAAEA,EAAQC,OAAEA,GAAWC,EAAAA,mBAEzEC,EAAqBC,UAAgB,GAErCC,EAAwBD,SAAuB,MAC/CE,EAAoBC,EAAAA,YAEpBC,EAAwBC,eAG3BC,IACuB,YAAlBA,EAAOC,SACTR,EAAmBS,SAAU,GAE/Bb,IAAW,CAAEc,MAAOH,EAAOG,QAC3BlB,IAAU,CAAEgB,OAAQ,cAAe,GAErC,CAACZ,EAAUJ,IAGP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gE,SAAUpC,EAAKoC,SACfC,SAAUrC,EAAKqC,kBAO1B,CACDjB,EACAL,EACA7B,EACAV,EACAY,EACAR,EACAP,IAGF,OACEkE,EAAAA,KAAAC,EAAAA,SAAA,CAAA5E,SAAA,CACGS,GAAiBA,EAAcoE,OAAS,GACvCjF,EAAAC,IAAA,MAAA,CAAKmE,IAAK3C,EAAuByD,MAAOlC,EACtC5C,SAAAJ,EAAAC,IAACkF,iBAAc,CAAA,gBACE7C,EACfG,QAAS/B,EACTiE,MAAOhC,EAAayC,oBACpBzE,KAAMA,GAAcX,MAACqF,EAAS,CAAA,GAC9BzE,MAAOA,EACP0E,sBAAuBjD,EACvBkD,kBAAmB1C,EACnB2C,gBAAiB,QAAO,iBACT,MAIpBjF,IACCP,EAAAC,IAACwF,EAAKA,MAAA,CAAC3E,OAAQA,EAAQC,QAASqB,EAC7BhC,SAAA6D,MAGHjE,EAAAC,IAACyF,EAAQA,SACP,CAAAC,aAAa,iBACb7E,OAAQA,EACRC,QAASmB,EACT0D,UAAW1E,EAAe,UAAY,aACtC2E,UAAWpE,EACVrB,SAAA6D,QAKX"}
|
|
1
|
+
{"version":3,"file":"OverflowTabBarItem-aae4eb2f.js","sources":["../../src/UNSAFE_RedwoodIcons/OverflowH/OverflowH.tsx","../../src/UNSAFE_TabBarCommon/OverflowTabBarItem.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * Licensed under The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n// DO NOT MODIFY THIS FILE MANUALLY!\n// This file is automatically generated based on the corresponding SVG image in\n// the packages/oraclejet-preact/resources/icons folder.\nimport { ComponentProps } from 'preact';\nimport { Icon } from '../../UNSAFE_Icon';\ntype Props = Omit<ComponentProps<typeof Icon>, 'viewBox'>;\nconst SvgOverflowH = (props: Props) => (\n <Icon viewBox=\"0 0 24 24\" {...props}>\n <g fill=\"none\">\n <path\n d=\"M6 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm8 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm8 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0z\"\n fill=\"currentcolor\"\n />\n </g>\n </Icon>\n);\nexport { SvgOverflowH as OverflowH };\n","import { ComponentChild, ComponentProps, createRef } from 'preact';\nimport { useCallback, useRef } from 'preact/hooks';\nimport type { BundleType } from '../resources/nls/bundle';\nimport { useTranslationBundle } from '../hooks/UNSAFE_useTranslationBundle';\nimport { getClientHints } from '../utils/PRIVATE_clientHints';\nimport { mergeInterpolations } from '../utils/UNSAFE_mergeInterpolations';\nimport { flexitemInterpolations } from '../utils/UNSAFE_interpolations/flexitem';\nimport type { FlexitemProps } from '../utils/UNSAFE_interpolations/flexitem';\nimport { classNames } from '../utils/UNSAFE_classNames';\nimport {\n NavigationListItem,\n NavigationList,\n RemovableNavigationListItem,\n FocusableHandle\n} from '../UNSAFE_NavigationList';\nimport { OverflowH } from '../UNSAFE_RedwoodIcons/OverflowH';\nimport { useTabBarContext } from './useTabBarContext';\nimport { Dropdown } from '../UNSAFE_Dropdown';\nimport { Sheet } from '../UNSAFE_Sheet';\nimport { BaseTabBarItem } from './BaseTabBarItem';\nimport { styles } from './themes/OverflowTabBarItemStyles.css';\nimport { TabBarItem } from './TabBarItem';\n\nexport type OverflowSelectionDetail<K> = {\n value: K;\n};\n\nexport type CloseDetail = {\n /**\n * dismissed represents dismissing the DropDown\n */\n reason: 'dismissed' | 'itemAction' | 'outsideMousedown';\n};\n\nexport type Item<K extends string | number> = Omit<\n ComponentProps<typeof TabBarItem<K>>,\n 'testId' | 'aria-controls'\n> & {\n isRemovable?: boolean;\n /**\n * Accepts the tabpanel element's ID associated with the tab item\n **/\n tabPanelId?: string;\n};\n\nexport type OverflowTabBarItemProps<K extends string | number> = {\n /**\n * Key of the TabBarItem\n */\n overflowItemKey: K;\n /**\n * Whether to open the popup\n */\n isOpen: boolean;\n /**\n * Property that triggers a callback when DropDown is supposed to be closed.\n */\n onClose?: (detail: CloseDetail) => void;\n /**\n * The icon of the OverflowTabBarItem\n */\n icon?: ComponentChild;\n /**\n * The content to be rendered inside the Badge component.\n */\n badge?: string;\n /**\n * An array of data used by NavigationList to render individual overflow items.\n */\n overflowItems?: Item<K>[];\n};\n\n/**\n * An OverflowTabBarItem renders TabBarItems in a device appropriate popup. OverflowTabBarItem is used internally in an OverflowTabBar.\n */\n\nexport function OverflowTabBarItem<K extends string | number>({\n overflowItemKey,\n icon,\n badge,\n overflowItems,\n isOpen,\n onClose\n}: OverflowTabBarItemProps<K>) {\n const { selection, showFocusRing, isEdgeBottom, onSelect, onRemove, layout } = useTabBarContext();\n\n const isPointerSelection = useRef<boolean>(false);\n\n const overflowTabBarItemRef = useRef<HTMLDivElement>(null);\n const navigationListRef = createRef<FocusableHandle>();\n\n const handleSelectionChange = useCallback<\n Required<ComponentProps<typeof NavigationList>>['onSelectionChange']\n >(\n (detail: { value: string | number; reason?: 'pointer' | 'keyboard' }) => {\n if (detail.reason === 'pointer') {\n isPointerSelection.current = true;\n }\n onSelect?.({ value: detail.value });\n onClose?.({ reason: 'itemAction' });\n },\n [onSelect, onClose]\n );\n\n const handleDropdownClose = useCallback(\n (e: CloseDetail) => {\n onClose?.({ reason: e.reason });\n },\n [onClose]\n );\n\n const handleSheetClose = useCallback(() => {\n onClose?.({ reason: 'dismissed' });\n }, [onClose]);\n\n //When NavigationList steals focus the app resets it. Not always would it be reset to\n //parent of OverflowTabBarItem. Though currentKey would be correct, but focusRing would would not be visible\n //Hence we check for isPointerSelection.current\n\n const focusRingRequirement = showFocusRing && !isPointerSelection.current && !getIsMobile();\n\n const overflowContainsKey = (searchKey: K) => {\n return overflowItems?.find((item) => item.itemKey === searchKey) != null;\n };\n\n const currentPanelId = overflowItems?.find((item) => item.itemKey === selection)?.tabPanelId;\n\n const translations = useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n\n const isSelected = selection !== undefined && overflowContainsKey(selection as K);\n\n //instead of specifying flex: '1 0 auto' in cssProps var\n const styleInterpolations = mergeInterpolations<FlexitemProps>([\n ...Object.values(flexitemInterpolations)\n ]);\n const flexDimensions = styleInterpolations({\n flex: layout === 'stretch' ? '1 0 auto' : '0 0 auto'\n });\n\n const navContainerClasses = classNames([styles.navContainerBase]);\n\n const navContainerRef = useRef<HTMLDivElement>(null);\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n navigationListRef.current?.focus();\n }\n },\n [navigationListRef]\n );\n const getNavigationList = useCallback(() => {\n return (\n <div onKeyDown={handleKeyDown} tabIndex={0} ref={navContainerRef} class={navContainerClasses}>\n <NavigationList\n ref={navigationListRef}\n selection={selection}\n onSelectionChange={handleSelectionChange}\n onRemove={onRemove}>\n {overflowItems?.map((item) =>\n item.isRemovable ? (\n <RemovableNavigationListItem\n itemKey={item.itemKey}\n label={item.label}\n badge={item.badge}\n metadata={item.metadata}\n severity={item.severity}\n />\n ) : (\n <NavigationListItem\n itemKey={item.itemKey}\n label={item.label}\n badge={item.badge}\n metadata={item.metadata}\n severity={item.severity}\n />\n )\n )}\n </NavigationList>\n </div>\n );\n }, [\n handleKeyDown,\n navContainerClasses,\n navigationListRef,\n selection,\n handleSelectionChange,\n onRemove,\n overflowItems\n ]);\n\n return (\n <>\n {overflowItems && overflowItems.length > 0 && (\n <div ref={overflowTabBarItemRef} style={flexDimensions}>\n <BaseTabBarItem\n aria-controls={currentPanelId}\n itemKey={overflowItemKey}\n label={translations.overflowItemLabel()}\n icon={icon ? icon : <OverflowH />}\n badge={badge}\n showFocusRingOverride={focusRingRequirement}\n selectionOverride={isSelected}\n displayOverride={'icons'}\n aria-haspopup={true}\n />\n </div>\n )}\n {getIsMobile() ? (\n <Sheet isOpen={isOpen} onClose={handleSheetClose}>\n {getNavigationList()}\n </Sheet>\n ) : (\n <Dropdown\n initialFocus=\"firstFocusable\"\n isOpen={isOpen}\n onClose={handleDropdownClose}\n placement={isEdgeBottom ? 'top-end' : 'bottom-end'}\n anchorRef={overflowTabBarItemRef}>\n {getNavigationList()}\n </Dropdown>\n )}\n </>\n );\n}\n\nconst getIsMobile = () => {\n const { deviceType } = getClientHints();\n return deviceType === 'phone';\n};\n"],"names":["SvgOverflowH","props","_jsx","jsx","Icon","viewBox","children","fill","d","getIsMobile","deviceType","getClientHints","overflowItemKey","icon","badge","overflowItems","isOpen","onClose","selection","showFocusRing","isEdgeBottom","onSelect","onRemove","layout","useTabBarContext","isPointerSelection","useRef","overflowTabBarItemRef","navigationListRef","createRef","handleSelectionChange","useCallback","detail","reason","current","value","handleDropdownClose","e","handleSheetClose","focusRingRequirement","currentPanelId","find","item","itemKey","tabPanelId","translations","useTranslationBundle","isSelected","undefined","searchKey","flexDimensions","mergeInterpolations","Object","values","flexitemInterpolations","styleInterpolations","flex","navContainerClasses","classNames","styles","navContainerBase","navContainerRef","handleKeyDown","event","key","preventDefault","focus","getNavigationList","onKeyDown","tabIndex","ref","class","NavigationList","onSelectionChange","map","isRemovable","RemovableNavigationListItem","label","metadata","severity","NavigationListItem","_jsxs","_Fragment","length","style","BaseTabBarItem","overflowItemLabel","OverflowH","showFocusRingOverride","selectionOverride","displayOverride","Sheet","Dropdown","initialFocus","placement","anchorRef"],"mappings":"0fAaA,MAAMA,EAAgBC,GACpBC,EAAAC,IAACC,EAAIA,KAAC,CAAAC,QAAQ,eAAgBJ,EAAKK,SACjCJ,EAAAA,IAAG,IAAA,CAAAK,KAAK,OACND,SAAAJ,MAAA,OAAA,CACEM,EAAE,uGACFD,KAAK,qBCgNb,MAAME,EAAc,KAClB,MAAMC,WAAEA,GAAeC,EAAAA,iBACvB,MAAsB,UAAfD,CAAsB,uBAxJf,UAA8CE,gBAC5DA,EAAeC,KACfA,EAAIC,MACJA,EAAKC,cACLA,EAAaC,OACbA,EAAMC,QACNA,IAEA,MAAMC,UAAEA,EAASC,cAAEA,EAAaC,aAAEA,EAAYC,SAA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C,GACnBA,EAAKiC,YACHzE,EAAAA,IAAC0E,EAAAA,4BACC,CAAAjC,QAASD,EAAKC,QACdkC,MAAOnC,EAAKmC,MACZ/D,MAAO4B,EAAK5B,MACZgE,SAAUpC,EAAKoC,SACfC,SAAUrC,EAAKqC,WAGjB7E,EAAAA,IAAC8E,EAAAA,mBAAkB,CACjBrC,QAASD,EAAKC,QACdkC,MAAOnC,EAAKmC,MACZ/D,MAAO4B,EAAK5B,MACZgE,SAAUpC,EAAKoC,SACfC,SAAUrC,EAAKqC,kBAO1B,CACDjB,EACAL,EACA7B,EACAV,EACAY,EACAR,EACAP,IAGF,OACEkE,EAAAA,KAAAC,EAAAA,SAAA,CAAA5E,SAAA,CACGS,GAAiBA,EAAcoE,OAAS,GACvCjF,EAAAC,IAAA,MAAA,CAAKmE,IAAK3C,EAAuByD,MAAOlC,EACtC5C,SAAAJ,EAAAC,IAACkF,iBAAc,CAAA,gBACE7C,EACfG,QAAS/B,EACTiE,MAAOhC,EAAayC,oBACpBzE,KAAMA,GAAcX,MAACqF,EAAS,CAAA,GAC9BzE,MAAOA,EACP0E,sBAAuBjD,EACvBkD,kBAAmB1C,EACnB2C,gBAAiB,QAAO,iBACT,MAIpBjF,IACCP,EAAAC,IAACwF,EAAKA,MAAA,CAAC3E,OAAQA,EAAQC,QAASqB,EAC7BhC,SAAA6D,MAGHjE,EAAAC,IAACyF,EAAQA,SACP,CAAAC,aAAa,iBACb7E,OAAQA,EACRC,QAASmB,EACT0D,UAAW1E,EAAe,UAAY,aACtC2E,UAAWpE,EACVrB,SAAA6D,QAKX"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
define(['exports', 'preact/jsx-runtime', 'preact/compat', './FormContext-5130e198', './useFormContext-30acdd33', './FormFieldContext-3c44aaaa', 'preact/hooks', './useFocusableTextField-c2f98a8b', './Label-3f8fc274', './TextFieldInput-dfd9529f', 'css!./ObfuscatedTextFieldInputStyles.styles.css', './ReadonlyTextFieldInput-a5e85e5d', './StyledTextField-8ac3bbb4', './TextField-0fc70892', './MaxLengthLiveRegion-23d7e335', './useTextField-e6877c79', './logger-0f873e29', './TabbableModeContext-a9c97640', './useId-c9578d26', './useTranslationBundle-6ef0dab6', 'css!./UserAssistanceStyles.styles.css', 'module', './UNSAFE_UserAssistance/themes/redwood/UserAssistanceVariants.css', './InlineUserAssistance-f4d1fa1b', './CompactUserAssistance-b2cbdbad', './useTooltipControlled-abf886f2', 'preact', 'css!./IconStyle.styles.css', './Popup-249d77c3', 'css!./LabelStyles.styles.css', 'module', './UNSAFE_Label/themes/redwood/LabelVariants.css', './InputGroupContext-372087af', './LayerHost-eab40731', './HiddenAccessible-037ef42d', 'module', './UNSAFE_Popup/themes/redwood/PopupVariants.css', './useLengthFilter-ed8959a4', './classNames-08d99695', './usePress-a9ed1488', './useFormFieldContext-8196183c', 'css!./MaxLengthCounterStyles.styles.css', './useCurrentValueReducer-faded381'], (function(e,s,t,a,n,i,l,o,r,d,c,u,x,m,p,h,b,F,f,y,g,L,C,v,A,S,R,T,I,j,U,_,E,w,P,D,M,k,N,V,B,H,q){"use strict";var z="MaxLengthCounterStyles_spanStyles__7dy9j72";const W=()=>{};function $({maxLength:e,valueLength:t=0,onClick:a}){const{isFocused:n}=B.useFormFieldContext(),i=l.useCallback((e=>e.preventDefault()),[]),o=N.classNames([!n&&"MaxLengthCounterStyles_hide__7dy9j71"]),{pressProps:r}=V.usePress(a??W);return s.jsx("div",{class:"MaxLengthCounterStyles_maxLengthCounterBase__7dy9j70",onMouseDown:i,...r,children:s.jsxs("span",{class:o,children:[s.jsx("span",{class:z,children:t}),s.jsx("span",{class:z,children:"/"}),s.jsx("span",{class:z,children:e})]})})}const G=t.forwardRef((({"aria-describedby":e,assistiveText:a,autoComplete:l="off",autoFocus:c=!1,columnSpan:b,helpSourceLink:F,helpSourceText:g,isDisabled:L,isReadonly:C,isRequired:S=!1,isRequiredShown:R,label:T,labelEdge:I,labelStartWidth:j,maxLength:U,maxLengthCounter:_="remaining",maxLengthUnit:E,messages:w,placeholder:D,resize:M,role:N,rows:V,textAlign:B,userAssistanceDensity:H,value:z,variant:W="default",onInput:G,onCommit:O,testId:X},J)=>{const K=y.useTranslationBundle("@oracle/oraclejet-preact"),Q=U?K.formControl_limitReached({CHARACTER_LIMIT:U}):"",{currentCommitValue:Y,dispatch:Z}=q.useCurrentValueReducer({value:z}),ee=t.useCallback((e=>{Z({type:"input",payload:e.value}),G?.(e)}),[G,Z]),se=t.useCallback((e=>{Z({type:"commit",payload:e.value}),O?.(e)}),[O,Z]),{isDisabled:te,isReadonly:ae,labelEdge:ne,labelStartWidth:ie,textAlign:le,userAssistanceDensity:oe}=n.useFormContext(),re=L??te,de=C??ae,ce=I??ne,ue=j??ie,xe=B??le,me=H??oe,pe=t.useRef(f.useId()),he=e?`${e} ${pe.current}`:pe.current,{enabledElementRef:be,readonlyElementRef:Fe,focusProps:fe,isFocused:ye}=o.useFocusableTextField({isDisabled:re,isReadonly:de,ref:J}),{isMaxLengthReached:ge,valueLength:Le,onFilteredInput:Ce}=k.useLengthFilter({maxLength:U,maxLengthUnit:E,value:z,onInput:ee,onCommit:se}),ve=[...w??[],...ge?[{detail:Q,severity:"info"}]:[]],{formFieldContext:Ae,inputProps:Se,labelProps:Re,textFieldProps:Te,userAssistanceProps:Ie}=h.useTextField({ariaDescribedBy:de||re?e:he,contentVariant:"textarea",helpSourceLink:F,helpSourceText:g,isDisabled:re,isFocused:ye,isReadonly:de,isRequiredShown:R,labelEdge:ce,messages:ve,styleVariant:W,userAssistanceDensity:me,value:z}),je=t.useCallback((()=>{const e=be.current,s=e?e.value.length:null;be.current?.setSelectionRange(s,s),be.current?.focus()}),[be]),Ue="none"!==ce?s.jsx(r.Label,{...Re,children:T}):void 0,_e={label:"none"!==ce?Ue:void 0,labelEdge:"none"!==ce?ce:void 0,labelStartWidth:"none"!==ce?ue:void 0},Ee="none"===ce?T:void 0,we="efficient"===me||"reflow"===me?re||de?"efficient"!==me?void 0:s.jsx(v.InlineUserAssistance,{userAssistanceDensity:me,...Ie}):s.jsx(v.InlineUserAssistance,{assistiveText:a,fieldLabel:T,helpSourceLink:F,helpSourceText:g,messages:ve,isRequiredShown:R,userAssistanceDensity:me,...Ie}):void 0,Pe=t.useRef(null),De="compact"===me?s.jsx(A.CompactUserAssistance,{anchorRef:Pe,messages:ve,assistiveText:a,...Ie}):void 0;if(de){const e=s.jsx(u.ReadonlyTextFieldInput,{"aria-describedby":Se["aria-describedby"],"aria-label":Ee,"aria-labelledby":Re.id,as:"textarea",elementRef:Fe,rows:V,autoFocus:c,textAlign:xe,value:z,variant:"textarea",hasEmptyLabel:""===T&&"none"===ce,hasInsideLabel:void 0!==T&&"inside"===ce});return s.jsx(i.FormFieldContext.Provider,{value:Ae,children:s.jsx(x.ReadonlyTextField,{role:"presentation",columnSpan:b,compactUserAssistance:De,inlineUserAssistance:we,ref:Pe,testId:X,variant:"textarea",mainContent:e,resize:M,..._e})})}const Me=void 0!==U,ke=s.jsxs(s.Fragment,{children:[s.jsx(d.TextFieldInput,{as:"textarea","aria-label":Ee,autoComplete:l,autoFocus:c,currentCommitValue:Y,hasEmptyLabel:""===T&&"none"===ce,hasInsideLabel:void 0!==Ue&&"inside"===ce,isRequired:S,inputRef:be,onCommit:se,onInput:Ce,placeholder:D,role:N,rows:V,textAlign:xe,value:z,...Se}),"remaining"===_&&Me&&s.jsx($,{maxLength:U,valueLength:Le,onClick:je}),Me&&s.jsx(P.HiddenAccessible,{id:pe.current,isHidden:!0,children:K.formControl_maxLength({MAX_LENGTH:`${U}`})}),Me&&ye&&s.jsx(p.MaxLengthLiveRegion,{maxLength:U,valueLength:Le,testId:X+"_remainingChars"})]});return s.jsx(i.FormFieldContext.Provider,{value:Ae,children:s.jsx(m.TextField,{mainContent:ke,columnSpan:b,compactUserAssistance:De,inlineUserAssistance:we,onBlur:fe?.onFocusOut,onFocus:fe?.onFocusIn,mainFieldRef:Pe,resize:M,testId:X,...Te,..._e})})}));e.MaxLengthCounter=$,e.TextArea=G}));
|
|
2
|
+
//# sourceMappingURL=TextArea-2c7af40c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea-2c7af40c.js","sources":["../../src/UNSAFE_TextArea/MaxLengthCounter.tsx","../../src/UNSAFE_TextArea/TextArea.tsx"],"sourcesContent":["import { useCallback } from 'preact/hooks';\n\nimport { classNames } from '../utils/UNSAFE_classNames';\nimport { usePress } from '../hooks/UNSAFE_usePress';\nimport { useFormFieldContext } from '../hooks/UNSAFE_useFormFieldContext';\nimport { hide, maxLengthCounterBase, spanStyles } from './MaxLengthCounterStyles.css';\n\ntype Props = {\n maxLength: number;\n valueLength?: number;\n onClick?: () => void; // the calling component should focus on the appropriate element when clicked.\n};\n\nconst noop = () => {};\n\nexport function MaxLengthCounter({ maxLength, valueLength = 0, onClick }: Props) {\n const { isFocused } = useFormFieldContext();\n // We don't want mousedown on this component to do anything, so prevent the default behavior.\n const killEvent = useCallback((event: Event) => event.preventDefault(), []);\n const textClasses = classNames([!isFocused && hide]);\n const { pressProps } = usePress(onClick ?? noop);\n return (\n <div class={maxLengthCounterBase} onMouseDown={killEvent} {...pressProps}>\n <span class={textClasses}>\n <span class={spanStyles}>{valueLength}</span>\n <span class={spanStyles}>/</span>\n <span class={spanStyles}>{maxLength}</span>\n </span>\n </div>\n );\n}\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { ComponentProps, Ref } from 'preact';\nimport { forwardRef, useCallback, useRef } from 'preact/compat';\nimport { useFormContext } from '../hooks/UNSAFE_useFormContext';\nimport { FormFieldContext } from '../hooks/UNSAFE_useFormFieldContext';\nimport { FocusableHandle, useFocusableTextField } from '../hooks/UNSAFE_useFocusableTextField';\nimport { Label } from '../UNSAFE_Label';\nimport {\n ReadonlyTextField,\n ReadonlyTextFieldInput,\n TextField,\n TextFieldInput\n} from '../UNSAFE_TextField';\nimport { useTextField } from '../hooks/UNSAFE_useTextField';\nimport {\n CompactUserAssistance,\n InlineUserAssistance,\n UserAssistanceDensityType\n} from '../UNSAFE_UserAssistance';\nimport { CountUnit, useLengthFilter } from '../hooks/UNSAFE_useLengthFilter';\nimport { MaxLengthLiveRegion } from '../UNSAFE_TextField';\nimport { MaxLengthCounter } from './MaxLengthCounter';\nimport { Size } from '../utils/UNSAFE_size';\nimport { useCurrentValueReducer } from '../hooks/UNSAFE_useCurrentValueReducer';\nimport { ValueUpdateDetail } from '../utils/UNSAFE_valueUpdateDetail';\nimport { ComponentMessageItem } from '../UNSAFE_ComponentMessage';\nimport { useTranslationBundle } from '../hooks/UNSAFE_useTranslationBundle';\nimport { BundleType } from '../resources/nls/bundle';\nimport { LayoutColumnSpan } from '../utils/UNSAFE_styles/Layout';\nimport type { TestIdProps } from '#hooks/UNSAFE_useTestId';\nimport { HiddenAccessible } from '../UNSAFE_HiddenAccessible';\nimport { useId } from '../hooks/UNSAFE_useId';\n\ntype TextFieldProps = ComponentProps<typeof TextField>;\ntype TextFieldInputProps = ComponentProps<typeof TextFieldInput>;\ntype InlineUserAssistanceProps = ComponentProps<typeof InlineUserAssistance>;\n\ntype Props = TestIdProps & {\n /**\n * The ID of an element (or space separated IDs of multiple elements) that\n * describes the input.\n */\n 'aria-describedby'?: TextFieldInputProps['aria-describedby'];\n\n /**\n * Text to provide guidance to help the user understand what to enter.\n */\n assistiveText?: InlineUserAssistanceProps['assistiveText'];\n /**\n * Dictates component's autocomplete state.\n * This attribute indicates whether the value of the control can be automatically completed by the browser.\n * The common values are \"on\" and \"off\".\n */\n autoComplete?: TextFieldInputProps['autoComplete'];\n /**\n * Autofocus specifies whether the component will get focus when the page is loaded.\n * If it is set to true then the associated component will get input focus when the page is loaded.\n * Setting this property doesn't set the focus to the component; it tells the browser to focus\n * to it when the element is inserted in the document.\n */\n autoFocus?: TextFieldInputProps['autoFocus'];\n /**\n * Specifies how many columns to span in a FormLayout with direction === 'row'\n */\n columnSpan?: LayoutColumnSpan;\n /**\n * Help source URL associated with the component.\n */\n helpSourceLink?: InlineUserAssistanceProps['helpSourceLink'];\n /**\n * Custom text to be rendered for the <code>helpSourceLink</code>.\n */\n helpSourceText?: InlineUserAssistanceProps['helpSourceText'];\n /**\n * Specifies whether the component is disabled.\n */\n isDisabled?: boolean;\n /**\n * Specifies whether the component is readonly.\n */\n isReadonly?: boolean;\n /**\n * Specifies for accessibility purposes whether a value is required.\n *\n * Setting this property to <code>false</code> means that a value is not required to be\n * committed by the user. Setting this property to <code>true</code> means that a value\n * is required to be committed by the user.\n */\n isRequired?: TextFieldInputProps['isRequired'];\n /**\n * Specifies whether to show an indicator on screen that a value is required, for example\n * before the user has committed a value.\n */\n isRequiredShown?: InlineUserAssistanceProps['isRequiredShown'];\n /**\n * Specifies the label associated with the field.\n */\n label: string;\n /**\n * Specifies where the label is positioned relative to the field.\n */\n labelEdge?: 'inside' | 'start' | 'top' | 'none';\n /**\n * Specifies the width of the label when <code>labelEdge</code> is <code>\"start\"</code>\n */\n labelStartWidth?: Size;\n /**\n * Specifies the maximum number of characters that can be entered in the input field.\n */\n maxLength?: number;\n /**\n * Determines whether the remaining number of characters that can be entered is shown or not.\n */\n maxLengthCounter?: 'none' | 'remaining';\n /**\n * Specifies how the input text characters are to be counted when maxLength is specified.\n */\n maxLengthUnit?: CountUnit;\n /**\n * Messages to show on screen that are associated with the component.\n */\n messages?: InlineUserAssistanceProps['messages'];\n /**\n * A short hint to display before the user enters a value.\n */\n placeholder?: TextFieldInputProps['placeholder'];\n /**\n * Specifies how the user is allowed to manually resize the TextArea component.\n */\n resize?: TextFieldProps['resize'];\n /**\n * Specifies the ARIA role type.\n */\n role?: TextFieldInputProps['role'];\n /**\n * Specifies the number of rows to display\n */\n rows?: TextFieldInputProps['rows'];\n /**\n * Specifies how to align text within the field.\n */\n textAlign?: TextFieldInputProps['textAlign'];\n /**\n * Specifies the density of the user assistance presentation. It can be set to:\n * <ul>\n * <li><code>'efficient'</code>: Show inline and reserve space to prevent layout reflow when user\n * assistance text is displayed.</li>\n * <li><code>'reflow'</code>: Show inline. Layout will reflow when text is displayed.</li>\n * <li><code>'compact'</code>: Messages, help, hints, and required will not be shown inline; they will show in a mode that keeps the screen more compact, like a popup for the messages, and a required icon to indicate Required. </li>\n * </ul>\n */\n userAssistanceDensity?: UserAssistanceDensityType;\n /**\n * The current display value of the component.\n */\n value?: TextFieldInputProps['value'];\n /**\n * The style variant of the component.\n */\n variant?: TextFieldInputProps['variant'];\n /**\n * Callback invoked when the user commits the entered value by blurring out of the field.\n */\n onCommit?: TextFieldInputProps['onCommit'];\n /**\n * Callback invoked each time the user changes the value of the field. For example, if the user\n * types 'abcd', this callback will be called four times with the value as 'a', 'ab', 'abc' and 'abcd'\n * respectively.\n */\n onInput: TextFieldInputProps['onInput'];\n};\n/**\n * A text area displays a field that allows a user to enter a multi-line text value.\n */\nexport const TextArea = forwardRef(\n (\n {\n 'aria-describedby': ariaDescribedBy,\n assistiveText,\n autoComplete = 'off',\n autoFocus = false,\n columnSpan,\n helpSourceLink,\n helpSourceText,\n isDisabled: propIsDisabled,\n isReadonly: propIsReadonly,\n isRequired = false,\n isRequiredShown,\n label,\n labelEdge: propLabelEdge,\n labelStartWidth: propLabelStartWidth,\n maxLength,\n maxLengthCounter = 'remaining',\n maxLengthUnit,\n messages,\n placeholder,\n resize,\n role,\n rows,\n textAlign: propTextAlign,\n userAssistanceDensity: propUserAssistanceDensity,\n value,\n variant = 'default',\n onInput,\n onCommit,\n testId\n }: Props,\n ref?: Ref<FocusableHandle>\n ) => {\n const translations = useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n const formControl_limitReached = maxLength\n ? translations.formControl_limitReached({\n CHARACTER_LIMIT: maxLength\n })\n : '';\n\n const { currentCommitValue, dispatch } = useCurrentValueReducer({ value });\n const onInputAndDispatch = useCallback(\n (detail: ValueUpdateDetail<string>) => {\n // Should dispatch happen first? This will queue up a re-render, ordering should not cause issues (this is async)\n dispatch({ type: 'input', payload: detail.value });\n onInput?.(detail);\n },\n [onInput, dispatch]\n );\n const onCommitAndDispatch = useCallback(\n (detail: ValueUpdateDetail<string>) => {\n // Should dispatch happen first? This will queue up a re-render, ordering should not cause issues (this is async)\n dispatch({ type: 'commit', payload: detail.value });\n onCommit?.(detail);\n },\n [onCommit, dispatch]\n );\n const {\n isDisabled: isFormDisabled,\n isReadonly: isFormReadonly,\n labelEdge: formLabelEdge,\n labelStartWidth: formLabelStartWidth,\n textAlign: formTextAlign,\n userAssistanceDensity: formUserAssistanceDensity\n } = useFormContext();\n\n // default to FormContext values if component properties are not specified\n const isDisabled = propIsDisabled ?? isFormDisabled;\n const isReadonly = propIsReadonly ?? isFormReadonly;\n const labelEdge = propLabelEdge ?? formLabelEdge;\n const labelStartWidth = propLabelStartWidth ?? formLabelStartWidth;\n const textAlign = propTextAlign ?? formTextAlign;\n const userAssistanceDensity = propUserAssistanceDensity ?? formUserAssistanceDensity;\n const maxLengthDescribedByIdRef = useRef<string>(useId());\n // The enabledAriaDescribedBy includes the maxLengthDescribedById in addition to what was passed in to aria-describedby.\n // We don't need to announce the max length message for readonly, as it only applies when editing the value.\n const enabledAriaDescribedBy = ariaDescribedBy\n ? `${ariaDescribedBy} ${maxLengthDescribedByIdRef.current}`\n : maxLengthDescribedByIdRef.current;\n\n const { enabledElementRef, readonlyElementRef, focusProps, isFocused } = useFocusableTextField<\n HTMLTextAreaElement,\n HTMLTextAreaElement\n >({ isDisabled, isReadonly, ref });\n\n // Handle length filter for user-typed inputs and controlled inputs\n const { isMaxLengthReached, valueLength, onFilteredInput } = useLengthFilter({\n maxLength,\n maxLengthUnit,\n value,\n onInput: onInputAndDispatch,\n onCommit: onCommitAndDispatch\n });\n\n const limitMessage = [{ detail: formControl_limitReached, severity: 'info' }];\n const allMessages = [\n ...(messages ?? []),\n ...(isMaxLengthReached ? limitMessage : [])\n ] as ComponentMessageItem[];\n\n const { formFieldContext, inputProps, labelProps, textFieldProps, userAssistanceProps } =\n useTextField({\n ariaDescribedBy: isReadonly || isDisabled ? ariaDescribedBy : enabledAriaDescribedBy,\n contentVariant: 'textarea',\n helpSourceLink,\n helpSourceText,\n isDisabled,\n isFocused,\n isReadonly,\n isRequiredShown,\n labelEdge,\n messages: allMessages,\n styleVariant: variant,\n userAssistanceDensity,\n value\n });\n\n const onClickCounter = useCallback(() => {\n const elm = enabledElementRef.current;\n // for setSelectionRange(), len needs to be a number or null.\n const len = elm ? elm.value.length : null;\n // Since the counter element is after the text, clicking in this\n // should put the selection at the end of the text\n enabledElementRef.current?.setSelectionRange(len, len);\n // Clicking the counter should put the focus on the input field\n enabledElementRef.current?.focus();\n }, [enabledElementRef]);\n\n const labelComp = labelEdge !== 'none' ? <Label {...labelProps}>{label}</Label> : undefined;\n\n const fieldLabelProps = {\n label: labelEdge !== 'none' ? labelComp : undefined,\n labelEdge: labelEdge !== 'none' ? labelEdge : undefined,\n labelStartWidth: labelEdge !== 'none' ? labelStartWidth : undefined\n };\n\n const ariaLabel = labelEdge === 'none' ? label : undefined;\n const isInlineDensity =\n userAssistanceDensity === 'efficient' || userAssistanceDensity === 'reflow';\n\n const inlineUserAssistance = isInlineDensity ? (\n isDisabled || isReadonly ? (\n // save space for user assistance if density is 'efficient', even though we don't\n // render user assistance for disabled or readonly fields\n userAssistanceDensity !== 'efficient' ? undefined : (\n <InlineUserAssistance\n userAssistanceDensity={userAssistanceDensity}\n {...userAssistanceProps}\n />\n )\n ) : (\n <InlineUserAssistance\n assistiveText={assistiveText}\n fieldLabel={label}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n messages={allMessages}\n isRequiredShown={isRequiredShown}\n userAssistanceDensity={userAssistanceDensity}\n {...userAssistanceProps}\n />\n )\n ) : undefined;\n\n const anchorRef = useRef<HTMLDivElement>(null);\n\n const compactUserAssistance =\n userAssistanceDensity === 'compact' ? (\n <CompactUserAssistance\n anchorRef={anchorRef}\n messages={allMessages}\n assistiveText={assistiveText}\n {...userAssistanceProps}\n />\n ) : undefined;\n\n if (isReadonly) {\n const mainContent = (\n <ReadonlyTextFieldInput\n aria-describedby={inputProps['aria-describedby']}\n aria-label={ariaLabel}\n aria-labelledby={labelProps.id}\n as=\"textarea\"\n elementRef={readonlyElementRef}\n rows={rows}\n autoFocus={autoFocus}\n textAlign={textAlign}\n value={value}\n variant=\"textarea\"\n hasEmptyLabel={label === '' && labelEdge === 'none'}\n hasInsideLabel={label !== undefined && labelEdge === 'inside'}\n />\n );\n return (\n <FormFieldContext.Provider value={formFieldContext}>\n <ReadonlyTextField\n role=\"presentation\"\n columnSpan={columnSpan}\n compactUserAssistance={compactUserAssistance}\n inlineUserAssistance={inlineUserAssistance}\n ref={anchorRef}\n testId={testId}\n variant=\"textarea\"\n mainContent={mainContent}\n resize={resize}\n {...fieldLabelProps}\n />\n </FormFieldContext.Provider>\n );\n }\n const hasMaxLength = maxLength !== undefined;\n const mainContent = (\n <>\n <TextFieldInput\n as=\"textarea\"\n aria-label={ariaLabel}\n autoComplete={autoComplete}\n autoFocus={autoFocus}\n currentCommitValue={currentCommitValue}\n hasEmptyLabel={label === '' && labelEdge === 'none'}\n hasInsideLabel={labelComp !== undefined && labelEdge === 'inside'}\n isRequired={isRequired}\n inputRef={enabledElementRef}\n onCommit={onCommitAndDispatch}\n onInput={onFilteredInput}\n placeholder={placeholder}\n role={role}\n rows={rows}\n textAlign={textAlign}\n value={value}\n {...inputProps}\n />\n {maxLengthCounter === 'remaining' && hasMaxLength && (\n <MaxLengthCounter\n maxLength={maxLength}\n valueLength={valueLength}\n onClick={onClickCounter}\n />\n )}\n {hasMaxLength && (\n <HiddenAccessible id={maxLengthDescribedByIdRef.current} isHidden={true}>\n {translations.formControl_maxLength({\n MAX_LENGTH: `${maxLength}`\n })}\n </HiddenAccessible>\n )}\n {hasMaxLength && isFocused && (\n <MaxLengthLiveRegion\n maxLength={maxLength}\n valueLength={valueLength}\n testId={testId + '_remainingChars'}\n />\n )}\n </>\n );\n\n return (\n <FormFieldContext.Provider value={formFieldContext}>\n <TextField\n mainContent={mainContent}\n columnSpan={columnSpan}\n compactUserAssistance={compactUserAssistance}\n inlineUserAssistance={inlineUserAssistance}\n onBlur={focusProps?.onFocusOut}\n onFocus={focusProps?.onFocusIn}\n mainFieldRef={anchorRef}\n resize={resize}\n testId={testId}\n {...textFieldProps}\n {...fieldLabelProps}></TextField>\n </FormFieldContext.Provider>\n );\n }\n);\n"],"names":["noop","MaxLengthCounter","maxLength","valueLength","onClick","isFocused","useFormFieldContext","killEvent","useCallback","event","preventDefault","textClasses","classNames","pressProps","usePress","_jsx","jsx","class","onMouseDown","_jsxs","jsxs","children","spanStyles","TextArea","forwardRef","ariaDescribedBy","assistiveText","autoComplete","autoFocus","columnSpan","helpSourceLink","helpSourceText","isDisabled","propIsDisabled","isReadonly","propIsReadonly","isRequired","isRequiredShown","label","labelEdge","propLabelEdge","labelStartWidth","propLabelStartWidth","maxLengthCounter","maxLengthUnit","messages","placeholder","resize","role","rows","textAlign","propTextAlign","userAssistanceDensity","propUserAssistanceDensity","value","variant","onInput","onCommit","testId","ref","translations","useTranslationBundle","formControl_limitReached","CHARACTER_LIMIT","currentCommitValue","dispatch","useCurrentValueReducer","onInputAndDispatch","detail","type","payload","onCommitAndDispatch","isFormDisabled","isFormReadonly","formLabelEdge","formLabelStartWidth","formTextAlign","formUserAssistanceDensity","useFormContext","maxLengthDescribedByIdRef","useRef","useId","enabledAriaDescribedBy","current","enabledElementRef","readonlyElementRef","focusProps","useFocusableTextField","isMaxLengthReached","onFilteredInput","useLengthFilter","allMessages","severity","formFieldContext","inputProps","labelProps","textFieldProps","userAssistanceProps","useTextField","contentVariant","styleVariant","onClickCounter","elm","len","length","setSelectionRange","focus","labelComp","Label","undefined","fieldLabelProps","ariaLabel","inlineUserAssistance","InlineUserAssistance","fieldLabel","anchorRef","compactUserAssistance","CompactUserAssistance","mainContent","ReadonlyTextFieldInput","id","as","elementRef","hasEmptyLabel","hasInsideLabel","FormFieldContext","Provider","ReadonlyTextField","hasMaxLength","_Fragment","Fragment","TextFieldInput","inputRef","HiddenAccessible","isHidden","formControl_maxLength","MAX_LENGTH","MaxLengthLiveRegion","TextField","onBlur","onFocusOut","onFocus","onFocusIn","mainFieldRef"],"mappings":"qgDAaA,MAAMA,EAAO,OAEP,SAAUC,GAAiBC,UAAEA,EAASC,YAAEA,EAAc,EAACC,QAAEA,IAC7D,MAAMC,UAAEA,GAAcC,EAAAA,sBAEhBC,EAAYC,EAAAA,aAAaC,GAAiBA,EAAMC,kBAAkB,IAClEC,EAAcC,EAAAA,WAAW,EAAEP,6CAC3BQ,WAAEA,GAAeC,EAAQA,SAACV,GAAWJ,GAC3C,OACEe,EAAKC,IAAA,MAAA,CAAAC,6DAA6BC,YAAaX,KAAeM,WAC5DM,EAAMC,KAAA,OAAA,CAAAH,MAAON,EAAWU,SAAA,CACtBN,cAAME,MAAOK,EAAUD,SAAGlB,IAC1BY,EAAAA,YAAME,MAAOK,EAAoBD,SAAA,MACjCN,cAAME,MAAOK,EAAaD,SAAAnB,QAIlC,OCuJaqB,EAAWC,EAAAA,YACtB,EAEI,mBAAoBC,EACpBC,gBACAC,eAAe,MACfC,aAAY,EACZC,aACAC,iBACAC,iBACAC,WAAYC,EACZC,WAAYC,EACZC,cAAa,EACbC,kBACAC,QACAC,UAAWC,EACXC,gBAAiBC,EACjBxC,YACAyC,mBAAmB,YACnBC,gBACAC,WACAC,cACAC,SACAC,OACAC,OACAC,UAAWC,EACXC,sBAAuBC,EACvBC,QACAC,UAAU,UACVC,UACAC,WACAC,UAEFC,KAEA,MAAMC,EAAeC,uBAAiC,4BAChDC,EAA2B5D,EAC7B0D,EAAaE,yBAAyB,CACpCC,gBAAiB7D,IAEnB,IAEE8D,mBAAEA,EAAkBC,SAAEA,GAAaC,EAAAA,uBAAuB,CAAEZ,UAC5Da,GAAqB3D,eACxB4D,IAECH,EAAS,CAAEI,KAAM,QAASC,QAASF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ACvBJ,qBAAsBA,GACtBrD,IAAKwD,GACLzD,OAAQA,EACRH,QAAQ,WACR+D,YAAaA,EACbvE,OAAQA,KACJ+D,MAIX,CACD,MAAMkB,QAA6BnB,IAAd3G,EACfoH,GACJnG,EAAAA,KAAA8G,EAAAC,SAAA,CAAA7G,SAAA,CACEN,EAACC,IAAAmH,iBACC,CAAAV,GAAG,WACS,aAAAV,GACZpF,aAAcA,EACdC,UAAWA,EACXoC,mBAAoBA,EACpB2D,cAAyB,KAAVrF,GAA8B,SAAdC,GAC/BqF,oBAA8Bf,IAAdF,IAAyC,WAAdpE,GAC3CH,WAAYA,EACZgG,SAAUhD,GACV3B,SAAUc,GACVf,QAASiC,GACT3C,YAAaA,EACbE,KAAMA,EACNC,KAAMA,EACNC,UAAWA,GACXI,MAAOA,KACHwC,KAEgB,cAArBnD,GAAoCqF,IACnCjH,EAAAA,IAACd,GACCC,UAAWA,EACXC,YAAaA,GACbC,QAASiG,KAGZ2B,IACCjH,MAACsH,EAAAA,iBAAgB,CAACb,GAAIzC,GAA0BI,QAASmD,UAAU,EAAIjH,SACpEuC,EAAa2E,sBAAsB,CAClCC,WAAY,GAAGtI,QAIpB8H,IAAgB3H,IACfU,MAAC0H,EAAAA,oBACC,CAAAvI,UAAWA,EACXC,YAAaA,GACbuD,OAAQA,EAAS,uBAMzB,OACE3C,EAAAA,IAAC8G,EAAAA,iBAAiBC,SAAS,CAAAxE,MAAOuC,GAChCxE,SAAAN,EAAAC,IAAC0H,EAASA,UAAA,CACRpB,YAAaA,GACbzF,WAAYA,EACZuF,sBAAuBA,GACvBJ,qBAAsBA,GACtB2B,OAAQrD,IAAYsD,WACpBC,QAASvD,IAAYwD,UACrBC,aAAc5B,GACdpE,OAAQA,EACRW,OAAQA,KACJsC,MACAc,MAER"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
define(['exports', 'preact/jsx-runtime', 'preact/compat', './FormContext-5130e198', './useFormContext-30acdd33', './FormFieldContext-3c44aaaa', 'preact/hooks', './useFocusableTextField-c2f98a8b', './Label-3f8fc274', './TextFieldInput-dfd9529f', 'css!./ObfuscatedTextFieldInputStyles.styles.css', './ReadonlyTextFieldInput-a5e85e5d', './StyledTextField-8ac3bbb4', './TextField-0fc70892', './MaxLengthLiveRegion-23d7e335', './useTextField-e6877c79', './logger-0f873e29', './TabbableModeContext-a9c97640', './useId-c9578d26', './useTranslationBundle-6ef0dab6', 'css!./UserAssistanceStyles.styles.css', 'module', './UNSAFE_UserAssistance/themes/redwood/UserAssistanceVariants.css', './InlineUserAssistance-f4d1fa1b', './CompactUserAssistance-b2cbdbad', './useTooltipControlled-abf886f2', 'preact', 'css!./IconStyle.styles.css', './Popup-249d77c3', 'css!./LabelStyles.styles.css', 'module', './UNSAFE_Label/themes/redwood/LabelVariants.css', './InputGroupContext-372087af', './LayerHost-eab40731', './HiddenAccessible-037ef42d', 'module', './UNSAFE_Popup/themes/redwood/PopupVariants.css', './useLengthFilter-ed8959a4', './useCurrentValueReducer-faded381', './TextArea-2c7af40c'], (function(e,t,s,a,n,i,o,l,r,d,c,u,m,p,x,b,h,f,g,F,y,R,v,L,A,C,T,S,I,w,E,U,j,H,P,D,_,B,V,k){"use strict";const M=({isReadonly:e,enabledElementRef:t,readonlyElementRef:s,minRows:a=2,maxRows:n,value:i})=>{o.useLayoutEffect((()=>{const i=e?s:t;if(null===i.current)return;if(i.current instanceof HTMLDivElement)return;const o=i.current,l=(e=>{const t=window.getComputedStyle(e),s=t.lineHeight;if("normal"===s)return 1.2*parseFloat(t.fontSize);return parseFloat(s)})(o);o.style.height="0";const{paddingHeight:r,borderHeight:d}=(e=>{const t=window.getComputedStyle(e);return{paddingHeight:parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),borderHeight:parseFloat(t.borderTop)+parseFloat(t.borderBottom)}})(o),c=l*a+r+d,u=o.scrollHeight+d;let m=0;if(void 0===n)m=u<c?c:u;else if(n>a){const e=l*n+r+d;m=u>e?e:u<c?c:u}else m=c;o.style.height=m+.5+"px"}),[i,a,n,e,t,s])},N=s.forwardRef((({"aria-describedby":e,assistiveText:a,autoComplete:o="off",autoFocus:c=!1,columnSpan:h,helpSourceLink:f,helpSourceText:y,isDisabled:R,isReadonly:v,isRequired:C=!1,isRequiredShown:T,label:S,labelEdge:I,labelStartWidth:w,maxLength:E,maxLengthCounter:U="remaining",maxLengthUnit:j,maxRows:H,messages:D,minRows:_=2,placeholder:N,role:q,textAlign:W,userAssistanceDensity:$,value:z,variant:G="default",onInput:O,onCommit:X,testId:J},K)=>{const Q=F.useTranslationBundle("@oracle/oraclejet-preact"),Y=E?Q.formControl_limitReached({CHARACTER_LIMIT:E}):"",{currentCommitValue:Z,dispatch:ee}=V.useCurrentValueReducer({value:z}),te=s.useCallback((e=>{ee({type:"input",payload:e.value}),O?.(e)}),[O,ee]),se=s.useCallback((e=>{ee({type:"commit",payload:e.value}),X?.(e)}),[X,ee]),{isDisabled:ae,isReadonly:ne,labelEdge:ie,labelStartWidth:oe,textAlign:le,userAssistanceDensity:re}=n.useFormContext(),de=R??ae,ce=v??ne,ue=I??ie,me=w??oe,pe=W??le,xe=$??re,be=s.useRef(g.useId()),he=e?`${e} ${be.current}`:be.current,{enabledElementRef:fe,readonlyElementRef:ge,focusProps:Fe,isFocused:ye}=l.useFocusableTextField({isDisabled:de,isReadonly:ce,ref:K}),{isMaxLengthReached:Re,valueLength:ve,onFilteredInput:Le}=B.useLengthFilter({maxLength:E,maxLengthUnit:j,value:z,onInput:te,onCommit:se}),Ae=[...D??[],...Re?[{detail:Y,severity:"info"}]:[]],{formFieldContext:Ce,inputProps:Te,labelProps:Se,textFieldProps:Ie,userAssistanceProps:we}=b.useTextField({ariaDescribedBy:ce||de?e:he,contentVariant:"textarea",helpSourceLink:f,helpSourceText:y,isDisabled:de,isFocused:ye,isReadonly:ce,isRequiredShown:T,labelEdge:ue,messages:Ae,styleVariant:G,userAssistanceDensity:xe,value:z}),Ee=s.useCallback((()=>{const e=fe.current,t=e?e.value.length:null;fe.current?.setSelectionRange(t,t),fe.current?.focus()}),[fe]),Ue="none"!==ue?t.jsx(r.Label,{...Se,children:S}):void 0,je={label:"none"!==ue?Ue:void 0,labelEdge:"none"!==ue?ue:void 0,labelStartWidth:"none"!==ue?me:void 0},He="none"===ue?S:void 0,Pe="efficient"===xe||"reflow"===xe?de||ce?"efficient"!==xe?void 0:t.jsx(L.InlineUserAssistance,{userAssistanceDensity:xe,...we}):t.jsx(L.InlineUserAssistance,{assistiveText:a,fieldLabel:S,helpSourceLink:f,helpSourceText:y,messages:Ae,isRequiredShown:T,userAssistanceDensity:xe,...we}):void 0,De=s.useRef(null),_e="compact"===xe?t.jsx(A.CompactUserAssistance,{anchorRef:De,messages:Ae,assistiveText:a,...we}):void 0;if(M({isReadonly:ce,enabledElementRef:fe,readonlyElementRef:ge,minRows:_,maxRows:H,value:z}),ce){const e=t.jsx(u.ReadonlyTextFieldInput,{"aria-describedby":Te["aria-describedby"],"aria-label":He,"aria-labelledby":Se.id,elementRef:ge,...H?{as:"textarea",rows:_}:{as:"div"},autoFocus:c,textAlign:pe,value:z,variant:"textarea",hasEmptyLabel:""===S&&"none"===ue,hasInsideLabel:void 0!==S&&"inside"===ue});return t.jsx(i.FormFieldContext.Provider,{value:Ce,children:t.jsx(m.ReadonlyTextField,{role:"presentation",colSpan:h,compactUserAssistance:_e,inlineUserAssistance:Pe,variant:"textarea",mainContent:e,ref:De,testId:J,...je})})}const Be=void 0!==E,Ve=t.jsxs(t.Fragment,{children:[t.jsx(d.TextFieldInput,{as:"textarea","aria-label":He,autoComplete:o,autoFocus:c,currentCommitValue:Z,hasEmptyLabel:""===S&&"none"===ue,hasInsideLabel:void 0!==Ue&&"inside"===ue,isRequired:C,inputRef:fe,onCommit:se,onInput:Le,placeholder:N,role:q,rows:_,textAlign:pe,value:z,...Te}),"remaining"===U&&Be&&t.jsx(k.MaxLengthCounter,{maxLength:E,valueLength:ve,onClick:Ee}),Be&&t.jsx(P.HiddenAccessible,{id:be.current,children:Q.formControl_maxLength({MAX_LENGTH:`${E}`})}),Be&&ye&&t.jsx(x.MaxLengthLiveRegion,{maxLength:E,valueLength:ve,testId:J+"_remainingChars"})]});return t.jsx(i.FormFieldContext.Provider,{value:Ce,children:t.jsx(p.TextField,{mainContent:Ve,columnSpan:h,compactUserAssistance:_e,inlineUserAssistance:Pe,onBlur:Fe?.onFocusOut,onFocus:Fe?.onFocusIn,mainFieldRef:De,testId:J,...Ie,...je})})}));e.TextAreaAutosize=N}));
|
|
2
|
+
//# sourceMappingURL=TextAreaAutosize-9dc5bffe.js.map
|