@janbox/storefront-ui 2.0.9 → 2.0.10

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.
@@ -1,5 +1,4 @@
1
1
  export * from './use-window-screen';
2
- export * from './use-hover-line-effect';
3
2
  export * from './use-ripple-effect';
4
3
  export * from './use-controllable-state';
5
4
  export * from './use-countdown-timer';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { useWindowScreen } from "./use-window-screen/index.js";
2
- import { useHoverLineEffect } from "./use-hover-line-effect/index.js";
3
2
  import { useRippleEffect } from "./use-ripple-effect/index.js";
4
3
  import { useControllableState } from "./use-controllable-state.js";
5
4
  import { useCountdownTimer } from "./use-countdown-timer.js";
@@ -14,7 +13,6 @@ export {
14
13
  useDeepCompareEffect,
15
14
  useFirstMountState,
16
15
  useFormatter,
17
- useHoverLineEffect,
18
16
  useQueryParams,
19
17
  useRippleEffect,
20
18
  useUpdateEffect,
@@ -1 +1 @@
1
- {"version":3,"file":"input-number.d.ts","sourceRoot":"","sources":["../../../src/lib/input-number/input-number.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAY3C,eAAO,MAAM,WAAW,sGAYrB,gBAAgB,4CAmHlB,CAAC"}
1
+ {"version":3,"file":"input-number.d.ts","sourceRoot":"","sources":["../../../src/lib/input-number/input-number.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAW3C,eAAO,MAAM,WAAW,sGAYrB,gBAAgB,4CA0HlB,CAAC"}
@@ -2,10 +2,8 @@ import { jsx, Fragment } from "react/jsx-runtime";
2
2
  import { useRef } from "react";
3
3
  import { useMergeRefs } from "@floating-ui/react";
4
4
  import { isNil } from "lodash-es";
5
- import classes from "./input-number.module.scss.js";
6
5
  import { Input } from "../input/input.js";
7
6
  import { useControllableState } from "../../hooks/use-controllable-state.js";
8
- import { cn } from "../../utils/stylesheet.js";
9
7
  import MinusIcon from "../../assets/svg/minus.svg.js";
10
8
  import PlusIcon from "../../assets/svg/plus.svg.js";
11
9
  import { IconButton } from "../icon-button/icon-button.js";
@@ -94,7 +92,14 @@ const InputNumber = ({
94
92
  value: valueAsString,
95
93
  onChange,
96
94
  transform: transformFn,
97
- className: cn(classes.input_number__input, className),
95
+ className,
96
+ sx: {
97
+ "&::-webkit-outer-spin-button, &::-webkit-inner-spin-button": {
98
+ WebkitAppearance: "none",
99
+ margin: 0,
100
+ ...props.sx
101
+ }
102
+ },
98
103
  onKeyDown,
99
104
  suffix: suffix ?? /* @__PURE__ */ jsx(Fragment, { children: step > 0 && /* @__PURE__ */ jsx(
100
105
  IconButton,
@@ -1 +1 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/lib/link/link.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAuB,MAAM,SAAS,CAAC;AAQzD,eAAO,MAAM,IAAI,iCAAkC,SAAS,qDAuD3D,CAAC"}
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/lib/link/link.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAuB,MAAM,SAAS,CAAC;AAOzD,eAAO,MAAM,IAAI,iCAAkC,SAAS,qDAoD3D,CAAC"}
@@ -3,14 +3,14 @@ import { ClassNames } from "@emotion/react";
3
3
  import { isNil } from "lodash-es";
4
4
  import { Link as Link$1 } from "react-router";
5
5
  import { getLinkProps } from "./helpers.js";
6
- import { useHoverLineEffect } from "../../hooks/use-hover-line-effect/index.js";
7
6
  import { Booleanish } from "../../constants/index.js";
7
+ import "react";
8
8
  import { mediaQuery } from "../../theme/screens.js";
9
9
  import "../../theme/palette.js";
10
10
  import { getTypographyVar } from "../../theme/typography.js";
11
+ import { createUnderlineEffect } from "../../utils/stylesheet.js";
11
12
  const Link = ({ children, ref, ..._props }) => {
12
13
  const { sx, textVariant, sm, md, lg, to, underline = false, className, ...rest } = getLinkProps(_props);
13
- const hoverLineEffectProps = useHoverLineEffect({ enabled: underline });
14
14
  const onClick = (e) => {
15
15
  var _a;
16
16
  if (e.currentTarget.getAttribute("aria-disabled") === Booleanish.True) {
@@ -25,14 +25,13 @@ const Link = ({ children, ref, ..._props }) => {
25
25
  Link$1,
26
26
  {
27
27
  to: to ?? "#",
28
- ...hoverLineEffectProps,
29
28
  className: cx(
30
29
  className,
31
- hoverLineEffectProps.className,
32
30
  css({
33
31
  '&[aria-disabled="true"]': {
34
32
  pointerEvents: "none"
35
33
  },
34
+ ...underline ? createUnderlineEffect() : {},
36
35
  ...createStyle({ textVariant }),
37
36
  ...sx,
38
37
  [mediaQuery("sm")]: {
@@ -1 +1 @@
1
- {"version":3,"file":"price-label.d.ts","sourceRoot":"","sources":["../../../src/lib/price-label/price-label.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA8C,eAAe,EAAE,MAAM,SAAS,CAAC;AAQtF,eAAO,MAAM,UAAU,WAAY,eAAe,4CAwEjD,CAAC"}
1
+ {"version":3,"file":"price-label.d.ts","sourceRoot":"","sources":["../../../src/lib/price-label/price-label.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA8C,eAAe,EAAE,MAAM,SAAS,CAAC;AAQtF,eAAO,MAAM,UAAU,WAAY,eAAe,4CAoFjD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { getPriceLabelProps } from "./helpers.js";
3
- import { isNil, isNumber } from "lodash-es";
3
+ import { isNumber, isNil } from "lodash-es";
4
4
  import { useTranslation } from "react-i18next";
5
5
  import { LocaleNamespaces } from "../../constants/index.js";
6
6
  import { useFormatter } from "../../hooks/use-formatter/index.js";
@@ -18,8 +18,14 @@ const PriceLabel = (_props) => {
18
18
  sm,
19
19
  md,
20
20
  lg,
21
+ showEqual = false,
21
22
  ...rest
22
23
  } = getPriceLabelProps(_props);
24
+ const isPriceEqual = price.currency && price.currency === (exchangePrice == null ? void 0 : exchangePrice.currency) && isNumber(price.value) && price.value === (exchangePrice == null ? void 0 : exchangePrice.value);
25
+ const isShowExchangePrice = (() => {
26
+ if (!exchangePrice) return false;
27
+ return showEqual ? true : !isPriceEqual;
28
+ })();
23
29
  return /* @__PURE__ */ jsxs(
24
30
  Primitive,
25
31
  {
@@ -53,7 +59,7 @@ const PriceLabel = (_props) => {
53
59
  )
54
60
  }
55
61
  ),
56
- exchangePrice && /* @__PURE__ */ jsxs(Fragment, { children: [
62
+ isShowExchangePrice && /* @__PURE__ */ jsxs(Fragment, { children: [
57
63
  orientation === "vertical" ? /* @__PURE__ */ jsx("br", {}) : /* @__PURE__ */ jsx(Fragment, { children: " " }),
58
64
  /* @__PURE__ */ jsx(
59
65
  Primitive,
@@ -78,7 +84,7 @@ const PriceLabel = (_props) => {
78
84
  price: {
79
85
  prefix: "(",
80
86
  suffix: ")",
81
- placeholder: isNil(exchangePrice.value),
87
+ placeholder: isNil(exchangePrice == null ? void 0 : exchangePrice.value),
82
88
  ...exchangePrice
83
89
  }
84
90
  }
@@ -18,6 +18,7 @@ type PriceLabelExtendedProps = ToResponsiveProps<PriceLabelResponsiveProps> & {
18
18
  exchangePrice?: PriceLabelEntry;
19
19
  color?: ColorVariant;
20
20
  orientation?: 'horizontal' | 'vertical';
21
+ showEqual?: boolean;
21
22
  };
22
23
  export type PriceLabelProps = ShallowMerge<PrimitiveProps<JSX.IntrinsicElements['span']>, PriceLabelExtendedProps>;
23
24
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/price-label/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC9B;AAED,KAAK,uBAAuB,GAAG,iBAAiB,CAAC,yBAAyB,CAAC,GAAG;IAC5E,KAAK,EAAE,eAAe,CAAC;IACvB,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/price-label/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC9B;AAED,KAAK,uBAAuB,GAAG,iBAAiB,CAAC,yBAAyB,CAAC,GAAG;IAC5E,KAAK,EAAE,eAAe,CAAC;IACvB,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../src/lib/textarea/textarea.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAA2B,MAAM,SAAS,CAAC;AAUjE,eAAO,MAAM,QAAQ,uBAAwB,aAAa,4CAuHzD,CAAC"}
1
+ {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../src/lib/textarea/textarea.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAA2B,MAAM,SAAS,CAAC;AAQjE,eAAO,MAAM,QAAQ,uBAAwB,aAAa,4CA8JzD,CAAC"}
@@ -3,11 +3,9 @@ import { useRef, useState } from "react";
3
3
  import { useMergeRefs } from "@floating-ui/react";
4
4
  import { isString } from "lodash-es";
5
5
  import { getTextareaProps } from "./helpers.js";
6
- import classes from "./textarea.module.scss.js";
7
- import { getSizeVariantState } from "../../utils/index.js";
8
- import { cn } from "../../utils/stylesheet.js";
9
- import "../../theme/palette.js";
6
+ import { getColorVar } from "../../theme/palette.js";
10
7
  import { getTypographyVar } from "../../theme/typography.js";
8
+ import { getSizeVariantState } from "../../utils/index.js";
11
9
  import { Primitive } from "../primitive/primitive.js";
12
10
  import { FormHelperText } from "../form-helper-text/form-helper-text.js";
13
11
  const Textarea = ({ ref, ..._props }) => {
@@ -75,52 +73,96 @@ const Textarea = ({ ref, ..._props }) => {
75
73
  setTypingValue(void 0);
76
74
  }, debounce);
77
75
  };
78
- return /* @__PURE__ */ jsxs(Primitive, { ...containerProps, className: cn(classes.textarea__container, containerProps == null ? void 0 : containerProps.className), children: [
79
- /* @__PURE__ */ jsx(
80
- Primitive,
81
- {
82
- ...mainProps,
83
- sx: {
84
- display: "flex",
85
- paddingTop: 4,
86
- paddingBottom: 4,
87
- ...createStyle({ size }),
88
- ...mainProps == null ? void 0 : mainProps.sx,
89
- sm: {
90
- ...createStyle(sm),
91
- ...(_a = mainProps == null ? void 0 : mainProps.sx) == null ? void 0 : _a.sm
92
- },
93
- md: {
94
- ...createStyle(md),
95
- ...(_b = mainProps == null ? void 0 : mainProps.sx) == null ? void 0 : _b.md
96
- },
97
- lg: {
98
- ...createStyle(lg),
99
- ...(_c = mainProps == null ? void 0 : mainProps.sx) == null ? void 0 : _c.lg
100
- }
101
- },
102
- className: cn(classes.textarea__main, mainProps == null ? void 0 : mainProps.className),
103
- children: /* @__PURE__ */ jsx(
76
+ return /* @__PURE__ */ jsxs(
77
+ Primitive,
78
+ {
79
+ ...containerProps,
80
+ sx: {
81
+ position: "relative",
82
+ width: "100%",
83
+ ...containerProps == null ? void 0 : containerProps.sx
84
+ },
85
+ className: containerProps == null ? void 0 : containerProps.className,
86
+ children: [
87
+ /* @__PURE__ */ jsx(
104
88
  Primitive,
105
89
  {
106
- "aria-invalid": error,
107
- className: cn(
108
- classes.textarea__control,
109
- className
110
- ),
111
- ...rest,
112
- value: typingValue ?? value,
113
- ref: mergedRefs,
114
- onChange,
115
- onBlur,
116
- onFocus,
117
- as: "textarea"
90
+ ...mainProps,
91
+ sx: {
92
+ width: "100%",
93
+ borderWidth: 1,
94
+ borderStyle: "solid",
95
+ borderRadius: "0.5rem",
96
+ display: "flex",
97
+ paddingTop: 4,
98
+ paddingBottom: 4,
99
+ "&:has(textarea[aria-invalid])": {
100
+ borderColor: getColorVar("red.600")
101
+ },
102
+ "&:hover": {
103
+ borderColor: getColorVar("primary.300")
104
+ },
105
+ "&:has(textarea:focus)": {
106
+ outline: "none",
107
+ borderColor: getColorVar("primary.600"),
108
+ boxShadow: `0 1px 3px 0 ${getColorVar("primary.300")}, 0 1px 2px -1px ${getColorVar("primary.300")}`
109
+ },
110
+ "&:has(textarea:read-only)": {
111
+ cursor: "default",
112
+ pointerEvents: "none"
113
+ },
114
+ "&:has(textarea:disabled)": {
115
+ backgroundColor: getColorVar("neutral.300"),
116
+ color: getColorVar("neutral.500"),
117
+ borderColor: getColorVar("neutral.300"),
118
+ pointerEvents: "none"
119
+ },
120
+ ...createStyle({ size }),
121
+ ...mainProps == null ? void 0 : mainProps.sx,
122
+ sm: {
123
+ ...createStyle(sm),
124
+ ...(_a = mainProps == null ? void 0 : mainProps.sx) == null ? void 0 : _a.sm
125
+ },
126
+ md: {
127
+ ...createStyle(md),
128
+ ...(_b = mainProps == null ? void 0 : mainProps.sx) == null ? void 0 : _b.md
129
+ },
130
+ lg: {
131
+ ...createStyle(lg),
132
+ ...(_c = mainProps == null ? void 0 : mainProps.sx) == null ? void 0 : _c.lg
133
+ }
134
+ },
135
+ className: mainProps == null ? void 0 : mainProps.className,
136
+ children: /* @__PURE__ */ jsx(
137
+ Primitive,
138
+ {
139
+ "aria-invalid": error,
140
+ sx: {
141
+ width: "100%",
142
+ backgroundColor: "transparent",
143
+ "&:focus": {
144
+ outline: "none"
145
+ },
146
+ "&::placeholder": {
147
+ color: getColorVar("neutral.400")
148
+ }
149
+ },
150
+ className,
151
+ ...rest,
152
+ value: typingValue ?? value,
153
+ ref: mergedRefs,
154
+ onChange,
155
+ onBlur,
156
+ onFocus,
157
+ as: "textarea"
158
+ }
159
+ )
118
160
  }
119
- )
120
- }
121
- ),
122
- /* @__PURE__ */ jsx(FormHelperText, { error, children: helperText })
123
- ] });
161
+ ),
162
+ /* @__PURE__ */ jsx(FormHelperText, { error, children: helperText })
163
+ ]
164
+ }
165
+ );
124
166
  };
125
167
  const createStyle = ({ size } = {}) => {
126
168
  const { inputPaddingX, textVariant } = getSizeVariantState(size);
package/dist/style.css CHANGED
@@ -1,22 +1,4 @@
1
- ._hover_line_effect_dv0bz_1 {
2
- position: relative;
3
- }
4
- ._hover_line_effect_dv0bz_1::after {
5
- content: "";
6
- position: absolute;
7
- bottom: 0;
8
- left: 0;
9
- right: 0;
10
- transform: scaleX(0);
11
- transition-property: transform;
12
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
13
- background-color: var(--hover-line-color);
14
- height: var(--hover-line-height);
15
- transition-duration: var(--hover-line-duration);
16
- }
17
- ._hover_line_effect_dv0bz_1:hover::after {
18
- transform: scaleX(1);
19
- }@keyframes _ripple_1jvqm_7 {
1
+ @keyframes _ripple_1jvqm_7 {
20
2
  to {
21
3
  transform: scale(1);
22
4
  opacity: 0;
@@ -847,9 +829,6 @@
847
829
  }
848
830
  ._input_range_1yrkm_1:hover {
849
831
  border-color: var(--color-primary-300);
850
- }._input_number__input_2xvhv_1::-webkit-outer-spin-button, ._input_number__input_2xvhv_1::-webkit-inner-spin-button {
851
- -webkit-appearance: none;
852
- margin: 0;
853
832
  }._switch__container_19zrg_1 {
854
833
  display: flex;
855
834
  align-items: center;
@@ -936,46 +915,4 @@
936
915
  ._switch__main_19zrg_24:has(._switch__input_19zrg_12:disabled)::after {
937
916
  background-color: var(--color-neutral-400);
938
917
  border-color: var(--color-neutral-400);
939
- }._textarea__container_bs49u_1 {
940
- position: relative;
941
- width: 100%;
942
- }
943
-
944
- ._textarea__main_bs49u_6 {
945
- width: 100%;
946
- border-width: 1px;
947
- border-style: solid;
948
- border-radius: 0.5rem;
949
- }
950
- ._textarea__main_bs49u_6:has(textarea[aria-invalid]) {
951
- border-color: var(--color-red-600);
952
- }
953
- ._textarea__main_bs49u_6:hover {
954
- border-color: var(--color-primary-300);
955
- }
956
- ._textarea__main_bs49u_6:has(textarea:focus) {
957
- outline: none;
958
- border-color: var(--color-primary-600);
959
- box-shadow: 0 1px 3px 0 var(--color-primary-300), 0 1px 2px -1px var(--color-primary-300);
960
- }
961
- ._textarea__main_bs49u_6:has(textarea:read-only) {
962
- cursor: default;
963
- pointer-events: none;
964
- }
965
- ._textarea__main_bs49u_6:has(textarea:disabled) {
966
- background-color: var(--color-neutral-300);
967
- color: var(--color-neutral-500);
968
- border-color: var(--color-neutral-300);
969
- pointer-events: none;
970
- }
971
-
972
- ._textarea__control_bs49u_34 {
973
- width: 100%;
974
- background-color: transparent;
975
- }
976
- ._textarea__control_bs49u_34:focus {
977
- outline: none;
978
- }
979
- ._textarea__control_bs49u_34::placeholder {
980
- color: var(--color-neutral-400);
981
918
  }
@@ -4,6 +4,7 @@ import { SizeVariant, ColorVariant, ToResponsiveProps } from '../types';
4
4
  import { Get, Paths, SetRequired } from 'type-fest';
5
5
  export * from './common';
6
6
  export * from './query-params';
7
+ export { createUnderlineEffect } from './stylesheet';
7
8
  export declare const getColorShadesByVariant: (variant?: ColorVariant) => {
8
9
  main: string;
9
10
  contrastText: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyD,YAAY,EAAE,MAAM,OAAO,CAAC;AAI5F,OAAO,EAAe,MAAM,EAAqB,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEpD,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAc/B,eAAO,MAAM,uBAAuB,aAAc,YAAY;;;;;;;;;;;;;;;;;;;;CAyF7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,MAAM,WAAW,KAAK,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,MAiB9G,CAAC;AAEF,eAAO,MAAM,eAAe,aAAc,KAAK,CAAC,SAAS,KAAG,YAAY,EAYvE,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,qBAAqB,CAAC;CACpC,CAAC,CAAC;AAEH,eAAO,MAAM,mBAAmB,UAAW,WAAW,KAAG,gBAiCxD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,2BAC/D,iBAAiB,CAAC,CAAC,CAAC,SACrB,CAAC,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AuB,qBAAqB,WAyBvG,CAAC"}
@@ -4,6 +4,7 @@ import { getSmallerScreens } from "../theme/screens.js";
4
4
  import { getColorVar } from "../theme/palette.js";
5
5
  import { ensureArray, ensureBoolean, getDecimalDigits, getEnumValues, matchSearch, normalizeSearchText, omitEmpty, parseNumber, parseSvgString } from "./common.js";
6
6
  import { ArrayParamParser, BooleanParamParser, DateParamParser, EnumParamParser, NumberParamParser, StringParamParser, simplifyQueryParams } from "./query-params.js";
7
+ import { createUnderlineEffect } from "./stylesheet.js";
7
8
  const getColorShadesByVariant = (variant) => {
8
9
  switch (variant) {
9
10
  case "primary":
@@ -220,6 +221,7 @@ export {
220
221
  EnumParamParser,
221
222
  NumberParamParser,
222
223
  StringParamParser,
224
+ createUnderlineEffect,
223
225
  ensureArray,
224
226
  ensureBoolean,
225
227
  flattenChildren,
@@ -2,4 +2,11 @@ import { PropsWithSx, StyledCSS } from '../types';
2
2
  import { ClassValue } from 'clsx';
3
3
  export declare const cn: (...classes: ClassValue[]) => string;
4
4
  export declare const createSxInterpolation: (sx?: PropsWithSx["sx"]) => StyledCSS[];
5
+ type CreateUnderlineEffectOptions = {
6
+ color?: string;
7
+ duration?: number;
8
+ height?: string | number;
9
+ };
10
+ export declare const createUnderlineEffect: (options?: CreateUnderlineEffectOptions) => StyledCSS;
11
+ export {};
5
12
  //# sourceMappingURL=stylesheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../src/utils/stylesheet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAC;AAExC,eAAO,MAAM,EAAE,eAAgB,UAAU,EAAE,WAAqB,CAAC;AAEjE,eAAO,MAAM,qBAAqB,QAAQ,WAAW,CAAC,IAAI,CAAC,KAAQ,SAAS,EAW3E,CAAC"}
1
+ {"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../src/utils/stylesheet.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAC;AAExC,eAAO,MAAM,EAAE,eAAgB,UAAU,EAAE,WAAqB,CAAC;AAEjE,eAAO,MAAM,qBAAqB,QAAQ,WAAW,CAAC,IAAI,CAAC,KAAQ,SAAS,EAW3E,CAAC;AAEF,KAAK,4BAA4B,GAAG;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAa,4BAA4B,KAAQ,SAsBlF,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { isNumber } from "lodash-es";
1
2
  import { mediaQuery } from "../theme/screens.js";
2
3
  import "../theme/palette.js";
3
4
  import { clsx } from "clsx";
@@ -13,7 +14,30 @@ const createSxInterpolation = (sx = {}) => {
13
14
  }
14
15
  ];
15
16
  };
17
+ const createUnderlineEffect = (options = {}) => {
18
+ const { color = "currentColor", duration = 300, height = 1 } = options;
19
+ return {
20
+ position: "relative",
21
+ "&::after": {
22
+ content: '""',
23
+ position: "absolute",
24
+ bottom: 0,
25
+ left: 0,
26
+ right: 0,
27
+ transform: "scaleX(0)",
28
+ transitionProperty: "transform",
29
+ transitionTimingFunction: "cubic-bezier(0.4, 0, 0.2, 1)",
30
+ backgroundColor: color,
31
+ height: isNumber(height) ? `${height}px` : height,
32
+ transitionDuration: `${duration}ms`
33
+ },
34
+ "&:hover::after": {
35
+ transform: "scaleX(1)"
36
+ }
37
+ };
38
+ };
16
39
  export {
17
40
  cn,
18
- createSxInterpolation
41
+ createSxInterpolation,
42
+ createUnderlineEffect
19
43
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janbox/storefront-ui",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "description": "Storefront UI component library for Janbox",
5
5
  "author": "Janbox",
6
6
  "keywords": [
@@ -1,12 +0,0 @@
1
- type UseHoverLineEffectOptions = {
2
- color?: string;
3
- duration?: number;
4
- height?: string | number;
5
- enabled?: boolean;
6
- };
7
- export declare const useHoverLineEffect: (options?: UseHoverLineEffectOptions) => {
8
- className: string;
9
- style: React.CSSProperties;
10
- };
11
- export {};
12
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-hover-line-effect/index.ts"],"names":[],"mappings":"AAMA,KAAK,yBAAyB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,kBAAkB,aAAa,yBAAyB;;WAYpD,KAAK,CAAC,aAAa;CAGnC,CAAC"}
@@ -1,19 +0,0 @@
1
- import { useMemo } from "react";
2
- import { isNumber } from "lodash-es";
3
- import classes from "./use-hover-line-effect.module.scss.js";
4
- const useHoverLineEffect = (options = {}) => {
5
- const { color = "currentColor", duration = 300, height = 1, enabled = true } = options;
6
- return useMemo(() => {
7
- return {
8
- className: enabled ? classes.hover_line_effect : "",
9
- style: enabled ? {
10
- "--hover-line-color": color,
11
- "--hover-line-duration": `${duration}ms`,
12
- "--hover-line-height": isNumber(height) ? `${height}px` : height
13
- } : {}
14
- };
15
- }, [color, duration, enabled, height]);
16
- };
17
- export {
18
- useHoverLineEffect
19
- };
@@ -1,8 +0,0 @@
1
- const hover_line_effect = "_hover_line_effect_dv0bz_1";
2
- const classes = {
3
- hover_line_effect
4
- };
5
- export {
6
- classes as default,
7
- hover_line_effect
8
- };
@@ -1,8 +0,0 @@
1
- const input_number__input = "_input_number__input_2xvhv_1";
2
- const classes = {
3
- input_number__input
4
- };
5
- export {
6
- classes as default,
7
- input_number__input
8
- };
@@ -1,14 +0,0 @@
1
- const textarea__container = "_textarea__container_bs49u_1";
2
- const textarea__main = "_textarea__main_bs49u_6";
3
- const textarea__control = "_textarea__control_bs49u_34";
4
- const classes = {
5
- textarea__container,
6
- textarea__main,
7
- textarea__control
8
- };
9
- export {
10
- classes as default,
11
- textarea__container,
12
- textarea__control,
13
- textarea__main
14
- };