@helsenorge/designsystem-react 14.5.1 → 14.7.0
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/CHANGELOG.md +24 -0
- package/lib/Drawer.js +37 -14
- package/lib/Drawer.js.map +1 -1
- package/lib/Select.js +3 -2
- package/lib/Select.js.map +1 -1
- package/lib/Title.js +2 -1
- package/lib/Title.js.map +1 -1
- package/lib/components/Drawer/Drawer.d.ts +6 -0
- package/lib/components/Drawer/styles.module.scss +19 -0
- package/lib/components/Drawer/styles.module.scss.d.ts +1 -0
- package/lib/components/Dropdown/styles.module.scss +4 -4
- package/lib/components/Filter/DrawerNavigation/DrawerNavigation.d.ts +35 -0
- package/lib/components/Filter/DrawerNavigation/FinnFastlegeFlyt.example.d.ts +2 -0
- package/lib/components/Filter/DrawerNavigation/FinnFastlegeFlyt.module.scss +15 -0
- package/lib/components/Filter/DrawerNavigation/FinnFastlegeFlyt.module.scss.d.ts +11 -0
- package/lib/components/Filter/DrawerNavigation/index.d.ts +4 -0
- package/lib/components/Filter/DrawerNavigation/index.js +81 -0
- package/lib/components/Filter/DrawerNavigation/index.js.map +1 -0
- package/lib/components/Filter/DrawerNavigation/useDrawerNavigation.d.ts +7 -0
- package/lib/components/Filter/FilterButton/FilterButton.d.ts +7 -0
- package/lib/components/Filter/FilterButton/styles.module.scss +52 -0
- package/lib/components/Filter/FilterButton/styles.module.scss.d.ts +12 -0
- package/lib/components/Filter/FilterButtonAndChipsWrapper/FilterButtonAndChipsWrapper.d.ts +11 -0
- package/lib/components/Filter/FilterButtonAndChipsWrapper/styles.module.scss +8 -0
- package/lib/components/Filter/FilterButtonAndChipsWrapper/styles.module.scss.d.ts +9 -0
- package/lib/components/Filter/FilterDrawer/FilterDrawer.d.ts +42 -0
- package/lib/components/Filter/FilterDrawer/styles.module.scss +29 -0
- package/lib/components/Filter/FilterDrawer/styles.module.scss.d.ts +10 -0
- package/lib/components/Filter/FilterLinkList/FilterLinkList.d.ts +35 -0
- package/lib/components/Filter/FilterLinkList/FilterLinkList.module.scss +89 -0
- package/lib/components/Filter/FilterLinkList/FilterLinkList.module.scss.d.ts +14 -0
- package/lib/components/Filter/FilterOverviewLinkList/FilterOverviewLinkList.d.ts +19 -0
- package/lib/components/Filter/FilterOverviewSearch/FilterOverviewSearch.d.ts +9 -0
- package/lib/components/Filter/FilterOverviewSearch/styles.module.scss +14 -0
- package/lib/components/Filter/FilterOverviewSearch/styles.module.scss.d.ts +9 -0
- package/lib/components/Filter/FilterResultCountAndSortWrapper/FilterResultCountAndSortWrapper.d.ts +8 -0
- package/lib/components/Filter/FilterResultCountAndSortWrapper/styles.module.scss +17 -0
- package/lib/components/Filter/FilterResultCountAndSortWrapper/styles.module.scss.d.ts +11 -0
- package/lib/components/Filter/FilterSearch/FilterSearch.d.ts +19 -0
- package/lib/components/Filter/FilterSearch/styles.module.scss +181 -0
- package/lib/components/Filter/FilterSearch/styles.module.scss.d.ts +16 -0
- package/lib/components/Filter/FilterSort/FilterSort.d.ts +8 -0
- package/lib/components/Filter/FilterSort/styles.module.scss +29 -0
- package/lib/components/Filter/FilterSort/styles.module.scss.d.ts +11 -0
- package/lib/components/Filter/getFilterChips/getFilterChips.d.ts +17 -0
- package/lib/components/Filter/index.d.ts +2 -0
- package/lib/components/Filter/index.js +109 -0
- package/lib/components/Filter/index.js.map +1 -0
- package/lib/components/Filter/resourceHelper.d.ts +3 -0
- package/lib/components/Filter/resourcesMock.d.ts +41 -0
- package/lib/components/Filter/useFilter.d.ts +20 -0
- package/lib/components/Filter/useFilterDrawer.d.ts +11 -0
- package/lib/components/Filter/utils.d.ts +81 -0
- package/lib/components/Highlighter/styles.module.scss +1 -1
- package/lib/components/Icons/HTMLFile.js +3 -11
- package/lib/components/Icons/HTMLFile.js.map +1 -1
- package/lib/components/Label/utils.d.ts +1 -0
- package/lib/components/NotificationPanel/NotificationPanel.d.ts +1 -1
- package/lib/components/NotificationPanel/index.js +1 -1
- package/lib/components/NotificationPanel/index.js.map +1 -1
- package/lib/components/Select/Select.d.ts +2 -0
- package/lib/components/Select/styles.module.scss +1 -0
- package/lib/components/Title/Title.d.ts +2 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/resource.js +4 -0
- package/lib/resource.js.map +1 -0
- package/lib/resources/HN.Designsystem.Drawer.nn-NO.json.d.ts +7 -0
- package/lib/utils/resource.d.ts +6 -0
- package/lib/utils/resource.js +2 -0
- package/lib/utils2.js +4 -2
- package/lib/utils2.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../../scss/breakpoints' as breakpoints;
|
|
3
|
+
@import '../../../scss/supernova/styles/spacers.css';
|
|
4
|
+
|
|
5
|
+
.filter-button {
|
|
6
|
+
width: fit-content;
|
|
7
|
+
height: 2.75rem;
|
|
8
|
+
padding: 0;
|
|
9
|
+
background-color: transparent;
|
|
10
|
+
border: none;
|
|
11
|
+
outline: none;
|
|
12
|
+
border-radius: 100px;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
|
|
15
|
+
&__inner {
|
|
16
|
+
border-radius: 100px;
|
|
17
|
+
height: 2rem;
|
|
18
|
+
background-color: var(--color-action-graphics-onlight);
|
|
19
|
+
border: 1px solid transparent;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-flow: row nowrap;
|
|
22
|
+
align-items: center;
|
|
23
|
+
padding: 0.1875rem var(--core-space-s) 0.1875rem 0.3125rem;
|
|
24
|
+
|
|
25
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
26
|
+
height: 2.25rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&--hovered,
|
|
30
|
+
&:hover {
|
|
31
|
+
background-color: var(--color-action-graphics-onlight-hover);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.filter-button:active & {
|
|
35
|
+
background-color: var(--color-action-background-onlight-active, #06596c);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.filter-button:focus-visible & {
|
|
39
|
+
outline: 4px solid var(--color-action-border-onlight-focus);
|
|
40
|
+
border-color: var(--color-action-border-ondark-focus);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
svg {
|
|
44
|
+
fill: white;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&__text {
|
|
49
|
+
color: white;
|
|
50
|
+
text-wrap: nowrap;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Styles = {
|
|
2
|
+
'filter-button': string;
|
|
3
|
+
'filter-button__inner': string;
|
|
4
|
+
'filter-button__inner--hovered': string;
|
|
5
|
+
'filter-button__text': string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type ClassNames = keyof Styles;
|
|
9
|
+
|
|
10
|
+
declare const styles: Styles;
|
|
11
|
+
|
|
12
|
+
export default styles;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface FilterButtonAndChipsWrapperProps {
|
|
3
|
+
/** FilterButton content area */
|
|
4
|
+
filterButtonComponent: React.ReactNode;
|
|
5
|
+
/** Content area for rendering filter chips */
|
|
6
|
+
filterChips: React.ReactNode[];
|
|
7
|
+
/** test id that is placed on the wrapper */
|
|
8
|
+
testId?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const FilterButtonAndChipsWrapper: React.FC<FilterButtonAndChipsWrapperProps>;
|
|
11
|
+
export default FilterButtonAndChipsWrapper;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { HNDesignsystemFilter } from '../../../resources/Resources';
|
|
2
|
+
import { UseFilterDrawerReturn } from '../useFilterDrawer';
|
|
3
|
+
import { DrawerViewProps } from '../DrawerNavigation/DrawerNavigation';
|
|
4
|
+
export interface FilterDrawerProps<ViewId extends string = string> {
|
|
5
|
+
/** The drawer state from useFilterDrawer */
|
|
6
|
+
drawer: UseFilterDrawerReturn<ViewId>;
|
|
7
|
+
/** Additional callback when the drawer closes (drawer.close() is always called automatically) */
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
/** Fully custom footer — overrides the default footer built from onReset/resultText */
|
|
10
|
+
footer?: React.ReactNode;
|
|
11
|
+
/** If provided, shows a "Nullstill filter" button in the default footer */
|
|
12
|
+
onReset?: () => void;
|
|
13
|
+
/** If provided, shows a result count button (e.g. "Vis 5 treff") that closes the drawer */
|
|
14
|
+
resultCount?: number;
|
|
15
|
+
/** Resources for the component */
|
|
16
|
+
resources?: Partial<HNDesignsystemFilter>;
|
|
17
|
+
/** DrawerNavigation.View children defining the overview and filter views */
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export interface FilterDrawerViewProps extends DrawerViewProps {
|
|
21
|
+
/** Hide reset button for view */
|
|
22
|
+
noResetButton?: boolean;
|
|
23
|
+
/** View specific close handler */
|
|
24
|
+
onClose?: () => void;
|
|
25
|
+
/** View specific reset handler */
|
|
26
|
+
onReset?: () => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Never rendered directly — FilterDrawer reads its props and creates a DrawerNavigation.View
|
|
30
|
+
* with id="overview" and home=true.
|
|
31
|
+
*/
|
|
32
|
+
declare function FilterDrawerOverview(_props: Omit<DrawerViewProps, 'id' | 'home'>): React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Never rendered directly — FilterDrawer reads its props and creates a FilterDrawerView
|
|
35
|
+
*/
|
|
36
|
+
declare function FilterDrawerView(_props: FilterDrawerViewProps): React.ReactNode;
|
|
37
|
+
declare function FilterDrawer<ViewId extends string>({ drawer, onClose, footer, onReset, resultCount, resources, children, }: FilterDrawerProps<ViewId>): React.ReactNode;
|
|
38
|
+
declare namespace FilterDrawer {
|
|
39
|
+
var Overview: typeof FilterDrawerOverview;
|
|
40
|
+
var View: typeof FilterDrawerView;
|
|
41
|
+
}
|
|
42
|
+
export default FilterDrawer;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../../scss/breakpoints' as breakpoints;
|
|
3
|
+
@import '../../../scss/supernova/styles/spacers.css';
|
|
4
|
+
|
|
5
|
+
.filter-drawer {
|
|
6
|
+
&__view {
|
|
7
|
+
--extra-horizontal-padding: 8px;
|
|
8
|
+
|
|
9
|
+
padding-left: var(--extra-horizontal-padding);
|
|
10
|
+
padding-right: var(--extra-horizontal-padding);
|
|
11
|
+
|
|
12
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
13
|
+
--extra-horizontal-padding: 12px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&__footer {
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
width: 100%;
|
|
21
|
+
|
|
22
|
+
// Override for single button
|
|
23
|
+
@supports selector(:has(> *)) {
|
|
24
|
+
&:not(:has(> :nth-child(2))) {
|
|
25
|
+
justify-content: flex-end;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type LinkType = React.FC<LinkProps>;
|
|
3
|
+
export interface CompoundComponent extends React.FC<LinkListProps> {
|
|
4
|
+
Link: LinkType;
|
|
5
|
+
}
|
|
6
|
+
export interface LinkListProps {
|
|
7
|
+
/** Items in the LinkList */
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
/** Adds custom classes to the element. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Sets the data-testid attribute. */
|
|
12
|
+
testId?: string;
|
|
13
|
+
/** Ref passed to the ul element */
|
|
14
|
+
ref?: React.Ref<HTMLUListElement | null>;
|
|
15
|
+
}
|
|
16
|
+
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
17
|
+
export type LinkProps = Modify<React.HTMLAttributes<HTMLAnchorElement | HTMLButtonElement>, {
|
|
18
|
+
/** If needed children will be content instead of title and chips. Use only in edge cases */
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
/** Title text on link element */
|
|
21
|
+
title?: string;
|
|
22
|
+
/** Texts rendered inside non-interactive chips on link element */
|
|
23
|
+
chips?: string[];
|
|
24
|
+
/** Custom classname for link element */
|
|
25
|
+
className?: string;
|
|
26
|
+
/** Ref for button */
|
|
27
|
+
linkRef?: React.RefObject<HTMLButtonElement | null>;
|
|
28
|
+
/** Sets the data-testid attribute. */
|
|
29
|
+
testId?: string;
|
|
30
|
+
/** Ref passed to the list item element */
|
|
31
|
+
ref?: React.Ref<HTMLLIElement | null>;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const Link: LinkType;
|
|
34
|
+
export declare const FilterLinkList: CompoundComponent;
|
|
35
|
+
export default FilterLinkList;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../../scss/breakpoints' as breakpoints;
|
|
3
|
+
@import '../../../scss/supernova/styles/colors.css';
|
|
4
|
+
|
|
5
|
+
.link-list {
|
|
6
|
+
list-style: none;
|
|
7
|
+
padding: 0;
|
|
8
|
+
width: inherit;
|
|
9
|
+
margin: 0;
|
|
10
|
+
position: relative;
|
|
11
|
+
|
|
12
|
+
&__item {
|
|
13
|
+
&:first-of-type {
|
|
14
|
+
border-top: 1px solid var(--component-listelements-border-neutral-normal);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&__button {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
align-items: center;
|
|
23
|
+
padding: 1rem;
|
|
24
|
+
padding-right: 0;
|
|
25
|
+
min-height: 4rem;
|
|
26
|
+
text-decoration: none;
|
|
27
|
+
color: var(--color-base-text-onlight);
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
width: 100%;
|
|
30
|
+
background-color: var(--color-base-background-white);
|
|
31
|
+
border: none;
|
|
32
|
+
text-align: left;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
border-bottom: 1px solid var(--component-listelements-border-neutral-normal);
|
|
35
|
+
|
|
36
|
+
&__content {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
gap: 0.375rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:hover {
|
|
43
|
+
background-color: var(--component-listelements-background-neutral-light);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:active {
|
|
47
|
+
background-color: var(--component-listelements-background-neutral-medium);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:focus-visible {
|
|
51
|
+
outline: 4px solid var(--color-action-border-onlight-focus);
|
|
52
|
+
outline-offset: 0; // Override user agent default
|
|
53
|
+
position: relative;
|
|
54
|
+
z-index: 1;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&__chip-list {
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-flow: row wrap;
|
|
61
|
+
column-gap: 0.5rem;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&__chip {
|
|
65
|
+
box-sizing: border-box;
|
|
66
|
+
height: 1.625rem;
|
|
67
|
+
margin-top: 0.375rem;
|
|
68
|
+
margin-bottom: 6px;
|
|
69
|
+
background-color: var(--core-color-blueberry-50);
|
|
70
|
+
border: 1px solid var(--core-color-blueberry-500);
|
|
71
|
+
color: var(--core-color-blueberry-800);
|
|
72
|
+
border-radius: 100px;
|
|
73
|
+
font-size: 0.875rem;
|
|
74
|
+
font-weight: 600;
|
|
75
|
+
text-transform: uppercase;
|
|
76
|
+
text-wrap: none;
|
|
77
|
+
line-height: 1.25rem;
|
|
78
|
+
padding-top: 0.1875rem;
|
|
79
|
+
padding-left: 0.75rem;
|
|
80
|
+
padding-right: 0.75rem;
|
|
81
|
+
|
|
82
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
83
|
+
height: 1.875rem;
|
|
84
|
+
padding-top: 0.3125rem;
|
|
85
|
+
margin-top: 0.4375rem;
|
|
86
|
+
margin-bottom: 0.4375rem;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Styles = {
|
|
2
|
+
'link-list': string;
|
|
3
|
+
'link-list__button': string;
|
|
4
|
+
'link-list__button__content': string;
|
|
5
|
+
'link-list__chip': string;
|
|
6
|
+
'link-list__chip-list': string;
|
|
7
|
+
'link-list__item': string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type ClassNames = keyof Styles;
|
|
11
|
+
|
|
12
|
+
declare const styles: Styles;
|
|
13
|
+
|
|
14
|
+
export default styles;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FilterValues, UseFilterReturn } from '../useFilter';
|
|
2
|
+
export interface FilterOverviewLink {
|
|
3
|
+
/** The filter key to read values from */
|
|
4
|
+
filterKey: string;
|
|
5
|
+
/** Display title for the link */
|
|
6
|
+
title: string;
|
|
7
|
+
/** View ID to navigate to when clicked. Defaults to filterKey */
|
|
8
|
+
viewId?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FilterOverviewLinkListProps<T extends FilterValues> {
|
|
11
|
+
/** The filter instance from useFilter */
|
|
12
|
+
filter: UseFilterReturn<T>;
|
|
13
|
+
/** Look up the display label for a filter key + value */
|
|
14
|
+
getLabel: (key: keyof T, value: unknown) => string;
|
|
15
|
+
/** Configuration for which filter keys to show as links */
|
|
16
|
+
links: FilterOverviewLink[];
|
|
17
|
+
}
|
|
18
|
+
declare function FilterOverviewLinkList<T extends FilterValues>({ filter, getLabel, links }: FilterOverviewLinkListProps<T>): React.ReactNode;
|
|
19
|
+
export default FilterOverviewLinkList;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FilterSearchProps } from '../FilterSearch/FilterSearch';
|
|
2
|
+
export interface FilterOverviewSearchProps extends FilterSearchProps {
|
|
3
|
+
/** Adds custom classes to the wrapper element. */
|
|
4
|
+
wrapperClassName?: string;
|
|
5
|
+
/** Sets the data-testid attribute. */
|
|
6
|
+
testId?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const FilterOverviewSearch: React.FC<FilterOverviewSearchProps>;
|
|
9
|
+
export default FilterOverviewSearch;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@import '../../../scss/supernova/styles/colors.css';
|
|
2
|
+
@import '../../../scss/supernova/styles/spacers.css';
|
|
3
|
+
|
|
4
|
+
.filter-overview-search {
|
|
5
|
+
width: 100%;
|
|
6
|
+
padding: var(--core-space-s);
|
|
7
|
+
padding-right: var(--core-space-xl);
|
|
8
|
+
background-color: var(--color-base-background-white);
|
|
9
|
+
border-bottom: 1px solid var(--component-listelements-border-neutral-normal);
|
|
10
|
+
|
|
11
|
+
&:first-child {
|
|
12
|
+
border-top: 1px solid var(--component-listelements-border-neutral-normal);
|
|
13
|
+
}
|
|
14
|
+
}
|
package/lib/components/Filter/FilterResultCountAndSortWrapper/FilterResultCountAndSortWrapper.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface FilterResultCountAndSortWrapper {
|
|
2
|
+
/** Result count content area */
|
|
3
|
+
resultCount?: React.ReactNode;
|
|
4
|
+
/** FilterSort content area */
|
|
5
|
+
sortComponent?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const FilterResultCountAndSortWrapper: React.FC<FilterResultCountAndSortWrapper>;
|
|
8
|
+
export default FilterResultCountAndSortWrapper;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.filter-result-count-and-sort-wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-flow: row wrap;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
align-items: flex-end;
|
|
6
|
+
gap: var(--core-space-xs);
|
|
7
|
+
|
|
8
|
+
&__count {
|
|
9
|
+
text-wrap: nowrap;
|
|
10
|
+
line-height: 3rem;
|
|
11
|
+
flex-shrink: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&__sort {
|
|
15
|
+
flex: 1 1 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type Styles = {
|
|
2
|
+
'filter-result-count-and-sort-wrapper': string;
|
|
3
|
+
'filter-result-count-and-sort-wrapper__count': string;
|
|
4
|
+
'filter-result-count-and-sort-wrapper__sort': string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type ClassNames = keyof Styles;
|
|
8
|
+
|
|
9
|
+
declare const styles: Styles;
|
|
10
|
+
|
|
11
|
+
export default styles;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HNDesignsystemFilter } from '../../../resources/Resources';
|
|
2
|
+
export interface FilterSearchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'className' | 'value' | 'onChange'> {
|
|
3
|
+
/** Adds custom classes to the component */
|
|
4
|
+
className?: string;
|
|
5
|
+
/** The value given by the user in the input field */
|
|
6
|
+
value: string | undefined;
|
|
7
|
+
/** onChange handler for the input field */
|
|
8
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
9
|
+
/** Props for the search button */
|
|
10
|
+
buttonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
11
|
+
/** Props for the clear button */
|
|
12
|
+
clearButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
13
|
+
/** Texts if overriding SOT */
|
|
14
|
+
resources?: Partial<HNDesignsystemFilter>;
|
|
15
|
+
/** Ref passed to the input element */
|
|
16
|
+
ref?: React.Ref<HTMLInputElement | null>;
|
|
17
|
+
}
|
|
18
|
+
declare const FilterSearch: React.FC<FilterSearchProps>;
|
|
19
|
+
export default FilterSearch;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../../scss/breakpoints' as breakpoints;
|
|
3
|
+
@use '../../../scss/screen-reader' as sr;
|
|
4
|
+
@import '../../../scss/supernova/styles/spacers.css';
|
|
5
|
+
|
|
6
|
+
.filter-search {
|
|
7
|
+
&__wrapper {
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-columns: 1fr auto auto;
|
|
10
|
+
align-items: center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&__input-wrapper {
|
|
14
|
+
grid-column: 1 / 3;
|
|
15
|
+
grid-row: 1;
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
cursor: text;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&__input {
|
|
23
|
+
position: relative;
|
|
24
|
+
height: 2rem;
|
|
25
|
+
width: 100%;
|
|
26
|
+
border-radius: 100px 0 0 100px;
|
|
27
|
+
border: 2px solid var(--color-base-border-onlight-emphasized);
|
|
28
|
+
background-color: var(--core-color-white);
|
|
29
|
+
padding: 0.375rem 1rem;
|
|
30
|
+
padding-right: 2.75rem;
|
|
31
|
+
text-overflow: ellipsis;
|
|
32
|
+
|
|
33
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
34
|
+
height: 2.75rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:not(:disabled)::placeholder {
|
|
38
|
+
color: var(--color-base-text-onlight);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&--hovered,
|
|
42
|
+
&:hover,
|
|
43
|
+
&:active {
|
|
44
|
+
outline: 1px solid var(--color-base-border-onlight-emphasized);
|
|
45
|
+
background-color: var(--core-color-neutral-50);
|
|
46
|
+
z-index: 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:focus-visible {
|
|
50
|
+
border-color: var(--color-action-border-onlight-focus);
|
|
51
|
+
outline: 2px solid var(--color-action-border-onlight-focus);
|
|
52
|
+
z-index: 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:disabled {
|
|
56
|
+
cursor: not-allowed;
|
|
57
|
+
border: 2px dashed var(--color-disabled-border);
|
|
58
|
+
outline: none;
|
|
59
|
+
color: var(--color-disabled-text);
|
|
60
|
+
background-color: transparent;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&__label {
|
|
64
|
+
@include sr.sr-only;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&__search-button,
|
|
69
|
+
&__clear-button {
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
outline: unset;
|
|
72
|
+
border: unset;
|
|
73
|
+
background-color: unset;
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
padding: 0;
|
|
78
|
+
|
|
79
|
+
svg {
|
|
80
|
+
fill: var(--color-action-graphics-onlight);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&:disabled {
|
|
84
|
+
cursor: not-allowed;
|
|
85
|
+
|
|
86
|
+
svg {
|
|
87
|
+
fill: var(--color-disabled-graphics);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&__search-button {
|
|
93
|
+
grid-column: 3;
|
|
94
|
+
grid-row: 1;
|
|
95
|
+
width: 2.75rem;
|
|
96
|
+
height: 2.75rem;
|
|
97
|
+
margin-left: -2px;
|
|
98
|
+
background-color: transparent;
|
|
99
|
+
|
|
100
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
101
|
+
width: 3rem;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&--inner {
|
|
105
|
+
position: relative;
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
width: 2.75rem;
|
|
109
|
+
height: 2rem;
|
|
110
|
+
background-color: var(--core-color-white);
|
|
111
|
+
border: 2px solid var(--color-base-border-onlight-emphasized);
|
|
112
|
+
border-radius: 0 100px 100px 0;
|
|
113
|
+
padding-right: 0.3125rem;
|
|
114
|
+
|
|
115
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
116
|
+
height: 2.75rem;
|
|
117
|
+
width: 3rem;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
:disabled > & {
|
|
121
|
+
border: 2px dashed var(--color-disabled-border);
|
|
122
|
+
background: transparent;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:hover > &:not(:disabled > &),
|
|
126
|
+
:active > &:not(:disabled > &) {
|
|
127
|
+
outline: 1px solid var(--color-base-border-onlight-emphasized);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:hover > &:not(:disabled > &) {
|
|
131
|
+
background-color: var(--core-color-neutral-50);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:active > &:not(:disabled > &) {
|
|
135
|
+
background-color: var(--core-color-neutral-100);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
:focus-visible > &:not(:disabled > &) {
|
|
139
|
+
border-color: var(--color-action-border-onlight-focus);
|
|
140
|
+
outline: 2px solid var(--color-action-border-onlight-focus);
|
|
141
|
+
z-index: 1;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
svg {
|
|
145
|
+
margin-left: 0.5rem;
|
|
146
|
+
|
|
147
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
148
|
+
margin-left: 0.0625rem;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&__clear-button {
|
|
155
|
+
position: relative;
|
|
156
|
+
grid-column: 2;
|
|
157
|
+
grid-row: 1;
|
|
158
|
+
width: 1.5rem;
|
|
159
|
+
height: 1.5rem;
|
|
160
|
+
margin: 0.375rem;
|
|
161
|
+
border-radius: 100%;
|
|
162
|
+
z-index: 1;
|
|
163
|
+
|
|
164
|
+
&:hover:not(:disabled) {
|
|
165
|
+
background-color: var(--core-color-neutral-50);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&:active:not(:disabled) {
|
|
169
|
+
background-color: var(--core-color-neutral-100);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&:focus-visible:not(:disabled) {
|
|
173
|
+
outline: 4px solid var(--color-action-border-onlight-focus);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
177
|
+
width: 2rem;
|
|
178
|
+
height: 2rem;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type Styles = {
|
|
2
|
+
'filter-search__clear-button': string;
|
|
3
|
+
'filter-search__input': string;
|
|
4
|
+
'filter-search__input__label': string;
|
|
5
|
+
'filter-search__input--hovered': string;
|
|
6
|
+
'filter-search__input-wrapper': string;
|
|
7
|
+
'filter-search__search-button': string;
|
|
8
|
+
'filter-search__search-button--inner': string;
|
|
9
|
+
'filter-search__wrapper': string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type ClassNames = keyof Styles;
|
|
13
|
+
|
|
14
|
+
declare const styles: Styles;
|
|
15
|
+
|
|
16
|
+
export default styles;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HNDesignsystemFilter } from '../../../resources/Resources';
|
|
2
|
+
import { SelectProps } from '../../Select';
|
|
3
|
+
export interface FilterSortProps extends SelectProps {
|
|
4
|
+
/** Texts if overriding SOT */
|
|
5
|
+
resources?: Partial<HNDesignsystemFilter>;
|
|
6
|
+
}
|
|
7
|
+
declare const FilterSort: React.FC<FilterSortProps>;
|
|
8
|
+
export default FilterSort;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../../scss/breakpoints' as breakpoints;
|
|
3
|
+
@import '../../../scss/supernova/styles/spacers.css';
|
|
4
|
+
|
|
5
|
+
.select {
|
|
6
|
+
select {
|
|
7
|
+
outline: none;
|
|
8
|
+
text-align: right;
|
|
9
|
+
color: var(--color-action-text-onlight);
|
|
10
|
+
padding-right: 3rem;
|
|
11
|
+
height: 2.75rem;
|
|
12
|
+
|
|
13
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
14
|
+
height: 3rem;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&__wrapper {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-flow: row wrap;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: flex-end;
|
|
23
|
+
gap: var(--core-space-4xs);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&__label {
|
|
27
|
+
margin-bottom: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|