@shoplflow/base 0.19.0 → 0.20.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/index.cjs +232 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +231 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -39,10 +39,14 @@ var Scrollbars__default = /*#__PURE__*/_interopDefault(Scrollbars);
|
|
|
39
39
|
var ShoplAssets__namespace = /*#__PURE__*/_interopNamespace(ShoplAssets);
|
|
40
40
|
var HadaAssets__namespace = /*#__PURE__*/_interopNamespace(HadaAssets);
|
|
41
41
|
|
|
42
|
+
var __create = Object.create;
|
|
42
43
|
var __defProp = Object.defineProperty;
|
|
43
44
|
var __defProps = Object.defineProperties;
|
|
45
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
44
46
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
47
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
45
48
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
49
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
46
50
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
47
51
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
48
52
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -70,6 +74,74 @@ var __objRest = (source, exclude) => {
|
|
|
70
74
|
}
|
|
71
75
|
return target;
|
|
72
76
|
};
|
|
77
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
78
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
79
|
+
};
|
|
80
|
+
var __copyProps = (to, from, except, desc) => {
|
|
81
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
82
|
+
for (let key of __getOwnPropNames(from))
|
|
83
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
84
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
85
|
+
}
|
|
86
|
+
return to;
|
|
87
|
+
};
|
|
88
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
89
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
90
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
91
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
92
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
93
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
94
|
+
mod
|
|
95
|
+
));
|
|
96
|
+
|
|
97
|
+
// ../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js
|
|
98
|
+
var require_classnames = __commonJS({
|
|
99
|
+
"../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js"(exports, module) {
|
|
100
|
+
(function() {
|
|
101
|
+
var hasOwn = {}.hasOwnProperty;
|
|
102
|
+
function classNames2() {
|
|
103
|
+
var classes = [];
|
|
104
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
105
|
+
var arg = arguments[i];
|
|
106
|
+
if (!arg)
|
|
107
|
+
continue;
|
|
108
|
+
var argType = typeof arg;
|
|
109
|
+
if (argType === "string" || argType === "number") {
|
|
110
|
+
classes.push(arg);
|
|
111
|
+
} else if (Array.isArray(arg)) {
|
|
112
|
+
if (arg.length) {
|
|
113
|
+
var inner = classNames2.apply(null, arg);
|
|
114
|
+
if (inner) {
|
|
115
|
+
classes.push(inner);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
} else if (argType === "object") {
|
|
119
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
120
|
+
classes.push(arg.toString());
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
for (var key in arg) {
|
|
124
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
125
|
+
classes.push(key);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return classes.join(" ");
|
|
131
|
+
}
|
|
132
|
+
if (typeof module !== "undefined" && module.exports) {
|
|
133
|
+
classNames2.default = classNames2;
|
|
134
|
+
module.exports = classNames2;
|
|
135
|
+
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
136
|
+
define("classnames", [], function() {
|
|
137
|
+
return classNames2;
|
|
138
|
+
});
|
|
139
|
+
} else {
|
|
140
|
+
window.classNames = classNames2;
|
|
141
|
+
}
|
|
142
|
+
})();
|
|
143
|
+
}
|
|
144
|
+
});
|
|
73
145
|
exports.useDomain = (domain = "SHOPL") => {
|
|
74
146
|
const [domainType, setDomainType] = React3.useState(void 0);
|
|
75
147
|
React3.useEffect(() => {
|
|
@@ -1016,15 +1088,29 @@ exports.ChipToggle = ChipToggle;
|
|
|
1016
1088
|
// src/utils/getNextColor.ts
|
|
1017
1089
|
var getNextColor = (color, step = 1) => {
|
|
1018
1090
|
const colorName = color.replace(/[0-9]|_/g, "");
|
|
1019
|
-
const colorNumberString = color.replace(/[a-z]|_/g, "");
|
|
1020
|
-
const decimalColorNumber = Number(colorNumberString) * 0.01;
|
|
1021
|
-
const nextColorNumber = Math.floor(decimalColorNumber) + 100 * step;
|
|
1022
|
-
const nextColorToken = `${colorName}${nextColorNumber}`;
|
|
1023
|
-
const colorKeysOfColorName = Object.keys(exports.colorTokens).filter((colorToken) => colorToken.includes(colorName)).sort((a, b) => Number(a.replace(/[a-z]|_/g, "")) - Number(b.replace(/[a-z]|_/g, "")));
|
|
1024
1091
|
const colorTokenKeys = Object.keys(exports.colorTokens);
|
|
1025
|
-
const findColorToken = colorTokenKeys.
|
|
1026
|
-
const
|
|
1027
|
-
|
|
1092
|
+
const findColorToken = colorTokenKeys.filter((colorToken) => colorToken.includes(colorName));
|
|
1093
|
+
const extractNumbers = (str) => {
|
|
1094
|
+
const formattedStr = str.replace(/_/g, ".");
|
|
1095
|
+
const regex = /\d+(\.\d+)?/g;
|
|
1096
|
+
const match = formattedStr.match(regex);
|
|
1097
|
+
return match ? parseFloat(match[0]) : 0;
|
|
1098
|
+
};
|
|
1099
|
+
const sortColorToken = findColorToken.sort((a, b) => extractNumbers(a) - extractNumbers(b));
|
|
1100
|
+
const currentIndex = sortColorToken.indexOf(color);
|
|
1101
|
+
let newIndex = currentIndex + step;
|
|
1102
|
+
let potentialToken = sortColorToken[newIndex];
|
|
1103
|
+
while (potentialToken.endsWith("_5") || potentialToken.includes("50")) {
|
|
1104
|
+
newIndex += Math.sign(step);
|
|
1105
|
+
if (newIndex < 0) {
|
|
1106
|
+
potentialToken = sortColorToken[0];
|
|
1107
|
+
}
|
|
1108
|
+
if (newIndex >= sortColorToken.length) {
|
|
1109
|
+
potentialToken = sortColorToken[sortColorToken.length - 1];
|
|
1110
|
+
}
|
|
1111
|
+
potentialToken = sortColorToken[newIndex];
|
|
1112
|
+
}
|
|
1113
|
+
return potentialToken;
|
|
1028
1114
|
};
|
|
1029
1115
|
|
|
1030
1116
|
// src/components/Chips/ChipButton/ChipButton.styled.ts
|
|
@@ -1921,14 +2007,141 @@ var List = (_a) => {
|
|
|
1921
2007
|
rightSource && rightSource
|
|
1922
2008
|
] }));
|
|
1923
2009
|
};
|
|
1924
|
-
|
|
2010
|
+
exports.Text2Rows = ({ title, subTitle }) => {
|
|
1925
2011
|
return /* @__PURE__ */ jsxRuntime.jsxs(exports.StyledText2Rows, { children: [
|
|
1926
2012
|
/* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_500", color: "neutral700", children: title }),
|
|
1927
2013
|
subTitle && /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body2_400", color: "neutral400", children: subTitle })
|
|
1928
2014
|
] });
|
|
1929
2015
|
};
|
|
1930
|
-
List.Text2Rows = Text2Rows;
|
|
2016
|
+
List.Text2Rows = exports.Text2Rows;
|
|
1931
2017
|
exports.List = List;
|
|
2018
|
+
var getTypographyBySize = (size2) => {
|
|
2019
|
+
switch (size2) {
|
|
2020
|
+
case "XS":
|
|
2021
|
+
return "caption_400";
|
|
2022
|
+
case "S":
|
|
2023
|
+
return "caption_400";
|
|
2024
|
+
case "M":
|
|
2025
|
+
return "body2_400";
|
|
2026
|
+
default:
|
|
2027
|
+
return "body2_400";
|
|
2028
|
+
}
|
|
2029
|
+
};
|
|
2030
|
+
var getTagStyleBySize = (size2) => {
|
|
2031
|
+
switch (size2) {
|
|
2032
|
+
case "XS":
|
|
2033
|
+
return react$1.css`
|
|
2034
|
+
height: 20px;
|
|
2035
|
+
padding: 0 4px;
|
|
2036
|
+
border-radius: 4px;
|
|
2037
|
+
`;
|
|
2038
|
+
case "S":
|
|
2039
|
+
return react$1.css`
|
|
2040
|
+
height: 24px;
|
|
2041
|
+
padding: 0 8px;
|
|
2042
|
+
border-radius: 4px;
|
|
2043
|
+
`;
|
|
2044
|
+
case "M":
|
|
2045
|
+
return react$1.css`
|
|
2046
|
+
padding: 4px 8px;
|
|
2047
|
+
height: 32px;
|
|
2048
|
+
border-radius: 6px;
|
|
2049
|
+
`;
|
|
2050
|
+
default:
|
|
2051
|
+
return react$1.css`
|
|
2052
|
+
padding: 4px 8px;
|
|
2053
|
+
height: 32px;
|
|
2054
|
+
`;
|
|
2055
|
+
}
|
|
2056
|
+
};
|
|
2057
|
+
var getRadiusBySize = (size2) => {
|
|
2058
|
+
switch (size2) {
|
|
2059
|
+
case "XS":
|
|
2060
|
+
return react$1.css`
|
|
2061
|
+
border-radius: 12px;
|
|
2062
|
+
`;
|
|
2063
|
+
case "S":
|
|
2064
|
+
return react$1.css`
|
|
2065
|
+
border-radius: 16px;
|
|
2066
|
+
`;
|
|
2067
|
+
case "M":
|
|
2068
|
+
return react$1.css`
|
|
2069
|
+
border-radius: 16px;
|
|
2070
|
+
`;
|
|
2071
|
+
default:
|
|
2072
|
+
return react$1.css`
|
|
2073
|
+
border-radius: 16px;
|
|
2074
|
+
`;
|
|
2075
|
+
}
|
|
2076
|
+
};
|
|
2077
|
+
var getColorsByStyleVariant = (styleVariant, color = "neutral700") => {
|
|
2078
|
+
switch (styleVariant) {
|
|
2079
|
+
case "SOLID":
|
|
2080
|
+
return react$1.css`
|
|
2081
|
+
background: ${exports.colorTokens[color]};
|
|
2082
|
+
color: ${exports.colorTokens.neutral0};
|
|
2083
|
+
`;
|
|
2084
|
+
case "TINT":
|
|
2085
|
+
return react$1.css`
|
|
2086
|
+
background: ${exports.colorTokens[getNextColor(color, -2)]};
|
|
2087
|
+
color: ${exports.colorTokens[color]};
|
|
2088
|
+
`;
|
|
2089
|
+
case "LINE":
|
|
2090
|
+
return react$1.css`
|
|
2091
|
+
background: transparent;
|
|
2092
|
+
color: ${exports.colorTokens[color]};
|
|
2093
|
+
border: 1px solid ${exports.colorTokens[color]};
|
|
2094
|
+
`;
|
|
2095
|
+
default:
|
|
2096
|
+
return react$1.css`
|
|
2097
|
+
background: ${exports.colorTokens[color]};
|
|
2098
|
+
color: ${exports.colorTokens.neutral0};
|
|
2099
|
+
`;
|
|
2100
|
+
}
|
|
2101
|
+
};
|
|
2102
|
+
var StyledTag = styled5__default.default.div`
|
|
2103
|
+
display: flex;
|
|
2104
|
+
align-items: center;
|
|
2105
|
+
flex-direction: row;
|
|
2106
|
+
cursor: default;
|
|
2107
|
+
gap: 2px;
|
|
2108
|
+
${({ sizeVar }) => getTagStyleBySize(sizeVar)};
|
|
2109
|
+
${({ color, styleVar }) => getColorsByStyleVariant(styleVar, color)};
|
|
2110
|
+
${({ radius, sizeVar }) => radius && getRadiusBySize(sizeVar)};
|
|
2111
|
+
`;
|
|
2112
|
+
|
|
2113
|
+
// src/components/Tag/Tag.tsx
|
|
2114
|
+
var import_classnames = __toESM(require_classnames(), 1);
|
|
2115
|
+
var Tag = (_a) => {
|
|
2116
|
+
var _b = _a, { sizeVar, children, rightSource, leftSource, className } = _b, rest = __objRest(_b, ["sizeVar", "children", "rightSource", "leftSource", "className"]);
|
|
2117
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2118
|
+
StyledTag,
|
|
2119
|
+
__spreadProps(__spreadValues({
|
|
2120
|
+
sizeVar,
|
|
2121
|
+
className: (0, import_classnames.default)(getTypographyBySize(sizeVar), className)
|
|
2122
|
+
}, rest), {
|
|
2123
|
+
"data-shoplflow": "Tag",
|
|
2124
|
+
children: [
|
|
2125
|
+
leftSource && leftSource,
|
|
2126
|
+
children,
|
|
2127
|
+
rightSource && rightSource
|
|
2128
|
+
]
|
|
2129
|
+
})
|
|
2130
|
+
);
|
|
2131
|
+
};
|
|
2132
|
+
exports.Tag = Tag;
|
|
2133
|
+
|
|
2134
|
+
// src/components/Tag/Tag.types.ts
|
|
2135
|
+
exports.TagStyleVariants = {
|
|
2136
|
+
SOLID: "SOLID",
|
|
2137
|
+
TINT: "TINT",
|
|
2138
|
+
LINE: "LINE"
|
|
2139
|
+
};
|
|
2140
|
+
exports.TagSizeVariants = {
|
|
2141
|
+
XS: "XS",
|
|
2142
|
+
S: "S",
|
|
2143
|
+
M: "M"
|
|
2144
|
+
};
|
|
1932
2145
|
var StyledInput = styled5__default.default.input`
|
|
1933
2146
|
padding: 4px 0 4px 12px;
|
|
1934
2147
|
background-color: transparent;
|
|
@@ -2658,6 +2871,15 @@ var Radio = (_a) => {
|
|
|
2658
2871
|
);
|
|
2659
2872
|
};
|
|
2660
2873
|
exports.Radio = Radio;
|
|
2874
|
+
/*! Bundled license information:
|
|
2875
|
+
|
|
2876
|
+
classnames/index.js:
|
|
2877
|
+
(*!
|
|
2878
|
+
Copyright (c) 2018 Jed Watson.
|
|
2879
|
+
Licensed under the MIT License (MIT), see
|
|
2880
|
+
http://jedwatson.github.io/classnames
|
|
2881
|
+
*)
|
|
2882
|
+
*/
|
|
2661
2883
|
|
|
2662
2884
|
Object.defineProperty(exports, 'arrow', {
|
|
2663
2885
|
enumerable: true,
|