Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/babel/preset-env-7…
Browse files Browse the repository at this point in the history
….23.8
  • Loading branch information
mhuchet authored Jan 16, 2024
2 parents 58cbfd4 + f675918 commit 754f855
Show file tree
Hide file tree
Showing 68 changed files with 1,694 additions and 2,502 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilled-bears-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/design-system': patch
---

chore: add "section" as an option to the "as" list of possible values of the StackPrimitive component
6 changes: 6 additions & 0 deletions .changeset/itchy-eggs-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@talend/ui-playground': patch
'@talend/react-forms': patch
---

fix(DFD-536): Fix click on collapsible toggle
10 changes: 10 additions & 0 deletions .changeset/rotten-turkeys-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@talend/react-faceted-search': major
---

TDOPS-5724 - Restyle faceted search to remove bootstrap and use more Design System elements

# BREAKING CHANGE
- Lot of styling and classes has changed so your overrides might not work anymore
- DOM has changed too so your tests might need to be upgraded
- `tags` type for badges does not exists enymore, use `checkbox` instead as it is the same kind of component but with more possibilities
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import styles from './StackPrimitive.module.scss';
import classnames from 'classnames';
import { forwardRef } from 'react';
import type { Ref, ReactNode } from 'react';
import type { ReactNode, Ref } from 'react';

import classnames from 'classnames';

import styles from './StackPrimitive.module.scss';

export const justifyOptions = {
start: 'justify-start',
Expand Down Expand Up @@ -88,7 +90,7 @@ type SpacingTypeWithAuto =
bottom: keyof typeof sizeOptionsWithAuto;
};

export const possibleAsTypes = ['div', 'ul', 'ol', 'article', 'span', 'dl'] as const;
export const possibleAsTypes = ['div', 'ul', 'ol', 'section', 'article', 'span', 'dl'] as const;

type DirectionType = 'row' | 'column';

