@ox0/ui 3.0.1 → 3.0.3

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 ADDED
@@ -0,0 +1,60 @@
1
+ # @ox0/ui
2
+
3
+ Accessible React components and layout primitives for data-heavy apps, styled by
4
+ [`@ox0/tokens`](https://esturcke.github.io/ox0-docs/tokens) and translatable through react-intl.
5
+
6
+ **Documentation:** [https://esturcke.github.io/ox0-docs/ui](https://esturcke.github.io/ox0-docs/ui), with a live example and props table for every
7
+ component.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pnpm add @ox0/ui @ox0/tokens react-intl
13
+ ```
14
+
15
+ Requires React 19. `react-intl` is a required peer: every string ox0 shows goes through it.
16
+
17
+ ## Set up
18
+
19
+ ```tsx
20
+ import "@ox0/tokens/styles.css"
21
+ import "@ox0/tokens/themes/stone.css"
22
+ import { defaultUiMessages, Ox0Provider } from "@ox0/ui"
23
+
24
+ export function Root() {
25
+ return (
26
+ <Ox0Provider
27
+ neutralTheme="stone"
28
+ colorScheme="system"
29
+ locale="en"
30
+ messages={{ ...defaultUiMessages, ...appMessages }}
31
+ navigate={(href) => navigate(href)} // your router's, so <Link> navigates in the app
32
+ >
33
+ <App />
34
+ </Ox0Provider>
35
+ )
36
+ }
37
+ ```
38
+
39
+ `Ox0Provider` manages color scheme, density and font scale, sets up react-intl, connects ox0's
40
+ links to your router, and hosts toasts. See [Getting started](https://esturcke.github.io/ox0-docs/).
41
+
42
+ ## What's inside
43
+
44
+ - **Layout:** `Stack`, `Inline`, `Grid`, `Split`, `Box`, `Surface`, `Card`.
45
+ - **Fields:** `TextField`, `TextArea`, `NumberField`, `SearchField`, `Select`, `Combobox`,
46
+ `Checkbox`, `CheckboxGroup`, `RadioGroup`, `Switch`, `Slider`, `TagGroup`. All follow one
47
+ field contract (`label`, `description`, `isInvalid`, `errorMessage`, `onChange` with a plain
48
+ value), which [`@ox0/form`](https://esturcke.github.io/ox0-docs/form) binds to schema-validated forms.
49
+ - **Overlays and navigation:** `Dialog`, `Drawer`, `Popover`, `Menu`, `Tooltip`, `Tabs`,
50
+ `Accordion`, `Breadcrumbs`, `Link`.
51
+ - **Display:** `Table`, `Badge`, `Banner`, `Toast`, `Text`, `Heading`, `Code`, `CodeBlock`,
52
+ `Numeric`, `Skeleton`, `Spinner`, and more.
53
+
54
+ Components don't take `className` or `style`: compose them, and use the structural prop mixins
55
+ (see [Prop mixins](https://esturcke.github.io/ox0-docs/ui/mixins)).
56
+
57
+ ## Translating
58
+
59
+ `defaultUiMessages` maps ox0's message ids (`ox0.*`) to English. Add it to your catalog and
60
+ translate the same ids per locale. See [i18n](https://esturcke.github.io/ox0-docs/i18n).
@@ -1 +1 @@
1
- {"version":3,"file":"text-area.d.ts","sourceRoot":"","sources":["../../src/components/text-area.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAA;AAId,MAAM,WAAW,aAAc,SAAQ,IAAI,CACzC,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,YAAY,GAAG,UAAU,GAAG,UAAU,CACvC;IACC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAA;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAA;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,uDAAuD;IACvD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C;AAED,eAAO,MAAM,QAAQ,+GAmGnB,CAAA"}
1
+ {"version":3,"file":"text-area.d.ts","sourceRoot":"","sources":["../../src/components/text-area.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAA;AAId,MAAM,WAAW,aAAc,SAAQ,IAAI,CACzC,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,YAAY,GAAG,UAAU,GAAG,UAAU,CACvC;IACC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAA;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAA;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,uDAAuD;IACvD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C;AAED,eAAO,MAAM,QAAQ,+GAqGnB,CAAA"}
package/dist/index.js CHANGED
@@ -3931,6 +3931,37 @@ div.tag-ueb2Qr.selected-a1JhC8[data-selectable]:hover {
3931
3931
  padding-block: 0;
3932
3932
  }
3933
3933
 
3934
+ .textarea-f9gopi {
3935
+ background: var(--ox0-color-surface);
3936
+ border: 1px solid var(--ox0-color-border);
3937
+ border-radius: var(--ox0-radius-sm);
3938
+ box-sizing: border-box;
3939
+ padding-inline: var(--ox0-space-md);
3940
+ transition: border-color var(--ox0-duration-fast) var(--ox0-ease-crisp),
3941
+ box-shadow var(--ox0-duration-fast) var(--ox0-ease-crisp);
3942
+ }
3943
+
3944
+ .textarea-f9gopi:hover {
3945
+ border-color: var(--ox0-color-border-strong);
3946
+ }
3947
+
3948
+ .textarea-f9gopi:focus-visible {
3949
+ border-color: var(--ox0-color-accent);
3950
+ box-shadow: 0 0 0 3px var(--ox0-color-focus-ring);
3951
+ }
3952
+
3953
+ .textarea-f9gopi.invalid-M29JY3 {
3954
+ border-color: var(--ox0-color-danger);
3955
+ }
3956
+
3957
+ .textarea-f9gopi.invalid-M29JY3:focus-visible {
3958
+ box-shadow: 0 0 0 3px var(--ox0-color-danger-subtle);
3959
+ }
3960
+
3961
+ .textarea-f9gopi:disabled {
3962
+ background: var(--ox0-color-canvas);
3963
+ }
3964
+
3934
3965
  .input-pJgRNM::placeholder {
3935
3966
  color: var(--ox0-color-disabled);
3936
3967
  }
@@ -3983,6 +4014,7 @@ div.tag-ueb2Qr.selected-a1JhC8[data-selectable]:hover {
3983
4014
  invalid: "invalid-M29JY3",
3984
4015
  icon: "icon-SJ2fI8",
3985
4016
  input: "input-pJgRNM",
4017
+ textarea: "textarea-f9gopi",
3986
4018
  clear: "clear-eMD0M3",
3987
4019
  description: "description-U5SfzR",
3988
4020
  error: "error-PaIi5f"
@@ -9301,12 +9333,13 @@ const text_area_TextArea = /*#__PURE__*/ forwardRef(function({ ariaLabel, classN
9301
9333
  const el = ref.current;
9302
9334
  if (!el) return;
9303
9335
  el.style.height = "auto";
9304
- const lineHeight = parseFloat(getComputedStyle(el).lineHeight);
9305
- const paddingTop = parseFloat(getComputedStyle(el).paddingTop);
9306
- const paddingBottom = parseFloat(getComputedStyle(el).paddingBottom);
9307
- const min = paddingTop + paddingBottom + minLines * lineHeight;
9308
- const max = 1 / 0 === maxLines ? 1 / 0 : paddingTop + paddingBottom + maxLines * lineHeight;
9309
- el.style.height = `${Math.min(Math.max(el.scrollHeight, min), max)}px`;
9336
+ const computed = getComputedStyle(el);
9337
+ const lineHeight = parseFloat(computed.lineHeight);
9338
+ const padding = parseFloat(computed.paddingTop) + parseFloat(computed.paddingBottom);
9339
+ const border = parseFloat(computed.borderTopWidth) + parseFloat(computed.borderBottomWidth);
9340
+ const min = padding + minLines * lineHeight;
9341
+ const max = 1 / 0 === maxLines ? 1 / 0 : padding + maxLines * lineHeight;
9342
+ el.style.height = `${Math.min(Math.max(el.scrollHeight, min), max) + border}px`;
9310
9343
  el.style.overflowY = el.scrollHeight > max ? "auto" : "hidden";
9311
9344
  }
9312
9345
  useEffect(()=>{
@@ -9335,6 +9368,7 @@ const text_area_TextArea = /*#__PURE__*/ forwardRef(function({ ariaLabel, classN
9335
9368
  "aria-label": ariaLabel,
9336
9369
  className: [
9337
9370
  text_field_module.input,
9371
+ text_field_module.textarea,
9338
9372
  invalid ? text_field_module.invalid : null,
9339
9373
  className
9340
9374
  ].filter(Boolean).join(" "),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox0/ui",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/esturcke/ox0-platform.git",
@@ -24,8 +24,8 @@
24
24
  "@floating-ui/react": "^0.27.19",
25
25
  "react-aria": "^3.52.1",
26
26
  "react-stately": "^3.50.0",
27
- "@ox0/i18n": "0.3.2",
28
27
  "@ox0/hooks": "0.2.2",
28
+ "@ox0/i18n": "0.3.3",
29
29
  "@ox0/tokens": "0.4.0"
30
30
  },
31
31
  "peerDependencies": {