@mieweb/ui 0.6.1-dev.159 → 0.6.1-dev.164
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/dist/MedicationEditor-Bp4NLy7y.d.cts +352 -0
- package/dist/MedicationEditor-Bp4NLy7y.d.ts +352 -0
- package/dist/ag-grid.cjs +5 -5
- package/dist/ag-grid.js +1 -1
- package/dist/{chunk-H4T5T65N.cjs → chunk-2JQBPU3Y.cjs} +3 -3
- package/dist/{chunk-H4T5T65N.cjs.map → chunk-2JQBPU3Y.cjs.map} +1 -1
- package/dist/{chunk-6555OYRU.js → chunk-5BQE6BEL.js} +2 -2
- package/dist/{chunk-6555OYRU.js.map → chunk-5BQE6BEL.js.map} +1 -1
- package/dist/chunk-67CEEDAP.cjs +1605 -0
- package/dist/chunk-67CEEDAP.cjs.map +1 -0
- package/dist/{chunk-ULF4PWHW.cjs → chunk-7BARESXI.cjs} +3 -3
- package/dist/{chunk-ULF4PWHW.cjs.map → chunk-7BARESXI.cjs.map} +1 -1
- package/dist/chunk-7ZVTLTJF.js +109 -0
- package/dist/chunk-7ZVTLTJF.js.map +1 -0
- package/dist/{chunk-KX4NWZIR.cjs → chunk-CDMWZBDD.cjs} +3 -3
- package/dist/{chunk-KX4NWZIR.cjs.map → chunk-CDMWZBDD.cjs.map} +1 -1
- package/dist/chunk-DHKYGVP7.js +3 -0
- package/dist/{chunk-LEMY57MI.js.map → chunk-DHKYGVP7.js.map} +1 -1
- package/dist/{chunk-FSBFQBNE.cjs → chunk-DKGUOMBC.cjs} +2 -2
- package/dist/{chunk-FSBFQBNE.cjs.map → chunk-DKGUOMBC.cjs.map} +1 -1
- package/dist/{chunk-4FALCEJI.cjs → chunk-EL2RSQTJ.cjs} +2 -2
- package/dist/{chunk-4FALCEJI.cjs.map → chunk-EL2RSQTJ.cjs.map} +1 -1
- package/dist/{chunk-TQV5CGSA.js → chunk-ETGZ5DSA.js} +3 -3
- package/dist/{chunk-TQV5CGSA.js.map → chunk-ETGZ5DSA.js.map} +1 -1
- package/dist/{chunk-EYJDPYOP.js → chunk-FJG7KUDJ.js} +3 -3
- package/dist/{chunk-EYJDPYOP.js.map → chunk-FJG7KUDJ.js.map} +1 -1
- package/dist/{chunk-HMQ2PRTB.cjs → chunk-GBRPZGSI.cjs} +7 -7
- package/dist/{chunk-HMQ2PRTB.cjs.map → chunk-GBRPZGSI.cjs.map} +1 -1
- package/dist/{chunk-M7BLVBL4.js → chunk-GSOOPTGM.js} +3 -3
- package/dist/{chunk-M7BLVBL4.js.map → chunk-GSOOPTGM.js.map} +1 -1
- package/dist/chunk-HUXOASEB.js +1568 -0
- package/dist/chunk-HUXOASEB.js.map +1 -0
- package/dist/chunk-IQ4KQJAO.js +3 -0
- package/dist/{chunk-4ZU53GNR.cjs.map → chunk-IQ4KQJAO.js.map} +1 -1
- package/dist/{chunk-RUGWUQ47.js → chunk-NBD236EH.js} +48 -2
- package/dist/chunk-NBD236EH.js.map +1 -0
- package/dist/chunk-OF7NTZ2I.js +3 -0
- package/dist/chunk-OF7NTZ2I.js.map +1 -0
- package/dist/chunk-RHNPILZQ.cjs +4 -0
- package/dist/chunk-RHNPILZQ.cjs.map +1 -0
- package/dist/chunk-RI56YPED.cjs +201 -0
- package/dist/chunk-RI56YPED.cjs.map +1 -0
- package/dist/{chunk-DCER2QQB.js → chunk-T42BCIUA.js} +2 -2
- package/dist/{chunk-DCER2QQB.js.map → chunk-T42BCIUA.js.map} +1 -1
- package/dist/{chunk-4ZU53GNR.cjs → chunk-UTYUT5YY.cjs} +62 -2
- package/dist/chunk-UTYUT5YY.cjs.map +1 -0
- package/dist/{chunk-Q7NBJFEB.js → chunk-UVQEHZRF.js} +2 -2
- package/dist/{chunk-Q7NBJFEB.js.map → chunk-UVQEHZRF.js.map} +1 -1
- package/dist/chunk-VBWRH4UW.cjs +4 -0
- package/dist/chunk-VBWRH4UW.cjs.map +1 -0
- package/dist/{chunk-WJIANZPI.cjs → chunk-VJOVJTFP.cjs} +3 -3
- package/dist/chunk-VJOVJTFP.cjs.map +1 -0
- package/dist/{chunk-OVQKCUTZ.js → chunk-WFS6R2F5.js} +3 -3
- package/dist/{chunk-OVQKCUTZ.js.map → chunk-WFS6R2F5.js.map} +1 -1
- package/dist/chunk-Y5KEFV5O.js +192 -0
- package/dist/chunk-Y5KEFV5O.js.map +1 -0
- package/dist/{chunk-4N72FAQW.js → chunk-YBLIDESO.js} +3 -3
- package/dist/chunk-YBLIDESO.js.map +1 -0
- package/dist/chunk-YVPC65ZJ.cjs +134 -0
- package/dist/chunk-YVPC65ZJ.cjs.map +1 -0
- package/dist/{chunk-3AMNAMJA.cjs → chunk-YYDW3ZZS.cjs} +48 -2
- package/dist/chunk-YYDW3ZZS.cjs.map +1 -0
- package/dist/{chunk-3M4P2KMG.cjs → chunk-ZHBANUBI.cjs} +2 -2
- package/dist/{chunk-3M4P2KMG.cjs.map → chunk-ZHBANUBI.cjs.map} +1 -1
- package/dist/components/Badge/index.cjs +4 -3
- package/dist/components/Badge/index.js +2 -1
- package/dist/components/Card/index.cjs +16 -15
- package/dist/components/Card/index.js +2 -1
- package/dist/components/CountryCodeDropdown/index.cjs +5 -5
- package/dist/components/CountryCodeDropdown/index.js +2 -2
- package/dist/components/Dropdown/index.cjs +8 -8
- package/dist/components/Dropdown/index.js +2 -2
- package/dist/components/RichTextEditor/index.cjs +7 -7
- package/dist/components/RichTextEditor/index.js +4 -4
- package/dist/components/Skeleton/index.d.cts +1 -1
- package/dist/components/Skeleton/index.d.ts +1 -1
- package/dist/components/SuperChat/index.cjs +10 -9
- package/dist/components/SuperChat/index.cjs.map +1 -1
- package/dist/components/SuperChat/index.js +5 -4
- package/dist/components/SuperChat/index.js.map +1 -1
- package/dist/components/SuperChat/plugins/index.cjs +3 -3
- package/dist/components/SuperChat/plugins/index.js +2 -2
- package/dist/datavis.cjs +273 -5
- package/dist/datavis.cjs.map +1 -1
- package/dist/datavis.d.cts +61 -1
- package/dist/datavis.d.ts +61 -1
- package/dist/datavis.js +251 -1
- package/dist/datavis.js.map +1 -1
- package/dist/esheet.cjs +182 -0
- package/dist/esheet.cjs.map +1 -1
- package/dist/esheet.d.cts +117 -0
- package/dist/esheet.d.ts +117 -0
- package/dist/esheet.js +161 -0
- package/dist/esheet.js.map +1 -1
- package/dist/hooks/index.cjs +33 -16
- package/dist/hooks/index.d.cts +62 -1
- package/dist/hooks/index.d.ts +62 -1
- package/dist/hooks/index.js +3 -2
- package/dist/index.cjs +3923 -938
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +981 -2
- package/dist/index.d.ts +981 -2
- package/dist/index.js +3313 -452
- package/dist/index.js.map +1 -1
- package/dist/{nitroTableGrid-RQNSZQO4.cjs → nitroTableGrid-3J2GY6CK.cjs} +4 -4
- package/dist/{nitroTableGrid-RQNSZQO4.cjs.map → nitroTableGrid-3J2GY6CK.cjs.map} +1 -1
- package/dist/{nitroTableGrid-W6XWRFA7.js → nitroTableGrid-SIMT7635.js} +3 -3
- package/dist/{nitroTableGrid-W6XWRFA7.js.map → nitroTableGrid-SIMT7635.js.map} +1 -1
- package/dist/orderRows-BUJYgSc7.d.cts +221 -0
- package/dist/orderRows-BUJYgSc7.d.ts +221 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind-preset.cjs +4 -4
- package/dist/tailwind-preset.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3AMNAMJA.cjs.map +0 -1
- package/dist/chunk-4N72FAQW.js.map +0 -1
- package/dist/chunk-LEMY57MI.js +0 -3
- package/dist/chunk-RUGWUQ47.js.map +0 -1
- package/dist/chunk-WJIANZPI.cjs.map +0 -1
package/dist/esheet.d.ts
CHANGED
|
@@ -1,3 +1,120 @@
|
|
|
1
|
+
import { FieldComponentProps } from '@esheet/core';
|
|
1
2
|
export { FormDefinition } from '@esheet/core';
|
|
2
3
|
export { EsheetBuilder, EsheetBuilderProps } from '@esheet/builder';
|
|
3
4
|
export { EsheetRenderer, EsheetRendererHandle, EsheetRendererProps } from '@esheet/renderer';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { C as CodeLookupConfig, M as Medication, A as Allergy } from './MedicationEditor-Bp4NLy7y.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* MedicationListField — eSheet custom field wrapper around
|
|
10
|
+
* MedicationReconciliation.
|
|
11
|
+
*
|
|
12
|
+
* Thin adapter: all reconciliation UI/behavior lives in the standalone
|
|
13
|
+
* `MedicationReconciliation` component (main bundle). This file only maps the
|
|
14
|
+
* eSheet field contract (definition, response, preview/enabled state) onto it.
|
|
15
|
+
*
|
|
16
|
+
* Exposed via the `@mieweb/ui/esheet` entry point (NOT the main bundle) so
|
|
17
|
+
* that @esheet/* stays an optional dependency.
|
|
18
|
+
*
|
|
19
|
+
* The field stores its state as JSON in `response.answer`:
|
|
20
|
+
* `{ medications: Medication[] }`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* import { registerMedicationListFieldType } from '@mieweb/ui/esheet';
|
|
25
|
+
*
|
|
26
|
+
* registerMedicationListFieldType(); // before rendering EsheetBuilder/Renderer
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
interface MedicationListFieldValue {
|
|
31
|
+
medications: Medication[];
|
|
32
|
+
}
|
|
33
|
+
declare function MedicationListField({ field, response, isPreview, isEnabled, onResponse, codeLookup, }: FieldComponentProps & {
|
|
34
|
+
/** CodeLookup wiring — supplied via registerMedicationListFieldType() */
|
|
35
|
+
codeLookup?: CodeLookupConfig | false;
|
|
36
|
+
}): React.JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* Register the `medicationList` field type with eSheet.
|
|
39
|
+
* Call once before rendering EsheetBuilder or EsheetRenderer.
|
|
40
|
+
*
|
|
41
|
+
* @param options.codeLookup — wire the offline RxNorm/FDB CodeLookup into the
|
|
42
|
+
* medication editor (Correct / Add Medication):
|
|
43
|
+
* ```tsx
|
|
44
|
+
* import { CodeLookup } from '…/CodeLookup';
|
|
45
|
+
* registerMedicationListFieldType({
|
|
46
|
+
* codeLookup: { component: CodeLookup, indexUrl: '/codify' },
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare function registerMedicationListFieldType(options?: {
|
|
51
|
+
codeLookup?: CodeLookupConfig | false;
|
|
52
|
+
}): void;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* AllergyListField — eSheet custom field wrapper around AllergyManager.
|
|
56
|
+
*
|
|
57
|
+
* Thin adapter, same pattern as MedicationListField. State persists as JSON
|
|
58
|
+
* in `response.answer`: `{ allergies: Allergy[], noKnownAllergies?: boolean }`.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* import { registerAllergyListFieldType } from '@mieweb/ui/esheet';
|
|
63
|
+
*
|
|
64
|
+
* registerAllergyListFieldType({ codeLookup: { component: CodeLookup, indexUrl: '/codify' } });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
interface AllergyListFieldValue {
|
|
69
|
+
allergies: Allergy[];
|
|
70
|
+
noKnownAllergies?: boolean;
|
|
71
|
+
}
|
|
72
|
+
declare function AllergyListField({ field, response, isPreview, isEnabled, onResponse, codeLookup, }: FieldComponentProps & {
|
|
73
|
+
/** CodeLookup wiring — supplied via registerAllergyListFieldType() */
|
|
74
|
+
codeLookup?: CodeLookupConfig | false;
|
|
75
|
+
}): React.JSX.Element;
|
|
76
|
+
/**
|
|
77
|
+
* Register the `allergyList` field type with eSheet.
|
|
78
|
+
* Call once before rendering EsheetBuilder or EsheetRenderer.
|
|
79
|
+
*/
|
|
80
|
+
declare function registerAllergyListFieldType(options?: {
|
|
81
|
+
codeLookup?: CodeLookupConfig | false;
|
|
82
|
+
}): void;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* registerMieEsheetFields — one-call registration for every @mieweb/ui custom
|
|
86
|
+
* eSheet field type (medication reconciliation + allergy list).
|
|
87
|
+
*
|
|
88
|
+
* The @esheet/* packages stay generic and free of medical dependencies; these
|
|
89
|
+
* fields live in @mieweb/ui and opt in from the consumer side. This helper is
|
|
90
|
+
* the "batteries included" entry point so an app can enable the full medical
|
|
91
|
+
* field set with a single call instead of wiring each field type by hand.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```tsx
|
|
95
|
+
* import { registerMieEsheetFields } from '@mieweb/ui/esheet';
|
|
96
|
+
* import { CodeLookup } from '…/CodeLookup';
|
|
97
|
+
*
|
|
98
|
+
* // once, before EsheetBuilder / EsheetRenderer mount
|
|
99
|
+
* registerMieEsheetFields({
|
|
100
|
+
* codeLookup: { component: CodeLookup, indexUrl: '/codify' },
|
|
101
|
+
* });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
interface RegisterMieEsheetFieldsOptions {
|
|
106
|
+
/**
|
|
107
|
+
* Shared CodeLookup wiring applied to every field that supports offline
|
|
108
|
+
* RxNorm/FDB coding (medication + allergy editors).
|
|
109
|
+
*/
|
|
110
|
+
codeLookup?: CodeLookupConfig;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Register all @mieweb/ui custom eSheet field types at once:
|
|
114
|
+
* `medicationList` and `allergyList`.
|
|
115
|
+
*
|
|
116
|
+
* Call once before rendering EsheetBuilder or EsheetRenderer.
|
|
117
|
+
*/
|
|
118
|
+
declare function registerMieEsheetFields(options?: RegisterMieEsheetFieldsOptions): void;
|
|
119
|
+
|
|
120
|
+
export { AllergyListField, type AllergyListFieldValue, MedicationListField, type MedicationListFieldValue, type RegisterMieEsheetFieldsOptions, registerAllergyListFieldType, registerMedicationListFieldType, registerMieEsheetFields };
|
package/dist/esheet.js
CHANGED
|
@@ -1,4 +1,165 @@
|
|
|
1
|
+
import { MedicationReconciliation, useCodeLookupConfig, AllergyManager } from './chunk-HUXOASEB.js';
|
|
2
|
+
import './chunk-6LFG4JFF.js';
|
|
3
|
+
import './chunk-FZJBFJJR.js';
|
|
4
|
+
import './chunk-EZKRAW2X.js';
|
|
5
|
+
import './chunk-R25H4N4Z.js';
|
|
6
|
+
import './chunk-DUPR6FEL.js';
|
|
7
|
+
import './chunk-5BQE6BEL.js';
|
|
8
|
+
import './chunk-HYEJLKXI.js';
|
|
9
|
+
import './chunk-IUFDGB5O.js';
|
|
10
|
+
import './chunk-PVUDXJAI.js';
|
|
11
|
+
import './chunk-DHKYGVP7.js';
|
|
12
|
+
import './chunk-ZVSW2KS6.js';
|
|
13
|
+
import './chunk-T42BCIUA.js';
|
|
14
|
+
import './chunk-7ZVTLTJF.js';
|
|
15
|
+
import './chunk-HB7C7NB5.js';
|
|
16
|
+
import './chunk-4SMSH4OY.js';
|
|
17
|
+
import './chunk-T4ME7QCT.js';
|
|
18
|
+
import './chunk-RC2YMOMS.js';
|
|
19
|
+
import './chunk-F3SOEIN2.js';
|
|
20
|
+
import './chunk-VSQF22GL.js';
|
|
1
21
|
export { EsheetBuilder } from '@esheet/builder';
|
|
2
22
|
export { EsheetRenderer } from '@esheet/renderer';
|
|
23
|
+
import * as React from 'react';
|
|
24
|
+
import { registerCustomFieldTypes } from '@esheet/fields';
|
|
25
|
+
import { jsx } from 'react/jsx-runtime';
|
|
26
|
+
|
|
27
|
+
function parseValue(answer) {
|
|
28
|
+
if (!answer) return { medications: [] };
|
|
29
|
+
try {
|
|
30
|
+
const parsed = JSON.parse(answer);
|
|
31
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
32
|
+
return { medications: [] };
|
|
33
|
+
}
|
|
34
|
+
const { medications } = parsed;
|
|
35
|
+
return {
|
|
36
|
+
medications: Array.isArray(medications) ? medications : []
|
|
37
|
+
};
|
|
38
|
+
} catch {
|
|
39
|
+
return { medications: [] };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function MedicationListField({
|
|
43
|
+
field,
|
|
44
|
+
response,
|
|
45
|
+
isPreview,
|
|
46
|
+
isEnabled,
|
|
47
|
+
onResponse,
|
|
48
|
+
codeLookup
|
|
49
|
+
}) {
|
|
50
|
+
const definition = field.definition;
|
|
51
|
+
const medications = React.useMemo(() => {
|
|
52
|
+
if (response?.answer) return parseValue(response.answer).medications;
|
|
53
|
+
return definition.medications ?? [];
|
|
54
|
+
}, [response?.answer, definition.medications]);
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
MedicationReconciliation,
|
|
57
|
+
{
|
|
58
|
+
medications,
|
|
59
|
+
onChange: (next) => onResponse({ answer: JSON.stringify({ medications: next }) }),
|
|
60
|
+
title: definition.question ?? "Presenting medications",
|
|
61
|
+
quickAddOptions: definition.quickAddOptions,
|
|
62
|
+
codeLookup,
|
|
63
|
+
readOnly: !(isPreview && isEnabled)
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
function registerMedicationListFieldType(options) {
|
|
68
|
+
const Field = (props) => /* @__PURE__ */ jsx(MedicationListField, { ...props, codeLookup: options?.codeLookup });
|
|
69
|
+
registerCustomFieldTypes({
|
|
70
|
+
medicationList: {
|
|
71
|
+
label: "Medication Reconciliation",
|
|
72
|
+
category: "rich",
|
|
73
|
+
answerType: "text",
|
|
74
|
+
hasOptions: false,
|
|
75
|
+
hasMatrix: false,
|
|
76
|
+
defaultProps: {
|
|
77
|
+
question: "Presenting medications",
|
|
78
|
+
quickAddOptions: [
|
|
79
|
+
"aspirin 81 mg tablet",
|
|
80
|
+
"atorvastatin 20 mg tablet",
|
|
81
|
+
"metformin 500 mg tablet"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
component: Field
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function parseValue2(answer) {
|
|
89
|
+
if (!answer) return { allergies: [] };
|
|
90
|
+
try {
|
|
91
|
+
const parsed = JSON.parse(answer);
|
|
92
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
93
|
+
return { allergies: [] };
|
|
94
|
+
}
|
|
95
|
+
const { allergies, noKnownAllergies } = parsed;
|
|
96
|
+
return {
|
|
97
|
+
allergies: Array.isArray(allergies) ? allergies : [],
|
|
98
|
+
noKnownAllergies: typeof noKnownAllergies === "boolean" ? noKnownAllergies : void 0
|
|
99
|
+
};
|
|
100
|
+
} catch {
|
|
101
|
+
return { allergies: [] };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function AllergyListField({
|
|
105
|
+
field,
|
|
106
|
+
response,
|
|
107
|
+
isPreview,
|
|
108
|
+
isEnabled,
|
|
109
|
+
onResponse,
|
|
110
|
+
codeLookup
|
|
111
|
+
}) {
|
|
112
|
+
const definition = field.definition;
|
|
113
|
+
const ambientCodeLookup = useCodeLookupConfig();
|
|
114
|
+
const effectiveCodeLookup = codeLookup === false ? void 0 : codeLookup ?? ambientCodeLookup ?? void 0;
|
|
115
|
+
const value = React.useMemo(() => {
|
|
116
|
+
if (response?.answer) return parseValue2(response.answer);
|
|
117
|
+
return { allergies: definition.allergies ?? [] };
|
|
118
|
+
}, [response?.answer, definition.allergies]);
|
|
119
|
+
const commit = (next) => {
|
|
120
|
+
onResponse({ answer: JSON.stringify(next) });
|
|
121
|
+
};
|
|
122
|
+
return /* @__PURE__ */ jsx(
|
|
123
|
+
AllergyManager,
|
|
124
|
+
{
|
|
125
|
+
allergies: value.allergies,
|
|
126
|
+
onChange: (allergies) => commit({
|
|
127
|
+
allergies,
|
|
128
|
+
// any recorded allergy clears NKA
|
|
129
|
+
noKnownAllergies: allergies.length > 0 ? void 0 : value.noKnownAllergies
|
|
130
|
+
}),
|
|
131
|
+
noKnownAllergies: value.noKnownAllergies,
|
|
132
|
+
onNoKnownAllergiesChange: (nka) => commit({ allergies: value.allergies, noKnownAllergies: nka }),
|
|
133
|
+
title: definition.question ?? "Allergies",
|
|
134
|
+
codeLookup,
|
|
135
|
+
inlineAddSearch: Boolean(effectiveCodeLookup),
|
|
136
|
+
readOnly: !(isPreview && isEnabled)
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
function registerAllergyListFieldType(options) {
|
|
141
|
+
const Field = (props) => /* @__PURE__ */ jsx(AllergyListField, { ...props, codeLookup: options?.codeLookup });
|
|
142
|
+
registerCustomFieldTypes({
|
|
143
|
+
allergyList: {
|
|
144
|
+
label: "Allergy List",
|
|
145
|
+
category: "rich",
|
|
146
|
+
answerType: "text",
|
|
147
|
+
hasOptions: false,
|
|
148
|
+
hasMatrix: false,
|
|
149
|
+
defaultProps: {
|
|
150
|
+
question: "Allergies"
|
|
151
|
+
},
|
|
152
|
+
component: Field
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// src/esheet-fields/registerAll.ts
|
|
158
|
+
function registerMieEsheetFields(options) {
|
|
159
|
+
registerMedicationListFieldType({ codeLookup: options?.codeLookup });
|
|
160
|
+
registerAllergyListFieldType({ codeLookup: options?.codeLookup });
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export { AllergyListField, MedicationListField, registerAllergyListFieldType, registerMedicationListFieldType, registerMieEsheetFields };
|
|
3
164
|
//# sourceMappingURL=esheet.js.map
|
|
4
165
|
//# sourceMappingURL=esheet.js.map
|
package/dist/esheet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"esheet.js","sourcesContent":[]}
|
|
1
|
+
{"version":3,"sources":["../src/esheet-fields/MedicationListField.tsx","../src/esheet-fields/AllergyListField.tsx","../src/esheet-fields/registerAll.ts"],"names":["parseValue","React2","jsx","registerCustomFieldTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,WAAW,MAAA,EAAsD;AACxE,EAAA,IAAI,CAAC,MAAA,EAAQ,OAAO,EAAE,WAAA,EAAa,EAAC,EAAE;AACtC,EAAA,IAAI;AAEF,IAAA,MAAM,MAAA,GAAkB,IAAA,CAAK,KA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WAAW,QAAA,IAAY,WAAA;AAAA,MAC9B,UAAA;AAAA,MACA,eAAA,EAAiB,QAAQ,mBAAmB,CAAA;AAAA,MAC5C,QAAA,EAAU,EAAE,SAAA,IAAa,SAAA;AAAA;AAAA,GAC3B;AAEJ;AAUO,SAAS,6BAA6B,OAAA,EAEpC;AACP,EAAA,MAAM,KAAA,GAAQ,CAAC,KAAA,qBACbA,GAAAA,CAAC,oBAAkB,GAAG,KAAA,EAAO,UAAA,EAAY,OAAA,EAAS,UAAA,EAAY,CAAA;AAEhE,EAAAC,wBAAAA,CAAyB;AAAA,IACvB,WAAA,EAAa;AAAA,MACX,KAAA,EAAO,cAAA;AAAA,MACP,QAAA,EAAU,MAAA;AAAA,MACV,UAAA,EAAY,MAAA;AAAA,MACZ,UAAA,EAAY,KAAA;AAAA,MACZ,SAAA,EAAW,KAAA;AAAA,MACX,YAAA,EAAc;AAAA,QACZ,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,SAAA,EAAW;AAAA;AACb,GACD,CAAA;AACH;;;AClGO,SAAS,wBACd,OAAA,EACM;AACN,EAAA,+BAAA,CAAgC,EAAE,UAAA,EAAY,OAAA,EAAS,UAAA,EAAY,CAAA;AACnE,EAAA,4BAAA,CAA6B,EAAE,UAAA,EAAY,OAAA,EAAS,UAAA,EAAY,CAAA;AAClE","file":"esheet.js","sourcesContent":["/**\n * MedicationListField — eSheet custom field wrapper around\n * MedicationReconciliation.\n *\n * Thin adapter: all reconciliation UI/behavior lives in the standalone\n * `MedicationReconciliation` component (main bundle). This file only maps the\n * eSheet field contract (definition, response, preview/enabled state) onto it.\n *\n * Exposed via the `@mieweb/ui/esheet` entry point (NOT the main bundle) so\n * that @esheet/* stays an optional dependency.\n *\n * The field stores its state as JSON in `response.answer`:\n * `{ medications: Medication[] }`.\n *\n * @example\n * ```tsx\n * import { registerMedicationListFieldType } from '@mieweb/ui/esheet';\n *\n * registerMedicationListFieldType(); // before rendering EsheetBuilder/Renderer\n * ```\n */\n\nimport * as React from 'react';\nimport type { FieldComponentProps } from '@esheet/core';\nimport { registerCustomFieldTypes } from '@esheet/fields';\nimport {\n MedicationReconciliation,\n type CodeLookupConfig,\n type Medication,\n} from '../components/MedicationList';\n\n// =============================================================================\n// Response (de)serialization\n// =============================================================================\n\nexport interface MedicationListFieldValue {\n medications: Medication[];\n}\n\nfunction parseValue(answer: string | undefined): MedicationListFieldValue {\n if (!answer) return { medications: [] };\n try {\n // shape-guarded: valid JSON like `null` or `[]` must degrade safely\n const parsed: unknown = JSON.parse(answer);\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n return { medications: [] };\n }\n const { medications } = parsed as { medications?: unknown };\n return {\n medications: Array.isArray(medications)\n ? (medications as Medication[])\n : [],\n };\n } catch {\n return { medications: [] };\n }\n}\n\n// =============================================================================\n// Field component\n// =============================================================================\n\nexport function MedicationListField({\n field,\n response,\n isPreview,\n isEnabled,\n onResponse,\n codeLookup,\n}: FieldComponentProps & {\n /** CodeLookup wiring — supplied via registerMedicationListFieldType() */\n codeLookup?: CodeLookupConfig | false;\n}): React.JSX.Element {\n const definition = field.definition as {\n question?: string;\n medications?: Medication[];\n quickAddOptions?: string[];\n };\n\n // Response wins; otherwise seed from the field definition's medication list.\n const medications = React.useMemo(() => {\n if (response?.answer) return parseValue(response.answer).medications;\n return definition.medications ?? [];\n }, [response?.answer, definition.medications]);\n\n return (\n <MedicationReconciliation\n medications={medications}\n onChange={(next) =>\n onResponse({ answer: JSON.stringify({ medications: next }) })\n }\n title={definition.question ?? 'Presenting medications'}\n quickAddOptions={definition.quickAddOptions}\n codeLookup={codeLookup}\n readOnly={!(isPreview && isEnabled)}\n />\n );\n}\n\n// =============================================================================\n// Registration\n// =============================================================================\n\n/**\n * Register the `medicationList` field type with eSheet.\n * Call once before rendering EsheetBuilder or EsheetRenderer.\n *\n * @param options.codeLookup — wire the offline RxNorm/FDB CodeLookup into the\n * medication editor (Correct / Add Medication):\n * ```tsx\n * import { CodeLookup } from '…/CodeLookup';\n * registerMedicationListFieldType({\n * codeLookup: { component: CodeLookup, indexUrl: '/codify' },\n * });\n * ```\n */\nexport function registerMedicationListFieldType(options?: {\n codeLookup?: CodeLookupConfig | false;\n}): void {\n const Field = (props: FieldComponentProps) => (\n <MedicationListField {...props} codeLookup={options?.codeLookup} />\n );\n registerCustomFieldTypes({\n medicationList: {\n label: 'Medication Reconciliation',\n category: 'rich',\n answerType: 'text',\n hasOptions: false,\n hasMatrix: false,\n defaultProps: {\n question: 'Presenting medications',\n quickAddOptions: [\n 'aspirin 81 mg tablet',\n 'atorvastatin 20 mg tablet',\n 'metformin 500 mg tablet',\n ],\n },\n component: Field,\n },\n });\n}\n","/**\n * AllergyListField — eSheet custom field wrapper around AllergyManager.\n *\n * Thin adapter, same pattern as MedicationListField. State persists as JSON\n * in `response.answer`: `{ allergies: Allergy[], noKnownAllergies?: boolean }`.\n *\n * @example\n * ```tsx\n * import { registerAllergyListFieldType } from '@mieweb/ui/esheet';\n *\n * registerAllergyListFieldType({ codeLookup: { component: CodeLookup, indexUrl: '/codify' } });\n * ```\n */\n\nimport * as React from 'react';\nimport type { FieldComponentProps } from '@esheet/core';\nimport { registerCustomFieldTypes } from '@esheet/fields';\nimport { AllergyManager, type Allergy } from '../components/AllergyList';\nimport type { CodeLookupConfig } from '../components/MedicationList';\nimport { useCodeLookupConfig } from '../components/CodeLookup/context';\n\n// =============================================================================\n// Response (de)serialization\n// =============================================================================\n\nexport interface AllergyListFieldValue {\n allergies: Allergy[];\n noKnownAllergies?: boolean;\n}\n\nfunction parseValue(answer: string | undefined): AllergyListFieldValue {\n if (!answer) return { allergies: [] };\n try {\n // shape-guarded: valid JSON like `null` or `[]` must degrade safely\n const parsed: unknown = JSON.parse(answer);\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n return { allergies: [] };\n }\n const { allergies, noKnownAllergies } = parsed as Partial<\n Record<keyof AllergyListFieldValue, unknown>\n >;\n return {\n allergies: Array.isArray(allergies) ? (allergies as Allergy[]) : [],\n noKnownAllergies:\n typeof noKnownAllergies === 'boolean' ? noKnownAllergies : undefined,\n };\n } catch {\n return { allergies: [] };\n }\n}\n\n// =============================================================================\n// Field component\n// =============================================================================\n\nexport function AllergyListField({\n field,\n response,\n isPreview,\n isEnabled,\n onResponse,\n codeLookup,\n}: FieldComponentProps & {\n /** CodeLookup wiring — supplied via registerAllergyListFieldType() */\n codeLookup?: CodeLookupConfig | false;\n}): React.JSX.Element {\n const definition = field.definition as {\n question?: string;\n allergies?: Allergy[];\n };\n\n // Default to the ambient provider; `false` forces plain text.\n const ambientCodeLookup = useCodeLookupConfig();\n const effectiveCodeLookup =\n codeLookup === false\n ? undefined\n : (codeLookup ?? ambientCodeLookup ?? undefined);\n\n const value = React.useMemo(() => {\n if (response?.answer) return parseValue(response.answer);\n return { allergies: definition.allergies ?? [] };\n }, [response?.answer, definition.allergies]);\n\n const commit = (next: AllergyListFieldValue) => {\n onResponse({ answer: JSON.stringify(next) });\n };\n\n return (\n <AllergyManager\n allergies={value.allergies}\n onChange={(allergies) =>\n commit({\n allergies,\n // any recorded allergy clears NKA\n noKnownAllergies:\n allergies.length > 0 ? undefined : value.noKnownAllergies,\n })\n }\n noKnownAllergies={value.noKnownAllergies}\n onNoKnownAllergiesChange={(nka) =>\n commit({ allergies: value.allergies, noKnownAllergies: nka })\n }\n title={definition.question ?? 'Allergies'}\n codeLookup={codeLookup}\n inlineAddSearch={Boolean(effectiveCodeLookup)}\n readOnly={!(isPreview && isEnabled)}\n />\n );\n}\n\n// =============================================================================\n// Registration\n// =============================================================================\n\n/**\n * Register the `allergyList` field type with eSheet.\n * Call once before rendering EsheetBuilder or EsheetRenderer.\n */\nexport function registerAllergyListFieldType(options?: {\n codeLookup?: CodeLookupConfig | false;\n}): void {\n const Field = (props: FieldComponentProps) => (\n <AllergyListField {...props} codeLookup={options?.codeLookup} />\n );\n registerCustomFieldTypes({\n allergyList: {\n label: 'Allergy List',\n category: 'rich',\n answerType: 'text',\n hasOptions: false,\n hasMatrix: false,\n defaultProps: {\n question: 'Allergies',\n },\n component: Field,\n },\n });\n}\n","/**\n * registerMieEsheetFields — one-call registration for every @mieweb/ui custom\n * eSheet field type (medication reconciliation + allergy list).\n *\n * The @esheet/* packages stay generic and free of medical dependencies; these\n * fields live in @mieweb/ui and opt in from the consumer side. This helper is\n * the \"batteries included\" entry point so an app can enable the full medical\n * field set with a single call instead of wiring each field type by hand.\n *\n * @example\n * ```tsx\n * import { registerMieEsheetFields } from '@mieweb/ui/esheet';\n * import { CodeLookup } from '…/CodeLookup';\n *\n * // once, before EsheetBuilder / EsheetRenderer mount\n * registerMieEsheetFields({\n * codeLookup: { component: CodeLookup, indexUrl: '/codify' },\n * });\n * ```\n */\n\nimport type { CodeLookupConfig } from '../components/MedicationList';\nimport { registerMedicationListFieldType } from './MedicationListField';\nimport { registerAllergyListFieldType } from './AllergyListField';\n\nexport interface RegisterMieEsheetFieldsOptions {\n /**\n * Shared CodeLookup wiring applied to every field that supports offline\n * RxNorm/FDB coding (medication + allergy editors).\n */\n codeLookup?: CodeLookupConfig;\n}\n\n/**\n * Register all @mieweb/ui custom eSheet field types at once:\n * `medicationList` and `allergyList`.\n *\n * Call once before rendering EsheetBuilder or EsheetRenderer.\n */\nexport function registerMieEsheetFields(\n options?: RegisterMieEsheetFieldsOptions\n): void {\n registerMedicationListFieldType({ codeLookup: options?.codeLookup });\n registerAllergyListFieldType({ codeLookup: options?.codeLookup });\n}\n"]}
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -1,59 +1,80 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDKGUOMBC_cjs = require('../chunk-DKGUOMBC.cjs');
|
|
4
4
|
var chunk2O7D6F67_cjs = require('../chunk-2O7D6F67.cjs');
|
|
5
|
+
var chunkIKMR2ADM_cjs = require('../chunk-IKMR2ADM.cjs');
|
|
6
|
+
var chunkYVPC65ZJ_cjs = require('../chunk-YVPC65ZJ.cjs');
|
|
5
7
|
var chunk6HFFWEM3_cjs = require('../chunk-6HFFWEM3.cjs');
|
|
6
8
|
var chunkNNEFAUHV_cjs = require('../chunk-NNEFAUHV.cjs');
|
|
7
9
|
var chunkFHY3K6PL_cjs = require('../chunk-FHY3K6PL.cjs');
|
|
8
|
-
var chunkIKMR2ADM_cjs = require('../chunk-IKMR2ADM.cjs');
|
|
9
10
|
require('../chunk-SCV7C55E.cjs');
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
Object.defineProperty(exports, "useCommandK", {
|
|
14
15
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkDKGUOMBC_cjs.useCommandK; }
|
|
16
17
|
});
|
|
17
18
|
Object.defineProperty(exports, "useIsDesktop", {
|
|
18
19
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkDKGUOMBC_cjs.useIsDesktop; }
|
|
20
21
|
});
|
|
21
22
|
Object.defineProperty(exports, "useIsLargeDesktop", {
|
|
22
23
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkDKGUOMBC_cjs.useIsLargeDesktop; }
|
|
24
25
|
});
|
|
25
26
|
Object.defineProperty(exports, "useIsMobile", {
|
|
26
27
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkDKGUOMBC_cjs.useIsMobile; }
|
|
28
29
|
});
|
|
29
30
|
Object.defineProperty(exports, "useIsMobileOrTablet", {
|
|
30
31
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkDKGUOMBC_cjs.useIsMobileOrTablet; }
|
|
32
33
|
});
|
|
33
34
|
Object.defineProperty(exports, "useIsSmallTablet", {
|
|
34
35
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkDKGUOMBC_cjs.useIsSmallTablet; }
|
|
36
37
|
});
|
|
37
38
|
Object.defineProperty(exports, "useIsTablet", {
|
|
38
39
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkDKGUOMBC_cjs.useIsTablet; }
|
|
40
41
|
});
|
|
41
42
|
Object.defineProperty(exports, "useKeyboardShortcut", {
|
|
42
43
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkDKGUOMBC_cjs.useKeyboardShortcut; }
|
|
44
45
|
});
|
|
45
46
|
Object.defineProperty(exports, "useMediaQuery", {
|
|
46
47
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkDKGUOMBC_cjs.useMediaQuery; }
|
|
48
49
|
});
|
|
49
50
|
Object.defineProperty(exports, "useScrollSpy", {
|
|
50
51
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkDKGUOMBC_cjs.useScrollSpy; }
|
|
52
53
|
});
|
|
53
54
|
Object.defineProperty(exports, "useTheme", {
|
|
54
55
|
enumerable: true,
|
|
55
56
|
get: function () { return chunk2O7D6F67_cjs.useTheme; }
|
|
56
57
|
});
|
|
58
|
+
Object.defineProperty(exports, "useClickOutside", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () { return chunkIKMR2ADM_cjs.useClickOutside; }
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, "dragIndicatorClasses", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function () { return chunkYVPC65ZJ_cjs.dragIndicatorClasses; }
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "reorderIds", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () { return chunkYVPC65ZJ_cjs.reorderIds; }
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(exports, "useDragReorder", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () { return chunkYVPC65ZJ_cjs.useDragReorder; }
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(exports, "useLiveAnnouncement", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function () { return chunkYVPC65ZJ_cjs.useLiveAnnouncement; }
|
|
77
|
+
});
|
|
57
78
|
Object.defineProperty(exports, "usePrefersReducedMotion", {
|
|
58
79
|
enumerable: true,
|
|
59
80
|
get: function () { return chunk6HFFWEM3_cjs.usePrefersReducedMotion; }
|
|
@@ -66,9 +87,5 @@ Object.defineProperty(exports, "useEscapeKey", {
|
|
|
66
87
|
enumerable: true,
|
|
67
88
|
get: function () { return chunkFHY3K6PL_cjs.useEscapeKey; }
|
|
68
89
|
});
|
|
69
|
-
Object.defineProperty(exports, "useClickOutside", {
|
|
70
|
-
enumerable: true,
|
|
71
|
-
get: function () { return chunkIKMR2ADM_cjs.useClickOutside; }
|
|
72
|
-
});
|
|
73
90
|
//# sourceMappingURL=index.cjs.map
|
|
74
91
|
//# sourceMappingURL=index.cjs.map
|
package/dist/hooks/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { R as ResolvedTheme, T as Theme, u as useTheme } from '../useTheme-B9SWu6ui.cjs';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import { RefObject } from 'react';
|
|
3
4
|
|
|
4
5
|
interface UseScrollSpyOptions {
|
|
@@ -212,4 +213,64 @@ declare function useIsLargeDesktop(): boolean;
|
|
|
212
213
|
/** Returns true when viewport is smaller than 1024px (mobile/tablet) */
|
|
213
214
|
declare function useIsMobileOrTablet(): boolean;
|
|
214
215
|
|
|
215
|
-
|
|
216
|
+
/** Insert `draggedId` before/after `targetId` in `ids`. */
|
|
217
|
+
declare function reorderIds(ids: string[], draggedId: string, targetId: string, after: boolean): string[];
|
|
218
|
+
interface UseDragReorderOptions {
|
|
219
|
+
/** Current flat order of item ids (props order) */
|
|
220
|
+
ids: string[];
|
|
221
|
+
/** Called with the full new id order after a drop. Omit to disable dragging. */
|
|
222
|
+
onReorder?: (ids: string[]) => void;
|
|
223
|
+
/** Restrict drops, e.g. to the same status group */
|
|
224
|
+
canDropOn?: (draggedId: string, targetId: string) => boolean;
|
|
225
|
+
}
|
|
226
|
+
interface DragOverState {
|
|
227
|
+
id: string;
|
|
228
|
+
/** Drop indicator position relative to the hovered row */
|
|
229
|
+
after: boolean;
|
|
230
|
+
}
|
|
231
|
+
interface UseDragReorderReturn {
|
|
232
|
+
/** Whether drag reordering is active (onReorder provided) */
|
|
233
|
+
enabled: boolean;
|
|
234
|
+
/** Id currently being dragged, if any */
|
|
235
|
+
draggingId: string | null;
|
|
236
|
+
/** Row currently hovered as a drop target */
|
|
237
|
+
over: DragOverState | null;
|
|
238
|
+
/** Spread onto each row element (must be keyed by a stable id) */
|
|
239
|
+
rowProps: (id: string) => React.HTMLAttributes<HTMLElement>;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* HTML5 drag-and-drop list reordering. Rows spread `rowProps(id)`; on drop the
|
|
243
|
+
* hook computes the full new id order and reports it via `onReorder` — the
|
|
244
|
+
* consumer persists it (e.g. on the encounter/patient object) and feeds the
|
|
245
|
+
* list back in props order.
|
|
246
|
+
*
|
|
247
|
+
* Drag-and-drop is a pointer-only affordance: pair it with a keyboard
|
|
248
|
+
* alternative (e.g. move buttons / Alt+Arrow keys) for accessibility.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```tsx
|
|
252
|
+
* const drag = useDragReorder({ ids: items.map((i) => i.id), onReorder });
|
|
253
|
+
* // <li {...drag.rowProps(item.id)} className={cn(dragIndicatorClasses(drag, item.id))}>
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare function useDragReorder({ ids, onReorder, canDropOn, }: UseDragReorderOptions): UseDragReorderReturn;
|
|
257
|
+
/** Tailwind classes for the drag state of a row: drop indicator + dragging dim. */
|
|
258
|
+
declare function dragIndicatorClasses(drag: Pick<UseDragReorderReturn, 'draggingId' | 'over'>, id: string): string;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* State for an `aria-live` region that re-announces even when the same
|
|
262
|
+
* message is emitted twice in a row. Setting identical React state bails out
|
|
263
|
+
* (and identical DOM text isn't a mutation), so screen readers would stay
|
|
264
|
+
* silent for repeated actions like "moved down" — this clears the region
|
|
265
|
+
* first, then sets the message a tick later.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```tsx
|
|
269
|
+
* const [announcement, announce] = useLiveAnnouncement();
|
|
270
|
+
* // announce('Item moved down');
|
|
271
|
+
* // <div aria-live="polite" className="sr-only">{announcement}</div>
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
declare function useLiveAnnouncement(): [string, (message: string) => void];
|
|
275
|
+
|
|
276
|
+
export { type DragOverState, type KeyboardShortcutOptions, type UseDragReorderOptions, type UseDragReorderReturn, type UseScrollSpyOptions, type UseScrollSpyReturn, dragIndicatorClasses, reorderIds, useClickOutside, useCommandK, useDragReorder, useEscapeKey, useFocusTrap, useIsDesktop, useIsLargeDesktop, useIsMobile, useIsMobileOrTablet, useIsSmallTablet, useIsTablet, useKeyboardShortcut, useLiveAnnouncement, useMediaQuery, usePrefersReducedMotion, useScrollSpy };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { R as ResolvedTheme, T as Theme, u as useTheme } from '../useTheme-B9SWu6ui.js';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import { RefObject } from 'react';
|
|
3
4
|
|
|
4
5
|
interface UseScrollSpyOptions {
|
|
@@ -212,4 +213,64 @@ declare function useIsLargeDesktop(): boolean;
|
|
|
212
213
|
/** Returns true when viewport is smaller than 1024px (mobile/tablet) */
|
|
213
214
|
declare function useIsMobileOrTablet(): boolean;
|
|
214
215
|
|
|
215
|
-
|
|
216
|
+
/** Insert `draggedId` before/after `targetId` in `ids`. */
|
|
217
|
+
declare function reorderIds(ids: string[], draggedId: string, targetId: string, after: boolean): string[];
|
|
218
|
+
interface UseDragReorderOptions {
|
|
219
|
+
/** Current flat order of item ids (props order) */
|
|
220
|
+
ids: string[];
|
|
221
|
+
/** Called with the full new id order after a drop. Omit to disable dragging. */
|
|
222
|
+
onReorder?: (ids: string[]) => void;
|
|
223
|
+
/** Restrict drops, e.g. to the same status group */
|
|
224
|
+
canDropOn?: (draggedId: string, targetId: string) => boolean;
|
|
225
|
+
}
|
|
226
|
+
interface DragOverState {
|
|
227
|
+
id: string;
|
|
228
|
+
/** Drop indicator position relative to the hovered row */
|
|
229
|
+
after: boolean;
|
|
230
|
+
}
|
|
231
|
+
interface UseDragReorderReturn {
|
|
232
|
+
/** Whether drag reordering is active (onReorder provided) */
|
|
233
|
+
enabled: boolean;
|
|
234
|
+
/** Id currently being dragged, if any */
|
|
235
|
+
draggingId: string | null;
|
|
236
|
+
/** Row currently hovered as a drop target */
|
|
237
|
+
over: DragOverState | null;
|
|
238
|
+
/** Spread onto each row element (must be keyed by a stable id) */
|
|
239
|
+
rowProps: (id: string) => React.HTMLAttributes<HTMLElement>;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* HTML5 drag-and-drop list reordering. Rows spread `rowProps(id)`; on drop the
|
|
243
|
+
* hook computes the full new id order and reports it via `onReorder` — the
|
|
244
|
+
* consumer persists it (e.g. on the encounter/patient object) and feeds the
|
|
245
|
+
* list back in props order.
|
|
246
|
+
*
|
|
247
|
+
* Drag-and-drop is a pointer-only affordance: pair it with a keyboard
|
|
248
|
+
* alternative (e.g. move buttons / Alt+Arrow keys) for accessibility.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```tsx
|
|
252
|
+
* const drag = useDragReorder({ ids: items.map((i) => i.id), onReorder });
|
|
253
|
+
* // <li {...drag.rowProps(item.id)} className={cn(dragIndicatorClasses(drag, item.id))}>
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare function useDragReorder({ ids, onReorder, canDropOn, }: UseDragReorderOptions): UseDragReorderReturn;
|
|
257
|
+
/** Tailwind classes for the drag state of a row: drop indicator + dragging dim. */
|
|
258
|
+
declare function dragIndicatorClasses(drag: Pick<UseDragReorderReturn, 'draggingId' | 'over'>, id: string): string;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* State for an `aria-live` region that re-announces even when the same
|
|
262
|
+
* message is emitted twice in a row. Setting identical React state bails out
|
|
263
|
+
* (and identical DOM text isn't a mutation), so screen readers would stay
|
|
264
|
+
* silent for repeated actions like "moved down" — this clears the region
|
|
265
|
+
* first, then sets the message a tick later.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```tsx
|
|
269
|
+
* const [announcement, announce] = useLiveAnnouncement();
|
|
270
|
+
* // announce('Item moved down');
|
|
271
|
+
* // <div aria-live="polite" className="sr-only">{announcement}</div>
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
declare function useLiveAnnouncement(): [string, (message: string) => void];
|
|
275
|
+
|
|
276
|
+
export { type DragOverState, type KeyboardShortcutOptions, type UseDragReorderOptions, type UseDragReorderReturn, type UseScrollSpyOptions, type UseScrollSpyReturn, dragIndicatorClasses, reorderIds, useClickOutside, useCommandK, useDragReorder, useEscapeKey, useFocusTrap, useIsDesktop, useIsLargeDesktop, useIsMobile, useIsMobileOrTablet, useIsSmallTablet, useIsTablet, useKeyboardShortcut, useLiveAnnouncement, useMediaQuery, usePrefersReducedMotion, useScrollSpy };
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { useCommandK, useIsDesktop, useIsLargeDesktop, useIsMobile, useIsMobileOrTablet, useIsSmallTablet, useIsTablet, useKeyboardShortcut, useMediaQuery, useScrollSpy } from '../chunk-
|
|
1
|
+
export { useCommandK, useIsDesktop, useIsLargeDesktop, useIsMobile, useIsMobileOrTablet, useIsSmallTablet, useIsTablet, useKeyboardShortcut, useMediaQuery, useScrollSpy } from '../chunk-UVQEHZRF.js';
|
|
2
2
|
export { useTheme } from '../chunk-KJZNEVYM.js';
|
|
3
|
+
export { useClickOutside } from '../chunk-OKBR6PX4.js';
|
|
4
|
+
export { dragIndicatorClasses, reorderIds, useDragReorder, useLiveAnnouncement } from '../chunk-7ZVTLTJF.js';
|
|
3
5
|
export { usePrefersReducedMotion } from '../chunk-HB7C7NB5.js';
|
|
4
6
|
export { useFocusTrap } from '../chunk-4SMSH4OY.js';
|
|
5
7
|
export { useEscapeKey } from '../chunk-T4ME7QCT.js';
|
|
6
|
-
export { useClickOutside } from '../chunk-OKBR6PX4.js';
|
|
7
8
|
import '../chunk-VSQF22GL.js';
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
9
10
|
//# sourceMappingURL=index.js.map
|