Expand Down
2 changes: 0 additions & 2 deletions packages/faceted-search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"url": "https://github.com/Talend/ui.git"
},
"dependencies": {
"@talend/bootstrap-theme": "^8.3.1",
"@talend/daikon-tql-client": "^1.3.1",
"@talend/utils": "^3.0.0",
"@talend/design-tokens": "^2.11.0",
Expand All @@ -45,7 +44,6 @@
"devDependencies": {
"@storybook/addon-actions": "^7.6.4",
"@storybook/testing-library": "^0.2.2",
"@talend/bootstrap-theme": "^8.3.1",
"@talend/design-system": "^8.8.3",
"@talend/eslint-config": "^13.0.2",
"@talend/eslint-plugin": "^1.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { createRef, useCallback, useRef, useState } from 'react';
import PropTypes from 'prop-types';

import isString from 'lodash/isString';
import times from 'lodash/times';
import uniq from 'lodash/uniq';
import PropTypes from 'prop-types';

import { getTheme, Rich } from '@talend/react-components';
import { Form, StackVertical } from '@talend/design-system';

import cssModule from './AddFacetPopover.module.scss';
import { badgesFacetedPropTypes } from '../facetedSearch.propTypes';
import { AddFacetPopoverHeader } from './AddFacetPopoverHeader';
import { AddFacetPopoverRowItem, AddFacetPopoverRowItemCategory } from './AddFacetPopoverRow';

const theme = getTheme(cssModule);
import styles from './AddFacetPopover.module.scss';

const filterByLabel = label => row => {
const rowLabel = isString(row) ? row : row.properties.label;
Expand Down Expand Up @@ -96,8 +96,8 @@ export const AddFacetPopover = ({
const screens = getScreensMemo();
const screensRef = useRef(times(screens.length, createRef));

const onFilter = (_, value) => {
setFilterValue(value);
const onFilter = event => {
setFilterValue(event?.target?.value || '');
};
const resetFilter = () => setFilterValue('');

Expand All @@ -112,57 +112,52 @@ export const AddFacetPopover = ({
};

return (
<div id={addFacetId} className={theme('tc-add-facet-popover')}>
<div id={addFacetId} className={theme('tc-add-facet-popover-container')}>
{screens.map((screen, index) =>
category === screen.category ? (
<div key={`screen-${screen.category}`} ref={screensRef.current[index]}>
<AddFacetPopoverHeader
id={`${addFacetId}-${category}`}
category={screen.category}
onCategoryChange={onCategoryChange}
resetFilter={resetFilter}
onFilter={onFilter}
filterValue={filterValue}
isFocusable={screen.category === category}
t={t}
/>

<Rich.Layout.Body id={`${addFacetId}-${category}-body`}>
<div className={theme('tc-add-facet-popover-row-container')}>
{filterValue !== '' && !screen.rows.length && (
<span className={theme('tc-add-facet-popover-filter-empty')}>
{t('ADD_FACET_FILTER_NO_RESULT', 'No result found')}
</span>
)}
{screen.rows.map(rowItem =>
isString(rowItem) ? (
<AddFacetPopoverRowItemCategory
id={`${id}-open-category`}
key={rowItem}
label={rowItem}
onClick={onCategoryChange}
isFocusable={screen.category === category}
/>
) : (
<AddFacetPopoverRowItem
badgeDefinition={rowItem}
id={addFacetId}
key={rowItem.properties.label}
label={rowItem.properties.label}
onClick={onRowClick}
isFocusable={screen.category === category}
badges={badges}
t={t}
/>
),
)}
</div>
</Rich.Layout.Body>
<div id={addFacetId} className={styles['tc-add-facet-popover']}>
{screens.map((screen, index) =>
category === screen.category ? (
<Form key={`screen-${screen.category}`} ref={screensRef.current[index]}>
<AddFacetPopoverHeader
id={`${addFacetId}-${category}`}
category={screen.category}
onCategoryChange={onCategoryChange}
onFilter={onFilter}
filterValue={filterValue}
t={t}
/>
<div
className={styles['tc-add-facet-popover-items']}
data-test="add-facet-popover-items"
data-testid="add-facet-popover-items"
>
<StackVertical gap="0">
{filterValue !== '' &&
!screen.rows.length &&
t('ADD_FACET_FILTER_NO_RESULT', 'No result found')}
{screen.rows.map(rowItem =>
isString(rowItem) ? (
<AddFacetPopoverRowItemCategory
id={`${id}-open-category`}
key={rowItem}
label={rowItem}
onClick={onCategoryChange}
/>
) : (
<AddFacetPopoverRowItem
badgeDefinition={rowItem}
id={addFacetId}
key={rowItem.properties.label}
label={rowItem.properties.label}
onClick={onRowClick}
badges={badges}
t={t}
/>
),
)}
</StackVertical>
</div>
) : null,
)}
</div>
</Form>
) : null,
)}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,47 +1,13 @@
@use '~@talend/bootstrap-theme/src/theme/guidelines' as *;

@use '~@talend/design-tokens/lib/tokens';

$popover-screen-width: tokens.$coral-sizing-maximal;

.tc-add-facet-popover {
display: flex;
width: $popover-screen-width;
overflow: hidden;

:global(.tc-tooltip-header) {
width: $popover-screen-width;
align-items: center;
font-weight: 800;
min-width: auto;
}

:global(.tc-tooltip-body) {
margin-right: 0;
margin-left: 0;
padding: 0;

:global(.tc-tooltip-content) {
flex-direction: column;
min-height: 0;
padding: 1rem 0;
}
}

&-filter-empty {
padding: tokens.$coral-spacing-s;
display: block;
text-align: center;
font-style: italic;
}

&-row-container {
overflow-y: auto;
width: tokens.$coral-sizing-xxxl;
}

button {
width: 100%;
overflow-wrap: anywhere;
text-align: left;
}
.tc-add-facet-popover-items {
button {
width: 100%;
white-space: break-spaces;
text-align: left;
}
}
Original file line number Diff line number Diff line change
@@ -1,63 +1,42 @@
/* eslint-disable jsx-a11y/no-autofocus */
import { createRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import isNull from 'lodash/isNull';
import PropTypes from 'prop-types';

import { ButtonIcon } from '@talend/design-system';
import { FilterBar, getTheme, Rich } from '@talend/react-components';

import { getTabIndex } from '../addFacetPopover.utils';
import cssModule from './AddFacetPopoverHeader.module.scss';

const theme = getTheme(cssModule);
import { ButtonTertiary, Form } from '@talend/design-system';

export const AddFacetPopoverHeader = ({
category,
onCategoryChange,
id,
resetFilter,
onFilter,
filterValue,
t,
isFocusable,
}) => (
<Rich.Layout.Header className={theme('tc-add-facet-popover-header')} id={`${id}-header`}>
<div id={`${id}-header`}>
{!isNull(category) && (
<div className={theme('tc-add-facet-popover-header-category')}>
<ButtonIcon
icon="chevron-left"
size="S"
onClick={() => onCategoryChange(null)}
tabIndex={getTabIndex(isFocusable)}
>
{t('ADD_FACET_FILTER_BACK', 'Back')}
</ButtonIcon>
<span className={theme('tc-add-facet-popover-header-category-title')}>{category}</span>
</div>
<ButtonTertiary
data-test="add-facet-popover-header-goback"
data-testid="add-facet-popover-header-goback"
icon="chevron-left"
size="S"
onClick={() => onCategoryChange(null)}
>
{t('ADD_FACET_FILTER_BACK', 'Back')}
</ButtonTertiary>
)}
<FilterBar
autoFocus={false}
className={theme('tc-add-facet-popover-filter')}
dockable={false}
docked={false}
iconAlwaysVisible
<Form.Search
id={`${id}-filter`}
placeholder={t('ADD_FACET_FILTER_PLACEHOLDER', 'Find a filter')}
onToggle={resetFilter}
onFilter={onFilter}
onChange={onFilter}
value={filterValue}
disabled={!isFocusable}
/>
</Rich.Layout.Header>
</div>
);

AddFacetPopoverHeader.propTypes = {
category: PropTypes.string,
onCategoryChange: PropTypes.func.isRequired,
id: PropTypes.string.isRequired,
resetFilter: PropTypes.func.isRequired,
onFilter: PropTypes.func.isRequired,
filterValue: PropTypes.string.isRequired,
isFocusable: PropTypes.bool.isRequired,
t: PropTypes.func.isRequired,
};

This file was deleted.

Loading

0 comments on commit 754f855

Please sign in to comment.