pixelize-design-library 2.4.2-beta.9 → 2.4.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/Button/Button.d.ts +2 -2
- package/dist/Components/Button/Button.js +3 -3
- package/dist/Components/Button/Button.styles.js +29 -3
- package/dist/Components/Button/ButtonProps.d.ts +6 -1
- package/dist/Components/Card/Card.d.ts +1 -1
- package/dist/Components/Card/Card.js +2 -2
- package/dist/Components/Card/CardProps.d.ts +0 -1
- package/dist/Components/Checkbox/Checkbox.js +1 -1
- package/dist/Components/FileUpload/FileUpload.js +3 -2
- package/dist/Components/FileUpload/FileUploadProps.d.ts +3 -1
- package/dist/Components/FileUpload/constants.js +1 -0
- package/dist/Components/FilterSidebar/FilterSidebar.js +2 -2
- package/dist/Components/Input/TextInput.styles.js +0 -1
- package/dist/Components/InputTextArea/InputTextArea.style.js +0 -1
- package/dist/Components/NoteTextArea/NoteTextArea.js +0 -2
- package/dist/Components/NumberInput/NumberInput.js +3 -1
- package/dist/Components/NumberInput/NumberInput.styles.js +0 -1
- package/dist/Components/Primitives/Primitives.d.ts +6 -0
- package/dist/Components/Primitives/Primitives.js +113 -0
- package/dist/Components/RadioButton/RadioButton.js +1 -1
- package/dist/Components/Search/Search.js +2 -2
- package/dist/Components/Select/Select.d.ts +1 -1
- package/dist/Components/Select/Select.js +4 -2
- package/dist/Components/Select/Select.styles.js +0 -1
- package/dist/Components/Select/SelectProps.d.ts +3 -0
- package/dist/Components/SelectV2/SelectV2.js +1 -1
- package/dist/Components/SideBar/SideBar.js +1 -1
- package/dist/Components/Table/Table.d.ts +1 -1
- package/dist/Components/Table/Table.js +8 -4
- package/dist/Components/Table/TableProps.d.ts +4 -0
- package/dist/Components/Table/components/Pagination.js +1 -1
- package/dist/Components/Table/components/TableBody.js +40 -11
- package/dist/Components/Table/components/TableHeader.js +21 -8
- package/dist/Components/Table/variants/TableVariantContext.d.ts +4 -0
- package/dist/Components/Table/variants/TableVariantContext.js +17 -0
- package/dist/Components/Table/variants/classic.d.ts +6 -0
- package/dist/Components/Table/variants/classic.js +47 -0
- package/dist/Components/Table/variants/index.d.ts +7 -0
- package/dist/Components/Table/variants/index.js +27 -0
- package/dist/Components/Table/variants/pillInk.d.ts +6 -0
- package/dist/Components/Table/variants/pillInk.js +21 -0
- package/dist/Components/Table/variants/studio.d.ts +6 -0
- package/dist/Components/Table/variants/studio.js +50 -0
- package/dist/Components/Table/variants/tokens.d.ts +49 -0
- package/dist/Components/Table/variants/tokens.js +2 -0
- package/dist/Theme/chakra/Menu.styles.d.ts +3 -1
- package/dist/Theme/chakra/Menu.styles.js +5 -3
- package/dist/Theme/chakra/Popover.styles.d.ts +3 -1
- package/dist/Theme/chakra/Popover.styles.js +4 -2
- package/dist/Theme/chakra/componentStyles.d.ts +8 -4
- package/dist/Theme/tokens/builders/outlineRung.d.ts +27 -3
- package/dist/Theme/tokens/builders/outlineRung.js +55 -5
- package/dist/Theme/tokens/builders/placeholderInk.d.ts +5 -5
- package/dist/Theme/tokens/builders/placeholderInk.js +8 -6
- package/dist/Theme/tokens/builders/surfaceRungs.js +12 -1
- package/dist/esm/Components/Button/Button.js +4 -4
- package/dist/esm/Components/Button/Button.styles.js +29 -3
- package/dist/esm/Components/Card/Card.js +2 -2
- package/dist/esm/Components/Checkbox/Checkbox.js +1 -1
- package/dist/esm/Components/FileUpload/FileUpload.js +4 -3
- package/dist/esm/Components/FileUpload/constants.js +1 -0
- package/dist/esm/Components/FilterSidebar/FilterSidebar.js +2 -2
- package/dist/esm/Components/Input/TextInput.styles.js +0 -1
- package/dist/esm/Components/InputTextArea/InputTextArea.style.js +0 -1
- package/dist/esm/Components/NoteTextArea/NoteTextArea.js +0 -2
- package/dist/esm/Components/NumberInput/NumberInput.js +4 -2
- package/dist/esm/Components/NumberInput/NumberInput.styles.js +0 -1
- package/dist/esm/Components/Primitives/Primitives.js +6 -0
- package/dist/esm/Components/RadioButton/RadioButton.js +1 -1
- package/dist/esm/Components/Search/Search.js +2 -2
- package/dist/esm/Components/Select/Select.js +5 -3
- package/dist/esm/Components/Select/Select.styles.js +0 -1
- package/dist/esm/Components/SelectV2/SelectV2.js +1 -1
- package/dist/esm/Components/SideBar/SideBar.js +1 -1
- package/dist/esm/Components/Table/Table.js +8 -4
- package/dist/esm/Components/Table/components/Pagination.js +1 -1
- package/dist/esm/Components/Table/components/TableBody.js +41 -12
- package/dist/esm/Components/Table/components/TableHeader.js +21 -8
- package/dist/esm/Components/Table/variants/TableVariantContext.js +13 -0
- package/dist/esm/Components/Table/variants/classic.js +43 -0
- package/dist/esm/Components/Table/variants/index.js +9 -0
- package/dist/esm/Components/Table/variants/pillInk.js +18 -0
- package/dist/esm/Components/Table/variants/studio.js +46 -0
- package/dist/esm/Components/Table/variants/tokens.js +1 -0
- package/dist/esm/Theme/chakra/Menu.styles.js +5 -3
- package/dist/esm/Theme/chakra/Popover.styles.js +4 -2
- package/dist/esm/Theme/tokens/builders/outlineRung.js +52 -4
- package/dist/esm/Theme/tokens/builders/placeholderInk.js +9 -7
- package/dist/esm/Theme/tokens/builders/surfaceRungs.js +13 -2
- package/dist/esm/index.js +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -0
- package/package.json +1 -1
|
@@ -31,9 +31,11 @@ const baseStyle = definePartsStyle(({ theme }) => {
|
|
|
31
31
|
[$bg.variable]: colors.backgroundColor.light,
|
|
32
32
|
bg: $bg.reference,
|
|
33
33
|
color: colors.text[900],
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
borderWidth:
|
|
34
|
+
// A rule at CHROME_RULE weight, not Chakra's gray.200: that default read as a hard edge,
|
|
35
|
+
// which is why this shipped borderless. At 1.31:1 the edge defines the surface instead.
|
|
36
|
+
borderWidth: "1px",
|
|
37
|
+
borderStyle: "solid",
|
|
38
|
+
borderColor: colors.boxborder[200],
|
|
37
39
|
},
|
|
38
40
|
// Own CSS var (`--menu-item-bg`), NOT the list's `--menu-bg` — Chakra's stock item
|
|
39
41
|
// baseStyle rewrites `--menu-bg` itself on hover/focus, so reusing that same var name
|
|
@@ -23,8 +23,10 @@ const baseStyle = definePartsStyle(({ theme }) => {
|
|
|
23
23
|
bg: $popperBg.reference,
|
|
24
24
|
[$arrowShadowColor.variable]: colors.boxborder[200],
|
|
25
25
|
color: colors.text[900],
|
|
26
|
-
//
|
|
27
|
-
borderWidth:
|
|
26
|
+
// Matches Menu: a CHROME_RULE-weight edge, not Chakra's gray.200 hard edge.
|
|
27
|
+
borderWidth: "1px",
|
|
28
|
+
borderStyle: "solid",
|
|
29
|
+
borderColor: colors.boxborder[200],
|
|
28
30
|
},
|
|
29
31
|
};
|
|
30
32
|
});
|
|
@@ -70,10 +70,12 @@ export declare const componentStyles: {
|
|
|
70
70
|
Menu: {
|
|
71
71
|
baseStyle?: (({ theme }: StyleFunctionProps) => {
|
|
72
72
|
list: {
|
|
73
|
-
[x: string]: string
|
|
73
|
+
[x: string]: string;
|
|
74
74
|
bg: string;
|
|
75
75
|
color: string;
|
|
76
|
-
borderWidth:
|
|
76
|
+
borderWidth: string;
|
|
77
|
+
borderStyle: string;
|
|
78
|
+
borderColor: string;
|
|
77
79
|
};
|
|
78
80
|
item: {
|
|
79
81
|
bg: string;
|
|
@@ -140,10 +142,12 @@ export declare const componentStyles: {
|
|
|
140
142
|
Popover: {
|
|
141
143
|
baseStyle?: (({ theme }: StyleFunctionProps) => {
|
|
142
144
|
content: {
|
|
143
|
-
[x: string]: string
|
|
145
|
+
[x: string]: string;
|
|
144
146
|
bg: string;
|
|
145
147
|
color: string;
|
|
146
|
-
borderWidth:
|
|
148
|
+
borderWidth: string;
|
|
149
|
+
borderStyle: string;
|
|
150
|
+
borderColor: string;
|
|
147
151
|
};
|
|
148
152
|
}) | undefined;
|
|
149
153
|
sizes?: {
|
|
@@ -7,6 +7,22 @@ import type { PaletteProps } from "../types";
|
|
|
7
7
|
export declare const MIN_PERCEPTIBLE_STEP = 1.15;
|
|
8
8
|
/** WCAG 1.4.11 — a control outline is a UI component boundary, held to 3:1. */
|
|
9
9
|
export declare const AA_NON_TEXT = 3;
|
|
10
|
+
/**
|
|
11
|
+
* Resting chrome — card, popover and field outlines — settles here, not at `AA_NON_TEXT`.
|
|
12
|
+
* At 3:1 a container border is text-weight and the UI reads as a wireframe; every mainstream
|
|
13
|
+
* system draws this line far lighter (Tailwind gray-200 1.24, Chakra gray.200 1.30, Material
|
|
14
|
+
* outline-variant 1.61). 1.4.11 asks that a control be identifiable, not that its resting
|
|
15
|
+
* border carry the whole job: the fill, the label and the focus ring do that, and the focus
|
|
16
|
+
* ring is still held to `AA_NON_TEXT`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const CHROME_BORDER = 1.5;
|
|
19
|
+
export declare const CHROME_RULE = 1.31;
|
|
20
|
+
/**
|
|
21
|
+
* A rule is decorative, so it has a ceiling and no floor: soften it until the surface it reads
|
|
22
|
+
* hardest against sits at `target`, and leave a already-fainter rung alone. Never `settleAcross`
|
|
23
|
+
* here — that clears a floor on EVERY surface, so one tinted surface drags the rule darker.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ruleInk(hex: string, surfaces: readonly string[], target: number): string;
|
|
10
26
|
/**
|
|
11
27
|
* Walks a hex toward `target` contrast against `backdrop`, keeping hue and saturation.
|
|
12
28
|
* Direction is DERIVED from the backdrop, never passed: a mode argument here was redundant
|
|
@@ -21,9 +37,10 @@ export declare function liftToContrast(hex: string, backdrop: string, target?: n
|
|
|
21
37
|
export declare function softenToContrast(hex: string, backdrop: string, target: number): string;
|
|
22
38
|
/**
|
|
23
39
|
* `boxborder[500]` is the rung every control outline reads (Checkbox, SearchSelect, the date
|
|
24
|
-
* pickers, the editor's inputs).
|
|
25
|
-
*
|
|
26
|
-
*
|
|
40
|
+
* pickers, the editor's inputs). Settled onto `CHROME_BORDER` — lifted when a brand authored it
|
|
41
|
+
* invisibly pale, softened when it overshoots. It was previously lifted to `AA_NON_TEXT`, which
|
|
42
|
+
* shipped 3.85-4.95:1 outlines: a text-weight box around every card and popover.
|
|
43
|
+
* Resolved here rather than hand-pinned per brand: a copied hex goes stale the moment a canvas moves.
|
|
27
44
|
*
|
|
28
45
|
* `border[*]` is deliberately untouched — that ramp draws table gridlines, which are decorative
|
|
29
46
|
* and outside 1.4.11.
|
|
@@ -38,3 +55,10 @@ export declare function withOutlineRung(palette: PaletteProps): PaletteProps;
|
|
|
38
55
|
* its OWN list background, not necessarily the page canvas.
|
|
39
56
|
*/
|
|
40
57
|
export declare function resolveHoverTint(seed: string, restSurface: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Settles ink into `target` against EVERY surface at once. Softening one step can change which
|
|
60
|
+
* surface is hardest, so resolving against a single pre-computed "hardest" one lands under the
|
|
61
|
+
* floor on another — that is how radiant and rosewood ended up with an invisible outline on
|
|
62
|
+
* their muted surface.
|
|
63
|
+
*/
|
|
64
|
+
export declare function settleAcross(hex: string, surfaces: readonly string[], target: number): string;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AA_NON_TEXT = exports.MIN_PERCEPTIBLE_STEP = void 0;
|
|
3
|
+
exports.CHROME_RULE = exports.CHROME_BORDER = exports.AA_NON_TEXT = exports.MIN_PERCEPTIBLE_STEP = void 0;
|
|
4
|
+
exports.ruleInk = ruleInk;
|
|
4
5
|
exports.liftToContrast = liftToContrast;
|
|
5
6
|
exports.softenToContrast = softenToContrast;
|
|
6
7
|
exports.withOutlineRung = withOutlineRung;
|
|
7
8
|
exports.resolveHoverTint = resolveHoverTint;
|
|
9
|
+
exports.settleAcross = settleAcross;
|
|
8
10
|
const color_1 = require("./color");
|
|
9
11
|
/**
|
|
10
12
|
* The floor a hover/active state's step off its own resting surface must clear to be seen at
|
|
@@ -14,6 +16,29 @@ const color_1 = require("./color");
|
|
|
14
16
|
exports.MIN_PERCEPTIBLE_STEP = 1.15;
|
|
15
17
|
/** WCAG 1.4.11 — a control outline is a UI component boundary, held to 3:1. */
|
|
16
18
|
exports.AA_NON_TEXT = 3;
|
|
19
|
+
/**
|
|
20
|
+
* Resting chrome — card, popover and field outlines — settles here, not at `AA_NON_TEXT`.
|
|
21
|
+
* At 3:1 a container border is text-weight and the UI reads as a wireframe; every mainstream
|
|
22
|
+
* system draws this line far lighter (Tailwind gray-200 1.24, Chakra gray.200 1.30, Material
|
|
23
|
+
* outline-variant 1.61). 1.4.11 asks that a control be identifiable, not that its resting
|
|
24
|
+
* border carry the whole job: the fill, the label and the focus ring do that, and the focus
|
|
25
|
+
* ring is still held to `AA_NON_TEXT`.
|
|
26
|
+
*/
|
|
27
|
+
exports.CHROME_BORDER = 1.5;
|
|
28
|
+
// The resting rule between two surfaces — a card edge, a divider, a menu outline. Lighter than
|
|
29
|
+
// CHROME_BORDER, which outlines a control the user acts on.
|
|
30
|
+
exports.CHROME_RULE = 1.31;
|
|
31
|
+
/**
|
|
32
|
+
* A rule is decorative, so it has a ceiling and no floor: soften it until the surface it reads
|
|
33
|
+
* hardest against sits at `target`, and leave a already-fainter rung alone. Never `settleAcross`
|
|
34
|
+
* here — that clears a floor on EVERY surface, so one tinted surface drags the rule darker.
|
|
35
|
+
*/
|
|
36
|
+
function ruleInk(hex, surfaces, target) {
|
|
37
|
+
const loudest = surfaces.reduce((worst, s) => (0, color_1.contrastRatio)(hex, s) > (0, color_1.contrastRatio)(hex, worst) ? s : worst);
|
|
38
|
+
return (0, color_1.contrastRatio)(hex, loudest) > target
|
|
39
|
+
? softenToContrast(hex, loudest, target)
|
|
40
|
+
: hex;
|
|
41
|
+
}
|
|
17
42
|
/**
|
|
18
43
|
* Walks a hex toward `target` contrast against `backdrop`, keeping hue and saturation.
|
|
19
44
|
* Direction is DERIVED from the backdrop, never passed: a mode argument here was redundant
|
|
@@ -57,9 +82,10 @@ function softenToContrast(hex, backdrop, target) {
|
|
|
57
82
|
}
|
|
58
83
|
/**
|
|
59
84
|
* `boxborder[500]` is the rung every control outline reads (Checkbox, SearchSelect, the date
|
|
60
|
-
* pickers, the editor's inputs).
|
|
61
|
-
*
|
|
62
|
-
*
|
|
85
|
+
* pickers, the editor's inputs). Settled onto `CHROME_BORDER` — lifted when a brand authored it
|
|
86
|
+
* invisibly pale, softened when it overshoots. It was previously lifted to `AA_NON_TEXT`, which
|
|
87
|
+
* shipped 3.85-4.95:1 outlines: a text-weight box around every card and popover.
|
|
88
|
+
* Resolved here rather than hand-pinned per brand: a copied hex goes stale the moment a canvas moves.
|
|
63
89
|
*
|
|
64
90
|
* `border[*]` is deliberately untouched — that ramp draws table gridlines, which are decorative
|
|
65
91
|
* and outside 1.4.11.
|
|
@@ -72,7 +98,9 @@ function withOutlineRung(palette) {
|
|
|
72
98
|
(0, color_1.contrastRatio)(current, palette.background[50])
|
|
73
99
|
? palette.backgroundColor.main
|
|
74
100
|
: palette.background[50];
|
|
75
|
-
const resolved =
|
|
101
|
+
const resolved = (0, color_1.contrastRatio)(current, backdrop) > exports.CHROME_BORDER
|
|
102
|
+
? softenToContrast(current, backdrop, exports.CHROME_BORDER)
|
|
103
|
+
: liftToContrast(current, backdrop, exports.CHROME_BORDER);
|
|
76
104
|
if (resolved === current)
|
|
77
105
|
return palette;
|
|
78
106
|
return { ...palette, boxborder: { ...palette.boxborder, 500: resolved } };
|
|
@@ -88,3 +116,25 @@ function withOutlineRung(palette) {
|
|
|
88
116
|
function resolveHoverTint(seed, restSurface) {
|
|
89
117
|
return liftToContrast(seed, restSurface, exports.MIN_PERCEPTIBLE_STEP);
|
|
90
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Settles ink into `target` against EVERY surface at once. Softening one step can change which
|
|
121
|
+
* surface is hardest, so resolving against a single pre-computed "hardest" one lands under the
|
|
122
|
+
* floor on another — that is how radiant and rosewood ended up with an invisible outline on
|
|
123
|
+
* their muted surface.
|
|
124
|
+
*/
|
|
125
|
+
function settleAcross(hex, surfaces, target) {
|
|
126
|
+
const clearsAll = (c) => surfaces.every((s) => (0, color_1.contrastRatio)(c, s) >= target);
|
|
127
|
+
if (!clearsAll(hex)) {
|
|
128
|
+
return surfaces.reduce((ink, s) => liftToContrast(ink, s, target), hex);
|
|
129
|
+
}
|
|
130
|
+
const { s: sat, l: start } = (0, color_1.hexToHsl)(hex);
|
|
131
|
+
const toward = (0, color_1.relativeLuminance)(surfaces[0]) < 0.5 ? -1 : 1;
|
|
132
|
+
let settled = hex;
|
|
133
|
+
for (let l = start; l > 0 && l < 100; l += toward) {
|
|
134
|
+
const next = (0, color_1.withLightness)(hex, l, sat);
|
|
135
|
+
if (!clearsAll(next))
|
|
136
|
+
break;
|
|
137
|
+
settled = next;
|
|
138
|
+
}
|
|
139
|
+
return settled;
|
|
140
|
+
}
|
|
@@ -2,12 +2,12 @@ import type { PaletteProps } from "../types";
|
|
|
2
2
|
/** A field always renders on at least one surface — the first is the reference backdrop. */
|
|
3
3
|
export type FieldSurfaces = readonly [string, ...string[]];
|
|
4
4
|
/**
|
|
5
|
-
* The hint ink for a field: the
|
|
6
|
-
*
|
|
5
|
+
* The hint ink for a field: the brand's authored rung settled onto `PLACEHOLDER_TEXT` against the
|
|
6
|
+
* hardest surface a field can land on — lifted when it falls short, softened when it overshoots.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Settled rather than floored because the authored rungs measured 3.96-7.73:1 across the brands,
|
|
9
|
+
* and anything much past the floor reads as a field already typed into. The floor is the look:
|
|
10
|
+
* one hint weight for every brand in both modes, instead of a per-brand accident.
|
|
11
11
|
*/
|
|
12
12
|
export declare const placeholderInkOn: (palette: PaletteProps, surfaces: FieldSurfaces) => string;
|
|
13
13
|
/**
|
|
@@ -5,17 +5,19 @@ const color_1 = require("./color");
|
|
|
5
5
|
const outlineRung_1 = require("./outlineRung");
|
|
6
6
|
const surfaceRungs_1 = require("./surfaceRungs");
|
|
7
7
|
/**
|
|
8
|
-
* The hint ink for a field: the
|
|
9
|
-
*
|
|
8
|
+
* The hint ink for a field: the brand's authored rung settled onto `PLACEHOLDER_TEXT` against the
|
|
9
|
+
* hardest surface a field can land on — lifted when it falls short, softened when it overshoots.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Settled rather than floored because the authored rungs measured 3.96-7.73:1 across the brands,
|
|
12
|
+
* and anything much past the floor reads as a field already typed into. The floor is the look:
|
|
13
|
+
* one hint weight for every brand in both modes, instead of a per-brand accident.
|
|
14
14
|
*/
|
|
15
15
|
const placeholderInkOn = (palette, surfaces) => {
|
|
16
16
|
const rung = palette.placeholder[500];
|
|
17
17
|
const hardest = surfaces.reduce((worst, s) => (0, color_1.contrastRatio)(rung, s) < (0, color_1.contrastRatio)(rung, worst) ? s : worst);
|
|
18
|
-
return (0,
|
|
18
|
+
return (0, color_1.contrastRatio)(rung, hardest) > surfaceRungs_1.PLACEHOLDER_TEXT
|
|
19
|
+
? (0, outlineRung_1.softenToContrast)(rung, hardest, surfaceRungs_1.PLACEHOLDER_TEXT)
|
|
20
|
+
: (0, outlineRung_1.liftToContrast)(rung, hardest, surfaceRungs_1.PLACEHOLDER_TEXT);
|
|
19
21
|
};
|
|
20
22
|
exports.placeholderInkOn = placeholderInkOn;
|
|
21
23
|
/**
|
|
@@ -24,6 +24,8 @@ exports.hardestSurface = hardestSurface;
|
|
|
24
24
|
function withSurfaceRungs(palette) {
|
|
25
25
|
const surfaces = (0, exports.namedSurfaces)(palette);
|
|
26
26
|
const lift = (ink, target) => (0, outlineRung_1.liftToContrast)(ink, (0, exports.hardestSurface)(ink, surfaces), target);
|
|
27
|
+
const settle = (ink, target) => (0, outlineRung_1.settleAcross)(ink, surfaces, target);
|
|
28
|
+
const rule = (ink) => (0, outlineRung_1.ruleInk)(ink, [palette.backgroundColor.main, palette.background[50]], outlineRung_1.CHROME_RULE);
|
|
27
29
|
const semanticText = semanticText_1.SEMANTIC_TONES.reduce((acc, tone) => {
|
|
28
30
|
acc[tone] = lift(palette.semanticText[tone], accentText_1.AA_NORMAL_TEXT);
|
|
29
31
|
return acc;
|
|
@@ -38,6 +40,15 @@ function withSurfaceRungs(palette) {
|
|
|
38
40
|
// `placeholder` is deliberately absent: the brand authors that rung and the published
|
|
39
41
|
// library ships it untouched. Its floor is enforced in `placeholderInk`, against the
|
|
40
42
|
// surfaces a FIELD renders on — not `table.hover`, which no field sits on.
|
|
41
|
-
|
|
43
|
+
// Settled, not lifted: this rung already passed through `withOutlineRung`, and lifting it
|
|
44
|
+
// again here to AA_NON_TEXT is what shipped 3.85-4.95:1 outlines. See CHROME_BORDER.
|
|
45
|
+
boxborder: {
|
|
46
|
+
...palette.boxborder,
|
|
47
|
+
200: rule(palette.boxborder[200]),
|
|
48
|
+
500: settle(palette.boxborder[500], outlineRung_1.CHROME_BORDER),
|
|
49
|
+
},
|
|
50
|
+
// The 200 rung of both ramps is the same job under two names; settle them together or an
|
|
51
|
+
// app picking `border` gets a heavier rule than one picking `boxborder`.
|
|
52
|
+
border: { ...palette.border, 200: rule(palette.border[200]) },
|
|
42
53
|
};
|
|
43
54
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from "react";
|
|
2
|
+
import { forwardRef, memo } from "react";
|
|
3
3
|
import { Button as ChakraButton } from "@chakra-ui/react";
|
|
4
|
-
function Button({ label, children, onClick, opacity, variant = "solid", leftIcon, rightIcon, size, isDisabled = false, isLoading = false, loadingText = "Loading", type, width, sx, colorScheme,
|
|
5
|
-
return (_jsx(ChakraButton, { ...aria, type: type, onClick: onClick, width: width || "fit-content", variant: variant, size: size, isLoading: isLoading, isDisabled: isDisabled, loadingText: loadingText, leftIcon: leftIcon, rightIcon: rightIcon, ref: ref, colorScheme: colorScheme, sx: sx, opacity: opacity, border: border, borderRadius: borderRadius, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: children !== null && children !== void 0 ? children : label }));
|
|
6
|
-
}
|
|
4
|
+
const Button = forwardRef(function Button({ label, children, onClick, opacity, variant = "solid", leftIcon, rightIcon, size, isDisabled = false, isLoading = false, loadingText = "Loading", type, width, w, sx, colorScheme, border, borderRadius, onMouseEnter, onMouseLeave, ...aria }, ref) {
|
|
5
|
+
return (_jsx(ChakraButton, { ...aria, type: type, onClick: onClick, width: width || w || "fit-content", variant: variant, size: size, isLoading: isLoading, isDisabled: isDisabled, loadingText: loadingText, leftIcon: leftIcon, rightIcon: rightIcon, ref: ref, colorScheme: colorScheme, sx: sx, opacity: opacity, border: border, borderRadius: borderRadius, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: children !== null && children !== void 0 ? children : label }));
|
|
6
|
+
});
|
|
7
7
|
export default memo(Button);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { accentTextOnCanvas, isDarkCanvas, onFilled } from "../../Theme/tokens/builders/accentText.js";
|
|
2
|
+
import { contrastRatio } from "../../Theme/tokens/builders/color.js";
|
|
2
3
|
import { resolveGradient, gradientCss } from "../../Theme/tokens/builders/gradientInk.js";
|
|
3
4
|
/**
|
|
4
5
|
* Outline/ghost/link text sits ON the canvas, so it needs a rung that stays readable there —
|
|
@@ -27,9 +28,34 @@ const onCanvasHoverBg = (theme, colorScheme, step) => {
|
|
|
27
28
|
* ~3.2 contrast.
|
|
28
29
|
*/
|
|
29
30
|
const FILL_STEP_RUNGS = { light: [600, 700], dark: [400, 300] };
|
|
31
|
+
const RUNGS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
|
|
32
|
+
const AA_NORMAL_TEXT = 4.5;
|
|
33
|
+
// Semantic scales (red/green) carry no opacity ramp; brand scales do and keep their own [500].
|
|
34
|
+
const solidRung = (theme, colorScheme) => {
|
|
35
|
+
const scale = theme.colors[colorScheme];
|
|
36
|
+
const white = theme.colors.white;
|
|
37
|
+
if ("opacity" in scale)
|
|
38
|
+
return 500;
|
|
39
|
+
if (contrastRatio(scale[500], white) >= AA_NORMAL_TEXT)
|
|
40
|
+
return 500;
|
|
41
|
+
const passing = RUNGS.filter((r) => scale[r] && contrastRatio(scale[r], white) >= AA_NORMAL_TEXT);
|
|
42
|
+
if (!passing.length)
|
|
43
|
+
return 500;
|
|
44
|
+
return passing.reduce((a, b) => contrastRatio(scale[a], white) <= contrastRatio(scale[b], white) ? a : b);
|
|
45
|
+
};
|
|
46
|
+
const steppedRung = (theme, base, step) => {
|
|
47
|
+
const dir = isDarkCanvas(theme.colors.backgroundColor.main) ? -100 : 100;
|
|
48
|
+
return Math.min(900, Math.max(50, base + dir * step));
|
|
49
|
+
};
|
|
30
50
|
const darkerFill = (theme, colorScheme, step) => {
|
|
31
|
-
|
|
32
|
-
|
|
51
|
+
var _a;
|
|
52
|
+
const scale = theme.colors[colorScheme];
|
|
53
|
+
const base = solidRung(theme, colorScheme);
|
|
54
|
+
if (base === 500) {
|
|
55
|
+
const mode = isDarkCanvas(theme.colors.backgroundColor.main) ? "dark" : "light";
|
|
56
|
+
return scale[FILL_STEP_RUNGS[mode][step]];
|
|
57
|
+
}
|
|
58
|
+
return (_a = scale[steppedRung(theme, base, step === 0 ? 1 : 2)]) !== null && _a !== void 0 ? _a : scale[base];
|
|
33
59
|
};
|
|
34
60
|
/** Label for the solid variant's filled bg — derived from THAT fill, since hover/active swap it. */
|
|
35
61
|
const labelFor = (theme, fill) => onFilled(fill, theme.colors.white, theme.colors.black);
|
|
@@ -46,7 +72,7 @@ export const Button = {
|
|
|
46
72
|
}),
|
|
47
73
|
variants: {
|
|
48
74
|
solid: ({ theme, colorScheme = "primary" }) => {
|
|
49
|
-
const fill = theme.colors[colorScheme][
|
|
75
|
+
const fill = theme.colors[colorScheme][solidRung(theme, colorScheme)];
|
|
50
76
|
const hoverFill = darkerFill(theme, colorScheme, 0);
|
|
51
77
|
const activeFill = darkerFill(theme, colorScheme, 1);
|
|
52
78
|
const hoverLabel = labelFor(theme, hoverFill);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Card as ChakraCard } from "@chakra-ui/react";
|
|
3
|
-
export default function Card({
|
|
4
|
-
return (_jsx(ChakraCard, { maxW: maxW, align: align, variant: variant, direction: direction, justify: justify, size: size, overflow: overflow, colorScheme: color, p: 4, sx: sx, children: children }
|
|
3
|
+
export default function Card({ maxW, align, variant, direction, justify, children, size, color, overflow, sx, }) {
|
|
4
|
+
return (_jsx(ChakraCard, { maxW: maxW, align: align, variant: variant, direction: direction, justify: justify, size: size, overflow: overflow, colorScheme: color, p: 4, sx: sx, children: children }));
|
|
5
5
|
}
|
|
@@ -21,7 +21,7 @@ export default function CheckBox({ label, labelFontSize, showLabelTooltip, label
|
|
|
21
21
|
...labelSx,
|
|
22
22
|
}
|
|
23
23
|
: { ...labelSx };
|
|
24
|
-
return (_jsxs(_Fragment, { children: [_jsx(ChakraCheckbox, { ...aria, onClick: onClick, spacing: spacing !== null && spacing !== void 0 ? spacing : "0.5rem", isInvalid: isInvalid, colorScheme: color, iconColor: iconColor, iconSize: iconSize, isChecked: isChecked, isIndeterminate: isIndeterminate, onChange: onChange, isDisabled: isDisabled, size: size, value: value, defaultChecked: defaultChecked, borderColor: theme.colors.
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsx(ChakraCheckbox, { ...aria, onClick: onClick, spacing: spacing !== null && spacing !== void 0 ? spacing : "0.5rem", isInvalid: isInvalid, colorScheme: color, iconColor: iconColor, iconSize: iconSize, isChecked: isChecked, isIndeterminate: isIndeterminate, onChange: onChange, isDisabled: isDisabled, size: size, value: value, defaultChecked: defaultChecked, borderColor: theme.colors.boxborder[500], display: "flex", alignItems: "center", sx: {
|
|
25
25
|
...sx,
|
|
26
26
|
".chakra-checkbox__control": { w: controlSize, h: controlSize },
|
|
27
27
|
}, children: label && (showLabelTooltip ? (_jsx(ToolTip, { label: labelTooltip !== null && labelTooltip !== void 0 ? labelTooltip : label, hasArrow: true, placement: "top", fontSize: "0.75rem", children: _jsx(Box, { as: "span", sx: clampStyles, fontSize: labelFontSize !== null && labelFontSize !== void 0 ? labelFontSize : "0.8125rem", color: theme.colors.text[700], fontWeight: 500, ml: 0, children: label }) })) : (_jsx(Box, { as: "span", sx: clampStyles, fontSize: labelFontSize !== null && labelFontSize !== void 0 ? labelFontSize : "0.8125rem", color: theme.colors.text[700], fontWeight: 500, ml: 0, children: label }))) }), error && _jsx(ErrorMessage, { errorMessage: errorMessage }), helperText && !error && _jsx(HelperText, { helperText: helperText })] }));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback } from "react";
|
|
3
|
-
import { Box, Text, VStack, Icon, List, ListItem, ListIcon, CloseButton, HStack, Progress, useDisclosure, Image, } from "@chakra-ui/react";
|
|
3
|
+
import { Box, Text, Stack, VStack, Icon, List, ListItem, ListIcon, CloseButton, HStack, Progress, useDisclosure, Image, } from "@chakra-ui/react";
|
|
4
4
|
import { useDropzone } from "react-dropzone";
|
|
5
5
|
import { Upload, FileText, Eye } from "lucide-react";
|
|
6
6
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
7
7
|
import { accentTextOnCanvas } from "../../Theme/tokens/builders/accentText.js";
|
|
8
8
|
import { mimeMap, toMB } from "./constants.js";
|
|
9
9
|
import Modal, { ModalBody, ModalHeader } from "../Modal/Modal.js";
|
|
10
|
-
const FileUpload = ({ onFilesUploaded, uploadedFiles, onRemoveFile, acceptTypes = [".jpg", ".png"], maxSizeKB = 5, maxFiles = undefined, progress = {}, }) => {
|
|
10
|
+
const FileUpload = ({ onFilesUploaded, uploadedFiles, onRemoveFile, acceptTypes = [".jpg", ".png"], maxSizeKB = 5, maxFiles = undefined, progress = {}, size = "md", inputAriaLabel = "Upload files", }) => {
|
|
11
|
+
const compact = size === "sm";
|
|
11
12
|
const { colors, radii } = useCustomTheme();
|
|
12
13
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
|
13
14
|
const [previewUrl, setPreviewUrl] = React.useState(null);
|
|
@@ -53,7 +54,7 @@ const FileUpload = ({ onFilesUploaded, uploadedFiles, onRemoveFile, acceptTypes
|
|
|
53
54
|
setErrors(messages);
|
|
54
55
|
},
|
|
55
56
|
});
|
|
56
|
-
return (_jsxs(_Fragment, { children: [_jsxs(VStack, { spacing: 4, align: "stretch", children: [_jsxs(Box, { ...getRootProps(), border: "2px dashed", borderColor: border, borderRadius: "md", p: 10, textAlign: "center", bg: bg, cursor: "pointer", transition: "all 0.2s", _hover: { bg: colors.gray[100] }, position: "relative", children: [_jsx("input", { ...getInputProps() }), _jsxs(
|
|
57
|
+
return (_jsxs(_Fragment, { children: [_jsxs(VStack, { spacing: 4, align: "stretch", children: [_jsxs(Box, { ...getRootProps(), border: "2px dashed", borderColor: border, borderRadius: "md", p: compact ? 3 : 10, textAlign: "center", bg: bg, cursor: "pointer", transition: "all 0.2s", _hover: { bg: colors.gray[100] }, position: "relative", children: [_jsx("input", { ...getInputProps({ "aria-label": inputAriaLabel }) }), _jsxs(Stack, { direction: compact ? "row" : "column", spacing: compact ? 3 : 2, align: "center", justify: "center", children: [_jsx(Icon, { as: Upload, boxSize: compact ? 4 : 6 }), _jsxs(Stack, { spacing: 0, align: compact ? "start" : "center", children: [_jsx(Text, { fontWeight: "medium", fontSize: compact ? "sm" : "md", color: colors.textMuted, children: "Drag and drop files here" }), _jsxs(Text, { fontSize: compact ? "xs" : "sm", color: colors.textMuted, children: [acceptTypes.join(", "), " up to ", toMB(maxSizeKB), " ", maxFiles ? `- ${maxFiles} file(s) max` : ""] })] })] })] }), errors.length > 0 && (_jsx(Box, { children: errors.map((err, idx) => (_jsx(Text, { fontSize: "sm", color: colors.semanticText.error, children: err }, idx))) })), uploadedFiles.length > 0 && (_jsxs(Box, { children: [_jsx(Box, { display: "flex", alignItems: "center", gap: 2, children: _jsx(Text, { fontFamily: "open-sans, sans-serif", fontWeight: 600, fontSize: 14, lineHeight: "100%", letterSpacing: "4%", textTransform: "uppercase", py: 4, children: "Uploaded Files" }) }), _jsx(List, { spacing: 2, children: uploadedFiles.map((file, index) => (_jsxs(Box, { borderWidth: "0.063rem", borderRadius: "md", px: 3, py: 2, bg: colors.background[50], children: [_jsxs(ListItem, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [_jsxs(HStack, { spacing: 3, flex: "1", children: [file.type.startsWith("image/") ? (_jsxs(Box, { boxSize: "2.5rem", cursor: "pointer", position: "relative", _hover: {
|
|
57
58
|
".hover-icon": {
|
|
58
59
|
opacity: 1,
|
|
59
60
|
bg: colors.secondary.opacity[16],
|
|
@@ -13,6 +13,7 @@ export const mimeMap = {
|
|
|
13
13
|
'.ppt': 'application/vnd.ms-powerpoint',
|
|
14
14
|
'.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
15
15
|
'.txt': 'text/plain',
|
|
16
|
+
'.csv': 'text/csv',
|
|
16
17
|
'.mp4': 'video/mp4',
|
|
17
18
|
'.mov': 'video/quicktime',
|
|
18
19
|
'.mp3': 'audio/mpeg',
|
|
@@ -144,13 +144,13 @@ panelPadding = 3, clearAllButton = true, onClearAllHandler,
|
|
|
144
144
|
pointerEvents: 'none', // Allow clicks to pass through track
|
|
145
145
|
zIndex: 3,
|
|
146
146
|
margin: 0,
|
|
147
|
-
} })] }), _jsxs(SimpleGrid, { columns: 2, spacing: 2, pt: 2, w: "full", children: [_jsxs(Popover, { isOpen: openPrice.id === section.id && openPrice.target === "min", onClose: () => setOpenPrice({}), placement: "bottom-start", closeOnBlur: true, children: [_jsx(PopoverTrigger, { children: _jsx(Flex, { borderWidth: "0", borderRadius: "md", alignItems: "center", px: 3, py: 2, bg: theme.colors.gray[50], borderColor: theme.colors.
|
|
147
|
+
} })] }), _jsxs(SimpleGrid, { columns: 2, spacing: 2, pt: 2, w: "full", children: [_jsxs(Popover, { isOpen: openPrice.id === section.id && openPrice.target === "min", onClose: () => setOpenPrice({}), placement: "bottom-start", closeOnBlur: true, children: [_jsx(PopoverTrigger, { children: _jsx(Flex, { borderWidth: "0", borderRadius: "md", alignItems: "center", px: 3, py: 2, bg: theme.colors.gray[50], borderColor: theme.colors.boxborder[500], cursor: "pointer", onClick: () => setOpenPrice({ id: section.id, target: "min" }), gap: 2, overflow: "hidden", children: _jsx(Box, { ml: "auto", children: _jsxs(Text, { fontSize: "12px", color: theme.colors.text[500], whiteSpace: "nowrap", children: [currentMin, range.unit ? ` ${range.unit}` : ""] }) }) }) }), _jsx(Portal, { children: _jsx(PopoverContent, { width: "6rem", p: 0, zIndex: 1600, bg: theme.colors.background[50], children: _jsx(PopoverBody, { p: 0, children: _jsx(VStack, { align: "stretch", spacing: 0, maxH: "12rem", overflowY: "auto", children: values.map((v) => (_jsxs(Flex, { px: 2, py: 1, align: "center", justify: "space-between", cursor: "pointer", bg: currentMin === v ? theme.colors.red[50] : theme.colors.background[50], borderLeftWidth: currentMin === v ? 3 : 0, borderLeftStyle: "solid", borderLeftColor: currentMin === v ? theme.colors.red[400] : "transparent", _hover: { bg: hoverBg }, onClick: () => {
|
|
148
148
|
const min = v;
|
|
149
149
|
const max = currentMax;
|
|
150
150
|
const nextVal = [Math.min(min, max), Math.max(min, max)];
|
|
151
151
|
setInternalSelected((prev) => { const next = { ...prev, [section.id]: nextVal }; onChange === null || onChange === void 0 ? void 0 : onChange(next); return next; });
|
|
152
152
|
setOpenPrice({});
|
|
153
|
-
}, children: [_jsxs(Text, { fontSize: "sm", color: theme.colors.gray[800], children: [v, range.unit ? ` ${range.unit}` : ""] }), currentMin === v ? (_jsx(Box, { bg: theme.colors.red[100], borderRadius: "full", p: 1, display: "flex", alignItems: "center", children: _jsx(Check, { size: 9, color: onFilled(theme.colors.red[100], theme.colors.white, theme.colors.black) }) })) : null] }, `min-${v}`))) }) }) }) })] }), _jsxs(Popover, { isOpen: openPrice.id === section.id && openPrice.target === "max", onClose: () => setOpenPrice({}), placement: "bottom-start", closeOnBlur: true, children: [_jsx(PopoverTrigger, { children: _jsx(Flex, { borderWidth: "0", borderRadius: "md", alignItems: "center", px: 3, py: 2, bg: theme.colors.gray[50], borderColor: theme.colors.
|
|
153
|
+
}, children: [_jsxs(Text, { fontSize: "sm", color: theme.colors.gray[800], children: [v, range.unit ? ` ${range.unit}` : ""] }), currentMin === v ? (_jsx(Box, { bg: theme.colors.red[100], borderRadius: "full", p: 1, display: "flex", alignItems: "center", children: _jsx(Check, { size: 9, color: onFilled(theme.colors.red[100], theme.colors.white, theme.colors.black) }) })) : null] }, `min-${v}`))) }) }) }) })] }), _jsxs(Popover, { isOpen: openPrice.id === section.id && openPrice.target === "max", onClose: () => setOpenPrice({}), placement: "bottom-start", closeOnBlur: true, children: [_jsx(PopoverTrigger, { children: _jsx(Flex, { borderWidth: "0", borderRadius: "md", alignItems: "center", px: 3, py: 2, bg: theme.colors.gray[50], borderColor: theme.colors.boxborder[500], cursor: "pointer", onClick: () => setOpenPrice({ id: section.id, target: "max" }), gap: 2, overflow: "hidden", children: _jsx(Box, { ml: "auto", children: _jsxs(Text, { fontSize: "12px", color: theme.colors.text[500], whiteSpace: "nowrap", children: [currentMax, range.unit ? ` ${range.unit}` : ""] }) }) }) }), _jsx(PopoverContent, { width: "6rem", p: 0, bg: theme.colors.background[50], children: _jsx(PopoverBody, { p: 0, children: _jsx(VStack, { align: "stretch", spacing: 0, maxH: "12rem", overflowY: "auto", children: values.map((v) => (_jsxs(Flex, { px: 2, py: 1, align: "center", justify: "space-between", cursor: "pointer", bg: currentMax === v ? theme.colors.red[50] : theme.colors.background[50], borderLeftWidth: currentMax === v ? 3 : 0, borderLeftStyle: "solid", borderLeftColor: currentMax === v ? theme.colors.red[400] : "transparent", _hover: { bg: hoverBg }, onClick: () => {
|
|
154
154
|
const max = v;
|
|
155
155
|
const min = currentMin;
|
|
156
156
|
const nextVal = [Math.min(min, max), Math.max(min, max)];
|
|
@@ -120,10 +120,8 @@ export default function NoteTextArea({ width = "100%", handleSubmit, handleCance
|
|
|
120
120
|
setTitleShow(false);
|
|
121
121
|
setTitleValue(e.target.value);
|
|
122
122
|
}, placeholder: "Add a title...", variant: "unstyled", px: 3, pt: 2.5, pb: 1.5, fontWeight: 600, fontSize: "0.875rem", color: theme.colors.text[700], _placeholder: {
|
|
123
|
-
fontStyle: "italic",
|
|
124
123
|
color: placeholderInk(theme.colors),
|
|
125
124
|
} }), _jsx(Divider, { borderColor: theme.colors.gray[200] })] })), _jsx(Box, { bg: theme.colors.background[50], minH: "76px", px: 3, pt: 2.5, position: "relative", children: _jsx(Textarea, { ref: noteAreaRef, value: noteValue, onChange: handleNoteChange, placeholder: customPlaceholder, variant: "unstyled", resize: "none", minH: "76px", fontSize: "0.75rem", color: theme.colors.text[700], _placeholder: {
|
|
126
|
-
fontStyle: "italic",
|
|
127
125
|
color: placeholderInk(theme.colors),
|
|
128
126
|
}, style: { overflow: "hidden" }, p: 0 }) })] }), _jsx(Divider, { borderColor: theme.colors.gray[200] }), _jsxs(Box, { px: 3, py: 2.5, children: [_jsxs(Flex, { align: "center", justify: "space-between", w: "100%", gap: 3, children: [_jsxs(Flex, { align: "center", gap: 2, minW: 0, children: [_jsx(Tooltip, { label: "Attach files", hasArrow: true, placement: "top", children: _jsx(Box, { as: "label", htmlFor: "file-upload", cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center", w: "1.75rem", h: "1.75rem", borderRadius: "md", color: theme.colors.textMuted, transition: "background 0.15s", _hover: { bg: theme.colors.gray[100] }, children: _jsx(Paperclip, { size: 16 }) }) }), _jsx(Box, { h: "1rem", w: "1px", bg: theme.colors.gray[200] }), !titleShow ? (_jsx(Box, { as: "button", type: "button", onClick: () => setTitleShow(true), px: 2, py: 1, borderRadius: "md", color: theme.colors.textMuted, fontWeight: 500, fontSize: "sm", transition: "background 0.15s", _hover: { bg: theme.colors.gray[100] }, children: "+ Add a title" })) : (_jsx(Tooltip, { label: titleValue, hasArrow: true, isDisabled: !titleValue, children: _jsx(Text, { color: theme.colors.textMuted, fontSize: "sm", fontWeight: 500, isTruncated: true, maxW: "180px", children: titleValue || "Title" }) }))] }), _jsxs(Flex, { gap: 2.5, align: "center", ml: "auto", flexShrink: 0, children: [_jsxs(Text, { fontSize: "xs", fontWeight: 500, color: isOverLimit ? theme.colors.semanticText.error : theme.colors.textMuted, whiteSpace: "nowrap", children: [noteWordCount, "/", maxNoteWordCount] }), cancelButtonHide ? null : (_jsx(Button, { size: "sm", variant: "ghost", colorScheme: "gray", onClick: handleCloseTextArea, children: "Cancel" })), _jsxs(Button, { size: "sm", variant: "solid", isLoading: !!saveButtonLoading, isDisabled: !noteValue || isSaveDisabled, onClick: () => handleSubmit(noteValue, titleValue, files), children: [saveButtonLoading ? (_jsx(Spinner, { size: "xs", thickness: "2px", mr: 2 })) : null, "Save"] })] })] }), _jsx("input", { id: "file-upload", type: "file", style: { display: "none" }, onChange: (e) => {
|
|
129
127
|
const newFiles = Array.from(e.target.files || []);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { NumberDecrementStepper, NumberIncrementStepper, NumberInput as ChakraNumberInput, NumberInputField, NumberInputStepper, FormControl, } from "@chakra-ui/react";
|
|
3
|
-
import { forwardRef } from "react";
|
|
3
|
+
import { forwardRef, useId } from "react";
|
|
4
4
|
import { TextLabel } from "../Common/FormLabel.js";
|
|
5
5
|
const NumberInput = forwardRef(function NumberInput({ defaultValue, min, max, precision, step, clampValueOnBlur, keepWithinRange, value, onChange, onBlur, name, size, maxW, allowMouseWheel, NumberIncrementStepperBg, NumberIncrementStepperActive, NumberIncrementStepperChildren, NumberDecrementStepperBg, NumberDecrementStepperChildren, NumberDecrementStepperActive, label, isInformation, informationMessage, isRequired, id, width = "100%", minW, ...props }, ref) {
|
|
6
|
-
|
|
6
|
+
const generatedId = useId();
|
|
7
|
+
const resolvedId = id !== null && id !== void 0 ? id : generatedId;
|
|
8
|
+
return (_jsxs(FormControl, { w: width, minW: minW, maxW: maxW, id: resolvedId, isRequired: isRequired, children: [label && (_jsx(TextLabel, { label: label, id: resolvedId, isInformation: isInformation, informationMessage: informationMessage, isRequired: isRequired })), _jsxs(ChakraNumberInput, { defaultValue: defaultValue, min: min, max: max, step: step, precision: precision, clampValueOnBlur: clampValueOnBlur, keepWithinRange: keepWithinRange, value: value, onChange: onChange, onBlur: onBlur, name: name, size: size, maxW: maxW, allowMouseWheel: allowMouseWheel, ...props, children: [_jsx(NumberInputField, { ref: ref }), _jsxs(NumberInputStepper, { children: [_jsx(NumberIncrementStepper, { bg: NumberIncrementStepperBg, _active: NumberIncrementStepperActive, children: NumberIncrementStepperChildren }), _jsx(NumberDecrementStepper, { bg: NumberDecrementStepperBg, _active: NumberDecrementStepperActive, children: NumberDecrementStepperChildren })] })] })] }));
|
|
7
9
|
});
|
|
8
10
|
export default NumberInput;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Box, Flex, Stack, VStack, HStack, Grid, GridItem, SimpleGrid, Wrap, WrapItem, Center, Spacer, Container, Divider, Text, Heading, Link, Image, Icon, Avatar, AvatarGroup, Badge, Spinner, Alert, AlertIcon, AlertTitle, AlertDescription, Portal, Collapse, Show, Hide, List, ListItem, ListIcon, OrderedList, UnorderedList, Tabs, TabList, Tab, TabPanels, TabPanel, Popover, PopoverTrigger, PopoverContent, PopoverBody, PopoverHeader, PopoverFooter, PopoverArrow, PopoverCloseButton, FormControl, FormLabel, FormErrorMessage, FormHelperText, IconButton, TableContainer, Thead, Tbody, Tfoot, Tr, Th, Td, Menu, MenuButton, MenuList, MenuItem, MenuGroup, MenuDivider, MenuOptionGroup, MenuItemOption, Accordion, AccordionItem, AccordionButton, AccordionPanel, AccordionIcon, SliderTrack, SliderFilledTrack, SliderThumb, SliderMark, ChakraProvider, extendTheme, useDisclosure, useMediaQuery, useToken, useBreakpointValue, } from "@chakra-ui/react";
|
|
2
|
+
// Renamed: the library's own Table and Slider own these names.
|
|
3
|
+
export { Table as TableRoot, Slider as RangeSlider } from "@chakra-ui/react";
|
|
4
|
+
export { Input, Textarea, Progress, Radio, RadioGroup, Skeleton, ModalOverlay, ModalContent, ModalCloseButton, CardBody, } from "@chakra-ui/react";
|
|
5
|
+
// Prefixed because the library ships its own component under each of these names.
|
|
6
|
+
export { Card as ChakraCard, Select as ChakraSelect, Modal as ChakraModal, ModalBody as ChakraModalBody, ModalHeader as ChakraModalHeader, ModalFooter as ChakraModalFooter, } from "@chakra-ui/react";
|
|
@@ -4,7 +4,7 @@ import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
|
4
4
|
import { TextLabel } from "../Common/FormLabel.js";
|
|
5
5
|
const RadioButton = ({ label, colorScheme, isChecked, onChange, isDisabled, size, value, defaultChecked, labelFontSize = "0.75rem", labelClampLines = 2, showLabelTooltip = (label || "").length > 18, labelTooltip = label, }) => {
|
|
6
6
|
const theme = useCustomTheme();
|
|
7
|
-
return (_jsx(ChakraRadio, { colorScheme: colorScheme, isChecked: isChecked, onChange: onChange, isDisabled: isDisabled, size: size, value: value, defaultChecked: defaultChecked, borderColor: theme.colors.
|
|
7
|
+
return (_jsx(ChakraRadio, { colorScheme: colorScheme, isChecked: isChecked, onChange: onChange, isDisabled: isDisabled, size: size, value: value, defaultChecked: defaultChecked, borderColor: theme.colors.boxborder[500], borderWidth: "1.6px", _hover: {
|
|
8
8
|
borderColor: theme.colors.primary[500],
|
|
9
9
|
backgroundColor: theme.colors.background[100],
|
|
10
10
|
}, sx: {
|
|
@@ -24,6 +24,6 @@ export default function Search({ placeholder = "Search...", onSearch, onclose, s
|
|
|
24
24
|
window.removeEventListener("keydown", handleKeyDown);
|
|
25
25
|
};
|
|
26
26
|
}, [shortcut]);
|
|
27
|
-
return (_jsxs(FormControl, { id: id, isInvalid: !!error, children: [label && (_jsx(TextLabel, { label: label, id: id, isInformation: isInformation, informationMessage: informationMessage, isRequired: isRequired })), _jsxs(InputGroup, { w: "100%", children: [_jsx(InputLeftElement, { pointerEvents: "none", children: _jsx(Icon, { as: SearchIconComponent, color: theme.colors.
|
|
28
|
-
, gap: "2", children: [query && (_jsx(Icon, { as: X, color: theme.colors.
|
|
27
|
+
return (_jsxs(FormControl, { id: id, isInvalid: !!error, children: [label && (_jsx(TextLabel, { label: label, id: id, isInformation: isInformation, informationMessage: informationMessage, isRequired: isRequired })), _jsxs(InputGroup, { w: "100%", children: [_jsx(InputLeftElement, { pointerEvents: "none", children: _jsx(Icon, { as: SearchIconComponent, color: theme.colors.textMuted }) }), _jsx(Input, { ref: inputRef, type: "text", value: query, onChange: onSearch, placeholder: placeholder, variant: "outline", isInvalid: error }), _jsxs(InputRightElement, { w: "auto", pr: "3", display: "flex", alignItems: "center" // ✅ centers vertically
|
|
28
|
+
, gap: "2", children: [query && (_jsx(Icon, { as: X, color: theme.colors.textMuted, boxSize: 5, cursor: "pointer", onClick: onclose })), shortcut && (_jsx(Text, { fontSize: "sm", color: theme.colors.textMuted, px: "2", py: "0.5", borderRadius: "md", bg: theme.colors.backgroundColor.subtle, children: shortcut }))] })] }), error && _jsx(ErrorMessage, { errorMessage: errorMessage }), helperText && !error && _jsx(HelperText, { helperText: helperText })] }));
|
|
29
29
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from "react";
|
|
2
|
+
import { useCallback, useId } from "react";
|
|
3
3
|
import { Select as ChakraSelect, FormControl } from "@chakra-ui/react";
|
|
4
4
|
import { getTextInputIconSizePx } from "../Input/textInputIconSize.js";
|
|
5
5
|
import { TextLabel } from "../Common/FormLabel.js";
|
|
6
6
|
import ErrorMessage from "../Common/ErrorMessage.js";
|
|
7
7
|
import HelperText from "../Common/HelperText.js";
|
|
8
|
-
export default function Select({ placeholder = "Select Option", size = "md", variant = "outline", icon, onChange, onBlur, onFocus, errorBorderColor, isDisabled, isReadOnly, isRequired = false, value = "", colorScheme, label, error, errorMessage, helperText, options = [], height, formControlStyle, isInformation = false, informationMessage, selectStyle, }) {
|
|
8
|
+
export default function Select({ placeholder = "Select Option", size = "md", variant = "outline", icon, onChange, onBlur, onFocus, errorBorderColor, isDisabled, isReadOnly, isRequired = false, value = "", colorScheme, label, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, error, errorMessage, helperText, options = [], height, formControlStyle, isInformation = false, informationMessage, selectStyle, }) {
|
|
9
9
|
const sizeKey = typeof size === "string" ? size : "md";
|
|
10
10
|
const iconSizePx = getTextInputIconSizePx(sizeKey);
|
|
11
|
+
const generatedId = useId();
|
|
12
|
+
const selectId = id !== null && id !== void 0 ? id : (label ? generatedId : undefined);
|
|
11
13
|
const getOptionsList = useCallback(() => {
|
|
12
14
|
if (!options.length)
|
|
13
15
|
return _jsx("option", { value: "", children: "No Options" });
|
|
@@ -20,5 +22,5 @@ export default function Select({ placeholder = "Select Option", size = "md", var
|
|
|
20
22
|
onChange(selectedOption);
|
|
21
23
|
}
|
|
22
24
|
};
|
|
23
|
-
return (_jsxs(FormControl, { isInvalid: error, style: formControlStyle, size: size, children: [label && (_jsx(TextLabel, { label: label, isRequired: isRequired, isInformation: isInformation, informationMessage: informationMessage })), _jsx(ChakraSelect, { placeholder: placeholder, size: size, variant: variant, icon: icon, iconSize: `${iconSizePx}px`, isInvalid: error, value: value, onChange: handleOnChange, onBlur: onBlur, onFocus: onFocus, isDisabled: isDisabled, isReadOnly: isReadOnly, colorScheme: colorScheme, errorBorderColor: errorBorderColor, style: selectStyle, ...(height != null && height !== "" ? { minH: height, h: height } : {}), children: getOptionsList() }), error && _jsx(ErrorMessage, { errorMessage: errorMessage }), helperText && !error && _jsx(HelperText, { helperText: helperText })] }));
|
|
25
|
+
return (_jsxs(FormControl, { isInvalid: error, style: formControlStyle, size: size, children: [label && (_jsx(TextLabel, { label: label, id: selectId, isRequired: isRequired, isInformation: isInformation, informationMessage: informationMessage })), _jsx(ChakraSelect, { id: selectId, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, placeholder: placeholder, size: size, variant: variant, icon: icon, iconSize: `${iconSizePx}px`, isInvalid: error, value: value, onChange: handleOnChange, onBlur: onBlur, onFocus: onFocus, isDisabled: isDisabled, isReadOnly: isReadOnly, colorScheme: colorScheme, errorBorderColor: errorBorderColor, style: selectStyle, ...(height != null && height !== "" ? { minH: height, h: height } : {}), children: getOptionsList() }), error && _jsx(ErrorMessage, { errorMessage: errorMessage }), helperText && !error && _jsx(HelperText, { helperText: helperText })] }));
|
|
24
26
|
}
|