ui-core-abv 0.11.3 → 0.11.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/fesm2022/ui-core-abv.mjs +1155 -177
- package/fesm2022/ui-core-abv.mjs.map +1 -1
- package/lib/components/dynamic-form/form/dynamic-form.component.d.ts +14 -0
- package/lib/components/dynamic-form/form-engine.service.d.ts +6 -0
- package/lib/components/dynamic-form/form-validators.d.ts +12 -0
- package/lib/components/dynamic-form/form.models.d.ts +32 -2
- package/lib/components/dynamic-form/other-option.d.ts +34 -0
- package/lib/components/inputs/ui-chips-input/ui-chips-input.component.d.ts +55 -0
- package/lib/components/inputs/ui-distribution/ui-distribution.component.d.ts +62 -0
- package/lib/components/survey/survey.component.d.ts +59 -7
- package/lib/components/survey/survey.config.d.ts +52 -0
- package/lib/components/survey/survey.models.d.ts +6 -1
- package/lib/components/uic-action-button/uic-action-button.component.d.ts +9 -2
- package/lib/components/user-formbuilder/block-editor/field-editor/field-editor.component.d.ts +13 -2
- package/lib/components/user-formbuilder/form-preview/form-preview.component.d.ts +3 -0
- package/lib/components/user-formbuilder/formbuilder.config.d.ts +4 -1
- package/lib/components/user-formbuilder/user-formbuilder.component.d.ts +6 -0
- package/lib/components/user-formbuilder/visibility-rule-pruning.d.ts +34 -0
- package/lib/translate/dictionary.en.d.ts +32 -0
- package/lib/translate/dictionary.es.d.ts +32 -0
- package/package.json +1 -1
- package/public-api.d.ts +4 -0
- package/src/lib/styles/_dark.scss +113 -113
- package/src/lib/styles/_default_colors.scss +228 -228
- package/src/lib/styles/_variables.scss +140 -140
|
@@ -19,7 +19,7 @@ import type { FormBuilderPreviewMode, FormBuilderSurveyPreviewOptions } from './
|
|
|
19
19
|
* "visibilityRules": false,
|
|
20
20
|
* "styleSection": false,
|
|
21
21
|
* "limits": { "maxBlocks": 3, "maxFields": 20, "maxRepeaterFields": 5 },
|
|
22
|
-
* "preview": { "mode": "survey", "survey": { "pageMode": "field" } }
|
|
22
|
+
* "preview": { "showButton": true, "mode": "survey", "survey": { "pageMode": "field" } }
|
|
23
23
|
* }
|
|
24
24
|
*/
|
|
25
25
|
export interface UicFormBuilderConfig {
|
|
@@ -74,6 +74,8 @@ export interface UicFormBuilderConfig {
|
|
|
74
74
|
* (útiles si el modo debe cambiar en tiempo de ejecución, porque la config se lee una sola vez).
|
|
75
75
|
*/
|
|
76
76
|
preview?: {
|
|
77
|
+
/** Muestra el botón "Vista previa" en la cabecera. Por defecto: true. */
|
|
78
|
+
showButton?: boolean;
|
|
77
79
|
mode?: FormBuilderPreviewMode;
|
|
78
80
|
survey?: FormBuilderSurveyPreviewOptions;
|
|
79
81
|
};
|
|
@@ -99,6 +101,7 @@ export interface ResolvedFormBuilderConfig {
|
|
|
99
101
|
limits: FormBuilderLimits;
|
|
100
102
|
/** null = no definido en la config (se usan las entradas `previewMode` / `surveyPreviewOptions`). */
|
|
101
103
|
preview: {
|
|
104
|
+
showButton: boolean;
|
|
102
105
|
mode: FormBuilderPreviewMode | null;
|
|
103
106
|
survey: FormBuilderSurveyPreviewOptions | null;
|
|
104
107
|
};
|
|
@@ -60,6 +60,7 @@ export declare class UicUserFormbuilderComponent implements OnInit {
|
|
|
60
60
|
private readonly modalService;
|
|
61
61
|
private readonly host;
|
|
62
62
|
private readonly tinyAlertService;
|
|
63
|
+
private readonly pushAlertService;
|
|
63
64
|
private readonly translateService;
|
|
64
65
|
disabled: boolean;
|
|
65
66
|
/**
|
|
@@ -84,6 +85,8 @@ export declare class UicUserFormbuilderComponent implements OnInit {
|
|
|
84
85
|
previewMode: import("@angular/core").InputSignal<FormBuilderPreviewMode>;
|
|
85
86
|
/** Ajustes de la vista previa en modo encuesta. `config.preview.survey` tiene prioridad (ver previewMode). */
|
|
86
87
|
surveyPreviewOptions: import("@angular/core").InputSignal<FormBuilderSurveyPreviewOptions | null>;
|
|
88
|
+
/** Vista previa como encuesta de una pregunta por página: habilita "samePage" en los campos. */
|
|
89
|
+
readonly surveyFieldMode: import("@angular/core").Signal<boolean>;
|
|
87
90
|
editableFormInput: import("@angular/core").InputSignal<EditableForm>;
|
|
88
91
|
submitFormRequest: import("@angular/core").OutputEmitterRef<EditableForm>;
|
|
89
92
|
nextBlockId: number;
|
|
@@ -173,6 +176,9 @@ export declare class UicUserFormbuilderComponent implements OnInit {
|
|
|
173
176
|
*/
|
|
174
177
|
private fingerprint;
|
|
175
178
|
onSubFieldChange(updatedFieldData: FormField): void;
|
|
179
|
+
/** Tras limpiar reglas, la selección apunta a los objetos actualizados (mismo code). */
|
|
180
|
+
private syncSelectionAfterPruning;
|
|
181
|
+
private warnPrunedRules;
|
|
176
182
|
startPropertiesResize(event: MouseEvent): void;
|
|
177
183
|
onPropertiesResize(event: MouseEvent): void;
|
|
178
184
|
stopPropertiesResize(): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FormField } from '../dynamic-form/form.models';
|
|
2
|
+
import { AppSelectOption } from '../inputs/select/select.component';
|
|
3
|
+
import type { EditableBlock } from './user-formbuilder.component';
|
|
4
|
+
/**
|
|
5
|
+
* Opciones manuales de un campo del que se puede depender: el editor de reglas las usa para
|
|
6
|
+
* mostrar un selector de valor (y su texto) en vez de pedir el id a mano. Con origen externo no hay lista fija.
|
|
7
|
+
*/
|
|
8
|
+
export declare const dependencyValueOptions: (fieldData: FormField) => AppSelectOption[] | undefined;
|
|
9
|
+
/** Ids de opciones que tenía `before` y ya no tiene `after`. Vacío si `after` no tiene opciones manuales. */
|
|
10
|
+
export declare function removedOptionIds(before: FormField, after: FormField): Set<string>;
|
|
11
|
+
/** Qué campo cambió: uno raíz (por code) o un subcampo de un repetidor (code del padre + code del subcampo). */
|
|
12
|
+
export type PrunedFieldRef = {
|
|
13
|
+
kind: 'field';
|
|
14
|
+
code: string;
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'subfield';
|
|
17
|
+
parentCode: string;
|
|
18
|
+
code: string;
|
|
19
|
+
};
|
|
20
|
+
export interface RulePruningResult {
|
|
21
|
+
blocks: EditableBlock[];
|
|
22
|
+
/** Reglas modificadas o eliminadas. */
|
|
23
|
+
changed: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Quita de las reglas de visibilidad las referencias a opciones eliminadas de un campo.
|
|
27
|
+
* - in / notIn: se quitan los ids eliminados del arreglo; si queda vacío, se elimina la regla.
|
|
28
|
+
* - equals / notEquals (e includes / notIncludes si el campo es multyselect): se elimina la regla
|
|
29
|
+
* si su valor era una opción eliminada.
|
|
30
|
+
* Alcance: un campo raíz puede ser referenciado por campos raíz y subcampos; un subcampo, solo por
|
|
31
|
+
* sus hermanos del mismo repetidor (los codes de subcampo se repiten entre repetidores).
|
|
32
|
+
* Devuelve los mismos objetos para lo que no cambió.
|
|
33
|
+
*/
|
|
34
|
+
export declare function pruneRulesForRemovedOptions(blocks: EditableBlock[], ref: PrunedFieldRef, removedIds: Set<string>, changedFieldType: string | undefined): RulePruningResult;
|
|
@@ -235,6 +235,13 @@ export declare const DICTIONARY_EN: {
|
|
|
235
235
|
readonly visibility_summary: "Visible if {{field}} {{operator}} {{value}}";
|
|
236
236
|
readonly yes: "Yes";
|
|
237
237
|
readonly no: "No";
|
|
238
|
+
readonly other_option: {
|
|
239
|
+
readonly enable: "Include an \"Other\" (please specify) option";
|
|
240
|
+
readonly enable_tip: "Adds an Other option with a text to specify. The text is saved as <identifier>__other.";
|
|
241
|
+
readonly label: "Option text";
|
|
242
|
+
readonly placeholder: "Field placeholder";
|
|
243
|
+
readonly required: "Specifying is required when Other is chosen";
|
|
244
|
+
};
|
|
238
245
|
readonly limits: {
|
|
239
246
|
readonly fields_reached: "The form already has the maximum of {{max}} fields";
|
|
240
247
|
readonly blocks_reached: "The maximum of {{max}} blocks has been reached";
|
|
@@ -272,6 +279,8 @@ export declare const DICTIONARY_EN: {
|
|
|
272
279
|
readonly new_line: "New line";
|
|
273
280
|
readonly col_span: "Column span";
|
|
274
281
|
readonly col_span_tip: "How many columns the field occupies";
|
|
282
|
+
readonly same_page: "Same page as the previous one";
|
|
283
|
+
readonly same_page_tip: "Only in one-question-per-page surveys";
|
|
275
284
|
};
|
|
276
285
|
readonly extra: {
|
|
277
286
|
readonly iconColor: "Icon color";
|
|
@@ -433,6 +442,7 @@ export declare const DICTIONARY_EN: {
|
|
|
433
442
|
readonly operator: "Operator";
|
|
434
443
|
readonly value: "Value";
|
|
435
444
|
readonly expected_value: "Expected value";
|
|
445
|
+
readonly values: "Values";
|
|
436
446
|
readonly style: "Style";
|
|
437
447
|
readonly advanced: "Advanced";
|
|
438
448
|
readonly duplicate: "Duplicate";
|
|
@@ -442,6 +452,7 @@ export declare const DICTIONARY_EN: {
|
|
|
442
452
|
readonly subfields: "Sub-fields";
|
|
443
453
|
readonly external_validation_title: "External validation";
|
|
444
454
|
};
|
|
455
|
+
readonly rules_pruned: "{{count}} dependency rules were updated because they used removed options.";
|
|
445
456
|
readonly visibility_operators: {
|
|
446
457
|
readonly equals: "Equals";
|
|
447
458
|
readonly notEquals: "Does not equal";
|
|
@@ -451,6 +462,8 @@ export declare const DICTIONARY_EN: {
|
|
|
451
462
|
readonly notIncludes: "Does not include";
|
|
452
463
|
readonly isEmpty: "Is empty";
|
|
453
464
|
readonly isNotEmpty: "Is not empty";
|
|
465
|
+
readonly in: "Is any of";
|
|
466
|
+
readonly notIn: "Is none of";
|
|
454
467
|
};
|
|
455
468
|
readonly validation: {
|
|
456
469
|
readonly duplicate_identifier: "The identifier \"{{identifier}}\" is used more than once.";
|
|
@@ -476,6 +489,24 @@ export declare const DICTIONARY_EN: {
|
|
|
476
489
|
readonly subtitle_margin: "Subtitle margin";
|
|
477
490
|
};
|
|
478
491
|
};
|
|
492
|
+
readonly other_option: {
|
|
493
|
+
readonly label: "Other";
|
|
494
|
+
readonly placeholder: "Please specify...";
|
|
495
|
+
};
|
|
496
|
+
readonly chips_input: {
|
|
497
|
+
readonly placeholder: "Type and press Enter";
|
|
498
|
+
readonly remove: "Remove {{item}}";
|
|
499
|
+
readonly max_reached: "Maximum {{max}}";
|
|
500
|
+
};
|
|
501
|
+
readonly distribution: {
|
|
502
|
+
readonly total: "Total";
|
|
503
|
+
readonly complete: "Complete";
|
|
504
|
+
readonly missing: "{{amount}}% left";
|
|
505
|
+
readonly over: "{{amount}}% over";
|
|
506
|
+
readonly clear: "Clear";
|
|
507
|
+
readonly fill_remaining: "Assign the remaining {{remaining}}% to {{option}}";
|
|
508
|
+
readonly no_options: "This question has no options yet.";
|
|
509
|
+
};
|
|
479
510
|
readonly validation: {
|
|
480
511
|
readonly invalid: "{{field}} is invalid.";
|
|
481
512
|
readonly required: "{{field}} is required.";
|
|
@@ -487,6 +518,7 @@ export declare const DICTIONARY_EN: {
|
|
|
487
518
|
readonly external_invalid: "{{field}} is not valid.";
|
|
488
519
|
readonly min_selections: "{{field}}: choose at least {{min}} options.";
|
|
489
520
|
readonly max_selections: "{{field}}: choose at most {{max}} options.";
|
|
521
|
+
readonly distribution_total: "{{field}} must add up to {{expected}}% (currently {{total}}%).";
|
|
490
522
|
};
|
|
491
523
|
readonly clipboard: {
|
|
492
524
|
readonly copy_error: "Could not copy:";
|
|
@@ -235,6 +235,13 @@ export declare const DICTIONARY_ES: {
|
|
|
235
235
|
readonly visibility_summary: "Visible si {{field}} {{operator}} {{value}}";
|
|
236
236
|
readonly yes: "Sí";
|
|
237
237
|
readonly no: "No";
|
|
238
|
+
readonly other_option: {
|
|
239
|
+
readonly enable: "Incluir opción «Otros» (especifica)";
|
|
240
|
+
readonly enable_tip: "Agrega la opción Otros con un texto para especificar. El texto se guarda en <identificador>__other.";
|
|
241
|
+
readonly label: "Texto de la opción";
|
|
242
|
+
readonly placeholder: "Texto de ayuda del campo";
|
|
243
|
+
readonly required: "Especificar es obligatorio al elegir Otros";
|
|
244
|
+
};
|
|
238
245
|
readonly limits: {
|
|
239
246
|
readonly fields_reached: "Se alcanzó el máximo de {{max}} campos del formulario";
|
|
240
247
|
readonly blocks_reached: "Se alcanzó el máximo de {{max}} bloques";
|
|
@@ -272,6 +279,8 @@ export declare const DICTIONARY_ES: {
|
|
|
272
279
|
readonly new_line: "Saltar línea";
|
|
273
280
|
readonly col_span: "Ancho";
|
|
274
281
|
readonly col_span_tip: "Cuantas columnas ocupa el campo";
|
|
282
|
+
readonly same_page: "Misma página que la anterior";
|
|
283
|
+
readonly same_page_tip: "Solo en encuestas de una pregunta por página";
|
|
275
284
|
};
|
|
276
285
|
readonly extra: {
|
|
277
286
|
readonly iconColor: "Color de ícono externo";
|
|
@@ -433,6 +442,7 @@ export declare const DICTIONARY_ES: {
|
|
|
433
442
|
readonly operator: "Operador";
|
|
434
443
|
readonly value: "Valor";
|
|
435
444
|
readonly expected_value: "Valor esperado";
|
|
445
|
+
readonly values: "Valores";
|
|
436
446
|
readonly style: "Estilo";
|
|
437
447
|
readonly advanced: "Avanzado";
|
|
438
448
|
readonly duplicate: "Duplicar";
|
|
@@ -442,6 +452,7 @@ export declare const DICTIONARY_ES: {
|
|
|
442
452
|
readonly subfields: "Sub-campos";
|
|
443
453
|
readonly external_validation_title: "Validación externa";
|
|
444
454
|
};
|
|
455
|
+
readonly rules_pruned: "Se actualizaron {{count}} reglas de dependencia porque usaban opciones eliminadas.";
|
|
445
456
|
readonly visibility_operators: {
|
|
446
457
|
readonly equals: "Es igual a";
|
|
447
458
|
readonly notEquals: "No es igual a";
|
|
@@ -451,6 +462,8 @@ export declare const DICTIONARY_ES: {
|
|
|
451
462
|
readonly notIncludes: "No incluye";
|
|
452
463
|
readonly isEmpty: "Está vacío";
|
|
453
464
|
readonly isNotEmpty: "No está vacío";
|
|
465
|
+
readonly in: "Es alguno de";
|
|
466
|
+
readonly notIn: "No es ninguno de";
|
|
454
467
|
};
|
|
455
468
|
readonly validation: {
|
|
456
469
|
readonly duplicate_identifier: "El identificador \"{{identifier}}\" se está usando más de una vez.";
|
|
@@ -476,6 +489,24 @@ export declare const DICTIONARY_ES: {
|
|
|
476
489
|
readonly subtitle_margin: "Margen subtítulo";
|
|
477
490
|
};
|
|
478
491
|
};
|
|
492
|
+
readonly other_option: {
|
|
493
|
+
readonly label: "Otros";
|
|
494
|
+
readonly placeholder: "Especifica...";
|
|
495
|
+
};
|
|
496
|
+
readonly chips_input: {
|
|
497
|
+
readonly placeholder: "Escribe y presiona Enter";
|
|
498
|
+
readonly remove: "Quitar {{item}}";
|
|
499
|
+
readonly max_reached: "Máximo {{max}}";
|
|
500
|
+
};
|
|
501
|
+
readonly distribution: {
|
|
502
|
+
readonly total: "Total";
|
|
503
|
+
readonly complete: "Completo";
|
|
504
|
+
readonly missing: "Faltan {{amount}}%";
|
|
505
|
+
readonly over: "Sobran {{amount}}%";
|
|
506
|
+
readonly clear: "Limpiar";
|
|
507
|
+
readonly fill_remaining: "Asignar el {{remaining}}% restante a {{option}}";
|
|
508
|
+
readonly no_options: "Esta pregunta aún no tiene opciones.";
|
|
509
|
+
};
|
|
479
510
|
readonly validation: {
|
|
480
511
|
readonly invalid: "{{field}} es invalido.";
|
|
481
512
|
readonly required: "{{field}} es obligatorio.";
|
|
@@ -487,6 +518,7 @@ export declare const DICTIONARY_ES: {
|
|
|
487
518
|
readonly external_invalid: "{{field}} no es válido.";
|
|
488
519
|
readonly min_selections: "{{field}}: elige al menos {{min}} opciones.";
|
|
489
520
|
readonly max_selections: "{{field}}: elige como máximo {{max}} opciones.";
|
|
521
|
+
readonly distribution_total: "{{field}} debe sumar {{expected}}% (ahora suma {{total}}%).";
|
|
490
522
|
};
|
|
491
523
|
readonly clipboard: {
|
|
492
524
|
readonly copy_error: "No se pudo copiar:";
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export * from './lib/components/skeleton-cards/skeleton-cards.component';
|
|
|
24
24
|
export * from './lib/components/push-alerts/alert-container/alert-container.component';
|
|
25
25
|
export * from './lib/components/inputs/ui-slider/ui-slider.component';
|
|
26
26
|
export * from './lib/components/inputs/ui-scale/ui-scale.component';
|
|
27
|
+
export * from './lib/components/inputs/ui-distribution/ui-distribution.component';
|
|
28
|
+
export * from './lib/components/inputs/ui-chips-input/ui-chips-input.component';
|
|
27
29
|
export * from './lib/components/uic-action-button/uic-action-button.component';
|
|
28
30
|
export * from './lib/components/signature-pad/signature-pad.component';
|
|
29
31
|
export * from './lib/components/dropdown-container/dropdown-container.component';
|
|
@@ -64,8 +66,10 @@ export * from './lib/helpers';
|
|
|
64
66
|
export * from './lib/components/survey/survey.component';
|
|
65
67
|
export * from './lib/components/survey/survey.models';
|
|
66
68
|
export * from './lib/components/survey/survey-templates.directive';
|
|
69
|
+
export * from './lib/components/survey/survey.config';
|
|
67
70
|
export * from './lib/components/dynamic-form/form-engine.service';
|
|
68
71
|
export * from './lib/components/dynamic-form/form-state.service';
|
|
69
72
|
export * from './lib/components/dynamic-form/form-validators';
|
|
73
|
+
export * from './lib/components/dynamic-form/other-option';
|
|
70
74
|
export * from './lib/theme/theme-scope';
|
|
71
75
|
export * from './lib/theme/colors';
|
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
@use 'sass:map';
|
|
2
|
-
|
|
3
|
-
// ========== MODO OSCURO (opt-in) ==========
|
|
4
|
-
// La app lo importa después de los tokens; sin este archivo la librería se ve igual que siempre:
|
|
5
|
-
//
|
|
6
|
-
// @use 'ui-core-abv/src/lib/styles/tokens';
|
|
7
|
-
// @use 'ui-core-abv/src/lib/styles/dark';
|
|
8
|
-
//
|
|
9
|
-
// Se activa con data-theme="dark" en <html> o en cualquier ancestro. Una zona con
|
|
10
|
-
// data-theme="light" dentro de una oscura vuelve a verse clara. No mira prefers-color-scheme:
|
|
11
|
-
// decidir el tema es cosa de la app.
|
|
12
|
-
//
|
|
13
|
-
// Los valores se pueden cambiar sin copiar el archivo:
|
|
14
|
-
//
|
|
15
|
-
// @use 'ui-core-abv/src/lib/styles/dark' with (
|
|
16
|
-
// $uic-dark-overrides: (surface: #10131a, text: #ffffff),
|
|
17
|
-
// );
|
|
18
|
-
//
|
|
19
|
-
// Cómo funciona: los componentes usan los tokens siempre con su valor de siempre como fallback,
|
|
20
|
-
// p. ej. var(--uic-surface, var(--white)) o var(--uic-neutral-300, var(--grey-300)). En claro
|
|
21
|
-
// los tokens no están definidos y gana el fallback; aquí se definen solo para el modo oscuro.
|
|
22
|
-
// Los --uic-* que la app ya sobrescribe (--uic-input-bg, --uic-label-color...) siguen ganando,
|
|
23
|
-
// porque caen a estos tokens solo cuando no están definidos.
|
|
24
|
-
|
|
25
|
-
// Escala neutral: reemplaza a --grey-N dentro de los componentes. Va invertida (el 50, que en
|
|
26
|
-
// claro es un fondo casi blanco, aquí es un fondo oscuro; el 950, texto principal, es casi blanco).
|
|
27
|
-
$uic-dark-neutral: (
|
|
28
|
-
25: #12151c,
|
|
29
|
-
50: #1d222d,
|
|
30
|
-
100: #232937,
|
|
31
|
-
200: #2a3140,
|
|
32
|
-
300: #353d4d,
|
|
33
|
-
400: #7d8696,
|
|
34
|
-
500: #9aa3b2,
|
|
35
|
-
600: #b4bcc8,
|
|
36
|
-
700: #c9cfd8,
|
|
37
|
-
800: #dde1e7,
|
|
38
|
-
900: #eaedf2,
|
|
39
|
-
950: #f2f4f8
|
|
40
|
-
) !default;
|
|
41
|
-
|
|
42
|
-
$uic-dark-tokens: (
|
|
43
|
-
surface: #161a23,
|
|
44
|
-
surface-raised: #1d222d,
|
|
45
|
-
surface-hover: #1d222d,
|
|
46
|
-
text: #f2f4f8,
|
|
47
|
-
text-muted: #9aa3b2,
|
|
48
|
-
border: #262c39,
|
|
49
|
-
border-strong: #353d4d,
|
|
50
|
-
on-primary: #ffffff,
|
|
51
|
-
inverse-bg: #f2f4f8,
|
|
52
|
-
inverse-text: #111214,
|
|
53
|
-
backdrop: rgba(0, 0, 0, 0.6),
|
|
54
|
-
shadow-sm: (0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4)),
|
|
55
|
-
shadow-md: 0 4px 12px rgba(0, 0, 0, 0.55),
|
|
56
|
-
shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.65),
|
|
57
|
-
preview-label-color: var(--yellow-800),
|
|
58
|
-
) !default;
|
|
59
|
-
|
|
60
|
-
$uic-dark-overrides: () !default;
|
|
61
|
-
|
|
62
|
-
$_tokens: map.merge($uic-dark-tokens, $uic-dark-overrides);
|
|
63
|
-
|
|
64
|
-
// Tokens globales de _tokens.scss que se resuelven con --grey-* en :root.
|
|
65
|
-
$_light-context-tokens: (
|
|
66
|
-
table-header-background: var(--grey-200),
|
|
67
|
-
table-header-color: var(--grey-900),
|
|
68
|
-
table-border-color: var(--grey-300),
|
|
69
|
-
table-hover: var(--grey-50),
|
|
70
|
-
disabled-color: var(--grey-700),
|
|
71
|
-
disabled-color-placeholder: var(--grey-300),
|
|
72
|
-
disabled-background: var(--grey-200),
|
|
73
|
-
);
|
|
74
|
-
$_dark-context-tokens: (
|
|
75
|
-
table-header-background: map.get($uic-dark-neutral, 200),
|
|
76
|
-
table-header-color: map.get($uic-dark-neutral, 900),
|
|
77
|
-
table-border-color: map.get($uic-dark-neutral, 300),
|
|
78
|
-
table-hover: map.get($uic-dark-neutral, 50),
|
|
79
|
-
disabled-color: map.get($uic-dark-neutral, 500),
|
|
80
|
-
disabled-color-placeholder: map.get($uic-dark-neutral, 400),
|
|
81
|
-
disabled-background: map.get($uic-dark-neutral, 100),
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
[data-theme='dark'] {
|
|
85
|
-
color-scheme: dark;
|
|
86
|
-
|
|
87
|
-
@each $shade, $color in $uic-dark-neutral {
|
|
88
|
-
--uic-neutral-#{$shade}: #{$color};
|
|
89
|
-
}
|
|
90
|
-
@each $name, $value in $_tokens {
|
|
91
|
-
--uic-#{$name}: #{$value};
|
|
92
|
-
}
|
|
93
|
-
@each $name, $value in $_dark-context-tokens {
|
|
94
|
-
--#{$name}: #{$value};
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Zona clara dentro de una oscura: los tokens vuelven a "no definidos" (initial) para que gane el
|
|
99
|
-
// fallback de cada componente, y los de _tokens.scss recuperan su valor claro. Con :where() la
|
|
100
|
-
// especificidad es 0: si la app sobrescribe esos tokens en :root, su valor sigue ganando.
|
|
101
|
-
:where([data-theme='light']) {
|
|
102
|
-
color-scheme: light;
|
|
103
|
-
|
|
104
|
-
@each $shade, $color in $uic-dark-neutral {
|
|
105
|
-
--uic-neutral-#{$shade}: initial;
|
|
106
|
-
}
|
|
107
|
-
@each $name, $value in $_tokens {
|
|
108
|
-
--uic-#{$name}: initial;
|
|
109
|
-
}
|
|
110
|
-
@each $name, $value in $_light-context-tokens {
|
|
111
|
-
--#{$name}: #{$value};
|
|
112
|
-
}
|
|
113
|
-
}
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
|
|
3
|
+
// ========== MODO OSCURO (opt-in) ==========
|
|
4
|
+
// La app lo importa después de los tokens; sin este archivo la librería se ve igual que siempre:
|
|
5
|
+
//
|
|
6
|
+
// @use 'ui-core-abv/src/lib/styles/tokens';
|
|
7
|
+
// @use 'ui-core-abv/src/lib/styles/dark';
|
|
8
|
+
//
|
|
9
|
+
// Se activa con data-theme="dark" en <html> o en cualquier ancestro. Una zona con
|
|
10
|
+
// data-theme="light" dentro de una oscura vuelve a verse clara. No mira prefers-color-scheme:
|
|
11
|
+
// decidir el tema es cosa de la app.
|
|
12
|
+
//
|
|
13
|
+
// Los valores se pueden cambiar sin copiar el archivo:
|
|
14
|
+
//
|
|
15
|
+
// @use 'ui-core-abv/src/lib/styles/dark' with (
|
|
16
|
+
// $uic-dark-overrides: (surface: #10131a, text: #ffffff),
|
|
17
|
+
// );
|
|
18
|
+
//
|
|
19
|
+
// Cómo funciona: los componentes usan los tokens siempre con su valor de siempre como fallback,
|
|
20
|
+
// p. ej. var(--uic-surface, var(--white)) o var(--uic-neutral-300, var(--grey-300)). En claro
|
|
21
|
+
// los tokens no están definidos y gana el fallback; aquí se definen solo para el modo oscuro.
|
|
22
|
+
// Los --uic-* que la app ya sobrescribe (--uic-input-bg, --uic-label-color...) siguen ganando,
|
|
23
|
+
// porque caen a estos tokens solo cuando no están definidos.
|
|
24
|
+
|
|
25
|
+
// Escala neutral: reemplaza a --grey-N dentro de los componentes. Va invertida (el 50, que en
|
|
26
|
+
// claro es un fondo casi blanco, aquí es un fondo oscuro; el 950, texto principal, es casi blanco).
|
|
27
|
+
$uic-dark-neutral: (
|
|
28
|
+
25: #12151c,
|
|
29
|
+
50: #1d222d,
|
|
30
|
+
100: #232937,
|
|
31
|
+
200: #2a3140,
|
|
32
|
+
300: #353d4d,
|
|
33
|
+
400: #7d8696,
|
|
34
|
+
500: #9aa3b2,
|
|
35
|
+
600: #b4bcc8,
|
|
36
|
+
700: #c9cfd8,
|
|
37
|
+
800: #dde1e7,
|
|
38
|
+
900: #eaedf2,
|
|
39
|
+
950: #f2f4f8
|
|
40
|
+
) !default;
|
|
41
|
+
|
|
42
|
+
$uic-dark-tokens: (
|
|
43
|
+
surface: #161a23,
|
|
44
|
+
surface-raised: #1d222d,
|
|
45
|
+
surface-hover: #1d222d,
|
|
46
|
+
text: #f2f4f8,
|
|
47
|
+
text-muted: #9aa3b2,
|
|
48
|
+
border: #262c39,
|
|
49
|
+
border-strong: #353d4d,
|
|
50
|
+
on-primary: #ffffff,
|
|
51
|
+
inverse-bg: #f2f4f8,
|
|
52
|
+
inverse-text: #111214,
|
|
53
|
+
backdrop: rgba(0, 0, 0, 0.6),
|
|
54
|
+
shadow-sm: (0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4)),
|
|
55
|
+
shadow-md: 0 4px 12px rgba(0, 0, 0, 0.55),
|
|
56
|
+
shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.65),
|
|
57
|
+
preview-label-color: var(--yellow-800),
|
|
58
|
+
) !default;
|
|
59
|
+
|
|
60
|
+
$uic-dark-overrides: () !default;
|
|
61
|
+
|
|
62
|
+
$_tokens: map.merge($uic-dark-tokens, $uic-dark-overrides);
|
|
63
|
+
|
|
64
|
+
// Tokens globales de _tokens.scss que se resuelven con --grey-* en :root.
|
|
65
|
+
$_light-context-tokens: (
|
|
66
|
+
table-header-background: var(--grey-200),
|
|
67
|
+
table-header-color: var(--grey-900),
|
|
68
|
+
table-border-color: var(--grey-300),
|
|
69
|
+
table-hover: var(--grey-50),
|
|
70
|
+
disabled-color: var(--grey-700),
|
|
71
|
+
disabled-color-placeholder: var(--grey-300),
|
|
72
|
+
disabled-background: var(--grey-200),
|
|
73
|
+
);
|
|
74
|
+
$_dark-context-tokens: (
|
|
75
|
+
table-header-background: map.get($uic-dark-neutral, 200),
|
|
76
|
+
table-header-color: map.get($uic-dark-neutral, 900),
|
|
77
|
+
table-border-color: map.get($uic-dark-neutral, 300),
|
|
78
|
+
table-hover: map.get($uic-dark-neutral, 50),
|
|
79
|
+
disabled-color: map.get($uic-dark-neutral, 500),
|
|
80
|
+
disabled-color-placeholder: map.get($uic-dark-neutral, 400),
|
|
81
|
+
disabled-background: map.get($uic-dark-neutral, 100),
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
[data-theme='dark'] {
|
|
85
|
+
color-scheme: dark;
|
|
86
|
+
|
|
87
|
+
@each $shade, $color in $uic-dark-neutral {
|
|
88
|
+
--uic-neutral-#{$shade}: #{$color};
|
|
89
|
+
}
|
|
90
|
+
@each $name, $value in $_tokens {
|
|
91
|
+
--uic-#{$name}: #{$value};
|
|
92
|
+
}
|
|
93
|
+
@each $name, $value in $_dark-context-tokens {
|
|
94
|
+
--#{$name}: #{$value};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Zona clara dentro de una oscura: los tokens vuelven a "no definidos" (initial) para que gane el
|
|
99
|
+
// fallback de cada componente, y los de _tokens.scss recuperan su valor claro. Con :where() la
|
|
100
|
+
// especificidad es 0: si la app sobrescribe esos tokens en :root, su valor sigue ganando.
|
|
101
|
+
:where([data-theme='light']) {
|
|
102
|
+
color-scheme: light;
|
|
103
|
+
|
|
104
|
+
@each $shade, $color in $uic-dark-neutral {
|
|
105
|
+
--uic-neutral-#{$shade}: initial;
|
|
106
|
+
}
|
|
107
|
+
@each $name, $value in $_tokens {
|
|
108
|
+
--uic-#{$name}: initial;
|
|
109
|
+
}
|
|
110
|
+
@each $name, $value in $_light-context-tokens {
|
|
111
|
+
--#{$name}: #{$value};
|
|
112
|
+
}
|
|
113
|
+
}
|