@pega/cosmos-react-core 9.0.0-build.9.1 → 9.0.0-build.9.10
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/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +6 -4
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +5 -3
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +6 -4
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/Dialog/InfoDialog.js +1 -1
- package/lib/components/Dialog/InfoDialog.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.js +4 -2
- package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.utils.d.ts +1 -1
- package/lib/components/FieldGroup/FieldGroupList.utils.js +2 -2
- package/lib/components/FieldGroup/FieldGroupList.utils.js.map +1 -1
- package/lib/components/Icon/streamline-icons/mobius.icon.d.ts +5 -0
- package/lib/components/Icon/streamline-icons/mobius.icon.d.ts.map +1 -0
- package/lib/components/Icon/streamline-icons/mobius.icon.js +7 -0
- package/lib/components/Icon/streamline-icons/mobius.icon.js.map +1 -0
- package/lib/components/Icon/streamlineIconNames.d.ts +1 -1
- package/lib/components/Icon/streamlineIconNames.d.ts.map +1 -1
- package/lib/components/Icon/streamlineIconNames.js +1 -0
- package/lib/components/Icon/streamlineIconNames.js.map +1 -1
- package/lib/components/MetaList/MetaList.js +1 -1
- package/lib/components/MetaList/MetaList.js.map +1 -1
- package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
- package/lib/components/Popover/Popover.styles.js +18 -1
- package/lib/components/Popover/Popover.styles.js.map +1 -1
- package/lib/components/Popover/modifiers.d.ts.map +1 -1
- package/lib/components/Popover/modifiers.js +10 -0
- package/lib/components/Popover/modifiers.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +3 -1
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +33 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useItemIntersection.d.ts +2 -1
- package/lib/hooks/useItemIntersection.d.ts.map +1 -1
- package/lib/hooks/useItemIntersection.js +10 -6
- package/lib/hooks/useItemIntersection.js.map +1 -1
- package/lib/i18n/default.d.ts +33 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +36 -0
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +33 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/styles/animations.d.ts +9 -0
- package/lib/styles/animations.d.ts.map +1 -0
- package/lib/styles/animations.js +78 -0
- package/lib/styles/animations.js.map +1 -0
- package/lib/styles/index.d.ts +1 -0
- package/lib/styles/index.d.ts.map +1 -1
- package/lib/styles/index.js +1 -0
- package/lib/styles/index.js.map +1 -1
- package/lib/utils/getFocusables.d.ts +4 -2
- package/lib/utils/getFocusables.d.ts.map +1 -1
- package/lib/utils/getFocusables.js +9 -7
- package/lib/utils/getFocusables.js.map +1 -1
- package/lib/utils/isInstance.d.ts +4 -4
- package/lib/utils/isInstance.d.ts.map +1 -1
- package/lib/utils/isInstance.js +20 -8
- package/lib/utils/isInstance.js.map +1 -1
- package/package.json +1 -1
|
@@ -15,10 +15,20 @@ export const fitToContent = Object.freeze({
|
|
|
15
15
|
phase: 'beforeWrite',
|
|
16
16
|
requires: ['computeStyles', 'offset'],
|
|
17
17
|
fn({ state }) {
|
|
18
|
+
if (state.elements.popper.dataset.initialized !== 'true') {
|
|
19
|
+
state.elements.popper.style.visibility = 'hidden';
|
|
20
|
+
}
|
|
18
21
|
state.styles.popper.width = 'fit-content';
|
|
19
22
|
// Ideally, we would use `content-width.md` from the theme, but we can't access it outside of a React function component
|
|
20
23
|
state.elements.popper.style.maxWidth = '60ch';
|
|
21
24
|
state.elements.popper.style.minWidth = `${state.rects.reference.width}px`;
|
|
25
|
+
state.elements.popper.style.visibility = 'visible';
|
|
26
|
+
state.elements.popper.dataset.initialized = 'true';
|
|
27
|
+
},
|
|
28
|
+
effect({ instance }) {
|
|
29
|
+
requestAnimationFrame(() => {
|
|
30
|
+
instance.update();
|
|
31
|
+
});
|
|
22
32
|
}
|
|
23
33
|
});
|
|
24
34
|
export const placeAndContain = Object.freeze({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modifiers.js","sourceRoot":"","sources":["../../../src/components/Popover/modifiers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAExF,MAAM,CAAC,MAAM,SAAS,GAAkC,MAAM,CAAC,MAAM,CAAC;IACpE,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,aAAa;IACpB,EAAE,CAAC,EAAE,KAAK,EAAE;QACV,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;IACjE,CAAC;IACD,QAAQ,EAAE,CAAC,eAAe,CAAC;CAC5B,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,mBAAmB,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,YAAY,GAAqC,MAAM,CAAC,MAAM,CAAC;IAC1E,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE,CAAC,e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AAC,SAAS,GAAG,iBAAiB,CAAC;YACpC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;QACrB,CAAC;IACH,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { Modifier } from '@popperjs/core';\n\nimport { documentIsAvailable, getScrollbarWidth, testElForOverflow } from '../../utils';\n\nexport const sameWidth: Modifier<'sameWidth', object> = Object.freeze({\n name: 'sameWidth',\n enabled: true,\n phase: 'beforeWrite',\n fn({ state }) {\n state.styles.popper.width = `${state.rects.reference.width}px`;\n },\n requires: ['computeStyles']\n});\n\nconst scrollbarSize = documentIsAvailable ? getScrollbarWidth() : 0;\n\nexport const fitToContent: Modifier<'fitToContent', object> = Object.freeze({\n name: 'fitToContent',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['computeStyles', 'offset'],\n fn({ state }) {\n state.styles.popper.width = 'fit-content';\n // Ideally, we would use `content-width.md` from the theme, but we can't access it outside of a React function component\n state.elements.popper.style.maxWidth = '60ch';\n state.elements.popper.style.minWidth = `${state.rects.reference.width}px`;\n }\n});\n\nexport const placeAndContain: Modifier<'placeAndContain', object> = Object.freeze({\n name: 'placeAndContain',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['computeStyles', 'offset'],\n fn: ({ state }) => {\n const [requestedPrimaryPlacement, requestedSecondaryPlacement] = state.placement.split('-') as [\n primaryPlacement: 'top' | 'bottom' | 'left' | 'right' | 'auto',\n secondaryPlacement?: 'start' | 'end' | undefined\n ];\n\n const padding = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n };\n\n const preventOverflowPad = state.orderedModifiers.find(({ name }) => name === 'preventOverflow')\n ?.options?.padding;\n\n if (typeof preventOverflowPad === 'number') {\n padding.top = preventOverflowPad;\n padding.bottom = preventOverflowPad;\n padding.right = preventOverflowPad;\n padding.left = preventOverflowPad;\n } else if (preventOverflowPad) {\n padding.top = preventOverflowPad.top ?? padding.top;\n padding.bottom = preventOverflowPad.bottom ?? padding.bottom;\n padding.right = preventOverflowPad.right ?? padding.right;\n padding.left = preventOverflowPad.left ?? padding.left;\n }\n\n const vw = document.documentElement.clientWidth;\n const vh = document.documentElement.clientHeight;\n\n const targetRect = state.rects.reference;\n const targetRectXStart = targetRect.x;\n const targetRectXEnd = targetRectXStart + targetRect.width;\n const targetRectYStart = targetRect.y;\n const targetRectYEnd = targetRectYStart + targetRect.height;\n const targetXMid = (targetRectXStart + targetRectXEnd) / 2;\n const targetYMid = (targetRectYStart + targetRectYEnd) / 2;\n const targetIsInLeftHalfOfViewport = targetXMid < vw / 2;\n const targetIsInTopHalfOfViewport = targetYMid < vh / 2;\n\n const offsetFromTargetX = state.modifiersData.offset?.[state.placement]?.x ?? 0;\n const offsetFromTargetY = state.modifiersData.offset?.[state.placement]?.y ?? 0;\n\n let popoverMaxWidth: null | number = null;\n let popoverMaxHeight: null | number = null;\n\n // The elements whose natural content size should be measured to determine resolved placement\n const scrollableEls = [...state.elements.popper.children].flatMap(popoverChildEl => {\n // Default to measuring direct popover children unless they have measureable items declared within\n const elsToMeasure = popoverChildEl.querySelectorAll('[data-popover-scroll-el]');\n return elsToMeasure.length > 0 ? [...elsToMeasure] : popoverChildEl;\n });\n\n const totalScrollableChildHeight = scrollableEls.reduce((sum, el) => {\n if (el === state.elements.arrow) {\n return sum;\n }\n\n if (testElForOverflow(el)[0]) {\n return sum + el.scrollHeight + scrollbarSize;\n }\n\n return sum + el.scrollHeight;\n }, 0);\n\n const naturalPopoverHeight = Math.max(\n state.elements.popper.scrollHeight,\n totalScrollableChildHeight\n );\n\n const naturalPopoverWidth = Math.max(\n state.elements.popper.scrollWidth,\n ...Array.from(state.elements.popper.children).map(el => {\n if (el === state.elements.arrow) {\n return -Infinity;\n }\n\n if (testElForOverflow(el)[1]) {\n return el.scrollWidth + scrollbarSize;\n }\n\n return el.scrollWidth;\n })\n );\n\n let resolvedPlacement: `${'top' | 'bottom' | 'left' | 'right' | 'auto'}${\n | ''\n | '-start'\n | '-end'}` = requestedPrimaryPlacement;\n\n if (requestedPrimaryPlacement === 'bottom') {\n popoverMaxHeight = vh - targetRectYEnd - offsetFromTargetY - padding.bottom;\n\n if (\n // If the popover will overflow the viewport bottom\n targetRectYEnd + offsetFromTargetY + naturalPopoverHeight + padding.bottom >\n vh\n ) {\n // Choose the side with most allowance\n resolvedPlacement = targetIsInTopHalfOfViewport ? 'bottom' : 'top';\n }\n } else if (requestedPrimaryPlacement === 'top') {\n popoverMaxHeight = targetRectYStart + offsetFromTargetY - padding.top;\n\n if (\n // If the popover will overflow the viewport top\n targetRectYStart + offsetFromTargetY - naturalPopoverHeight + padding.top <\n 0\n ) {\n // Choose the side with most allowance\n resolvedPlacement = targetIsInTopHalfOfViewport ? 'bottom' : 'top';\n }\n } else if (requestedPrimaryPlacement === 'left') {\n popoverMaxWidth = targetRectXStart + offsetFromTargetX - padding.left;\n\n if (\n // If the popover will overflow the viewport left\n targetRectXStart + offsetFromTargetX - naturalPopoverWidth + padding.left <\n 0\n ) {\n // Choose the side with most allowance\n resolvedPlacement = targetIsInLeftHalfOfViewport ? 'right' : 'left';\n }\n } else if (requestedPrimaryPlacement === 'right') {\n popoverMaxWidth = vw - targetRectXEnd - offsetFromTargetX - padding.right;\n\n if (\n // If the popover will overflow the viewport right\n targetRectXEnd + offsetFromTargetX + naturalPopoverWidth + padding.right >\n vw\n ) {\n // Choose the side with most allowance\n resolvedPlacement = targetIsInLeftHalfOfViewport ? 'right' : 'left';\n }\n }\n\n if (resolvedPlacement === 'left' || resolvedPlacement === 'right') {\n popoverMaxHeight = vh - padding.top - padding.bottom;\n }\n\n state.elements.popper.style.maxHeight = `${popoverMaxHeight}px`;\n\n state.elements.popper.style.maxWidth = popoverMaxWidth !== null ? `${popoverMaxWidth}px` : '';\n\n resolvedPlacement = `${resolvedPlacement}${\n (requestedSecondaryPlacement ? `-${requestedSecondaryPlacement}` : '') as\n | ''\n | '-start'\n | '-end'\n }`;\n\n if (state.placement !== resolvedPlacement) {\n state.placement = resolvedPlacement;\n state.reset = true;\n }\n }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AiB,EAAE,CAAC;YAC1C,KAAK,CAAC,SAAS,GAAG,iBAAiB,CAAC;YACpC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;QACrB,CAAC;IACH,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { Modifier } from '@popperjs/core';\n\nimport { documentIsAvailable, getScrollbarWidth, testElForOverflow } from '../../utils';\n\nexport const sameWidth: Modifier<'sameWidth', object> = Object.freeze({\n name: 'sameWidth',\n enabled: true,\n phase: 'beforeWrite',\n fn({ state }) {\n state.styles.popper.width = `${state.rects.reference.width}px`;\n },\n requires: ['computeStyles']\n});\n\nconst scrollbarSize = documentIsAvailable ? getScrollbarWidth() : 0;\n\nexport const fitToContent: Modifier<'fitToContent', object> = Object.freeze({\n name: 'fitToContent',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['computeStyles', 'offset'],\n fn({ state }) {\n if (state.elements.popper.dataset.initialized !== 'true') {\n state.elements.popper.style.visibility = 'hidden';\n }\n state.styles.popper.width = 'fit-content';\n // Ideally, we would use `content-width.md` from the theme, but we can't access it outside of a React function component\n state.elements.popper.style.maxWidth = '60ch';\n state.elements.popper.style.minWidth = `${state.rects.reference.width}px`;\n\n state.elements.popper.style.visibility = 'visible';\n state.elements.popper.dataset.initialized = 'true';\n },\n effect({ instance }) {\n requestAnimationFrame(() => {\n instance.update();\n });\n }\n});\n\nexport const placeAndContain: Modifier<'placeAndContain', object> = Object.freeze({\n name: 'placeAndContain',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['computeStyles', 'offset'],\n fn: ({ state }) => {\n const [requestedPrimaryPlacement, requestedSecondaryPlacement] = state.placement.split('-') as [\n primaryPlacement: 'top' | 'bottom' | 'left' | 'right' | 'auto',\n secondaryPlacement?: 'start' | 'end' | undefined\n ];\n\n const padding = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n };\n\n const preventOverflowPad = state.orderedModifiers.find(({ name }) => name === 'preventOverflow')\n ?.options?.padding;\n\n if (typeof preventOverflowPad === 'number') {\n padding.top = preventOverflowPad;\n padding.bottom = preventOverflowPad;\n padding.right = preventOverflowPad;\n padding.left = preventOverflowPad;\n } else if (preventOverflowPad) {\n padding.top = preventOverflowPad.top ?? padding.top;\n padding.bottom = preventOverflowPad.bottom ?? padding.bottom;\n padding.right = preventOverflowPad.right ?? padding.right;\n padding.left = preventOverflowPad.left ?? padding.left;\n }\n\n const vw = document.documentElement.clientWidth;\n const vh = document.documentElement.clientHeight;\n\n const targetRect = state.rects.reference;\n const targetRectXStart = targetRect.x;\n const targetRectXEnd = targetRectXStart + targetRect.width;\n const targetRectYStart = targetRect.y;\n const targetRectYEnd = targetRectYStart + targetRect.height;\n const targetXMid = (targetRectXStart + targetRectXEnd) / 2;\n const targetYMid = (targetRectYStart + targetRectYEnd) / 2;\n const targetIsInLeftHalfOfViewport = targetXMid < vw / 2;\n const targetIsInTopHalfOfViewport = targetYMid < vh / 2;\n\n const offsetFromTargetX = state.modifiersData.offset?.[state.placement]?.x ?? 0;\n const offsetFromTargetY = state.modifiersData.offset?.[state.placement]?.y ?? 0;\n\n let popoverMaxWidth: null | number = null;\n let popoverMaxHeight: null | number = null;\n\n // The elements whose natural content size should be measured to determine resolved placement\n const scrollableEls = [...state.elements.popper.children].flatMap(popoverChildEl => {\n // Default to measuring direct popover children unless they have measureable items declared within\n const elsToMeasure = popoverChildEl.querySelectorAll('[data-popover-scroll-el]');\n return elsToMeasure.length > 0 ? [...elsToMeasure] : popoverChildEl;\n });\n\n const totalScrollableChildHeight = scrollableEls.reduce((sum, el) => {\n if (el === state.elements.arrow) {\n return sum;\n }\n\n if (testElForOverflow(el)[0]) {\n return sum + el.scrollHeight + scrollbarSize;\n }\n\n return sum + el.scrollHeight;\n }, 0);\n\n const naturalPopoverHeight = Math.max(\n state.elements.popper.scrollHeight,\n totalScrollableChildHeight\n );\n\n const naturalPopoverWidth = Math.max(\n state.elements.popper.scrollWidth,\n ...Array.from(state.elements.popper.children).map(el => {\n if (el === state.elements.arrow) {\n return -Infinity;\n }\n\n if (testElForOverflow(el)[1]) {\n return el.scrollWidth + scrollbarSize;\n }\n\n return el.scrollWidth;\n })\n );\n\n let resolvedPlacement: `${'top' | 'bottom' | 'left' | 'right' | 'auto'}${\n | ''\n | '-start'\n | '-end'}` = requestedPrimaryPlacement;\n\n if (requestedPrimaryPlacement === 'bottom') {\n popoverMaxHeight = vh - targetRectYEnd - offsetFromTargetY - padding.bottom;\n\n if (\n // If the popover will overflow the viewport bottom\n targetRectYEnd + offsetFromTargetY + naturalPopoverHeight + padding.bottom >\n vh\n ) {\n // Choose the side with most allowance\n resolvedPlacement = targetIsInTopHalfOfViewport ? 'bottom' : 'top';\n }\n } else if (requestedPrimaryPlacement === 'top') {\n popoverMaxHeight = targetRectYStart + offsetFromTargetY - padding.top;\n\n if (\n // If the popover will overflow the viewport top\n targetRectYStart + offsetFromTargetY - naturalPopoverHeight + padding.top <\n 0\n ) {\n // Choose the side with most allowance\n resolvedPlacement = targetIsInTopHalfOfViewport ? 'bottom' : 'top';\n }\n } else if (requestedPrimaryPlacement === 'left') {\n popoverMaxWidth = targetRectXStart + offsetFromTargetX - padding.left;\n\n if (\n // If the popover will overflow the viewport left\n targetRectXStart + offsetFromTargetX - naturalPopoverWidth + padding.left <\n 0\n ) {\n // Choose the side with most allowance\n resolvedPlacement = targetIsInLeftHalfOfViewport ? 'right' : 'left';\n }\n } else if (requestedPrimaryPlacement === 'right') {\n popoverMaxWidth = vw - targetRectXEnd - offsetFromTargetX - padding.right;\n\n if (\n // If the popover will overflow the viewport right\n targetRectXEnd + offsetFromTargetX + naturalPopoverWidth + padding.right >\n vw\n ) {\n // Choose the side with most allowance\n resolvedPlacement = targetIsInLeftHalfOfViewport ? 'right' : 'left';\n }\n }\n\n if (resolvedPlacement === 'left' || resolvedPlacement === 'right') {\n popoverMaxHeight = vh - padding.top - padding.bottom;\n }\n\n state.elements.popper.style.maxHeight = `${popoverMaxHeight}px`;\n\n state.elements.popper.style.maxWidth = popoverMaxWidth !== null ? `${popoverMaxWidth}px` : '';\n\n resolvedPlacement = `${resolvedPlacement}${\n (requestedSecondaryPlacement ? `-${requestedSecondaryPlacement}` : '') as\n | ''\n | '-start'\n | '-end'\n }`;\n\n if (state.placement !== resolvedPlacement) {\n state.placement = resolvedPlacement;\n state.reset = true;\n }\n }\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqC,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG/E,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA+B,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG1F,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQtD,MAAM,WAAW,YAAa,SAAQ,SAAS,EAAE,UAAU;IACzD,oCAAoC;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,gDAAgD;IAChD,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC3C;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IACtC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAClC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqC,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG/E,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA+B,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG1F,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQtD,MAAM,WAAW,YAAa,SAAQ,SAAS,EAAE,UAAU;IACzD,oCAAoC;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,gDAAgD;IAChD,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC3C;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IACtC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAClC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,yGAcxB,CAAC;;;;AA4LH,wBAAuD"}
|
|
@@ -15,9 +15,11 @@ export const StyledTooltip = styled.div(({ theme }) => {
|
|
|
15
15
|
color: ${theme.components.tooltip['foreground-color']};
|
|
16
16
|
font-size: ${fontSize.xxs};
|
|
17
17
|
max-width: 40ch;
|
|
18
|
-
padding: ${theme.base.spacing};
|
|
18
|
+
padding: calc(${theme.base.spacing} / 2);
|
|
19
19
|
white-space: pre-line;
|
|
20
20
|
word-break: break-word;
|
|
21
|
+
--scale-in-size: 0;
|
|
22
|
+
--animation-duration: ${theme.base.animation.speed};
|
|
21
23
|
`;
|
|
22
24
|
});
|
|
23
25
|
StyledTooltip.defaultProps = defaultThemeProp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAgDvD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtF,OAAO,GAAG,CAAA;wBACY,KAAK,C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ACI,CACjB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\nimport type { MutableRefObject, PropsWithoutRef, ReactNode, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport type { BaseProps, ForwardRefForwardPropsComponent, TestIdProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Popover from '../Popover';\nimport type { Delay, PopoverProps } from '../Popover';\nimport { useConsolidatedRef, useTestIds, useTheme, useUID } from '../../hooks';\nimport { calculateFontSize, readableHue } from '../../styles';\nimport { getActiveElement, mouseState, testElForOverflow, withTestIds } from '../../utils';\nimport { ThemeOverride } from '../Configuration';\n\nimport { getTooltipTestIds } from './Tooltip.test-ids';\n\nexport interface TooltipProps extends BaseProps, TestIdProp {\n /** Text content for the tooltip. */\n children: ReactNode;\n /** Element to serve as the tooltip's target. */\n target: Element | null;\n /** Elements to ignore from within the tooltip's target. */\n ignoredElements?: TooltipProps['target'][];\n /**\n * Delay showing the tooltip on mouseenter.\n * @default 'short'\n */\n showDelay?: Delay;\n /**\n * Delay hiding the tooltip on mouseleave.\n * @default 'long'\n */\n hideDelay?: Delay;\n /**\n * If true, the Tooltip will render outside of the current DOM hierarchy in a [portal](https://reactjs.org/docs/portals.html).\n * @default true\n */\n portal?: PopoverProps['portal'];\n /**\n * If true, the Tooltip will automatically apply an aria-describedby attribute to its target.\n * @default true\n */\n describeTarget?: boolean;\n /**\n * Sets the placement of the tooltip relative to the target.\n * @default 'bottom'\n */\n placement?: PopoverProps['placement'];\n /**\n * Conditionally renders a tooltip only if the associated element's (or its descendants) text content is truncated.\n * To work, the associated element must be be displayed as a CSS \"block box\" i.e. block, inline-block, etc...\n * @default false\n */\n smart?: boolean;\n /**\n * The group that the Popover belongs to. Popovers in the same group will be closed when others open.\n * @default 'tooltip'\n */\n groupId?: PopoverProps['groupId'];\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledTooltip = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n background-color: ${theme.components.tooltip['background-color']};\n color: ${theme.components.tooltip['foreground-color']};\n font-size: ${fontSize.xxs};\n max-width: 40ch;\n padding: ${theme.base.spacing};\n white-space: pre-line;\n word-break: break-word;\n `;\n});\n\nStyledTooltip.defaultProps = defaultThemeProp;\n\nconst Tooltip: ForwardRefForwardPropsComponent<TooltipProps> = forwardRef(function Tooltip(\n {\n testId,\n children,\n target,\n ignoredElements = [],\n showDelay = 'short',\n hideDelay = 'long',\n placement = 'top',\n describeTarget = true,\n smart,\n groupId = 'tooltip',\n ...restProps\n }: PropsWithoutRef<TooltipProps>,\n ref: TooltipProps['ref']\n) {\n const id = useUID();\n const [show, setShow] = useState(false);\n const [ignoreDelay, setIgnoreDelay] = useState(false);\n const tooltipRef = useConsolidatedRef(ref);\n const lastClickedRef: MutableRefObject<EventTarget | null> = useRef(null);\n const testIds = useTestIds(testId, getTooltipTestIds);\n\n const stringContentOnly =\n typeof children === 'string' ||\n (Array.isArray(children) && children.every(child => typeof child === 'string'));\n\n const onMouseDown = useCallback(\n ({ target: eTarget }: MouseEvent) => {\n lastClickedRef.current = eTarget;\n if (eTarget === tooltipRef.current || eTarget === target) return;\n setShow(false);\n },\n [target]\n );\n\n useEffect(() => {\n if (!target) return;\n\n const showTooltip = () => {\n // This approach may result in a tooltip NOT appearing 1px before it should due to browser specifics. Enhance as needed.\n // https://stackoverflow.com/a/64747288\n\n const checkTruncation = (element: Element): boolean => {\n if (\n testElForOverflow(element).some(Boolean) &&\n !['absolute', 'fixed'].includes(window.getComputedStyle(element).position)\n )\n return true;\n\n for (const child of element.children) {\n if (checkTruncation(child)) return true;\n }\n\n return false;\n };\n\n setShow(smart ? checkTruncation(target) : true);\n };\n\n const onFocusIn = () => {\n showTooltip();\n };\n\n const onFocusOut = () => {\n if (!lastClickedRef.current || lastClickedRef.current !== tooltipRef.current) {\n setShow(false);\n }\n lastClickedRef.current = null;\n };\n\n const onMouseEnter = () => {\n if (ignoredElements.some(exclusion => exclusion?.matches(':hover')) || mouseState.primary) {\n return;\n }\n\n showTooltip();\n };\n\n const onMouseLeave = () => {\n if (getActiveElement() !== target) {\n setShow(false);\n }\n };\n\n const onKeyDown = ({ key }: KeyboardEvent) => {\n if (key === 'Escape' && show) {\n setIgnoreDelay(true);\n setShow(false);\n }\n };\n\n document.addEventListener('keydown', onKeyDown);\n document.addEventListener('mousedown', onMouseDown);\n\n target.addEventListener('focusin', onFocusIn);\n target.addEventListener('focusout', onFocusOut);\n target.addEventListener('mouseenter', onMouseEnter);\n target.addEventListener('mouseleave', onMouseLeave);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n document.removeEventListener('mousedown', onMouseDown);\n\n target.removeEventListener('focusin', onFocusIn);\n target.removeEventListener('focusout', onFocusOut);\n target.removeEventListener('mouseenter', onMouseEnter);\n target.removeEventListener('mouseleave', onMouseLeave);\n };\n }, [target, onMouseDown, smart, show]);\n\n useEffect(() => {\n if (target && describeTarget && show) {\n const describedBy = target.getAttribute('aria-describedby');\n // Set the attribute to the old attribute plus the id\n target.setAttribute('aria-describedby', describedBy ? `${describedBy} ${id}` : id);\n } else if (target) {\n // Get the old attribute\n const describedBy = target.getAttribute('aria-describedby');\n if (describedBy) {\n // If the old attribute matches the id just remove it entirely\n if (describedBy === id) {\n target.removeAttribute('aria-describedby');\n } else {\n // Otherwise we want to just remove the id that was added and reset the attribute to what it was before\n const oldDescribedBy = describedBy.replace(new RegExp(`(?:^|\\\\s+)${id}`), '');\n target.setAttribute('aria-describedby', oldDescribedBy);\n }\n }\n }\n }, [describeTarget, target, show]);\n\n useEffect(() => {\n if (!show && ignoreDelay) {\n setIgnoreDelay(false);\n }\n }, [show, ignoreDelay]);\n\n const theme = useTheme();\n const tooltipTheme = {\n base: {\n palette: {\n 'primary-background': theme.components.tooltip['background-color'],\n 'foreground-color': theme.components.tooltip['foreground-color'],\n interactive: readableHue(\n theme.base.palette.interactive,\n theme.components.tooltip['background-color']\n )\n }\n }\n };\n\n return (\n <ThemeOverride theme={tooltipTheme}>\n <Popover\n data-testid={testIds.root}\n id={id}\n groupId={groupId}\n {...restProps}\n show={show}\n showDelay={ignoreDelay ? 'none' : showDelay}\n hideDelay={ignoreDelay ? 'none' : hideDelay}\n onMouseOver={() => {\n setShow(true);\n }}\n onMouseOut={() => {\n setShow(false);\n }}\n strategy='fixed'\n as={StyledTooltip}\n role={stringContentOnly ? 'tooltip' : 'dialog'}\n target={target}\n arrow\n placement={placement}\n onMouseDown={onMouseDown}\n hideOnTargetHidden\n ref={tooltipRef}\n >\n {children}\n </Popover>\n </ThemeOverride>\n );\n});\n\nexport default withTestIds(Tooltip, getTooltipTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAgDvD,MAAM,CAAC,MAAM,aAAa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C,CAAC;YACjB,CAAC,EACD,QAAQ,EAAC,OAAO,EAChB,EAAE,EAAE,aAAa,EACjB,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAC9C,MAAM,EAAE,MAAM,EACd,KAAK,QACL,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,kBAAkB,QAClB,GAAG,EAAE,UAAU,YAEd,QAAQ,GACD,GACI,CACjB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\nimport type { MutableRefObject, PropsWithoutRef, ReactNode, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport type { BaseProps, ForwardRefForwardPropsComponent, TestIdProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Popover from '../Popover';\nimport type { Delay, PopoverProps } from '../Popover';\nimport { useConsolidatedRef, useTestIds, useTheme, useUID } from '../../hooks';\nimport { calculateFontSize, readableHue } from '../../styles';\nimport { getActiveElement, mouseState, testElForOverflow, withTestIds } from '../../utils';\nimport { ThemeOverride } from '../Configuration';\n\nimport { getTooltipTestIds } from './Tooltip.test-ids';\n\nexport interface TooltipProps extends BaseProps, TestIdProp {\n /** Text content for the tooltip. */\n children: ReactNode;\n /** Element to serve as the tooltip's target. */\n target: Element | null;\n /** Elements to ignore from within the tooltip's target. */\n ignoredElements?: TooltipProps['target'][];\n /**\n * Delay showing the tooltip on mouseenter.\n * @default 'short'\n */\n showDelay?: Delay;\n /**\n * Delay hiding the tooltip on mouseleave.\n * @default 'long'\n */\n hideDelay?: Delay;\n /**\n * If true, the Tooltip will render outside of the current DOM hierarchy in a [portal](https://reactjs.org/docs/portals.html).\n * @default true\n */\n portal?: PopoverProps['portal'];\n /**\n * If true, the Tooltip will automatically apply an aria-describedby attribute to its target.\n * @default true\n */\n describeTarget?: boolean;\n /**\n * Sets the placement of the tooltip relative to the target.\n * @default 'bottom'\n */\n placement?: PopoverProps['placement'];\n /**\n * Conditionally renders a tooltip only if the associated element's (or its descendants) text content is truncated.\n * To work, the associated element must be be displayed as a CSS \"block box\" i.e. block, inline-block, etc...\n * @default false\n */\n smart?: boolean;\n /**\n * The group that the Popover belongs to. Popovers in the same group will be closed when others open.\n * @default 'tooltip'\n */\n groupId?: PopoverProps['groupId'];\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledTooltip = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n background-color: ${theme.components.tooltip['background-color']};\n color: ${theme.components.tooltip['foreground-color']};\n font-size: ${fontSize.xxs};\n max-width: 40ch;\n padding: calc(${theme.base.spacing} / 2);\n white-space: pre-line;\n word-break: break-word;\n --scale-in-size: 0;\n --animation-duration: ${theme.base.animation.speed};\n `;\n});\n\nStyledTooltip.defaultProps = defaultThemeProp;\n\nconst Tooltip: ForwardRefForwardPropsComponent<TooltipProps> = forwardRef(function Tooltip(\n {\n testId,\n children,\n target,\n ignoredElements = [],\n showDelay = 'short',\n hideDelay = 'long',\n placement = 'top',\n describeTarget = true,\n smart,\n groupId = 'tooltip',\n ...restProps\n }: PropsWithoutRef<TooltipProps>,\n ref: TooltipProps['ref']\n) {\n const id = useUID();\n const [show, setShow] = useState(false);\n const [ignoreDelay, setIgnoreDelay] = useState(false);\n const tooltipRef = useConsolidatedRef(ref);\n const lastClickedRef: MutableRefObject<EventTarget | null> = useRef(null);\n const testIds = useTestIds(testId, getTooltipTestIds);\n\n const stringContentOnly =\n typeof children === 'string' ||\n (Array.isArray(children) && children.every(child => typeof child === 'string'));\n\n const onMouseDown = useCallback(\n ({ target: eTarget }: MouseEvent) => {\n lastClickedRef.current = eTarget;\n if (eTarget === tooltipRef.current || eTarget === target) return;\n setShow(false);\n },\n [target]\n );\n\n useEffect(() => {\n if (!target) return;\n\n const showTooltip = () => {\n // This approach may result in a tooltip NOT appearing 1px before it should due to browser specifics. Enhance as needed.\n // https://stackoverflow.com/a/64747288\n\n const checkTruncation = (element: Element): boolean => {\n if (\n testElForOverflow(element).some(Boolean) &&\n !['absolute', 'fixed'].includes(window.getComputedStyle(element).position)\n )\n return true;\n\n for (const child of element.children) {\n if (checkTruncation(child)) return true;\n }\n\n return false;\n };\n\n setShow(smart ? checkTruncation(target) : true);\n };\n\n const onFocusIn = () => {\n showTooltip();\n };\n\n const onFocusOut = () => {\n if (!lastClickedRef.current || lastClickedRef.current !== tooltipRef.current) {\n setShow(false);\n }\n lastClickedRef.current = null;\n };\n\n const onMouseEnter = () => {\n if (ignoredElements.some(exclusion => exclusion?.matches(':hover')) || mouseState.primary) {\n return;\n }\n\n showTooltip();\n };\n\n const onMouseLeave = () => {\n if (getActiveElement() !== target) {\n setShow(false);\n }\n };\n\n const onKeyDown = ({ key }: KeyboardEvent) => {\n if (key === 'Escape' && show) {\n setIgnoreDelay(true);\n setShow(false);\n }\n };\n\n document.addEventListener('keydown', onKeyDown);\n document.addEventListener('mousedown', onMouseDown);\n\n target.addEventListener('focusin', onFocusIn);\n target.addEventListener('focusout', onFocusOut);\n target.addEventListener('mouseenter', onMouseEnter);\n target.addEventListener('mouseleave', onMouseLeave);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n document.removeEventListener('mousedown', onMouseDown);\n\n target.removeEventListener('focusin', onFocusIn);\n target.removeEventListener('focusout', onFocusOut);\n target.removeEventListener('mouseenter', onMouseEnter);\n target.removeEventListener('mouseleave', onMouseLeave);\n };\n }, [target, onMouseDown, smart, show]);\n\n useEffect(() => {\n if (target && describeTarget && show) {\n const describedBy = target.getAttribute('aria-describedby');\n // Set the attribute to the old attribute plus the id\n target.setAttribute('aria-describedby', describedBy ? `${describedBy} ${id}` : id);\n } else if (target) {\n // Get the old attribute\n const describedBy = target.getAttribute('aria-describedby');\n if (describedBy) {\n // If the old attribute matches the id just remove it entirely\n if (describedBy === id) {\n target.removeAttribute('aria-describedby');\n } else {\n // Otherwise we want to just remove the id that was added and reset the attribute to what it was before\n const oldDescribedBy = describedBy.replace(new RegExp(`(?:^|\\\\s+)${id}`), '');\n target.setAttribute('aria-describedby', oldDescribedBy);\n }\n }\n }\n }, [describeTarget, target, show]);\n\n useEffect(() => {\n if (!show && ignoreDelay) {\n setIgnoreDelay(false);\n }\n }, [show, ignoreDelay]);\n\n const theme = useTheme();\n const tooltipTheme = {\n base: {\n palette: {\n 'primary-background': theme.components.tooltip['background-color'],\n 'foreground-color': theme.components.tooltip['foreground-color'],\n interactive: readableHue(\n theme.base.palette.interactive,\n theme.components.tooltip['background-color']\n )\n }\n }\n };\n\n return (\n <ThemeOverride theme={tooltipTheme}>\n <Popover\n data-testid={testIds.root}\n id={id}\n groupId={groupId}\n {...restProps}\n show={show}\n showDelay={ignoreDelay ? 'none' : showDelay}\n hideDelay={ignoreDelay ? 'none' : hideDelay}\n onMouseOver={() => {\n setShow(true);\n }}\n onMouseOut={() => {\n setShow(false);\n }}\n strategy='fixed'\n as={StyledTooltip}\n role={stringContentOnly ? 'tooltip' : 'dialog'}\n target={target}\n arrow\n placement={placement}\n onMouseDown={onMouseDown}\n hideOnTargetHidden\n ref={tooltipRef}\n >\n {children}\n </Popover>\n </ThemeOverride>\n );\n});\n\nexport default withTestIds(Tooltip, getTooltipTestIds);\n"]}
|
package/lib/hooks/useI18n.d.ts
CHANGED
|
@@ -143,6 +143,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
143
143
|
select_noun: string;
|
|
144
144
|
actions_for: string;
|
|
145
145
|
edited: string;
|
|
146
|
+
deleted: string;
|
|
146
147
|
done: string;
|
|
147
148
|
uploading: string;
|
|
148
149
|
loading: string;
|
|
@@ -316,6 +317,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
316
317
|
choose_week: string;
|
|
317
318
|
set_current_week_ally: string;
|
|
318
319
|
auto_focus_next_input_description: string;
|
|
320
|
+
year_input_description: string;
|
|
319
321
|
boolean_display_true_label: string;
|
|
320
322
|
boolean_display_false_label: string;
|
|
321
323
|
step_changed_to_name: string;
|
|
@@ -447,6 +449,11 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
447
449
|
drag_handle_vertical_description: string;
|
|
448
450
|
drag_handle_horizontal_description: string;
|
|
449
451
|
drag_handle_tab_description: string;
|
|
452
|
+
add_button_description: string;
|
|
453
|
+
configure_button_description: string;
|
|
454
|
+
remove_button_description: string;
|
|
455
|
+
list_item_control_instructions: string;
|
|
456
|
+
list_item_nav_instructions: string;
|
|
450
457
|
assignments: string;
|
|
451
458
|
case: string;
|
|
452
459
|
assignment: string;
|
|
@@ -604,12 +611,15 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
604
611
|
rte_edit_image: string;
|
|
605
612
|
rte_delete_image: string;
|
|
606
613
|
rte_image_key_command: string;
|
|
614
|
+
important: string;
|
|
607
615
|
expand_trail: string;
|
|
608
616
|
collapse_trail: string;
|
|
609
617
|
copy_to: string;
|
|
610
618
|
subject_label: string;
|
|
611
619
|
search_results: string;
|
|
612
620
|
get_next_email: string;
|
|
621
|
+
mark_email_as_important: string;
|
|
622
|
+
email_attachment: string;
|
|
613
623
|
feed_post_type: string;
|
|
614
624
|
feed_new_post: string;
|
|
615
625
|
feed_new_post_submit: string;
|
|
@@ -1346,6 +1356,26 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
1346
1356
|
download_app: string;
|
|
1347
1357
|
qr_code_not_available: string;
|
|
1348
1358
|
qr_code: string;
|
|
1359
|
+
expand_all: string;
|
|
1360
|
+
collapse_all: string;
|
|
1361
|
+
expand_steps: string;
|
|
1362
|
+
collapse_steps: string;
|
|
1363
|
+
expand_step: string;
|
|
1364
|
+
collapse_step: string;
|
|
1365
|
+
expanded_step: string;
|
|
1366
|
+
collapsed_step: string;
|
|
1367
|
+
add_step: string;
|
|
1368
|
+
generate_comments: string;
|
|
1369
|
+
action_set: string;
|
|
1370
|
+
action_when: string;
|
|
1371
|
+
action_append: string;
|
|
1372
|
+
action_call: string;
|
|
1373
|
+
action_create: string;
|
|
1374
|
+
action_for_each: string;
|
|
1375
|
+
action_exit: string;
|
|
1376
|
+
action_return: string;
|
|
1377
|
+
action_remove: string;
|
|
1378
|
+
action_error_handler: string;
|
|
1349
1379
|
app_header_notifications_empty: string;
|
|
1350
1380
|
app_header_notifications_loading: string;
|
|
1351
1381
|
open_app_header_notifications: string;
|
|
@@ -1513,6 +1543,9 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
1513
1543
|
aggregation_average: string;
|
|
1514
1544
|
aggregation_minimum: string;
|
|
1515
1545
|
aggregation_maximum: string;
|
|
1546
|
+
select_chart_data_view: string;
|
|
1547
|
+
toggle_chart_element_visibility: string;
|
|
1548
|
+
chart_legend_items: string;
|
|
1516
1549
|
add_to: string;
|
|
1517
1550
|
namespace: string;
|
|
1518
1551
|
decision_rule: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -5,8 +5,9 @@ import type { RefObject } from 'react';
|
|
|
5
5
|
* @param offset Index of the list item which needs to be observed.
|
|
6
6
|
* @param cb Callback that needs to be fired on intersect
|
|
7
7
|
* @param itemSelector Selector used to get the node list of items
|
|
8
|
+
* @param boundingRef Ref to use as the bounding root for querying items. Required for use when selected items are rendered within a ShadowRoot.
|
|
8
9
|
* @returns void.
|
|
9
10
|
*/
|
|
10
|
-
declare const useItemIntersection: (containerRef: RefObject<HTMLElement>, offset: number, cb: () => void, itemSelector: string) => void;
|
|
11
|
+
declare const useItemIntersection: (containerRef: RefObject<HTMLElement>, offset: number, cb: () => void, itemSelector: string, boundingRef?: RefObject<HTMLElement>) => void;
|
|
11
12
|
export default useItemIntersection;
|
|
12
13
|
//# sourceMappingURL=useItemIntersection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useItemIntersection.d.ts","sourceRoot":"","sources":["../../src/hooks/useItemIntersection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useItemIntersection.d.ts","sourceRoot":"","sources":["../../src/hooks/useItemIntersection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC;;;;;;;;GAQG;AAEH,QAAA,MAAM,mBAAmB,GACvB,cAAc,SAAS,CAAC,WAAW,CAAC,EACpC,QAAQ,MAAM,EACd,IAAI,MAAM,IAAI,EACd,cAAc,MAAM,EACpB,cAAc,SAAS,CAAC,WAAW,CAAC,SAmCrC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
+
import { isInstance } from '../utils';
|
|
2
3
|
/**
|
|
3
4
|
* @example useItemIntersection(listRef,offset,() => { do_some_thing; });
|
|
4
5
|
* @param containerRef The ref of the List.
|
|
5
6
|
* @param offset Index of the list item which needs to be observed.
|
|
6
7
|
* @param cb Callback that needs to be fired on intersect
|
|
7
8
|
* @param itemSelector Selector used to get the node list of items
|
|
9
|
+
* @param boundingRef Ref to use as the bounding root for querying items. Required for use when selected items are rendered within a ShadowRoot.
|
|
8
10
|
* @returns void.
|
|
9
11
|
*/
|
|
10
|
-
const useItemIntersection = (containerRef, offset, cb, itemSelector) => {
|
|
12
|
+
const useItemIntersection = (containerRef, offset, cb, itemSelector, boundingRef) => {
|
|
11
13
|
useEffect(() => {
|
|
12
|
-
if (!containerRef.current)
|
|
13
|
-
return;
|
|
14
14
|
let item = null;
|
|
15
15
|
if (offset > 0) {
|
|
16
|
-
const
|
|
16
|
+
const elementToQuery = containerRef?.current ?? boundingRef?.current?.getRootNode() ?? document;
|
|
17
|
+
if (!isInstance(elementToQuery, HTMLElement, SVGElement, ShadowRoot, Document)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const items = elementToQuery.querySelectorAll(itemSelector);
|
|
17
21
|
if (items.length > offset) {
|
|
18
22
|
item = items[offset];
|
|
19
23
|
}
|
|
@@ -24,14 +28,14 @@ const useItemIntersection = (containerRef, offset, cb, itemSelector) => {
|
|
|
24
28
|
cb();
|
|
25
29
|
}
|
|
26
30
|
}, {
|
|
27
|
-
root: containerRef.current
|
|
31
|
+
root: containerRef.current ?? null
|
|
28
32
|
});
|
|
29
33
|
intersectionObserver.observe(item);
|
|
30
34
|
return () => {
|
|
31
35
|
intersectionObserver.disconnect();
|
|
32
36
|
};
|
|
33
37
|
}
|
|
34
|
-
}, [cb,
|
|
38
|
+
}, [cb, offset]);
|
|
35
39
|
};
|
|
36
40
|
export default useItemIntersection;
|
|
37
41
|
//# sourceMappingURL=useItemIntersection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useItemIntersection.js","sourceRoot":"","sources":["../../src/hooks/useItemIntersection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC
|
|
1
|
+
{"version":3,"file":"useItemIntersection.js","sourceRoot":"","sources":["../../src/hooks/useItemIntersection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;;;;;;;GAQG;AAEH,MAAM,mBAAmB,GAAG,CAC1B,YAAoC,EACpC,MAAc,EACd,EAAc,EACd,YAAoB,EACpB,WAAoC,EACpC,EAAE;IACF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,GAAuB,IAAI,CAAC;QACpC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;YACf,MAAM,cAAc,GAClB,YAAY,EAAE,OAAO,IAAI,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,QAAQ,CAAC;YAE3E,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC;gBAC/E,OAAO;YACT,CAAC;YAED,MAAM,KAAK,GAA4B,cAAc,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;YAErF,IAAI,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;gBAC1B,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;QACD,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,CACnD,CAAC,OAAoC,EAAE,EAAE;gBACvC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;oBAC9B,EAAE,EAAE,CAAC;gBACP,CAAC;YACH,CAAC,EACD;gBACE,IAAI,EAAE,YAAY,CAAC,OAAO,IAAI,IAAI;aACnC,CACF,CAAC;YACF,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnC,OAAO,GAAG,EAAE;gBACV,oBAAoB,CAAC,UAAU,EAAE,CAAC;YACpC,CAAC,CAAC;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { useEffect } from 'react';\nimport type { RefObject } from 'react';\n\nimport { isInstance } from '../utils';\n\n/**\n * @example useItemIntersection(listRef,offset,() => { do_some_thing; });\n * @param containerRef The ref of the List.\n * @param offset Index of the list item which needs to be observed.\n * @param cb Callback that needs to be fired on intersect\n * @param itemSelector Selector used to get the node list of items\n * @param boundingRef Ref to use as the bounding root for querying items. Required for use when selected items are rendered within a ShadowRoot.\n * @returns void.\n */\n\nconst useItemIntersection = (\n containerRef: RefObject<HTMLElement>,\n offset: number,\n cb: () => void,\n itemSelector: string,\n boundingRef?: RefObject<HTMLElement>\n) => {\n useEffect(() => {\n let item: HTMLElement | null = null;\n if (offset > 0) {\n const elementToQuery =\n containerRef?.current ?? boundingRef?.current?.getRootNode() ?? document;\n\n if (!isInstance(elementToQuery, HTMLElement, SVGElement, ShadowRoot, Document)) {\n return;\n }\n\n const items: NodeListOf<HTMLElement> = elementToQuery.querySelectorAll(itemSelector);\n\n if (items.length > offset) {\n item = items[offset];\n }\n }\n if (item) {\n const intersectionObserver = new IntersectionObserver(\n (entries: IntersectionObserverEntry[]) => {\n if (entries[0].isIntersecting) {\n cb();\n }\n },\n {\n root: containerRef.current ?? null\n }\n );\n intersectionObserver.observe(item);\n return () => {\n intersectionObserver.disconnect();\n };\n }\n }, [cb, offset]);\n};\n\nexport default useItemIntersection;\n"]}
|
package/lib/i18n/default.d.ts
CHANGED
|
@@ -139,6 +139,7 @@ declare const _default: {
|
|
|
139
139
|
select_noun: string;
|
|
140
140
|
actions_for: string;
|
|
141
141
|
edited: string;
|
|
142
|
+
deleted: string;
|
|
142
143
|
done: string;
|
|
143
144
|
uploading: string;
|
|
144
145
|
loading: string;
|
|
@@ -312,6 +313,7 @@ declare const _default: {
|
|
|
312
313
|
choose_week: string;
|
|
313
314
|
set_current_week_ally: string;
|
|
314
315
|
auto_focus_next_input_description: string;
|
|
316
|
+
year_input_description: string;
|
|
315
317
|
boolean_display_true_label: string;
|
|
316
318
|
boolean_display_false_label: string;
|
|
317
319
|
step_changed_to_name: string;
|
|
@@ -443,6 +445,11 @@ declare const _default: {
|
|
|
443
445
|
drag_handle_vertical_description: string;
|
|
444
446
|
drag_handle_horizontal_description: string;
|
|
445
447
|
drag_handle_tab_description: string;
|
|
448
|
+
add_button_description: string;
|
|
449
|
+
configure_button_description: string;
|
|
450
|
+
remove_button_description: string;
|
|
451
|
+
list_item_control_instructions: string;
|
|
452
|
+
list_item_nav_instructions: string;
|
|
446
453
|
assignments: string;
|
|
447
454
|
case: string;
|
|
448
455
|
assignment: string;
|
|
@@ -600,12 +607,15 @@ declare const _default: {
|
|
|
600
607
|
rte_edit_image: string;
|
|
601
608
|
rte_delete_image: string;
|
|
602
609
|
rte_image_key_command: string;
|
|
610
|
+
important: string;
|
|
603
611
|
expand_trail: string;
|
|
604
612
|
collapse_trail: string;
|
|
605
613
|
copy_to: string;
|
|
606
614
|
subject_label: string;
|
|
607
615
|
search_results: string;
|
|
608
616
|
get_next_email: string;
|
|
617
|
+
mark_email_as_important: string;
|
|
618
|
+
email_attachment: string;
|
|
609
619
|
feed_post_type: string;
|
|
610
620
|
feed_new_post: string;
|
|
611
621
|
feed_new_post_submit: string;
|
|
@@ -1343,6 +1353,26 @@ declare const _default: {
|
|
|
1343
1353
|
download_app: string;
|
|
1344
1354
|
qr_code_not_available: string;
|
|
1345
1355
|
qr_code: string;
|
|
1356
|
+
expand_all: string;
|
|
1357
|
+
collapse_all: string;
|
|
1358
|
+
expand_steps: string;
|
|
1359
|
+
collapse_steps: string;
|
|
1360
|
+
expand_step: string;
|
|
1361
|
+
collapse_step: string;
|
|
1362
|
+
expanded_step: string;
|
|
1363
|
+
collapsed_step: string;
|
|
1364
|
+
add_step: string;
|
|
1365
|
+
generate_comments: string;
|
|
1366
|
+
action_set: string;
|
|
1367
|
+
action_when: string;
|
|
1368
|
+
action_append: string;
|
|
1369
|
+
action_call: string;
|
|
1370
|
+
action_create: string;
|
|
1371
|
+
action_for_each: string;
|
|
1372
|
+
action_exit: string;
|
|
1373
|
+
action_return: string;
|
|
1374
|
+
action_remove: string;
|
|
1375
|
+
action_error_handler: string;
|
|
1346
1376
|
app_header_notifications_empty: string;
|
|
1347
1377
|
app_header_notifications_loading: string;
|
|
1348
1378
|
open_app_header_notifications: string;
|
|
@@ -1512,6 +1542,9 @@ declare const _default: {
|
|
|
1512
1542
|
aggregation_average: string;
|
|
1513
1543
|
aggregation_minimum: string;
|
|
1514
1544
|
aggregation_maximum: string;
|
|
1545
|
+
select_chart_data_view: string;
|
|
1546
|
+
toggle_chart_element_visibility: string;
|
|
1547
|
+
chart_legend_items: string;
|
|
1515
1548
|
add_to: string;
|
|
1516
1549
|
namespace: string;
|
|
1517
1550
|
decision_rule: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/i18n/default.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/i18n/default.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAigDE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqMxB,6CAA6C;;;;IAK7C,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0F5C,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAryDzC,wBAw1DE"}
|
package/lib/i18n/default.js
CHANGED
|
@@ -148,6 +148,7 @@ export default {
|
|
|
148
148
|
actions_for: 'Actions - {0}',
|
|
149
149
|
/* States */
|
|
150
150
|
edited: 'Edited {0}',
|
|
151
|
+
deleted: '{0} deleted',
|
|
151
152
|
done: 'Done',
|
|
152
153
|
uploading: 'Uploading',
|
|
153
154
|
loading: 'Loading…',
|
|
@@ -341,6 +342,7 @@ export default {
|
|
|
341
342
|
choose_week: 'Choose week',
|
|
342
343
|
set_current_week_ally: 'Set to current week',
|
|
343
344
|
auto_focus_next_input_description: 'Automatically moves focus to next input when current input is completed.',
|
|
345
|
+
year_input_description: 'You may also enter a four-digit year manually.',
|
|
344
346
|
/* core:Boolean */
|
|
345
347
|
boolean_display_true_label: 'Yes',
|
|
346
348
|
boolean_display_false_label: 'No',
|
|
@@ -491,6 +493,12 @@ export default {
|
|
|
491
493
|
drag_handle_vertical_description: 'Use arrow keys to drag up or down.',
|
|
492
494
|
drag_handle_horizontal_description: 'Use arrow keys to drag left or right.',
|
|
493
495
|
drag_handle_tab_description: 'Use Tab and Shift Tab to drag to adjacent lists.',
|
|
496
|
+
/* dnd:StandardDragDropList */
|
|
497
|
+
add_button_description: 'Click to add a new item to the list',
|
|
498
|
+
configure_button_description: 'Click to configure the list item',
|
|
499
|
+
remove_button_description: 'Click to remove the list item',
|
|
500
|
+
list_item_control_instructions: 'Has interactive controls',
|
|
501
|
+
list_item_nav_instructions: 'Use the up and down arrow keys to navigate between items. Press Enter to enter tabbing mode and access elements within the list',
|
|
494
502
|
/* work:Assignments */
|
|
495
503
|
assignments: 'Assignments',
|
|
496
504
|
/* work:Hierarchial Assignment */
|
|
@@ -665,12 +673,15 @@ export default {
|
|
|
665
673
|
rte_delete_image: 'Delete image {0}',
|
|
666
674
|
rte_image_key_command: 'Press enter to edit the image',
|
|
667
675
|
/* social:Email */
|
|
676
|
+
important: 'Important',
|
|
668
677
|
expand_trail: 'Expand trail',
|
|
669
678
|
collapse_trail: 'Collapse trail',
|
|
670
679
|
copy_to: 'Copy to',
|
|
671
680
|
subject_label: 'Subject: {0}',
|
|
672
681
|
search_results: 'Search results',
|
|
673
682
|
get_next_email: 'Get next email',
|
|
683
|
+
mark_email_as_important: 'Mark email as important',
|
|
684
|
+
email_attachment: '{0} with {1}',
|
|
674
685
|
/* social:Feed */
|
|
675
686
|
feed_post_type: 'Post type',
|
|
676
687
|
feed_new_post: 'Message',
|
|
@@ -1433,6 +1444,27 @@ export default {
|
|
|
1433
1444
|
download_app: 'Download app',
|
|
1434
1445
|
qr_code_not_available: 'No QR code available yet',
|
|
1435
1446
|
qr_code: 'QR code',
|
|
1447
|
+
/* build: Automation */
|
|
1448
|
+
expand_all: 'Expand all',
|
|
1449
|
+
collapse_all: 'Collapse all',
|
|
1450
|
+
expand_steps: 'Expand all steps',
|
|
1451
|
+
collapse_steps: 'Collapse all steps',
|
|
1452
|
+
expand_step: 'Expand step {0}',
|
|
1453
|
+
collapse_step: 'Collapse step {0}',
|
|
1454
|
+
expanded_step: 'Expanded step {0}',
|
|
1455
|
+
collapsed_step: 'Collapsed step {0}',
|
|
1456
|
+
add_step: 'Add step',
|
|
1457
|
+
generate_comments: 'Generate comments',
|
|
1458
|
+
action_set: 'Set',
|
|
1459
|
+
action_when: 'When',
|
|
1460
|
+
action_append: 'Append',
|
|
1461
|
+
action_call: 'Call',
|
|
1462
|
+
action_create: 'Create',
|
|
1463
|
+
action_for_each: 'For each',
|
|
1464
|
+
action_exit: 'Exit',
|
|
1465
|
+
action_return: 'Return',
|
|
1466
|
+
action_remove: 'Remove',
|
|
1467
|
+
action_error_handler: 'Error handler',
|
|
1436
1468
|
/* wss:AppHeader */
|
|
1437
1469
|
app_header_notifications_empty: 'No notifications',
|
|
1438
1470
|
app_header_notifications_loading: 'Loading notifications',
|
|
@@ -1630,6 +1662,10 @@ export default {
|
|
|
1630
1662
|
aggregation_average: 'Average',
|
|
1631
1663
|
aggregation_minimum: 'Minimum',
|
|
1632
1664
|
aggregation_maximum: 'Maximum',
|
|
1665
|
+
/* business-intelligence: Legend */
|
|
1666
|
+
select_chart_data_view: 'Select chart data view',
|
|
1667
|
+
toggle_chart_element_visibility: 'Toggle chart element visibility',
|
|
1668
|
+
chart_legend_items: 'Chart legend items',
|
|
1633
1669
|
/* authoring-ui-views: AddButton */
|
|
1634
1670
|
add_to: 'Add to {0}',
|
|
1635
1671
|
/* authoring-ui-views: ViewPicker */
|