diff --git a/frontend/__snapshots__/filters-property-filter-button--button--dark.png b/frontend/__snapshots__/filters-property-filter-button--button--dark.png new file mode 100644 index 0000000000000..d2d5914ad6fd7 Binary files /dev/null and b/frontend/__snapshots__/filters-property-filter-button--button--dark.png differ diff --git a/frontend/__snapshots__/filters-property-filter-button--button--light.png b/frontend/__snapshots__/filters-property-filter-button--button--light.png new file mode 100644 index 0000000000000..01ecaac73a211 Binary files /dev/null and b/frontend/__snapshots__/filters-property-filter-button--button--light.png differ diff --git a/frontend/__snapshots__/filters-property-filter-button--button.png b/frontend/__snapshots__/filters-property-filter-button--button.png new file mode 100644 index 0000000000000..3b8c14ecc0b7c Binary files /dev/null and b/frontend/__snapshots__/filters-property-filter-button--button.png differ diff --git a/frontend/__snapshots__/filters-property-filter-button--filter-types--dark.png b/frontend/__snapshots__/filters-property-filter-button--filter-types--dark.png index 7d327b393da5c..e5da922ada12b 100644 Binary files a/frontend/__snapshots__/filters-property-filter-button--filter-types--dark.png and b/frontend/__snapshots__/filters-property-filter-button--filter-types--dark.png differ diff --git a/frontend/__snapshots__/filters-property-filter-button--filter-types--light.png b/frontend/__snapshots__/filters-property-filter-button--filter-types--light.png index 84df0a6bd221a..9769da9797415 100644 Binary files a/frontend/__snapshots__/filters-property-filter-button--filter-types--light.png and b/frontend/__snapshots__/filters-property-filter-button--filter-types--light.png differ diff --git a/frontend/__snapshots__/filters-property-filter-button--filter-types.png b/frontend/__snapshots__/filters-property-filter-button--filter-types.png index 7a70395f75462..6ffd6cde8b8b8 100644 Binary files a/frontend/__snapshots__/filters-property-filter-button--filter-types.png and b/frontend/__snapshots__/filters-property-filter-button--filter-types.png differ diff --git a/frontend/__snapshots__/filters-property-filter-button--pseudo-states--dark.png b/frontend/__snapshots__/filters-property-filter-button--pseudo-states--dark.png index e4c97bd9c112e..409601d4b2735 100644 Binary files a/frontend/__snapshots__/filters-property-filter-button--pseudo-states--dark.png and b/frontend/__snapshots__/filters-property-filter-button--pseudo-states--dark.png differ diff --git a/frontend/__snapshots__/filters-property-filter-button--pseudo-states--light.png b/frontend/__snapshots__/filters-property-filter-button--pseudo-states--light.png index bb5866b5ea58f..0937f703a736a 100644 Binary files a/frontend/__snapshots__/filters-property-filter-button--pseudo-states--light.png and b/frontend/__snapshots__/filters-property-filter-button--pseudo-states--light.png differ diff --git a/frontend/__snapshots__/filters-property-filter-button--pseudo-states.png b/frontend/__snapshots__/filters-property-filter-button--pseudo-states.png index 62cad7828bec4..e2d1b750a91c2 100644 Binary files a/frontend/__snapshots__/filters-property-filter-button--pseudo-states.png and b/frontend/__snapshots__/filters-property-filter-button--pseudo-states.png differ diff --git a/frontend/__snapshots__/filters-propertyfilters--with-no-close-button.png b/frontend/__snapshots__/filters-propertyfilters--with-no-close-button.png index 511e5bcc051b4..d6139bbdf9627 100644 Binary files a/frontend/__snapshots__/filters-propertyfilters--with-no-close-button.png and b/frontend/__snapshots__/filters-propertyfilters--with-no-close-button.png differ diff --git a/frontend/__snapshots__/scenes-app-surveys--new-survey-targeting-section.png b/frontend/__snapshots__/scenes-app-surveys--new-survey-targeting-section.png index 99f004ff819fd..911eaae6e5196 100644 Binary files a/frontend/__snapshots__/scenes-app-surveys--new-survey-targeting-section.png and b/frontend/__snapshots__/scenes-app-surveys--new-survey-targeting-section.png differ diff --git a/frontend/src/lib/components/PropertyFilters/components/PropertyFilterButton.scss b/frontend/src/lib/components/PropertyFilters/components/PropertyFilterButton.scss index f4760971ff52d..b78e0aeedb8ac 100644 --- a/frontend/src/lib/components/PropertyFilters/components/PropertyFilterButton.scss +++ b/frontend/src/lib/components/PropertyFilters/components/PropertyFilterButton.scss @@ -2,20 +2,36 @@ display: inline-flex; gap: 0.5rem; align-items: center; + height: 2rem; + padding: 0.25rem 1rem; overflow: hidden; - text-shadow: none; + color: var(--default); + white-space: nowrap; + user-select: none; background: var(--border); - border-color: transparent; - box-shadow: none; - transition-duration: 200ms; // Shorten from Ant's 300ms + border: 1px solid transparent; + border-radius: 2rem; + outline: 0; + transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); &:hover, &:focus { - color: var(--text-default); - background: var(--border); border-color: var(--border); } + &:not(.PropertyFilterButton--clickable) { + border-color: transparent; + } + + &.PropertyFilterButton--clickable { + touch-action: manipulation; // faster clicks + cursor: pointer; + } + + &.PropertyFilterButton--closable { + padding-right: 0.5rem; + } + > :not(.PropertyFilterButton-content) { flex-shrink: 0; } @@ -25,4 +41,28 @@ overflow: hidden; text-overflow: ellipsis; } + + // Close button + .LemonButton { + margin-left: -0.25rem; + } + + .LemonButton__chrome { + height: 22px !important; + min-height: auto !important; + padding: 0 4px !important; + } +} + +.posthog-3000 { + .PropertyFilterButton { + &:hover, + &:focus { + border-color: var(--border-bold); + } + + &:not(.PropertyFilterButton--clickable) { + border-color: transparent; + } + } } diff --git a/frontend/src/lib/components/PropertyFilters/components/PropertyFilterButton.stories.tsx b/frontend/src/lib/components/PropertyFilters/components/PropertyFilterButton.stories.tsx index d966a58546986..b92f13b21f989 100644 --- a/frontend/src/lib/components/PropertyFilters/components/PropertyFilterButton.stories.tsx +++ b/frontend/src/lib/components/PropertyFilters/components/PropertyFilterButton.stories.tsx @@ -83,6 +83,10 @@ const meta: Meta = { } export default meta +export function Button(): JSX.Element { + return {}} onClose={() => {}} /> +} + export function FilterTypes(): JSX.Element { return (
@@ -99,22 +103,30 @@ export function PseudoStates(): JSX.Element { return (
-
STATE=DEFAULT
+
Default
+ {}} /> + {}} /> + + {}} onClose={() => {}} />
-
STATE=HOVER
+
Hover
+ {}} /> + {}} /> -
-
-
STATE=HOVER,ACTIVE
- + {}} onClose={() => {}} /> +
+
+
Hover over close
{}} /> + + {}} onClose={() => {}} />
) @@ -122,7 +134,6 @@ export function PseudoStates(): JSX.Element { PseudoStates.parameters = { pseudo: { - hover: ['#hover .PropertyFilterButton', '#active .PropertyFilterButton'], - active: ['#active .PropertyFilterButton'], + hover: ['#hover .PropertyFilterButton', '#hover-close .PropertyFilterButton', '#hover-close .LemonButton'], }, } diff --git a/frontend/src/lib/components/PropertyFilters/components/PropertyFilterButton.tsx b/frontend/src/lib/components/PropertyFilters/components/PropertyFilterButton.tsx index eea640e7c1b60..bed6c93160f93 100644 --- a/frontend/src/lib/components/PropertyFilters/components/PropertyFilterButton.tsx +++ b/frontend/src/lib/components/PropertyFilters/components/PropertyFilterButton.tsx @@ -1,9 +1,12 @@ import './PropertyFilterButton.scss' -import { Button } from 'antd' +import { LemonButton } from '@posthog/lemon-ui' +import clsx from 'clsx' import { useValues } from 'kea' import { CloseButton } from 'lib/components/CloseButton' import { PropertyFilterIcon } from 'lib/components/PropertyFilters/components/PropertyFilterIcon' +import { useFeatureFlag } from 'lib/hooks/useFeatureFlag' +import { IconClose } from 'lib/lemon-ui/icons' import { KEY_MAPPING } from 'lib/taxonomy' import { midEllipsis } from 'lib/utils' import React from 'react' @@ -19,14 +22,16 @@ export interface PropertyFilterButtonProps { onClose?: () => void children?: string item: AnyPropertyFilter - style?: React.CSSProperties } export const PropertyFilterButton = React.forwardRef( - function PropertyFilterButton({ onClick, onClose, children, item, style }, ref): JSX.Element { + function PropertyFilterButton({ onClick, onClose, children, item }, ref): JSX.Element { const { cohortsById } = useValues(cohortsModel) const { formatPropertyValueForDisplay } = useValues(propertyDefinitionsModel) + const is3000 = useFeatureFlag('POSTHOG_3000', 'test') + const closable = onClose !== undefined + const clickable = onClick !== undefined const label = children || formatPropertyLabel( @@ -36,27 +41,47 @@ export const PropertyFilterButton = React.forwardRef formatPropertyValueForDisplay(item.key, s)?.toString() || '?' ) + const ButtonComponent = clickable ? 'button' : 'div' + return ( - + ) } ) diff --git a/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx b/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx index 47e0dcd57b105..6c49bbdfb845e 100644 --- a/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx +++ b/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx @@ -170,6 +170,7 @@ export function TaxonomicPropertyFilter({ status={!valuePresent ? 'primary' : 'stealth'} icon={!valuePresent ? : undefined} data-attr={'property-select-toggle-' + index} + sideIcon={null} // The null sideIcon is here on purpose - it prevents the dropdown caret onClick={() => (dropdownOpen ? closeDropdown() : openDropdown())} > {filter?.type === 'cohort' ? ( diff --git a/frontend/src/styles/vars.scss b/frontend/src/styles/vars.scss index 2b70f795f2b42..096baebf9b890 100644 --- a/frontend/src/styles/vars.scss +++ b/frontend/src/styles/vars.scss @@ -334,14 +334,15 @@ $_lifecycle_dormant: $_danger; --toastify-color-success: var(--success); --toastify-color-warning: var(--warning); --toastify-color-error: var(--danger); + --toastify-color-progress-info: var(--toastify-color-info); + --toastify-color-progress-success: var(--toastify-color-success); + --toastify-color-progress-warning: var(--toastify-color-warning); + --toastify-color-progress-error: var(--toastify-color-error); --toastify-toast-background: var(--bg-light); --toastify-toast-width: 26rem; --toastify-toast-min-height: 3.5rem; --toastify-toast-max-height: 16rem; --toastify-text-color-light: #757575; - --toastify-color-progress-success: var(--toastify-color-success); - --toastify-color-progress-warning: var(--toastify-color-warning); - --toastify-color-progress-error: var(--toastify-color-error); // In-app prompts --in-app-prompts-width: 26rem;