@oslokommune/punkt-react 16.6.2 → 16.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/CHANGELOG.md +18 -0
- package/dist/index.d.ts +86 -0
- package/dist/punkt-react.es.js +6526 -5239
- package/dist/punkt-react.umd.js +542 -355
- package/package.json +4 -4
- package/src/components/index.ts +1 -0
- package/src/components/interfaces.ts +1 -0
- package/src/components/timepicker/Timepicker.test.tsx +336 -0
- package/src/components/timepicker/Timepicker.tsx +244 -0
- package/src/components/timepicker/types.ts +118 -0
- package/src/components/timepicker/useTimepickerState.ts +843 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [16.7.0](https://github.com/oslokommune/punkt/compare/16.6.2...16.7.0) (2026-04-10)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
* Ny komponent: PktTimepicker (#3380).
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
Ingen
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
Ingen
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
|
|
8
26
|
## [16.6.2](https://github.com/oslokommune/punkt/compare/16.6.1...16.6.2) (2026-04-10)
|
|
9
27
|
|
|
10
28
|
### ⚠ BREAKING CHANGES
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ChangeEvent } from 'react';
|
|
|
5
5
|
import { ChangeEventHandler } from 'react';
|
|
6
6
|
import { CSSProperties } from 'react';
|
|
7
7
|
import { FC } from 'react';
|
|
8
|
+
import { FocusEvent as FocusEvent_2 } from 'react';
|
|
8
9
|
import { ForwardRefExoticComponent } from 'react';
|
|
9
10
|
import { HTMLAttributes } from 'react';
|
|
10
11
|
import { HTMLProps } from 'react';
|
|
@@ -14,6 +15,7 @@ import { IPktComboboxOption } from '../../../../../shared-types/combobox';
|
|
|
14
15
|
import { IPktConsent as IPktConsent_2 } from '@oslokommune/punkt-elements';
|
|
15
16
|
import { IPktHeading as IPktHeading_2 } from '@oslokommune/punkt-elements';
|
|
16
17
|
import { IPktLoader as IPktLoader_2 } from '@oslokommune/punkt-elements';
|
|
18
|
+
import { ITimepickerStrings } from '../../../../../shared-types/timepicker';
|
|
17
19
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
18
20
|
import { LegacyRef } from 'react';
|
|
19
21
|
import { LinkHTMLAttributes } from 'react';
|
|
@@ -850,6 +852,88 @@ export declare interface IPktTextinput extends InputHTMLAttributes<HTMLInputElem
|
|
|
850
852
|
skipForwardTestid?: boolean;
|
|
851
853
|
}
|
|
852
854
|
|
|
855
|
+
/**
|
|
856
|
+
* Props for {@link PktTimepicker}: a React time picker with `HH:MM`, aligned with Elements `pkt-timepicker`.
|
|
857
|
+
*
|
|
858
|
+
* The value is submitted via a hidden `input type="time"`; hour/minute fields are the editing UI. Use `value`
|
|
859
|
+
* or `defaultValue` for controlled vs. uncontrolled mode.
|
|
860
|
+
*/
|
|
861
|
+
export declare interface IPktTimepicker extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'min' | 'max' | 'step' | 'onFocus' | 'onBlur'> {
|
|
862
|
+
/** Unique id; used for hour, minute, popup, and hidden input ids. */
|
|
863
|
+
id: string;
|
|
864
|
+
/** Visible label (InputWrapper). */
|
|
865
|
+
label: string;
|
|
866
|
+
/** Controlled value (`HH:MM`). */
|
|
867
|
+
value?: string;
|
|
868
|
+
/** Initial value when the component is uncontrolled. */
|
|
869
|
+
defaultValue?: string;
|
|
870
|
+
/**
|
|
871
|
+
* Earliest valid time (`HH:MM`). May be a number or string (HTML attribute / RHF).
|
|
872
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time}
|
|
873
|
+
*/
|
|
874
|
+
min?: string | number;
|
|
875
|
+
/**
|
|
876
|
+
* Latest valid time (`HH:MM`). May be a number or string (HTML attribute / RHF).
|
|
877
|
+
*/
|
|
878
|
+
max?: string | number;
|
|
879
|
+
/**
|
|
880
|
+
* Step in **seconds** (e.g. `60` = 1 min, `300` = 5 min). Must be a valid multiple (same rules as Elements).
|
|
881
|
+
* @default 60
|
|
882
|
+
*/
|
|
883
|
+
step?: number;
|
|
884
|
+
/** Hides the clock button and popup; shows a static clock icon. */
|
|
885
|
+
hidePicker?: boolean;
|
|
886
|
+
/** Shows previous/next step buttons instead of the popup. */
|
|
887
|
+
stepArrows?: boolean;
|
|
888
|
+
/** Full width (`pkt-timepicker--fullwidth`). */
|
|
889
|
+
fullwidth?: boolean;
|
|
890
|
+
/** Form field name on the hidden `input`; falls back to `id` if omitted. */
|
|
891
|
+
name?: string;
|
|
892
|
+
/** Help text above the field. */
|
|
893
|
+
helptext?: string | ReactNode;
|
|
894
|
+
/** Expandable help text (dropdown). */
|
|
895
|
+
helptextDropdown?: string | ReactNode;
|
|
896
|
+
/** Button label for expandable help text. */
|
|
897
|
+
helptextDropdownButton?: string;
|
|
898
|
+
/** Forces error state on the wrapper. */
|
|
899
|
+
hasError?: boolean;
|
|
900
|
+
/** Error message below the field. */
|
|
901
|
+
errorMessage?: string | ReactNode;
|
|
902
|
+
/** Shows an "optional" tag. */
|
|
903
|
+
optionalTag?: boolean;
|
|
904
|
+
/** Label text for the optional tag. */
|
|
905
|
+
optionalText?: string;
|
|
906
|
+
/** Shows a "required" tag. */
|
|
907
|
+
requiredTag?: boolean;
|
|
908
|
+
/** Label text for the required tag. */
|
|
909
|
+
requiredText?: string;
|
|
910
|
+
/** Extra tag next to the label. */
|
|
911
|
+
tagText?: string | null;
|
|
912
|
+
/** Inline layout in InputWrapper. */
|
|
913
|
+
inline?: boolean;
|
|
914
|
+
/** Show visible label and help text (`false` = screen-reader-only label). */
|
|
915
|
+
useWrapper?: boolean;
|
|
916
|
+
/** Passed through to InputWrapper as `aria-describedby`. */
|
|
917
|
+
ariaDescribedby?: string;
|
|
918
|
+
/** Copy for hours, minutes, buttons, and popup. */
|
|
919
|
+
strings?: ITimepickerStrings;
|
|
920
|
+
/** Change event from the hidden input (`e.target.value` is `HH:MM`). */
|
|
921
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
922
|
+
/** Input events while typing or using spinners. */
|
|
923
|
+
onInput?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
924
|
+
/** Callback with the committed `HH:MM` string. */
|
|
925
|
+
onValueChange?: (value: string) => void;
|
|
926
|
+
/**
|
|
927
|
+
* Fires when focus enters this control from outside (not when moving only between hour and minute).
|
|
928
|
+
* Implemented on the root wrapper; spinbuttons must allow focus to bubble so this runs.
|
|
929
|
+
*/
|
|
930
|
+
onFocus?: (e: FocusEvent_2<Element>) => void;
|
|
931
|
+
/** Focus leaves the whole component. */
|
|
932
|
+
onBlur?: (e: FocusEvent_2<Element>) => void;
|
|
933
|
+
/** Extra class names on the root (`pkt-timepicker`). */
|
|
934
|
+
className?: string;
|
|
935
|
+
}
|
|
936
|
+
|
|
853
937
|
declare interface ISearch extends HTMLProps<HTMLInputElement> {
|
|
854
938
|
appearance?: 'local' | 'local-with-button' | 'global';
|
|
855
939
|
disabled?: boolean;
|
|
@@ -1051,6 +1135,8 @@ export declare const PktTextarea: ForwardRefExoticComponent<IPktTextarea & RefAt
|
|
|
1051
1135
|
|
|
1052
1136
|
export declare const PktTextinput: ForwardRefExoticComponent<IPktTextinput & RefAttributes<HTMLInputElement>>;
|
|
1053
1137
|
|
|
1138
|
+
export declare const PktTimepicker: ForwardRefExoticComponent<IPktTimepicker & RefAttributes<HTMLDivElement>>;
|
|
1139
|
+
|
|
1054
1140
|
/** Representing object for header components */
|
|
1055
1141
|
declare interface Representing {
|
|
1056
1142
|
name: string;
|