@k-int/stripes-kint-components 5.33.0 → 5.33.2
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/CHANGELOG.md +14 -0
- package/LICENSE +1 -1
- package/es/__mocks__/@folio/stripes/components.js +3 -7
- package/es/__mocks__/@folio/stripes/core.js +4 -6
- package/es/__mocks__/@folio/stripes/smart-components.js +4 -6
- package/es/__mocks__/react-query.js +4 -6
- package/es/__mocks__/react-router-dom.js +6 -6
- package/es/lib/ActionList/ActionList.js +26 -33
- package/es/lib/ActionList/ActionListFieldArray.js +103 -119
- package/es/lib/ButtonTypedown/ButtonTypedown.js +25 -33
- package/es/lib/ComboButton/ComboButton.js +42 -47
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +11 -17
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +42 -46
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +4 -8
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +32 -33
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +3 -3
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +29 -35
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +61 -59
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +20 -20
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -2
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
- package/es/lib/CustomProperties/Edit/testResources.js +11 -12
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +22 -33
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +24 -37
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +3 -6
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +4 -8
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +15 -19
- package/es/lib/CustomProperties/Filter/testResources.js +1 -2
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +1 -2
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +17 -25
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +3 -6
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +7 -11
- package/es/lib/CycleButton/CycleButton.js +9 -17
- package/es/lib/FormModal/FormModal.js +24 -32
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +23 -30
- package/es/lib/IconSelect/IconSelect.js +22 -32
- package/es/lib/NoResultsMessage/NoResultsMessage.js +4 -5
- package/es/lib/NumberField/NumberField.js +17 -25
- package/es/lib/NumberField/NumberField.test.js +6 -7
- package/es/lib/QueryTypedown/QueryTypedown.js +8 -15
- package/es/lib/RefdataButtons/RefdataButtons.js +6 -9
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +48 -60
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +5 -6
- package/es/lib/RichSelect/RichSelect.js +31 -36
- package/es/lib/RichSelect/useSelectedOption.js +1 -2
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +91 -94
- package/es/lib/SASQLookupComponent/SASQLookupComponent.test.js +44 -36
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +42 -53
- package/es/lib/SASQLookupComponent/TableBody/TableBody.test.js +19 -23
- package/es/lib/SASQRoute/SASQRoute.js +25 -29
- package/es/lib/SASQRoute/SASQRoute.test.js +11 -13
- package/es/lib/SASQViewComponent/SASQViewComponent.js +68 -76
- package/es/lib/SASQViewComponent/SASQViewComponent.test.js +4 -8
- package/es/lib/SearchField/SearchField.js +7 -13
- package/es/lib/SearchKeyControl/SearchKeyControl.js +8 -13
- package/es/lib/SearchKeyControl/SearchKeyControl.test.js +2 -6
- package/es/lib/Settings/EditableRefdataCategoryList/EditableRefdataCategoryList.js +30 -46
- package/es/lib/Settings/EditableRefdataList/EditableRefdataList.js +33 -43
- package/es/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +7 -11
- package/es/lib/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js +13 -20
- package/es/lib/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js +10 -12
- package/es/lib/Settings/EditableSettingsList/SettingField/SettingField.js +10 -15
- package/es/lib/Settings/EditableSettingsList/SettingField/SettingField.test.js +3 -3
- package/es/lib/Settings/RefdataCategoriesSettings/RefdataCategoriesSettings.js +19 -26
- package/es/lib/Settings/SettingPage/SettingPagePane/SettingPagePane.js +2 -2
- package/es/lib/Settings/Settings/Settings.js +14 -16
- package/es/lib/Settings/SettingsFormContainer/SettingsFormContainer.js +30 -35
- package/es/lib/Settings/StaticSettingsField/StaticSettingsField.js +5 -8
- package/es/lib/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js +18 -22
- package/es/lib/Settings/hooks/staticSettingsPages/useSettingCallout/useSettingCallout.js +2 -2
- package/es/lib/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/useSettingsSectionInitalValues.js +1 -1
- package/es/lib/Settings/hooks/staticSettingsPages/useStaticSettingsSection.js +3 -7
- package/es/lib/Settings/hooks/useAppSettings/useAppSettings.js +7 -11
- package/es/lib/Settings/hooks/useSettingSection/useSettingSection.js +16 -22
- package/es/lib/Settings/hooks/useSettings/useSettings.js +62 -60
- package/es/lib/Tags/Tags.js +5 -8
- package/es/lib/Tags/hooks/useTags.js +1 -1
- package/es/lib/Tags/hooks/useTagsEnabled.js +2 -3
- package/es/lib/Tags/tagsConfig.js +1 -1
- package/es/lib/Typedown/Typedown.js +21 -28
- package/es/lib/hooks/__mocks__/index.js +3 -7
- package/es/lib/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js +20 -26
- package/es/lib/hooks/intlHooks/useKintIntl/useKintIntl.js +24 -34
- package/es/lib/hooks/typedownHooks/useTypedown.js +11 -12
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
- package/es/lib/hooks/useActionListRef.js +1 -1
- package/es/lib/hooks/useActiveElement.js +1 -1
- package/es/lib/hooks/useCustomProperties.js +6 -10
- package/es/lib/hooks/useHelperApp.js +13 -16
- package/es/lib/hooks/useKiwtFieldArray.js +7 -8
- package/es/lib/hooks/useKiwtSASQuery.js +15 -19
- package/es/lib/hooks/useLocalPageStore.js +7 -10
- package/es/lib/hooks/useModConfigEntries.js +2 -2
- package/es/lib/hooks/useMutateCustomProperties/useMutateCustomProperties.js +10 -17
- package/es/lib/hooks/useMutateGeneric/useMutateGeneric.js +2 -2
- package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
- package/es/lib/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js +15 -21
- package/es/lib/hooks/useMutateRefdataValue/useMutateRefdataValue.js +16 -23
- package/es/lib/hooks/usePrevNextPagination.js +17 -19
- package/es/lib/hooks/useQIndex.js +11 -14
- package/es/lib/hooks/useRefdata.js +3 -3
- package/es/lib/hooks/useStandaloneSASQQueryParameter/useStandaloneSASQQueryParameter.js +9 -13
- package/es/lib/hooks/useTemplates.js +4 -4
- package/es/lib/utils/buildUrl.js +2 -3
- package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +5 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
- package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +4 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
- package/es/lib/utils/generateKiwtQueryParams/generateKiwtQueryParams.js +94 -107
- package/es/lib/utils/groupCustomPropertiesByCtx.js +5 -9
- package/es/lib/utils/index.js +34 -13
- package/es/lib/utils/matchString/index.js +13 -0
- package/es/lib/utils/{matchString.js → matchString/matchString.js} +8 -9
- package/es/lib/utils/matchString/matchString.test.js +40 -0
- package/es/lib/utils/parseErrorResponse.js +3 -7
- package/es/lib/utils/selectorSafe.js +2 -3
- package/es/lib/utils/sortByLabel.js +2 -3
- package/es/lib/utils/stringStyling/boldString.js +30 -0
- package/es/lib/utils/stringStyling/boldString.test.js +47 -0
- package/es/lib/utils/stringStyling/highlightString.js +30 -0
- package/es/lib/utils/stringStyling/highlightString.test.js +51 -0
- package/es/lib/utils/stringStyling/index.js +20 -0
- package/es/lib/validators/validators.js +6 -9
- package/package.json +1 -1
- package/src/artifacts/coverage-jest/ActionList/ActionList.js.html +1 -1
- package/src/artifacts/coverage-jest/ActionList/ActionListFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/ActionList/index.html +1 -1
- package/src/artifacts/coverage-jest/ActionList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/ButtonTypedown/ButtonTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/ButtonTypedown/index.html +1 -1
- package/src/artifacts/coverage-jest/ButtonTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/ComboButton/ComboButton.js.html +1 -1
- package/src/artifacts/coverage-jest/ComboButton/index.html +1 -1
- package/src/artifacts/coverage-jest/ComboButton/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesLookup.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyForm.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyView.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEdit.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesListField.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyField.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyFormCard.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilter.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterField.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesRule.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/useOperators.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/useParseActiveFilterStrings.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/useValueProps.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesView.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesViewCtx.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertyCard.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CycleButton/CycleButton.js.html +1 -1
- package/src/artifacts/coverage-jest/CycleButton/index.html +1 -1
- package/src/artifacts/coverage-jest/CycleButton/index.js.html +1 -1
- package/src/artifacts/coverage-jest/FieldLabel/FieldLabel.js.html +1 -1
- package/src/artifacts/coverage-jest/FieldLabel/index.html +1 -1
- package/src/artifacts/coverage-jest/FieldLabel/index.js.html +1 -1
- package/src/artifacts/coverage-jest/FormModal/FormModal.js.html +1 -1
- package/src/artifacts/coverage-jest/FormModal/index.html +1 -1
- package/src/artifacts/coverage-jest/FormModal/index.js.html +1 -1
- package/src/artifacts/coverage-jest/FormattedKintMessage/FormattedKintMessage.js.html +1 -1
- package/src/artifacts/coverage-jest/FormattedKintMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/FormattedKintMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/IconSelect/IconSelect.js.html +1 -1
- package/src/artifacts/coverage-jest/IconSelect/index.html +1 -1
- package/src/artifacts/coverage-jest/IconSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/NoResultsMessage/NoResultsMessage.js.html +1 -1
- package/src/artifacts/coverage-jest/NoResultsMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/NoResultsMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/NumberField/NumberField.js.html +15 -15
- package/src/artifacts/coverage-jest/NumberField/index.html +1 -1
- package/src/artifacts/coverage-jest/NumberField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/QueryTypedown/QueryTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/QueryTypedown/index.html +1 -1
- package/src/artifacts/coverage-jest/QueryTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/RefdataButtons/RefdataButtons.js.html +1 -1
- package/src/artifacts/coverage-jest/RefdataButtons/index.html +1 -1
- package/src/artifacts/coverage-jest/RefdataButtons/index.js.html +1 -1
- package/src/artifacts/coverage-jest/ResponsiveButtonGroup/ResponsiveButtonGroup.js.html +1 -1
- package/src/artifacts/coverage-jest/ResponsiveButtonGroup/index.html +1 -1
- package/src/artifacts/coverage-jest/ResponsiveButtonGroup/index.js.html +1 -1
- package/src/artifacts/coverage-jest/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js.html +1 -1
- package/src/artifacts/coverage-jest/RichSelect/RichSelect.js.html +1 -1
- package/src/artifacts/coverage-jest/RichSelect/index.html +1 -1
- package/src/artifacts/coverage-jest/RichSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/RichSelect/useSelectedOption.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/SASQLookupComponent.js.html +31 -31
- package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/TableBody.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQRoute/SASQRoute.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQRoute/index.html +1 -1
- package/src/artifacts/coverage-jest/SASQRoute/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQViewComponent/SASQViewComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQViewComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/SASQViewComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SearchField/SearchField.js.html +1 -1
- package/src/artifacts/coverage-jest/SearchField/index.html +1 -1
- package/src/artifacts/coverage-jest/SearchField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SearchKeyControl/SearchKeyControl.js.html +1 -1
- package/src/artifacts/coverage-jest/SearchKeyControl/index.html +1 -1
- package/src/artifacts/coverage-jest/SearchKeyControl/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataList/EditableRefdataList.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataList/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsList.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/SettingField.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/RefdataCategoriesSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPage.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/SettingPagePane.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/Settings/Settings.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/Settings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/Settings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/SettingsFormContainer.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsField.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/constants/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/constants/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/constants/queryKeys.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/contexts/SettingsContext.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/contexts/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/contexts/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/useSettingCallout.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/useSettingsSectionInitalValues.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useStaticSettingsSection.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/useAppSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/useSettingSection.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/useSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/Tags.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/hooks/index.html +1 -1
- package/src/artifacts/coverage-jest/Tags/hooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/hooks/useTags.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/hooks/useTagsEnabled.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/index.html +1 -1
- package/src/artifacts/coverage-jest/Tags/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/tagsConfig.js.html +1 -1
- package/src/artifacts/coverage-jest/Typedown/Typedown.js.html +1 -1
- package/src/artifacts/coverage-jest/Typedown/index.html +1 -1
- package/src/artifacts/coverage-jest/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/cobertura-coverage.xml +267 -238
- package/src/artifacts/coverage-jest/constants/comparators.js.html +1 -1
- package/src/artifacts/coverage-jest/constants/customProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/constants/endpoints.js.html +1 -1
- package/src/artifacts/coverage-jest/constants/eventCodes.js.html +1 -1
- package/src/artifacts/coverage-jest/constants/index.html +1 -1
- package/src/artifacts/coverage-jest/constants/pagination.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/useIntlKey.js.html +7 -7
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js.html +6 -6
- package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/useKintIntl.js.html +6 -6
- package/src/artifacts/coverage-jest/hooks/typedownHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/typedownHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownData.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useActionListRef.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useActiveElement.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useCustomProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useHelperApp.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/useInvalidateRefdata.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useKiwtFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useKiwtSASQuery.js.html +9 -9
- package/src/artifacts/coverage-jest/hooks/useLocalPageStore.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useLocalStorageState.js.html +5 -5
- package/src/artifacts/coverage-jest/hooks/useModConfigEntries.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/useMutateCustomProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/useMutateGeneric.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateModConfigEntry.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/useMutateRefdataValue.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/usePrevNextPagination.js.html +20 -20
- package/src/artifacts/coverage-jest/hooks/useQIndex.js.html +8 -8
- package/src/artifacts/coverage-jest/hooks/useRefdata.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useSASQQueryMeta.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/useStandaloneSASQQueryParameter.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useTemplates.js.html +1 -1
- package/src/artifacts/coverage-jest/index.html +49 -19
- package/src/artifacts/coverage-jest/utils/buildUrl.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/deparseKiwtQueryFilters.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/index.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryFilters.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryGroups.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryString.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/generateKiwtQuery.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/generateKiwtQueryParams.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.html +1 -1
- package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/groupCustomPropertiesByCtx.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/index.html +9 -39
- package/src/artifacts/coverage-jest/utils/index.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/matchString/index.html +131 -0
- package/src/artifacts/coverage-jest/utils/matchString/index.js.html +88 -0
- package/src/artifacts/coverage-jest/utils/{matchString.js.html → matchString/matchString.js.html} +82 -55
- package/src/artifacts/coverage-jest/utils/modConfigEntriesQueryKey.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/parseErrorResponse.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/parseModConfigEntry.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/refdataOptions.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/refdataQueryKey/index.html +1 -1
- package/src/artifacts/coverage-jest/utils/refdataQueryKey/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/refdataQueryKey/refdataQueryKey.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/selectorSafe.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/sortByLabel.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/stringStyling/boldString.js.html +190 -0
- package/src/artifacts/coverage-jest/utils/stringStyling/highlightString.js.html +190 -0
- package/src/artifacts/coverage-jest/utils/stringStyling/index.html +146 -0
- package/src/artifacts/coverage-jest/utils/stringStyling/index.js.html +91 -0
- package/src/artifacts/coverage-jest/utils/toCamelCase.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/typedownQueryKey.js.html +1 -1
- package/src/artifacts/coverage-jest/validators/index.html +1 -1
- package/src/artifacts/coverage-jest/validators/index.js.html +1 -1
- package/src/artifacts/coverage-jest/validators/validators.js.html +1 -1
- package/src/lib/utils/index.js +1 -1
- package/src/lib/utils/matchString/index.js +1 -0
- package/src/lib/utils/matchString/matchString.js +44 -0
- package/src/lib/utils/matchString/matchString.test.js +68 -0
- package/src/lib/utils/stringStyling/boldString.js +35 -0
- package/src/lib/utils/stringStyling/boldString.test.js +59 -0
- package/src/lib/utils/stringStyling/highlightString.js +35 -0
- package/src/lib/utils/stringStyling/highlightString.test.js +67 -0
- package/src/lib/utils/stringStyling/index.js +2 -0
- package/styles/TypeDown.css +2 -2
- package/styles/stringMatchStyles.css +3 -0
- package/es/lib/utils/highlightString.js +0 -45
- package/src/artifacts/coverage-jest/utils/highlightString.js.html +0 -259
- package/src/lib/utils/highlightString.js +0 -58
- package/src/lib/utils/matchString.js +0 -35
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
74
74
|
Code coverage generated by
|
|
75
75
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
76
|
-
at 2026-03-
|
|
76
|
+
at 2026-03-12T15:30:01.874Z
|
|
77
77
|
</div>
|
|
78
78
|
<script src="../prettify.js"></script>
|
|
79
79
|
<script>
|
|
@@ -355,7 +355,7 @@ export {
|
|
|
355
355
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
356
356
|
Code coverage generated by
|
|
357
357
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
358
|
-
at 2026-03-
|
|
358
|
+
at 2026-03-12T15:30:01.874Z
|
|
359
359
|
</div>
|
|
360
360
|
<script src="../prettify.js"></script>
|
|
361
361
|
<script>
|
package/src/lib/utils/index.js
CHANGED
|
@@ -17,7 +17,7 @@ export { default as toCamelCase } from './toCamelCase'; // I hate that this exis
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
export { default as matchString } from './matchString';
|
|
20
|
-
export
|
|
20
|
+
export * from './stringStyling';
|
|
21
21
|
|
|
22
22
|
export {
|
|
23
23
|
parseKiwtQueryGroups,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './matchString';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import escapeRegExp from 'lodash/escapeRegExp';
|
|
2
|
+
|
|
3
|
+
const matchString = (match, str, ignoreNull = true, simpleSplit = true) => {
|
|
4
|
+
// Simple regex split -- this is default behaviour
|
|
5
|
+
const regexSimple = new RegExp(
|
|
6
|
+
`${match.split(/(\s+)/)
|
|
7
|
+
.filter(h => h.trim())
|
|
8
|
+
.map(hl => '(' + escapeRegExp(hl) + ')')
|
|
9
|
+
.join('|')}`,
|
|
10
|
+
'gi'
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
// Split Elvis "The King" Presley into [Elvis, The King, Presley]
|
|
14
|
+
const quotedParts = match.match(/"[^"]*"|\S+/g) || [];
|
|
15
|
+
const regex = new RegExp(
|
|
16
|
+
`${
|
|
17
|
+
quotedParts
|
|
18
|
+
.filter(h => h.trim())
|
|
19
|
+
.map(quotedSection => {
|
|
20
|
+
if (quotedSection.charAt(0) === '"' && quotedSection.charAt(quotedSection.length - 1) === '"') {
|
|
21
|
+
return quotedSection.slice(1, -1);
|
|
22
|
+
}
|
|
23
|
+
return quotedSection;
|
|
24
|
+
})
|
|
25
|
+
.map(hl => '(' + escapeRegExp(hl) + ')')
|
|
26
|
+
.join('|')
|
|
27
|
+
}`,
|
|
28
|
+
'gi'
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
if (ignoreNull && !match) {
|
|
32
|
+
const nullRegex = /a^/gi; // Should match nothing
|
|
33
|
+
|
|
34
|
+
return [[str], nullRegex];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (simpleSplit) {
|
|
38
|
+
return [str.split(regexSimple)?.filter(s => s != null && s !== ''), regexSimple];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return [str.split(regex)?.filter(s => s != null && s !== ''), regex];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default matchString;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import matchString from './matchString';
|
|
2
|
+
|
|
3
|
+
describe('matchString', () => {
|
|
4
|
+
describe('simpleSplit=true (default)', () => {
|
|
5
|
+
test.each([
|
|
6
|
+
['hello', 'say hello world', 'hello', 'splits by matched term'],
|
|
7
|
+
['HELLO', 'say hello world', 'hello', 'match is case insensitive'],
|
|
8
|
+
['foo bar', 'foo baz bar', 'foo', 'highlights individual words'],
|
|
9
|
+
['foo bar', 'foo baz bar', 'bar', 'highlights individual words (second word)'],
|
|
10
|
+
['foo.bar', 'foo.bar baz', 'foo.bar', 'handles regex special characters'],
|
|
11
|
+
['(test)', '(test) value', '(test)', 'handles parentheses'],
|
|
12
|
+
])('%s: when searching "%s", parts should contain "%s"', (term, str, expected) => {
|
|
13
|
+
const [parts] = matchString(term, str);
|
|
14
|
+
expect(parts).toContain(expected);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test.each([
|
|
18
|
+
['AN', 'AN 2025', 'start of string'],
|
|
19
|
+
['AN 2025', 'AN 2025', 'full match'],
|
|
20
|
+
['AB', 'AB CD EF', 'multiple spaces'],
|
|
21
|
+
['world', 'hello world', 'end of string'],
|
|
22
|
+
['a', 'a b a', 'multiple matches'],
|
|
23
|
+
['A', 'AN 2025', 'single character'],
|
|
24
|
+
['AN ', 'AN 2025', 'trailing space'],
|
|
25
|
+
])('preserves original string structure for "%s" in "%s" (%s)', (term, str) => {
|
|
26
|
+
const [parts] = matchString(term, str);
|
|
27
|
+
expect(parts.join('')).toBe(str);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('returns full string when no match found', () => {
|
|
31
|
+
const [parts] = matchString('xyz', 'hello world');
|
|
32
|
+
expect(parts).toEqual(['hello world']);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('returns regex as second element with correct flags', () => {
|
|
36
|
+
const [, regex] = matchString('test', 'this is a test');
|
|
37
|
+
expect(regex).toBeInstanceOf(RegExp);
|
|
38
|
+
expect(regex.flags).toMatch(/g/);
|
|
39
|
+
expect(regex.flags).toMatch(/i/);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('simpleSplit=false (quoted string support)', () => {
|
|
44
|
+
test.each([
|
|
45
|
+
['"The King"', 'Elvis The King Presley', 'The King', 'quoted phrases as single term'],
|
|
46
|
+
['AN', 'AN 2025', 'AN', 'start of string'],
|
|
47
|
+
['AN ', 'AN 2025', 'AN', 'trailing space'],
|
|
48
|
+
['"AN 2025"', 'AN 2025', 'AN 2025', 'full match of quoted phrase'],
|
|
49
|
+
['hello', 'hello world', 'hello', 'partial match'],
|
|
50
|
+
['AB', 'AB CD EF', 'AB', 'multiple spaces'],
|
|
51
|
+
['world', 'hello world', 'world', 'end of string'],
|
|
52
|
+
['a', 'a b a', 'a', 'multiple matches'],
|
|
53
|
+
['A', 'AN 2025', 'A', 'single character'],
|
|
54
|
+
])('simpleSplit=false: %s in "%s" should preserve string and contain "%s"', (term, str, expected) => {
|
|
55
|
+
const [parts] = matchString(term, str, true, false);
|
|
56
|
+
expect(parts.join('')).toBe(str);
|
|
57
|
+
expect(parts).toContain(expected);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe('ignoreNull behavior', () => {
|
|
62
|
+
test('returns full string with non-matching regex when match is empty and ignoreNull=true', () => {
|
|
63
|
+
const [parts, regex] = matchString('', 'hello world', true);
|
|
64
|
+
expect(parts).toEqual(['hello world']);
|
|
65
|
+
expect(regex.exec('anything')).toBeNull();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import matchString from '../matchString';
|
|
2
|
+
|
|
3
|
+
import css from '../../../../styles/stringMatchStyles.css';
|
|
4
|
+
|
|
5
|
+
const boldString = (match, str, ignoreNull = true, simpleSplit = true) => {
|
|
6
|
+
const [parts, regex] = matchString(match, str, ignoreNull, simpleSplit);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
parts.map((part, i) => {
|
|
10
|
+
// RegExp is stateful, set up a new one to work with
|
|
11
|
+
const immutableRegex = new RegExp(regex);
|
|
12
|
+
if (immutableRegex.exec(part) !== null) {
|
|
13
|
+
return (
|
|
14
|
+
<strong
|
|
15
|
+
key={`bold-strong-${part}-${i}`}
|
|
16
|
+
className={css.whitespacePre}
|
|
17
|
+
>
|
|
18
|
+
{part}
|
|
19
|
+
</strong>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<span
|
|
25
|
+
key={`bold-span-${part}-${i}`}
|
|
26
|
+
className={css.whitespacePre}
|
|
27
|
+
>
|
|
28
|
+
{part}
|
|
29
|
+
</span>
|
|
30
|
+
);
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default boldString;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { render } from '@folio/jest-config-stripes/testing-library/react';
|
|
2
|
+
import boldString from './boldString';
|
|
3
|
+
|
|
4
|
+
import css from '../../../../styles/stringMatchStyles.css';
|
|
5
|
+
|
|
6
|
+
const renderBolded = (match, str, ignoreNull, simpleSplit) => {
|
|
7
|
+
const result = boldString(match, str, ignoreNull, simpleSplit);
|
|
8
|
+
const { container } = render(<div>{result}</div>);
|
|
9
|
+
return container;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
describe('boldString', () => {
|
|
13
|
+
describe('logic and structure', () => {
|
|
14
|
+
test.each([
|
|
15
|
+
['hello', 'say hello world', 1, 'wraps matched text in <strong>'],
|
|
16
|
+
['HELLO', 'say hello world', 1, 'match is case insensitive'],
|
|
17
|
+
['o', 'foo boo', 4, 'highlights multiple occurrences (o in foo boo)'],
|
|
18
|
+
['oo', 'foo boo', 2, 'highlights multiple occurrences (oo in foo boo)'],
|
|
19
|
+
])('%s: %s', (match, str, expectedBolds) => {
|
|
20
|
+
const container = renderBolded(match, str);
|
|
21
|
+
expect(container.querySelectorAll('strong')).toHaveLength(expectedBolds);
|
|
22
|
+
expect(container.textContent).toBe(str);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('returns full string without strong tags when no match', () => {
|
|
26
|
+
const container = renderBolded('xyz', 'hello world');
|
|
27
|
+
expect(container.querySelectorAll('strong')).toHaveLength(0);
|
|
28
|
+
expect(container.textContent).toBe('hello world');
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('space preservation (all modes)', () => {
|
|
33
|
+
test.each([
|
|
34
|
+
['A', 'AN 2025', true, false],
|
|
35
|
+
['AN ', 'AN 2025', true, false],
|
|
36
|
+
['AN 2025', 'AN 2025', true, true],
|
|
37
|
+
['world', 'hello world', true, true],
|
|
38
|
+
])('searching "%s" in "%s" (simpleSplit: %s) preserves spaces', (match, str, ignore, simple) => {
|
|
39
|
+
const container = renderBolded(match, str, ignore, simple);
|
|
40
|
+
expect(container.textContent).toBe(str);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe('whitespace styling', () => {
|
|
45
|
+
test.each([
|
|
46
|
+
['strong', 'AN', 'AN 2025'],
|
|
47
|
+
['span', 'AN', 'AN 2025'],
|
|
48
|
+
])('%s elements should have whiteSpace: pre', (selector, match, str) => {
|
|
49
|
+
const container = renderBolded(match, str, true, false);
|
|
50
|
+
const elements = container.querySelectorAll(selector);
|
|
51
|
+
|
|
52
|
+
expect(elements.length).toBeGreaterThan(0);
|
|
53
|
+
elements.forEach(el => {
|
|
54
|
+
// Compare classname to "whitespacePre" from css
|
|
55
|
+
expect(el.classList.contains(css.whitespacePre)).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import matchString from '../matchString';
|
|
2
|
+
|
|
3
|
+
import css from '../../../../styles/stringMatchStyles.css';
|
|
4
|
+
|
|
5
|
+
const highlightString = (match, str, ignoreNull = true, simpleSplit = true) => {
|
|
6
|
+
const [parts, regex] = matchString(match, str, ignoreNull, simpleSplit);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
parts.map((part, i) => {
|
|
10
|
+
// RegExp is stateful, set up a new one to work with
|
|
11
|
+
const immutableRegex = new RegExp(regex);
|
|
12
|
+
if (immutableRegex.exec(part) !== null) {
|
|
13
|
+
return (
|
|
14
|
+
<mark
|
|
15
|
+
key={`highlight-mark-${part}-${i}`}
|
|
16
|
+
className={css.whitespacePre}
|
|
17
|
+
>
|
|
18
|
+
{part}
|
|
19
|
+
</mark>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<span
|
|
25
|
+
key={`highlight-span-${part}-${i}`}
|
|
26
|
+
className={css.whitespacePre}
|
|
27
|
+
>
|
|
28
|
+
{part}
|
|
29
|
+
</span>
|
|
30
|
+
);
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default highlightString;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// We're using the base render as we don't need any kint harness stuff, and it causes jest artifacts
|
|
2
|
+
import { render } from '@folio/jest-config-stripes/testing-library/react';
|
|
3
|
+
import highlightString from './highlightString';
|
|
4
|
+
|
|
5
|
+
import css from '../../../../styles/stringMatchStyles.css';
|
|
6
|
+
|
|
7
|
+
const renderHighlighted = (match, str, ignoreNull, simpleSplit) => {
|
|
8
|
+
const result = highlightString(match, str, ignoreNull, simpleSplit);
|
|
9
|
+
const { container } = render(<div>{result}</div>);
|
|
10
|
+
return container;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
describe('highlightString', () => {
|
|
14
|
+
describe('logic and structure', () => {
|
|
15
|
+
test.each([
|
|
16
|
+
['hello', 'say hello world', 1, 'wraps matched text in <mark>'],
|
|
17
|
+
['HELLO', 'say hello world', 1, 'match is case insensitive'],
|
|
18
|
+
['o', 'foo boo', 4, 'highlights multiple occurrences (o in foo boo)'],
|
|
19
|
+
['oo', 'foo boo', 2, 'highlights multiple occurrences (oo in foo boo)'],
|
|
20
|
+
])('%s: %s', (match, str, expectedMarks) => {
|
|
21
|
+
const container = renderHighlighted(match, str);
|
|
22
|
+
expect(container.querySelectorAll('mark')).toHaveLength(expectedMarks);
|
|
23
|
+
expect(container.textContent).toBe(str);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('returns full string without marks when no match', () => {
|
|
27
|
+
const container = renderHighlighted('xyz', 'hello world');
|
|
28
|
+
expect(container.querySelectorAll('mark')).toHaveLength(0);
|
|
29
|
+
expect(container.textContent).toBe('hello world');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('space preservation (all modes)', () => {
|
|
34
|
+
test.each([
|
|
35
|
+
// match, str, ignoreNull, simpleSplit
|
|
36
|
+
['A', 'AN 2025', true, false],
|
|
37
|
+
['AN', 'AN 2025', true, false],
|
|
38
|
+
['AN ', 'AN 2025', true, false],
|
|
39
|
+
['AN 2025', 'AN 2025', true, false],
|
|
40
|
+
['hello', 'hello world', true, false],
|
|
41
|
+
['AB', 'AB CD EF', true, false],
|
|
42
|
+
['world', 'hello world', true, false],
|
|
43
|
+
['a', 'a b a', true, false],
|
|
44
|
+
['AN', 'AN 2025', true, true],
|
|
45
|
+
['AN 2025', 'AN 2025', true, true],
|
|
46
|
+
['world', 'hello world', true, true],
|
|
47
|
+
])('searching "%s" in "%s" (simpleSplit: %s) preserves spaces', (match, str, ignore, simple) => {
|
|
48
|
+
const container = renderHighlighted(match, str, ignore, simple);
|
|
49
|
+
expect(container.textContent).toBe(str);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('whitespace styling', () => {
|
|
54
|
+
test.each([
|
|
55
|
+
['mark', 'AN', 'AN 2025'],
|
|
56
|
+
['span', 'AN', 'AN 2025'],
|
|
57
|
+
])('%s elements should have whiteSpace: pre', (selector, match, str) => {
|
|
58
|
+
const container = renderHighlighted(match, str, true, false);
|
|
59
|
+
const elements = container.querySelectorAll(selector);
|
|
60
|
+
expect(elements.length).toBeGreaterThan(0);
|
|
61
|
+
elements.forEach(el => {
|
|
62
|
+
// Compare classname to "whitespacePre" from css
|
|
63
|
+
expect(el.classList.contains(css.whitespacePre)).toBe(true);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
package/styles/TypeDown.css
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
box-shadow: var(--shadow);
|
|
21
21
|
border: 1px solid #ccc;
|
|
22
22
|
margin-top: 0;
|
|
23
|
-
|
|
24
|
-
min-width:
|
|
23
|
+
width: var(--searchWidth);
|
|
24
|
+
min-width: max(var(--searchWidth), 300px);
|
|
25
25
|
pointer-events: all;
|
|
26
26
|
z-index: 1000;
|
|
27
27
|
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.highlightString = exports.boldString = void 0;
|
|
7
|
-
var _matchString = _interopRequireDefault(require("./matchString"));
|
|
8
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
const highlightString = function (match, str) {
|
|
11
|
-
let ignoreNull = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
12
|
-
let simpleSplit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
13
|
-
const [parts, regex] = (0, _matchString.default)(match, str, ignoreNull, simpleSplit);
|
|
14
|
-
return parts.map((part, i) => {
|
|
15
|
-
// RegExp is stateful, set up a new one to work with
|
|
16
|
-
const immutableRegex = new RegExp(regex);
|
|
17
|
-
if (immutableRegex.exec(part) !== null) {
|
|
18
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("mark", {
|
|
19
|
-
children: part
|
|
20
|
-
}, i);
|
|
21
|
-
}
|
|
22
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
23
|
-
children: part
|
|
24
|
-
}, i);
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
exports.highlightString = highlightString;
|
|
28
|
-
const boldString = function (match, str) {
|
|
29
|
-
let ignoreNull = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
30
|
-
let simpleSplit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
31
|
-
const [parts, regex] = (0, _matchString.default)(match, str, ignoreNull, simpleSplit);
|
|
32
|
-
return parts.map((part, i) => {
|
|
33
|
-
// RegExp is stateful, set up a new one to work with
|
|
34
|
-
const immutableRegex = new RegExp(regex);
|
|
35
|
-
if (immutableRegex.exec(part) !== null) {
|
|
36
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
37
|
-
children: part
|
|
38
|
-
}, i);
|
|
39
|
-
}
|
|
40
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
41
|
-
children: part
|
|
42
|
-
}, i);
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
exports.boldString = boldString;
|