@activecollab/components 2.0.505 → 2.0.507
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/dist/cjs/components/ObjectFormModal/ObjectFormModal.js +117 -0
- package/dist/cjs/components/ObjectFormModal/ObjectFormModal.js.map +1 -0
- package/dist/cjs/components/ObjectFormModal/Styles.js +28 -0
- package/dist/cjs/components/ObjectFormModal/Styles.js.map +1 -0
- package/dist/cjs/components/ObjectFormModal/index.js +17 -0
- package/dist/cjs/components/ObjectFormModal/index.js.map +1 -0
- package/dist/cjs/components/ObjectLayout/ObjectLayout.js +3 -0
- package/dist/cjs/components/ObjectLayout/ObjectLayout.js.map +1 -1
- package/dist/cjs/components/PropertyList/PropertyList.js +27 -7
- package/dist/cjs/components/PropertyList/PropertyList.js.map +1 -1
- package/dist/cjs/components/PropertyList/Styles.js +38 -29
- package/dist/cjs/components/PropertyList/Styles.js.map +1 -1
- package/dist/cjs/components/index.js +11 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/hooks/useInputHours.js +6 -1
- package/dist/cjs/hooks/useInputHours.js.map +1 -1
- package/dist/cjs/hooks/useInputNumber.js +6 -1
- package/dist/cjs/hooks/useInputNumber.js.map +1 -1
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.d.ts +24 -0
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.d.ts.map +1 -0
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.js +101 -0
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.js.map +1 -0
- package/dist/esm/components/ObjectFormModal/Styles.d.ts +7 -0
- package/dist/esm/components/ObjectFormModal/Styles.d.ts.map +1 -0
- package/dist/esm/components/ObjectFormModal/Styles.js +15 -0
- package/dist/esm/components/ObjectFormModal/Styles.js.map +1 -0
- package/dist/esm/components/ObjectFormModal/index.d.ts +2 -0
- package/dist/esm/components/ObjectFormModal/index.d.ts.map +1 -0
- package/dist/esm/components/ObjectFormModal/index.js +2 -0
- package/dist/esm/components/ObjectFormModal/index.js.map +1 -0
- package/dist/esm/components/ObjectLayout/ObjectLayout.d.ts.map +1 -1
- package/dist/esm/components/ObjectLayout/ObjectLayout.js +3 -0
- package/dist/esm/components/ObjectLayout/ObjectLayout.js.map +1 -1
- package/dist/esm/components/PropertyList/PropertyList.d.ts +5 -0
- package/dist/esm/components/PropertyList/PropertyList.d.ts.map +1 -1
- package/dist/esm/components/PropertyList/PropertyList.js +24 -6
- package/dist/esm/components/PropertyList/PropertyList.js.map +1 -1
- package/dist/esm/components/PropertyList/Styles.d.ts +4 -1
- package/dist/esm/components/PropertyList/Styles.d.ts.map +1 -1
- package/dist/esm/components/PropertyList/Styles.js +38 -29
- package/dist/esm/components/PropertyList/Styles.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/hooks/useInputHours.d.ts.map +1 -1
- package/dist/esm/hooks/useInputHours.js +6 -1
- package/dist/esm/hooks/useInputHours.js.map +1 -1
- package/dist/esm/hooks/useInputNumber.d.ts.map +1 -1
- package/dist/esm/hooks/useInputNumber.js +6 -1
- package/dist/esm/hooks/useInputNumber.js.map +1 -1
- package/dist/index.js +951 -799
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyList.js","names":["React","Children","Fragment","createContext","forwardRef","useContext","classnames","StyledPropertyList","StyledPropertyListAddIcon","StyledPropertyListBranch","StyledPropertyListBranchLine","StyledPropertyListChevron","StyledPropertyListDivider","StyledPropertyListIcon","StyledPropertyListLabelText","StyledPropertyListRow","StyledPropertyListTableAction","StyledPropertyListTableLabel","StyledPropertyListTableValue","StyledPropertyListToggle","StyledPropertyListValue","AddCrossTinyIcon","ArrowDownSmallIcon","DensityContext","LayoutContext","usePropertyListDensity","usePropertyListLayout","PropertyListLayout","_ref","_ref$value","value","children","createElement","Provider","PropertyListDivider","$layout","$density","className","PropertyList","_ref2","ref","_ref2$density","density","rest","_objectWithoutPropertiesLoose","_excluded","parts","toArray","filter","Boolean","_extends","variant","radius","shadow","map","part","index","_key","key","displayName","PropertyListValue","_ref3","_ref3$placeholder","placeholder","forwardedAs","color","undefined","$placeholder","PropertyListAdd","_ref4","PropertyListLabel","_ref5","icon","label","layout","$size","$scale","weight","PropertyListRow","_ref6","action","_ref6$tone","tone","_ref6$readOnly","readOnly","_ref6$chevron","chevron","_excluded2","caret","as","type","$tone","$clickable","PropertyListToggle","_ref7","_ref7$expanded","expanded","_excluded3","PropertyListBranch","_ref8","_ref8$position","position","_excluded4"],"sources":["../../../../src/components/PropertyList/PropertyList.tsx"],"sourcesContent":["import React, {\n ButtonHTMLAttributes,\n Children,\n Fragment,\n HTMLAttributes,\n ReactElement,\n ReactNode,\n Ref,\n createContext,\n forwardRef,\n useContext,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport {\n PropertyListDensity,\n PropertyListLayoutName,\n PropertyListTone,\n StyledPropertyList,\n StyledPropertyListAddIcon,\n StyledPropertyListBranch,\n StyledPropertyListBranchLine,\n StyledPropertyListChevron,\n StyledPropertyListDivider,\n StyledPropertyListIcon,\n StyledPropertyListLabelText,\n StyledPropertyListRow,\n StyledPropertyListTableAction,\n StyledPropertyListTableLabel,\n StyledPropertyListTableValue,\n StyledPropertyListToggle,\n StyledPropertyListValue,\n} from \"./Styles\";\nimport { AddCrossTinyIcon, ArrowDownSmallIcon } from \"../Icons\";\n\nconst DensityContext = createContext<PropertyListDensity>(\"form\");\nconst LayoutContext = createContext<PropertyListLayoutName>(\"stacked\");\n\nexport const usePropertyListDensity = () => useContext(DensityContext);\nexport const usePropertyListLayout = () => useContext(LayoutContext);\n\n/** Sets the layout of the rows below it: one line each, or the three columns of a table. */\nexport const PropertyListLayout = ({\n value = \"stacked\",\n children,\n}: {\n value?: PropertyListLayoutName;\n children?: ReactNode;\n}) => <LayoutContext.Provider value={value}>{children}</LayoutContext.Provider>;\n\n/** The line between two rows. In a stacked list it starts where the label text starts. */\nexport const PropertyListDivider = () => (\n <StyledPropertyListDivider\n aria-hidden=\"true\"\n $layout={usePropertyListLayout()}\n $density={usePropertyListDensity()}\n className=\"c-property-list__divider\"\n />\n);\n\nexport interface IPropertyListProps extends HTMLAttributes<HTMLDivElement> {\n /** \"form\" for a compact list in a form, \"page\" for a list on a page, with a shadow. */\n density?: PropertyListDensity;\n}\n\nexport const PropertyList = forwardRef<HTMLDivElement, IPropertyListProps>(\n ({ density = \"form\", className, children, ...rest }, ref) => {\n const parts = Children.toArray(children).filter(Boolean);\n\n return (\n <DensityContext.Provider value={density}>\n <StyledPropertyList\n {...rest}\n ref={ref}\n variant=\"raised\"\n radius={20}\n shadow={density === \"page\"}\n className={classnames(\"c-property-list\", className)}\n >\n {parts.map((part, index) => (\n <Fragment key={(part as ReactElement).key ?? index}>\n {index > 0 ? <PropertyListDivider /> : null}\n {part}\n </Fragment>\n ))}\n </StyledPropertyList>\n </DensityContext.Provider>\n );\n }\n);\n\nPropertyList.displayName = \"PropertyList\";\n\nexport interface IPropertyListValueProps {\n /** A row with no value shows its text in the placeholder color. */\n placeholder?: boolean;\n className?: string;\n children?: ReactNode;\n}\n\nexport const PropertyListValue = ({\n placeholder = false,\n className,\n children,\n}: IPropertyListValueProps) => (\n <StyledPropertyListValue\n forwardedAs=\"span\"\n color={placeholder ? \"quaternary\" : undefined}\n $density={usePropertyListDensity()}\n $placeholder={placeholder}\n className={classnames(\"c-property-list__value\", className)}\n data-placeholder={placeholder || undefined}\n >\n {children}\n </StyledPropertyListValue>\n);\n\n/** The \"Add\" of a row: a placeholder with a plus where another row has its chevron. */\nexport const PropertyListAdd = ({ children }: { children?: ReactNode }) => (\n <>\n <PropertyListValue placeholder>{children}</PropertyListValue>\n <StyledPropertyListAddIcon>\n <AddCrossTinyIcon />\n </StyledPropertyListAddIcon>\n </>\n);\n\nexport interface IPropertyListLabelProps {\n icon?: ReactNode;\n label?: ReactNode;\n}\n\nexport const PropertyListLabel = ({ icon, label }: IPropertyListLabelProps) => {\n const density = usePropertyListDensity();\n const layout = usePropertyListLayout();\n\n if (layout === \"table\") {\n return (\n <StyledPropertyListTableLabel className=\"c-property-list__label\">\n <StyledPropertyListIcon $size={16} $scale>\n {icon}\n </StyledPropertyListIcon>\n <StyledPropertyListLabelText\n forwardedAs=\"span\"\n weight=\"medium\"\n $layout={layout}\n $density={density}\n >\n {label}\n </StyledPropertyListLabelText>\n </StyledPropertyListTableLabel>\n );\n }\n\n return (\n <>\n <StyledPropertyListIcon\n $size={density === \"page\" ? 28 : 24}\n $scale={false}\n >\n {icon}\n </StyledPropertyListIcon>\n <StyledPropertyListLabelText\n forwardedAs=\"span\"\n weight=\"medium\"\n $layout={layout}\n $density={density}\n className=\"c-property-list__label\"\n >\n {label}\n </StyledPropertyListLabelText>\n </>\n );\n};\n\nexport interface IPropertyListRowProps\n extends Omit<HTMLAttributes<HTMLElement>, \"children\"> {\n icon?: ReactNode;\n label?: ReactNode;\n value?: ReactNode;\n /** A control before the chevron. */\n action?: ReactNode;\n tone?: PropertyListTone;\n /** A read only row is plain text. A row that can change is one button. */\n readOnly?: boolean;\n chevron?: boolean;\n /** Replaces the label, the value and the action. */\n children?: ReactNode;\n}\n\nexport const PropertyListRow = forwardRef<HTMLElement, IPropertyListRowProps>(\n (\n {\n icon,\n label,\n value,\n action,\n tone = \"regular\",\n readOnly = false,\n chevron = true,\n className,\n children,\n ...rest\n },\n ref\n ) => {\n const density = usePropertyListDensity();\n const layout = usePropertyListLayout();\n const caret =\n !readOnly && chevron ? (\n <StyledPropertyListChevron>\n <ArrowDownSmallIcon />\n </StyledPropertyListChevron>\n ) : null;\n\n return (\n <StyledPropertyListRow\n {...rest}\n as={readOnly ? \"div\" : \"button\"}\n ref={ref as Ref<HTMLDivElement>}\n {...(readOnly ? null : { type: \"button\" })}\n $layout={layout}\n $density={density}\n $tone={tone}\n $clickable={!readOnly}\n className={classnames(\"c-property-list__row\", className)}\n >\n {children ??\n (layout === \"table\" ? (\n <>\n <PropertyListLabel icon={icon} label={label} />\n <StyledPropertyListTableValue>\n {value}\n </StyledPropertyListTableValue>\n <StyledPropertyListTableAction>\n {action}\n {caret}\n </StyledPropertyListTableAction>\n </>\n ) : (\n <>\n <PropertyListLabel icon={icon} label={label} />\n {value}\n {action}\n {caret}\n </>\n ))}\n </StyledPropertyListRow>\n );\n }\n);\n\nPropertyListRow.displayName = \"PropertyListRow\";\n\nexport interface IPropertyListToggleProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** The rows that the toggle opens are on the screen. */\n expanded?: boolean;\n}\n\n/** The last row of a list: it opens and closes the rows with no value. */\nexport const PropertyListToggle = forwardRef<\n HTMLButtonElement,\n IPropertyListToggleProps\n>(({ expanded = false, className, children, ...rest }, ref) => (\n <StyledPropertyListToggle\n type=\"button\"\n {...rest}\n ref={ref}\n aria-expanded={expanded}\n className={classnames(\"c-property-list__toggle\", className)}\n >\n {children}\n </StyledPropertyListToggle>\n));\n\nPropertyListToggle.displayName = \"PropertyListToggle\";\n\nexport interface IPropertyListBranchProps\n extends HTMLAttributes<HTMLSpanElement> {\n /** \"middle\" continues the line to the next row of the branch. */\n position?: \"middle\" | \"last\";\n}\n\n/** The tree line before a row that belongs to the row above it. Its parent must be positioned. */\nexport const PropertyListBranch = ({\n position = \"last\",\n ...rest\n}: IPropertyListBranchProps) => (\n <>\n <StyledPropertyListBranch aria-hidden=\"true\" {...rest} />\n {position === \"middle\" ? (\n <StyledPropertyListBranchLine aria-hidden=\"true\" />\n ) : null}\n </>\n);\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAEVC,QAAQ,EACRC,QAAQ,EAKRC,aAAa,EACbC,UAAU,EACVC,UAAU,QACL,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAIEC,kBAAkB,EAClBC,y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version":3,"file":"PropertyList.js","names":["React","Children","Fragment","createContext","forwardRef","useContext","classnames","StyledPropertyList","StyledPropertyListAddIcon","StyledPropertyListBranch","StyledPropertyListBranchLine","StyledPropertyListChevron","StyledPropertyListDivider","StyledPropertyListIcon","StyledPropertyListLabelText","StyledPropertyListRow","StyledPropertyListTableAction","StyledPropertyListTableLabel","StyledPropertyListTableValue","StyledPropertyListToggle","StyledPropertyListValue","AddCrossTinyIcon","ArrowDownSmallIcon","DensityContext","LayoutContext","DisabledContext","usePropertyListDensity","usePropertyListLayout","usePropertyListDisabled","PropertyListLayout","_ref","_ref$value","value","children","createElement","Provider","PropertyListDivider","$layout","$density","className","PropertyList","_ref2","ref","_ref2$density","density","_ref2$disabled","disabled","rest","_objectWithoutPropertiesLoose","_excluded","parts","toArray","filter","Boolean","_extends","variant","radius","shadow","$disabled","undefined","map","part","index","_key","key","displayName","PropertyListValue","_ref3","_ref3$placeholder","placeholder","forwardedAs","color","$placeholder","PropertyListAdd","_ref4","PropertyListLabel","_ref5","icon","label","layout","$size","$scale","weight","PropertyListRow","_ref6","action","_ref6$tone","tone","_ref6$readOnly","readOnly","_ref6$chevron","chevron","_ref6$disabled","_excluded2","isDisabled","caret","as","type","$tone","$clickable","PropertyListToggle","_ref7","_ref7$expanded","expanded","_excluded3","PropertyListBranch","_ref8","_ref8$position","position","_excluded4"],"sources":["../../../../src/components/PropertyList/PropertyList.tsx"],"sourcesContent":["import React, {\n ButtonHTMLAttributes,\n Children,\n Fragment,\n HTMLAttributes,\n ReactElement,\n ReactNode,\n Ref,\n createContext,\n forwardRef,\n useContext,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport {\n PropertyListDensity,\n PropertyListLayoutName,\n PropertyListTone,\n StyledPropertyList,\n StyledPropertyListAddIcon,\n StyledPropertyListBranch,\n StyledPropertyListBranchLine,\n StyledPropertyListChevron,\n StyledPropertyListDivider,\n StyledPropertyListIcon,\n StyledPropertyListLabelText,\n StyledPropertyListRow,\n StyledPropertyListTableAction,\n StyledPropertyListTableLabel,\n StyledPropertyListTableValue,\n StyledPropertyListToggle,\n StyledPropertyListValue,\n} from \"./Styles\";\nimport { AddCrossTinyIcon, ArrowDownSmallIcon } from \"../Icons\";\n\nconst DensityContext = createContext<PropertyListDensity>(\"form\");\nconst LayoutContext = createContext<PropertyListLayoutName>(\"stacked\");\nconst DisabledContext = createContext(false);\n\nexport const usePropertyListDensity = () => useContext(DensityContext);\nexport const usePropertyListLayout = () => useContext(LayoutContext);\nexport const usePropertyListDisabled = () => useContext(DisabledContext);\n\n/** Sets the layout of the rows below it: one line each, or the three columns of a table. */\nexport const PropertyListLayout = ({\n value = \"stacked\",\n children,\n}: {\n value?: PropertyListLayoutName;\n children?: ReactNode;\n}) => <LayoutContext.Provider value={value}>{children}</LayoutContext.Provider>;\n\n/** The line between two rows. In a stacked list it starts where the label text starts. */\nexport const PropertyListDivider = () => (\n <StyledPropertyListDivider\n aria-hidden=\"true\"\n $layout={usePropertyListLayout()}\n $density={usePropertyListDensity()}\n className=\"c-property-list__divider\"\n />\n);\n\nexport interface IPropertyListProps extends HTMLAttributes<HTMLDivElement> {\n /** \"form\" for a compact list in a form, \"page\" for a list on a page, with a shadow. */\n density?: PropertyListDensity;\n /** Every row of the list is dimmed and takes no click and no focus. */\n disabled?: boolean;\n}\n\nexport const PropertyList = forwardRef<HTMLDivElement, IPropertyListProps>(\n (\n { density = \"form\", disabled = false, className, children, ...rest },\n ref\n ) => {\n const parts = Children.toArray(children).filter(Boolean);\n\n return (\n <DensityContext.Provider value={density}>\n <DisabledContext.Provider value={disabled}>\n <StyledPropertyList\n {...rest}\n ref={ref}\n variant=\"raised\"\n radius={20}\n shadow={density === \"page\"}\n $disabled={disabled}\n aria-disabled={disabled || undefined}\n className={classnames(\"c-property-list\", className)}\n >\n {parts.map((part, index) => (\n <Fragment key={(part as ReactElement).key ?? index}>\n {index > 0 ? <PropertyListDivider /> : null}\n {part}\n </Fragment>\n ))}\n </StyledPropertyList>\n </DisabledContext.Provider>\n </DensityContext.Provider>\n );\n }\n);\n\nPropertyList.displayName = \"PropertyList\";\n\nexport interface IPropertyListValueProps {\n /** A row with no value shows its text in the placeholder color. */\n placeholder?: boolean;\n className?: string;\n children?: ReactNode;\n}\n\nexport const PropertyListValue = ({\n placeholder = false,\n className,\n children,\n}: IPropertyListValueProps) => (\n <StyledPropertyListValue\n forwardedAs=\"span\"\n color={placeholder ? \"quaternary\" : undefined}\n $density={usePropertyListDensity()}\n $placeholder={placeholder}\n className={classnames(\"c-property-list__value\", className)}\n data-placeholder={placeholder || undefined}\n >\n {children}\n </StyledPropertyListValue>\n);\n\n/** The \"Add\" of a row: a placeholder with a plus where another row has its chevron. */\nexport const PropertyListAdd = ({ children }: { children?: ReactNode }) => (\n <>\n <PropertyListValue placeholder>{children}</PropertyListValue>\n <StyledPropertyListAddIcon>\n <AddCrossTinyIcon />\n </StyledPropertyListAddIcon>\n </>\n);\n\nexport interface IPropertyListLabelProps {\n icon?: ReactNode;\n label?: ReactNode;\n}\n\nexport const PropertyListLabel = ({ icon, label }: IPropertyListLabelProps) => {\n const density = usePropertyListDensity();\n const layout = usePropertyListLayout();\n\n if (layout === \"table\") {\n return (\n <StyledPropertyListTableLabel className=\"c-property-list__label\">\n <StyledPropertyListIcon $size={16} $scale>\n {icon}\n </StyledPropertyListIcon>\n <StyledPropertyListLabelText\n forwardedAs=\"span\"\n weight=\"medium\"\n $layout={layout}\n $density={density}\n >\n {label}\n </StyledPropertyListLabelText>\n </StyledPropertyListTableLabel>\n );\n }\n\n return (\n <>\n <StyledPropertyListIcon\n $size={density === \"page\" ? 28 : 24}\n $scale={false}\n >\n {icon}\n </StyledPropertyListIcon>\n <StyledPropertyListLabelText\n forwardedAs=\"span\"\n weight=\"medium\"\n $layout={layout}\n $density={density}\n className=\"c-property-list__label\"\n >\n {label}\n </StyledPropertyListLabelText>\n </>\n );\n};\n\nexport interface IPropertyListRowProps\n extends Omit<HTMLAttributes<HTMLElement>, \"children\"> {\n icon?: ReactNode;\n label?: ReactNode;\n value?: ReactNode;\n /** A control before the chevron. */\n action?: ReactNode;\n tone?: PropertyListTone;\n /** A read only row is plain text. A row that can change is one button. */\n readOnly?: boolean;\n chevron?: boolean;\n /** Dimmed, with no click and no focus. A disabled list disables its rows. */\n disabled?: boolean;\n /** Replaces the label, the value and the action. */\n children?: ReactNode;\n}\n\nexport const PropertyListRow = forwardRef<HTMLElement, IPropertyListRowProps>(\n (\n {\n icon,\n label,\n value,\n action,\n tone = \"regular\",\n readOnly = false,\n chevron = true,\n disabled = false,\n className,\n children,\n ...rest\n },\n ref\n ) => {\n const isDisabled = usePropertyListDisabled() || disabled;\n const density = usePropertyListDensity();\n const layout = usePropertyListLayout();\n const caret =\n !readOnly && chevron ? (\n <StyledPropertyListChevron>\n <ArrowDownSmallIcon />\n </StyledPropertyListChevron>\n ) : null;\n\n return (\n <StyledPropertyListRow\n {...rest}\n as={readOnly ? \"div\" : \"button\"}\n ref={ref as Ref<HTMLDivElement>}\n {...(readOnly\n ? { \"aria-disabled\": isDisabled || undefined }\n : { type: \"button\", disabled: isDisabled })}\n $disabled={isDisabled}\n $layout={layout}\n $density={density}\n $tone={tone}\n $clickable={!readOnly}\n className={classnames(\"c-property-list__row\", className)}\n >\n {children ??\n (layout === \"table\" ? (\n <>\n <PropertyListLabel icon={icon} label={label} />\n <StyledPropertyListTableValue>\n {value}\n </StyledPropertyListTableValue>\n <StyledPropertyListTableAction>\n {action}\n {caret}\n </StyledPropertyListTableAction>\n </>\n ) : (\n <>\n <PropertyListLabel icon={icon} label={label} />\n {value}\n {action}\n {caret}\n </>\n ))}\n </StyledPropertyListRow>\n );\n }\n);\n\nPropertyListRow.displayName = \"PropertyListRow\";\n\nexport interface IPropertyListToggleProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** The rows that the toggle opens are on the screen. */\n expanded?: boolean;\n}\n\n/** The last row of a list: it opens and closes the rows with no value. */\nexport const PropertyListToggle = forwardRef<\n HTMLButtonElement,\n IPropertyListToggleProps\n>(({ expanded = false, disabled, className, children, ...rest }, ref) => {\n const isDisabled = usePropertyListDisabled() || disabled;\n\n return (\n <StyledPropertyListToggle\n type=\"button\"\n {...rest}\n disabled={isDisabled}\n ref={ref}\n aria-expanded={expanded}\n className={classnames(\"c-property-list__toggle\", className)}\n >\n {children}\n </StyledPropertyListToggle>\n );\n});\n\nPropertyListToggle.displayName = \"PropertyListToggle\";\n\nexport interface IPropertyListBranchProps\n extends HTMLAttributes<HTMLSpanElement> {\n /** \"middle\" continues the line to the next row of the branch. */\n position?: \"middle\" | \"last\";\n}\n\n/** The tree line before a row that belongs to the row above it. Its parent must be positioned. */\nexport const PropertyListBranch = ({\n position = \"last\",\n ...rest\n}: IPropertyListBranchProps) => (\n <>\n <StyledPropertyListBranch aria-hidden=\"true\" {...rest} />\n {position === \"middle\" ? (\n <StyledPropertyListBranchLine aria-hidden=\"true\" />\n ) : null}\n </>\n);\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAEVC,QAAQ,EACRC,QAAQ,EAKRC,aAAa,EACbC,UAAU,EACVC,UAAU,QACL,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAIEC,kBAAkB,EAClBC,yBAAyB,EACzBC,wBAAwB,EACxBC,4BAA4B,EAC5BC,yBAAyB,EACzBC,yBAAyB,EACzBC,sBAAsB,EACtBC,2BAA2B,EAC3BC,qBAAqB,EACrBC,6BAA6B,EAC7BC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,wBAAwB,EACxBC,uBAAuB,QAClB,UAAU;AACjB,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,UAAU;AAE/D,MAAMC,cAAc,gBAAGpB,aAAa,CAAsB,MAAM,CAAC;AACjE,MAAMqB,aAAa,gBAAGrB,aAAa,CAAyB,SAAS,CAAC;AACtE,MAAMsB,eAAe,gBAAGtB,aAAa,CAAC,KAAK,CAAC;AAE5C,OAAO,MAAMuB,sBAAsB,GAAGA,CAAA,KAA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AA,CAAAlC,KAAA,CAAAE,QAAA,qBACEF,KAAA,CAAAkC,aAAA,CAACzB,wBAAwB,EAAA6C,QAAA;IAAC,eAAY;EAAM,GAAKP,IAAI,CAAG,CAAC,EACxD6D,QAAQ,KAAK,QAAQ,gBACpB5G,KAAA,CAAAkC,aAAA,CAACxB,4BAA4B;IAAC,eAAY;EAAM,CAAE,CAAC,GACjD,IACJ,CAAC;AAAA,CACJ","ignoreList":[]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export type PropertyListDensity = "form" | "page";
|
|
2
2
|
export type PropertyListLayoutName = "stacked" | "table";
|
|
3
3
|
export type PropertyListTone = "regular" | "alert";
|
|
4
|
-
export declare const StyledPropertyList: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement> & import("..").ICardProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>, any, {
|
|
4
|
+
export declare const StyledPropertyList: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement> & import("..").ICardProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>, any, {
|
|
5
|
+
$disabled?: boolean;
|
|
6
|
+
}, never>;
|
|
5
7
|
export declare const StyledPropertyListDivider: import("styled-components").StyledComponent<"div", any, {
|
|
6
8
|
$layout: PropertyListLayoutName;
|
|
7
9
|
$density: PropertyListDensity;
|
|
@@ -11,6 +13,7 @@ export declare const StyledPropertyListRow: import("styled-components").StyledCo
|
|
|
11
13
|
$density: PropertyListDensity;
|
|
12
14
|
$tone: PropertyListTone;
|
|
13
15
|
$clickable: boolean;
|
|
16
|
+
$disabled?: boolean;
|
|
14
17
|
}, never>;
|
|
15
18
|
export declare const StyledPropertyListTableLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
16
19
|
export declare const StyledPropertyListIcon: import("styled-components").StyledComponent<"span", any, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/PropertyList/Styles.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,OAAO,CAAC;AACzD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/PropertyList/Styles.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,OAAO,CAAC;AACzD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAAC;AAKnD,eAAO,MAAM,kBAAkB;gBAA8B,OAAO;SAgBnE,CAAC;AAEF,eAAO,MAAM,yBAAyB;aAC3B,sBAAsB;cACrB,mBAAmB;SAO9B,CAAC;AAKF,eAAO,MAAM,qBAAqB;aACvB,sBAAsB;cACrB,mBAAmB;WACtB,gBAAgB;gBACX,OAAO;gBACP,OAAO;SAuDpB,CAAC;AAEF,eAAO,MAAM,4BAA4B,qEAMxC,CAAC;AAEF,eAAO,MAAM,sBAAsB;WAC1B,MAAM;YACL,OAAO;SAahB,CAAC;AAEF,eAAO,MAAM,2BAA2B;aAC7B,sBAAsB;cACrB,mBAAmB;SAgB9B,CAAC;AAEF,eAAO,MAAM,uBAAuB;cACxB,mBAAmB;kBACf,OAAO;SAgBtB,CAAC;AAEF,eAAO,MAAM,yBAAyB,qEAWrC,CAAC;AAEF,eAAO,MAAM,4BAA4B,qEAKxC,CAAC;AAEF,eAAO,MAAM,6BAA6B,qEAOzC,CAAC;AAEF,eAAO,MAAM,yBAAyB,qEAOrC,CAAC;AAEF,eAAO,MAAM,wBAAwB,uEAwBpC,CAAC;AAEF,eAAO,MAAM,wBAAwB,qEAWpC,CAAC;AAEF,eAAO,MAAM,4BAA4B,qEAQxC,CAAC"}
|
|
@@ -1,33 +1,42 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { Card } from "../Card";
|
|
3
3
|
import { Body2 } from "../Typography";
|
|
4
|
+
const disabledSurface = "color-mix(in srgb, var(--surface-raised) 50%, transparent)";
|
|
4
5
|
export const StyledPropertyList = styled(Card).withConfig({
|
|
5
6
|
displayName: "Styles__StyledPropertyList",
|
|
6
7
|
componentId: "sc-ssdfzo-0"
|
|
7
|
-
})(["display:flex;flex-direction:column;overflow:clip;"]
|
|
8
|
+
})(["display:flex;flex-direction:column;overflow:clip;", ""], _ref => {
|
|
9
|
+
let $disabled = _ref.$disabled;
|
|
10
|
+
return $disabled && css(["&&{background-color:", ";}&&:hover{background-color:", ";}"], disabledSurface, disabledSurface);
|
|
11
|
+
});
|
|
8
12
|
export const StyledPropertyListDivider = styled.div.withConfig({
|
|
9
13
|
displayName: "Styles__StyledPropertyListDivider",
|
|
10
14
|
componentId: "sc-ssdfzo-1"
|
|
11
|
-
})(["flex-shrink:0;height:1px;background-color:var(--border-raised);", ""],
|
|
12
|
-
let $layout =
|
|
13
|
-
$density =
|
|
15
|
+
})(["flex-shrink:0;height:1px;background-color:var(--border-raised);", ""], _ref2 => {
|
|
16
|
+
let $layout = _ref2.$layout,
|
|
17
|
+
$density = _ref2.$density;
|
|
14
18
|
return $layout === "stacked" && "margin-left: " + ($density === "page" ? 44 : 46) + "px;";
|
|
15
19
|
});
|
|
16
20
|
const highlight = "linear-gradient(var(--highlight-dark), var(--highlight-dark))";
|
|
17
21
|
export const StyledPropertyListRow = styled.div.withConfig({
|
|
18
22
|
displayName: "Styles__StyledPropertyListRow",
|
|
19
23
|
componentId: "sc-ssdfzo-2"
|
|
20
|
-
})(["position:relative;width:100%;border:0;text-align:left;background-color:", ";", " ", ""],
|
|
21
|
-
let $tone =
|
|
24
|
+
})(["position:relative;width:100%;border:0;text-align:left;background-color:", ";", " ", " ", ""], _ref3 => {
|
|
25
|
+
let $tone = _ref3.$tone;
|
|
22
26
|
return $tone === "alert" ? "var(--alert-surface-subtle)" : "transparent";
|
|
23
|
-
}, _ref3 => {
|
|
24
|
-
let $layout = _ref3.$layout,
|
|
25
|
-
$density = _ref3.$density;
|
|
26
|
-
return $layout === "table" ? css(["display:grid;grid-template-columns:185px minmax(0,1fr) auto;align-items:center;min-height:36px;padding:4px 12px;"]) : css(["display:flex;align-items:center;gap:8px;min-height:", "px;padding:6px 12px;"], $density === "page" ? 44 : 40);
|
|
27
27
|
}, _ref4 => {
|
|
28
|
-
let $
|
|
29
|
-
$
|
|
30
|
-
return $
|
|
28
|
+
let $layout = _ref4.$layout,
|
|
29
|
+
$density = _ref4.$density;
|
|
30
|
+
return $layout === "table" ? css(["display:grid;grid-template-columns:185px minmax(0,1fr) auto;align-items:center;min-height:36px;padding:4px 12px;"]) : css(["display:flex;align-items:center;gap:8px;min-height:", "px;padding:6px 12px;"], $density === "page" ? 44 : 40);
|
|
31
|
+
}, _ref5 => {
|
|
32
|
+
let $disabled = _ref5.$disabled,
|
|
33
|
+
$density = _ref5.$density;
|
|
34
|
+
return $disabled && css(["cursor:default;> *{opacity:0.4;}&& .c-property-list__value[data-placeholder]{color:", ";}"], $density === "page" ? "var(--muted-text)" : "var(--color-theme-800)");
|
|
35
|
+
}, _ref6 => {
|
|
36
|
+
let $clickable = _ref6.$clickable,
|
|
37
|
+
$disabled = _ref6.$disabled,
|
|
38
|
+
$tone = _ref6.$tone;
|
|
39
|
+
return $clickable && !$disabled && css(["cursor:pointer;&:hover,&[aria-expanded=\"true\"]{", "}"], $tone === "alert" ? "background-image: " + highlight + ";" : "background-color: var(--color-theme-200);");
|
|
31
40
|
});
|
|
32
41
|
export const StyledPropertyListTableLabel = styled.span.withConfig({
|
|
33
42
|
displayName: "Styles__StyledPropertyListTableLabel",
|
|
@@ -36,34 +45,34 @@ export const StyledPropertyListTableLabel = styled.span.withConfig({
|
|
|
36
45
|
export const StyledPropertyListIcon = styled.span.withConfig({
|
|
37
46
|
displayName: "Styles__StyledPropertyListIcon",
|
|
38
47
|
componentId: "sc-ssdfzo-4"
|
|
39
|
-
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;width:", "px;height:", "px;& svg{fill:var(--color-theme-700);", "}"],
|
|
40
|
-
let $size =
|
|
48
|
+
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;width:", "px;height:", "px;& svg{fill:var(--color-theme-700);", "}"], _ref7 => {
|
|
49
|
+
let $size = _ref7.$size;
|
|
41
50
|
return $size;
|
|
42
|
-
},
|
|
43
|
-
let $size =
|
|
51
|
+
}, _ref8 => {
|
|
52
|
+
let $size = _ref8.$size;
|
|
44
53
|
return $size;
|
|
45
|
-
},
|
|
46
|
-
let $scale =
|
|
47
|
-
$size =
|
|
54
|
+
}, _ref9 => {
|
|
55
|
+
let $scale = _ref9.$scale,
|
|
56
|
+
$size = _ref9.$size;
|
|
48
57
|
return $scale && "width: " + $size + "px; height: " + $size + "px;";
|
|
49
58
|
});
|
|
50
59
|
export const StyledPropertyListLabelText = styled(Body2).withConfig({
|
|
51
60
|
displayName: "Styles__StyledPropertyListLabelText",
|
|
52
61
|
componentId: "sc-ssdfzo-5"
|
|
53
|
-
})(["&&{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--color-theme-700);", "}"],
|
|
54
|
-
let $layout =
|
|
55
|
-
$density =
|
|
62
|
+
})(["&&{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--color-theme-700);", "}"], _ref0 => {
|
|
63
|
+
let $layout = _ref0.$layout,
|
|
64
|
+
$density = _ref0.$density;
|
|
56
65
|
return $layout === "stacked" && css(["flex:1 1 0%;", ""], $density === "page" ? "margin-left: -4px;" : "padding-left: 6px;");
|
|
57
66
|
});
|
|
58
67
|
export const StyledPropertyListValue = styled(Body2).withConfig({
|
|
59
68
|
displayName: "Styles__StyledPropertyListValue",
|
|
60
69
|
componentId: "sc-ssdfzo-6"
|
|
61
|
-
})(["&&{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:", ";", "}"],
|
|
62
|
-
let $density =
|
|
70
|
+
})(["&&{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:", ";", "}"], _ref1 => {
|
|
71
|
+
let $density = _ref1.$density;
|
|
63
72
|
return $density === "page" ? "15px" : "calc(1em + 1px)";
|
|
64
|
-
},
|
|
65
|
-
let $placeholder =
|
|
66
|
-
$density =
|
|
73
|
+
}, _ref10 => {
|
|
74
|
+
let $placeholder = _ref10.$placeholder,
|
|
75
|
+
$density = _ref10.$density;
|
|
67
76
|
return !$placeholder && "color: " + ($density === "page" ? "var(--muted-text)" : "var(--color-theme-800)") + ";";
|
|
68
77
|
});
|
|
69
78
|
export const StyledPropertyListAddIcon = styled.span.withConfig({
|
|
@@ -85,7 +94,7 @@ export const StyledPropertyListChevron = styled.span.withConfig({
|
|
|
85
94
|
export const StyledPropertyListToggle = styled.button.withConfig({
|
|
86
95
|
displayName: "Styles__StyledPropertyListToggle",
|
|
87
96
|
componentId: "sc-ssdfzo-11"
|
|
88
|
-
})(["display:flex;align-items:center;width:100%;min-height:36px;padding:0 12px;border:0;background-color:transparent;color:var(--color-theme-600);font-size:13px;line-height:20px;text-align:left;cursor:pointer;&:hover,&:focus-visible{background-color:var(--color-theme-200);}"]);
|
|
97
|
+
})(["display:flex;align-items:center;width:100%;min-height:36px;padding:0 12px;border:0;background-color:transparent;color:var(--color-theme-600);font-size:13px;line-height:20px;text-align:left;cursor:pointer;&:hover,&:focus-visible{background-color:var(--color-theme-200);}&:disabled{cursor:default;opacity:0.4;background-color:transparent;}"]);
|
|
89
98
|
export const StyledPropertyListBranch = styled.span.withConfig({
|
|
90
99
|
displayName: "Styles__StyledPropertyListBranch",
|
|
91
100
|
componentId: "sc-ssdfzo-12"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["styled","css","Card","Body2","StyledPropertyList","withConfig","displayName","componentId","StyledPropertyListDivider","div","
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","css","Card","Body2","disabledSurface","StyledPropertyList","withConfig","displayName","componentId","_ref","$disabled","StyledPropertyListDivider","div","_ref2","$layout","$density","highlight","StyledPropertyListRow","_ref3","$tone","_ref4","_ref5","_ref6","$clickable","StyledPropertyListTableLabel","span","StyledPropertyListIcon","_ref7","$size","_ref8","_ref9","$scale","StyledPropertyListLabelText","_ref0","StyledPropertyListValue","_ref1","_ref10","$placeholder","StyledPropertyListAddIcon","StyledPropertyListTableValue","StyledPropertyListTableAction","StyledPropertyListChevron","StyledPropertyListToggle","button","StyledPropertyListBranch","StyledPropertyListBranchLine"],"sources":["../../../../src/components/PropertyList/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { Card } from \"../Card\";\nimport { Body2 } from \"../Typography\";\n\nexport type PropertyListDensity = \"form\" | \"page\";\nexport type PropertyListLayoutName = \"stacked\" | \"table\";\nexport type PropertyListTone = \"regular\" | \"alert\";\n\nconst disabledSurface =\n \"color-mix(in srgb, var(--surface-raised) 50%, transparent)\";\n\nexport const StyledPropertyList = styled(Card)<{ $disabled?: boolean }>`\n display: flex;\n flex-direction: column;\n overflow: clip;\n\n ${({ $disabled }) =>\n $disabled &&\n css`\n && {\n background-color: ${disabledSurface};\n }\n\n &&:hover {\n background-color: ${disabledSurface};\n }\n `}\n`;\n\nexport const StyledPropertyListDivider = styled.div<{\n $layout: PropertyListLayoutName;\n $density: PropertyListDensity;\n}>`\n flex-shrink: 0;\n height: 1px;\n background-color: var(--border-raised);\n ${({ $layout, $density }) =>\n $layout === \"stacked\" && `margin-left: ${$density === \"page\" ? 44 : 46}px;`}\n`;\n\nconst highlight =\n \"linear-gradient(var(--highlight-dark), var(--highlight-dark))\";\n\nexport const StyledPropertyListRow = styled.div<{\n $layout: PropertyListLayoutName;\n $density: PropertyListDensity;\n $tone: PropertyListTone;\n $clickable: boolean;\n $disabled?: boolean;\n}>`\n position: relative;\n width: 100%;\n border: 0;\n text-align: left;\n background-color: ${({ $tone }) =>\n $tone === \"alert\" ? \"var(--alert-surface-subtle)\" : \"transparent\"};\n\n ${({ $layout, $density }) =>\n $layout === \"table\"\n ? css`\n display: grid;\n grid-template-columns: 185px minmax(0, 1fr) auto;\n align-items: center;\n min-height: 36px;\n padding: 4px 12px;\n `\n : css`\n display: flex;\n align-items: center;\n gap: 8px;\n min-height: ${$density === \"page\" ? 44 : 40}px;\n padding: 6px 12px;\n `}\n\n ${({ $disabled, $density }) =>\n $disabled &&\n css`\n cursor: default;\n\n > * {\n opacity: 0.4;\n }\n\n && .c-property-list__value[data-placeholder] {\n color: ${$density === \"page\"\n ? \"var(--muted-text)\"\n : \"var(--color-theme-800)\"};\n }\n `}\n\n ${({ $clickable, $disabled, $tone }) =>\n $clickable &&\n !$disabled &&\n css`\n cursor: pointer;\n\n &:hover,\n &[aria-expanded=\"true\"] {\n ${$tone === \"alert\"\n ? `background-image: ${highlight};`\n : \"background-color: var(--color-theme-200);\"}\n }\n `}\n`;\n\nexport const StyledPropertyListTableLabel = styled.span`\n display: flex;\n align-items: center;\n gap: 10px;\n min-width: 0;\n padding-right: 8px;\n`;\n\nexport const StyledPropertyListIcon = styled.span<{\n $size: number;\n $scale: boolean;\n}>`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: ${({ $size }) => $size}px;\n height: ${({ $size }) => $size}px;\n\n & svg {\n fill: var(--color-theme-700);\n ${({ $scale, $size }) => $scale && `width: ${$size}px; height: ${$size}px;`}\n }\n`;\n\nexport const StyledPropertyListLabelText = styled(Body2)<{\n $layout: PropertyListLayoutName;\n $density: PropertyListDensity;\n}>`\n && {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--color-theme-700);\n\n ${({ $layout, $density }) =>\n $layout === \"stacked\" &&\n css`\n flex: 1 1 0%;\n ${$density === \"page\" ? \"margin-left: -4px;\" : \"padding-left: 6px;\"}\n `}\n }\n`;\n\nexport const StyledPropertyListValue = styled(Body2)<{\n $density: PropertyListDensity;\n $placeholder: boolean;\n}>`\n && {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: ${({ $density }) =>\n $density === \"page\" ? \"15px\" : \"calc(1em + 1px)\"};\n\n ${({ $placeholder, $density }) =>\n !$placeholder &&\n `color: ${\n $density === \"page\" ? \"var(--muted-text)\" : \"var(--color-theme-800)\"\n };`}\n }\n`;\n\nexport const StyledPropertyListAddIcon = styled.span`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n\n & svg {\n fill: var(--color-theme-700);\n }\n`;\n\nexport const StyledPropertyListTableValue = styled.span`\n display: flex;\n align-items: center;\n gap: 8px;\n min-width: 0;\n`;\n\nexport const StyledPropertyListTableAction = styled.span`\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n min-width: 16px;\n padding-left: 8px;\n`;\n\nexport const StyledPropertyListChevron = styled.span`\n display: flex;\n flex-shrink: 0;\n\n & svg {\n fill: var(--color-theme-700);\n }\n`;\n\nexport const StyledPropertyListToggle = styled.button`\n display: flex;\n align-items: center;\n width: 100%;\n min-height: 36px;\n padding: 0 12px;\n border: 0;\n background-color: transparent;\n color: var(--color-theme-600);\n font-size: 13px;\n line-height: 20px;\n text-align: left;\n cursor: pointer;\n\n &:hover,\n &:focus-visible {\n background-color: var(--color-theme-200);\n }\n\n &:disabled {\n cursor: default;\n opacity: 0.4;\n background-color: transparent;\n }\n`;\n\nexport const StyledPropertyListBranch = styled.span`\n position: absolute;\n top: 0;\n left: 19px;\n width: 13px;\n height: 50%;\n border: 0 solid var(--color-theme-500);\n border-bottom-width: 1px;\n border-left-width: 1px;\n border-bottom-left-radius: 4px;\n pointer-events: none;\n`;\n\nexport const StyledPropertyListBranchLine = styled.span`\n position: absolute;\n top: 50%;\n bottom: 0;\n left: 19px;\n width: 1px;\n background-color: var(--color-theme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":["export * from \"./Button\";\nexport * from \"./CaretButton\";\nexport * from \"./ButtonGroup\";\nexport * from \"./Breadcrumbs\";\nexport * from \"./CounterButton\";\nexport * from \"./Steppers\";\nexport * from \"./Tables\";\nexport * from \"./CompleteCheckbox\";\nexport * from \"./Paper\";\nexport * from \"./ScaleBar\";\nexport * from \"./Card\";\nexport * from \"./EntityCard\";\nexport * from \"./EntitiesHeader\";\nexport * from \"./Signifier\";\nexport * from \"./Avatar\";\nexport * from \"./Tag\";\nexport * from \"./Loaders\";\nexport * from \"./Nav\";\nexport * from \"./SideNav\";\nexport * from \"./Bubble\";\nexport * from \"./Input\";\nexport * from \"./Display\";\nexport * from \"./DrilldownMenu\";\nexport * from \"./Menu\";\nexport * from \"./Expanders\";\nexport * from \"./DatePicker\";\nexport * from \"./List\";\nexport * from \"./MenuSelector\";\nexport * from \"./MultiAvatar\";\nexport * from \"./RadioButton\";\nexport * from \"./RadioCard\";\nexport * from \"./RadioGroup\";\nexport * from \"./ScrollShadow\";\nexport * from \"./Icons\";\nexport * from \"./Textarea\";\nexport * from \"./Modal\";\nexport * from \"./Sheet\";\nexport * from \"./Header\";\nexport * from \"./AutoResizeTextarea\";\nexport * from \"./Overlay\";\nexport * from \"./Accordion\";\nexport * from \"./Choose\";\nexport * from \"./ChooseV2\";\nexport * from \"./Links\";\nexport * from \"./SelectDate\";\nexport * from \"./Popper\";\nexport * from \"./ToastMessage\";\nexport * from \"./Tooltip\";\nexport * from \"./Transitions\";\nexport * from \"./Window\";\nexport * from \"./ValueButton\";\nexport * from \"./PillButton\";\nexport * from \"./PillGroup\";\nexport * from \"./Select\";\nexport * from \"./SelectTrigger\";\nexport * from \"./SelectTime\";\nexport * from \"./Dialog\";\nexport * from \"./ConfirmDialog\";\nexport * from \"./Checkbox\";\nexport * from \"./Toggle\";\nexport * from \"./Typography\";\nexport * from \"./Autocomplete\";\nexport * from \"./ComboBox\";\nexport * from \"./Button/AddToListButton\";\nexport * from \"./PortableText\";\nexport * from \"./ProgressBar\";\nexport * from \"./ProgressPie\";\nexport * from \"./Reactions\";\nexport * from \"./Label\";\nexport * from \"./GlobalStyle\";\nexport * from \"./ProgressRing\";\nexport * from \"./EditableContent\";\nexport * from \"./EditableText\";\nexport * from \"./EditableHours\";\nexport * from \"./EditableCurrency\";\nexport * from \"./Folder\";\nexport * from \"./Chip\";\nexport * from \"./Trigger\";\nexport * from \"./Dot\";\nexport * from \"./Entity\";\nexport * from \"./Filter\";\nexport * from \"./Wizard\";\nexport * from \"./ContentWizard\";\nexport * from \"./IconButton\";\nexport * from \"./Typography\";\nexport * from \"./Badge\";\nexport * from \"./AvatarGroup\";\nexport * from \"./CommandPalette\";\nexport * from \"./EmptySlate\";\nexport * from \"./Toolbar\";\nexport * from \"./InfoBox\";\nexport * from \"./Sort\";\nexport * from \"./StepSequence\";\nexport * from \"./StackedCard\";\nexport * from \"./Stack\";\nexport * from \"./Row\";\nexport * from \"./Columns\";\nexport * from \"./Tiles\";\nexport * from \"./Media\";\nexport * from \"./TitledText\";\nexport * from \"./LayoutTokens\";\nexport * from \"./Section\";\nexport * from \"./Collapse\";\nexport * from \"./LabeledDivider\";\nexport * from \"./FloatingPill\";\nexport * from \"./ClampedContent\";\nexport * from \"./ResizeHandle\";\nexport * from \"./ObjectLayout\";\nexport * from \"./ListRow\";\nexport * from \"./FileTile\";\nexport * from \"./EditorFrame\";\nexport * from \"./PropertyList\";\nexport * from \"./MessageBubble\";\nexport * from \"./DockedCard\";\n"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,oBAAoB;AAClC,cAAc,SAAS;AACvB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,cAAc;AAC5B,cAAc,kBAAkB;AAChC,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,OAAO;AACr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ACxB,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,iBAAiB;AAC/B,cAAc,cAAc;AAC5B,cAAc,cAAc;AAC5B,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,QAAQ;AACtB,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,OAAO;AACrB,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,cAAc;AAC5B,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from \"./Button\";\nexport * from \"./CaretButton\";\nexport * from \"./ButtonGroup\";\nexport * from \"./Breadcrumbs\";\nexport * from \"./CounterButton\";\nexport * from \"./Steppers\";\nexport * from \"./Tables\";\nexport * from \"./CompleteCheckbox\";\nexport * from \"./Paper\";\nexport * from \"./ScaleBar\";\nexport * from \"./Card\";\nexport * from \"./EntityCard\";\nexport * from \"./EntitiesHeader\";\nexport * from \"./Signifier\";\nexport * from \"./Avatar\";\nexport * from \"./Tag\";\nexport * from \"./Loaders\";\nexport * from \"./Nav\";\nexport * from \"./SideNav\";\nexport * from \"./Bubble\";\nexport * from \"./Input\";\nexport * from \"./Display\";\nexport * from \"./DrilldownMenu\";\nexport * from \"./Menu\";\nexport * from \"./Expanders\";\nexport * from \"./DatePicker\";\nexport * from \"./List\";\nexport * from \"./MenuSelector\";\nexport * from \"./MultiAvatar\";\nexport * from \"./RadioButton\";\nexport * from \"./RadioCard\";\nexport * from \"./RadioGroup\";\nexport * from \"./ScrollShadow\";\nexport * from \"./Icons\";\nexport * from \"./Textarea\";\nexport * from \"./Modal\";\nexport * from \"./Sheet\";\nexport * from \"./Header\";\nexport * from \"./AutoResizeTextarea\";\nexport * from \"./Overlay\";\nexport * from \"./Accordion\";\nexport * from \"./Choose\";\nexport * from \"./ChooseV2\";\nexport * from \"./Links\";\nexport * from \"./SelectDate\";\nexport * from \"./Popper\";\nexport * from \"./ToastMessage\";\nexport * from \"./Tooltip\";\nexport * from \"./Transitions\";\nexport * from \"./Window\";\nexport * from \"./ValueButton\";\nexport * from \"./PillButton\";\nexport * from \"./PillGroup\";\nexport * from \"./Select\";\nexport * from \"./SelectTrigger\";\nexport * from \"./SelectTime\";\nexport * from \"./Dialog\";\nexport * from \"./ObjectFormModal\";\nexport * from \"./ConfirmDialog\";\nexport * from \"./Checkbox\";\nexport * from \"./Toggle\";\nexport * from \"./Typography\";\nexport * from \"./Autocomplete\";\nexport * from \"./ComboBox\";\nexport * from \"./Button/AddToListButton\";\nexport * from \"./PortableText\";\nexport * from \"./ProgressBar\";\nexport * from \"./ProgressPie\";\nexport * from \"./Reactions\";\nexport * from \"./Label\";\nexport * from \"./GlobalStyle\";\nexport * from \"./ProgressRing\";\nexport * from \"./EditableContent\";\nexport * from \"./EditableText\";\nexport * from \"./EditableHours\";\nexport * from \"./EditableCurrency\";\nexport * from \"./Folder\";\nexport * from \"./Chip\";\nexport * from \"./Trigger\";\nexport * from \"./Dot\";\nexport * from \"./Entity\";\nexport * from \"./Filter\";\nexport * from \"./Wizard\";\nexport * from \"./ContentWizard\";\nexport * from \"./IconButton\";\nexport * from \"./Typography\";\nexport * from \"./Badge\";\nexport * from \"./AvatarGroup\";\nexport * from \"./CommandPalette\";\nexport * from \"./EmptySlate\";\nexport * from \"./Toolbar\";\nexport * from \"./InfoBox\";\nexport * from \"./Sort\";\nexport * from \"./StepSequence\";\nexport * from \"./StackedCard\";\nexport * from \"./Stack\";\nexport * from \"./Row\";\nexport * from \"./Columns\";\nexport * from \"./Tiles\";\nexport * from \"./Media\";\nexport * from \"./TitledText\";\nexport * from \"./LayoutTokens\";\nexport * from \"./Section\";\nexport * from \"./Collapse\";\nexport * from \"./LabeledDivider\";\nexport * from \"./FloatingPill\";\nexport * from \"./ClampedContent\";\nexport * from \"./ResizeHandle\";\nexport * from \"./ObjectLayout\";\nexport * from \"./ListRow\";\nexport * from \"./FileTile\";\nexport * from \"./EditorFrame\";\nexport * from \"./PropertyList\";\nexport * from \"./MessageBubble\";\nexport * from \"./DockedCard\";\n"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,oBAAoB;AAClC,cAAc,SAAS;AACvB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,cAAc;AAC5B,cAAc,kBAAkB;AAChC,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,OAAO;AACrB,cAAc,WAAW;AACzB,cAAc,OAAO;AACrB,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,iBAAiB;AAC/B,cAAc,QAAQ;AACtB,cAAc,aAAa;AAC3B,cAAc,cAAc;AAC5B,cAAc,QAAQ;AACtB,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,aAAa;AAC3B,cAAc,cAAc;AAC5B,cAAc,gBAAgB;AAC9B,cAAc,SAAS;AACvB,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,sBAAsB;AACpC,cAAc,WAAW;AACzB,cAAc,aAAa;A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AkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,cAAc","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputHours.d.ts","sourceRoot":"","sources":["../../../src/hooks/useInputHours.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKT,UAAU,EACX,MAAM,OAAO,CAAC;AAKf,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,OAAA,KAAK,OAAO,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CACzD;AAED,eAAO,MAAM,aAAa,GACxB,wJAYG,WAAW,EACd,UAAU,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useInputHours.d.ts","sourceRoot":"","sources":["../../../src/hooks/useInputHours.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKT,UAAU,EACX,MAAM,OAAO,CAAC;AAKf,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,OAAA,KAAK,OAAO,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CACzD;AAED,eAAO,MAAM,aAAa,GACxB,wJAYG,WAAW,EACd,UAAU,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC;;;;;;;;;;;CA0R7C,CAAC"}
|
|
@@ -114,10 +114,15 @@ export const useInputHours = (_ref, inputRef) => {
|
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
if (e.key === "Escape") {
|
|
117
|
+
// Esc that discards an edit stops here. With nothing to discard it goes on, for example to close a modal.
|
|
118
|
+
if (e.target.value !== prevValue) {
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
}
|
|
117
121
|
escapeRef.current = true;
|
|
118
122
|
e.target.blur();
|
|
119
123
|
typeof onCancel === "function" && onCancel(e);
|
|
120
124
|
escapeRef.current = false;
|
|
125
|
+
return;
|
|
121
126
|
}
|
|
122
127
|
if (e.key === "Backspace") {
|
|
123
128
|
return;
|
|
@@ -177,7 +182,7 @@ export const useInputHours = (_ref, inputRef) => {
|
|
|
177
182
|
return;
|
|
178
183
|
}
|
|
179
184
|
}
|
|
180
|
-
}, [handleIncrementDecrement, inputRef, onCancel, onEnterKeyPress, validation, withLeadingZero]);
|
|
185
|
+
}, [prevValue, handleIncrementDecrement, inputRef, onCancel, onEnterKeyPress, validation, withLeadingZero]);
|
|
181
186
|
const handleChange = useCallback(e => {
|
|
182
187
|
setCurrentValue(e.target.value);
|
|
183
188
|
if (onChange) onChange(e.target.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputHours.js","names":["useCallback","useMemo","useRef","useState","formatHours","validateTimeInput","useInputHours","_ref","inputRef","value","withLeadingZero","onSave","_ref$validation","validation","allowEmptyValue","onCancel","_ref$minuteIncrement","minuteIncrement","incrementOnlySelected","onEnterKeyPress","onChange","onClick","_useState","currentValue","setCurrentValue","_useState2","prevValue","setPrevValue","escapeRef","handleBlur","e","current","target","trim","length","_value","handleIncrementDecrement","increment","selectionStart","dotsIndex","indexOf","_currentValue$split$m","split","map","Number","hours","minutes","newHours","newMinutes","newMinutesString","newHoursString","newValue","requestAnimationFrame","_inputRef$current","newDotsIndex","isHoursSelected","newSelectionStart","selectionEnd","setSelectionRange","handleKeyDown","key","blur","metaKey","ctrlKey","_inputRef$current2","select","input","start","end","shiftKey","isMinutesSelected","_inputRef$current3","preventDefault","_inputRef$current4","substring","handleChange","handleClick","_inputRef$current5","_inputRef$current6","_inputRef$current7","handleDoubleClick","_inputRef$current8","inputProps","onBlur","onKeyDown","onDoubleClick"],"sources":["../../../src/hooks/useInputHours.tsx"],"sourcesContent":["import {\n RefObject,\n useCallback,\n useMemo,\n useRef,\n useState,\n MouseEvent,\n} from \"react\";\n\nimport { formatHours } from \"../utils\";\nimport { validateTimeInput } from \"../utils\";\n\nexport interface IInputHours {\n value?: string | number;\n withLeadingZero?: boolean;\n onSave?: (e: Event) => void;\n validation?: (...args) => boolean;\n allowEmptyValue?: boolean;\n onCancel?: (e: Event) => void;\n minuteIncrement?: number;\n incrementOnlySelected?: boolean;\n onEnterKeyPress?: (val: string) => void;\n onChange?: (val: string) => void;\n onClick?: (event: MouseEvent<HTMLInputElement>) => void;\n}\n\nexport const useInputHours = (\n {\n value,\n withLeadingZero,\n onSave,\n validation = validateTimeInput,\n allowEmptyValue,\n onCancel,\n minuteIncrement = 1,\n incrementOnlySelected,\n onEnterKeyPress,\n onChange,\n onClick,\n }: IInputHours,\n inputRef: RefObject<HTMLInputElement | null>\n) => {\n const [currentValue, setCurrentValue] = useState(() =>\n formatHours(value, withLeadingZero)\n );\n const [prevValue, setPrevValue] = useState(() =>\n formatHours(value, withLeadingZero)\n );\n\n const escapeRef = useRef(false);\n\n const handleBlur = useCallback(\n (e) => {\n if (escapeRef.current) {\n setCurrentValue(prevValue);\n } else {\n if (e.target.value.trim().length > 0 && prevValue !== e.target.value) {\n const _value = formatHours(e.target.value, withLeadingZero);\n setPrevValue(_value);\n setCurrentValue(_value);\n typeof onSave === \"function\" && onSave(e);\n } else {\n if (!allowEmptyValue) {\n setCurrentValue(prevValue);\n typeof onCancel === \"function\" && onCancel(e);\n } else {\n if (typeof onSave === \"function\" && prevValue !== e.target.value) {\n onSave(e);\n } else {\n typeof onCancel === \"function\" && onCancel(e);\n }\n }\n }\n }\n },\n [allowEmptyValue, onCancel, onSave, prevValue, withLeadingZero]\n );\n\n const handleIncrementDecrement = useCallback(\n (increment: boolean) => {\n if (inputRef.current) {\n const selectionStart = inputRef.current.selectionStart;\n if (selectionStart !== null) {\n const dotsIndex = currentValue.indexOf(\":\");\n const [hours, minutes] = currentValue.split(\":\").map(Number);\n let newHours = hours;\n let newMinutes = minutes;\n\n if (selectionStart < dotsIndex) {\n if (increment) {\n newHours += 1;\n } else {\n newHours -= 1;\n if (newHours < 0) newHours = 0;\n }\n } else if (selectionStart > dotsIndex) {\n if (increment) {\n newMinutes += minuteIncrement;\n if (newMinutes > 59) {\n newMinutes = 0;\n if (!incrementOnlySelected) newHours += 1;\n }\n } else {\n if (newMinutes >= minuteIncrement || newMinutes === 0) {\n newMinutes -= minuteIncrement;\n if (newMinutes < 0 && newHours > 0) {\n newMinutes = 60 - minuteIncrement;\n if (!incrementOnlySelected) newHours -= 1;\n }\n if (newHours < 0) {\n newHours = 0;\n }\n } else {\n newMinutes = 0;\n }\n }\n }\n\n const newMinutesString =\n newMinutes < 10 ? `0${newMinutes}` : newMinutes;\n const newHoursString =\n withLeadingZero && newHours < 10 ? `0${newHours}` : newHours;\n const newValue = `${newHoursString}:${newMinutesString}`;\n\n if (validation(newValue, withLeadingZero)) {\n setCurrentValue(newValue);\n\n if (onChange) onChange(newValue);\n\n requestAnimationFrame(() => {\n const newDotsIndex = newValue.indexOf(\":\");\n const isHoursSelected = selectionStart < newDotsIndex;\n const newSelectionStart = isHoursSelected ? 0 : newDotsIndex + 1;\n const selectionEnd = isHoursSelected\n ? newDotsIndex\n : newValue.length;\n inputRef.current?.setSelectionRange(\n newSelectionStart,\n selectionEnd\n );\n });\n }\n }\n }\n },\n [\n currentValue,\n incrementOnlySelected,\n inputRef,\n minuteIncrement,\n onChange,\n validation,\n withLeadingZero,\n ]\n );\n\n const handleKeyDown = useCallback(\n (e) => {\n if (e.key === \"Enter\") {\n e.target.blur();\n if (typeof onEnterKeyPress === \"function\")\n onEnterKeyPress(e.target.value);\n }\n if (e.key === \"ArrowLeft\") {\n return;\n }\n if (e.key === \"ArrowRight\") {\n return;\n }\n if (e.key === \"Escape\") {\n escapeRef.current = true;\n e.target.blur();\n typeof onCancel === \"function\" && onCancel(e);\n escapeRef.current = false;\n }\n if (e.key === \"Backspace\") {\n return;\n }\n if (e.key === \"Delete\") {\n return;\n }\n if ((e.metaKey || e.ctrlKey) && e.key === \"a\") {\n inputRef.current?.select();\n return;\n }\n const input = e.target;\n const start = input.selectionStart;\n const end = input.selectionEnd;\n const currentValue = input.value;\n if (e.key === \"Tab\") {\n if (start !== end) {\n if (e.shiftKey) {\n const newDotsIndex = currentValue.indexOf(\":\");\n const isMinutesSelected = start > newDotsIndex;\n if (isMinutesSelected) {\n e.preventDefault();\n inputRef.current?.setSelectionRange(0, newDotsIndex);\n }\n } else {\n const newDotsIndex = currentValue.indexOf(\":\");\n const isHoursSelected = start < newDotsIndex;\n if (isHoursSelected) {\n e.preventDefault();\n inputRef.current?.setSelectionRange(\n newDotsIndex + 1,\n currentValue.length\n );\n }\n }\n }\n return;\n }\n\n if (start !== end) {\n if (e.key === \"ArrowUp\") {\n handleIncrementDecrement(true);\n return;\n }\n if (e.key === \"ArrowDown\") {\n handleIncrementDecrement(false);\n return;\n }\n const newValue =\n currentValue.substring(0, start) +\n e.key +\n currentValue.substring(end);\n if (!validation(newValue, withLeadingZero)) {\n e.preventDefault();\n return;\n }\n } else {\n const newValue =\n currentValue.substring(0, start) +\n e.key +\n currentValue.substring(end);\n\n if (!validation(newValue, withLeadingZero)) {\n e.preventDefault();\n return;\n }\n }\n },\n [\n handleIncrementDecrement,\n inputRef,\n onCancel,\n onEnterKeyPress,\n validation,\n withLeadingZero,\n ]\n );\n\n const handleChange = useCallback(\n (e) => {\n setCurrentValue(e.target.value);\n if (onChange) onChange(e.target.value);\n },\n [onChange]\n );\n\n const handleClick = useCallback(\n (e) => {\n const selectionStart = inputRef.current?.selectionStart;\n if (\n inputRef.current &&\n currentValue &&\n currentValue.length > 0 &&\n typeof selectionStart === \"number\"\n ) {\n const dotsIndex = currentValue.indexOf(\":\");\n if (selectionStart < dotsIndex) {\n inputRef.current?.setSelectionRange(0, dotsIndex);\n } else if (selectionStart >= dotsIndex) {\n inputRef.current?.setSelectionRange(\n dotsIndex + 1,\n currentValue.length\n );\n }\n }\n\n if (typeof onClick === \"function\") {\n onClick(e);\n }\n },\n [currentValue, inputRef, onClick]\n );\n\n const handleDoubleClick = useCallback(() => {\n if (inputRef.current) {\n inputRef.current?.select();\n }\n }, [inputRef]);\n\n const inputProps = useMemo(() => {\n return {\n value: currentValue,\n onBlur: handleBlur,\n onKeyDown: handleKeyDown,\n onChange: handleChange,\n onClick: handleClick,\n onDoubleClick: handleDoubleClick,\n };\n }, [\n currentValue,\n handleBlur,\n handleChange,\n handleClick,\n handleDoubleClick,\n handleKeyDown,\n ]);\n\n return {\n inputProps,\n setCurrentValue,\n setPrevValue,\n };\n};\n"],"mappings":"AAAA,SAEEA,WAAW,EACXC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAEH,OAAO;AAEd,SAASC,WAAW,QAAQ,UAAU;AACtC,SAASC,iBAAiB,QAAQ,UAAU;AAgB5C,OAAO,MAAMC,aAAa,GAAGA,CAAAC,IAAA,EAc3BC,QAA4C,KACzC;EAAA,IAbDC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,eAAe,GAAAH,IAAA,CAAfG,eAAe;IACfC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IAAAC,eAAA,GAAAL,IAAA,CACNM,UAAU;IAAVA,UAAU,GAAAD,eAAA,cAAGP,iBAAiB,GAAAO,eAAA;IAC9BE,eAAe,GAAAP,IAAA,CAAfO,eAAe;IACfC,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;IAAAC,oBAAA,GAAAT,IAAA,CACRU,eAAe;IAAfA,eAAe,GAAAD,oBAAA,cAAG,CAAC,GAAAA,oBAAA;IACnBE,qBAAqB,GAAAX,IAAA,CAArBW,qBAAqB;IACrBC,eAAe,GAAAZ,IAAA,CAAfY,eAAe;IACfC,QAAQ,GAAAb,IAAA,CAARa,QAAQ;IACRC,OAAO,GAAAd,IAAA,CAAPc,OAAO;EAIT,MAAAC,SAAA,GAAwCnB,QAAQ,CAAC,MAC/CC,WAAW,CAACK,KAAK,EAAEC,eAAe,CACpC,CAAC;IAFMa,YAAY,GAAAD,SAAA;IAAEE,eAAe,GAAAF,SAAA;EAGpC,MAAAG,UAAA,GAAkCtB,QAAQ,CAAC,MACzCC,WAAW,CAACK,KAAK,EAAEC,eAAe,CACpC,CAAC;IAFMgB,SAAS,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ACP,YAAY,EAAEf,QAAQ,EAAEa,OAAO,CAClC,CAAC;EAED,MAAM2D,iBAAiB,GAAGhF,WAAW,CAAC,MAAM;IAC1C,IAAIQ,QAAQ,CAACuB,OAAO,EAAE;MAAA,IAAAkD,kBAAA;MACpB,CAAAA,kBAAA,GAAAzE,QAAQ,CAACuB,OAAO,aAAhBkD,kBAAA,CAAkBhB,MAAM,CAAC,CAAC;IAC5B;EACF,CAAC,EAAE,CAACzD,QAAQ,CAAC,CAAC;EAEd,MAAM0E,UAAU,GAAGjF,OAAO,CAAC,MAAM;IAC/B,OAAO;MACLQ,KAAK,EAAEc,YAAY;MACnB4D,MAAM,EAAEtD,UAAU;MAClBuD,SAAS,EAAEzB,aAAa;MACxBvC,QAAQ,EAAEuD,YAAY;MACtBtD,OAAO,EAAEuD,WAAW;MACpBS,aAAa,EAAEL;IACjB,CAAC;EACH,CAAC,EAAE,CACDzD,YAAY,EACZM,UAAU,EACV8C,YAAY,EACZC,WAAW,EACXI,iBAAiB,EACjBrB,aAAa,CACd,CAAC;EAEF,OAAO;IACLuB,UAAU;IACV1D,eAAe;IACfG;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useInputHours.js","names":["useCallback","useMemo","useRef","useState","formatHours","validateTimeInput","useInputHours","_ref","inputRef","value","withLeadingZero","onSave","_ref$validation","validation","allowEmptyValue","onCancel","_ref$minuteIncrement","minuteIncrement","incrementOnlySelected","onEnterKeyPress","onChange","onClick","_useState","currentValue","setCurrentValue","_useState2","prevValue","setPrevValue","escapeRef","handleBlur","e","current","target","trim","length","_value","handleIncrementDecrement","increment","selectionStart","dotsIndex","indexOf","_currentValue$split$m","split","map","Number","hours","minutes","newHours","newMinutes","newMinutesString","newHoursString","newValue","requestAnimationFrame","_inputRef$current","newDotsIndex","isHoursSelected","newSelectionStart","selectionEnd","setSelectionRange","handleKeyDown","key","blur","preventDefault","metaKey","ctrlKey","_inputRef$current2","select","input","start","end","shiftKey","isMinutesSelected","_inputRef$current3","_inputRef$current4","substring","handleChange","handleClick","_inputRef$current5","_inputRef$current6","_inputRef$current7","handleDoubleClick","_inputRef$current8","inputProps","onBlur","onKeyDown","onDoubleClick"],"sources":["../../../src/hooks/useInputHours.tsx"],"sourcesContent":["import {\n RefObject,\n useCallback,\n useMemo,\n useRef,\n useState,\n MouseEvent,\n} from \"react\";\n\nimport { formatHours } from \"../utils\";\nimport { validateTimeInput } from \"../utils\";\n\nexport interface IInputHours {\n value?: string | number;\n withLeadingZero?: boolean;\n onSave?: (e: Event) => void;\n validation?: (...args) => boolean;\n allowEmptyValue?: boolean;\n onCancel?: (e: Event) => void;\n minuteIncrement?: number;\n incrementOnlySelected?: boolean;\n onEnterKeyPress?: (val: string) => void;\n onChange?: (val: string) => void;\n onClick?: (event: MouseEvent<HTMLInputElement>) => void;\n}\n\nexport const useInputHours = (\n {\n value,\n withLeadingZero,\n onSave,\n validation = validateTimeInput,\n allowEmptyValue,\n onCancel,\n minuteIncrement = 1,\n incrementOnlySelected,\n onEnterKeyPress,\n onChange,\n onClick,\n }: IInputHours,\n inputRef: RefObject<HTMLInputElement | null>\n) => {\n const [currentValue, setCurrentValue] = useState(() =>\n formatHours(value, withLeadingZero)\n );\n const [prevValue, setPrevValue] = useState(() =>\n formatHours(value, withLeadingZero)\n );\n\n const escapeRef = useRef(false);\n\n const handleBlur = useCallback(\n (e) => {\n if (escapeRef.current) {\n setCurrentValue(prevValue);\n } else {\n if (e.target.value.trim().length > 0 && prevValue !== e.target.value) {\n const _value = formatHours(e.target.value, withLeadingZero);\n setPrevValue(_value);\n setCurrentValue(_value);\n typeof onSave === \"function\" && onSave(e);\n } else {\n if (!allowEmptyValue) {\n setCurrentValue(prevValue);\n typeof onCancel === \"function\" && onCancel(e);\n } else {\n if (typeof onSave === \"function\" && prevValue !== e.target.value) {\n onSave(e);\n } else {\n typeof onCancel === \"function\" && onCancel(e);\n }\n }\n }\n }\n },\n [allowEmptyValue, onCancel, onSave, prevValue, withLeadingZero]\n );\n\n const handleIncrementDecrement = useCallback(\n (increment: boolean) => {\n if (inputRef.current) {\n const selectionStart = inputRef.current.selectionStart;\n if (selectionStart !== null) {\n const dotsIndex = currentValue.indexOf(\":\");\n const [hours, minutes] = currentValue.split(\":\").map(Number);\n let newHours = hours;\n let newMinutes = minutes;\n\n if (selectionStart < dotsIndex) {\n if (increment) {\n newHours += 1;\n } else {\n newHours -= 1;\n if (newHours < 0) newHours = 0;\n }\n } else if (selectionStart > dotsIndex) {\n if (increment) {\n newMinutes += minuteIncrement;\n if (newMinutes > 59) {\n newMinutes = 0;\n if (!incrementOnlySelected) newHours += 1;\n }\n } else {\n if (newMinutes >= minuteIncrement || newMinutes === 0) {\n newMinutes -= minuteIncrement;\n if (newMinutes < 0 && newHours > 0) {\n newMinutes = 60 - minuteIncrement;\n if (!incrementOnlySelected) newHours -= 1;\n }\n if (newHours < 0) {\n newHours = 0;\n }\n } else {\n newMinutes = 0;\n }\n }\n }\n\n const newMinutesString =\n newMinutes < 10 ? `0${newMinutes}` : newMinutes;\n const newHoursString =\n withLeadingZero && newHours < 10 ? `0${newHours}` : newHours;\n const newValue = `${newHoursString}:${newMinutesString}`;\n\n if (validation(newValue, withLeadingZero)) {\n setCurrentValue(newValue);\n\n if (onChange) onChange(newValue);\n\n requestAnimationFrame(() => {\n const newDotsIndex = newValue.indexOf(\":\");\n const isHoursSelected = selectionStart < newDotsIndex;\n const newSelectionStart = isHoursSelected ? 0 : newDotsIndex + 1;\n const selectionEnd = isHoursSelected\n ? newDotsIndex\n : newValue.length;\n inputRef.current?.setSelectionRange(\n newSelectionStart,\n selectionEnd\n );\n });\n }\n }\n }\n },\n [\n currentValue,\n incrementOnlySelected,\n inputRef,\n minuteIncrement,\n onChange,\n validation,\n withLeadingZero,\n ]\n );\n\n const handleKeyDown = useCallback(\n (e) => {\n if (e.key === \"Enter\") {\n e.target.blur();\n if (typeof onEnterKeyPress === \"function\")\n onEnterKeyPress(e.target.value);\n }\n if (e.key === \"ArrowLeft\") {\n return;\n }\n if (e.key === \"ArrowRight\") {\n return;\n }\n if (e.key === \"Escape\") {\n // Esc that discards an edit stops here. With nothing to discard it goes on, for example to close a modal.\n if (e.target.value !== prevValue) {\n e.preventDefault();\n }\n escapeRef.current = true;\n e.target.blur();\n typeof onCancel === \"function\" && onCancel(e);\n escapeRef.current = false;\n return;\n }\n if (e.key === \"Backspace\") {\n return;\n }\n if (e.key === \"Delete\") {\n return;\n }\n if ((e.metaKey || e.ctrlKey) && e.key === \"a\") {\n inputRef.current?.select();\n return;\n }\n const input = e.target;\n const start = input.selectionStart;\n const end = input.selectionEnd;\n const currentValue = input.value;\n if (e.key === \"Tab\") {\n if (start !== end) {\n if (e.shiftKey) {\n const newDotsIndex = currentValue.indexOf(\":\");\n const isMinutesSelected = start > newDotsIndex;\n if (isMinutesSelected) {\n e.preventDefault();\n inputRef.current?.setSelectionRange(0, newDotsIndex);\n }\n } else {\n const newDotsIndex = currentValue.indexOf(\":\");\n const isHoursSelected = start < newDotsIndex;\n if (isHoursSelected) {\n e.preventDefault();\n inputRef.current?.setSelectionRange(\n newDotsIndex + 1,\n currentValue.length\n );\n }\n }\n }\n return;\n }\n\n if (start !== end) {\n if (e.key === \"ArrowUp\") {\n handleIncrementDecrement(true);\n return;\n }\n if (e.key === \"ArrowDown\") {\n handleIncrementDecrement(false);\n return;\n }\n const newValue =\n currentValue.substring(0, start) +\n e.key +\n currentValue.substring(end);\n if (!validation(newValue, withLeadingZero)) {\n e.preventDefault();\n return;\n }\n } else {\n const newValue =\n currentValue.substring(0, start) +\n e.key +\n currentValue.substring(end);\n\n if (!validation(newValue, withLeadingZero)) {\n e.preventDefault();\n return;\n }\n }\n },\n [\n prevValue,\n handleIncrementDecrement,\n inputRef,\n onCancel,\n onEnterKeyPress,\n validation,\n withLeadingZero,\n ]\n );\n\n const handleChange = useCallback(\n (e) => {\n setCurrentValue(e.target.value);\n if (onChange) onChange(e.target.value);\n },\n [onChange]\n );\n\n const handleClick = useCallback(\n (e) => {\n const selectionStart = inputRef.current?.selectionStart;\n if (\n inputRef.current &&\n currentValue &&\n currentValue.length > 0 &&\n typeof selectionStart === \"number\"\n ) {\n const dotsIndex = currentValue.indexOf(\":\");\n if (selectionStart < dotsIndex) {\n inputRef.current?.setSelectionRange(0, dotsIndex);\n } else if (selectionStart >= dotsIndex) {\n inputRef.current?.setSelectionRange(\n dotsIndex + 1,\n currentValue.length\n );\n }\n }\n\n if (typeof onClick === \"function\") {\n onClick(e);\n }\n },\n [currentValue, inputRef, onClick]\n );\n\n const handleDoubleClick = useCallback(() => {\n if (inputRef.current) {\n inputRef.current?.select();\n }\n }, [inputRef]);\n\n const inputProps = useMemo(() => {\n return {\n value: currentValue,\n onBlur: handleBlur,\n onKeyDown: handleKeyDown,\n onChange: handleChange,\n onClick: handleClick,\n onDoubleClick: handleDoubleClick,\n };\n }, [\n currentValue,\n handleBlur,\n handleChange,\n handleClick,\n handleDoubleClick,\n handleKeyDown,\n ]);\n\n return {\n inputProps,\n setCurrentValue,\n setPrevValue,\n };\n};\n"],"mappings":"AAAA,SAEEA,WAAW,EACXC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAEH,OAAO;AAEd,SAASC,WAAW,QAAQ,UAAU;AACtC,SAASC,iBAAiB,QAAQ,UAAU;AAgB5C,OAAO,MAAMC,aAAa,GAAGA,CAAAC,IAAA,EAc3BC,QAA4C,KACzC;EAAA,IAbDC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,eAAe,GAAAH,IAAA,CAAfG,eAAe;IACfC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IAAAC,eAAA,GAAAL,IAAA,CACNM,UAAU;IAAVA,UAAU,GAAAD,eAAA,cAAGP,iBAAiB,GAAAO,eAAA;IAC9BE,eAAe,GAAAP,IAAA,CAAfO,eAAe;IACfC,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;IAAAC,oBAAA,GAAAT,IAAA,CACRU,eAAe;IAAfA,eAAe,GAAAD,oB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AAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACxD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC9B,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,CACX,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,OAAO,EACtB,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,MAAM,EACrB,KAAK,CAAC,EAAE,MAAM,KACX,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,GACzB,8PAsBG,YAAY,EACf,UAAU,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC;;;;;;;;;;;CA+a7C,CAAC"}
|
|
@@ -165,10 +165,15 @@ export const useInputNumber = (_ref, inputRef) => {
|
|
|
165
165
|
updateValue("decrement");
|
|
166
166
|
}
|
|
167
167
|
if (e.key === "Escape") {
|
|
168
|
+
// Esc that discards an edit stops here. With nothing to discard it goes on, for example to close a modal.
|
|
169
|
+
if (e.target.value !== prevValue) {
|
|
170
|
+
e.preventDefault();
|
|
171
|
+
}
|
|
168
172
|
escapeRef.current = true;
|
|
169
173
|
e.target.blur();
|
|
170
174
|
typeof onCancel === "function" && onCancel(e);
|
|
171
175
|
escapeRef.current = false;
|
|
176
|
+
return;
|
|
172
177
|
}
|
|
173
178
|
if (e.key === "Backspace") {
|
|
174
179
|
return;
|
|
@@ -209,7 +214,7 @@ export const useInputNumber = (_ref, inputRef) => {
|
|
|
209
214
|
e.preventDefault();
|
|
210
215
|
return;
|
|
211
216
|
}
|
|
212
|
-
}, [decimalLength, decimalSeparator, disableMacros, inputRef, limit, min, numericValue, onCancel, onEnterKeyPress, updateValue, validation]);
|
|
217
|
+
}, [prevValue, decimalLength, decimalSeparator, disableMacros, inputRef, limit, min, numericValue, onCancel, onEnterKeyPress, updateValue, validation]);
|
|
213
218
|
const handleChange = useCallback(e => {
|
|
214
219
|
const inputValue = e.target.value;
|
|
215
220
|
let numericNewValue = undefined;
|