@ladder-ui/field 0.4.0 → 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/dist/field.css CHANGED
@@ -1,47 +1 @@
1
- @layer components {
2
- .lui-field {
3
- display: flex;
4
- flex-direction: column;
5
- gap: var(--lui-field-gap);
6
- }
7
- .lui-field--horizontal {
8
- flex-direction: row;
9
- align-items: center;
10
- flex-wrap: wrap;
11
- gap: var(--lui-field-gap);
12
- }
13
- .lui-field[data-disabled=true] .lui-field-label,
14
- .lui-field[data-disabled=true] .lui-field-description {
15
- opacity: 0.5;
16
- }
17
- .lui-field[data-invalid=true] .lui-field-label {
18
- color: var(--lui-field-error-color);
19
- }
20
- .lui-field-label {
21
- display: block;
22
- color: var(--lui-field-label-color);
23
- font-family: var(--lui-font-family);
24
- font-size: var(--lui-field-label-size);
25
- font-weight: 400;
26
- line-height: 1.4;
27
- }
28
- .lui-field-description {
29
- margin: 0;
30
- color: var(--lui-field-description-color);
31
- font-family: var(--lui-font-family);
32
- font-size: var(--lui-field-description-size);
33
- line-height: 1.5;
34
- }
35
- .lui-field-error {
36
- margin: 0;
37
- color: var(--lui-field-error-color);
38
- font-family: var(--lui-font-family);
39
- font-size: var(--lui-field-error-size);
40
- line-height: 1.5;
41
- }
42
- .lui-field-group {
43
- display: flex;
44
- flex-direction: column;
45
- gap: var(--lui-field-group-gap);
46
- }
47
- }
1
+ @layer components{.lui-field{display:flex;flex-direction:column;gap:var(--lui-field-gap)}.lui-field--horizontal{align-items:center;flex-direction:row;flex-wrap:wrap;gap:var(--lui-field-gap)}.lui-field[data-disabled=true] .lui-field-description,.lui-field[data-disabled=true] .lui-field-label{opacity:.5}.lui-field[data-invalid=true] .lui-field-label{color:var(--lui-field-error-color)}.lui-field-label{color:var(--lui-field-label-color);display:block;font-family:var(--lui-font-family);font-size:var(--lui-field-label-size);font-weight:400;line-height:1.4}.lui-field-description{color:var(--lui-field-description-color);font-size:var(--lui-field-description-size)}.lui-field-description,.lui-field-error{font-family:var(--lui-font-family);line-height:1.5;margin:0}.lui-field-error{color:var(--lui-field-error-color);font-size:var(--lui-field-error-size)}.lui-field-group{display:flex;flex-direction:column;gap:var(--lui-field-group-gap)}}
@@ -1,15 +1 @@
1
- @charset "UTF-8";
2
- :root {
3
- /* Layout */
4
- --lui-field-gap: 0.375rem;
5
- --lui-field-group-gap: 1rem;
6
- /* Label — field-specific overrides of @ladder-ui/label base tokens */
7
- --lui-field-label-color: var(--lui-text-primary);
8
- --lui-field-label-size: var(--lui-font-size-sm);
9
- /* Description */
10
- --lui-field-description-color: color-mix(in srgb, var(--lui-text-primary) 60%, transparent);
11
- --lui-field-description-size: var(--lui-font-size-xs);
12
- /* Error */
13
- --lui-field-error-color: var(--lui-error);
14
- --lui-field-error-size: var(--lui-font-size-xs);
15
- }
1
+ :root{--lui-field-gap:0.375rem;--lui-field-group-gap:1rem;--lui-field-label-color:var(--lui-text-primary);--lui-field-label-size:var(--lui-font-size-sm);--lui-field-description-color:color-mix(in srgb,var(--lui-text-primary) 60%,transparent);--lui-field-description-size:var(--lui-font-size-xs);--lui-field-error-color:var(--lui-error);--lui-field-error-size:var(--lui-font-size-xs)}
package/dist/index.js CHANGED
@@ -1,78 +1 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var concatClassNames = require('@ladder-ui/core/concatClassNames');
5
- var label = require('@ladder-ui/label');
6
-
7
- /**
8
- * Field — semantic wrapper for a single form field.
9
- *
10
- * Provides layout (label + control + description + error) and propagates
11
- * disabled/invalid state to child components via `data-disabled` / `data-invalid`
12
- * HTML attributes, which are picked up by CSS selectors.
13
- *
14
- * Usage:
15
- * ```tsx
16
- * <Field>
17
- * <FieldLabel htmlFor="email">Email</FieldLabel>
18
- * <Input id="email" type="email" />
19
- * <FieldDescription>We'll never share your email.</FieldDescription>
20
- * </Field>
21
- *
22
- * <Field data-invalid="true">
23
- * <FieldLabel htmlFor="user">Username</FieldLabel>
24
- * <Input id="user" status="error" aria-invalid="true" />
25
- * <FieldError>Username already taken.</FieldError>
26
- * </Field>
27
- * ```
28
- */
29
- function Field({ ref, className, orientation = "vertical", ...props }) {
30
- return (jsxRuntime.jsx("div", { ref: ref, className: concatClassNames("lui-field", orientation === "horizontal" && "lui-field--horizontal", className), ...props }));
31
- }
32
- Field.displayName = "Field";
33
- /**
34
- * FieldLabel — a `Label` scoped to a `Field` compound component.
35
- *
36
- * Wraps `@ladder-ui/label`'s `Label` and adds the `lui-field-label` class so
37
- * the parent `Field` can apply context-aware styles:
38
- * - Dims when `<Field data-disabled="true">` is set
39
- * - Turns error-color when `<Field data-invalid="true">` is set
40
- *
41
- * For labels **outside a Field** context, use `Label` from `@ladder-ui/label`
42
- * directly — it provides the same accessible `<label>` element with styling
43
- * but without the Field-specific context.
44
- */
45
- function FieldLabel({ ref, className, ...props }) {
46
- return (jsxRuntime.jsx(label.Label, { ref: ref, className: concatClassNames("lui-field-label", className), ...props }));
47
- }
48
- FieldLabel.displayName = "FieldLabel";
49
- /**
50
- * FieldDescription — muted helper text rendered below the control.
51
- * Dims automatically when the parent `<Field>` has `data-disabled="true"`.
52
- */
53
- function FieldDescription({ ref, className, ...props }) {
54
- return (jsxRuntime.jsx("p", { ref: ref, className: concatClassNames("lui-field-description", className), ...props }));
55
- }
56
- FieldDescription.displayName = "FieldDescription";
57
- /**
58
- * FieldError — error text rendered below the control.
59
- * Has `role="alert"` for live-region announcements.
60
- * Only meaningful when the parent `<Field>` has `data-invalid="true"`.
61
- */
62
- function FieldError({ ref, className, ...props }) {
63
- return (jsxRuntime.jsx("p", { ref: ref, role: "alert", className: concatClassNames("lui-field-error", className), ...props }));
64
- }
65
- FieldError.displayName = "FieldError";
66
- /**
67
- * FieldGroup — groups multiple `<Field>` elements with a consistent vertical gap.
68
- */
69
- function FieldGroup({ ref, className, ...props }) {
70
- return (jsxRuntime.jsx("div", { ref: ref, className: concatClassNames("lui-field-group", className), ...props }));
71
- }
72
- FieldGroup.displayName = "FieldGroup";
73
-
74
- exports.Field = Field;
75
- exports.FieldDescription = FieldDescription;
76
- exports.FieldError = FieldError;
77
- exports.FieldGroup = FieldGroup;
78
- exports.FieldLabel = FieldLabel;
1
+ "use strict";var e=require("react/jsx-runtime"),r=require("@ladder-ui/core/concatClassNames"),i=require("@ladder-ui/label");function l({ref:i,className:l,orientation:a="vertical",...s}){return e.jsx("div",{ref:i,className:r("lui-field","horizontal"===a&&"lui-field--horizontal",l),...s})}function a({ref:l,className:a,...s}){return e.jsx(i.Label,{ref:l,className:r("lui-field-label",a),...s})}function s({ref:i,className:l,...a}){return e.jsx("p",{ref:i,className:r("lui-field-description",l),...a})}function t({ref:i,className:l,...a}){return e.jsx("p",{ref:i,role:"alert",className:r("lui-field-error",l),...a})}function d({ref:i,className:l,...a}){return e.jsx("div",{ref:i,className:r("lui-field-group",l),...a})}l.displayName="Field",a.displayName="FieldLabel",s.displayName="FieldDescription",t.displayName="FieldError",d.displayName="FieldGroup",exports.Field=l,exports.FieldDescription=s,exports.FieldError=t,exports.FieldGroup=d,exports.FieldLabel=a;
package/dist/index.mjs CHANGED
@@ -1,72 +1 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import concatClassNames from '@ladder-ui/core/concatClassNames';
3
- import { Label } from '@ladder-ui/label';
4
-
5
- /**
6
- * Field — semantic wrapper for a single form field.
7
- *
8
- * Provides layout (label + control + description + error) and propagates
9
- * disabled/invalid state to child components via `data-disabled` / `data-invalid`
10
- * HTML attributes, which are picked up by CSS selectors.
11
- *
12
- * Usage:
13
- * ```tsx
14
- * <Field>
15
- * <FieldLabel htmlFor="email">Email</FieldLabel>
16
- * <Input id="email" type="email" />
17
- * <FieldDescription>We'll never share your email.</FieldDescription>
18
- * </Field>
19
- *
20
- * <Field data-invalid="true">
21
- * <FieldLabel htmlFor="user">Username</FieldLabel>
22
- * <Input id="user" status="error" aria-invalid="true" />
23
- * <FieldError>Username already taken.</FieldError>
24
- * </Field>
25
- * ```
26
- */
27
- function Field({ ref, className, orientation = "vertical", ...props }) {
28
- return (jsx("div", { ref: ref, className: concatClassNames("lui-field", orientation === "horizontal" && "lui-field--horizontal", className), ...props }));
29
- }
30
- Field.displayName = "Field";
31
- /**
32
- * FieldLabel — a `Label` scoped to a `Field` compound component.
33
- *
34
- * Wraps `@ladder-ui/label`'s `Label` and adds the `lui-field-label` class so
35
- * the parent `Field` can apply context-aware styles:
36
- * - Dims when `<Field data-disabled="true">` is set
37
- * - Turns error-color when `<Field data-invalid="true">` is set
38
- *
39
- * For labels **outside a Field** context, use `Label` from `@ladder-ui/label`
40
- * directly — it provides the same accessible `<label>` element with styling
41
- * but without the Field-specific context.
42
- */
43
- function FieldLabel({ ref, className, ...props }) {
44
- return (jsx(Label, { ref: ref, className: concatClassNames("lui-field-label", className), ...props }));
45
- }
46
- FieldLabel.displayName = "FieldLabel";
47
- /**
48
- * FieldDescription — muted helper text rendered below the control.
49
- * Dims automatically when the parent `<Field>` has `data-disabled="true"`.
50
- */
51
- function FieldDescription({ ref, className, ...props }) {
52
- return (jsx("p", { ref: ref, className: concatClassNames("lui-field-description", className), ...props }));
53
- }
54
- FieldDescription.displayName = "FieldDescription";
55
- /**
56
- * FieldError — error text rendered below the control.
57
- * Has `role="alert"` for live-region announcements.
58
- * Only meaningful when the parent `<Field>` has `data-invalid="true"`.
59
- */
60
- function FieldError({ ref, className, ...props }) {
61
- return (jsx("p", { ref: ref, role: "alert", className: concatClassNames("lui-field-error", className), ...props }));
62
- }
63
- FieldError.displayName = "FieldError";
64
- /**
65
- * FieldGroup — groups multiple `<Field>` elements with a consistent vertical gap.
66
- */
67
- function FieldGroup({ ref, className, ...props }) {
68
- return (jsx("div", { ref: ref, className: concatClassNames("lui-field-group", className), ...props }));
69
- }
70
- FieldGroup.displayName = "FieldGroup";
71
-
72
- export { Field, FieldDescription, FieldError, FieldGroup, FieldLabel };
1
+ import{jsx as e}from"react/jsx-runtime";import r from"@ladder-ui/core/concatClassNames";import{Label as l}from"@ladder-ui/label";function a({ref:l,className:a,orientation:i="vertical",...s}){return e("div",{ref:l,className:r("lui-field","horizontal"===i&&"lui-field--horizontal",a),...s})}function i({ref:a,className:i,...s}){return e(l,{ref:a,className:r("lui-field-label",i),...s})}function s({ref:l,className:a,...i}){return e("p",{ref:l,className:r("lui-field-description",a),...i})}function o({ref:l,className:a,...i}){return e("p",{ref:l,role:"alert",className:r("lui-field-error",a),...i})}function t({ref:l,className:a,...i}){return e("div",{ref:l,className:r("lui-field-group",a),...i})}a.displayName="Field",i.displayName="FieldLabel",s.displayName="FieldDescription",o.displayName="FieldError",t.displayName="FieldGroup";export{a as Field,s as FieldDescription,o as FieldError,t as FieldGroup,i as FieldLabel};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ladder-ui/field",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -31,7 +31,8 @@
31
31
  "license": "ISC",
32
32
  "repository": {
33
33
  "type": "git",
34
- "url": "git+ssh://git@github.com/ivelaval/ladder-ui.git"
34
+ "url": "https://github.com/ivelaval/ladder-ui.git",
35
+ "directory": "packages/field"
35
36
  },
36
37
  "bugs": {
37
38
  "url": "https://github.com/ivelaval/ladder-ui/issues"
@@ -48,8 +49,8 @@
48
49
  "sass": "^1.90.0",
49
50
  "tslib": "^2.6.2",
50
51
  "typescript": "^5.3.3",
51
- "@ladder-ui/core": "0.4.0",
52
- "@ladder-ui/label": "0.4.0"
52
+ "@ladder-ui/core": "0.5.0",
53
+ "@ladder-ui/label": "0.5.0"
53
54
  },
54
55
  "peerDependencies": {
55
56
  "@ladder-ui/core": ">=0.0.0",