loon-bulma-react 2023.0.23 → 2023.0.25
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/README.md +31 -16
- package/dist/components/AspectRatio/AspectRatio.d.ts +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/dist/components/Container/Container.d.ts +4 -4
- package/dist/components/DataTable/DataTable.d.ts +1 -3
- package/dist/components/Icon/Icon.d.ts +2 -2
- package/dist/components/Image/Image.d.ts +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Notification/Notification.d.ts +14 -14
- package/dist/forms/Checkbox/CB.d.ts +1 -1
- package/dist/forms/Checkbox/Checkbox.d.ts +1 -1
- package/dist/forms/Currency/CurrencyInput.d.ts +3 -2
- package/dist/forms/Datetimes/DateInput.d.ts +1 -0
- package/dist/forms/Datetimes/DateTimeInput.d.ts +1 -0
- package/dist/forms/Datetimes/TimeInput.d.ts +1 -0
- package/dist/forms/File/FileInput.d.ts +1 -0
- package/dist/forms/Input.d.ts +2 -1
- package/dist/forms/Numeric/MultiRangeInput.d.ts +1 -1
- package/dist/forms/Numeric/NumberInput.d.ts +1 -0
- package/dist/forms/Numeric/RangeInput.d.ts +1 -1
- package/dist/forms/Others/ColorInput.d.ts +1 -0
- package/dist/forms/Radio/RB.d.ts +1 -1
- package/dist/forms/Radio/Radio.d.ts +1 -1
- package/dist/forms/RichTextArea/RichTextArea.d.ts +5 -0
- package/dist/forms/Selects/MultiSelect.d.ts +1 -1
- package/dist/forms/Selects/Select.d.ts +1 -1
- package/dist/forms/Text/EmailInput.d.ts +1 -0
- package/dist/forms/Text/PasswordInput.d.ts +1 -0
- package/dist/forms/Text/TextArea.d.ts +1 -0
- package/dist/forms/Text/TextEditor.d.ts +21 -0
- package/dist/forms/Text/TextInput.d.ts +1 -0
- package/dist/forms/index.d.ts +1 -0
- package/dist/forms/shared/Base.Input.Container.d.ts +1 -0
- package/dist/forms/shared/BaseInputProps.d.ts +8 -6
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useCaretPosition.d.ts +7 -0
- package/dist/hooks/useLocalStoredState.d.ts +5 -6
- package/dist/hooks/useSessionStoredState.d.ts +38 -0
- package/dist/index.js +8276 -245
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +8278 -245
- package/dist/index.modern.js.map +1 -1
- package/dist/loon-react-bulma-types.d.ts +2 -1
- package/dist/utils/JSDateTime.class.d.ts +10 -4
- package/dist/utils/JSDuration.class.d.ts +3 -5
- package/dist/utils/deserialize.function.d.ts +2 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/isIBAN.function.d.ts +25 -0
- package/dist/utils/serialize.function.d.ts +2 -0
- package/package.json +44 -19
- package/styles/_all.scss +1 -0
- package/styles/tiptap-editor.scss +11 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare type UseSessionStoredState<T = string> = {
|
|
2
|
+
/** Key to store the value with in Session Storage */
|
|
3
|
+
key: string;
|
|
4
|
+
/** Initial value (if its non-existent in Session 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 Session Storage.
|
|
13
|
+
* De waarde blijft dan bij het refreshen van de pagina aanwezig.
|
|
14
|
+
* Als de pagina dan ververst wordt, word de al bestaande waarde gebruikt, niet de initialValue.
|
|
15
|
+
* Maar als de tab of de browser gesloten wordt, dan wordt de inhoud van de session storage gewist.
|
|
16
|
+
* Om de waarde te bewaren bij afsluiten van de browser, gebruik je de hook `{@link useLocalStoredState}`.
|
|
17
|
+
* @param {UseSessionStoredState} params voor de hook
|
|
18
|
+
* @returns {[T, (value: T) => void]} tuple met een `value` en een `setValue`-function (net als `React.useState`)
|
|
19
|
+
* @description
|
|
20
|
+
* | Property | Type | Description |
|
|
21
|
+
* |--------------|------------|---------------------------------------------------------------|
|
|
22
|
+
* | key | `string` | De key waaronder de waarde in Session Storage wordt opgeslagen. |
|
|
23
|
+
* | initialValue | `T` | De initiale waarde. |
|
|
24
|
+
* | serialize | `function` | (optional) functie om de waarde om te zetten naar een string. Implementeer als de waarde __GEEN__ gebruik kan maken van `JSON.stringify()`! |
|
|
25
|
+
* | deserialize | `function` | (optional) De functie die een string omzet naar de waarde. Implementeer als de waarde __GEEN__ gebruik kan maken van `JSON.parse()`! |
|
|
26
|
+
* @example
|
|
27
|
+
* import { useSessionStoredState } from 'loon-bulma-react';
|
|
28
|
+
* const [ value, setValue, removeFromSessionStorage ] = useSessionStoredState({ key: 'myKey', initialValue: 'Oompa Loompa' });
|
|
29
|
+
* // 1. value is 'Oompa Loompa', put it somewhere on the screen
|
|
30
|
+
* // 2. change the value to something else
|
|
31
|
+
* // 3. refresh the page.
|
|
32
|
+
* // 4. see te new value on the page.
|
|
33
|
+
* // 5. you can also check the value in Local Storage in devtools.
|
|
34
|
+
* // 6. close the browser / tab
|
|
35
|
+
* // 7. check the value in session storage. it should be gone.
|
|
36
|
+
*/
|
|
37
|
+
declare function useSessionStoredState<T extends unknown>({ key, initialValue, deserialize, serialize }: UseSessionStoredState<T>): readonly [T | undefined, (value: T) => void, () => void];
|
|
38
|
+
export { useSessionStoredState };
|