@janbox/storefront-ui 2.0.27 → 2.0.29

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.
Files changed (31) hide show
  1. package/dist/hooks/index.d.ts +0 -1
  2. package/dist/hooks/index.js +0 -2
  3. package/dist/index.js +2 -0
  4. package/dist/lib/box/box.js +5 -21
  5. package/dist/lib/button/button.js +69 -80
  6. package/dist/lib/flexbox/flexbox/flexbox.d.ts +1 -1
  7. package/dist/lib/flexbox/flexbox/flexbox.js +16 -20
  8. package/dist/lib/grid/grid/grid.d.ts +1 -1
  9. package/dist/lib/grid/grid/grid.js +20 -25
  10. package/dist/lib/icon-button/icon-button.js +5 -9
  11. package/dist/lib/index.d.ts +1 -0
  12. package/dist/lib/input/input.js +155 -101
  13. package/dist/lib/input-range/input-range.d.ts +1 -1
  14. package/dist/lib/input-range/input-range.js +119 -95
  15. package/dist/lib/input-range/types.d.ts +3 -2
  16. package/dist/lib/ripple-effect/index.d.ts +2 -0
  17. package/dist/lib/ripple-effect/ripple-effect.d.ts +3 -0
  18. package/dist/lib/ripple-effect/ripple-effect.js +75 -0
  19. package/dist/{hooks/use-ripple-effect/index.d.ts → lib/ripple-effect/types.d.ts} +1 -6
  20. package/dist/lib/table/table-row/table-row.d.ts +1 -1
  21. package/dist/lib/table/table-row/table-row.js +4 -4
  22. package/dist/lib/table/table-row/types.d.ts +2 -2
  23. package/dist/lib/unordered-list/list-item/list-item.d.ts +1 -1
  24. package/dist/lib/unordered-list/list-item/list-item.js +8 -10
  25. package/dist/lib/unordered-list/list-item/types.d.ts +2 -2
  26. package/dist/style.css +1 -96
  27. package/package.json +1 -1
  28. package/dist/hooks/use-ripple-effect/index.js +0 -69
  29. package/dist/hooks/use-ripple-effect/use-ripple-effect.module.scss.js +0 -11
  30. package/dist/lib/input/input.module.scss.js +0 -17
  31. package/dist/lib/input-range/input-range.module.scss.js +0 -8
@@ -1,7 +1,7 @@
1
- import { jsx } from "@emotion/react/jsx-runtime";
2
- import { createSxInterpolation } from "../../../utils/stylesheet.js";
3
- const TableRow = ({ sx, children, ...props }) => {
4
- return /* @__PURE__ */ jsx("tr", { css: createSxInterpolation(sx), ...props, children });
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Primitive } from "../../primitive/primitive.js";
3
+ const TableRow = (props) => {
4
+ return /* @__PURE__ */ jsx(Primitive, { ...props, as: "tr" });
5
5
  };
