@expcat/tigercat-react 2.0.0-preview.1 → 2.0.0-preview.2

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,6 +1,6 @@
1
1
  import {
2
2
  Select
3
- } from "./chunk-JSBWEK6D.mjs";
3
+ } from "./chunk-YLVXXP7E.mjs";
4
4
  import {
5
5
  Radio
6
6
  } from "./chunk-IIWUQK2P.mjs";
@@ -25,7 +25,8 @@ import {
25
25
  findLastEnabledIndex as pickerFindLastEnabledIndex,
26
26
  findNextEnabledIndex as pickerFindNextEnabledIndex,
27
27
  resolveLocaleText,
28
- mergeTigerLocale
28
+ mergeTigerLocale,
29
+ getSelectLabels
29
30
  } from "@expcat/tigercat-core";
30
31
  var SELECT_KEYS = /* @__PURE__ */ new Set([
31
32
  "options",
@@ -44,6 +45,7 @@ var SELECT_KEYS = /* @__PURE__ */ new Set([
44
45
  "creatable",
45
46
  "createOptionText",
46
47
  "listHeight",
48
+ "labels",
47
49
  "onSearchChange",
48
50
  "onCreate",
49
51
  "className",
@@ -70,6 +72,7 @@ function useSelectState(props) {
70
72
  createOptionText = "Create",
71
73
  virtual = false,
72
74
  listHeight = 256,
75
+ labels: labelsOverride,
73
76
  onSearchChange,
74
77
  onCreate,
75
78
  className,
@@ -84,6 +87,10 @@ function useSelectState(props) {
84
87
  () => mergeTigerLocale(config.locale, locale),
85
88
  [config.locale, locale]
86
89
  );
90
+ const labels = useMemo(
91
+ () => getSelectLabels(mergedLocale, labelsOverride),
92
+ [mergedLocale, labelsOverride]
93
+ );
87
94
  const divProps = {};
88
95
  for (const [k, v] of Object.entries(props)) {
89
96
  if (!SELECT_KEYS.has(k)) divProps[k] = v;
@@ -122,12 +129,12 @@ function useSelectState(props) {
122
129
  if (isMultiple) {
123
130
  const values = Array.isArray(value) ? value : [];
124
131
  if (values.length === 0) return placeholder;
125
- const labels = [...allOptions, ...createdOptions].filter((opt) => values.includes(opt.value)).map((opt) => opt.label);
126
- if (maxTagCount !== void 0 && labels.length > maxTagCount) {
127
- const visible = labels.slice(0, maxTagCount);
128
- return `${visible.join(", ")} +${labels.length - maxTagCount}`;
132
+ const labels2 = [...allOptions, ...createdOptions].filter((opt) => values.includes(opt.value)).map((opt) => opt.label);
133
+ if (maxTagCount !== void 0 && labels2.length > maxTagCount) {
134
+ const visible = labels2.slice(0, maxTagCount);
135
+ return `${visible.join(", ")} +${labels2.length - maxTagCount}`;
129
136
  }
130
- return labels.join(", ");
137
+ return labels2.join(", ");
131
138
  }
132
139
  if (value === void 0 || value === null || value === "") return placeholder;
133
140
  return [...allOptions, ...createdOptions].find((opt) => opt.value === value)?.label ?? placeholder;
@@ -447,11 +454,7 @@ function useSelectState(props) {
447
454
  divProps,
448
455
  searchPlaceholder: resolveLocaleText("Search...", mergedLocale?.common?.searchPlaceholder),
449
456
  clearAriaLabel: resolveLocaleText("Clear selection", mergedLocale?.common?.clearText),
450
- doneText: resolveLocaleText(
451
- "Done",
452
- mergedLocale?.common?.okText,
453
- mergedLocale?.common?.closeText
454
- ),
457
+ doneText: resolveLocaleText(labels.doneText),
455
458
  filteredOptions,
456
459
  flatSelectableOptions,
457
460
  creatableOption,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Table
3
- } from "./chunk-MQ34GFHN.mjs";
3
+ } from "./chunk-YCEH4N3Z.mjs";
4
4
  import {
5
5
  Select
6
- } from "./chunk-JSBWEK6D.mjs";
6
+ } from "./chunk-YLVXXP7E.mjs";
7
7
  import {
8
8
  Popover
9
9
  } from "./chunk-QWUDJC6K.mjs";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  DataTableWithToolbar,
3
3
  DataTableWithToolbar_default
4
- } from "../chunk-G27UYCLT.mjs";
5
- import "../chunk-MQ34GFHN.mjs";
6
- import "../chunk-JSBWEK6D.mjs";
4
+ } from "../chunk-YN4FMZX5.mjs";
5
+ import "../chunk-YCEH4N3Z.mjs";
6
+ import "../chunk-YLVXXP7E.mjs";
7
7
  import "../chunk-IIWUQK2P.mjs";
8
8
  import "../chunk-AKNWUI7K.mjs";
9
9
  import "../chunk-QWUDJC6K.mjs";
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { SelectProps as SelectProps$1, SelectOptions, SelectOption, TigerLocale, SelectValue, SelectValues } from '@expcat/tigercat-core';
2
+ import { SelectProps as SelectProps$1, SelectOptions, SelectOption, SelectValue, SelectValues } from '@expcat/tigercat-core';
3
3
 
4
4
  type SelectDivProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'value' | 'onChange'>;
5
5
  interface SelectBaseProps extends Omit<SelectProps$1, 'multiple' | 'options'>, SelectDivProps {
@@ -7,7 +7,6 @@ interface SelectBaseProps extends Omit<SelectProps$1, 'multiple' | 'options'>, S
7
7
  onSearchChange?: (query: string) => void;
8
8
  onCreate?: (option: SelectOption) => void;
9
9
  className?: string;
10
- locale?: Partial<TigerLocale>;
11
10
  }
12
11
  interface SelectSingleProps extends SelectBaseProps {
13
12
  multiple?: false;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Select
3
- } from "../chunk-JSBWEK6D.mjs";
3
+ } from "../chunk-YLVXXP7E.mjs";
4
4
  import "../chunk-QAIBQHIO.mjs";
5
5
  export {
6
6
  Select
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Table
3
- } from "../chunk-MQ34GFHN.mjs";
4
- import "../chunk-JSBWEK6D.mjs";
3
+ } from "../chunk-YCEH4N3Z.mjs";
4
+ import "../chunk-YLVXXP7E.mjs";
5
5
  import "../chunk-IIWUQK2P.mjs";
6
6
  import "../chunk-AKNWUI7K.mjs";
7
7
  import "../chunk-NJHZQBA7.mjs";
package/dist/index.d.mts CHANGED
@@ -149,6 +149,6 @@ import 'react';
149
149
  * React components for Tigercat UI library
150
150
  */
151
151
 
152
- declare const version = "2.0.0-preview.1";
152
+ declare const version = "2.0.0-preview.2";
153
153
 
154
154
  export { version };
package/dist/index.mjs CHANGED
@@ -15,6 +15,7 @@ export {
15
15
  DEFAULT_IMAGE_EDITOR_LABELS,
16
16
  DEFAULT_IMAGE_VIEWER_LABELS,
17
17
  DEFAULT_PAGINATION_LABELS,
18
+ DEFAULT_SELECT_LABELS,
18
19
  DEFAULT_STATUS_LABELS,
19
20
  DEFAULT_TABLE_LABELS,
20
21
  DEFAULT_TASK_BOARD_LABELS,
@@ -87,6 +88,7 @@ export {
87
88
  ZH_CN_IMAGE_EDITOR_LABELS,
88
89
  ZH_CN_IMAGE_VIEWER_LABELS,
89
90
  ZH_CN_PAGINATION_LABELS,
91
+ ZH_CN_SELECT_LABELS,
90
92
  ZH_CN_STATUS_LABELS,
91
93
  ZH_CN_TABLE_LABELS,
92
94
  ZH_CN_TASK_BOARD_LABELS,
@@ -1003,6 +1005,7 @@ export {
1003
1005
  getSegmentedIndicatorClasses,
1004
1006
  getSegmentedIndicatorStyle,
1005
1007
  getSegmentedOptionClasses,
1008
+ getSelectLabels,
1006
1009
  getSelectOptionClasses,
1007
1010
  getSelectSizeClasses,
1008
1011
  getSelectTriggerClasses,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expcat/tigercat-react",
3
- "version": "2.0.0-preview.1",
3
+ "version": "2.0.0-preview.2",
4
4
  "description": "React components for Tigercat UI library",
5
5
  "license": "MIT",
6
6
  "author": "Yizhe Wang",
@@ -777,7 +777,7 @@
777
777
  "access": "public"
778
778
  },
779
779
  "dependencies": {
780
- "@expcat/tigercat-core": "2.0.0-preview.1"
780
+ "@expcat/tigercat-core": "2.0.0-preview.2"
781
781
  },
782
782
  "devDependencies": {
783
783
  "@types/node": "^22.20.0",