@lumiastream/ui 0.3.6 → 0.3.9

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/se-import.js CHANGED
@@ -3656,6 +3656,29 @@ function hasMarketplaceCandidates(seWidgetType) {
3656
3656
  return getMarketplaceCandidates(seWidgetType).length > 0;
3657
3657
  }
3658
3658
 
3659
+ // src/se-import/substitute.ts
3660
+ function substituteSeTokens(text, data) {
3661
+ if (typeof text !== "string" || text.length === 0) return "";
3662
+ const keys = Object.keys(data).filter(
3663
+ (k) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(k)
3664
+ );
3665
+ if (keys.length === 0) return text;
3666
+ const escaped = keys.map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
3667
+ const pattern = new RegExp(
3668
+ "(?<![{\\\\])\\{(" + escaped.join("|") + ")\\}",
3669
+ "g"
3670
+ );
3671
+ return text.replace(pattern, (_m, key) => {
3672
+ const v = data[key];
3673
+ if (v == null) return "";
3674
+ if (typeof v === "object") {
3675
+ const obj = v;
3676
+ return String(obj.value ?? JSON.stringify(v));
3677
+ }
3678
+ return String(v);
3679
+ });
3680
+ }
3681
+
3659
3682
  // src/se-import/api/seClient.ts
3660
3683
  var SEAuthError = class extends Error {
3661
3684
  constructor(code, message) {
@@ -4869,7 +4892,7 @@ var humanizeVariableName = (rawName) => {
4869
4892
  };
4870
4893
  var getVariableColorClass = (variableType, isSuggested) => {
4871
4894
  if (isSuggested && variableType !== "func")
4872
- return "ls-variable-token--custom";
4895
+ return "ls-variable-token--suggested";
4873
4896
  if (variableType === "func") return "ls-variable-token--function";
4874
4897
  if (variableType === "system") return "ls-variable-token--system";
4875
4898
  return "ls-variable-token--custom";
@@ -4964,24 +4987,27 @@ var LSVariableInputField = forwardRef5((props, ref) => {
4964
4987
  const [autoExpandPaths, setAutoExpandPaths] = useState4(
4965
4988
  () => /* @__PURE__ */ new Set()
4966
4989
  );
4990
+ const shouldRenderPicker = !hideVariables && showVariables;
4967
4991
  const systemVariableValueTrees = useMemo3(() => {
4968
4992
  const map = /* @__PURE__ */ new Map();
4993
+ if (!shouldRenderPicker) return map;
4969
4994
  Object.values(variableRecords).forEach((variable) => {
4970
4995
  if (variable && isExpandableValue(variable.value)) {
4971
4996
  map.set(variable.name, buildValueChildren(variable.value, "", 0));
4972
4997
  }
4973
4998
  });
4974
4999
  return map;
4975
- }, [variableRecords]);
5000
+ }, [shouldRenderPicker, variableRecords]);
4976
5001
  const allowedExampleTrees = useMemo3(() => {
4977
5002
  const map = /* @__PURE__ */ new Map();
5003
+ if (!shouldRenderPicker) return map;
4978
5004
  allowedVariableDefinitions.forEach((definition) => {
4979
5005
  if (isExpandableValue(definition.example)) {
4980
5006
  map.set(definition.name, buildValueChildren(definition.example, "", 0));
4981
5007
  }
4982
5008
  });
4983
5009
  return map;
4984
- }, [allowedVariableDefinitions]);
5010
+ }, [allowedVariableDefinitions, shouldRenderPicker]);
4985
5011
  useEffect4(() => {
4986
5012
  requestTranslations?.();
4987
5013
  }, [requestTranslations]);
@@ -5197,6 +5223,9 @@ var LSVariableInputField = forwardRef5((props, ref) => {
5197
5223
  [allowedExampleTrees, getAllowedVariableRecord, systemVariableValueTrees]
5198
5224
  );
5199
5225
  useEffect4(() => {
5226
+ if (!shouldRenderPicker) {
5227
+ return;
5228
+ }
5200
5229
  const query = (searchQuery ?? "").toLowerCase().replace("{{", "").replace("}}", "").trim();
5201
5230
  const nextAutoExpand = /* @__PURE__ */ new Set();
5202
5231
  const collectNestedAutoExpand = (rootToken, tree) => {
@@ -5313,6 +5342,7 @@ var LSVariableInputField = forwardRef5((props, ref) => {
5313
5342
  }
5314
5343
  setAutoExpandPaths(nextAutoExpand);
5315
5344
  }, [
5345
+ shouldRenderPicker,
5316
5346
  searchQuery,
5317
5347
  allowedVariableDefinitions,
5318
5348
  allowedVariableNames,
@@ -5493,8 +5523,8 @@ var LSVariableInputField = forwardRef5((props, ref) => {
5493
5523
  ] })
5494
5524
  );
5495
5525
  };
5496
- const showSuggestedSection = allowedVariableNames.length > 0 && filteredAllowedVariables.length > 0;
5497
- const pickerBody = /* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker ls-variable-picker--three-col", children: [
5526
+ const showSuggestedSection = shouldRenderPicker && allowedVariableNames.length > 0 && filteredAllowedVariables.length > 0;
5527
+ const pickerBody = shouldRenderPicker ? /* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker ls-variable-picker--three-col", children: [
5498
5528
  /* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__intro", children: [
5499
5529
  /* @__PURE__ */ jsx12("div", { className: "ls-variable-picker__intro-text", children: t(
5500
5530
  "overlay-variables.variables-description",
@@ -5595,7 +5625,7 @@ var LSVariableInputField = forwardRef5((props, ref) => {
5595
5625
  ] }, variable.name);
5596
5626
  })
5597
5627
  ] })
