@jsenv/navi 0.7.3 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/navi",
3
- "version": "0.7.3",
3
+ "version": "0.9.0",
4
4
  "description": "Library of components including navigation to create frontend applications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,8 +14,7 @@ import { FormActionContext } from "../action_execution/form_context.js";
14
14
  import { renderActionableComponent } from "../action_execution/render_actionable_component.jsx";
15
15
  import { useAction } from "../action_execution/use_action.js";
16
16
  import { useExecuteAction } from "../action_execution/use_execute_action.js";
17
- import { useConsumAlignProps } from "../layout/flex.jsx";
18
- import { consumeSpacingProps } from "../layout/spacing.jsx";
17
+ import { useLayoutStyle } from "../layout/use_layout_style.js";
19
18
  import { LoaderBackground } from "../loader/loader_background.jsx";
20
19
  import { withPropsClassName } from "../props_composition/with_props_class_name.js";
21
20
  import { withPropsStyle } from "../props_composition/with_props_style.js";
@@ -89,6 +88,7 @@ import.meta.css = /* css */ `
89
88
  .navi_button_content {
90
89
  position: relative;
91
90
  display: inline-flex;
91
+ width: 100%;
92
92
  padding-top: var(--padding-y);
93
93
  padding-right: var(--padding-x);
94
94
  padding-bottom: var(--padding-y);
@@ -212,8 +212,6 @@ const ButtonBasic = forwardRef((props, ref) => {
212
212
 
213
213
  // visual
214
214
  appearance = "navi",
215
- alignX,
216
- alignY,
217
215
  discrete,
218
216
  className,
219
217
  style,
@@ -242,13 +240,8 @@ const ButtonBasic = forwardRef((props, ref) => {
242
240
  appearance === "navi" ? "navi_button" : undefined,
243
241
  className,
244
242
  );
245
- const innerStyle = withPropsStyle(
246
- {
247
- ...consumeSpacingProps(rest),
248
- ...useConsumAlignProps({ alignX, alignY }),
249
- },
250
- style,
251
- );
243
+ const { all } = useLayoutStyle(rest);
244
+ const innerStyle = withPropsStyle(all, style);
252
245
 
253
246
  return (
254
247
  <button
@@ -13,7 +13,7 @@ import { useConstraints } from "../../validation/hooks/use_constraints.js";
13
13
  import { renderActionableComponent } from "../action_execution/render_actionable_component.jsx";
14
14
  import { useActionBoundToOneParam } from "../action_execution/use_action.js";
15
15
  import { useExecuteAction } from "../action_execution/use_execute_action.js";
16
- import { consumeSpacingProps } from "../layout/spacing.jsx";
16
+ import { useLayoutStyle } from "../layout/use_layout_style.js";
17
17
  import {
18
18
  LoadableInlineElement,
19
19
  LoaderBackground,
@@ -333,10 +333,11 @@ const NaviCheckbox = ({
333
333
  return initCustomField(ref.current, inputRef.current);
334
334
  }, []);
335
335
 
336
+ const { all } = useLayoutStyle(rest);
336
337
  const innerStyle = withPropsStyle(
337
338
  {
339
+ ...all,
338
340
  ...(accentColor ? { "--accent-color": accentColor } : {}),
339
- ...consumeSpacingProps(rest),
340
341
  },
341
342
  style,
342
343
  );
@@ -8,7 +8,7 @@ import {
8
8
 
9
9
  import { useConstraints } from "../../validation/hooks/use_constraints.js";
10
10
  import { renderActionableComponent } from "../action_execution/render_actionable_component.jsx";
11
- import { consumeSpacingProps } from "../layout/spacing.jsx";
11
+ import { useLayoutStyle } from "../layout/use_layout_style.js";
12
12
  import {
13
13
  LoadableInlineElement,
14
14
  LoaderBackground,
@@ -372,10 +372,11 @@ const NaviRadio = ({
372
372
  return initCustomField(ref.current, inputRef.current);
373
373
  }, []);
374
374
 
375
+ const { all } = useLayoutStyle(rest);
375
376
  const innerStyle = withPropsStyle(
376
377
  {
378
+ ...all,
377
379
  ...(accentColor ? { "--accent-color": accentColor } : {}),
378
- ...consumeSpacingProps(rest),
379
380
  },
380
381
  style,
381
382
  );
@@ -31,7 +31,7 @@ import { useConstraints } from "../../validation/hooks/use_constraints.js";
31
31
  import { renderActionableComponent } from "../action_execution/render_actionable_component.jsx";
32
32
  import { useActionBoundToOneParam } from "../action_execution/use_action.js";
33
33
  import { useExecuteAction } from "../action_execution/use_execute_action.js";
34
- import { consumeSpacingProps } from "../layout/spacing.jsx";
34
+ import { useLayoutStyle } from "../layout/use_layout_style.js";
35
35
  import { LoadableInlineElement } from "../loader/loader_background.jsx";
36
36
  import { withPropsClassName } from "../props_composition/with_props_class_name.js";
37
37
  import { withPropsStyle } from "../props_composition/with_props_style.js";
@@ -88,6 +88,8 @@ import.meta.css = /* css */ `
88
88
  --color: currentColor;
89
89
  --color-readonly: color-mix(in srgb, currentColor 60%, transparent);
90
90
  --color-disabled: var(--color-readonly);
91
+
92
+ width: 100%;
91
93
  color: var(--color);
92
94
 
93
95
  background-color: var(--background-color);
@@ -170,8 +172,6 @@ const InputTextualBasic = forwardRef((props, ref) => {
170
172
  // visual
171
173
  appearance = "navi",
172
174
  accentColor,
173
- width,
174
- height,
175
175
  className,
176
176
  style,
177
177
 
@@ -199,14 +199,8 @@ const InputTextualBasic = forwardRef((props, ref) => {
199
199
  appearance === "navi" ? "navi_input" : undefined,
200
200
  className,
201
201
  );
202
- const innerStyle = withPropsStyle(
203
- {
204
- width,
205
- height,
206
- ...consumeSpacingProps(rest),
207
- },
208
- style,
209
- );
202
+ const { margin, padding, alignment, expansion } = useLayoutStyle(rest);
203
+ const innerStyle = withPropsStyle(padding, style);
210
204
  const inputTextual = (
211
205
  <input
212
206
  {...rest}
@@ -254,11 +248,12 @@ const InputTextualBasic = forwardRef((props, ref) => {
254
248
  <LoadableInlineElement
255
249
  loading={innerLoading}
256
250
  style={{
251
+ ...margin,
252
+ ...alignment,
253
+ ...expansion,
257
254
  "--accent-color": accentColor || "light-dark(#355fcc, #4476ff)",
258
255
  }}
259
256
  color="var(--accent-color)"
260
- width={width}
261
- height={height}
262
257
  inset={-1}
263
258
  >
264
259
  {inputTextual}