@visns-studio/visns-components 6.3.1 → 6.3.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/package.json
CHANGED
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
92
92
|
},
|
|
93
93
|
"name": "@visns-studio/visns-components",
|
|
94
|
-
"version": "6.3.
|
|
94
|
+
"version": "6.3.2",
|
|
95
95
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
96
96
|
"main": "src/index.js",
|
|
97
97
|
"files": [
|
|
@@ -4630,44 +4630,37 @@ const DataGrid = forwardRef(
|
|
|
4630
4630
|
|
|
4631
4631
|
{/* Opt-in colour legend (config key `legend`: array of
|
|
4632
4632
|
{colour, label}); entries without a colour render as
|
|
4633
|
-
plain lead-in text
|
|
4633
|
+
plain lead-in text.
|
|
4634
|
+
|
|
4635
|
+
Styling lives in DataGrid.module.scss (`.legend` and
|
|
4636
|
+
friends) rather than inline, so a consuming project can
|
|
4637
|
+
actually reach it — see the notes there. The only inline
|
|
4638
|
+
style left is the swatch's own fill, which is data from
|
|
4639
|
+
the config rather than a design decision. */}
|
|
4634
4640
|
{Array.isArray(legend) && legend.length > 0 && (
|
|
4635
|
-
<div
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
width: '14px',
|
|
4659
|
-
height: '14px',
|
|
4660
|
-
borderRadius: '3px',
|
|
4661
|
-
backgroundColor:
|
|
4662
|
-
item.colour || item.color,
|
|
4663
|
-
display: 'inline-block',
|
|
4664
|
-
flexShrink: 0,
|
|
4665
|
-
}}
|
|
4666
|
-
/>
|
|
4667
|
-
)}
|
|
4668
|
-
{item.label}
|
|
4669
|
-
</span>
|
|
4670
|
-
))}
|
|
4641
|
+
<div className={styles.legend}>
|
|
4642
|
+
{legend.map((item, index) => {
|
|
4643
|
+
const swatch = item.colour || item.color;
|
|
4644
|
+
|
|
4645
|
+
return (
|
|
4646
|
+
<span
|
|
4647
|
+
key={index}
|
|
4648
|
+
className={
|
|
4649
|
+
swatch
|
|
4650
|
+
? styles.legendItem
|
|
4651
|
+
: `${styles.legendItem} ${styles.legendLead}`
|
|
4652
|
+
}
|
|
4653
|
+
>
|
|
4654
|
+
{swatch && (
|
|
4655
|
+
<span
|
|
4656
|
+
className={styles.legendSwatch}
|
|
4657
|
+
style={{ backgroundColor: swatch }}
|
|
4658
|
+
/>
|
|
4659
|
+
)}
|
|
4660
|
+
{item.label}
|
|
4661
|
+
</span>
|
|
4662
|
+
);
|
|
4663
|
+
})}
|
|
4671
4664
|
</div>
|
|
4672
4665
|
)}
|
|
4673
4666
|
|
|
@@ -526,6 +526,94 @@
|
|
|
526
526
|
justify-content: flex-end;
|
|
527
527
|
}
|
|
528
528
|
|
|
529
|
+
/* ============================================================================
|
|
530
|
+
Colour legend
|
|
531
|
+
----------------------------------------------------------------------------
|
|
532
|
+
The opt-in caption above the grid (config key `legend`: an array of
|
|
533
|
+
`{ colour | color, label }`, where an entry carrying no colour renders as
|
|
534
|
+
lead-in text introducing the swatches after it).
|
|
535
|
+
|
|
536
|
+
This was inline styles on the elements themselves — `fontSize: '0.8rem'`,
|
|
537
|
+
`color: '#555'`, a hardcoded 14px swatch, `padding: '6px 4px 8px'`. Inline
|
|
538
|
+
styles are unreachable from a consuming project's stylesheet, so the one
|
|
539
|
+
thing a legend needs to be — tuned to the app it sits in — was the one
|
|
540
|
+
thing it could not be. It was also set off any scale in the library: 0.8rem
|
|
541
|
+
falls between two steps of the type ramp, and #555 is a grey that appears
|
|
542
|
+
nowhere else.
|
|
543
|
+
|
|
544
|
+
It is a caption for the table below it, so it is set as one: the same
|
|
545
|
+
`--font-size-xs`, `--muted-color` and `--font-weight-semibold` the grid's
|
|
546
|
+
own header row uses, so the two label rows stacked above the data read as
|
|
547
|
+
one family. It deliberately stops short of that header's uppercase and
|
|
548
|
+
0.06em tracking — legend labels are sentences ("No Goods Received entered
|
|
549
|
+
yet"), not column names, and setting a sentence in caps would undo the
|
|
550
|
+
quiet the rest of this is after.
|
|
551
|
+
|
|
552
|
+
Density hooks, following the `--nav-*` set documented at the top of
|
|
553
|
+
Navigation.module.scss: every declaration below is written
|
|
554
|
+
`var(--hook, <the value it always had>)`, so an unset hook is a no-op and a
|
|
555
|
+
project retunes from `:root` with no fork, no prop and no class of its own.
|
|
556
|
+
The plant-floor tablet case is the one that needs them — 12px is small when
|
|
557
|
+
the screen is at arm's length on a bench.
|
|
558
|
+
|
|
559
|
+
--grid-legend-font-size label type size.
|
|
560
|
+
default: var(--font-size-xs, 0.75rem)
|
|
561
|
+
--grid-legend-gap space between entries along a line.
|
|
562
|
+
default: var(--spacing-md, 1rem)
|
|
563
|
+
--grid-legend-swatch-size the colour chip. default: 0.875rem (14px)
|
|
564
|
+
========================================================================= */
|
|
565
|
+
|
|
566
|
+
.legend {
|
|
567
|
+
display: flex;
|
|
568
|
+
flex-wrap: wrap;
|
|
569
|
+
align-items: center;
|
|
570
|
+
/* Row gap and column gap differ on purpose: a legend that wraps (despatch
|
|
571
|
+
runs to seven entries) needs its lines closer together than its entries
|
|
572
|
+
are along a line, or the wrapped rows read as separate captions. */
|
|
573
|
+
gap: var(--spacing-sm, 0.5rem)
|
|
574
|
+
var(--grid-legend-gap, var(--spacing-md, 1rem));
|
|
575
|
+
/* A caption belongs to the thing it describes, so it sits nearer the grid
|
|
576
|
+
than the toolbar row above it — which is also what stops it crowding
|
|
577
|
+
that row, the complaint this change came from. No horizontal padding:
|
|
578
|
+
`.dataGridContainer` has none either, so the caption starts on the
|
|
579
|
+
grid's own left edge rather than floating 4px off it. */
|
|
580
|
+
margin: var(--spacing-md, 1rem) 0 var(--spacing-sm, 0.5rem);
|
|
581
|
+
padding: 0;
|
|
582
|
+
font-size: var(--grid-legend-font-size, var(--font-size-xs, 0.75rem));
|
|
583
|
+
line-height: 1.4;
|
|
584
|
+
color: var(--muted-color, #6b7688);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.legendItem {
|
|
588
|
+
display: inline-flex;
|
|
589
|
+
align-items: center;
|
|
590
|
+
gap: var(--spacing-xs, 0.25rem);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/* The lead-in entry: a legend line with no colour of its own, labelling the
|
|
594
|
+
swatches that follow. Weight and a darker ink rather than a different size,
|
|
595
|
+
so it introduces the row without breaking its line. */
|
|
596
|
+
.legendLead {
|
|
597
|
+
font-weight: var(--font-weight-semibold, 600);
|
|
598
|
+
color: var(--paragraph-color, #374151);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.legendSwatch {
|
|
602
|
+
width: var(--grid-legend-swatch-size, 0.875rem);
|
|
603
|
+
height: var(--grid-legend-swatch-size, 0.875rem);
|
|
604
|
+
flex-shrink: 0;
|
|
605
|
+
display: inline-block;
|
|
606
|
+
border-radius: var(--radius-sm, 6px);
|
|
607
|
+
/* These are row tints, so they are pale by design — #FFEAEA has no edge
|
|
608
|
+
of its own against a white page and the swatch dissolves into it. A
|
|
609
|
+
low-alpha ink hairline gives every chip its shape back while staying
|
|
610
|
+
invisible against the darker ones. `--border-color` is the wrong token
|
|
611
|
+
here: it is tuned to be barely there on a white surface, which is
|
|
612
|
+
exactly where it is needed most. */
|
|
613
|
+
border: 1px solid rgba(var(--paragraph-color-rgb, 34, 30, 51), 0.18);
|
|
614
|
+
box-sizing: border-box;
|
|
615
|
+
}
|
|
616
|
+
|
|
529
617
|
/* Date field styling for uniform width */
|
|
530
618
|
:global {
|
|
531
619
|
// Target date cells specifically
|