@kcascend/liquid-ui 0.0.4 → 0.0.5

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/README.md CHANGED
@@ -10,23 +10,22 @@
10
10
 
11
11
  ## Grid usage
12
12
 
13
- The package exposes a grid primitive through `GridLayout` and `GridColumn`.
13
+ The package exposes a grid primitive through `GridLayout` and `GridColumn`, plus an approved layout catalog for application shells and content regions.
14
14
 
15
15
  ```tsx
16
- import { GridColumn, GridLayout } from '@kcascend/liquid-ui';
16
+ import {
17
+ approvedContentLayoutPatterns,
18
+ GridColumn,
19
+ GridLayout,
20
+ } from '@kcascend/liquid-ui';
17
21
 
18
22
  export function Example() {
23
+ const layout = approvedContentLayoutPatterns.sidebarEnd;
24
+
19
25
  return (
20
26
  <GridLayout as="div">
21
- <GridColumn sm={4} md={4} lg={8}>
22
- Primary
23
- </GridColumn>
24
- <GridColumn sm={2} md={2} lg={4}>
25
- Secondary A
26
- </GridColumn>
27
- <GridColumn sm={2} md={2} lg={4}>
28
- Secondary B
29
- </GridColumn>
27
+ <GridColumn {...layout.regions.primary}>Primary</GridColumn>
28
+ <GridColumn {...layout.regions.secondary}>Secondary</GridColumn>
30
29
  </GridLayout>
31
30
  );
32
31
  }
@@ -42,6 +41,12 @@ Supported layout features:
42
41
  - `subgrid` for nested grids that inherit the parent column scaffold.
43
42
  - Auto columns when a `GridColumn` is rendered without explicit breakpoint props.
44
43
 
44
+ Approved layout guidance:
45
+
46
+ - Start application shells from `approvedShellRows`.
47
+ - Start page content from `approvedContentLayoutPatterns`.
48
+ - Introduce a bespoke breakpoint map only when a screen cannot be expressed by the approved patterns and that exception is documented in a spec.
49
+
45
50
  ## Figma governance
46
51
 
47
52
  Every reusable component must record an approved Figma reference in story metadata or component documentation before it is considered ready for review. The initial workflow example in this package uses the Liquid token source in Figma
@@ -1,3 +1,4 @@
1
- import type { CheckboxProps } from '../../types';
1
+ import type { CheckboxGroupProps, CheckboxProps } from '../../types';
2
2
  export declare function Checkbox({ className, id, indeterminate, label, hideLabel, style, disabled, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function CheckboxGroup({ legend, helperText, errorText, warningText, className, style, children, }: CheckboxGroupProps): import("react/jsx-runtime").JSX.Element;
3
4
  //# sourceMappingURL=Checkbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD,wBAAgB,QAAQ,CAAC,EACvB,SAAS,EACT,EAAE,EACF,aAAqB,EACrB,KAAK,EACL,SAAiB,EACjB,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,aAAa,2CAkDf"}
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMrE,wBAAgB,QAAQ,CAAC,EACvB,SAAS,EACT,EAAE,EACF,aAAqB,EACrB,KAAK,EACL,SAAiB,EACjB,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,aAAa,2CAkDf;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE,kBAAkB,2CA0BpB"}
@@ -15,3 +15,12 @@ export function Checkbox({ className, id, indeterminate = false, label, hideLabe
15
15
  }, [indeterminate]);
16
16
  return (_jsxs("label", { className: getClassName(className), style: style, "data-disabled": disabled || undefined, children: [_jsx("input", { ...props, ref: inputRef, type: "checkbox", id: inputId, disabled: disabled, className: "liquid-checkbox__input" }), _jsxs("span", { className: "liquid-checkbox__box", "aria-hidden": "true", children: [_jsx(Icon, { className: "liquid-checkbox__check-icon", color: "var(--component-checkbox-icon-check, #ffffff)", name: "check", size: 14 }), _jsx(Icon, { className: "liquid-checkbox__dash-icon", color: "var(--component-checkbox-icon-check, #ffffff)", name: "dash", size: 14 })] }), label ? (_jsx("span", { className: hideLabel ? 'liquid-sr-only' : 'liquid-checkbox__label-text', children: label })) : null] }));
17
17
  }
18
+ export function CheckboxGroup({ legend, helperText, errorText, warningText, className, style, children, }) {
19
+ const statusText = errorText ?? warningText ?? helperText;
20
+ const statusClass = errorText
21
+ ? 'liquid-checkbox-group__status--error'
22
+ : warningText
23
+ ? 'liquid-checkbox-group__status--warning'
24
+ : 'liquid-checkbox-group__status--helper';
25
+ return (_jsxs("fieldset", { className: ['liquid-checkbox-group', className].filter(Boolean).join(' '), style: style, children: [legend ? (_jsx("legend", { className: "liquid-checkbox-group__legend", children: legend })) : null, _jsxs("div", { className: "liquid-checkbox-group__options-helper", children: [_jsx("div", { className: "liquid-checkbox-group__items", children: children }), statusText ? (_jsx("span", { className: `liquid-checkbox-group__status ${statusClass}`, children: statusText })) : null] })] }));
26
+ }
@@ -0,0 +1,5 @@
1
+ import type { GridColumnProps, ApprovedContentLayoutPattern, ApprovedShellRowConfig } from '../../types';
2
+ export declare const approvedShellRows: Record<'header' | 'search' | 'results' | 'footer', ApprovedShellRowConfig>;
3
+ export declare const approvedContentLayoutPatterns: Record<'single' | 'sidebarStart' | 'sidebarEnd' | 'splitEqual', ApprovedContentLayoutPattern>;
4
+ export declare function getApprovedContentLayoutColumns(patternName: keyof typeof approvedContentLayoutPatterns): Record<'primary' | 'secondary' | 'tertiary', GridColumnProps | undefined>;
5
+ //# sourceMappingURL=layoutPatterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layoutPatterns.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/layoutPatterns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAGf,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAoBrB,eAAO,MAAM,iBAAiB,EAAE,MAAM,CACpC,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,EAC1C,sBAAsB,CAqBvB,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAChD,QAAQ,GAAG,cAAc,GAAG,YAAY,GAAG,YAAY,EACvD,4BAA4B,CA0D7B,CAAC;AAEF,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,MAAM,OAAO,6BAA6B,GACtD,MAAM,CAAC,SAAS,GAAG,WAAW,GAAG,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC,CAY3E"}
@@ -0,0 +1,90 @@
1
+ function pickResponsiveColumns(columns) {
2
+ return columns;
3
+ }
4
+ function pickLayoutProps(props) {
5
+ return props;
6
+ }
7
+ function toGridColumnProps(columns) {
8
+ return columns;
9
+ }
10
+ export const approvedShellRows = {
11
+ header: {
12
+ description: 'Full-width header row aligned to the global shell column map.',
13
+ layout: pickLayoutProps({ fullWidth: true, withRowGap: false }),
14
+ },
15
+ search: {
16
+ description: 'Standard-gutter search row for filters and query controls.',
17
+ layout: pickLayoutProps({ fullWidth: false, withRowGap: false }),
18
+ },
19
+ results: {
20
+ description: 'Standard-gutter results row. Start from an approved content pattern before introducing bespoke spans.',
21
+ layout: pickLayoutProps({ fullWidth: false, withRowGap: false }),
22
+ },
23
+ footer: {
24
+ description: 'Full-width footer row for meta content and secondary actions.',
25
+ layout: pickLayoutProps({ fullWidth: true, withRowGap: false }),
26
+ },
27
+ };
28
+ export const approvedContentLayoutPatterns = {
29
+ single: {
30
+ description: 'Single-column content for forms, detail views, and uninterrupted reading flows.',
31
+ guidance: 'Prefer this when secondary content is optional or can move below the primary flow.',
32
+ regions: {
33
+ primary: pickResponsiveColumns({
34
+ sm: 4,
35
+ md: 8,
36
+ lg: 16,
37
+ xlg: 16,
38
+ max: 16,
39
+ }),
40
+ },
41
+ },
42
+ sidebarStart: {
43
+ description: 'Leading sidebar with primary content to the right.',
44
+ guidance: 'Use for filter, navigation, or status sidebars that should stack above content on smaller viewports.',
45
+ regions: {
46
+ primary: pickResponsiveColumns({
47
+ sm: 4,
48
+ md: 8,
49
+ lg: 12,
50
+ xlg: 12,
51
+ max: 12,
52
+ }),
53
+ secondary: pickResponsiveColumns({ sm: 4, md: 8, lg: 4, xlg: 4, max: 4 }),
54
+ },
55
+ },
56
+ sidebarEnd: {
57
+ description: 'Primary content first, with a trailing sidebar on wider breakpoints.',
58
+ guidance: 'Use for supporting context that should remain visible on desktop without preceding the main task.',
59
+ regions: {
60
+ primary: pickResponsiveColumns({
61
+ sm: 4,
62
+ md: 8,
63
+ lg: 12,
64
+ xlg: 12,
65
+ max: 12,
66
+ }),
67
+ secondary: pickResponsiveColumns({ sm: 4, md: 8, lg: 4, xlg: 4, max: 4 }),
68
+ },
69
+ },
70
+ splitEqual: {
71
+ description: 'Balanced two-up layout for peer content such as comparisons or dual work areas.',
72
+ guidance: 'Use when both regions have equal task weight. Avoid for filters or auxiliary status panels.',
73
+ regions: {
74
+ primary: pickResponsiveColumns({ sm: 4, md: 8, lg: 8, xlg: 8, max: 8 }),
75
+ secondary: pickResponsiveColumns({ sm: 4, md: 8, lg: 8, xlg: 8, max: 8 }),
76
+ },
77
+ },
78
+ };
79
+ export function getApprovedContentLayoutColumns(patternName) {
80
+ const pattern = approvedContentLayoutPatterns[patternName];
81
+ return {
82
+ primary: toGridColumnProps(pattern.regions.primary),
83
+ secondary: pattern.regions.secondary
84
+ ? toGridColumnProps(pattern.regions.secondary)
85
+ : undefined,
86
+ tertiary: pattern.regions.tertiary
87
+ ? toGridColumnProps(pattern.regions.tertiary)
88
+ : undefined,
89
+ };
90
+ }