6
6
  export {
7
7
  TableRow
@@ -1,3 +1,3 @@
1
1
  import { JSX } from 'react';
2
- import { PropsWithSx } from '../../../types';
3
- export type TableRowProps = PropsWithSx<JSX.IntrinsicElements['tr']>;
2
+ import { PrimitiveProps } from '../../primitive';
3
+ export type TableRowProps = PrimitiveProps<JSX.IntrinsicElements['tr']>;
@@ -1,2 +1,2 @@
1
1
  import { ListItemProps } from './types';
2
- export declare const ListItem: ({ ref, ..._props }: ListItemProps) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare const ListItem: ({ ref, ..._props }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,23 +1,21 @@
1
- import { jsx } from "@emotion/react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { isNil } from "lodash-es";
3
3
  import { getListItemProps } from "./helpers.js";
4
- import { createSxInterpolation } from "../../../utils/stylesheet.js";
4
+ import { Primitive } from "../../primitive/primitive.js";
5
5
  const ListItem = ({ ref, ..._props }) => {
6
6
  const { sx, children, dangerouslySetInnerHTML, ...rest } = getListItemProps(_props);
7
- const css = [
8
- {
9
- display: "inline-flex"
10
- },
11
- createSxInterpolation(sx)
12
- ];
13
7
  return /* @__PURE__ */ jsx(
14
- "li",
8
+ Primitive,
15
9
  {
16
- css,
17
10
  suppressContentEditableWarning: true,
18
11
  dangerouslySetInnerHTML: isNil(children) ? dangerouslySetInnerHTML : void 0,
19
12
  ...rest,
20
13
  ref,
14
+ sx: {
15
+ display: "inline-flex",
16
+ ...sx
17
+ },
18
+ as: "li",
21
19
  children: isNil(dangerouslySetInnerHTML) ? children : null
22
20
  }
23
21
  );
@@ -1,3 +1,3 @@
1
1
  import { JSX } from 'react';
2
- import { PropsWithSx } from '../../../types';
3
- export type ListItemProps = PropsWithSx<JSX.IntrinsicElements['li']>;
2
+ import { PrimitiveProps } from '../../primitive';
3
+ export type ListItemProps = PrimitiveProps<JSX.IntrinsicElements['li']>;
package/dist/style.css CHANGED
@@ -1,85 +1,4 @@
1
- @keyframes _ripple_1jvqm_7 {
2
- to {
3
- transform: scale(1);
4
- opacity: 0;
5
- }
6
- }
7
- ._ripple_effect_1jvqm_7 {
8
- position: relative;
9
- overflow: hidden;
10
- }
11
-
12
- ._ripple_effect__circle_1jvqm_12 {
13
- position: absolute;
14
- border-radius: 9999px;
15
- background-color: var(--ripple-color);
16
- opacity: var(--ripple-opacity);
17
- transform: scale(0);
18
- transform-origin: center;
19
- will-change: transform, opacity;
20
- backface-visibility: hidden;
21
- touch-action: none;
22
- animation: _ripple_1jvqm_7 var(--ripple-duration) ease-in-out;
23
- }
24
-
25
- @media (prefers-reduced-motion: reduce) {
26
- ._ripple_effect__circle_1jvqm_12 {
27
- animation-duration: calc(var(--ripple-duration) * 0.5);
28
- }
29
- }._input__container_1129f_1 {
30
- position: relative;
31
- display: flex;
32
- flex-direction: column;
33
- width: 100%;
34
- }
35
-
36
- ._input__main_1129f_8 {
37
- width: 100%;
38
- display: flex;
39
- overflow: hidden;
40
- align-items: center;
41
- gap: 0.5rem;
42
- border-radius: 0.5rem;
43
- border-width: 1px;
44
- border-style: solid;
45
- background-color: var(--color-surface-default);
46
- }
47
- ._input__main_1129f_8:hover {
48
- border-color: var(--color-primary-300);
49
- }
50
- ._input__main_1129f_8:has(input:focus:not(:read-only)) {
51
- border-color: var(--color-primary-600);
52
- box-shadow: 0 1px 3px 0 var(--color-primary-300), 0 1px 2px -1px var(--color-primary-300);
53
- }
54
- ._input__main_1129f_8:has(input:read-only) {
55
- pointer-events: none;
56
- }
57
- ._input__main_1129f_8:has(input:disabled) {
58
- background-color: var(--color-neutral-300);
59
- color: var(--color-neutral-500);
60
- border-color: var(--color-neutral-300);
61
- pointer-events: none;
62
- }
63
-
64
- ._input__main_error_1129f_36 {
65
- border-color: var(--color-red-600);
66
- }
67
-
68
- ._input__control_1129f_40 {
69
- flex: 1 1 0%;
70
- width: 100%;
71
- height: 100%;
72
- overflow: hidden;
73
- text-overflow: ellipsis;
74
- white-space: nowrap;
75
- background-color: transparent;
76
- }
77
- ._input__control_1129f_40:focus {
78
- outline: none;
79
- }
80
- ._input__control_1129f_40::placeholder {
81
- color: var(--color-neutral-400);
82
- }._checkbox__container_1rrv2_1 {
1
+ ._checkbox__container_1rrv2_1 {
83
2
  display: flex;
84
3
  align-items: center;
85
4
  gap: 0.5rem;
@@ -815,20 +734,6 @@
815
734
 
816
735
  ._radio_button__input_10dls_10:disabled + ._radio_button__checkmark_10dls_21 {
817
736
  color: var(--color-neutral-300);
818
- }._input_range_1yrkm_1 {
819
- display: flex;
820
- align-items: center;
821
- border-width: 1px;
822
- border-style: solid;
823
- border-radius: 0.5rem;
824
- gap: 0.5rem;
825
- }
826
- ._input_range_1yrkm_1:has(input:focus) {
827
- border-color: var(--color-primary-600);
828
- box-shadow: 0 1px 3px 0 var(--color-primary-300), 0 1px 2px -1px var(--color-primary-300);
829
- }
830
- ._input_range_1yrkm_1:hover {
831
- border-color: var(--color-primary-300);
832
737
  }._switch__container_19zrg_1 {
833
738
  display: flex;
834
739
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janbox/storefront-ui",
3
- "version": "2.0.27",
3
+ "version": "2.0.29",
4
4
  "description": "Storefront UI component library for Janbox",
5
5
  "author": "Janbox",
6
6
  "keywords": [
@@ -1,69 +0,0 @@
1
- import { useCallback, useEffect, useMemo } from "react";
2
- import classes from "./use-ripple-effect.module.scss.js";
3
- const useRippleEffect = (ref, {
4
- enabled = true,
5
- color = "currentColor",
6
- duration = 400,
7
- opacity = 0.2,
8
- sizeMultiplier = 1
9
- } = {}) => {
10
- const createRippleCircle = useCallback(
11
- (event) => {
12
- const { currentTarget, clientX, clientY } = event;
13
- const { clientHeight, clientWidth } = currentTarget;
14
- const { left: offsetLeft, top: offsetTop } = currentTarget.getBoundingClientRect();
15
- const circleLeft = clientX - offsetLeft;
16
- const circleTop = clientY - offsetTop;
17
- const circleRight = offsetLeft + clientWidth - clientX;
18
- const circleBottom = offsetTop + clientHeight - clientY;
19
- const radius = Math.max(circleLeft, circleTop, circleRight, circleBottom) * sizeMultiplier;
20
- const circle = document.createElement("div");
21
- circle.style.width = circle.style.height = `${radius * 2}px`;
22
- circle.style.left = `${circleLeft - radius}px`;
23
- circle.style.top = `${circleTop - radius}px`;
24
- circle.classList.add(classes.ripple_effect__circle);
25
- circle.style.setProperty("--ripple-color", color);
26
- circle.style.setProperty("--ripple-duration", `${duration}ms`);
27
- circle.style.setProperty("--ripple-opacity", opacity.toString());
28
- return circle;
29
- },
30
- [color, duration, opacity, sizeMultiplier]
31
- );
32
- const start = useCallback(
33
- (event) => {
34
- var _a;
35
- if (!enabled) return;
36
- const circle = createRippleCircle(event);
37
- const handleAnimationEnd = (ev) => {
38
- if (!ev.target) return;
39
- ev.target.remove();
40
- };
41
- circle.addEventListener("animationend", handleAnimationEnd);
42
- (_a = ref.current) == null ? void 0 : _a.appendChild(circle);
43
- },
44
- [createRippleCircle, enabled, ref]
45
- );
46
- useEffect(() => {
47
- if (!enabled) return;
48
- const targetElement = ref.current;
49
- const handleClick = (e) => {
50
- start(e);
51
- };
52
- targetElement == null ? void 0 : targetElement.addEventListener("click", handleClick);
53
- return () => {
54
- targetElement == null ? void 0 : targetElement.removeEventListener("click", handleClick);
55
- Array.from((targetElement == null ? void 0 : targetElement.getElementsByClassName(classes.ripple_effect__circle)) ?? []).forEach(
56
- (circle) => circle.remove()
57
- );
58
- };
59
- }, [start, enabled, ref]);
60
- return useMemo(
61
- () => ({
62
- className: classes.ripple_effect
63
- }),
64
- []
65
- );
66
- };
67
- export {
68
- useRippleEffect
69
- };
@@ -1,11 +0,0 @@
1
- const ripple_effect = "_ripple_effect_1jvqm_7";
2
- const ripple_effect__circle = "_ripple_effect__circle_1jvqm_12";
3
- const classes = {
4
- ripple_effect,
5
- ripple_effect__circle
6
- };
7
- export {
8
- classes as default,
9
- ripple_effect,
10
- ripple_effect__circle
11
- };
@@ -1,17 +0,0 @@
1
- const input__container = "_input__container_1129f_1";
2
- const input__main = "_input__main_1129f_8";
3
- const input__main_error = "_input__main_error_1129f_36";
4
- const input__control = "_input__control_1129f_40";
5
- const classes = {
6
- input__container,
7
- input__main,
8
- input__main_error,
9
- input__control
10
- };
11
- export {
12
- classes as default,
13
- input__container,
14
- input__control,
15
- input__main,
16
- input__main_error
17
- };
@@ -1,8 +0,0 @@
1
- const input_range = "_input_range_1yrkm_1";
2
- const classes = {
3
- input_range
4
- };
5
- export {
6
- classes as default,
7
- input_range
8
- };