@cxxi-lab/hubbyware-ui 0.0.0-stage → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/fonts/Fredoka/Fredoka-SemiBold.woff2 +0 -0
- package/fonts/Fredoka/OFL.txt +93 -0
- package/fonts/MerriweatherSans/MerriweatherSans-Bold.woff +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-Bold.woff2 +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-BoldItalic.woff +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-BoldItalic.woff2 +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-ExtraBold.woff +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-ExtraBold.woff2 +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-ExtraBoldItalic.woff +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-ExtraBoldItalic.woff2 +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-Italic.woff +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-Italic.woff2 +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-Light.woff +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-Light.woff2 +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-LightItalic.woff +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-LightItalic.woff2 +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-Medium.woff +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-Medium.woff2 +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-MediumItalic.woff +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-MediumItalic.woff2 +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-Regular.woff +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-Regular.woff2 +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-SemiBold.woff +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-SemiBold.woff2 +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-SemiBoldItalic.woff +0 -0
- package/fonts/MerriweatherSans/MerriweatherSans-SemiBoldItalic.woff2 +0 -0
- package/fonts/Sofia/Sofia-Regular.woff +0 -0
- package/fonts/Sofia/Sofia-Regular.woff2 +0 -0
- package/package.json +46 -5
- package/src/Brand/Brand.tsx +23 -0
- package/src/Brand/Brand.types.ts +6 -0
- package/src/Brand/Brand.variants.ts +10 -0
- package/src/Brand/HubLogo.tsx +23 -0
- package/src/Brand/index.ts +2 -0
- package/src/back.ts +52 -0
- package/src/buttons/Button/Button.tsx +38 -0
- package/src/buttons/Button/Button.types.ts +18 -0
- package/src/buttons/Button/Button.variants.ts +36 -0
- package/src/buttons/Button/index.ts +2 -0
- package/src/buttons/FavButton/FavButton.tsx +29 -0
- package/src/buttons/FavButton/FavButton.types.ts +10 -0
- package/src/buttons/FavButton/FavButton.variants.ts +12 -0
- package/src/buttons/FavButton/index.ts +2 -0
- package/src/buttons/IconButton/IconButton.tsx +40 -0
- package/src/buttons/IconButton/IconButton.types.ts +23 -0
- package/src/buttons/IconButton/IconButton.variants.ts +56 -0
- package/src/buttons/IconButton/index.ts +2 -0
- package/src/buttons/index.ts +3 -0
- package/src/contexts/FormContext.tsx +57 -0
- package/src/forms/CheckboxField/Checkbox.tsx +17 -0
- package/src/forms/CheckboxField/CheckboxField.tsx +39 -0
- package/src/forms/CheckboxField/CheckboxField.types.ts +5 -0
- package/src/forms/CheckboxField/CheckboxField.variants.ts +36 -0
- package/src/forms/CheckboxField/index.ts +3 -0
- package/src/forms/DropdownField/DropdownField.tsx +72 -0
- package/src/forms/DropdownField/DropdownField.types.ts +11 -0
- package/src/forms/DropdownField/DropdownField.variants.ts +37 -0
- package/src/forms/DropdownField/index.ts +2 -0
- package/src/forms/Form/Form.tsx +41 -0
- package/src/forms/Form/Form.types.ts +11 -0
- package/src/forms/Form/Form.variants.ts +8 -0
- package/src/forms/Form/index.ts +2 -0
- package/src/forms/FormField/FormField.tsx +26 -0
- package/src/forms/FormField/FormField.types.ts +10 -0
- package/src/forms/FormField/FormField.variants.ts +44 -0
- package/src/forms/FormField/index.ts +3 -0
- package/src/forms/InputField/InputField.tsx +33 -0
- package/src/forms/InputField/InputField.types.ts +14 -0
- package/src/forms/InputField/InputField.variants.ts +14 -0
- package/src/forms/InputField/index.ts +2 -0
- package/src/forms/SpoilerField/SpoilerField.tsx +48 -0
- package/src/forms/SpoilerField/SpoilerField.types.ts +8 -0
- package/src/forms/SpoilerField/SpoilerField.variants.ts +31 -0
- package/src/forms/SpoilerField/index.ts +2 -0
- package/src/forms/SwitchField/ChoiceSwitch.tsx +43 -0
- package/src/forms/SwitchField/Switch.tsx +18 -0
- package/src/forms/SwitchField/SwitchField.tsx +43 -0
- package/src/forms/SwitchField/SwitchField.types.ts +5 -0
- package/src/forms/SwitchField/SwitchField.variants.ts +62 -0
- package/src/forms/SwitchField/index.ts +4 -0
- package/src/forms/TagsField/TagsField.tsx +109 -0
- package/src/forms/TagsField/TagsField.types.ts +7 -0
- package/src/forms/TagsField/TagsField.variants.ts +51 -0
- package/src/forms/TagsField/index.ts +2 -0
- package/src/forms/TextareaField/TextareaField.tsx +33 -0
- package/src/forms/TextareaField/TextareaField.types.ts +9 -0
- package/src/forms/TextareaField/TextareaField.variants.ts +14 -0
- package/src/forms/TextareaField/index.ts +2 -0
- package/src/forms/UploadField/UploadField.tsx +70 -0
- package/src/forms/UploadField/UploadField.types.ts +7 -0
- package/src/forms/UploadField/UploadField.variants.ts +23 -0
- package/src/forms/UploadField/index.ts +2 -0
- package/src/forms/index.ts +10 -0
- package/src/index.ts +15 -0
- package/src/menus/Dropdown/Dropdown.tsx +39 -0
- package/src/menus/Dropdown/Dropdown.types.ts +17 -0
- package/src/menus/Dropdown/Dropdown.variants.ts +44 -0
- package/src/menus/Dropdown/index.ts +2 -0
- package/src/menus/index.ts +1 -0
- package/src/modals/ConfirmationModal/ConfirmationModal.tsx +44 -0
- package/src/modals/ConfirmationModal/ConfirmationModal.types.ts +14 -0
- package/src/modals/ConfirmationModal/ConfirmationModal.variants.ts +6 -0
- package/src/modals/ConfirmationModal/index.ts +2 -0
- package/src/modals/FormModal/FormModal.tsx +46 -0
- package/src/modals/FormModal/FormModal.types.ts +14 -0
- package/src/modals/FormModal/FormModal.variants.ts +5 -0
- package/src/modals/FormModal/index.ts +2 -0
- package/src/modals/InfoModal/InfoModal.tsx +21 -0
- package/src/modals/InfoModal/InfoModal.types.ts +10 -0
- package/src/modals/InfoModal/InfoModal.variants.ts +6 -0
- package/src/modals/InfoModal/index.ts +2 -0
- package/src/modals/Modal/Modal.tsx +34 -0
- package/src/modals/Modal/Modal.types.ts +10 -0
- package/src/modals/Modal/Modal.variants.ts +48 -0
- package/src/modals/Modal/index.ts +2 -0
- package/src/modals/index.ts +4 -0
- package/src/navs/BreadCrumb/BreadCrumb.tsx +19 -0
- package/src/navs/BreadCrumb/BreadCrumb.types.ts +11 -0
- package/src/navs/BreadCrumb/BreadCrumb.variants.ts +7 -0
- package/src/navs/BreadCrumb/index.ts +2 -0
- package/src/navs/index.ts +1 -0
- package/src/tables/Table/Table.tsx +6 -0
- package/src/tables/Table/Table.types.ts +6 -0
- package/src/tables/Table/Table.variants.ts +5 -0
- package/src/tables/Table/index.ts +2 -0
- package/src/tables/TableCell/TableCell.tsx +27 -0
- package/src/tables/TableCell/TableCell.types.ts +9 -0
- package/src/tables/TableCell/TableCell.variants.ts +26 -0
- package/src/tables/TableCell/index.ts +2 -0
- package/src/tables/TableFootGroup/TableFootGroup.tsx +10 -0
- package/src/tables/TableFootGroup/TableFootGroup.variants.ts +6 -0
- package/src/tables/TableFootGroup/index.ts +1 -0
- package/src/tables/TableHead/TableHead.tsx +22 -0
- package/src/tables/TableHead/TableHead.types.ts +9 -0
- package/src/tables/TableHead/TableHead.variants.ts +16 -0
- package/src/tables/TableHead/index.ts +2 -0
- package/src/tables/TableHeadGroup/TableHeadGroup.tsx +10 -0
- package/src/tables/TableHeadGroup/TableHeadGroup.variants.ts +6 -0
- package/src/tables/TableHeadGroup/index.ts +1 -0
- package/src/tables/TableRow/TableRow.tsx +7 -0
- package/src/tables/TableRow/TableRow.types.ts +7 -0
- package/src/tables/TableRow/TableRow.variants.ts +12 -0
- package/src/tables/TableRow/index.ts +2 -0
- package/src/tables/TableRowGroup/TableRowGroup.tsx +6 -0
- package/src/tables/TableRowGroup/TableRowGroup.variants.ts +5 -0
- package/src/tables/TableRowGroup/index.ts +1 -0
- package/src/tables/index.ts +7 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/snakeCase.ts +6 -0
- package/src/utils/useClickOutside.ts +16 -0
- package/src/utils/useMediaQuery.ts +11 -0
- package/src/utils/withLoading.ts +13 -0
- package/styles/fonts.css +125 -0
- package/styles/theme.css +237 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Louis-Antoine Lumet
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2016 The Fredoka Project Authors (https://github.com/hafontia/Fredoka-One)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@cxxi-lab/hubbyware-ui",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Hubbyware's design system: React components, design tokens and fonts (formerly @cxxi-lab/hub-ui).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": [
|
|
8
|
+
"*.css"
|
|
9
|
+
],
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./src/index.ts",
|
|
12
|
+
"./theme.css": "./styles/theme.css",
|
|
13
|
+
"./fonts.css": "./styles/fonts.css",
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"src",
|
|
18
|
+
"styles",
|
|
19
|
+
"fonts",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"typecheck": "tsc --noEmit"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/cxxi-lab/hubbyware-ui.git",
|
|
28
|
+
"directory": "packages/hubbyware-ui"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"tailwind-merge": "^3.6.0",
|
|
35
|
+
"tailwind-variants": "^3.2.2"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
39
|
+
"@fortawesome/free-solid-svg-icons": "^7.2.0",
|
|
40
|
+
"@fortawesome/react-fontawesome": "^3.3.1",
|
|
41
|
+
"react": "^19.2.4",
|
|
42
|
+
"react-dom": "^19.2.4",
|
|
43
|
+
"react-router": "^7.18.3",
|
|
44
|
+
"tailwind-scrollbar": "^4.0.2",
|
|
45
|
+
"tailwindcss": "^4.3.0"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Link } from 'react-router'
|
|
2
|
+
import { HubLogo } from './HubLogo'
|
|
3
|
+
import { type BrandProps } from './Brand.types'
|
|
4
|
+
import { styles } from './Brand.variants'
|
|
5
|
+
|
|
6
|
+
export function Brand({ to, onClick }: BrandProps) {
|
|
7
|
+
const content = (
|
|
8
|
+
<>
|
|
9
|
+
<HubLogo className={styles.icon()} />
|
|
10
|
+
<span className={styles.text()}>hubbyware</span>
|
|
11
|
+
</>
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
if (to) {
|
|
15
|
+
return (
|
|
16
|
+
<Link to={to} onClick={onClick} className={`${styles.wrap()} cursor-pointer`}>
|
|
17
|
+
{content}
|
|
18
|
+
</Link>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return <div className={styles.wrap()}>{content}</div>
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants'
|
|
2
|
+
|
|
3
|
+
export const styles = {
|
|
4
|
+
wrap: tv({
|
|
5
|
+
// the family here, the weight on the word (tailwind-merge takes the two for one group)
|
|
6
|
+
base: 'inline-flex items-center gap-1.5 px-1 text-2xl font-["Fredoka"] select-none outline-none'
|
|
7
|
+
}),
|
|
8
|
+
icon: tv({ base: 'size-6' }),
|
|
9
|
+
text: tv({ base: 'brand-gradient font-semibold lowercase tracking-[-0.01em]' })
|
|
10
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useId } from 'react'
|
|
2
|
+
|
|
3
|
+
/** The Hubbyware mark (inline: the package needs no SVG loader in its consumers' bundler), in the accent colour. */
|
|
4
|
+
export function HubLogo({ className }: { className?: string }) {
|
|
5
|
+
const gradient = `hub-logo-${useId()}`
|
|
6
|
+
return (
|
|
7
|
+
<svg className={className} width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
8
|
+
<path
|
|
9
|
+
fillRule="evenodd"
|
|
10
|
+
clipRule="evenodd"
|
|
11
|
+
d="M32 100.641C32 68.391 54.1651 41.3515 84 34.1102V1.28125C36.3772 8.98855 0 50.5392 0 100.641C0 150.742 36.3772 192.293 84 200V167.171C54.1651 159.93 32 132.89 32 100.641ZM200 100.641C200 150.742 163.623 192.293 116 200V167.171C145.835 159.93 168 132.89 168 100.641C168 68.391 145.835 41.3515 116 34.1102V1.28125C163.623 8.98855 200 50.5392 200 100.641Z"
|
|
12
|
+
fill={`url(#${gradient})`}
|
|
13
|
+
/>
|
|
14
|
+
<defs>
|
|
15
|
+
<linearGradient id={gradient} x1="157.5" y1="33.0763" x2="44.7421" y2="148.561" gradientUnits="userSpaceOnUse">
|
|
16
|
+
{/* the accent's (styles/theme.css), the blue without one */}
|
|
17
|
+
<stop offset="0.0509862" style={{ stopColor: 'var(--color-brand-300, oklch(77.48% 0.1158 256.78))' }} />
|
|
18
|
+
<stop offset="1" style={{ stopColor: 'var(--color-brand-500, oklch(69.57% 0.1612 257.18))' }} />
|
|
19
|
+
</linearGradient>
|
|
20
|
+
</defs>
|
|
21
|
+
</svg>
|
|
22
|
+
)
|
|
23
|
+
}
|
package/src/back.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The phone's back button (Android): it closes what is open on top (a menu, a modal, the hubby
|
|
5
|
+
* drawer…), most recent first; with nothing open, it goes back a page; on the home page, the app
|
|
6
|
+
* goes to the background. The host wires handleBack() to its back button (the app: window.hubBack,
|
|
7
|
+
* called by the Android shell, which does the last part itself when it answers false).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const handlers: Array<{ close: () => void }> = []
|
|
11
|
+
const depthListeners = new Set<(depth: number) => void>()
|
|
12
|
+
const changed = () => depthListeners.forEach(l => l(handlers.length))
|
|
13
|
+
|
|
14
|
+
/** How many things the back button would close, now and on each change (a hubby's frame tells its host). */
|
|
15
|
+
export function onBackDepth(listener: (depth: number) => void): () => void {
|
|
16
|
+
depthListeners.add(listener)
|
|
17
|
+
listener(handlers.length)
|
|
18
|
+
return () => { depthListeners.delete(listener) }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** While `open`, the back button closes this (onClose). */
|
|
22
|
+
export function useBackHandler(open: boolean, onClose: () => void): void {
|
|
23
|
+
const latest = useRef(onClose)
|
|
24
|
+
latest.current = onClose
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!open) return
|
|
27
|
+
const entry = { close: () => latest.current() }
|
|
28
|
+
handlers.push(entry)
|
|
29
|
+
changed()
|
|
30
|
+
return () => {
|
|
31
|
+
const at = handlers.indexOf(entry)
|
|
32
|
+
if (at >= 0) handlers.splice(at, 1)
|
|
33
|
+
changed()
|
|
34
|
+
}
|
|
35
|
+
}, [open])
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The back button: true when handled here (something closed, or a page back). */
|
|
39
|
+
export function handleBack(): boolean {
|
|
40
|
+
const top = handlers.pop()
|
|
41
|
+
if (top) {
|
|
42
|
+
changed()
|
|
43
|
+
top.close()
|
|
44
|
+
return true
|
|
45
|
+
}
|
|
46
|
+
const at = window.location.hash.replace(/^#/, '') || '/'
|
|
47
|
+
if (at !== '/' && window.history.length > 1) {
|
|
48
|
+
window.history.back()
|
|
49
|
+
return true
|
|
50
|
+
}
|
|
51
|
+
return false
|
|
52
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
2
|
+
import { faCircleNotch } from '@fortawesome/free-solid-svg-icons'
|
|
3
|
+
import { twMerge } from 'tailwind-merge'
|
|
4
|
+
import { type ButtonProps } from './Button.types'
|
|
5
|
+
import { styles } from './Button.variants'
|
|
6
|
+
|
|
7
|
+
export function Button({
|
|
8
|
+
label,
|
|
9
|
+
children,
|
|
10
|
+
icon,
|
|
11
|
+
onClick,
|
|
12
|
+
className,
|
|
13
|
+
color,
|
|
14
|
+
isDisabled = false,
|
|
15
|
+
isLoading = false,
|
|
16
|
+
type = 'button',
|
|
17
|
+
...rest
|
|
18
|
+
}: ButtonProps) {
|
|
19
|
+
const classList = twMerge(styles.button({ disabled: isDisabled, color }), className)
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<button
|
|
23
|
+
type={type}
|
|
24
|
+
className={classList}
|
|
25
|
+
onClick={onClick}
|
|
26
|
+
disabled={isDisabled || isLoading}
|
|
27
|
+
{...rest}
|
|
28
|
+
>
|
|
29
|
+
{isLoading
|
|
30
|
+
? <FontAwesomeIcon icon={faCircleNotch} className="animate-spin" />
|
|
31
|
+
: <>
|
|
32
|
+
{icon && <FontAwesomeIcon icon={icon} />}
|
|
33
|
+
{label ?? children}
|
|
34
|
+
</>
|
|
35
|
+
}
|
|
36
|
+
</button>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type IconDefinition } from '@fortawesome/fontawesome-svg-core'
|
|
2
|
+
import { type MouseEventHandler, type ReactNode } from 'react'
|
|
3
|
+
|
|
4
|
+
export type ButtonColor = 'primary' | 'secondary' | 'danger'
|
|
5
|
+
|
|
6
|
+
export interface ButtonProps {
|
|
7
|
+
label?: ReactNode
|
|
8
|
+
children?: ReactNode
|
|
9
|
+
icon?: IconDefinition
|
|
10
|
+
color?: ButtonColor
|
|
11
|
+
isDisabled?: boolean
|
|
12
|
+
isLoading?: boolean
|
|
13
|
+
className?: string
|
|
14
|
+
onClick?: MouseEventHandler<HTMLButtonElement>
|
|
15
|
+
type?: 'button' | 'submit' | 'reset'
|
|
16
|
+
title?: string
|
|
17
|
+
'aria-label'?: string
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants'
|
|
2
|
+
|
|
3
|
+
export const styles = {
|
|
4
|
+
button: tv({
|
|
5
|
+
base: [
|
|
6
|
+
'inline-flex',
|
|
7
|
+
'items-center',
|
|
8
|
+
'justify-center',
|
|
9
|
+
'gap-2',
|
|
10
|
+
'px-4',
|
|
11
|
+
'h-9',
|
|
12
|
+
'rounded',
|
|
13
|
+
'text-sm',
|
|
14
|
+
'font-semibold',
|
|
15
|
+
'leading-none',
|
|
16
|
+
// a label on one line, the button never squeezed by its neighbours (a narrow header)
|
|
17
|
+
'whitespace-nowrap',
|
|
18
|
+
'shrink-0',
|
|
19
|
+
'cursor-pointer',
|
|
20
|
+
'transition'
|
|
21
|
+
],
|
|
22
|
+
variants: {
|
|
23
|
+
color: {
|
|
24
|
+
primary: 'bg-primary-500 text-steel-950 hover:bg-primary-300',
|
|
25
|
+
secondary: 'bg-steel-800 text-steel-100 hover:bg-steel-700 hover:text-white',
|
|
26
|
+
danger: 'bg-red-500 text-steel-950 hover:bg-red-300'
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
true: 'opacity-25 pointer-events-none'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
color: 'primary'
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import { faStar } from '@fortawesome/free-solid-svg-icons'
|
|
3
|
+
import { IconButton } from '../IconButton'
|
|
4
|
+
import { type FavButtonProps } from './FavButton.types'
|
|
5
|
+
import { styles } from './FavButton.variants'
|
|
6
|
+
|
|
7
|
+
export function FavButton({ initialState = false, onClick, size, className, ...rest }: FavButtonProps) {
|
|
8
|
+
const [favorite, setFavorite] = useState(initialState)
|
|
9
|
+
|
|
10
|
+
useEffect(() => setFavorite(initialState), [initialState])
|
|
11
|
+
|
|
12
|
+
const handleClick = () => {
|
|
13
|
+
const next = !favorite
|
|
14
|
+
setFavorite(next)
|
|
15
|
+
onClick?.(next)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<IconButton
|
|
20
|
+
icon={faStar}
|
|
21
|
+
color="secondary"
|
|
22
|
+
shape="square"
|
|
23
|
+
size={size}
|
|
24
|
+
onClick={handleClick}
|
|
25
|
+
className={[styles.button({ favorite }), className].filter(Boolean).join(' ')}
|
|
26
|
+
{...rest}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
2
|
+
import { faCircleNotch } from '@fortawesome/free-solid-svg-icons'
|
|
3
|
+
import { twMerge } from 'tailwind-merge'
|
|
4
|
+
import { type IconButtonProps } from './IconButton.types'
|
|
5
|
+
import { styles } from './IconButton.variants'
|
|
6
|
+
|
|
7
|
+
export function IconButton({
|
|
8
|
+
icon,
|
|
9
|
+
onClick,
|
|
10
|
+
className,
|
|
11
|
+
active = false,
|
|
12
|
+
highlighted = false,
|
|
13
|
+
isDisabled = false,
|
|
14
|
+
isLoading = false,
|
|
15
|
+
color,
|
|
16
|
+
shape,
|
|
17
|
+
size,
|
|
18
|
+
type = 'button',
|
|
19
|
+
...rest
|
|
20
|
+
}: IconButtonProps) {
|
|
21
|
+
const classList = twMerge(
|
|
22
|
+
styles.button({ active, highlighted, disabled: isDisabled, color, shape, size }),
|
|
23
|
+
className
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<button
|
|
28
|
+
type={type}
|
|
29
|
+
className={classList}
|
|
30
|
+
onClick={onClick}
|
|
31
|
+
disabled={isDisabled || isLoading}
|
|
32
|
+
{...rest}
|
|
33
|
+
>
|
|
34
|
+
<FontAwesomeIcon
|
|
35
|
+
icon={isLoading ? faCircleNotch : icon}
|
|
36
|
+
className={styles.icon({ loading: isLoading })}
|
|
37
|
+
/>
|
|
38
|
+
</button>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type IconDefinition } from '@fortawesome/fontawesome-svg-core'
|
|
2
|
+
import { type MouseEventHandler } from 'react'
|
|
3
|
+
|
|
4
|
+
export type IconButtonColor = 'primary' | 'secondary' | 'danger' | 'dark'
|
|
5
|
+
export type IconButtonShape = 'square' | 'circle'
|
|
6
|
+
export type IconButtonSize = 'xxs' | 'xs' | 'sm' | 'md' | 'xl'
|
|
7
|
+
|
|
8
|
+
export interface IconButtonProps {
|
|
9
|
+
icon: IconDefinition
|
|
10
|
+
onClick?: MouseEventHandler<HTMLButtonElement>
|
|
11
|
+
className?: string
|
|
12
|
+
active?: boolean
|
|
13
|
+
highlighted?: boolean
|
|
14
|
+
isDisabled?: boolean
|
|
15
|
+
isLoading?: boolean
|
|
16
|
+
color?: IconButtonColor
|
|
17
|
+
shape?: IconButtonShape
|
|
18
|
+
size?: IconButtonSize
|
|
19
|
+
type?: 'button' | 'submit' | 'reset'
|
|
20
|
+
title?: string
|
|
21
|
+
'aria-label'?: string
|
|
22
|
+
'aria-expanded'?: boolean
|
|
23
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants'
|
|
2
|
+
|
|
3
|
+
export const styles = {
|
|
4
|
+
button: tv({
|
|
5
|
+
base: [
|
|
6
|
+
'inline-flex',
|
|
7
|
+
'justify-center',
|
|
8
|
+
'items-center',
|
|
9
|
+
'aspect-square',
|
|
10
|
+
'font-semibold',
|
|
11
|
+
'leading-none',
|
|
12
|
+
'cursor-pointer',
|
|
13
|
+
'transition'
|
|
14
|
+
],
|
|
15
|
+
variants: {
|
|
16
|
+
color: {
|
|
17
|
+
primary: 'text-steel-950 bg-primary-500 hover:bg-primary-300',
|
|
18
|
+
secondary: 'text-steel-300 hover:bg-steel-700 hover:text-white',
|
|
19
|
+
danger: 'text-steel-950 bg-red-500 hover:bg-red-300',
|
|
20
|
+
dark: 'text-steel-300 bg-steel-800 hover:bg-steel-700 hover:text-white'
|
|
21
|
+
},
|
|
22
|
+
active: {
|
|
23
|
+
true: 'bg-primary-700! text-primary-300!'
|
|
24
|
+
},
|
|
25
|
+
highlighted: {
|
|
26
|
+
true: 'text-primary-300!'
|
|
27
|
+
},
|
|
28
|
+
shape: {
|
|
29
|
+
square: 'rounded',
|
|
30
|
+
circle: 'rounded-full'
|
|
31
|
+
},
|
|
32
|
+
size: {
|
|
33
|
+
xxs: 'size-4 text-[11px]',
|
|
34
|
+
xs: 'size-6 text-xs',
|
|
35
|
+
sm: 'size-7 text-sm',
|
|
36
|
+
md: 'size-9 text-base',
|
|
37
|
+
xl: 'size-10 text-lg'
|
|
38
|
+
},
|
|
39
|
+
disabled: {
|
|
40
|
+
true: 'opacity-25 pointer-events-none'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
color: 'dark',
|
|
45
|
+
shape: 'circle',
|
|
46
|
+
size: 'md'
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
icon: tv({
|
|
50
|
+
variants: {
|
|
51
|
+
loading: {
|
|
52
|
+
true: 'animate-spin'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
}
|