@opexa/portal-components 0.0.1030 → 0.0.1031

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.
@@ -23,5 +23,6 @@ export interface SignUpDefaultProps {
23
23
  isRegulated?: boolean;
24
24
  variant?: string;
25
25
  showEmailAddressField?: boolean;
26
+ branchItemToValue?: 'code' | 'name';
26
27
  }
27
28
  export declare function SignUpDefault(props: SignUpDefaultProps): import("react/jsx-runtime").JSX.Element;
@@ -38,9 +38,14 @@ import DateOfBirthField from '../../DateOfBirthField.js';
38
38
  import { useSignUpDefaultPropsContext } from './SignUpDefaultContext.js';
39
39
  export function SignUpDefaultForm() {
40
40
  const signUpProps = useSignUpDefaultPropsContext();
41
+ const itemToValue = (item) => {
42
+ if (signUpProps.branchItemToValue === 'name')
43
+ return item.name;
44
+ return item.code;
45
+ };
41
46
  const branchCollection = createListCollection({
42
47
  items: signUpProps.branches ?? [],
43
- itemToValue: (item) => item.code,
48
+ itemToValue,
44
49
  itemToString: (item) => {
45
50
  const name = (item.name ?? '').trim();
46
51
  return name ? `${item.code} - ${name}` : item.code;
@@ -167,7 +172,7 @@ export function SignUpDefaultForm() {
167
172
  lastName: '',
168
173
  mobileNumber: '',
169
174
  branchCode: signUpProps?.branches?.length
170
- ? signUpProps.branches[0]?.code
175
+ ? itemToValue(signUpProps.branches[0])
171
176
  : '',
172
177
  termsAccepted: globalStore.responsibleGaming.accepted &&
173
178
  globalStore.termsAndConditions.accepted
@@ -240,9 +245,9 @@ export function SignUpDefaultForm() {
240
245
  }, collection: branchCollection, positioning: {
241
246
  sameWidth: true,
242
247
  placement: 'bottom',
243
- }, lazyMount: true, unmountOnExit: true, children: [_jsxs(Select.Label, { className: "flex items-center gap-1", children: ["Branch", ToolTip] }), _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, {}), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: branchCollection.items.map((item) => {
248
+ }, lazyMount: true, unmountOnExit: true, children: [_jsxs(Select.Label, { className: "flex items-center gap-1", children: ["Branch", ToolTip] }), _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, {}), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: branchCollection.items.map((item, index) => {
244
249
  const label = branchCollection.stringifyItem(item) ?? '';
245
- return (_jsx(Select.Item, { item: item, "aria-disabled": item.disabled, className: twMerge(item.disabled && 'text-border-disabled'), children: _jsx("div", { title: label, className: "line-clamp-1", children: label }) }, item.code));
250
+ return (_jsx(Select.Item, { item: item, "aria-disabled": item.disabled, className: twMerge(item.disabled && 'text-border-disabled'), children: _jsx("div", { title: label, className: "grow", children: label }) }, index));
246
251
  }) }) })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.branchCode?.message })] }))] })), _jsx(Controller, { control: step1Form.control, name: "termsAccepted", render: (o) => (_jsxs(Field.Root, { className: "mt-2xl", invalid: o.fieldState.invalid, children: [_jsxs(Checkbox.Root, { variant: "outline", colorScheme: "neutral", checked: o.field.value, onCheckedChange: (details) => {
247
252
  if (details.checked === 'indeterminate')
248
253
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.1030",
3
+ "version": "0.0.1031",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",