@oslokommune/punkt-react 12.3.6 → 12.3.8
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 +37 -0
- package/dist/index.d.ts +3 -2
- package/dist/punkt-react.es.js +833 -891
- package/dist/punkt-react.umd.js +53 -53
- package/package.json +3 -3
- package/src/components/accordion/Accordion.tsx +0 -2
- package/src/components/accordion/AccordionItem.tsx +0 -2
- package/src/components/alert/Alert.tsx +0 -2
- package/src/components/backlink/BackLink.tsx +0 -2
- package/src/components/breadcrumbs/Breadcrumbs.tsx +67 -107
- package/src/components/button/Button.tsx +0 -2
- package/src/components/card/Card.tsx +0 -2
- package/src/components/checkbox/Checkbox.tsx +0 -2
- package/src/components/datepicker/Datepicker.tsx +4 -4
- package/src/components/footer/Footer.tsx +9 -11
- package/src/components/footerSimple/FooterSimple.tsx +13 -18
- package/src/components/header/Header.tsx +0 -2
- package/src/components/icon/Icon.tsx +0 -2
- package/src/components/icon/IconContext.tsx +4 -6
- package/src/components/input/Input.tsx +0 -2
- package/src/components/inputwrapper/InputWrapper.tsx +0 -2
- package/src/components/link/Link.tsx +0 -2
- package/src/components/linkcard/LinkCard.tsx +1 -3
- package/src/components/loader/Loader.tsx +0 -2
- package/src/components/preview/Preview.tsx +0 -2
- package/src/components/preview/PreviewSpecs.tsx +2 -2
- package/src/components/progressbar/Progressbar.tsx +0 -2
- package/src/components/radio/RadioButton.tsx +0 -2
- package/src/components/searchinput/SearchInput.tsx +22 -6
- package/src/components/select/Select.tsx +0 -2
- package/src/components/stepper/Step.tsx +0 -2
- package/src/components/stepper/Stepper.tsx +0 -2
- package/src/components/table/Table.tsx +0 -2
- package/src/components/table/TableBody.tsx +0 -2
- package/src/components/table/TableData.tsx +0 -2
- package/src/components/table/TableDataCell.tsx +0 -2
- package/src/components/table/TableHeader.tsx +0 -2
- package/src/components/table/TableHeaderCell.tsx +0 -2
- package/src/components/table/TableRow.tsx +0 -2
- package/src/components/tabs/Tabs.tsx +0 -2
- package/src/components/textarea/Textarea.tsx +0 -2
- package/src/components/textinput/Textinput.tsx +1 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.8",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@oslokommune/punkt-assets": "^12.1.0",
|
|
46
46
|
"@oslokommune/punkt-css": "^12.3.4",
|
|
47
|
-
"@oslokommune/punkt-elements": "^12.3.
|
|
47
|
+
"@oslokommune/punkt-elements": "^12.3.8",
|
|
48
48
|
"@testing-library/jest-dom": "^6.5.0",
|
|
49
49
|
"@testing-library/react": "^16.0.1",
|
|
50
50
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
103
103
|
},
|
|
104
104
|
"license": "MIT",
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "be4a7ca19fb67b079fe05d9901f891a10ebd02d4"
|
|
106
106
|
}
|
|
@@ -1,116 +1,76 @@
|
|
|
1
|
-
|
|
1
|
+
import React, { ForwardedRef, forwardRef } from 'react'
|
|
2
|
+
import { Link } from 'react-router-dom'
|
|
2
3
|
|
|
3
|
-
import
|
|
4
|
-
import { Link } from 'react-router-dom';
|
|
5
|
-
|
|
6
|
-
import PktIcon from '../icon/Icon'; // Import your Icon component
|
|
4
|
+
import PktIcon from '../icon/Icon' // Import your Icon component
|
|
7
5
|
|
|
8
6
|
export interface IBreadcrumbs {
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
text: string
|
|
8
|
+
href: string
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
export interface IPktBreadcrumbs extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
breadcrumbs: IBreadcrumbs[]
|
|
13
|
+
navigationType?: 'router' | 'anchor'
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
|
|
19
16
|
export const PktBreadcrumbs = forwardRef(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</li>
|
|
81
|
-
))}
|
|
82
|
-
</ol>
|
|
83
|
-
|
|
84
|
-
{
|
|
85
|
-
navigationType === 'router' ? (
|
|
86
|
-
<Link
|
|
87
|
-
to={backLink.href}
|
|
88
|
-
className="pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile"
|
|
89
|
-
{...props}
|
|
90
|
-
>
|
|
91
|
-
<PktIcon
|
|
92
|
-
className="pkt-back-link__icon pkt-icon pkt-link__icon"
|
|
93
|
-
name="chevron-thin-left"
|
|
94
|
-
/>
|
|
95
|
-
<span className="pkt-breadcrumbs__text">{backLink.text}</span>
|
|
96
|
-
</Link>
|
|
97
|
-
) : (
|
|
98
|
-
<a
|
|
99
|
-
href={backLink.href}
|
|
100
|
-
className="pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile"
|
|
101
|
-
{...props}
|
|
102
|
-
>
|
|
103
|
-
<PktIcon
|
|
104
|
-
className="pkt-back-link__icon pkt-icon pkt-link__icon"
|
|
105
|
-
name="chevron-thin-left"
|
|
106
|
-
/>
|
|
107
|
-
<span className="pkt-breadcrumbs__text">{backLink.text}</span>
|
|
108
|
-
</a>
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
</nav>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
export default PktBreadcrumbs;
|
|
17
|
+
({ breadcrumbs, navigationType, className, ...props }: IPktBreadcrumbs, ref: ForwardedRef<HTMLAnchorElement>) => {
|
|
18
|
+
// Slice the breadcrumb to maximum links
|
|
19
|
+
const slicedBreadcrumbs = breadcrumbs.slice(0, 4)
|
|
20
|
+
// Define the backLink function
|
|
21
|
+
const backLink = slicedBreadcrumbs[slicedBreadcrumbs.length - 2]
|
|
22
|
+
|
|
23
|
+
// Define the classes
|
|
24
|
+
const classes = [className, 'pkt-breadcrumbs'].filter(Boolean).join(' ')
|
|
25
|
+
|
|
26
|
+
// If navigationType is router, then use react-router Link, else use anchor tag
|
|
27
|
+
// Mobile and desktop have different markup
|
|
28
|
+
return (
|
|
29
|
+
<nav ref={ref} aria-label="brødsmulemeny" className={classes}>
|
|
30
|
+
<ol className="pkt-breadcrumbs__list pkt-breadcrumbs--desktop">
|
|
31
|
+
{slicedBreadcrumbs.map((item, index) => (
|
|
32
|
+
<li key={`breadcrumb-${index}`} className="pkt-breadcrumbs__item">
|
|
33
|
+
{index === slicedBreadcrumbs.length - 1 ? (
|
|
34
|
+
<span className="pkt-breadcrumbs__label" aria-current="true">
|
|
35
|
+
<span className="pkt-breadcrumbs__text">{item.text}</span>
|
|
36
|
+
</span>
|
|
37
|
+
) : navigationType === 'router' ? (
|
|
38
|
+
<Link
|
|
39
|
+
to={item.href}
|
|
40
|
+
className="pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link"
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
<PktIcon className="pkt-icon pkt-breadcrumbs__icon pkt-link__icon" name="chevron-thin-right" />
|
|
44
|
+
<span className="pkt-breadcrumbs__text">{item.text}</span>
|
|
45
|
+
</Link>
|
|
46
|
+
) : (
|
|
47
|
+
<a
|
|
48
|
+
href={item.href}
|
|
49
|
+
className="pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link"
|
|
50
|
+
{...props}
|
|
51
|
+
>
|
|
52
|
+
<PktIcon className="pkt-icon pkt-breadcrumbs__icon pkt-link__icon" name="chevron-thin-right" />
|
|
53
|
+
<span className="pkt-breadcrumbs__text">{item.text}</span>
|
|
54
|
+
</a>
|
|
55
|
+
)}
|
|
56
|
+
</li>
|
|
57
|
+
))}
|
|
58
|
+
</ol>
|
|
59
|
+
|
|
60
|
+
{navigationType === 'router' ? (
|
|
61
|
+
<Link to={backLink.href} className="pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile" {...props}>
|
|
62
|
+
<PktIcon className="pkt-back-link__icon pkt-icon pkt-link__icon" name="chevron-thin-left" />
|
|
63
|
+
<span className="pkt-breadcrumbs__text">{backLink.text}</span>
|
|
64
|
+
</Link>
|
|
65
|
+
) : (
|
|
66
|
+
<a href={backLink.href} className="pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile" {...props}>
|
|
67
|
+
<PktIcon className="pkt-back-link__icon pkt-icon pkt-link__icon" name="chevron-thin-left" />
|
|
68
|
+
<span className="pkt-breadcrumbs__text">{backLink.text}</span>
|
|
69
|
+
</a>
|
|
70
|
+
)}
|
|
71
|
+
</nav>
|
|
72
|
+
)
|
|
73
|
+
},
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
export default PktBreadcrumbs
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { FC, LegacyRef } from 'react'
|
|
2
2
|
import { createComponent, EventName } from '@lit/react'
|
|
3
3
|
import { PktDatepicker as PktEl } from '@oslokommune/punkt-elements'
|
|
4
|
-
import type { PktElType, PktElConstructor } from '@/interfaces/IPktElements'
|
|
4
|
+
import type { PktElType, PktElConstructor, PktEventWithTarget } from '@/interfaces/IPktElements'
|
|
5
5
|
|
|
6
6
|
interface IPktDatepicker extends PktElType {
|
|
7
7
|
value?: string | string[]
|
|
@@ -15,7 +15,7 @@ interface IPktDatepicker extends PktElType {
|
|
|
15
15
|
range?: boolean
|
|
16
16
|
weeknumbers?: boolean
|
|
17
17
|
withcontrols?: boolean
|
|
18
|
-
|
|
18
|
+
fullwidth?: boolean
|
|
19
19
|
min?: string | number | undefined
|
|
20
20
|
max?: string | number | undefined
|
|
21
21
|
excludedates?: string[]
|
|
@@ -35,7 +35,7 @@ interface IPktDatepicker extends PktElType {
|
|
|
35
35
|
strings?: any
|
|
36
36
|
className?: string
|
|
37
37
|
ref?: LegacyRef<HTMLElement>
|
|
38
|
-
onChange?: (e:
|
|
38
|
+
onChange?: (e: PktEventWithTarget) => void
|
|
39
39
|
onValueChange?: (e: CustomEvent) => void
|
|
40
40
|
onToggleHelpText?: (e: CustomEvent) => void
|
|
41
41
|
}
|
|
@@ -46,7 +46,7 @@ export const PktDatepicker: FC<IPktDatepicker> = createComponent({
|
|
|
46
46
|
react: React,
|
|
47
47
|
displayName: 'PktDatepicker',
|
|
48
48
|
events: {
|
|
49
|
-
onChange: 'change' as EventName<
|
|
49
|
+
onChange: 'change' as EventName<PktEventWithTarget>,
|
|
50
50
|
onValueChange: 'value-change' as EventName<CustomEvent>,
|
|
51
51
|
onToggleHelpText: 'toggleHelpText' as EventName<CustomEvent>,
|
|
52
52
|
},
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
1
|
import React from 'react'
|
|
4
2
|
|
|
5
3
|
import { PktIcon } from '../icon/Icon'
|
|
@@ -32,7 +30,13 @@ export interface IPktFooter extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
32
30
|
tilgjengelighetLink?: string
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
export const PktFooter: React.FC<IPktFooter> = ({
|
|
33
|
+
export const PktFooter: React.FC<IPktFooter> = ({
|
|
34
|
+
columnOne,
|
|
35
|
+
columnTwo,
|
|
36
|
+
socialLinks,
|
|
37
|
+
className,
|
|
38
|
+
personvernOgInfoLink = 'https://www.oslo.kommune.no/personvern-og-informasjonskapsler/',
|
|
39
|
+
tilgjengelighetLink = 'https://www.oslo.kommune.no/tilgjengelighet/',
|
|
36
40
|
}) => {
|
|
37
41
|
const classNames = [className, 'pkt-footer'].filter(Boolean).join(' ')
|
|
38
42
|
return (
|
|
@@ -81,10 +85,7 @@ export const PktFooter: React.FC<IPktFooter> = ({ columnOne, columnTwo, socialLi
|
|
|
81
85
|
<h2 className="pkt-footer__title">Om nettstedet</h2>
|
|
82
86
|
<ul className="pkt-footer__list">
|
|
83
87
|
<li className="pkt-footer__list-item">
|
|
84
|
-
<a
|
|
85
|
-
className="pkt-footer__link"
|
|
86
|
-
href={personvernOgInfoLink}
|
|
87
|
-
>
|
|
88
|
+
<a className="pkt-footer__link" href={personvernOgInfoLink}>
|
|
88
89
|
<PktIcon className="pkt-footer__link-icon" name="chevron-right" />
|
|
89
90
|
Personvern og informasjonskapsler
|
|
90
91
|
</a>
|
|
@@ -104,10 +105,7 @@ export const PktFooter: React.FC<IPktFooter> = ({ columnOne, columnTwo, socialLi
|
|
|
104
105
|
{socialLinks
|
|
105
106
|
.filter((link) => link.language)
|
|
106
107
|
.map((link, index) => (
|
|
107
|
-
<div
|
|
108
|
-
key={`sociallinks-language-${index}`}
|
|
109
|
-
className="pkt-footer__social-language"
|
|
110
|
-
>
|
|
108
|
+
<div key={`sociallinks-language-${index}`} className="pkt-footer__social-language">
|
|
111
109
|
<a
|
|
112
110
|
href={link.href}
|
|
113
111
|
aria-label={`til ${link.language} versjon av nettsiden`}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { PktIcon } from '../icon/Icon';
|
|
3
|
+
import { PktIcon } from '../icon/Icon'
|
|
6
4
|
|
|
7
5
|
export interface IPktFooterSimple extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
6
|
links?: Array<{
|
|
9
|
-
href: string
|
|
10
|
-
text: string
|
|
11
|
-
external?: boolean
|
|
12
|
-
openInNewTab?: boolean
|
|
13
|
-
}
|
|
7
|
+
href: string
|
|
8
|
+
text: string
|
|
9
|
+
external?: boolean
|
|
10
|
+
openInNewTab?: boolean
|
|
11
|
+
}>
|
|
14
12
|
personvernOgInfoLink?: string
|
|
15
13
|
tilgjengelighetLink?: string
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
export const PktFooterSimple: React.FC<IPktFooterSimple> = ({
|
|
19
17
|
links = [],
|
|
20
|
-
personvernOgInfoLink =
|
|
21
|
-
tilgjengelighetLink =
|
|
22
|
-
className
|
|
18
|
+
personvernOgInfoLink = 'https://www.oslo.kommune.no/personvern-og-informasjonskapsler/',
|
|
19
|
+
tilgjengelighetLink = 'https://www.oslo.kommune.no/tilgjengelighet/',
|
|
20
|
+
className,
|
|
23
21
|
}) => {
|
|
24
22
|
const classNames = [className, 'pkt-footer-simple'].filter(Boolean).join(' ')
|
|
25
23
|
return (
|
|
@@ -34,10 +32,7 @@ export const PktFooterSimple: React.FC<IPktFooterSimple> = ({
|
|
|
34
32
|
target={link.openInNewTab ? '_blank' : '_self'}
|
|
35
33
|
rel={link.openInNewTab ? 'noopener noreferrer' : undefined}
|
|
36
34
|
>
|
|
37
|
-
<PktIcon
|
|
38
|
-
className="pkt-footer-simple__link-icon"
|
|
39
|
-
name="chevron-right"
|
|
40
|
-
/>
|
|
35
|
+
<PktIcon className="pkt-footer-simple__link-icon" name="chevron-right" />
|
|
41
36
|
{link.text}
|
|
42
37
|
</a>
|
|
43
38
|
</li>
|
|
@@ -57,5 +52,5 @@ export const PktFooterSimple: React.FC<IPktFooterSimple> = ({
|
|
|
57
52
|
</ul>
|
|
58
53
|
</div>
|
|
59
54
|
</footer>
|
|
60
|
-
)
|
|
61
|
-
}
|
|
55
|
+
)
|
|
56
|
+
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { createContext } from 'react'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import defaultIconFetcher from "./DefaultIconFetcher";
|
|
3
|
+
import defaultIconFetcher from './DefaultIconFetcher'
|
|
6
4
|
|
|
7
5
|
export type IconFetcher = {
|
|
8
6
|
fetchIcon: (name: string, path: string | undefined) => Promise<string | null>
|
|
9
|
-
}
|
|
7
|
+
}
|
|
10
8
|
|
|
11
|
-
export const PktIconContext = createContext<IconFetcher>(defaultIconFetcher)
|
|
9
|
+
export const PktIconContext = createContext<IconFetcher>(defaultIconFetcher)
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
1
|
import React, { ForwardedRef, forwardRef } from 'react'
|
|
4
2
|
|
|
5
3
|
import { PktIcon } from '../icon/Icon'
|
|
6
4
|
|
|
7
5
|
export interface IPktLinkCard extends React.HTMLAttributes<HTMLAnchorElement> {
|
|
8
|
-
skin?: 'normal' | 'blue' | 'beige' | 'beige-outline' | 'green' | 'grey' | 'gray' | 'grey-outline'| 'gray-outline'
|
|
6
|
+
skin?: 'normal' | 'blue' | 'beige' | 'beige-outline' | 'green' | 'grey' | 'gray' | 'grey-outline' | 'gray-outline'
|
|
9
7
|
title?: string
|
|
10
8
|
href?: string
|
|
11
9
|
iconName?: string
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
1
|
import React from 'react'
|
|
4
2
|
import { PktTable } from '../table/Table'
|
|
5
3
|
import { PktTableHeader } from '../table/TableHeader'
|
|
@@ -97,6 +95,7 @@ export const PktPreviewSpecs: React.FC<{ specs: ISpecObject }> = ({ specs }) =>
|
|
|
97
95
|
<PktTableRow>
|
|
98
96
|
<PktTableHeaderCell>Event</PktTableHeaderCell>
|
|
99
97
|
<PktTableHeaderCell>Beskrivelse</PktTableHeaderCell>
|
|
98
|
+
<PktTableHeaderCell>Type</PktTableHeaderCell>
|
|
100
99
|
</PktTableRow>
|
|
101
100
|
</PktTableHeader>
|
|
102
101
|
<PktTableBody>
|
|
@@ -108,6 +107,7 @@ export const PktPreviewSpecs: React.FC<{ specs: ISpecObject }> = ({ specs }) =>
|
|
|
108
107
|
<PktTableDataCell dataLabel="Beskrivelse">
|
|
109
108
|
<span dangerouslySetInnerHTML={{ __html: value.description || '' }}></span>
|
|
110
109
|
</PktTableDataCell>
|
|
110
|
+
<PktTableDataCell dataLabel="Type">{value.type}</PktTableDataCell>
|
|
111
111
|
</PktTableRow>
|
|
112
112
|
))}
|
|
113
113
|
</PktTableBody>
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import React, { forwardRef, HTMLProps, ReactNode } from 'react'
|
|
1
|
+
import React, { ChangeEvent, forwardRef, HTMLProps, ReactNode } from 'react'
|
|
4
2
|
|
|
5
3
|
import { PktButton } from '../button/Button'
|
|
6
4
|
|
|
@@ -66,6 +64,10 @@ export const PktSearchInput = forwardRef<HTMLInputElement, ISearchInput | ISearc
|
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
|
|
67
|
+
const handleNoOnChange = (e: ChangeEvent<HTMLInputElement>) => {
|
|
68
|
+
value = e.target.value
|
|
69
|
+
}
|
|
70
|
+
|
|
69
71
|
const wrapperClass = `pkt-searchinput pkt-searchinput--${appearance} ${
|
|
70
72
|
fullwidth ? 'pkt-searchinput--fullwidth' : ''
|
|
71
73
|
}`
|
|
@@ -103,7 +105,7 @@ export const PktSearchInput = forwardRef<HTMLInputElement, ISearchInput | ISearc
|
|
|
103
105
|
aria-autocomplete="list"
|
|
104
106
|
ref={ref}
|
|
105
107
|
aria-controls={`${id}-suggestions`}
|
|
106
|
-
onChange={onChange}
|
|
108
|
+
onChange={onChange ? onChange : handleNoOnChange}
|
|
107
109
|
{...props}
|
|
108
110
|
/>
|
|
109
111
|
<PktButton
|
|
@@ -114,8 +116,22 @@ export const PktSearchInput = forwardRef<HTMLInputElement, ISearchInput | ISearc
|
|
|
114
116
|
color={appearance === 'global' ? 'yellow' : undefined}
|
|
115
117
|
type="submit"
|
|
116
118
|
disabled={disabled}
|
|
117
|
-
onClick={
|
|
118
|
-
|
|
119
|
+
onClick={
|
|
120
|
+
onSearch &&
|
|
121
|
+
((event) => {
|
|
122
|
+
event.preventDefault()
|
|
123
|
+
onSearch(value)
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
onKeyUp={
|
|
127
|
+
onSearch &&
|
|
128
|
+
((event) => {
|
|
129
|
+
if (event.key === 'Enter') {
|
|
130
|
+
event.preventDefault()
|
|
131
|
+
onSearch(value)
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
}
|
|
119
135
|
>
|
|
120
136
|
{label || placeholder}
|
|
121
137
|
</PktButton>
|