5598
- ] });
5628
+ ] }) : null;
5599
5629
  const textField = (params = {}) => /* @__PURE__ */ jsx12(
5600
5630
  VariableInputTextField,
5601
5631
  {
@@ -8841,5 +8871,6 @@ export {
8841
8871
  mirrorOneAsset,
8842
8872
  rewriteAssetURLs,
8843
8873
  streamElementsCopyJwt,
8874
+ substituteSeTokens,
8844
8875
  transplantLayer
8845
8876
  };
package/package.json CHANGED
@@ -1,138 +1,138 @@
1
1
  {
2
- "name": "@lumiastream/ui",
3
- "version": "0.3.6",
4
- "author": "Lumia Stream",
5
- "license": "ISC",
6
- "description": "Lumia UI Kit",
7
- "packageManager": "npm@11.9.0",
8
- "type": "module",
9
- "main": "dist/index.js",
10
- "module": "dist/index.js",
11
- "types": "dist/index.d.ts",
12
- "files": [
13
- "dist"
14
- ],
15
- "exports": {
16
- ".": {
17
- "types": "./dist/index.d.ts",
18
- "import": "./dist/index.js"
19
- },
20
- "./components": {
21
- "types": "./dist/components.d.ts",
22
- "import": "./dist/components.js"
23
- },
24
- "./LSButton": {
25
- "types": "./dist/LSButton.d.ts",
26
- "import": "./dist/LSButton.js"
27
- },
28
- "./LSCheckbox": {
29
- "types": "./dist/LSCheckbox.d.ts",
30
- "import": "./dist/LSCheckbox.js"
31
- },
32
- "./LSColorPicker": {
33
- "types": "./dist/LSColorPicker.d.ts",
34
- "import": "./dist/LSColorPicker.js"
35
- },
36
- "./LSDatePicker": {
37
- "types": "./dist/LSDatePicker.d.ts",
38
- "import": "./dist/LSDatePicker.js"
39
- },
40
- "./LSFontPicker": {
41
- "types": "./dist/LSFontPicker.d.ts",
42
- "import": "./dist/LSFontPicker.js"
43
- },
44
- "./LSInput": {
45
- "types": "./dist/LSInput.d.ts",
46
- "import": "./dist/LSInput.js"
47
- },
48
- "./LSMultiSelect": {
49
- "types": "./dist/LSMultiSelect.d.ts",
50
- "import": "./dist/LSMultiSelect.js"
51
- },
52
- "./LSRadio": {
53
- "types": "./dist/LSRadio.d.ts",
54
- "import": "./dist/LSRadio.js"
55
- },
56
- "./LSSelect": {
57
- "types": "./dist/LSSelect.d.ts",
58
- "import": "./dist/LSSelect.js"
59
- },
60
- "./LSSliderInput": {
61
- "types": "./dist/LSSliderInput.d.ts",
62
- "import": "./dist/LSSliderInput.js"
63
- },
64
- "./LSTextField": {
65
- "types": "./dist/LSTextField.d.ts",
66
- "import": "./dist/LSTextField.js"
67
- },
68
- "./LSVariableInputField": {
69
- "types": "./dist/LSVariableInputField.d.ts",
70
- "import": "./dist/LSVariableInputField.js"
71
- },
72
- "./utils": {
73
- "types": "./dist/utils.d.ts",
74
- "import": "./dist/utils.js"
75
- },
76
- "./utils/chatMedia": {
77
- "types": "./dist/utils/chatMedia.d.ts",
78
- "import": "./dist/utils/chatMedia.js"
79
- },
80
- "./se-import": {
81
- "types": "./dist/se-import.d.ts",
82
- "import": "./dist/se-import.js"
83
- }
84
- },
85
- "scripts": {
86
- "start": "storybook dev -p 6006",
87
- "build": "tsup",
88
- "build-storybook": "storybook build",
89
- "watch": "tsup --watch",
90
- "test": "vitest run",
91
- "test:watch": "vitest",
92
- "release": "changeset && changeset tag && npm run build && npm publish",
93
- "prepublishOnly": "npm run build",
94
- "postpublish": "npm cache clean --force && node ./scripts/postpublish-install.mjs",
95
- "check-module-defaults": "tsx scripts/check-module-defaults.ts"
96
- },
97
- "peerDependencies": {
98
- "@codemirror/autocomplete": "^6.0.0",
99
- "@emotion/react": "^11.14.0",
100
- "@emotion/styled": "^11.14.1",
101
- "@mui/icons-material": "^9.0.0",
102
- "@mui/material": "^9.0.0",
103
- "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
104
- "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
105
- "react-hook-form": "^7.62.0"
106
- },
107
- "devDependencies": {
108
- "@codemirror/autocomplete": "^6.20.1",
109
- "@emotion/react": "^11.14.0",
110
- "@emotion/styled": "^11.14.1",
111
- "@mui/icons-material": "^9.0.0",
112
- "@mui/material": "^9.0.0",
113
- "@storybook/builder-vite": "^10.2.17",
114
- "@storybook/react-vite": "^10.2.17",
115
- "@types/node": "^25.5.0",
116
- "@types/react": "^19.2.14",
117
- "@types/react-dom": "19.2.3",
118
- "postcss": "^8.5.14",
119
- "react": "^19.2.0",
120
- "react-dom": "^19.2.0",
121
- "react-hook-form": "^7.73.1",
122
- "sass-embedded": "^1.99.0",
123
- "storybook": "^10.2.17",
124
- "tsup": "^8.5.1",
125
- "tsx": "^4.22.3",
126
- "typescript": "^5.9.3",
127
- "vite": "^8.0.8",
128
- "vitest": "^4.1.6"
129
- },
130
- "dependencies": {
131
- "@lumiastream/lumia-translations": "1.16.0",
132
- "@lumiastream/lumia-types": "^3.3.7-alpha.2",
133
- "classnames": "^2.5.1",
134
- "globals": "^17.4.0",
135
- "nanoid": "^5.1.11",
136
- "react-best-gradient-color-picker": "^3.0.14"
137
- }
2
+ "name": "@lumiastream/ui",
3
+ "version": "0.3.9",
4
+ "author": "Lumia Stream",
5
+ "license": "ISC",
6
+ "description": "Lumia UI Kit",
7
+ "packageManager": "npm@11.9.0",
8
+ "type": "module",
9
+ "main": "dist/index.js",
10
+ "module": "dist/index.js",
11
+ "types": "dist/index.d.ts",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ },
20
+ "./components": {
21
+ "types": "./dist/components.d.ts",
22
+ "import": "./dist/components.js"
23
+ },
24
+ "./LSButton": {
25
+ "types": "./dist/LSButton.d.ts",
26
+ "import": "./dist/LSButton.js"
27
+ },
28
+ "./LSCheckbox": {
29
+ "types": "./dist/LSCheckbox.d.ts",
30
+ "import": "./dist/LSCheckbox.js"
31
+ },
32
+ "./LSColorPicker": {
33
+ "types": "./dist/LSColorPicker.d.ts",
34
+ "import": "./dist/LSColorPicker.js"
35
+ },
36
+ "./LSDatePicker": {
37
+ "types": "./dist/LSDatePicker.d.ts",
38
+ "import": "./dist/LSDatePicker.js"
39
+ },
40
+ "./LSFontPicker": {
41
+ "types": "./dist/LSFontPicker.d.ts",
42
+ "import": "./dist/LSFontPicker.js"
43
+ },
44
+ "./LSInput": {
45
+ "types": "./dist/LSInput.d.ts",
46
+ "import": "./dist/LSInput.js"
47
+ },
48
+ "./LSMultiSelect": {
49
+ "types": "./dist/LSMultiSelect.d.ts",
50
+ "import": "./dist/LSMultiSelect.js"
51
+ },
52
+ "./LSRadio": {
53
+ "types": "./dist/LSRadio.d.ts",
54
+ "import": "./dist/LSRadio.js"
55
+ },
56
+ "./LSSelect": {
57
+ "types": "./dist/LSSelect.d.ts",
58
+ "import": "./dist/LSSelect.js"
59
+ },
60
+ "./LSSliderInput": {
61
+ "types": "./dist/LSSliderInput.d.ts",
62
+ "import": "./dist/LSSliderInput.js"
63
+ },
64
+ "./LSTextField": {
65
+ "types": "./dist/LSTextField.d.ts",
66
+ "import": "./dist/LSTextField.js"
67
+ },
68
+ "./LSVariableInputField": {
69
+ "types": "./dist/LSVariableInputField.d.ts",
70
+ "import": "./dist/LSVariableInputField.js"
71
+ },
72
+ "./utils": {
73
+ "types": "./dist/utils.d.ts",
74
+ "import": "./dist/utils.js"
75
+ },
76
+ "./utils/chatMedia": {
77
+ "types": "./dist/utils/chatMedia.d.ts",
78
+ "import": "./dist/utils/chatMedia.js"
79
+ },
80
+ "./se-import": {
81
+ "types": "./dist/se-import.d.ts",
82
+ "import": "./dist/se-import.js"
83
+ }
84
+ },
85
+ "scripts": {
86
+ "start": "storybook dev -p 6006",
87
+ "build": "tsup",
88
+ "build-storybook": "storybook build",
89
+ "watch": "tsup --watch",
90
+ "test": "vitest run",
91
+ "test:watch": "vitest",
92
+ "release": "changeset && changeset tag && npm run build && npm publish",
93
+ "prepublishOnly": "npm run build",
94
+ "postpublish": "npm cache clean --force && node ./scripts/postpublish-install.mjs",
95
+ "check-module-defaults": "tsx scripts/check-module-defaults.ts"
96
+ },
97
+ "peerDependencies": {
98
+ "@codemirror/autocomplete": "^6.0.0",
99
+ "@emotion/react": "^11.14.0",
100
+ "@emotion/styled": "^11.14.1",
101
+ "@mui/icons-material": "^9.0.0",
102
+ "@mui/material": "^9.0.0",
103
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
104
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
105
+ "react-hook-form": "^7.62.0"
106
+ },
107
+ "devDependencies": {
108
+ "@codemirror/autocomplete": "^6.20.1",
109
+ "@emotion/react": "^11.14.0",
110
+ "@emotion/styled": "^11.14.1",
111
+ "@mui/icons-material": "^9.0.0",
112
+ "@mui/material": "^9.0.0",
113
+ "@storybook/builder-vite": "^10.2.17",
114
+ "@storybook/react-vite": "^10.2.17",
115
+ "@types/node": "^25.5.0",
116
+ "@types/react": "^19.2.14",
117
+ "@types/react-dom": "19.2.3",
118
+ "postcss": "^8.5.14",
119
+ "react": "^19.2.0",
120
+ "react-dom": "^19.2.0",
121
+ "react-hook-form": "^7.73.1",
122
+ "sass-embedded": "^1.99.0",
123
+ "storybook": "^10.2.17",
124
+ "tsup": "^8.5.1",
125
+ "tsx": "^4.22.3",
126
+ "typescript": "^5.9.3",
127
+ "vite": "^8.0.8",
128
+ "vitest": "^4.1.6"
129
+ },
130
+ "dependencies": {
131
+ "@lumiastream/lumia-translations": "1.16.0",
132
+ "@lumiastream/lumia-types": "^3.3.7-alpha.2",
133
+ "classnames": "^2.5.1",
134
+ "globals": "^17.4.0",
135
+ "nanoid": "^5.1.11",
136
+ "react-best-gradient-color-picker": "^3.0.14"
137
+ }
138
138
  }