@douglasneuroinformatics/libui 2.8.0 → 2.8.2
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/components/Form/StringField/StringFieldPassword.d.ts.map +1 -1
- package/dist/components/Form/StringField/StringFieldPassword.js +1 -1
- package/dist/douglasneuroinformatics-libui-2.8.2.tgz +0 -0
- package/dist/styles/globals.css +1 -0
- package/dist/testing/mocks.js +1 -1
- package/package.json +18 -13
- package/src/components/DatePicker/DatePicker.tsx +1 -1
- package/src/components/Form/FieldsComponent.tsx +1 -1
- package/src/components/Form/NumberRecordField.tsx +1 -1
- package/src/components/Form/RecordArrayField.tsx +2 -2
- package/src/components/Form/StringField/StringFieldPassword.tsx +2 -1
- package/src/components/Form/utils.ts +1 -1
- package/src/hooks/useNotificationsStore.test.ts +1 -1
- package/src/i18n.ts +2 -2
- package/src/styles/globals.css +1 -0
- package/src/testing/mocks.ts +1 -1
- package/dist/douglasneuroinformatics-libui-2.8.0.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringFieldPassword.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/StringField/StringFieldPassword.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AASjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,MAAM,MAAM,qBAAqB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEtD,MAAM,MAAM,wBAAwB,GAAG,uBAAuB,CAAC,MAAM,CAAC,GACpE,OAAO,CAAC,eAAe,EAAE;IAAE,OAAO,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC;AAEpD,eAAO,MAAM,mBAAmB,sFAS7B,wBAAwB,
|
|
1
|
+
{"version":3,"file":"StringFieldPassword.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/StringField/StringFieldPassword.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AASjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,MAAM,MAAM,qBAAqB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEtD,MAAM,MAAM,wBAAwB,GAAG,uBAAuB,CAAC,MAAM,CAAC,GACpE,OAAO,CAAC,eAAe,EAAE;IAAE,OAAO,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC;AAEpD,eAAO,MAAM,mBAAmB,sFAS7B,wBAAwB,sBAuD1B,CAAC"}
|
|
@@ -22,7 +22,7 @@ export const StringFieldPassword = ({ calculateStrength, description, error, lab
|
|
|
22
22
|
React.createElement("button", { className: "absolute right-0 flex h-full w-8 items-center justify-center text-muted-foreground", disabled: readOnly, tabIndex: -1, type: "button", onClick: () => setShow(!show) },
|
|
23
23
|
React.createElement(EyeIcon, { className: cn('absolute transition-all', show ? '-rotate-90 scale-0' : 'rotate-0 scale-100') }),
|
|
24
24
|
React.createElement(EyeOffIcon, { className: cn('absolute transition-all', !show ? 'rotate-90 scale-0' : 'rotate-0 scale-100') }))),
|
|
25
|
-
strength !== null && (React.createElement(motion.div, { animate: { width: `${strength * 25}%` }, className: "h-1 w-full overflow-hidden rounded", transition: { duration: 0.5 } },
|
|
25
|
+
strength !== null && (React.createElement(motion.div, { animate: { width: `${Math.max(strength, value?.length ? 1 : 0) * 25}%` }, className: "h-1 w-full overflow-hidden rounded", initial: { width: '0%' }, transition: { duration: 0.5 } },
|
|
26
26
|
React.createElement("div", { className: cn('h-full w-full bg-destructive transition-colors duration-500', strength === 2 && 'bg-yellow-500 dark:bg-yellow-700', strength === 3 && 'bg-sky-500 dark:bg-sky-700', strength === 4 && 'bg-green-500 dark:bg-green-700') }))),
|
|
27
27
|
React.createElement(FieldGroup.Error, { error: error })));
|
|
28
28
|
};
|
|
Binary file
|
package/dist/styles/globals.css
CHANGED
package/dist/testing/mocks.js
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douglasneuroinformatics/libui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.8.
|
|
4
|
+
"version": "2.8.2",
|
|
5
5
|
"packageManager": "pnpm@9.3.0",
|
|
6
|
-
"description": "Generic UI components for DNP projects, built using React and
|
|
7
|
-
"author":
|
|
8
|
-
"name": "Douglas Neuroinformatics",
|
|
9
|
-
"email": "support@douglasneuroinformatics.ca"
|
|
10
|
-
},
|
|
6
|
+
"description": "Generic UI components for DNP projects, built using React and Tailwind CSS",
|
|
7
|
+
"author": "Joshua Unrau",
|
|
11
8
|
"license": "Apache-2.0",
|
|
12
9
|
"homepage": "https://github.com/DouglasNeuroInformatics/libui#readme",
|
|
13
10
|
"repository": {
|
|
14
11
|
"type": "git",
|
|
15
|
-
"url": "
|
|
12
|
+
"url": "https://github.com/DouglasNeuroInformatics/libui"
|
|
16
13
|
},
|
|
17
14
|
"bugs": {
|
|
18
15
|
"url": "https://github.com/DouglasNeuroInformatics/libui/issues"
|
|
@@ -116,11 +113,10 @@
|
|
|
116
113
|
"devDependencies": {
|
|
117
114
|
"@commitlint/cli": "^19.3.0",
|
|
118
115
|
"@commitlint/config-conventional": "^19.2.2",
|
|
119
|
-
"@commitlint/types": "^19.0.3",
|
|
120
116
|
"@douglasneuroinformatics/eslint-config": "^4.2.2",
|
|
121
|
-
"@
|
|
122
|
-
"@semantic-release
|
|
123
|
-
"@
|
|
117
|
+
"@douglasneuroinformatics/prettier-config": "^0.0.1",
|
|
118
|
+
"@douglasneuroinformatics/semantic-release": "^0.0.1",
|
|
119
|
+
"@douglasneuroinformatics/tsconfig": "^1.0.1",
|
|
124
120
|
"@storybook/addon-essentials": "^8.1.6",
|
|
125
121
|
"@storybook/addon-interactions": "^8.1.6",
|
|
126
122
|
"@storybook/addon-links": "^8.1.6",
|
|
@@ -147,9 +143,8 @@
|
|
|
147
143
|
"husky": "^9.0.11",
|
|
148
144
|
"jsdom": "24.1.0",
|
|
149
145
|
"postcss": "^8.4.38",
|
|
150
|
-
"prettier": "^3.3.
|
|
146
|
+
"prettier": "^3.3.2",
|
|
151
147
|
"prettier-plugin-tailwindcss": "^0.6.2",
|
|
152
|
-
"semantic-release": "^23.0.8",
|
|
153
148
|
"sort-json": "^2.0.1",
|
|
154
149
|
"storybook": "^8.1.6",
|
|
155
150
|
"storybook-react-i18next": "^3.1.1",
|
|
@@ -157,5 +152,15 @@
|
|
|
157
152
|
"typescript": "~5.4.5",
|
|
158
153
|
"vite": "5.2.13",
|
|
159
154
|
"vitest": "^1.6.0"
|
|
155
|
+
},
|
|
156
|
+
"commitlint": {
|
|
157
|
+
"extends": [
|
|
158
|
+
"@commitlint/config-conventional"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"release": {
|
|
162
|
+
"extends": [
|
|
163
|
+
"@douglasneuroinformatics/semantic-release"
|
|
164
|
+
]
|
|
160
165
|
}
|
|
161
166
|
}
|
|
@@ -72,7 +72,7 @@ export const DatePicker = React.forwardRef<React.ElementRef<typeof Card>, DatePi
|
|
|
72
72
|
// the duration is doubled because presumably it is to mount old and mount new
|
|
73
73
|
const [canSetMonth, setCanSetMonth] = useState(true);
|
|
74
74
|
|
|
75
|
-
const monthName = t(`months.${MONTHS[date.getMonth()]}`);
|
|
75
|
+
const monthName = t(`months.${MONTHS[date.getMonth()]!}`);
|
|
76
76
|
|
|
77
77
|
const handleYearSelection = (date: Date) => {
|
|
78
78
|
dispatch({ type: 'set-year', value: date.getFullYear() });
|
|
@@ -19,7 +19,7 @@ export type FieldsComponentProps<T extends FormDataType> = {
|
|
|
19
19
|
/** Renders an object containing key value pairs, where the value is a FormField of some kind */
|
|
20
20
|
export const FieldsComponent = <T extends FormDataType>({ fields, ...props }: FieldsComponentProps<T>) => {
|
|
21
21
|
return Object.keys(fields).map((name) => {
|
|
22
|
-
const field = fields[name]
|
|
22
|
+
const field = fields[name]!;
|
|
23
23
|
if (field.kind === 'dynamic') {
|
|
24
24
|
return <DynamicField {...props} field={field} key={name} name={name} />;
|
|
25
25
|
}
|
|
@@ -41,7 +41,7 @@ export const NumberRecordField = <T extends NumberRecordFieldValue = NumberRecor
|
|
|
41
41
|
</Heading>
|
|
42
42
|
<div className="space-y-6">
|
|
43
43
|
{Object.keys(items).map((name) => {
|
|
44
|
-
const item = items[name]
|
|
44
|
+
const item = items[name]!;
|
|
45
45
|
return (
|
|
46
46
|
<NumberField
|
|
47
47
|
error={recordError?.[name]}
|
|
@@ -73,12 +73,12 @@ export const RecordArrayField = memo(function RecordArrayField({
|
|
|
73
73
|
if (!newArrayError[i]) {
|
|
74
74
|
newArrayError[i] = {};
|
|
75
75
|
}
|
|
76
|
-
newArrayError[i][name] = error;
|
|
76
|
+
newArrayError[i]![name] = error;
|
|
77
77
|
setArrayError(newArrayError);
|
|
78
78
|
}}
|
|
79
79
|
setValue={(value) => {
|
|
80
80
|
const newArrayValue = [...arrayValue];
|
|
81
|
-
newArrayValue[i][name] = value;
|
|
81
|
+
newArrayValue[i]![name] = value;
|
|
82
82
|
setArrayValue(newArrayValue);
|
|
83
83
|
}}
|
|
84
84
|
value={arrayValue?.[i]?.[name]}
|
|
@@ -62,8 +62,9 @@ export const StringFieldPassword = ({
|
|
|
62
62
|
</FieldGroup.Row>
|
|
63
63
|
{strength !== null && (
|
|
64
64
|
<motion.div
|
|
65
|
-
animate={{ width: `${strength * 25}%` }}
|
|
65
|
+
animate={{ width: `${Math.max(strength, value?.length ? 1 : 0) * 25}%` }}
|
|
66
66
|
className="h-1 w-full overflow-hidden rounded"
|
|
67
|
+
initial={{ width: '0%' }}
|
|
67
68
|
transition={{ duration: 0.5 }}
|
|
68
69
|
>
|
|
69
70
|
<div
|
|
@@ -28,7 +28,7 @@ export function getFormFields<T extends FormDataType>(content: FormContent<T>):
|
|
|
28
28
|
if (!Array.isArray(content)) {
|
|
29
29
|
return content;
|
|
30
30
|
}
|
|
31
|
-
return content.reduce((prev, current) => ({ ...prev, ...current.fields }), content[0]
|
|
31
|
+
return content.reduce((prev, current) => ({ ...prev, ...current.fields }), content[0]!.fields) as FormFields<T>;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -23,7 +23,7 @@ describe('useNotificationsStore', () => {
|
|
|
23
23
|
expect(result.current.notifications.length).toBe(1);
|
|
24
24
|
expect(result.current.notifications[0]).toMatchObject({ message: 'test' });
|
|
25
25
|
act(() => {
|
|
26
|
-
result.current.dismissNotification(result.current.notifications[0]
|
|
26
|
+
result.current.dismissNotification(result.current.notifications[0]!.id);
|
|
27
27
|
});
|
|
28
28
|
expect(result.current.notifications.length).toBe(0);
|
|
29
29
|
});
|
package/src/i18n.ts
CHANGED
|
@@ -69,8 +69,8 @@ i18n.addPreInitTranslations = function (this, translations) {
|
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
const resources = createResources(translations);
|
|
72
|
-
Object.assign(this.options.resources.en
|
|
73
|
-
Object.assign(this.options.resources.fr
|
|
72
|
+
Object.assign(this.options.resources.en!, resources.en);
|
|
73
|
+
Object.assign(this.options.resources.fr!, resources.fr);
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
i18n.use(initReactI18next).use(LanguageDetector);
|
package/src/styles/globals.css
CHANGED
package/src/testing/mocks.ts
CHANGED
|
Binary file
|