loon-bulma-react 2026.0.39 → 2026.0.41

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.
Files changed (150) hide show
  1. package/dist/components/DragDrop/DragDropList.d.ts +6 -4
  2. package/dist/forms/Select/Select.d.ts +1 -1
  3. package/dist/hooks/useClipboard.d.ts +3 -3
  4. package/dist/index.js +1257 -1249
  5. package/dist/internal_functions/createIconsInternal.d.ts +2 -1
  6. package/dist/lib/classes/Console.d.ts +29 -0
  7. package/dist/lib/classes/FetchWrapper.d.ts +124 -0
  8. package/dist/lib/components/AspectRatio/AspectRatio.d.ts +28 -0
  9. package/dist/lib/components/Block/Block.d.ts +9 -0
  10. package/dist/lib/components/Box/BorderBox.d.ts +29 -0
  11. package/dist/lib/components/Box/Box.d.ts +20 -0
  12. package/dist/lib/components/Button/Button.d.ts +87 -0
  13. package/dist/lib/components/ButtonGroup/ButtonGroup.d.ts +26 -0
  14. package/dist/lib/components/Calendar/CalendarItems/CalendarColoredItem.d.ts +18 -0
  15. package/dist/lib/components/Calendar/CalendarItems/CalendarItem.d.ts +18 -0
  16. package/dist/lib/components/Calendar/DayContainer.d.ts +25 -0
  17. package/dist/lib/components/Calendar/EventDescriptions.d.ts +33 -0
  18. package/dist/lib/components/Calendar/Fourweeks/FourweeksView.d.ts +23 -0
  19. package/dist/lib/components/Calendar/Mini/MiniView.d.ts +24 -0
  20. package/dist/lib/components/Calendar/Month/MonthView.d.ts +23 -0
  21. package/dist/lib/components/Calendar/Planning/PlanningView.d.ts +41 -0
  22. package/dist/lib/components/Calendar/Props.d.ts +58 -0
  23. package/dist/lib/components/Calendar/Week/AlldayContainer.d.ts +19 -0
  24. package/dist/lib/components/Calendar/Week/HourRow.d.ts +30 -0
  25. package/dist/lib/components/Calendar/Week/WeekView.d.ts +24 -0
  26. package/dist/lib/components/Calendar/calendar.functions.d.ts +10 -0
  27. package/dist/lib/components/Calendar/index.d.ts +15 -0
  28. package/dist/lib/components/CodeBlock/CodeBlock.d.ts +49 -0
  29. package/dist/lib/components/Columns/Column.d.ts +207 -0
  30. package/dist/lib/components/Columns/Columns.d.ts +35 -0
  31. package/dist/lib/components/Container/Container.d.ts +45 -0
  32. package/dist/lib/components/Content/Content.d.ts +22 -0
  33. package/dist/lib/components/DataTable/DataTable.d.ts +227 -0
  34. package/dist/lib/components/DataTable/DataTableDropdown.d.ts +39 -0
  35. package/dist/lib/components/Divider/Divider.d.ts +23 -0
  36. package/dist/lib/components/DragDrop/DragDropList.d.ts +97 -0
  37. package/dist/lib/components/Dropdown/Dropdown.d.ts +42 -0
  38. package/dist/lib/components/Footer/Footer.d.ts +22 -0
  39. package/dist/lib/components/Help/Help.d.ts +19 -0
  40. package/dist/lib/components/Hero/Hero.d.ts +104 -0
  41. package/dist/lib/components/Icon/Icon.d.ts +84 -0
  42. package/dist/lib/components/Image/Image.d.ts +28 -0
  43. package/dist/lib/components/Indicator/Indicator.d.ts +25 -0
  44. package/dist/lib/components/Kbd/Kbd.d.ts +30 -0
  45. package/dist/lib/components/Label/Label.d.ts +11 -0
  46. package/dist/lib/components/Link/Link.d.ts +44 -0
  47. package/dist/lib/components/Menu/Menu.d.ts +64 -0
  48. package/dist/lib/components/Message/Message.d.ts +49 -0
  49. package/dist/lib/components/Modal/Modal.d.ts +89 -0
  50. package/dist/lib/components/Notification/Notification.d.ts +38 -0
  51. package/dist/lib/components/Pagination/Pagination.d.ts +58 -0
  52. package/dist/lib/components/Panel/Panel.d.ts +99 -0
  53. package/dist/lib/components/ProgressBar/ProgressBar.d.ts +28 -0
  54. package/dist/lib/components/QuickView/QuickView.d.ts +61 -0
  55. package/dist/lib/components/ScrollArea/ScrollArea.d.ts +76 -0
  56. package/dist/lib/components/Section/Section.d.ts +21 -0
  57. package/dist/lib/components/SimpleTable/SimpleTable.d.ts +130 -0
  58. package/dist/lib/components/Steps/Steps.d.ts +61 -0
  59. package/dist/lib/components/TabBar/TabBar.d.ts +47 -0
  60. package/dist/lib/components/Tag/Tag.d.ts +54 -0
  61. package/dist/lib/components/TimeLine/TimeLine.d.ts +62 -0
  62. package/dist/lib/components/Titles/Titles.d.ts +71 -0
  63. package/dist/lib/components/ToggleBar/ToggleBar.d.ts +80 -0
  64. package/dist/lib/components/Tooltip/Tooltip.d.ts +50 -0
  65. package/dist/lib/components/TreeView/TreeView.d.ts +185 -0
  66. package/dist/lib/contexts/ActionSheet/ActionSheetContextProvider.d.ts +76 -0
  67. package/dist/lib/contexts/AppProvider/AppProviders.d.ts +17 -0
  68. package/dist/lib/contexts/ColorSchemeProvider/ColorSchemeProvider.d.ts +15 -0
  69. package/dist/lib/contexts/Confirm/ConfirmContextProvider.d.ts +60 -0
  70. package/dist/lib/contexts/DefaultsProvider/DefaultsProvider.d.ts +100 -0
  71. package/dist/lib/contexts/DialogsProvider/DialogsProvider.d.ts +4 -0
  72. package/dist/lib/contexts/KeysProvider/KeysProvider.d.ts +52 -0
  73. package/dist/lib/contexts/ModalProvider/ModalProvider.d.ts +11 -0
  74. package/dist/lib/contexts/ModeProvider/ModeProvider.d.ts +16 -0
  75. package/dist/lib/contexts/Notifier/Notifier.d.ts +81 -0
  76. package/dist/lib/contexts/Prompt/PromptContextProvider.d.ts +71 -0
  77. package/dist/lib/forms/Checkbox/Checkbox.d.ts +48 -0
  78. package/dist/lib/forms/ComboBox/ComboBox.d.ts +44 -0
  79. package/dist/lib/forms/ComboBox/MultiComboBox.d.ts +44 -0
  80. package/dist/lib/forms/ComboBox/useComboBoxScroll.d.ts +4 -0
  81. package/dist/lib/forms/Currency/CurrencyInput.d.ts +50 -0
  82. package/dist/lib/forms/Datetimes/DateInput.d.ts +37 -0
  83. package/dist/lib/forms/Datetimes/DateTimeInput.d.ts +44 -0
  84. package/dist/lib/forms/Datetimes/TimeInput.d.ts +42 -0
  85. package/dist/lib/forms/File/FileInput.d.ts +71 -0
  86. package/dist/lib/forms/Input.d.ts +248 -0
  87. package/dist/lib/forms/MaskedInput/IBANInput.d.ts +95 -0
  88. package/dist/lib/forms/MaskedInput/MaskedInput.d.ts +46 -0
  89. package/dist/lib/forms/Numeric/NumberInput.d.ts +16 -0
  90. package/dist/lib/forms/Numeric/RangeInput.d.ts +21 -0
  91. package/dist/lib/forms/Others/ColorInput.d.ts +56 -0
  92. package/dist/lib/forms/Others/HiddenInput.d.ts +29 -0
  93. package/dist/lib/forms/Others/TelephoneInput.d.ts +14 -0
  94. package/dist/lib/forms/Others/URLInput.d.ts +14 -0
  95. package/dist/lib/forms/Periodes/MonthInput.d.ts +43 -0
  96. package/dist/lib/forms/Periodes/WeekInput.d.ts +43 -0
  97. package/dist/lib/forms/Radio/Radio.d.ts +97 -0
  98. package/dist/lib/forms/Select/Select.d.ts +136 -0
  99. package/dist/lib/forms/TagsInput/TagsInput.d.ts +44 -0
  100. package/dist/lib/forms/Text/EmailInput.d.ts +14 -0
  101. package/dist/lib/forms/Text/FormattedInput.d.ts +54 -0
  102. package/dist/lib/forms/Text/PasswordInput.d.ts +19 -0
  103. package/dist/lib/forms/Text/TextArea.d.ts +31 -0
  104. package/dist/lib/forms/Text/TextEditor.d.ts +36 -0
  105. package/dist/lib/forms/Text/TextInput.d.ts +30 -0
  106. package/dist/lib/hooks/useCaretPosition.d.ts +8 -0
  107. package/dist/lib/hooks/useClickOutside.d.ts +15 -0
  108. package/dist/lib/hooks/useClipboard.d.ts +21 -0
  109. package/dist/lib/hooks/useContextMenu.d.ts +29 -0
  110. package/dist/lib/hooks/useCookieState.d.ts +37 -0
  111. package/dist/lib/hooks/useDebounced.hooks.d.ts +85 -0
  112. package/dist/lib/hooks/useFetchApi.d.ts +65 -0
  113. package/dist/lib/hooks/useHotkeys.d.ts +96 -0
  114. package/dist/lib/hooks/useIndexedDb.d.ts +90 -0
  115. package/dist/lib/hooks/useLocalStoredState.d.ts +36 -0
  116. package/dist/lib/hooks/useMediaQuery.d.ts +154 -0
  117. package/dist/lib/hooks/usePagination.d.ts +25 -0
  118. package/dist/lib/hooks/usePropState.d.ts +16 -0
  119. package/dist/lib/hooks/useScrollIntoView.d.ts +59 -0
  120. package/dist/lib/hooks/useSessionStoredState.d.ts +38 -0
  121. package/dist/lib/hooks/useThrottle.hooks.d.ts +99 -0
  122. package/dist/lib/hooks/useToggle.d.ts +16 -0
  123. package/dist/lib/hooks/useUncontrolled.d.ts +44 -0
  124. package/dist/lib/hooks/useValidatedState.d.ts +21 -0
  125. package/dist/lib/index.d.ts +174 -0
  126. package/dist/lib/internal_functions/createIconsInternal.d.ts +36 -0
  127. package/dist/lib/internal_functions/getAlignmentClass.d.ts +16 -0
  128. package/dist/lib/internal_functions/getColorClass.d.ts +23 -0
  129. package/dist/lib/internal_functions/getPositionClass.d.ts +2 -0
  130. package/dist/lib/internal_functions/getSizeClass.d.ts +23 -0
  131. package/dist/lib/internal_functions/index.d.ts +8 -0
  132. package/dist/lib/shims/useSyncExternalStoreShim.d.ts +1 -0
  133. package/dist/lib/shims/useSyncExternalStoreWithSelector.d.ts +5 -0
  134. package/dist/lib/test-data.d.ts +9 -0
  135. package/dist/lib/types/index.d.ts +104 -0
  136. package/dist/lib/utils/BSN.functions.d.ts +57 -0
  137. package/dist/lib/utils/IBAN.functions.d.ts +138 -0
  138. package/dist/lib/utils/JSDateTime.class.d.ts +512 -0
  139. package/dist/lib/utils/JSDuration.class.d.ts +184 -0
  140. package/dist/lib/utils/colors.d.ts +54 -0
  141. package/dist/lib/utils/compare.d.ts +7 -0
  142. package/dist/lib/utils/deserialize.function.d.ts +2 -0
  143. package/dist/lib/utils/flattenChildren.function.d.ts +49 -0
  144. package/dist/lib/utils/math.d.ts +22 -0
  145. package/dist/lib/utils/object.functions.d.ts +37 -0
  146. package/dist/lib/utils/operators.d.ts +195 -0
  147. package/dist/lib/utils/serialize.function.d.ts +2 -0
  148. package/dist/lib/utils/sorting.d.ts +34 -0
  149. package/dist/lib/utils/string.utils.d.ts +125 -0
  150. package/package.json +51 -51
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Debounce-hook voor een externe value (bijv. prop of state van elders).
3
+ * Neemt een externe waarde en retourneert een debounced versie ervan.
4
+ * Handig voor zware operaties zoals zoeken in een lijst, waarbij je de oorspronkelijke
5
+ * waarde nog steeds direct nodig hebt.
6
+ * @example
7
+ * const [value, setValue] = React.useState('');
8
+ * const [debouncedValue, cancel] = useDebouncedValue(value, { delay: 1000 });
9
+ * return <TextInput
10
+ * label="Typ hier om de debounced waarde te zien"
11
+ * value={value} // Directe toegang tot originele waarde
12
+ * onChange={setValue}
13
+ * />
14
+ * <p>Originele waarde: {value}</p>
15
+ * <p>Debounced waarde: {debouncedValue}</p>
16
+ * @description Belangrijkste verschillen met `useDebouncedState`:
17
+ * - Neemt externe waarde als input (geen eigen state management)
18
+ * - Geeft toegang tot zowel originele als debounced waarde
19
+ * - Bevat cancel-functie om pending updates te annuleren
20
+ * - Gebruikt voor controlled inputs waar je state elders beheert
21
+ * - Werkt met props, context, of andere state providers
22
+ * - Kortere standaard delay (300ms vs 500ms)
23
+ * @param valueParam de externe waarde die gedebounced moet worden
24
+ * @param options extra opties
25
+ * - leading: Direct updaten bij eerste wijziging (Default: false)
26
+ * - delay: Vertraging in ms voor het updaten van de debounced waarde (Default: 300ms)
27
+ * @returns [debouncedValue, cancelFunction] - de debounced waarde en een annuleer-functie
28
+ */
29
+ export declare function useDebouncedValue<T = unknown>(valueParam: T, options?: {
30
+ leading?: boolean;
31
+ delay?: number;
32
+ }): readonly [T, () => void];
33
+ /**
34
+ * Debounce-hook die zijn eigen interne state beheert.
35
+ * Creëert en beheert een debounced state waarde met bijbehorende setter functie.
36
+ * Handig voor formulieren waar je niet wilt dat elke toetsaanslag een re-render veroorzaakt.
37
+ * @param defaultValue de standaard waarde voor de debounced state
38
+ * @param options extra opties
39
+ * - `leading`: Direct updaten bij eerste wijziging (Default: false)
40
+ * - `delay`: Vertraging in ms voor het updaten van de debounced waarde (Default: 500ms)
41
+ * - `onDebouncedChange`: Callback die wordt aangeroepen bij wijzigingen van debounced waarde (niet bij initiële waarde) Wordt ook overgeslagen bij `setSilent`
42
+ * @returns [immediateValue, debouncedValue, setValue, setSilent] - directe waarde, debounced waarde, normale setter en stille setter
43
+ * - `immediateValue`: De directe waarde die onmiddellijk wordt bijgewerkt bij elke aanroep van `setValue`. (gebruik in input)
44
+ * - `debouncedValue`: De debounced waarde die wordt bijgewerkt na de opgegeven vertraging. (dat is dus de debounced waarde)
45
+ * - `setValue(newValue)`: Stelt zowel de directe als de debounced waarde in met een vertraging. (gebruik in formulieren)
46
+ * - `setSilent(newValue)`: Stelt zowel de directe als de debounced waarde onmiddellijk in zonder vertraging en zonder het aanroepen van de onDebouncedChange callback.
47
+ * @example
48
+ * const [immediateValue, debouncedValue, setValue, setSilent] = useDebouncedState('', {
49
+ * delay: 1000,
50
+ * onDebouncedChange: (value) => {
51
+ * // Dit wordt alleen aangeroepen bij echte wijzigingen, niet bij eerste render
52
+ * console.log('Debounced waarde veranderd naar:', value);
53
+ * searchAPI(value);
54
+ * }
55
+ * });
56
+ *
57
+ * // Voor gebruikersinput (triggert onChange)
58
+ * const handleUserInput = (e) => setValue(e.target.value);
59
+ *
60
+ * // Voor programmatische updates (triggert NIET de onDebouncedChange)
61
+ * const handleApiResponse = (data) => setSilent(data.defaultValue);
62
+ *
63
+ * return <TextInput
64
+ * label="Typ hier om de debounced state te zien"
65
+ * value={immediateValue} // Toon directe input voor responsive UI
66
+ * onChange={handleUserInput} // Direct de debounced setter gebruiken
67
+ * />
68
+ * <p>Je typt: {immediateValue}</p>
69
+ * <p>Debounced waarde: {debouncedValue}</p>
70
+ * @description Belangrijkste verschillen met `useDebouncedValue`:
71
+ * - Beheert eigen interne state (geen externe waarde nodig)
72
+ * - Geeft nu toegang tot zowel directe als debounced waarde
73
+ * - Geen cancel-functie beschikbaar
74
+ * - Gebruikt voor controlled inputs met directe feedback
75
+ * - Werkt alleen met interne useState, niet met externe state providers
76
+ * - Langere standaard delay (500ms vs 300ms)
77
+ * - Eenvoudigere API dan useDebouncedValue
78
+ * - Optionele onChange callback voor side-effects
79
+ * - setSilent functie voor programmatische updates zonder onChange
80
+ */
81
+ export declare function useDebouncedState<T = unknown>(defaultValue: T, options?: {
82
+ leading?: boolean;
83
+ delay?: number;
84
+ onDebouncedChange?: (value: T) => void;
85
+ }): readonly [T, T, (newValue: T) => void, (newValue: T) => void];
@@ -0,0 +1,65 @@
1
+ type LoonResponseType = '=OK' | `=${string}` | `*${string}` | string;
2
+ type FetchAPIWrapper = {
3
+ /** fetch-wrapper voor ophalen van een status of iets dergelijks. Resulteert in 2 mogelijkheden: `=...` voor een GOEDE afhandeling of `*...` voor een foute afhandeling. De puntjes bevatten dan een goed-code of fout-code
4
+ * @param url de url waarvandaan gefetched moet worden
5
+ * @throws een error met de status en statusText van de response
6
+ * @returns {`=${string}` | `*${string}`} promise met het resultaat `=...` of `*...`
7
+ */
8
+ ftch({ url, init }: {
9
+ url: string;
10
+ init?: RequestInit;
11
+ }): Promise<LoonResponseType>;
12
+ /** typed fetch-wrapper voor een GET-request. De deserializer is optioneel, default wordt de function genaamd `deserializeJSON` gebruikt
13
+ * @param url de url waarvandaan gefetched moet worden
14
+ * @param deserializer de deserializer die de string omzet naar een object. Default is `deserializeJSON`
15
+ * @throws een error met de status en statusText van de response
16
+ * @returns promise met het resultaat `T`
17
+ */
18
+ get<T = unknown>({ url, deserializer }: {
19
+ url: string;
20
+ deserializer?: ((v: string) => T);
21
+ }): Promise<T>;
22
+ /** typed fetch-wrapper voor een POST-request. De `serializer` is optioneel voor de body, default wordt de function genaamd `serializeJSON` gebruikt
23
+ * @param url de url waarheen gePOST moet worden
24
+ * @param body de body die gePOST moet worden (niet serialized). De body MOET een `token`-property bevatten.
25
+ * @param headers de headers die gePOST moeten worden. Default is `{'Content-Type': 'application/json'}`
26
+ * @param serializer de serializer voor de body. Default is `serializeJSON<T>()`
27
+ * @throws een error met de status en statusText van de response
28
+ * @returns het resultaat
29
+ */
30
+ post<B = {
31
+ token: string;
32
+ }>({ url, body, headers, serializer }: {
33
+ url: string;
34
+ body: B;
35
+ headers?: HeadersInit | undefined;
36
+ serializer?: (v: B) => string;
37
+ }): Promise<string>;
38
+ /** typed fetch-wrapper voor een PUT-request. De serializer is optioneel voor de body, default wordt de function genaamd `serializeJSON` gebruikt
39
+ * @param url de url waarheen gePUT moet worden
40
+ * @param body de body die gePUT moet worden (niet serialized). De body MOET een `token`-property bevatten.
41
+ * @param headers de headers die gePUT moeten worden. Default is `{'Content-Type': 'application/json'}`
42
+ * @param serializer de serializer voor de body. Default is `serializeJSON<T>()`
43
+ * @throws een error met de status en statusText van de response
44
+ * @returns het resultaat
45
+ */
46
+ put<B = {
47
+ token: string;
48
+ }>({ url, body, headers, serializer }: {
49
+ url: string;
50
+ body: B;
51
+ headers?: HeadersInit | undefined;
52
+ serializer?: (v: B) => string;
53
+ }): Promise<string>;
54
+ /**
55
+ * fetch-wrapper voor een DELETE-request
56
+ * @param url de url voor de delete-request
57
+ * @throws een error met de status en statusText van de response
58
+ * @returns het resultaat
59
+ */
60
+ del: ({ url }: {
61
+ url: string;
62
+ }) => Promise<string>;
63
+ };
64
+ export declare function useFetchAPI(): FetchAPIWrapper;
65
+ export {};
@@ -0,0 +1,96 @@
1
+ import React from 'react';
2
+ type KeyboardModifiers = {
3
+ alt: boolean;
4
+ ctrl: boolean;
5
+ meta: boolean;
6
+ /** Cross-platform modifier: Cmd (meta) op macOS, Ctrl op Windows/Linux. Gebruik dit voor shortcuts zoals 'save' (mod+s) */
7
+ mod: boolean;
8
+ shift: boolean;
9
+ };
10
+ export type Hotkey = KeyboardModifiers & {
11
+ key?: string;
12
+ };
13
+ type CheckHotkeyMatch = (event: KeyboardEvent) => boolean;
14
+ export type HotkeyOptions = {
15
+ /** Sta de standaard browser actie toe (bijv. ctrl+s opslaan). Standaard: false (browser actie wordt voorkomen) */
16
+ allowBrowserDefault?: boolean;
17
+ /** Sta toe dat eerdere hotkey handlers ook afvuren. Standaard: false (alleen deze handler wordt uitgevoerd) */
18
+ allowPropagation?: boolean;
19
+ };
20
+ type ReactHotkeyItem = readonly [string, (event: React.KeyboardEvent<HTMLElement>) => void, HotkeyOptions?];
21
+ export type HotkeyItem = readonly [string, (event: KeyboardEvent) => void, HotkeyOptions?];
22
+ /** Parse een key-combi naar een Hotkey object */
23
+ export declare function parseHotkey(hotkey: string): Hotkey;
24
+ /** Vergelijk hotkeys */
25
+ export declare function isExactHotkey(hotkey: Hotkey, event: KeyboardEvent): boolean;
26
+ /** Match hotkeys */
27
+ export declare function getHotkeyMatcher(hotkey: string): CheckHotkeyMatch;
28
+ /**
29
+ * `getHotkeyHandler` kan bijvoorbeeld op een `onKeyDown()` handler gebruikt worden. Om bijvoorbeeld hotkeys aan inputs toe te voegen
30
+ * @param hotkeys een array van keyboard-combinaties met een handler.
31
+ * @example
32
+ * <input type="text" onKeyDown={getHotkeyHandler(['alt+shift+l'])} />
33
+ */
34
+ export declare function getHotkeyHandler(hotkeys: ReactHotkeyItem[]): (event: React.KeyboardEvent<HTMLElement>) => void;
35
+ /**
36
+ * Hook om te luisteren naar keyboard-combinaties op het document.
37
+ * Vereist KeysProvider in de component tree.
38
+ *
39
+ * Formats:
40
+ * `"mod+s"` = Cmd + s op macOS, Ctrl + S op Windows,
41
+ * `"ctrl+shift+x"` = Ctrl + Shift + x,
42
+ * `"alt+shift+L"` = Alt + Shift + L, spaties zijn toegestaan,
43
+ * `"ArrowLeft"` = @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values voor speciale keys
44
+ *
45
+ * Options:
46
+ * - `allowBrowserDefault`: Sta de standaard browser actie toe (standaard: false)
47
+ * - `allowPropagation`: Sta toe dat eerder geregistreerde handlers ook afvuren (standaard: false)
48
+ *
49
+ * @param hotkeys een array van keyboard-combinaties met een handler en optionele opties.
50
+ * @example
51
+ * // Basis gebruik
52
+ * useHotkeys([
53
+ * ['mod+s', (e) => saveDocument()],
54
+ * ['ctrl+k', (e) => openCommandPalette()],
55
+ * ]);
56
+ *
57
+ * @example
58
+ * // Met opties: sta browser default toe (bijv. voor ctrl+f)
59
+ * useHotkeys([
60
+ * ['ctrl+f', (e) => customSearch(), { allowBrowserDefault: true }],
61
+ * ]);
62
+ *
63
+ * @example
64
+ * // Parent en child componenten met specificity
65
+ * // Parent component:
66
+ * useHotkeys([
67
+ * ['escape', () => console.log('Parent escape')],
68
+ * ]);
69
+ *
70
+ * // Child component (heeft voorrang):
71
+ * useHotkeys([
72
+ * ['escape', () => console.log('Child escape')], // Alleen deze vuurt af
73
+ * ]);
74
+ *
75
+ * @example
76
+ * // Sta propagatie toe naar eerdere handlers
77
+ * useHotkeys([
78
+ * ['ctrl+l', () => logAction(), { allowPropagation: true }], // Beide handlers vuren af
79
+ * ]);
80
+ */
81
+ export declare function useHotkeys(hotkeys: HotkeyItem[], tagsToIgnore?: string[], triggerOnContentEditable?: boolean): void;
82
+ /**
83
+ * Hook om te checken of een hotkey al geregistreerd is.
84
+ * Geeft een array terug met alle registraties die deze hotkey gebruiken.
85
+ *
86
+ * @param hotkey de hotkey om te checken (bijv. "mod+s" of "ctrl+k")
87
+ * @returns array van matches met id en hotkey string
88
+ *
89
+ * @example
90
+ * const matches = useIsHotkeyRegistered('mod+s');
91
+ * if (matches.length > 0) {
92
+ * console.log('mod+s is al geregistreerd door:', matches);
93
+ * }
94
+ */
95
+ export declare function useIsHotkeyRegistered(hotkey: string): import("..").RegisteredHotkeyMatch[];
96
+ export {};
@@ -0,0 +1,90 @@
1
+ type DBKey = string | number | Date;
2
+ type DBData = {
3
+ isOpen: boolean;
4
+ name: string;
5
+ version: number;
6
+ defaultStore: string;
7
+ stores: string[];
8
+ };
9
+ type DBFunctions<T extends unknown = string> = {
10
+ /** write a value to this database
11
+ * @param key the key to write to
12
+ * @param value the value to write
13
+ * @param store the store to write to (optional). When not provided, the default store is used
14
+ * @returns true if the write was successful
15
+ */
16
+ write: (key: DBKey, value: T, store?: string | undefined) => Promise<boolean>;
17
+ /** read a value from this database
18
+ * @param key the key to read from
19
+ * @param store the store to read from (optional). When not provided, the default store is used
20
+ * @param defaultValue the default value to return if the key does not exist (optional), defaults to null
21
+ * @returns the value if it exists, null otherwise
22
+ */
23
+ read: (key: DBKey, store?: string | undefined, defaultValue?: T | undefined) => Promise<T | null>;
24
+ /** remove a value from this database
25
+ * @param keyParam the key to remove
26
+ * @param storeParam the store to remove from (optional). When not provided, the default store is used
27
+ * @returns true if the remove was successful
28
+ */
29
+ remove: (key: DBKey, store?: string | undefined) => Promise<boolean>;
30
+ /** close the database manually */
31
+ close: () => void;
32
+ /** open the database manually */
33
+ open: () => void;
34
+ /** clear the store
35
+ * @param store the store to clear from (optional). When not provided, the default store is used.
36
+ * @return true if the clear was successful
37
+ */
38
+ clear: (store?: string | undefined) => Promise<boolean>;
39
+ /** check if a key exists in the store
40
+ * @param key the key to check
41
+ * @param store the store to check (optional). When not provided, the default store is used
42
+ * @returns true if the key exists, false otherwise
43
+ */
44
+ keyExists: (key?: DBKey | undefined, store?: string | undefined) => Promise<boolean>;
45
+ };
46
+ type DBSFunctions = {
47
+ /**
48
+ * Get a list of all databases
49
+ * @returns a promise that resolves to an array of database information
50
+ */
51
+ getDbs: () => Promise<IDBDatabaseInfo[]>;
52
+ /**
53
+ * Delete a database by name
54
+ * @param dbName the name of the database to delete
55
+ * @returns a promise that resolves when the database is deleted
56
+ */
57
+ deleteDb(dbName: string): Promise<void>;
58
+ };
59
+ type HookReturnValue = {
60
+ db: DBData & DBFunctions;
61
+ dbs: DBSFunctions;
62
+ };
63
+ type IndexedDBHookParams = {
64
+ /** The name of the database */
65
+ db?: string | undefined;
66
+ /** The default name of the object store (something like a table in SQL) */
67
+ store?: string | undefined;
68
+ /** The version of the database, defaults to 1 */
69
+ version?: number | undefined;
70
+ };
71
+ /** Hook to manage an IndexedDB database.
72
+ * @param dbName the name of the database to use, defaults to 'lbr-default-db'
73
+ * @param storeName the name of the object store to use, defaults to 'lbr-default-store'
74
+ * @param version the version of the database, defaults to 1
75
+ * @example
76
+ * const { db } = useIndexedDB({ db: 'my-db', store: 'my-store', version: 1 });
77
+ * db.write('my-key', 'my-value').then(success => console.log('Write successful:', success));
78
+ * db.read('my-key').then(value => console.log('Read value:', value));
79
+ * db.remove('my-key').then(success => console.log('Remove successful:', success));
80
+ * db.clear().then(success => console.log('Clear successful:', success));
81
+ * db.keyExists('my-key').then(exists => console.log('Key exists:', exists));
82
+ * db.open(); // to open the database manually
83
+ * db.close(); // to close the database manually
84
+ * @example // database management functions
85
+ * const { dbs } = useIndexedDB({ db: 'my-db', store: 'my-store', version: 1 });
86
+ * dbs.getDbs().then(dbs => console.log('All IndexedDBs:', dbs));
87
+ * dbs.deleteDb('my-db').then(() => console.log('Database deleted'));
88
+ */
89
+ declare function useIndexedDB({ db: dbName, store: storeName, version }: IndexedDBHookParams): HookReturnValue;
90
+ export { useIndexedDB };
@@ -0,0 +1,36 @@
1
+ type UseLocalStoredStateFn<T = string> = {
2
+ /** Key to store the value with in Local Storage */
3
+ key: string;
4
+ /** Initial value (if its non-existent in Local Storage) */
5
+ initialValue: T;
6
+ /** Your own serializing-function. Implement when you cannot use `JSON.stringify` */
7
+ serialize?: (value: T, replacer?: (key: string, value: any) => any, space?: string | number) => string;
8
+ /** Your own deserializing-funtion. Implement when you cannot use `JSON.parse` */
9
+ deserialize?: (value: string, reviver?: (key: string, value: any) => any) => T;
10
+ };
11
+ /**
12
+ * Hook die werkt als `React.useState<T|undefined>()`, maar waarbij de waarde ook wordt opgeslagen in Local Storage.
13
+ * De waarde blijft dan bij het refreshen van de pagina aanwezig. Als de pagina dan ververst wordt, word de al bestaande waarde gebruikt, niet de initialValue.
14
+ * Om de waarde te bewaren bij afsluiten van de browser, gebruik je de hook `{@link useSessionStoredState}`.
15
+ * @param {UseLocalStoredStateFn} params voor de hook
16
+ * @returns {[T, (value: T) => void]} tuple met een value en een setValue-function (net als React.useState)
17
+ * @description
18
+ * | Property | Type | Description |
19
+ * |--------------|------------|---------------------------------------------------------------|
20
+ * | key | `string` | De key waaronder de waarde in Local Storage wordt opgeslagen. |
21
+ * | initialValue | `T` | De initiale waarde. |
22
+ * | serialize | `function` | (optional) functie om de waarde om te zetten naar een string. Implementeer als de waarde __GEEN__ gebruik kan maken van `JSON.stringify()`! |
23
+ * | deserialize | `function` | (optional) De functie die een string omzet naar de waarde. Implementeer als de waarde __GEEN__ gebruik kan maken van `JSON.parse()`! |
24
+ * @example
25
+ * import { useLocalStoredState } from 'loon-bulma-react';
26
+ * const [ value, setValue, removeFromLocalStorage ] = useLocalStoredState({ key: 'myKey', initialValue: 'Oompa Loompa' });
27
+ * // 1. value is 'Oompa Loompa', put it somewhere on the screen
28
+ * // 2. change the value to something else
29
+ * // 3. refresh the page.
30
+ * // 4. see te new value on the page.
31
+ * // 5. you can also check the value in Local Storage in devtools.
32
+ * // 6. close the browser / tab
33
+ * // 7. check the value in session storage. it should still be there.
34
+ */
35
+ declare function useLocalStoredState<T extends unknown>({ key, initialValue, deserialize, serialize, }: UseLocalStoredStateFn<T>): readonly [T, (value: T) => void, () => void];
36
+ export { useLocalStoredState };
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Bulma breakpoints as defined in the Bulma CSS framework
3
+ * @see https://bulma.io/documentation/overview/responsiveness/
4
+ */
5
+ export declare const BulmaBreakpoints: {
6
+ /** Mobile devices (up to 768px) */
7
+ readonly mobile: "(max-width: 768px)";
8
+ /** Tablet and up (769px and above) */
9
+ readonly tablet: "(min-width: 769px)";
10
+ /** Tablet only (769px to 1023px) */
11
+ readonly tabletOnly: "(min-width: 769px) and (max-width: 1023px)";
12
+ /** Touch devices (up to 1023px) */
13
+ readonly touch: "(max-width: 1023px)";
14
+ /** Desktop and up (1024px and above) */
15
+ readonly desktop: "(min-width: 1024px)";
16
+ /** Desktop only (1024px to 1215px) */
17
+ readonly desktopOnly: "(min-width: 1024px) and (max-width: 1215px)";
18
+ /** Widescreen and up (1216px and above) */
19
+ readonly widescreen: "(min-width: 1216px)";
20
+ /** Widescreen only (1216px to 1407px) */
21
+ readonly widescreenOnly: "(min-width: 1216px) and (max-width: 1407px)";
22
+ /** FullHD and up (1408px and above) */
23
+ readonly fullhd: "(min-width: 1408px)";
24
+ };
25
+ /**
26
+ * Common media queries for typical use cases
27
+ * Provides convenient shortcuts for frequently used media features
28
+ */
29
+ export declare const CommonMediaQueries: {
30
+ /** Portrait orientation (height > width) */
31
+ readonly portrait: "(orientation: portrait)";
32
+ /** Landscape orientation (width > height) */
33
+ readonly landscape: "(orientation: landscape)";
34
+ /** User prefers light color scheme */
35
+ readonly lightMode: "(prefers-color-scheme: light)";
36
+ /** User prefers dark color scheme */
37
+ readonly darkMode: "(prefers-color-scheme: dark)";
38
+ /** User prefers reduced motion (accessibility) */
39
+ readonly reduceMotion: "(prefers-reduced-motion: reduce)";
40
+ /** User has no motion preference */
41
+ readonly allowMotion: "(prefers-reduced-motion: no-preference)";
42
+ /** Device supports hover (mouse, trackpad) */
43
+ readonly canHover: "(hover: hover)";
44
+ /** Device does not support hover (touch screens) */
45
+ readonly cannotHover: "(hover: none)";
46
+ /** Fine pointer (mouse, stylus) */
47
+ readonly finePointer: "(pointer: fine)";
48
+ /** Coarse pointer (touch, limited precision) */
49
+ readonly coarsePointer: "(pointer: coarse)";
50
+ /** High DPI / Retina displays (2x pixel density) */
51
+ readonly retina: "(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)";
52
+ /** Extra high DPI displays (3x pixel density) */
53
+ readonly retina3x: "(-webkit-min-device-pixel-ratio: 3), (min-resolution: 288dpi)";
54
+ /** Screen media (not print) */
55
+ readonly screen: "screen";
56
+ /** Print media */
57
+ readonly print: "print";
58
+ /** Wide aspect ratio (16:9 or wider) */
59
+ readonly wideAspect: "(min-aspect-ratio: 16/9)";
60
+ /** Square-ish aspect ratio */
61
+ readonly squareAspect: "(min-aspect-ratio: 4/5) and (max-aspect-ratio: 5/4)";
62
+ /** User prefers high contrast */
63
+ readonly highContrast: "(prefers-contrast: more)";
64
+ /** User prefers low contrast */
65
+ readonly lowContrast: "(prefers-contrast: less)";
66
+ };
67
+ export type BulmaBreakpointKey = keyof typeof BulmaBreakpoints;
68
+ export type CommonMediaQueryKey = keyof typeof CommonMediaQueries;
69
+ export type MediaQueryKey = BulmaBreakpointKey | CommonMediaQueryKey;
70
+ /**
71
+ * Hook to detect if a media query matches the current viewport.
72
+ * Integrates with Bulma breakpoints and common media queries, but also supports custom queries.
73
+ *
74
+ * @param query - A media query string, Bulma breakpoint key, or common media query key
75
+ * @param defaultValue - Default value to return during SSR or before first check (default: false)
76
+ * @returns boolean indicating if the media query matches
77
+ *
78
+ * @example
79
+ * // Using Bulma breakpoints
80
+ * const isMobile = useMediaQuery('mobile');
81
+ * const isDesktop = useMediaQuery('desktop');
82
+ * const isWidescreen = useMediaQuery('widescreen');
83
+ *
84
+ * @example
85
+ * // Using common media queries
86
+ * const isPortrait = useMediaQuery('portrait');
87
+ * const isDarkMode = useMediaQuery('darkMode');
88
+ * const canHover = useMediaQuery('canHover');
89
+ * const prefersReducedMotion = useMediaQuery('reduceMotion');
90
+ *
91
+ * @example
92
+ * // Using custom media queries
93
+ * const isVerySmall = useMediaQuery('(max-width: 400px)');
94
+ * const isExtraWide = useMediaQuery('(min-width: 2000px)');
95
+ *
96
+ * @example
97
+ * // With default value for SSR
98
+ * const isMobile = useMediaQuery('mobile', true); // assume mobile during SSR
99
+ *
100
+ * @example
101
+ * // Responsive component rendering
102
+ * function ResponsiveNav() {
103
+ * const isMobile = useMediaQuery('mobile');
104
+ * return isMobile ? <MobileNav /> : <DesktopNav />;
105
+ * }
106
+ */
107
+ export declare function useMediaQuery(query: MediaQueryKey | string, defaultValue?: boolean): boolean;
108
+ /**
109
+ * Hook to get multiple Bulma breakpoint matches at once.
110
+ * More efficient than calling useMediaQuery multiple times.
111
+ *
112
+ * @returns Object with boolean values for each Bulma breakpoint
113
+ *
114
+ * @example
115
+ * function ResponsiveComponent() {
116
+ * const { mobile, tablet, desktop, widescreen } = useBulmaBreakpoints();
117
+ *
118
+ * return (
119
+ * <div>
120
+ * {mobile && <p>Mobile view</p>}
121
+ * {tablet && <p>Tablet view</p>}
122
+ * {desktop && <p>Desktop view</p>}
123
+ * {widescreen && <p>Widescreen view</p>}
124
+ * </div>
125
+ * );
126
+ * }
127
+ */
128
+ export declare function useBulmaBreakpoints(): {
129
+ readonly mobile: boolean;
130
+ readonly tablet: boolean;
131
+ readonly tabletOnly: boolean;
132
+ readonly touch: boolean;
133
+ readonly desktop: boolean;
134
+ readonly desktopOnly: boolean;
135
+ readonly widescreen: boolean;
136
+ readonly widescreenOnly: boolean;
137
+ readonly fullhd: boolean;
138
+ };
139
+ /**
140
+ * Hook to get the current Bulma breakpoint name.
141
+ * Returns the most specific matching breakpoint.
142
+ *
143
+ * @returns The name of the current breakpoint or 'unknown' if none match
144
+ *
145
+ * @example
146
+ * function App() {
147
+ * const breakpoint = useCurrentBreakpoint();
148
+ *
149
+ * return <div className={`app-${breakpoint}`}>
150
+ * Current breakpoint: {breakpoint}
151
+ * </div>;
152
+ * }
153
+ */
154
+ export declare function useCurrentBulmaBreakpoint(): 'mobile' | 'tablet' | 'desktop' | 'widescreen' | 'fullhd' | 'unknown';
@@ -0,0 +1,25 @@
1
+ export declare const DOTS = "dots";
2
+ export interface PaginationParams {
3
+ /** Page selected on initial render, defaults to 1 */
4
+ initialPage?: number;
5
+ /** Controlled active page number */
6
+ page?: number;
7
+ /** Total amount of pages */
8
+ total: number;
9
+ /** Siblings amount on left/right side of selected page, defaults to 1 */
10
+ siblings?: number;
11
+ /** Amount of elements visible on left/right edges, defaults to 1 */
12
+ boundaries?: number;
13
+ /** Callback fired after change of each page */
14
+ onChange?: (page: number) => void;
15
+ }
16
+ export declare function usePagination({ total, siblings, boundaries, page, initialPage, onChange, }: PaginationParams): {
17
+ range: (number | "dots")[];
18
+ active: number;
19
+ total: number;
20
+ setPage: (pageNumber: number) => void;
21
+ next: () => void;
22
+ prev: () => void;
23
+ first: () => void;
24
+ last: () => void;
25
+ };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ /**
3
+ * Doet hetzelfde als `React.useState`, maar zorgt ervoor dat de state altijd gelijk is aan de parameter.
4
+ * Om te voorkomen dat je constructies als onderstaand voorbeeld hoeft te gebruiken
5
+ * @example // Dit stuk
6
+ * const [state, setState] = React.useState(value);
7
+ * React.useEffect(() => {
8
+ * setState(propValue);
9
+ * }, [propValue]);
10
+ *
11
+ * // Kan vervangen worden door
12
+ * const [state, setState] = usePropState(value);
13
+ * @param propValue
14
+ * @returns
15
+ */
16
+ export declare function usePropState<T extends unknown>(propValue: T): readonly [T, React.Dispatch<React.SetStateAction<T>>];
@@ -0,0 +1,59 @@
1
+ import React from 'react';
2
+ type Axis = 'x' | 'y';
3
+ type Alignment = 'start' | 'end' | 'center';
4
+ type ScrollIntoViewAnimation = {
5
+ /** target element alignment relatively to parent based on current axis */
6
+ alignment?: Alignment;
7
+ };
8
+ type ScrollIntoViewParams = {
9
+ /** callback voor NA het scrollen */
10
+ onScrollFinish?: () => void;
11
+ /** Duur van het scrollen (in Milliseconden) */
12
+ duration?: number;
13
+ /** axis/richting van het scrollen */
14
+ axis?: Axis;
15
+ /** offset van de dichtstbijzijnde rand en het element */
16
+ offset?: number;
17
+ /** mag het scrollen door andere gebruikersactiviteit geannuleerd worden */
18
+ cancelable?: boolean;
19
+ /** voorkomt verspringen van content bij lijsten met veel dezelfde elementen. */
20
+ isList?: boolean;
21
+ };
22
+ /**
23
+ * Scrollt een element in het zicht van een parent element.
24
+ * @param duration: de duur van een scroll animatie in milliseconden
25
+ * @param axis: de richting van het scrollen
26
+ * @param onScrollFinish: callback voor NA het scrollen
27
+ * @param offset: offset van de dichtstbijzijnde rand en het element
28
+ * @param cancelable: mag het scrollen door andere gebruikersactiviteit geannuleerd worden
29
+ * @param isList: voorkomt verspringen van content bij lijsten met veel dezelfde elementen.
30
+ * @returns object met:
31
+ * - `scrollableRef`: ref van de parent element,
32
+ * - `targetRef`: ref van het element dat in het zicht moet komen,
33
+ * - `scrollIntoView`: functie om het element in het zicht te scrollen,
34
+ * - `cancel`: functie om het scrollen te annuleren
35
+ * @example // 1 element om naar te scrollen
36
+ * const { scrollableRef, targetRef, scrollIntoView, cancel } = useScrollIntoView();
37
+ * <div ref={scrollableRef}>
38
+ * <div ref={targetRef} />
39
+ * </div>
40
+ * <button onClick={() => scrollIntoView()}>Scroll</button>
41
+ *
42
+ * @example // meerdere elementen om naar te scrollen
43
+ * const { FirstIargetRef, scrollIntoView: ScrollToFirstTarget, cancel } = useScrollIntoView();
44
+ * const { secondTargetRef, scrollIntoView: ScrollToSecondTarget, cancel } = useScrollIntoView();
45
+ * <div ref={scrollableRef}>
46
+ * <div ref={firstTtargetRef} />
47
+ * <div ref={secondTargetRef} />
48
+ * </div>
49
+ *
50
+ * <button onClick={() => ScrollToFirstTarget()}>Scroll naar eerste element</button>
51
+ * <button onClick={() => ScrollToSecondTarget()}>Scroll naar tweede element</button>
52
+ */
53
+ export declare function useScrollIntoView<Target extends HTMLElement, Parent extends HTMLElement | null = null>({ duration, axis, onScrollFinish, offset, cancelable, isList, }?: ScrollIntoViewParams): {
54
+ scrollableRef: React.RefObject<Parent | null>;
55
+ targetRef: React.RefObject<Target | null>;
56
+ scrollIntoView: ({ alignment }?: ScrollIntoViewAnimation) => void;
57
+ cancel: () => void;
58
+ };
59
+ export {};