coles-solid-library 0.4.3 → 0.4.5
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/USAGE.html
CHANGED
|
@@ -175,7 +175,7 @@ addTheme('dark'); // or 'light'
|
|
|
175
175
|
disabled
|
|
176
176
|
onClick={(e) => {}}
|
|
177
177
|
>Click Me</Button></code></pre>
|
|
178
|
-
<p>Styling: theme tokens map to CSS variables like <code>--primary-color</code>. Prefer using <code>theme</code> rather than custom class names for consistent theming. Pass <code>class</code>/<code>style</code> for bespoke tweaks.</p>
|
|
178
|
+
<p>Styling: theme tokens map to CSS variables like <code>--primary-color</code>. Prefer using <code>theme</code> rather than custom class names for consistent theming. Pass <code>class</code>/<code>style</code> for bespoke tweaks. Disabled buttons now render with reduced opacity and a not-allowed cursor.</p>
|
|
179
179
|
|
|
180
180
|
<table class="api"><tr><th>Prop</th><th>Type</th><th>Description</th><th>Default</th></tr>
|
|
181
181
|
<tr><td>theme</td><td><code>ThemeVariables (excludes header/subheader)</code></td><td>Visual color role.</td><td><code>container</code></td></tr>
|
|
@@ -201,7 +201,7 @@ const [desc, setDesc] = createSignal("");
|
|
|
201
201
|
placeholder="Description"
|
|
202
202
|
/></code></pre>
|
|
203
203
|
<p><strong>Input:</strong> controlled via <code>value</code> (or form context) and <code>onChange</code>. <strong>TextArea:</strong> uses a signal pair <code>text</code>/<code>setText</code> instead of a <code>value</code> prop and auto-grows with content. Wrap in <code>FormField</code> for legend float + error sync.</p>
|
|
204
|
-
<p><small><strong>Notes:</strong> (1) <code>onChange</code> for <code>Input</code> is invoked after internal form sync (if inside a FormField) so reading form state inside the handler reflects the new value. (2) An <code>Input</code> with <code>type="checkbox"</code> is coerced to text internally for styling; prefer the dedicated <code>Checkbox</code> component for semantics. (3) Required indicator logic appends an asterisk to placeholders when the parent FormField marks the control as required.</small></p>
|
|
204
|
+
<p><small><strong>Notes:</strong> (1) <code>onChange</code> for <code>Input</code> is invoked after internal form sync (if inside a FormField) so reading form state inside the handler reflects the new value. (2) An <code>Input</code> with <code>type="checkbox"</code> is coerced to text internally for styling; prefer the dedicated <code>Checkbox</code> component for semantics. (3) Required indicator logic appends an asterisk to placeholders when the parent FormField marks the control as required. (4) When <code>disabled</code>, Input/TextArea suppress focus/blur handlers and input updates, and apply a disabled visual style.</small></p>
|
|
205
205
|
|
|
206
206
|
<table class="api"><tr><th>Component</th><th>Prop</th><th>Type</th><th>Description</th><th>Default</th></tr>
|
|
207
207
|
<tr><td>Input</td><td>value</td><td><code>string</code></td><td>Controlled value (overrides form context).</td><td>-</td></tr>
|
|
@@ -234,7 +234,7 @@ const [desc, setDesc] = createSignal("");
|
|
|
234
234
|
<Option value="a">Alpha</Option>
|
|
235
235
|
<Option value="b">Beta</Option>
|
|
236
236
|
</Select></code></pre>
|
|
237
|
-
<p><strong>Features:</strong> positioning logic clamps inside viewport; flips above if insufficient space. Multi-select toggles items; consumer tracks selected list via <code>onChange</code> or controlled value (depending on implementation).
|
|
237
|
+
<p><strong>Features:</strong> positioning logic clamps inside viewport; flips above if insufficient space. Multi-select toggles items; consumer tracks selected list via <code>onChange</code> or controlled value (depending on implementation). Keyboard navigation supports Arrow keys, Home/End, Enter, Escape, and type-to-search highlight. Disabled selects do not open or accept selection and expose <code>aria-disabled</code>.</p>
|
|
238
238
|
|
|
239
239
|
<table class="api"><tr><th>Component</th><th>Prop</th><th>Type</th><th>Description</th><th>Default</th></tr>
|
|
240
240
|
<tr><td>Select</td><td>multiple</td><td><code>boolean</code></td><td>Enable multi selection.</td><td>false</td></tr>
|
|
@@ -243,11 +243,12 @@ const [desc, setDesc] = createSignal("");
|
|
|
243
243
|
<tr><td>Select</td><td>onChange</td><td><code>(val) => void</code></td><td>Fires on selection state change (may fire on mount).</td><td>-</td></tr>
|
|
244
244
|
<tr><td>Select</td><td>onSelect</td><td><code>(val) => void</code></td><td>User interaction selection callback.</td><td>-</td></tr>
|
|
245
245
|
<tr><td>Select</td><td>placeholder</td><td><code>string</code></td><td>Trigger placeholder text.</td><td>"Select..."</td></tr>
|
|
246
|
-
<tr><td>Select</td><td>renderValue</td><td><code>(
|
|
246
|
+
<tr><td>Select</td><td>renderValue</td><td><code>(selectedValue) => JSX</code></td><td>Custom render of current value(s).</td><td>-</td></tr>
|
|
247
247
|
<tr><td>Select</td><td>dropdownClass</td><td><code>string</code></td><td>Class for dropdown portal element.</td><td>-</td></tr>
|
|
248
248
|
<tr><td>Select</td><td>transparent</td><td><code>boolean</code></td><td>Transparent trigger style.</td><td>false</td></tr>
|
|
249
249
|
<tr><td>Select</td><td>tooltip</td><td><code>string</code></td><td>Title attribute tooltip.</td><td>-</td></tr>
|
|
250
250
|
<tr><td>Select</td><td>id</td><td><code>string</code></td><td>DOM id (anchor / tests).</td><td>-</td></tr>
|
|
251
|
+
<tr><td>Select</td><td>disabled</td><td><code>boolean</code></td><td>Disable opening and selection; applies disabled styling.</td><td>false</td></tr>
|
|
251
252
|
<tr><td>Option</td><td>value</td><td><code>T</code></td><td>Option value token.</td><td>n/a</td></tr>
|
|
252
253
|
<tr><td>Option</td><td>children</td><td><code>JSX</code></td><td>Displayed label (fallback <code>String(value)</code>).</td><td>-</td></tr>
|
|
253
254
|
<tr><td>Option</td><td>class</td><td><code>string</code></td><td>Custom class.</td><td>-</td></tr>
|
|
@@ -558,7 +559,7 @@ const asyncOk = syncOk && await form.validateAsync();
|
|
|
558
559
|
if (asyncOk) doSubmit();</code></pre>
|
|
559
560
|
<h3 id="forms-patterns">Common Patterns</h3>
|
|
560
561
|
<ul>
|
|
561
|
-
<li>Blur-driven validation via <code>FormField</code>'s outside click detection.</li>
|
|
562
|
+
<li>Blur-driven validation via <code>FormField</code>'s outside click detection; it validates on blur when the field was focused or already dirty.</li>
|
|
562
563
|
<li>Programmatic: <code>form.validate('field')</code> returns boolean.</li>
|
|
563
564
|
<li>Dynamic rules: <code>form.addValidator('name', Validators.maxLength(20))</code>.</li>
|
|
564
565
|
<li>Reset: <code>form.reset()</code> clears errors + meta + restores initial values.</li>
|
|
@@ -9,10 +9,11 @@ interface SelectProps<T = string, K = boolean> {
|
|
|
9
9
|
onSelect?: (value: T) => void;
|
|
10
10
|
placeholder?: string;
|
|
11
11
|
tooltip?: string;
|
|
12
|
-
renderValue?: (
|
|
12
|
+
renderValue?: (selectedValue: T) => JSX.Element;
|
|
13
13
|
class?: string;
|
|
14
14
|
dropdownClass?: string;
|
|
15
15
|
children: JSX.Element;
|
|
16
|
+
disabled?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export declare function Select<T, K extends boolean = false>(props: SelectProps<(K extends true ? T[] : T), K>): JSX.Element;
|
|
18
19
|
export {};
|
|
@@ -2,10 +2,12 @@ import { JSX } from "solid-js";
|
|
|
2
2
|
export interface SelectContextValue<T> {
|
|
3
3
|
isSelected: (val: T) => boolean;
|
|
4
4
|
selectValue: (val: T) => void;
|
|
5
|
-
registerOption?: (val: T, label: JSX.Element) => void;
|
|
5
|
+
registerOption?: (val: T, label: JSX.Element, labelText?: string) => void;
|
|
6
6
|
unregisterOption?: (val: T) => void;
|
|
7
|
+
isHighlighted?: (val: T) => boolean;
|
|
7
8
|
selectRef?: (val: HTMLDivElement | undefined) => HTMLDivElement | undefined;
|
|
8
9
|
selectStyle?: () => string;
|
|
10
|
+
isDisabled?: () => boolean;
|
|
9
11
|
}
|
|
10
12
|
export declare const useSelectContext: () => SelectContextValue<any>;
|
|
11
13
|
export declare const SelectContextProvider: (props: {
|
package/dist/index.esm.js
CHANGED
|
@@ -516,7 +516,7 @@ function styleInject(css, ref) {
|
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
|
|
519
|
-
var css_248z$j = ".Button-module_customButtonStyle__RCNcn {\n border-radius: 8px;\n font-family: \"Roboto, sans-serif\";\n padding: 8px 8px;\n border: none;\n outline: none;\n transition: transform 0.2s ease, background 0.2s ease;\n}\n.Button-module_customButtonStyle__RCNcn:active {\n transform: scale(0.9);\n box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.3);\n}\n.Button-module_customButtonStyle__RCNcn:not(:disabled):hover {\n cursor: pointer;\n box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.15);\n}\n.Button-module_customButtonStyle__RCNcn:disabled:hover {\n cursor: not-allowed;\n}\n\n.Button-module_primary__st6yY {\n background-color: var(--primary-color, #4CAF50);\n color: var(--on-primary-color, #fff);\n}\n\n.Button-module_primaryVariant__ObiQc {\n background-color: var(--primary-color-varient, #43A047);\n color: var(--on-primary-color, #fff);\n}\n\n.Button-module_secondary__j-3rj {\n background-color: var(--secondary-color, #14b9c3);\n color: var(--on-secondary-color, #000000);\n}\n\n.Button-module_secondaryVariant__xFdCV {\n background-color: var(--secondary-color-varient, #0b969f);\n color: var(--on-secondary-color, #000000);\n}\n\n.Button-module_background__ebjke {\n background-color: var(--background-color, #ffffff);\n color: var(--on-background-color, #000000);\n}\n\n.Button-module_surface__wzdJD {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}\n\n.Button-module_surfaceVariant__SkL3X {\n background-color: var(--surface-color-variant, #ccc);\n color: var(--on-surface-color, #000000);\n}\n\n.Button-module_container__0j8md {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n\n.Button-module_error__1zBsf {\n background-color: var(--error-color, #B00020);\n color: var(--on-error-color, #ffffff);\n}\n\n.Button-module_borderPrimary__k5fYt {\n border: 1px solid var(--primary-color, #4CAF50);\n}\n\n.Button-module_borderPrimaryVariant__-uFUm {\n border: 1px solid var(--primary-color-varient, #43A047);\n}\n\n.Button-module_borderSecondary__hzoGk {\n border: 1px solid var(--secondary-color, #14b9c3);\n}\n\n.Button-module_borderSecondaryVariant__-75Li {\n border: 1px solid var(--secondary-color-varient, #0b969f);\n}\n\n.Button-module_borderBackground__Uyf-G {\n border: 1px solid var(--background-color, #ffffff);\n}\n\n.Button-module_borderSurface__q9bRE {\n border: 1px solid var(--surface-color, #EEEEEE);\n}\n\n.Button-module_borderSurfaceVariant__ZHVd0 {\n border: 1px solid var(--surface-color-variant, #ccc);\n}\n\n.Button-module_borderContainer__mXwj- {\n border: 1px solid var(--container-color, #ffffff);\n}\n\n.Button-module_borderError__IChtd {\n border: 1px solid var(--error-color, #B00020);\n}\n\n.Button-module_none__YrUD1 {\n border: none;\n}\n\n.Button-module_transparent__6v0QA {\n background-color: transparent !important;\n border: none;\n outline: none;\n padding: 0px;\n margin: 0px;\n}";
|
|
519
|
+
var css_248z$j = ".Button-module_customButtonStyle__RCNcn {\n border-radius: 8px;\n font-family: \"Roboto, sans-serif\";\n padding: 8px 8px;\n border: none;\n outline: none;\n transition: transform 0.2s ease, background 0.2s ease;\n}\n.Button-module_customButtonStyle__RCNcn:active {\n transform: scale(0.9);\n box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.3);\n}\n.Button-module_customButtonStyle__RCNcn:not(:disabled):hover {\n cursor: pointer;\n box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.15);\n}\n.Button-module_customButtonStyle__RCNcn:disabled {\n opacity: 0.6;\n}\n.Button-module_customButtonStyle__RCNcn:disabled:hover {\n cursor: not-allowed;\n}\n\n.Button-module_primary__st6yY {\n background-color: var(--primary-color, #4CAF50);\n color: var(--on-primary-color, #fff);\n}\n\n.Button-module_primaryVariant__ObiQc {\n background-color: var(--primary-color-varient, #43A047);\n color: var(--on-primary-color, #fff);\n}\n\n.Button-module_secondary__j-3rj {\n background-color: var(--secondary-color, #14b9c3);\n color: var(--on-secondary-color, #000000);\n}\n\n.Button-module_secondaryVariant__xFdCV {\n background-color: var(--secondary-color-varient, #0b969f);\n color: var(--on-secondary-color, #000000);\n}\n\n.Button-module_background__ebjke {\n background-color: var(--background-color, #ffffff);\n color: var(--on-background-color, #000000);\n}\n\n.Button-module_surface__wzdJD {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}\n\n.Button-module_surfaceVariant__SkL3X {\n background-color: var(--surface-color-variant, #ccc);\n color: var(--on-surface-color, #000000);\n}\n\n.Button-module_container__0j8md {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n\n.Button-module_error__1zBsf {\n background-color: var(--error-color, #B00020);\n color: var(--on-error-color, #ffffff);\n}\n\n.Button-module_borderPrimary__k5fYt {\n border: 1px solid var(--primary-color, #4CAF50);\n}\n\n.Button-module_borderPrimaryVariant__-uFUm {\n border: 1px solid var(--primary-color-varient, #43A047);\n}\n\n.Button-module_borderSecondary__hzoGk {\n border: 1px solid var(--secondary-color, #14b9c3);\n}\n\n.Button-module_borderSecondaryVariant__-75Li {\n border: 1px solid var(--secondary-color-varient, #0b969f);\n}\n\n.Button-module_borderBackground__Uyf-G {\n border: 1px solid var(--background-color, #ffffff);\n}\n\n.Button-module_borderSurface__q9bRE {\n border: 1px solid var(--surface-color, #EEEEEE);\n}\n\n.Button-module_borderSurfaceVariant__ZHVd0 {\n border: 1px solid var(--surface-color-variant, #ccc);\n}\n\n.Button-module_borderContainer__mXwj- {\n border: 1px solid var(--container-color, #ffffff);\n}\n\n.Button-module_borderError__IChtd {\n border: 1px solid var(--error-color, #B00020);\n}\n\n.Button-module_none__YrUD1 {\n border: none;\n}\n\n.Button-module_transparent__6v0QA {\n background-color: transparent !important;\n border: none;\n outline: none;\n padding: 0px;\n margin: 0px;\n}";
|
|
520
520
|
var style$8 = {"customButtonStyle":"Button-module_customButtonStyle__RCNcn","primary":"Button-module_primary__st6yY","primaryVariant":"Button-module_primaryVariant__ObiQc","secondary":"Button-module_secondary__j-3rj","secondaryVariant":"Button-module_secondaryVariant__xFdCV","background":"Button-module_background__ebjke","surface":"Button-module_surface__wzdJD","surfaceVariant":"Button-module_surfaceVariant__SkL3X","container":"Button-module_container__0j8md","error":"Button-module_error__1zBsf","borderPrimary":"Button-module_borderPrimary__k5fYt","borderPrimaryVariant":"Button-module_borderPrimaryVariant__-uFUm","borderSecondary":"Button-module_borderSecondary__hzoGk","borderSecondaryVariant":"Button-module_borderSecondaryVariant__-75Li","borderBackground":"Button-module_borderBackground__Uyf-G","borderSurface":"Button-module_borderSurface__q9bRE","borderSurfaceVariant":"Button-module_borderSurfaceVariant__ZHVd0","borderContainer":"Button-module_borderContainer__mXwj-","borderError":"Button-module_borderError__IChtd","none":"Button-module_none__YrUD1","transparent":"Button-module_transparent__6v0QA"};
|
|
521
521
|
styleInject(css_248z$j);
|
|
522
522
|
|
|
@@ -1396,7 +1396,7 @@ function useClickOutside(elementRefs, callback) {
|
|
|
1396
1396
|
}
|
|
1397
1397
|
|
|
1398
1398
|
var css_248z$e = "@charset \"UTF-8\";\n.input-module_input__-LMoi {\n width: 100%;\n max-width: 400px;\n border-radius: var(--border-radius-lg, 16px);\n font-size: var(--font-size-base, 16px);\n transition: border 0.7s ease, padding 0.7s ease;\n}\n@media screen and (max-width: 768px) {\n .input-module_input__-LMoi {\n width: 100%;\n max-width: 100%;\n }\n}\n.input-module_input__-LMoi[type=checkbox] {\n width: -moz-min-content;\n width: min-content;\n -webkit-appearance: none;\n border: 1px solid #cacece;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05);\n padding: var(--spacing-1, 8px);\n border-radius: var(--border-radius-sm);\n display: inline-block;\n position: relative;\n}\n.input-module_input__-LMoi[type=checkbox]:checked {\n background-color: inherit;\n border: 1px solid #adb8c0;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05), inset 15px 10px -12px rgba(255, 255, 255, 0.1);\n color: inherit;\n}\n.input-module_input__-LMoi[type=checkbox]:checked:after {\n content: \"✔\";\n position: absolute;\n top: -15%;\n left: 15%;\n width: 10px;\n height: 10px;\n border-radius: 10%;\n}\n.input-module_input__-LMoi:not([type=checkbox])::-moz-placeholder {\n opacity: 0;\n}\n.input-module_input__-LMoi:not([type=checkbox])::placeholder {\n opacity: 0;\n}\n.input-module_input__-LMoi:focus {\n outline: none;\n}\n.input-module_input__-LMoi.input-module_error__vs2kz {\n border: 1px solid var(--warn-color);\n}\n.input-module_input__-LMoi.input-module_success__beiu5 {\n border: 1px solid green;\n}\n.input-module_input__-LMoi.input-module_warning__b6S5s {\n border: 1px solid orange;\n}\n.input-module_input__-LMoi.input-module_info__pWO0n {\n border: 1px solid blue;\n}\n.input-module_input__-LMoi.input-module_disabled__40ZHw {\n border: 1px solid gray;\n}\n\n.input-module_inFormField__kk-PD {\n border: none;\n outline: none;\n transition: padding 0.7s ease;\n}\n\n.input-module_checkbox__Yu-9M {\n cursor: pointer;\n}\n\n.input-module_transparent__aXcGX {\n background-color: inherit !important;\n opacity: 1;\n color: inherit !important;\n border: none;\n}\n.input-module_transparent__aXcGX :focus {\n outline: none;\n}";
|
|
1399
|
-
var styles$9 = {"input":"input-module_input__-LMoi","inFormField":"input-module_inFormField__kk-PD","transparent":"input-module_transparent__aXcGX"};
|
|
1399
|
+
var styles$9 = {"input":"input-module_input__-LMoi","disabled":"input-module_disabled__40ZHw","inFormField":"input-module_inFormField__kk-PD","transparent":"input-module_transparent__aXcGX"};
|
|
1400
1400
|
styleInject(css_248z$e);
|
|
1401
1401
|
|
|
1402
1402
|
var _tmpl$$j = /*#__PURE__*/template(`<form>`);
|
|
@@ -1583,17 +1583,13 @@ const Input = props => {
|
|
|
1583
1583
|
return inputValue();
|
|
1584
1584
|
},
|
|
1585
1585
|
"onFocus": () => {
|
|
1586
|
+
if (props.disabled) return;
|
|
1586
1587
|
if (!isNullish(context.getName)) {
|
|
1587
1588
|
context.setFocused?.(true);
|
|
1588
|
-
// Mark dirty on initial focus if part of a form (requested behavior)
|
|
1589
|
-
const formName = context.formName;
|
|
1590
|
-
if (formName && formContext?.formGroup?.markDirty) {
|
|
1591
|
-
const meta = formContext.formGroup.getMeta(formName);
|
|
1592
|
-
if (meta && !meta.dirty) formContext.formGroup.markDirty(formName);
|
|
1593
|
-
}
|
|
1594
1589
|
}
|
|
1595
1590
|
},
|
|
1596
1591
|
"onBlur": e => {
|
|
1592
|
+
if (props.disabled) return;
|
|
1597
1593
|
if (!isNullish(context.getName)) {
|
|
1598
1594
|
context?.setFocused?.(prev => {
|
|
1599
1595
|
if (prev) {
|
|
@@ -1612,7 +1608,7 @@ const Input = props => {
|
|
|
1612
1608
|
},
|
|
1613
1609
|
"onChange": onChange,
|
|
1614
1610
|
get ["class"]() {
|
|
1615
|
-
return `${styles$9.input} ${customProps.transparent ? styles$9.transparent : ""} ${!!context?.getName?.() ? styles$9.inFormField : ""} ${props?.class ?? ""}`;
|
|
1611
|
+
return `${styles$9.input} ${props.disabled ? styles$9.disabled : ""} ${customProps.transparent ? styles$9.transparent : ""} ${!!context?.getName?.() ? styles$9.inFormField : ""} ${props?.class ?? ""}`;
|
|
1616
1612
|
},
|
|
1617
1613
|
get title() {
|
|
1618
1614
|
return customProps.tooltip;
|
|
@@ -1724,8 +1720,8 @@ function Checkbox(props) {
|
|
|
1724
1720
|
})();
|
|
1725
1721
|
}
|
|
1726
1722
|
|
|
1727
|
-
var css_248z$c = ".selectStyles-module_solid_select__placeholder__VO5-- {\n opacity: var(--text-emphasis-medium, 87%);\n transition: all 0.7s ease;\n}\n\n.selectStyles-module_solid_select__transparent__nOpvm {\n background-color: transparent;\n}\n\n.selectStyles-module_solid_select__3plh1 {\n display: inline-block;\n position: relative;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n text-align: left;\n border-radius: 8px;\n width: 100%;\n margin: 0px 6px;\n}\n\n.selectStyles-module_solid_select__control__Wmmpg {\n display: flex;\n align-items: center;\n width: 100%;\n max-height: 48px;\n border-radius: 8px;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n cursor: pointer;\n transition: border 0.7s ease, padding 0.7s ease;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.selectStyles-module_solid_select__control__Wmmpg:first-child {\n flex-grow: 1;\n}\n.selectStyles-module_solid_select__control__Wmmpg:last-child {\n padding: 0px 6px;\n margin: 0px;\n}\n\n.selectStyles-module_solid_select__control_no_form__Cq9Sc {\n display: flex;\n align-items: center;\n width: 100%;\n height: 48px;\n border-radius: 8px;\n width: 200px;\n margin-top: 2px;\n cursor: pointer;\n}\n.selectStyles-module_solid_select__control_no_form__Cq9Sc:first-child {\n flex-grow: 1;\n}\n.selectStyles-module_solid_select__control_no_form__Cq9Sc:last-child {\n padding: 0px 6px;\n margin: 0px;\n}\n\n.selectStyles-module_solid_select__arrow__OPCZo {\n font-size: 0.7em;\n}\n\n.selectStyles-module_solid_select__value__rNtqF {\n flex-grow: 1;\n transition: all 0.3s ease;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n}\n\n.selectStyles-module_multiselect-value__UUhhP {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n}\n\n.selectStyles-module_solid_select__dropdown__UCt-N {\n position: absolute;\n background-color: var(--surface-color, #EEEEEE);\n top: 100%;\n left: 0;\n z-index: 999999999999999;\n max-height: 200px;\n border-radius: 8px;\n overflow-x: hidden;\n overflow-y: auto;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);\n transform-origin: top;\n transform: scaleY(0);\n transition: transform 0.3s ease-out, opacity 0.3s ease-out;\n opacity: 0;\n}\n\n.selectStyles-module_dropTop__IVz9p {\n transform-origin: bottom;\n}\n\n.selectStyles-module_dropBottom__cYJF0 {\n transform-origin: top;\n}\n\n.selectStyles-module_open__f8zLA {\n transform: scaleY(1);\n opacity: 1;\n}\n\n.selectStyles-module_solid_select__option__47WMY {\n padding: 8px;\n cursor: pointer;\n display: flex;\n align-items: center;\n min-height: 32px;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n border-radius: 8px;\n}\n.selectStyles-module_solid_select__option__47WMY:hover {\n border: 2px inset var(--primary-color-varient, #43A047);\n}\n.selectStyles-module_solid_select__option__47WMY:has(.selectStyles-module_selected__1-CKm) {\n font-weight: bold;\n}\n\n.selectStyles-module_checkmark__UWcbd {\n display: inline-block;\n width: 1.2em;\n margin-right: 4px;\n text-align: center;\n}\n\n.selectStyles-module_option-label__bBFSW {\n width: -moz-max-content;\n width: max-content;\n height: -moz-max-content;\n height: max-content;\n}";
|
|
1728
|
-
var styles$7 = {"solid_select__placeholder":"selectStyles-module_solid_select__placeholder__VO5--","solid_select__transparent":"selectStyles-module_solid_select__transparent__nOpvm","solid_select":"selectStyles-module_solid_select__3plh1","solid_select__control":"selectStyles-module_solid_select__control__Wmmpg","solid_select__control_no_form":"selectStyles-module_solid_select__control_no_form__Cq9Sc","solid_select__arrow":"selectStyles-module_solid_select__arrow__OPCZo","solid_select__value":"selectStyles-module_solid_select__value__rNtqF","multiselect-value":"selectStyles-module_multiselect-value__UUhhP","solid_select__dropdown":"selectStyles-module_solid_select__dropdown__UCt-N","dropTop":"selectStyles-module_dropTop__IVz9p","dropBottom":"selectStyles-module_dropBottom__cYJF0","open":"selectStyles-module_open__f8zLA","solid_select__option":"selectStyles-module_solid_select__option__47WMY","selected":"selectStyles-module_selected__1-CKm","checkmark":"selectStyles-module_checkmark__UWcbd","option-label":"selectStyles-module_option-label__bBFSW"};
|
|
1723
|
+
var css_248z$c = ".selectStyles-module_solid_select__placeholder__VO5-- {\n opacity: var(--text-emphasis-medium, 87%);\n transition: all 0.7s ease;\n}\n\n.selectStyles-module_solid_select__transparent__nOpvm {\n background-color: transparent;\n}\n\n.selectStyles-module_solid_select__3plh1 {\n display: inline-block;\n position: relative;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n text-align: left;\n border-radius: 8px;\n width: 100%;\n margin: 0px 6px;\n}\n\n.selectStyles-module_solid_select__control__Wmmpg {\n display: flex;\n align-items: center;\n width: 100%;\n max-height: 48px;\n border-radius: 8px;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n cursor: pointer;\n transition: border 0.7s ease, padding 0.7s ease;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.selectStyles-module_solid_select__control__Wmmpg:first-child {\n flex-grow: 1;\n}\n.selectStyles-module_solid_select__control__Wmmpg:last-child {\n padding: 0px 6px;\n margin: 0px;\n}\n\n.selectStyles-module_solid_select__control_no_form__Cq9Sc {\n display: flex;\n align-items: center;\n width: 100%;\n height: 48px;\n border-radius: 8px;\n width: 200px;\n margin-top: 2px;\n cursor: pointer;\n}\n.selectStyles-module_solid_select__control_no_form__Cq9Sc:first-child {\n flex-grow: 1;\n}\n.selectStyles-module_solid_select__control_no_form__Cq9Sc:last-child {\n padding: 0px 6px;\n margin: 0px;\n}\n\n.selectStyles-module_solid_select__disabled__5rUz8 {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.selectStyles-module_solid_select__arrow__OPCZo {\n font-size: 0.7em;\n}\n\n.selectStyles-module_solid_select__value__rNtqF {\n flex-grow: 1;\n transition: all 0.3s ease;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n}\n\n.selectStyles-module_multiselect-value__UUhhP {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n}\n\n.selectStyles-module_solid_select__dropdown__UCt-N {\n position: absolute;\n background-color: var(--surface-color, #EEEEEE);\n top: 100%;\n left: 0;\n z-index: 999999999999999;\n max-height: 200px;\n border-radius: 8px;\n overflow-x: hidden;\n overflow-y: auto;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);\n transform-origin: top;\n transform: scaleY(0);\n transition: transform 0.3s ease-out, opacity 0.3s ease-out;\n opacity: 0;\n}\n\n.selectStyles-module_dropTop__IVz9p {\n transform-origin: bottom;\n}\n\n.selectStyles-module_dropBottom__cYJF0 {\n transform-origin: top;\n}\n\n.selectStyles-module_open__f8zLA {\n transform: scaleY(1);\n opacity: 1;\n}\n\n.selectStyles-module_solid_select__option__47WMY {\n padding: 8px;\n cursor: pointer;\n display: flex;\n align-items: center;\n min-height: 32px;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n border-radius: 8px;\n}\n.selectStyles-module_solid_select__option__47WMY:hover {\n border: 2px inset var(--primary-color-varient, #43A047);\n}\n.selectStyles-module_solid_select__option__47WMY:has(.selectStyles-module_selected__1-CKm) {\n font-weight: bold;\n}\n\n.selectStyles-module_solid_select__option_highlight__hPSRL {\n border: 2px inset var(--primary-color-varient, #43A047);\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n\n.selectStyles-module_solid_select__option_disabled__IZBcA {\n cursor: not-allowed;\n opacity: 0.6;\n pointer-events: none;\n}\n\n.selectStyles-module_checkmark__UWcbd {\n display: inline-block;\n width: 1.2em;\n margin-right: 4px;\n text-align: center;\n}\n\n.selectStyles-module_option-label__bBFSW {\n width: -moz-max-content;\n width: max-content;\n height: -moz-max-content;\n height: max-content;\n}";
|
|
1724
|
+
var styles$7 = {"solid_select__placeholder":"selectStyles-module_solid_select__placeholder__VO5--","solid_select__transparent":"selectStyles-module_solid_select__transparent__nOpvm","solid_select":"selectStyles-module_solid_select__3plh1","solid_select__control":"selectStyles-module_solid_select__control__Wmmpg","solid_select__control_no_form":"selectStyles-module_solid_select__control_no_form__Cq9Sc","solid_select__disabled":"selectStyles-module_solid_select__disabled__5rUz8","solid_select__arrow":"selectStyles-module_solid_select__arrow__OPCZo","solid_select__value":"selectStyles-module_solid_select__value__rNtqF","multiselect-value":"selectStyles-module_multiselect-value__UUhhP","solid_select__dropdown":"selectStyles-module_solid_select__dropdown__UCt-N","dropTop":"selectStyles-module_dropTop__IVz9p","dropBottom":"selectStyles-module_dropBottom__cYJF0","open":"selectStyles-module_open__f8zLA","solid_select__option":"selectStyles-module_solid_select__option__47WMY","selected":"selectStyles-module_selected__1-CKm","solid_select__option_highlight":"selectStyles-module_solid_select__option_highlight__hPSRL","solid_select__option_disabled":"selectStyles-module_solid_select__option_disabled__IZBcA","checkmark":"selectStyles-module_checkmark__UWcbd","option-label":"selectStyles-module_option-label__bBFSW"};
|
|
1729
1725
|
styleInject(css_248z$c);
|
|
1730
1726
|
|
|
1731
1727
|
const manager = new class WinManager {
|
|
@@ -1843,6 +1839,17 @@ function Select(props) {
|
|
|
1843
1839
|
};
|
|
1844
1840
|
// Signal for dropdown open/closed
|
|
1845
1841
|
const [open, setOpen] = createSignal(false);
|
|
1842
|
+
const [optionOrder, setOptionOrder] = createSignal([]);
|
|
1843
|
+
const [highlightedIndex, setHighlightedIndex] = createSignal(-1);
|
|
1844
|
+
const [typeahead, setTypeahead] = createSignal("");
|
|
1845
|
+
let typeaheadTimeoutId;
|
|
1846
|
+
let lastTypeaheadAt = 0;
|
|
1847
|
+
const TYPEAHEAD_TIMEOUT = 650;
|
|
1848
|
+
const isDisabled = () => {
|
|
1849
|
+
const fieldset = form?.getFormFieldRef?.();
|
|
1850
|
+
const fieldsetDisabled = !!fieldset?.hasAttribute?.('disabled');
|
|
1851
|
+
return !!props.disabled || fieldsetDisabled;
|
|
1852
|
+
};
|
|
1846
1853
|
const menuLocRef = createMemo(() => {
|
|
1847
1854
|
if (!!form?.getFormFieldRef) {
|
|
1848
1855
|
return form.getFormFieldRef();
|
|
@@ -1851,15 +1858,18 @@ function Select(props) {
|
|
|
1851
1858
|
});
|
|
1852
1859
|
const [options, setOptions] = createStore({});
|
|
1853
1860
|
// Register and unregister functions using the store
|
|
1854
|
-
const registerOption = (val, label) => {
|
|
1861
|
+
const registerOption = (val, label, labelText = "") => {
|
|
1855
1862
|
const stringVal = JSON.stringify(val);
|
|
1856
1863
|
setOptions(store => ({
|
|
1857
1864
|
...store,
|
|
1858
1865
|
[stringVal]: {
|
|
1859
1866
|
value: stringVal,
|
|
1860
|
-
|
|
1867
|
+
raw: val,
|
|
1868
|
+
label,
|
|
1869
|
+
labelText
|
|
1861
1870
|
}
|
|
1862
1871
|
}));
|
|
1872
|
+
setOptionOrder(prev => prev.includes(stringVal) ? prev : [...prev, stringVal]);
|
|
1863
1873
|
};
|
|
1864
1874
|
const unregisterOption = val => {
|
|
1865
1875
|
const stringVal = JSON.stringify(val);
|
|
@@ -1870,6 +1880,79 @@ function Select(props) {
|
|
|
1870
1880
|
delete newStore[stringVal];
|
|
1871
1881
|
return newStore;
|
|
1872
1882
|
});
|
|
1883
|
+
setOptionOrder(prev => prev.filter(key => key !== stringVal));
|
|
1884
|
+
};
|
|
1885
|
+
const optionEntries = createMemo(() => optionOrder().map(key => options[key]).filter(entry => !!entry));
|
|
1886
|
+
const getOptionLabelText = entry => {
|
|
1887
|
+
if (!entry) return "";
|
|
1888
|
+
const text = entry.labelText?.trim();
|
|
1889
|
+
if (text) return text;
|
|
1890
|
+
if (typeof entry.label === "string" || typeof entry.label === "number") return String(entry.label);
|
|
1891
|
+
return String(entry.raw ?? entry.value ?? "").trim();
|
|
1892
|
+
};
|
|
1893
|
+
const scrollHighlightedIntoView = index => {
|
|
1894
|
+
const dropdown = dropdownRef();
|
|
1895
|
+
if (!dropdown) return;
|
|
1896
|
+
const optionsEls = dropdown.querySelectorAll('[role="option"]');
|
|
1897
|
+
const idx = index ?? highlightedIndex();
|
|
1898
|
+
const el = optionsEls[idx];
|
|
1899
|
+
if (el && typeof el.scrollIntoView === "function") {
|
|
1900
|
+
el.scrollIntoView({
|
|
1901
|
+
block: "nearest"
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
};
|
|
1905
|
+
const moveHighlight = delta => {
|
|
1906
|
+
const entries = optionEntries();
|
|
1907
|
+
if (!entries.length) return;
|
|
1908
|
+
const nextIndex = ((highlightedIndex() < 0 ? 0 : highlightedIndex()) + delta + entries.length) % entries.length;
|
|
1909
|
+
setHighlightedIndex(nextIndex);
|
|
1910
|
+
queueMicrotask(() => scrollHighlightedIntoView(nextIndex));
|
|
1911
|
+
};
|
|
1912
|
+
const setHighlightToSelectedOrFirst = () => {
|
|
1913
|
+
const entries = optionEntries();
|
|
1914
|
+
if (!entries.length) {
|
|
1915
|
+
setHighlightedIndex(-1);
|
|
1916
|
+
return;
|
|
1917
|
+
}
|
|
1918
|
+
let idx = entries.findIndex(entry => isSelected(entry.raw));
|
|
1919
|
+
if (idx < 0) idx = 0;
|
|
1920
|
+
setHighlightedIndex(idx);
|
|
1921
|
+
queueMicrotask(() => scrollHighlightedIntoView(idx));
|
|
1922
|
+
};
|
|
1923
|
+
const findMatchIndex = search => {
|
|
1924
|
+
const entries = optionEntries();
|
|
1925
|
+
if (!entries.length) return -1;
|
|
1926
|
+
const normalized = search.toLowerCase();
|
|
1927
|
+
const start = highlightedIndex() >= 0 ? (highlightedIndex() + 1) % entries.length : 0;
|
|
1928
|
+
for (let i = 0; i < entries.length; i += 1) {
|
|
1929
|
+
const idx = (start + i) % entries.length;
|
|
1930
|
+
const label = getOptionLabelText(entries[idx]).toLowerCase();
|
|
1931
|
+
if (label.startsWith(normalized)) return idx;
|
|
1932
|
+
}
|
|
1933
|
+
return -1;
|
|
1934
|
+
};
|
|
1935
|
+
const resetTypeahead = () => {
|
|
1936
|
+
setTypeahead("");
|
|
1937
|
+
if (typeaheadTimeoutId) {
|
|
1938
|
+
window.clearTimeout(typeaheadTimeoutId);
|
|
1939
|
+
typeaheadTimeoutId = undefined;
|
|
1940
|
+
}
|
|
1941
|
+
};
|
|
1942
|
+
const handleTypeahead = key => {
|
|
1943
|
+
const now = Date.now();
|
|
1944
|
+
const prev = typeahead();
|
|
1945
|
+
const isRepeat = prev.length === 1 && prev === key && now - lastTypeaheadAt < TYPEAHEAD_TIMEOUT;
|
|
1946
|
+
const nextBuffer = isRepeat ? key : `${prev}${key}`;
|
|
1947
|
+
lastTypeaheadAt = now;
|
|
1948
|
+
setTypeahead(nextBuffer);
|
|
1949
|
+
if (typeaheadTimeoutId) window.clearTimeout(typeaheadTimeoutId);
|
|
1950
|
+
typeaheadTimeoutId = window.setTimeout(() => setTypeahead(""), TYPEAHEAD_TIMEOUT);
|
|
1951
|
+
const matchIndex = findMatchIndex(nextBuffer);
|
|
1952
|
+
if (matchIndex >= 0) {
|
|
1953
|
+
setHighlightedIndex(matchIndex);
|
|
1954
|
+
queueMicrotask(() => scrollHighlightedIntoView(matchIndex));
|
|
1955
|
+
}
|
|
1873
1956
|
};
|
|
1874
1957
|
const getLabel = val => {
|
|
1875
1958
|
const stringVal = JSON.stringify(val);
|
|
@@ -1883,6 +1966,10 @@ function Select(props) {
|
|
|
1883
1966
|
// Function to handle selecting/toggling an option for single or multi-select
|
|
1884
1967
|
// When not using a form or greater FormContext
|
|
1885
1968
|
const selectValue = val => {
|
|
1969
|
+
if (form?.formName && formContext?.formGroup?.markDirty) {
|
|
1970
|
+
const meta = formContext.formGroup.getMeta(form?.formName);
|
|
1971
|
+
if (meta && !meta.dirty) formContext.formGroup.markDirty(form?.formName);
|
|
1972
|
+
}
|
|
1886
1973
|
if (isMultiple) {
|
|
1887
1974
|
// For multi-select, toggle the value in the array
|
|
1888
1975
|
const current = props?.value ?? [];
|
|
@@ -2127,6 +2214,7 @@ function Select(props) {
|
|
|
2127
2214
|
!!props?.onChange ? props.onChange(currentValue()) : null;
|
|
2128
2215
|
});
|
|
2129
2216
|
useClickOutside([dropdownRef, selectRef], () => {
|
|
2217
|
+
if (isDisabled()) return;
|
|
2130
2218
|
setOpen(false);
|
|
2131
2219
|
form?.setFocused?.(prev => {
|
|
2132
2220
|
if (prev) {
|
|
@@ -2182,13 +2270,48 @@ function Select(props) {
|
|
|
2182
2270
|
queueMicrotask(() => updatePosition());
|
|
2183
2271
|
}
|
|
2184
2272
|
});
|
|
2273
|
+
createEffect(() => {
|
|
2274
|
+
const entries = optionEntries();
|
|
2275
|
+
if (!entries.length) {
|
|
2276
|
+
if (highlightedIndex() !== -1) setHighlightedIndex(-1);
|
|
2277
|
+
return;
|
|
2278
|
+
}
|
|
2279
|
+
if (highlightedIndex() >= entries.length) {
|
|
2280
|
+
setHighlightedIndex(entries.length - 1);
|
|
2281
|
+
}
|
|
2282
|
+
});
|
|
2283
|
+
createEffect(() => {
|
|
2284
|
+
if (open()) {
|
|
2285
|
+
setHighlightToSelectedOrFirst();
|
|
2286
|
+
} else {
|
|
2287
|
+
setHighlightedIndex(-1);
|
|
2288
|
+
resetTypeahead();
|
|
2289
|
+
}
|
|
2290
|
+
});
|
|
2291
|
+
createEffect(() => {
|
|
2292
|
+
if (props.disabled) {
|
|
2293
|
+
setOpen(false);
|
|
2294
|
+
}
|
|
2295
|
+
});
|
|
2296
|
+
onCleanup(() => {
|
|
2297
|
+
if (typeaheadTimeoutId) {
|
|
2298
|
+
window.clearTimeout(typeaheadTimeoutId);
|
|
2299
|
+
}
|
|
2300
|
+
});
|
|
2185
2301
|
const providerValue = createMemo(() => ({
|
|
2186
2302
|
isSelected,
|
|
2187
2303
|
selectValue,
|
|
2188
2304
|
registerOption,
|
|
2189
2305
|
unregisterOption,
|
|
2306
|
+
isHighlighted: val => {
|
|
2307
|
+
const stringVal = JSON.stringify(val);
|
|
2308
|
+
const entries = optionEntries();
|
|
2309
|
+
const index = entries.findIndex(entry => entry.value === stringVal);
|
|
2310
|
+
return index >= 0 && index === highlightedIndex();
|
|
2311
|
+
},
|
|
2190
2312
|
selectRef,
|
|
2191
|
-
selectStyle: currStyle
|
|
2313
|
+
selectStyle: currStyle,
|
|
2314
|
+
isDisabled
|
|
2192
2315
|
}));
|
|
2193
2316
|
const [dropTop, setDropTop] = createSignal(false);
|
|
2194
2317
|
return (() => {
|
|
@@ -2196,32 +2319,73 @@ function Select(props) {
|
|
|
2196
2319
|
_el$8 = _el$7.firstChild,
|
|
2197
2320
|
_el$9 = _el$8.firstChild;
|
|
2198
2321
|
_el$7.$$keydown = e => {
|
|
2322
|
+
if (isDisabled()) return;
|
|
2323
|
+
if (e.key === "Tab") {
|
|
2324
|
+
setOpen(false);
|
|
2325
|
+
return;
|
|
2326
|
+
}
|
|
2199
2327
|
if (e.key === "ArrowDown") {
|
|
2200
|
-
|
|
2328
|
+
e.preventDefault();
|
|
2201
2329
|
if (!open()) {
|
|
2202
2330
|
setOpen(true);
|
|
2203
|
-
|
|
2331
|
+
setHighlightToSelectedOrFirst();
|
|
2332
|
+
} else {
|
|
2333
|
+
moveHighlight(1);
|
|
2334
|
+
}
|
|
2335
|
+
} else if (e.key === "ArrowUp") {
|
|
2336
|
+
e.preventDefault();
|
|
2337
|
+
if (!open()) {
|
|
2338
|
+
setOpen(true);
|
|
2339
|
+
setHighlightToSelectedOrFirst();
|
|
2340
|
+
} else {
|
|
2341
|
+
moveHighlight(-1);
|
|
2204
2342
|
}
|
|
2205
|
-
} else if (e.key === "
|
|
2343
|
+
} else if (e.key === "Home") {
|
|
2344
|
+
e.preventDefault();
|
|
2345
|
+
if (!open()) setOpen(true);
|
|
2346
|
+
if (optionEntries().length) {
|
|
2347
|
+
setHighlightedIndex(0);
|
|
2348
|
+
queueMicrotask(() => scrollHighlightedIntoView(0));
|
|
2349
|
+
}
|
|
2350
|
+
} else if (e.key === "End") {
|
|
2351
|
+
e.preventDefault();
|
|
2352
|
+
if (!open()) setOpen(true);
|
|
2353
|
+
const entries = optionEntries();
|
|
2354
|
+
if (entries.length) {
|
|
2355
|
+
const last = entries.length - 1;
|
|
2356
|
+
setHighlightedIndex(last);
|
|
2357
|
+
queueMicrotask(() => scrollHighlightedIntoView(last));
|
|
2358
|
+
}
|
|
2359
|
+
} else if (e.key === "Enter") {
|
|
2360
|
+
const entries = optionEntries();
|
|
2361
|
+
const idx = highlightedIndex();
|
|
2362
|
+
if (open() && entries.length && idx >= 0 && idx < entries.length) {
|
|
2363
|
+
e.preventDefault();
|
|
2364
|
+
const dropdown = dropdownRef();
|
|
2365
|
+
const optionEls = dropdown?.querySelectorAll('[role="option"]');
|
|
2366
|
+
const optionEl = optionEls?.[idx];
|
|
2367
|
+
if (optionEl) {
|
|
2368
|
+
optionEl.click();
|
|
2369
|
+
} else {
|
|
2370
|
+
selectValue(entries[idx].raw);
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
} else if (e.key === "Escape") {
|
|
2206
2374
|
setOpen(false);
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
if (form?.formName && formContext?.formGroup?.markDirty) {
|
|
2212
|
-
const meta = formContext.formGroup.getMeta(form?.formName);
|
|
2213
|
-
if (meta && !meta.dirty) formContext.formGroup.markDirty(form?.formName);
|
|
2375
|
+
} else if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) {
|
|
2376
|
+
if (!open()) setOpen(true);
|
|
2377
|
+
e.preventDefault();
|
|
2378
|
+
handleTypeahead(e.key);
|
|
2214
2379
|
}
|
|
2215
2380
|
};
|
|
2216
2381
|
_el$7.addEventListener("focus", () => {
|
|
2382
|
+
if (isDisabled()) return;
|
|
2217
2383
|
form?.setFocused?.(true);
|
|
2218
|
-
if (form?.formName && formContext?.formGroup?.markDirty) {
|
|
2219
|
-
const meta = formContext.formGroup.getMeta(form?.formName);
|
|
2220
|
-
if (meta && !meta.dirty) formContext.formGroup.markDirty(form?.formName);
|
|
2221
|
-
}
|
|
2222
2384
|
});
|
|
2223
2385
|
_el$7._$owner = getOwner();
|
|
2224
2386
|
_el$8.$$click = e => {
|
|
2387
|
+
if (isDisabled()) return;
|
|
2388
|
+
e.currentTarget?.parentElement?.focus?.();
|
|
2225
2389
|
const menuRect = menuLocRef()?.getBoundingClientRect();
|
|
2226
2390
|
setMenuRect(menuRect);
|
|
2227
2391
|
setOpen(old => !old);
|
|
@@ -2281,21 +2445,23 @@ function Select(props) {
|
|
|
2281
2445
|
}), null);
|
|
2282
2446
|
createRenderEffect(_p$ => {
|
|
2283
2447
|
var _v$5 = props.id,
|
|
2284
|
-
_v$6 = `${styles$7.solid_select__control_no_form} ${styles$7[styleClassTransparent]} coles-solid-selectControl`,
|
|
2285
|
-
_v$7 = open(),
|
|
2286
|
-
_v$8 =
|
|
2287
|
-
_v$9 =
|
|
2288
|
-
_v$10 =
|
|
2448
|
+
_v$6 = `${styles$7.solid_select__control_no_form} ${styles$7[styleClassTransparent]} ${isDisabled() ? styles$7.solid_select__disabled : ''} coles-solid-selectControl`,
|
|
2449
|
+
_v$7 = isDisabled() ? false : open(),
|
|
2450
|
+
_v$8 = isDisabled(),
|
|
2451
|
+
_v$9 = props.tooltip,
|
|
2452
|
+
_v$10 = `${styles$7['solid_select__control']} ${props.class || ""} ${isDisabled() ? styles$7.solid_select__disabled : ''}`,
|
|
2453
|
+
_v$11 = !hasForm ? {
|
|
2289
2454
|
height: '48px'
|
|
2290
2455
|
} : {},
|
|
2291
|
-
_v$
|
|
2456
|
+
_v$12 = styles$7['solid_select__value'];
|
|
2292
2457
|
_v$5 !== _p$.e && (_el$7.id = _p$.e = _v$5);
|
|
2293
2458
|
_v$6 !== _p$.t && className(_el$7, _p$.t = _v$6);
|
|
2294
2459
|
_v$7 !== _p$.a && (_el$7.ariaExpanded = _p$.a = _v$7);
|
|
2295
|
-
_v$8 !== _p$.o && (_el$7.
|
|
2296
|
-
_v$9 !== _p$.i &&
|
|
2297
|
-
_p$.n
|
|
2298
|
-
|
|
2460
|
+
_v$8 !== _p$.o && (_el$7.ariaDisabled = _p$.o = _v$8);
|
|
2461
|
+
_v$9 !== _p$.i && (_el$7.title = _p$.i = _v$9);
|
|
2462
|
+
_v$10 !== _p$.n && className(_el$8, _p$.n = _v$10);
|
|
2463
|
+
_p$.s = style$9(_el$8, _v$11, _p$.s);
|
|
2464
|
+
_v$12 !== _p$.h && className(_el$9, _p$.h = _v$12);
|
|
2299
2465
|
return _p$;
|
|
2300
2466
|
}, {
|
|
2301
2467
|
e: undefined,
|
|
@@ -2304,20 +2470,23 @@ function Select(props) {
|
|
|
2304
2470
|
o: undefined,
|
|
2305
2471
|
i: undefined,
|
|
2306
2472
|
n: undefined,
|
|
2307
|
-
s: undefined
|
|
2473
|
+
s: undefined,
|
|
2474
|
+
h: undefined
|
|
2308
2475
|
});
|
|
2309
2476
|
return _el$7;
|
|
2310
2477
|
})();
|
|
2311
2478
|
}
|
|
2312
|
-
delegateEvents(["
|
|
2479
|
+
delegateEvents(["keydown", "click"]);
|
|
2313
2480
|
|
|
2314
2481
|
var _tmpl$$f = /*#__PURE__*/template(`<div role=option><span></span><span is=coles-select-label>`, true, false, false);
|
|
2315
2482
|
function Option(props) {
|
|
2316
2483
|
const formField = useFormProvider();
|
|
2317
2484
|
const formContext = useFormContext();
|
|
2318
2485
|
const select = useSelectContext();
|
|
2486
|
+
let labelRef;
|
|
2319
2487
|
onMount(() => {
|
|
2320
|
-
|
|
2488
|
+
const labelText = labelRef?.textContent?.trim() ?? (typeof props.children === "string" || typeof props.children === "number" ? String(props.children) : "");
|
|
2489
|
+
select.registerOption?.(props.value, props.children, labelText);
|
|
2321
2490
|
});
|
|
2322
2491
|
onCleanup(() => select.unregisterOption?.(props.value));
|
|
2323
2492
|
const selectFormFieldValue = value => {
|
|
@@ -2375,6 +2544,7 @@ function Option(props) {
|
|
|
2375
2544
|
return false;
|
|
2376
2545
|
};
|
|
2377
2546
|
const handleClick = e => {
|
|
2547
|
+
if (select?.isDisabled?.()) return;
|
|
2378
2548
|
e.stopPropagation();
|
|
2379
2549
|
const contextSuccess = selectFormContextValue(props.value);
|
|
2380
2550
|
!contextSuccess ? selectFormFieldValue(props.value) : true;
|
|
@@ -2389,34 +2559,42 @@ function Option(props) {
|
|
|
2389
2559
|
_el$3 = _el$2.nextSibling;
|
|
2390
2560
|
_el$.$$click = handleClick;
|
|
2391
2561
|
insert(_el$2, () => select?.isSelected?.(props.value) ?? false ? "✓" : "");
|
|
2562
|
+
var _ref$ = labelRef;
|
|
2563
|
+
typeof _ref$ === "function" ? use(_ref$, _el$3) : labelRef = _el$3;
|
|
2392
2564
|
_el$3._$owner = getOwner();
|
|
2393
2565
|
insert(_el$3, () => props.children ?? "");
|
|
2394
2566
|
createRenderEffect(_p$ => {
|
|
2395
2567
|
var _v$ = select?.isSelected?.(props.value) ?? false,
|
|
2396
|
-
_v$2 =
|
|
2397
|
-
_v$3 =
|
|
2398
|
-
_v$4 =
|
|
2399
|
-
|
|
2568
|
+
_v$2 = select?.isDisabled?.() ?? false,
|
|
2569
|
+
_v$3 = `${styles$7['solid_select__option']} ${props.class || ""} ${select?.isDisabled?.() ? styles$7.solid_select__option_disabled : ""}`,
|
|
2570
|
+
_v$4 = {
|
|
2571
|
+
"selected": select?.isSelected?.(props.value) ?? false,
|
|
2572
|
+
[styles$7.solid_select__option_highlight]: select?.isHighlighted?.(props.value) ?? false
|
|
2573
|
+
},
|
|
2574
|
+
_v$5 = `${styles$7['checkmark']}`,
|
|
2575
|
+
_v$6 = `${styles$7['option-label']}`;
|
|
2400
2576
|
_v$ !== _p$.e && setAttribute(_el$, "aria-selected", _p$.e = _v$);
|
|
2401
|
-
_v$2 !== _p$.t &&
|
|
2402
|
-
_v$3 !== _p$.a && _el
|
|
2403
|
-
|
|
2404
|
-
_v$5 !== _p$.i && className(_el$
|
|
2577
|
+
_v$2 !== _p$.t && setAttribute(_el$, "aria-disabled", _p$.t = _v$2);
|
|
2578
|
+
_v$3 !== _p$.a && className(_el$, _p$.a = _v$3);
|
|
2579
|
+
_p$.o = classList(_el$, _v$4, _p$.o);
|
|
2580
|
+
_v$5 !== _p$.i && className(_el$2, _p$.i = _v$5);
|
|
2581
|
+
_v$6 !== _p$.n && className(_el$3, _p$.n = _v$6);
|
|
2405
2582
|
return _p$;
|
|
2406
2583
|
}, {
|
|
2407
2584
|
e: undefined,
|
|
2408
2585
|
t: undefined,
|
|
2409
2586
|
a: undefined,
|
|
2410
2587
|
o: undefined,
|
|
2411
|
-
i: undefined
|
|
2588
|
+
i: undefined,
|
|
2589
|
+
n: undefined
|
|
2412
2590
|
});
|
|
2413
2591
|
return _el$;
|
|
2414
2592
|
})();
|
|
2415
2593
|
}
|
|
2416
2594
|
delegateEvents(["click"]);
|
|
2417
2595
|
|
|
2418
|
-
var css_248z$b = ".TextArea-module_areaStyle__AshKi {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n padding: 0.5rem;\n margin-right: calc(var(--spacing-1, 8px) / 2);\n border: 1px solid #ccc;\n border-radius: var(--border-radius-md, 6px);\n width: 98%;\n height: 100%;\n resize: none;\n}\n@media screen and (max-width: 768px) {\n .TextArea-module_areaStyle__AshKi {\n width: 90%;\n }\n}\n.TextArea-module_areaStyle__AshKi::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.TextArea-module_areaStyle__AshKi::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n\n.TextArea-module_picButton__TV9ZE {\n padding: calc(var(--spacing-1, 8px) / 2) var(--spacing-1, 8px) !important;\n background-color: transparent;\n border-top: 1px solid white;\n border-bottom: 1px solid white;\n}\n\n.TextArea-module_transparent__pwXRO {\n background-color: transparent;\n border: none;\n color: white;\n padding: 0.5rem;\n width: inherit;\n height: 100%;\n resize: none;\n}\n.TextArea-module_transparent__pwXRO:focus {\n outline: none;\n border: none;\n}";
|
|
2419
|
-
var style$4 = {"areaStyle":"TextArea-module_areaStyle__AshKi"};
|
|
2596
|
+
var css_248z$b = ".TextArea-module_areaStyle__AshKi {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n padding: 0.5rem;\n margin-right: calc(var(--spacing-1, 8px) / 2);\n border: 1px solid #ccc;\n border-radius: var(--border-radius-md, 6px);\n width: 98%;\n height: 100%;\n resize: none;\n}\n@media screen and (max-width: 768px) {\n .TextArea-module_areaStyle__AshKi {\n width: 90%;\n }\n}\n.TextArea-module_areaStyle__AshKi::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.TextArea-module_areaStyle__AshKi::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n\n.TextArea-module_disabled__lHxCa {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.TextArea-module_picButton__TV9ZE {\n padding: calc(var(--spacing-1, 8px) / 2) var(--spacing-1, 8px) !important;\n background-color: transparent;\n border-top: 1px solid white;\n border-bottom: 1px solid white;\n}\n\n.TextArea-module_transparent__pwXRO {\n background-color: transparent;\n border: none;\n color: white;\n padding: 0.5rem;\n width: inherit;\n height: 100%;\n resize: none;\n}\n.TextArea-module_transparent__pwXRO:focus {\n outline: none;\n border: none;\n}";
|
|
2597
|
+
var style$4 = {"areaStyle":"TextArea-module_areaStyle__AshKi","disabled":"TextArea-module_disabled__lHxCa"};
|
|
2420
2598
|
styleInject(css_248z$b);
|
|
2421
2599
|
|
|
2422
2600
|
var _tmpl$$e = /*#__PURE__*/template(`<textarea>`);
|
|
@@ -2480,6 +2658,7 @@ const TextArea = props => {
|
|
|
2480
2658
|
queueMicrotask(resizeToContent);
|
|
2481
2659
|
});
|
|
2482
2660
|
const handleInput = e => {
|
|
2661
|
+
if (props.disabled) return;
|
|
2483
2662
|
const newVal = e.currentTarget.value;
|
|
2484
2663
|
// Update whichever source is active
|
|
2485
2664
|
if (formName && formCtx?.formGroup) {
|
|
@@ -2507,7 +2686,7 @@ const TextArea = props => {
|
|
|
2507
2686
|
return areaValue();
|
|
2508
2687
|
},
|
|
2509
2688
|
get ["class"]() {
|
|
2510
|
-
return `${style$4.areaStyle} ${customProps.class ?? ''} ${customProps.transparent ? customProps.transparent : ''}`;
|
|
2689
|
+
return `${style$4.areaStyle} ${props.disabled ? style$4.disabled : ''} ${customProps.class ?? ''} ${customProps.transparent ? customProps.transparent : ''}`;
|
|
2511
2690
|
},
|
|
2512
2691
|
get placeholder() {
|
|
2513
2692
|
return fieldCtx?.getTextInside?.() && !fieldCtx?.getFocused?.() ? '' : props.placeholder;
|
|
@@ -2517,6 +2696,7 @@ const TextArea = props => {
|
|
|
2517
2696
|
},
|
|
2518
2697
|
"onInput": handleInput,
|
|
2519
2698
|
"onFocus": () => {
|
|
2699
|
+
if (props.disabled) return;
|
|
2520
2700
|
fieldCtx?.setFocused?.(true);
|
|
2521
2701
|
if (formName && formCtx?.formGroup?.markDirty) {
|
|
2522
2702
|
const meta = formCtx.formGroup.getMeta(formName);
|
|
@@ -2524,12 +2704,16 @@ const TextArea = props => {
|
|
|
2524
2704
|
}
|
|
2525
2705
|
},
|
|
2526
2706
|
"onClick": () => {
|
|
2707
|
+
if (props.disabled) return;
|
|
2527
2708
|
if (formName && formCtx?.formGroup?.markDirty) {
|
|
2528
2709
|
const meta = formCtx.formGroup.getMeta(formName);
|
|
2529
2710
|
if (meta && !meta.dirty) formCtx.formGroup.markDirty(formName);
|
|
2530
2711
|
}
|
|
2531
2712
|
},
|
|
2532
|
-
"onBlur": () =>
|
|
2713
|
+
"onBlur": () => {
|
|
2714
|
+
if (props.disabled) return;
|
|
2715
|
+
fieldCtx?.setFocused?.(false);
|
|
2716
|
+
}
|
|
2533
2717
|
}), false, false);
|
|
2534
2718
|
return _el$;
|
|
2535
2719
|
})();
|
|
@@ -2712,7 +2896,7 @@ const ExpansionPanel = props => {
|
|
|
2712
2896
|
width: 'min-content',
|
|
2713
2897
|
height: 'min-content',
|
|
2714
2898
|
padding: '0px',
|
|
2715
|
-
margin: '0px'
|
|
2899
|
+
margin: 'auto 0px'
|
|
2716
2900
|
},
|
|
2717
2901
|
onClick: () => {
|
|
2718
2902
|
setOpen(old => !old);
|
|
@@ -3690,7 +3874,7 @@ class FormArray {
|
|
|
3690
3874
|
}
|
|
3691
3875
|
}
|
|
3692
3876
|
|
|
3693
|
-
var css_248z$2 = ".formfield-module_formField__w6mH9:focus-within > legend, .formfield-module_has-focus__9ingx > legend {\n top: -8px !important;\n font-size: 0.75rem !important;\n}\n\n.formfield-module_formField__w6mH9 {\n position: relative;\n display: inline-block;\n border-radius: var(--border-radius-md);\n box-sizing: border-box;\n border: none;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n margin-top: 0px !important;\n margin-bottom: 0px !important;\n}\n.formfield-module_formField__w6mH9 > legend {\n position: absolute;\n left: 12px;\n top: calc(50% - 0.5em);\n font-size: 1rem;\n transition: top 0.25s ease, font-size 0.25s ease;\n pointer-events: none;\n}\n.formfield-module_formField__w6mH9 input::-moz-placeholder, .formfield-module_formField__w6mH9 select::-moz-placeholder {\n opacity: 0 !important;\n -moz-transition: opacity 0.25s ease;\n transition: opacity 0.25s ease;\n}\n.formfield-module_formField__w6mH9 input::placeholder,\n.formfield-module_formField__w6mH9 select::placeholder {\n opacity: 0 !important;\n transition: opacity 0.25s ease;\n}\n.formfield-module_formField__w6mH9 label {\n position: relative;\n top: -0.5rem;\n padding-right: 10px;\n}\n.formfield-module_formField__w6mH9:has(textarea) {\n position: relative;\n margin: 8px;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n width: auto;\n min-width: 95%;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n padding-bottom: 8px;\n border: none;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea:focus {\n outline: none;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_formField__w6mH9:has(textarea) legend {\n height: 24px;\n position: absolute;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) {\n position: relative;\n height: 48px !important;\n padding: 0px !important;\n width: 100%;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) legend {\n height: 16px;\n max-height: 16px;\n transition: all 0.25s ease;\n top: calc(50% - 1em);\n z-index:
|
|
3877
|
+
var css_248z$2 = ".formfield-module_formField__w6mH9:focus-within > legend, .formfield-module_has-focus__9ingx > legend {\n top: -8px !important;\n font-size: 0.75rem !important;\n}\n\n.formfield-module_formField__w6mH9 {\n position: relative;\n display: inline-block;\n border-radius: var(--border-radius-md);\n box-sizing: border-box;\n border: none;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n margin-top: 0px !important;\n margin-bottom: 0px !important;\n}\n.formfield-module_formField__w6mH9 > legend {\n position: absolute;\n left: 12px;\n top: calc(50% - 0.5em);\n font-size: 1rem;\n transition: top 0.25s ease, font-size 0.25s ease;\n pointer-events: none;\n}\n.formfield-module_formField__w6mH9 input::-moz-placeholder, .formfield-module_formField__w6mH9 select::-moz-placeholder {\n opacity: 0 !important;\n -moz-transition: opacity 0.25s ease;\n transition: opacity 0.25s ease;\n}\n.formfield-module_formField__w6mH9 input::placeholder,\n.formfield-module_formField__w6mH9 select::placeholder {\n opacity: 0 !important;\n transition: opacity 0.25s ease;\n}\n.formfield-module_formField__w6mH9 label {\n position: relative;\n top: -0.5rem;\n padding-right: 10px;\n}\n.formfield-module_formField__w6mH9:has(textarea) {\n position: relative;\n margin: 8px;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n width: auto;\n min-width: 95%;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n padding-bottom: 8px;\n border: none;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea:focus {\n outline: none;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_formField__w6mH9:has(textarea) legend {\n height: 24px;\n position: absolute;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) {\n position: relative;\n height: 48px !important;\n padding: 0px !important;\n width: 100%;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) legend {\n height: 16px;\n max-height: 16px;\n transition: all 0.25s ease;\n top: calc(50% - 1em);\n z-index: 1;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) [is=coles-solid-select] {\n position: absolute;\n left: 0px;\n right: 0px;\n padding: 0px !important;\n margin: 0px !important;\n height: 48px !important;\n border-radius: 4px;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n width: auto;\n min-width: 95%;\n z-index: 0;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) [is=coles-solid-select]:nth-child(n) {\n border-radius: 4px;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) {\n height: 48px;\n position: relative;\n width: 100%;\n margin-top: 16px;\n margin-bottom: 16px;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) legend {\n position: absolute;\n height: 24px;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) input[type=text] {\n background-color: transparent !important;\n height: 24px;\n border-radius: 4px;\n margin: 8px 0px;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n width: 100%;\n min-width: 95%;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) input[type=text]::-moz-placeholder {\n opacity: 0;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) input[type=text]::placeholder {\n opacity: 0;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) {\n height: 48px;\n position: relative;\n width: 100%;\n margin-top: 16px;\n margin-bottom: 16px;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) legend {\n height: 24px;\n position: absolute;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) input[type=number] {\n background-color: transparent !important;\n color: var(--on-primary-color, #fff);\n height: 24px;\n border-radius: 4px;\n margin: 8px 0px;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n width: 100%;\n min-width: 95%;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) input[type=number]::-moz-placeholder {\n opacity: 0;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) input[type=number]::placeholder {\n opacity: 0;\n}\n@media screen and (max-width: 768px) {\n .formfield-module_formField__w6mH9 {\n max-width: 75%;\n }\n}\n\n.formfield-module_topMargin__dahW5 {\n margin-top: 12px;\n}\n\n.formfield-module_primary__7BYyQ:has(input[type=text]) input[type=text] {\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(input[type=text]) input[type=text]::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(input[type=text]) input[type=text]::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(input[type=number]) input[type=number] {\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(input[type=number]) input[type=number]::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(input[type=number]) input[type=number]::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has([is=coles-solid-select]) [is=coles-solid-select] {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(textarea) {\n width: 100%;\n height: auto;\n}\n.formfield-module_primary__7BYyQ:has(textarea) textarea {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(textarea) textarea::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(textarea) textarea::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n\n.formfield-module_legendStyle__gnI49 {\n background-color: transparent;\n opacity: var(--text-emphasis-medium, 87%);\n width: 100%;\n transition: all 0.3s ease;\n}\n\n.formfield-module_checkboxPadding__DU1CG {\n padding: 0px;\n padding-bottom: 10px;\n padding-left: 10px;\n padding-right: 10px;\n}\n\n.formfield-module_errorContainer__HR4PL {\n position: relative;\n min-height: 2rem;\n}\n\n.formfield-module_error__wNBh2 {\n position: absolute;\n background: transparent;\n color: var(--error-color, #B00020);\n font-size: 10px;\n}";
|
|
3694
3878
|
var style = {"formField":"formfield-module_formField__w6mH9","has-focus":"formfield-module_has-focus__9ingx","primary":"formfield-module_primary__7BYyQ","legendStyle":"formfield-module_legendStyle__gnI49","errorContainer":"formfield-module_errorContainer__HR4PL","error":"formfield-module_error__wNBh2"};
|
|
3695
3879
|
styleInject(css_248z$2);
|
|
3696
3880
|
|
|
@@ -3732,12 +3916,15 @@ const FormField2 = props => {
|
|
|
3732
3916
|
};
|
|
3733
3917
|
const shouldFloat = createMemo(() => {
|
|
3734
3918
|
let currentVal;
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3919
|
+
const hasFormContext = !!local?.formName && !!formContext?.formGroup;
|
|
3920
|
+
// Prefer form context store value when available
|
|
3921
|
+
if (hasFormContext) {
|
|
3922
|
+
const formVal = formContext?.data?.[local?.formName ?? ''];
|
|
3923
|
+
if (hasValue(formVal)) {
|
|
3924
|
+
currentVal = formVal;
|
|
3925
|
+
}
|
|
3926
|
+
} else if (hasValue(context?.getValue?.())) {
|
|
3927
|
+
// Fallback to local provider value only when no form context
|
|
3741
3928
|
currentVal = context?.getValue?.();
|
|
3742
3929
|
}
|
|
3743
3930
|
// Float when value present, focused, or control marked dirty (programmatic set)
|
|
@@ -3745,8 +3932,8 @@ const FormField2 = props => {
|
|
|
3745
3932
|
const metaDirty = local?.formName ? !!formContext?.formGroup?.getMeta?.(local.formName)?.dirty : false;
|
|
3746
3933
|
// Float when there is a value, or focused, or meta marked dirty (programmatic set),
|
|
3747
3934
|
// or legacy input marked dirty-on-focus even if still empty (metaDirty && no value yet)
|
|
3748
|
-
|
|
3749
|
-
return
|
|
3935
|
+
const hasAnyValue = hasValue(currentVal);
|
|
3936
|
+
return hasAnyValue || context?.getFocused?.() || metaDirty && hasAnyValue || isDirty() && hasAnyValue;
|
|
3750
3937
|
});
|
|
3751
3938
|
// Effect: if underlying meta resets to pristine and value cleared, ensure focused state cleared
|
|
3752
3939
|
createEffect(() => {
|
|
@@ -3798,12 +3985,12 @@ const FormField2 = props => {
|
|
|
3798
3985
|
const val = context?.getValue?.();
|
|
3799
3986
|
context?.setTextInside(!hasValue(val));
|
|
3800
3987
|
}
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3988
|
+
const metaDirty = local?.formName ? !!formContext?.formGroup?.getMeta?.(local.formName)?.dirty : false;
|
|
3989
|
+
const shouldValidate = !!context?.getFocused?.() || metaDirty;
|
|
3990
|
+
if (shouldValidate) {
|
|
3991
|
+
formContext?.formGroup?.validate?.(local?.formName ?? '');
|
|
3992
|
+
}
|
|
3993
|
+
context?.setFocused(false);
|
|
3807
3994
|
});
|
|
3808
3995
|
onMount(() => {
|
|
3809
3996
|
if (context?.getValue !== undefined) {
|