@seedgrid/fe-components 2026.11.2 → 2026.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/seedgrid-components.manifest.json +350 -65
- package/dist/buttons/SgButton.d.ts +6 -2
- package/dist/buttons/SgButton.d.ts.map +1 -1
- package/dist/buttons/SgButton.js +2 -2
- package/dist/buttons/SgButton.meta.js +3 -3
- package/dist/buttons/SgFloatActionButton.d.ts +2 -2
- package/dist/buttons/SgFloatActionButton.d.ts.map +1 -1
- package/dist/buttons/SgFloatActionButton.js +7 -7
- package/dist/buttons/SgFloatActionButton.meta.js +2 -2
- package/dist/buttons/SgSplitButton.d.ts +2 -2
- package/dist/buttons/SgSplitButton.d.ts.map +1 -1
- package/dist/buttons/SgSplitButton.js +4 -4
- package/dist/buttons/SgSplitButton.meta.js +3 -3
- package/dist/commons/SgAvatar.d.ts +2 -2
- package/dist/commons/SgAvatar.d.ts.map +1 -1
- package/dist/commons/SgAvatar.js +3 -3
- package/dist/commons/SgBadge.d.ts +1 -1
- package/dist/commons/SgBadge.d.ts.map +1 -1
- package/dist/commons/SgBadge.js +3 -3
- package/dist/gadgets/calendar/SgCalendar.d.ts +6 -0
- package/dist/gadgets/calendar/SgCalendar.d.ts.map +1 -1
- package/dist/gadgets/calendar/SgCalendar.js +9 -5
- package/dist/gadgets/calendar/SgCalendar.meta.d.ts.map +1 -1
- package/dist/gadgets/calendar/SgCalendar.meta.js +1 -0
- package/dist/generated/compiledStyles.d.ts +1 -1
- package/dist/generated/compiledStyles.d.ts.map +1 -1
- package/dist/generated/compiledStyles.js +1 -1
- package/dist/i18n/en-US.d.ts.map +1 -1
- package/dist/i18n/en-US.js +26 -0
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +26 -0
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +26 -0
- package/dist/i18n/pt-BR.d.ts.map +1 -1
- package/dist/i18n/pt-BR.js +26 -0
- package/dist/i18n/pt-PT.d.ts.map +1 -1
- package/dist/i18n/pt-PT.js +26 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/inputs/SgAutocomplete.d.ts +1 -1
- package/dist/inputs/SgAutocomplete.d.ts.map +1 -1
- package/dist/inputs/SgAutocomplete.js +3 -3
- package/dist/inputs/SgCameraCapture.d.ts +1 -1
- package/dist/inputs/SgCameraCapture.d.ts.map +1 -1
- package/dist/inputs/SgCameraCapture.js +4 -4
- package/dist/inputs/SgCameraCapture.meta.js +1 -1
- package/dist/inputs/SgCheckboxGroup.d.ts +2 -2
- package/dist/inputs/SgCheckboxGroup.d.ts.map +1 -1
- package/dist/inputs/SgCheckboxGroup.js +12 -12
- package/dist/inputs/SgCombobox.js +5 -5
- package/dist/inputs/SgDatatable.d.ts +7 -0
- package/dist/inputs/SgDatatable.d.ts.map +1 -1
- package/dist/inputs/SgDatatable.js +33 -21
- package/dist/inputs/SgDatatable.meta.d.ts.map +1 -1
- package/dist/inputs/SgDatatable.meta.js +5 -1
- package/dist/inputs/SgFileUpload.d.ts +1 -1
- package/dist/inputs/SgFileUpload.d.ts.map +1 -1
- package/dist/inputs/SgFileUpload.js +2 -2
- package/dist/inputs/SgFileUpload.meta.js +1 -1
- package/dist/inputs/SgImageUpload.meta.js +1 -1
- package/dist/inputs/SgInputCurrency.d.ts.map +1 -1
- package/dist/inputs/SgInputCurrency.js +6 -4
- package/dist/inputs/SgInputDate.d.ts.map +1 -1
- package/dist/inputs/SgInputDate.js +3 -4
- package/dist/inputs/SgInputDateTime.d.ts.map +1 -1
- package/dist/inputs/SgInputDateTime.js +11 -0
- package/dist/inputs/SgInputNumber.d.ts.map +1 -1
- package/dist/inputs/SgInputNumber.js +6 -4
- package/dist/inputs/SgInputText.d.ts.map +1 -1
- package/dist/inputs/SgInputText.js +6 -4
- package/dist/inputs/SgInputTextArea.d.ts.map +1 -1
- package/dist/inputs/SgInputTextArea.js +4 -2
- package/dist/inputs/SgMultiSelect.meta.js +1 -1
- package/dist/inputs/SgMultiSelectChips.meta.js +1 -1
- package/dist/inputs/SgMultiSelectDropdown.js +1 -1
- package/dist/inputs/SgOrderList.d.ts +3 -3
- package/dist/inputs/SgOrderList.d.ts.map +1 -1
- package/dist/inputs/SgOrderList.js +13 -13
- package/dist/inputs/SgOrderList.meta.js +1 -1
- package/dist/inputs/SgPeriodSelector.d.ts +1 -1
- package/dist/inputs/SgPeriodSelector.d.ts.map +1 -1
- package/dist/inputs/SgPeriodSelector.js +3 -3
- package/dist/inputs/SgPickList.d.ts +3 -3
- package/dist/inputs/SgPickList.d.ts.map +1 -1
- package/dist/inputs/SgPickList.js +28 -28
- package/dist/inputs/SgPickList.meta.js +1 -1
- package/dist/inputs/SgRadioGroup.d.ts +2 -2
- package/dist/inputs/SgRadioGroup.d.ts.map +1 -1
- package/dist/inputs/SgRadioGroup.js +5 -5
- package/dist/inputs/SgRating.d.ts +1 -1
- package/dist/inputs/SgRating.d.ts.map +1 -1
- package/dist/inputs/SgRating.js +7 -7
- package/dist/inputs/SgRating.meta.js +1 -1
- package/dist/inputs/SgSlider.d.ts +1 -1
- package/dist/inputs/SgSlider.d.ts.map +1 -1
- package/dist/inputs/SgSlider.js +3 -3
- package/dist/inputs/SgSlider.meta.js +1 -1
- package/dist/inputs/SgStepperInput.d.ts +2 -2
- package/dist/inputs/SgStepperInput.d.ts.map +1 -1
- package/dist/inputs/SgStepperInput.js +4 -4
- package/dist/inputs/SgStepperInput.meta.js +1 -1
- package/dist/inputs/SgTextEditor.d.ts +1 -1
- package/dist/inputs/SgTextEditor.d.ts.map +1 -1
- package/dist/inputs/SgTextEditor.js +14 -14
- package/dist/inputs/SgToggleSwitch.meta.js +1 -1
- package/dist/inputs/SgYearPartSelector.d.ts +1 -1
- package/dist/inputs/SgYearPartSelector.d.ts.map +1 -1
- package/dist/inputs/SgYearPartSelector.js +1 -2
- package/dist/inputs/SgYearPartSelector.meta.js +2 -2
- package/dist/inputs/dateTimeLogic.d.ts +7 -1
- package/dist/inputs/dateTimeLogic.d.ts.map +1 -1
- package/dist/inputs/dateTimeLogic.js +17 -4
- package/dist/inputs/useSgMultiSelect.d.ts +1 -1
- package/dist/inputs/useSgMultiSelect.d.ts.map +1 -1
- package/dist/inputs/useSgMultiSelect.js +1 -1
- package/dist/layout/SgAccordion.d.ts +1 -1
- package/dist/layout/SgAccordion.d.ts.map +1 -1
- package/dist/layout/SgAccordion.js +3 -3
- package/dist/layout/SgBreadcrumb.d.ts +1 -1
- package/dist/layout/SgBreadcrumb.d.ts.map +1 -1
- package/dist/layout/SgBreadcrumb.js +1 -1
- package/dist/layout/SgCard.d.ts +1 -1
- package/dist/layout/SgCard.d.ts.map +1 -1
- package/dist/layout/SgCard.js +14 -14
- package/dist/layout/SgMenu.d.ts +1 -1
- package/dist/layout/SgMenu.d.ts.map +1 -1
- package/dist/layout/SgMenu.js +15 -15
- package/dist/layout/SgPageControl.d.ts +1 -1
- package/dist/layout/SgPageControl.d.ts.map +1 -1
- package/dist/layout/SgPageControl.js +4 -4
- package/dist/layout/SgPageControlPage.meta.js +2 -2
- package/dist/layout/SgToolBar.d.ts +1 -1
- package/dist/layout/SgToolBar.d.ts.map +1 -1
- package/dist/layout/SgToolBar.js +4 -4
- package/dist/layout/SgToolbarIconButton.meta.js +2 -2
- package/dist/layout/SgTreeView.d.ts +4 -4
- package/dist/layout/SgTreeView.d.ts.map +1 -1
- package/dist/layout/SgTreeView.js +6 -6
- package/dist/menus/SgDockMenu.d.ts +1 -1
- package/dist/menus/SgDockMenu.d.ts.map +1 -1
- package/dist/menus/SgDockMenu.js +4 -4
- package/dist/notifications/SgNotificationBell.d.ts +51 -0
- package/dist/notifications/SgNotificationBell.d.ts.map +1 -0
- package/dist/notifications/SgNotificationBell.js +348 -0
- package/dist/notifications/SgNotificationBell.meta.d.ts +4 -0
- package/dist/notifications/SgNotificationBell.meta.d.ts.map +1 -0
- package/dist/notifications/SgNotificationBell.meta.js +75 -0
- package/dist/notifications/notificationBellLogic.d.ts +148 -0
- package/dist/notifications/notificationBellLogic.d.ts.map +1 -0
- package/dist/notifications/notificationBellLogic.js +244 -0
- package/dist/overlay/SgConfirmationDialog.d.ts +1 -1
- package/dist/overlay/SgConfirmationDialog.d.ts.map +1 -1
- package/dist/overlay/SgConfirmationDialog.js +1 -1
- package/dist/overlay/SgPopup.d.ts +1 -1
- package/dist/overlay/SgPopup.d.ts.map +1 -1
- package/dist/overlay/SgPopup.js +1 -1
- package/dist/realtime/SgRealtimeProvider.d.ts +5 -0
- package/dist/realtime/SgRealtimeProvider.d.ts.map +1 -1
- package/dist/realtime/SgRealtimeProvider.js +31 -8
- package/dist/sandbox.cjs +64 -64
- package/dist/style.css +1 -1
- package/dist/wizard/SgWizard.d.ts +7 -0
- package/dist/wizard/SgWizard.d.ts.map +1 -1
- package/dist/wizard/SgWizard.js +11 -2
- package/dist/wizard/SgWizard.meta.d.ts.map +1 -1
- package/dist/wizard/SgWizard.meta.js +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgSlider.d.ts","sourceRoot":"","sources":["../../src/inputs/SgSlider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAiB/D,KAAK,gBAAgB,GAAG,IAAI,CAC1B,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EACzC,MAAM,GACN,IAAI,GACJ,KAAK,GACL,KAAK,GACL,MAAM,GACN,OAAO,GACP,cAAc,GACd,UAAU,GACV,YAAY,CACf,GAAG;IACF,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IAC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yBArDe,QAAQ"}
|
package/dist/inputs/SgSlider.js
CHANGED
|
@@ -34,7 +34,7 @@ function mergeInputRefs(primary, secondary) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
function SgSliderBase(props) {
|
|
37
|
-
const { id, minValue, maxValue, value, defaultValue, step = 1,
|
|
37
|
+
const { id, minValue, maxValue, value, defaultValue, step = 1, enabled = true, onChange, ariaLabel, className, width, error, inputProps } = props;
|
|
38
38
|
const safeMin = Number.isFinite(minValue) ? minValue : 0;
|
|
39
39
|
const rawMax = Number.isFinite(maxValue) ? maxValue : safeMin;
|
|
40
40
|
const safeMax = Math.max(safeMin, rawMax);
|
|
@@ -47,7 +47,7 @@ function SgSliderBase(props) {
|
|
|
47
47
|
setInternalValue((prev) => clamp(prev, safeMin, safeMax));
|
|
48
48
|
}, [isControlled, safeMin, safeMax]);
|
|
49
49
|
const currentValue = clamp(isControlled ? value : internalValue, safeMin, safeMax);
|
|
50
|
-
return (_jsxs("div", { style: { width: toCssSize(width) }, children: [_jsx("input", { id: id, type: "range", min: safeMin, max: safeMax, step: safeStep, value: currentValue, disabled:
|
|
50
|
+
return (_jsxs("div", { style: { width: toCssSize(width) }, children: [_jsx("input", { id: id, type: "range", min: safeMin, max: safeMax, step: safeStep, value: currentValue, disabled: !enabled, "aria-label": ariaLabel, "aria-invalid": error ? true : undefined, onChange: (event) => {
|
|
51
51
|
const nextRaw = Number(event.currentTarget.value);
|
|
52
52
|
const next = clamp(Number.isFinite(nextRaw) ? nextRaw : safeMin, safeMin, safeMax);
|
|
53
53
|
if (!isControlled)
|
|
@@ -56,7 +56,7 @@ function SgSliderBase(props) {
|
|
|
56
56
|
inputProps?.onChange?.(event);
|
|
57
57
|
}, onBlur: (event) => {
|
|
58
58
|
inputProps?.onBlur?.(event);
|
|
59
|
-
}, className: cn("h-5 w-full cursor-pointer",
|
|
59
|
+
}, className: cn("h-5 w-full cursor-pointer", !enabled ? "cursor-not-allowed opacity-60" : "", className), ...inputProps }), error ? _jsx("p", { className: "mt-1 text-xs text-red-600", children: error }) : null] }));
|
|
60
60
|
}
|
|
61
61
|
export function SgSlider(props) {
|
|
62
62
|
const { control, name, register, rules, ...rest } = props;
|
|
@@ -17,7 +17,7 @@ export const sgMeta = {
|
|
|
17
17
|
{ name: "maxValue", type: "number", required: true, description: "Valor maximo do intervalo.", semanticRole: "validation", bindable: true },
|
|
18
18
|
{ name: "value", type: "number", description: "Valor atual controlado.", semanticRole: "value", bindable: true },
|
|
19
19
|
{ name: "step", type: "number", description: "Passo entre valores.", semanticRole: "behavior", bindable: true },
|
|
20
|
-
{ name: "
|
|
20
|
+
{ name: "enabled", type: "boolean", default: true, description: "Desabilita interacao.", semanticRole: "behavior", bindable: true },
|
|
21
21
|
{ name: "width", type: "number | string", description: "Largura do componente.", semanticRole: "appearance", bindable: true },
|
|
22
22
|
{ name: "onChange", type: "(value: number) => void", description: "Callback de mudanca.", semanticRole: "event", bindable: false }
|
|
23
23
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type RhfFieldProps } from "../rhf";
|
|
3
|
-
type StepperInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "id" | "min" | "max" | "step" | "value" | "defaultValue" | "
|
|
3
|
+
type StepperInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "id" | "min" | "max" | "step" | "value" | "defaultValue" | "readOnly" | "aria-label"> & {
|
|
4
4
|
ref?: React.Ref<HTMLInputElement>;
|
|
5
5
|
};
|
|
6
6
|
export type SgStepperInputProps = {
|
|
@@ -10,7 +10,7 @@ export type SgStepperInputProps = {
|
|
|
10
10
|
step?: number;
|
|
11
11
|
value?: number;
|
|
12
12
|
defaultValue?: number;
|
|
13
|
-
|
|
13
|
+
enabled?: boolean;
|
|
14
14
|
readOnly?: boolean;
|
|
15
15
|
onChange?: (value: number) => void;
|
|
16
16
|
ariaLabel?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgStepperInput.d.ts","sourceRoot":"","sources":["../../src/inputs/SgStepperInput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAkB/D,KAAK,iBAAiB,GAAG,IAAI,CAC3B,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EACzC,MAAM,GACN,IAAI,GACJ,KAAK,GACL,KAAK,GACL,MAAM,GACN,OAAO,GACP,cAAc,GACd,UAAU,GACV,
|
|
1
|
+
{"version":3,"file":"SgStepperInput.d.ts","sourceRoot":"","sources":["../../src/inputs/SgStepperInput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAkB/D,KAAK,iBAAiB,GAAG,IAAI,CAC3B,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EACzC,MAAM,GACN,IAAI,GACJ,KAAK,GACL,KAAK,GACL,MAAM,GACN,OAAO,GACP,cAAc,GACd,UAAU,GACV,YAAY,CACf,GAAG;IACF,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC,GAAG,aAAa,CAAC;AAoJlB,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CAqDlE;yBArDe,cAAc"}
|
|
@@ -36,7 +36,7 @@ function mergeInputRefs(primary, secondary) {
|
|
|
36
36
|
}
|
|
37
37
|
function SgStepperInputBase(props) {
|
|
38
38
|
const i18n = useComponentsI18n();
|
|
39
|
-
const { id, minValue, maxValue, step = 1, value, defaultValue,
|
|
39
|
+
const { id, minValue, maxValue, step = 1, value, defaultValue, enabled = true, readOnly = false, onChange, ariaLabel, className, inputClassName, width, error, inputProps } = props;
|
|
40
40
|
const safeMin = Number.isFinite(minValue) ? minValue : 0;
|
|
41
41
|
const rawMax = Number.isFinite(maxValue) ? maxValue : safeMin;
|
|
42
42
|
const safeMax = Math.max(safeMin, rawMax);
|
|
@@ -55,9 +55,9 @@ function SgStepperInputBase(props) {
|
|
|
55
55
|
setInternalValue(next);
|
|
56
56
|
onChange?.(next);
|
|
57
57
|
}, [isControlled, onChange, safeMax, safeMin]);
|
|
58
|
-
const canDecrease =
|
|
59
|
-
const canIncrease =
|
|
60
|
-
return (_jsxs("div", { style: { width: toCssSize(width) }, children: [_jsxs("div", { className: cn("inline-flex h-10 w-full overflow-hidden rounded-md border border-border bg-background",
|
|
58
|
+
const canDecrease = enabled && !readOnly && currentValue > safeMin;
|
|
59
|
+
const canIncrease = enabled && !readOnly && currentValue < safeMax;
|
|
60
|
+
return (_jsxs("div", { style: { width: toCssSize(width) }, children: [_jsxs("div", { className: cn("inline-flex h-10 w-full overflow-hidden rounded-md border border-border bg-background", !enabled ? "opacity-60" : "", error ? "border-[hsl(var(--destructive))]" : "", className), children: [_jsx("input", { id: id, type: "number", min: safeMin, max: safeMax, step: safeStep, value: currentValue, disabled: !enabled, readOnly: readOnly, "aria-label": ariaLabel, "aria-invalid": error ? true : undefined, onChange: (event) => {
|
|
61
61
|
const inputNext = Number(event.currentTarget.value);
|
|
62
62
|
if (!Number.isFinite(inputNext))
|
|
63
63
|
return;
|
|
@@ -18,7 +18,7 @@ export const sgMeta = {
|
|
|
18
18
|
{ name: "step", type: "number", default: 1, description: "Incremento e decremento aplicados.", semanticRole: "behavior", bindable: true },
|
|
19
19
|
{ name: "value", type: "number", description: "Valor atual controlado.", semanticRole: "value", bindable: true },
|
|
20
20
|
{ name: "readOnly", type: "boolean", default: false, description: "Permite visualizacao sem edicao direta.", semanticRole: "behavior", bindable: true },
|
|
21
|
-
{ name: "
|
|
21
|
+
{ name: "enabled", type: "boolean", default: true, description: "Desabilita interacao.", semanticRole: "behavior", bindable: true },
|
|
22
22
|
{ name: "onChange", type: "(value: number) => void", description: "Callback de mudanca.", semanticRole: "event", bindable: false }
|
|
23
23
|
],
|
|
24
24
|
states: ["default", "disabled", "readOnly", "error"],
|
|
@@ -18,7 +18,7 @@ export type SgTextEditorProps = {
|
|
|
18
18
|
onLoad?: (meta: SgTextEditorSaveMeta) => void;
|
|
19
19
|
height?: number;
|
|
20
20
|
placeholder?: string;
|
|
21
|
-
|
|
21
|
+
enabled?: boolean;
|
|
22
22
|
borderRadius?: number | string;
|
|
23
23
|
showCssEditor?: boolean;
|
|
24
24
|
cssEditorLabel?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgTextEditor.d.ts","sourceRoot":"","sources":["../../src/inputs/SgTextEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AA4B/D,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,EAAE,MAAM,CAAC;IACr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Q,EAAE,MAAM,KAAK,IAAI,CAAC;IAE1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAE5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC1D,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAE9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,GAAG,aAAa,CAAC;AA+clB,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,2CAsB9D;yBAtBe,YAAY"}
|
|
@@ -72,7 +72,7 @@ function canRun(editor, fn) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
function SgTextEditorBase(props) {
|
|
75
|
-
const { id, valueHtml, defaultValueHtml, onChangeHtml, cssText = "", onCssTextChange, fileName, onSave, onLoad, height = 320, placeholder: placeholderProp,
|
|
75
|
+
const { id, valueHtml, defaultValueHtml, onChangeHtml, cssText = "", onCssTextChange, fileName, onSave, onLoad, height = 320, placeholder: placeholderProp, enabled = true, borderRadius, showCssEditor = false, cssEditorLabel: cssEditorLabelProp, className, style, error } = props;
|
|
76
76
|
const i18n = useComponentsI18n();
|
|
77
77
|
const placeholder = placeholderProp ?? t(i18n, "components.textEditor.placeholder");
|
|
78
78
|
const cssEditorLabel = cssEditorLabelProp ?? t(i18n, "components.textEditor.cssEditorLabel");
|
|
@@ -85,7 +85,7 @@ function SgTextEditorBase(props) {
|
|
|
85
85
|
const isControlled = typeof valueHtml === "string";
|
|
86
86
|
const editor = useEditor({
|
|
87
87
|
immediatelyRender: false,
|
|
88
|
-
editable:
|
|
88
|
+
editable: enabled,
|
|
89
89
|
extensions: [
|
|
90
90
|
StarterKit.configure({ codeBlock: {} }),
|
|
91
91
|
Underline,
|
|
@@ -104,7 +104,7 @@ function SgTextEditorBase(props) {
|
|
|
104
104
|
attributes: {
|
|
105
105
|
id,
|
|
106
106
|
"aria-label": editorAriaLabel,
|
|
107
|
-
class: cn("prose max-w-none focus:outline-none min-h-[120px]",
|
|
107
|
+
class: cn("prose max-w-none focus:outline-none min-h-[120px]", !enabled ? "opacity-60" : ""),
|
|
108
108
|
"data-placeholder": placeholder
|
|
109
109
|
}
|
|
110
110
|
},
|
|
@@ -161,7 +161,7 @@ function SgTextEditorBase(props) {
|
|
|
161
161
|
const cssTextareaStyle = resolvedBorderRadius
|
|
162
162
|
? { borderRadius: resolvedBorderRadius }
|
|
163
163
|
: undefined;
|
|
164
|
-
return (_jsxs("div", { className: cn("w-full", className), style: style, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2 rounded-t-lg border border-b-0 bg-background p-2", style: toolbarStyle, children: [_jsxs("select", { className: "h-9 rounded-md border px-2 text-sm bg-background", disabled: !editor ||
|
|
164
|
+
return (_jsxs("div", { className: cn("w-full", className), style: style, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2 rounded-t-lg border border-b-0 bg-background p-2", style: toolbarStyle, children: [_jsxs("select", { className: "h-9 rounded-md border px-2 text-sm bg-background", disabled: !editor || !enabled, value: active("heading", { level: 1 })
|
|
165
165
|
? "h1"
|
|
166
166
|
: active("heading", { level: 2 })
|
|
167
167
|
? "h2"
|
|
@@ -180,17 +180,17 @@ function SgTextEditorBase(props) {
|
|
|
180
180
|
editor.commands.toggleHeading({ level: 2 });
|
|
181
181
|
if (v === "h3")
|
|
182
182
|
editor.commands.toggleHeading({ level: 3 });
|
|
183
|
-
}, children: [_jsx("option", { value: "h1", children: t(i18n, "components.textEditor.toolbar.heading") }), _jsx("option", { value: "h2", children: t(i18n, "components.textEditor.toolbar.subheading") }), _jsx("option", { value: "p", children: t(i18n, "components.textEditor.toolbar.normal") }), _jsx("option", { value: "h3", children: t(i18n, "components.textEditor.toolbar.heading3") })] }), _jsxs("select", { className: "h-9 rounded-md border px-2 text-sm bg-background", disabled: !editor ||
|
|
183
|
+
}, children: [_jsx("option", { value: "h1", children: t(i18n, "components.textEditor.toolbar.heading") }), _jsx("option", { value: "h2", children: t(i18n, "components.textEditor.toolbar.subheading") }), _jsx("option", { value: "p", children: t(i18n, "components.textEditor.toolbar.normal") }), _jsx("option", { value: "h3", children: t(i18n, "components.textEditor.toolbar.heading3") })] }), _jsxs("select", { className: "h-9 rounded-md border px-2 text-sm bg-background", disabled: !editor || !enabled, onChange: (e) => {
|
|
184
184
|
const v = e.target.value;
|
|
185
185
|
if (!editor)
|
|
186
186
|
return;
|
|
187
187
|
editor.chain().focus().setFontFamily(v).run();
|
|
188
|
-
}, defaultValue: "inherit", children: [_jsx("option", { value: "inherit", children: t(i18n, "components.textEditor.toolbar.defaultFont") }), _jsx("option", { value: "Arial", children: "Arial" }), _jsx("option", { value: "Georgia", children: "Georgia" }), _jsx("option", { value: "Times New Roman", children: "Times" }), _jsx("option", { value: "Courier New", children: "Courier" })] }), _jsxs("select", { className: "h-9 rounded-md border px-2 text-sm bg-background", disabled: !editor ||
|
|
188
|
+
}, defaultValue: "inherit", children: [_jsx("option", { value: "inherit", children: t(i18n, "components.textEditor.toolbar.defaultFont") }), _jsx("option", { value: "Arial", children: "Arial" }), _jsx("option", { value: "Georgia", children: "Georgia" }), _jsx("option", { value: "Times New Roman", children: "Times" }), _jsx("option", { value: "Courier New", children: "Courier" })] }), _jsxs("select", { className: "h-9 rounded-md border px-2 text-sm bg-background", disabled: !editor || !enabled, defaultValue: "16px", onChange: (e) => {
|
|
189
189
|
const size = e.target.value;
|
|
190
190
|
if (!editor)
|
|
191
191
|
return;
|
|
192
192
|
editor.chain().focus().setMark("textStyle", { fontSize: size }).run();
|
|
193
|
-
}, children: [_jsx("option", { value: "12px", children: "12" }), _jsx("option", { value: "14px", children: "14" }), _jsx("option", { value: "16px", children: "16" }), _jsx("option", { value: "18px", children: "18" }), _jsx("option", { value: "24px", children: "24" }), _jsx("option", { value: "32px", children: "32" })] }), _jsx("div", { className: "mx-1 h-6 w-px bg-border" }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.bold"), icon: _jsx("span", { className: "font-bold leading-none", "aria-hidden": "true", children: "B" }), active: active("bold"),
|
|
193
|
+
}, children: [_jsx("option", { value: "12px", children: "12" }), _jsx("option", { value: "14px", children: "14" }), _jsx("option", { value: "16px", children: "16" }), _jsx("option", { value: "18px", children: "18" }), _jsx("option", { value: "24px", children: "24" }), _jsx("option", { value: "32px", children: "32" })] }), _jsx("div", { className: "mx-1 h-6 w-px bg-border" }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.bold"), icon: _jsx("span", { className: "font-bold leading-none", "aria-hidden": "true", children: "B" }), active: active("bold"), enabled: !(!canRun(editor, (ed) => ed.can().chain().focus().toggleBold().run()) || !enabled), onClick: () => exec(() => editor.chain().toggleBold().run()) }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.italic"), icon: _jsx("span", { className: "italic leading-none", "aria-hidden": "true", children: "I" }), active: active("italic"), enabled: !(!canRun(editor, (ed) => ed.can().chain().focus().toggleItalic().run()) || !enabled), onClick: () => exec(() => editor.chain().toggleItalic().run()) }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.underline"), icon: _jsx("span", { className: "underline leading-none", "aria-hidden": "true", children: "U" }), active: active("underline"), enabled: !(!canRun(editor, (ed) => ed.can().chain().focus().toggleUnderline().run()) || !enabled), onClick: () => exec(() => editor.chain().toggleUnderline().run()) }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.strike"), icon: _jsx("span", { className: "line-through leading-none", "aria-hidden": "true", children: "S" }), active: active("strike"), enabled: !(!canRun(editor, (ed) => ed.can().chain().focus().toggleStrike().run()) || !enabled), onClick: () => exec(() => editor.chain().toggleStrike().run()) }), _jsx("div", { className: "mx-1 h-6 w-px bg-border" }), _jsx(ColorPickerButton, { label: t(i18n, "components.textEditor.toolbar.textColor"), hint: t(i18n, "components.textEditor.toolbar.textColor"), icon: _jsx(Palette, { size: 14, "aria-hidden": "true" }), enabled: !(!editor || !enabled), onChange: (color) => editor?.chain().focus().setColor(color).run() }), _jsx(ColorPickerButton, { label: t(i18n, "components.textEditor.toolbar.highlightColor"), hint: t(i18n, "components.textEditor.toolbar.highlightColor"), icon: _jsx(Highlighter, { size: 14, "aria-hidden": "true" }), enabled: !(!editor || !enabled), onChange: (color) => editor?.chain().focus().toggleHighlight({ color }).run() }), _jsx("div", { className: "mx-1 h-6 w-px bg-border" }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.subscript"), text: "x2", active: active("subscript"), enabled: !(!editor || !enabled), onClick: () => exec(() => editor.chain().toggleSubscript().run()) }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.superscript"), text: "x^", active: active("superscript"), enabled: !(!editor || !enabled), onClick: () => exec(() => editor.chain().toggleSuperscript().run()) }), _jsx("div", { className: "mx-1 h-6 w-px bg-border" }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.bullets"), icon: _jsx(List, { size: 14, "aria-hidden": "true" }), active: active("bulletList"), enabled: !(!editor || !enabled), onClick: () => exec(() => editor.chain().toggleBulletList().run()) }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.numbered"), icon: _jsx(ListOrdered, { size: 14, "aria-hidden": "true" }), active: active("orderedList"), enabled: !(!editor || !enabled), onClick: () => exec(() => editor.chain().toggleOrderedList().run()) }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.outdent"), icon: _jsx(IndentDecrease, { size: 14, "aria-hidden": "true" }), active: false, enabled: !(!editor || !enabled), onClick: () => exec(() => editor.chain().liftListItem("listItem").run()) }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.indent"), icon: _jsx(IndentIncrease, { size: 14, "aria-hidden": "true" }), active: false, enabled: !(!editor || !enabled), onClick: () => exec(() => editor.chain().sinkListItem("listItem").run()) }), _jsx("div", { className: "mx-1 h-6 w-px bg-border" }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.alignLeft"), icon: _jsx(AlignLeft, { size: 14, "aria-hidden": "true" }), active: active("paragraph", { textAlign: "left" }) || active("heading", { textAlign: "left" }), enabled: !(!editor || !enabled), onClick: () => exec(() => editor.chain().setTextAlign("left").run()) }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.alignCenter"), icon: _jsx(AlignCenter, { size: 14, "aria-hidden": "true" }), active: active("paragraph", { textAlign: "center" }) || active("heading", { textAlign: "center" }), enabled: !(!editor || !enabled), onClick: () => exec(() => editor.chain().setTextAlign("center").run()) }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.alignRight"), icon: _jsx(AlignRight, { size: 14, "aria-hidden": "true" }), active: active("paragraph", { textAlign: "right" }) || active("heading", { textAlign: "right" }), enabled: !(!editor || !enabled), onClick: () => exec(() => editor.chain().setTextAlign("right").run()) }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.justify"), icon: _jsx(AlignJustify, { size: 14, "aria-hidden": "true" }), active: active("paragraph", { textAlign: "justify" }) || active("heading", { textAlign: "justify" }), enabled: !(!editor || !enabled), onClick: () => exec(() => editor.chain().setTextAlign("justify").run()) }), _jsx("div", { className: "mx-1 h-6 w-px bg-border" }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.link"), text: t(i18n, "components.textEditor.toolbar.link"), active: active("link"), enabled: !(!editor || !enabled), onClick: () => {
|
|
194
194
|
if (!editor)
|
|
195
195
|
return;
|
|
196
196
|
const prev = editor.getAttributes("link").href;
|
|
@@ -200,18 +200,18 @@ function SgTextEditorBase(props) {
|
|
|
200
200
|
return;
|
|
201
201
|
}
|
|
202
202
|
editor.chain().focus().setLink({ href: url }).run();
|
|
203
|
-
} }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.image"), icon: _jsx(FileImage, { size: 14, "aria-hidden": "true" }), active: false,
|
|
203
|
+
} }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.image"), icon: _jsx(FileImage, { size: 14, "aria-hidden": "true" }), active: false, enabled: !(!editor || !enabled), onClick: () => {
|
|
204
204
|
if (!editor)
|
|
205
205
|
return;
|
|
206
206
|
const src = window.prompt(t(i18n, "components.textEditor.prompt.imageUrl"));
|
|
207
207
|
if (!src)
|
|
208
208
|
return;
|
|
209
209
|
editor.chain().focus().setImage({ src }).run();
|
|
210
|
-
} }), _jsx("div", { className: "mx-1 h-6 w-px bg-border" }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.clear"), text: "X", active: false,
|
|
210
|
+
} }), _jsx("div", { className: "mx-1 h-6 w-px bg-border" }), _jsx(ToolbarButton, { label: t(i18n, "components.textEditor.toolbar.clear"), text: "X", active: false, enabled: !(!editor || !enabled), onClick: () => {
|
|
211
211
|
if (!editor)
|
|
212
212
|
return;
|
|
213
213
|
editor.chain().focus().unsetAllMarks().clearNodes().run();
|
|
214
|
-
} }), _jsxs("div", { className: "ml-auto flex items-center gap-2", children: [_jsx("button", { type: "button", className: "h-9 rounded-md border bg-muted px-3 text-sm hover:bg-muted/80 disabled:opacity-50", disabled: !editor ||
|
|
214
|
+
} }), _jsxs("div", { className: "ml-auto flex items-center gap-2", children: [_jsx("button", { type: "button", className: "h-9 rounded-md border bg-muted px-3 text-sm hover:bg-muted/80 disabled:opacity-50", disabled: !editor || !enabled, onClick: doSave, children: t(i18n, "components.actions.save") }), _jsxs("label", { className: "h-9 cursor-pointer rounded-md border bg-muted px-3 text-sm leading-9 hover:bg-muted/80", children: [t(i18n, "components.actions.loadHtml"), _jsx("input", { type: "file", accept: "text/html,.html", className: "hidden", onChange: (e) => {
|
|
215
215
|
const f = e.target.files?.[0];
|
|
216
216
|
if (!f)
|
|
217
217
|
return;
|
|
@@ -227,11 +227,11 @@ export function SgTextEditor(props) {
|
|
|
227
227
|
return _jsx(SgTextEditorBase, { ...rest });
|
|
228
228
|
}
|
|
229
229
|
function ToolbarButton(props) {
|
|
230
|
-
const { label, text, icon, active,
|
|
231
|
-
return (_jsx("button", { type: "button", title: label, "aria-label": label, disabled:
|
|
230
|
+
const { label, text, icon, active, enabled = true, onClick } = props;
|
|
231
|
+
return (_jsx("button", { type: "button", title: label, "aria-label": label, disabled: !enabled, onClick: onClick, className: cn("inline-flex h-9 min-w-9 items-center justify-center rounded-md border px-2 text-sm", "hover:bg-muted/80 disabled:opacity-50", active ? "bg-muted" : "bg-background"), children: icon ?? text }));
|
|
232
232
|
}
|
|
233
233
|
function ColorPickerButton(props) {
|
|
234
|
-
const { label, hint, icon,
|
|
235
|
-
return (_jsxs("label", { title: hint ?? label, "aria-label": label, className: cn("relative inline-flex h-9 min-w-9 items-center justify-center rounded-md border px-2 text-sm", "bg-background hover:bg-muted/80",
|
|
234
|
+
const { label, hint, icon, enabled = true, onChange } = props;
|
|
235
|
+
return (_jsxs("label", { title: hint ?? label, "aria-label": label, className: cn("relative inline-flex h-9 min-w-9 items-center justify-center rounded-md border px-2 text-sm", "bg-background hover:bg-muted/80", !enabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"), children: [icon, _jsx("input", { type: "color", disabled: !enabled, onChange: (e) => onChange(e.target.value), className: cn("absolute inset-0 h-full w-full opacity-0", !enabled ? "cursor-not-allowed" : "cursor-pointer"), "aria-label": label })] }));
|
|
236
236
|
}
|
|
237
237
|
SgTextEditor.displayName = "SgTextEditor";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgYearPartSelector.d.ts","sourceRoot":"","sources":["../../src/inputs/SgYearPartSelector.tsx"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EAMZ,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,oFAAoF;IACpF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAChD,wFAAwF;IACxF,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;IAC9B,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,
|
|
1
|
+
{"version":3,"file":"SgYearPartSelector.d.ts","sourceRoot":"","sources":["../../src/inputs/SgYearPartSelector.tsx"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EAMZ,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,oFAAoF;IACpF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAChD,wFAAwF;IACxF,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;IAC9B,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA2BF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,uBAAuB,CAAC,2CA4J1E"}
|
|
@@ -19,7 +19,7 @@ function pickLocale(map, locale) {
|
|
|
19
19
|
const DEFAULT_KIND = YearPartKind.SEMESTER;
|
|
20
20
|
const ALL_KINDS = [DEFAULT_KIND, YearPartKind.QUARTER, YearPartKind.BIMESTER];
|
|
21
21
|
export function SgYearPartSelector(props) {
|
|
22
|
-
const { id = "sg-year-part-selector", label, value, onChange, allowedKinds, minYear, maxYear, locale = "pt-BR",
|
|
22
|
+
const { id = "sg-year-part-selector", label, value, onChange, allowedKinds, minYear, maxYear, locale = "pt-BR", enabled = true, required, className } = props;
|
|
23
23
|
// Array vazio cai no default: um combo de recorte sem opcao nenhuma seria controle morto na tela.
|
|
24
24
|
const kinds = React.useMemo(() => (allowedKinds && allowedKinds.length > 0 ? allowedKinds : ALL_KINDS), [allowedKinds]);
|
|
25
25
|
const isControlled = value !== undefined;
|
|
@@ -63,7 +63,6 @@ export function SgYearPartSelector(props) {
|
|
|
63
63
|
// Depende do recorte: trocar de trimestre para semestre troca 4 opcoes por 2.
|
|
64
64
|
const partItems = React.useMemo(() => yearPartOptions(current.kind, locale).map((option) => ({ id: option.value, label: option.label })), [current.kind, locale]);
|
|
65
65
|
const showKind = kinds.length > 1;
|
|
66
|
-
const enabled = disabled ? false : undefined;
|
|
67
66
|
/*
|
|
68
67
|
* Flex em vez de grid de 3 colunas: com o combo de recorte escondido a linha reflui para dois
|
|
69
68
|
* controles, em vez de deixar uma coluna vazia no meio.
|
|
@@ -28,7 +28,7 @@ export const sgMeta = {
|
|
|
28
28
|
{ name: "minYear", type: "number", default: "ano corrente - 30", description: "Primeiro ano oferecido na lista de anos.", semanticRole: "behavior", bindable: true },
|
|
29
29
|
{ name: "maxYear", type: "number", default: "ano corrente + 10", description: "Ultimo ano oferecido na lista de anos.", semanticRole: "behavior", bindable: true },
|
|
30
30
|
{ name: "locale", type: "string", default: "pt-BR", description: "Locale dos rotulos de recorte e fatia. A sigla entre parenteses acompanha o idioma: Q1..Q4 em pt-BR e en-US, T1..T4 em es, fr e pt-PT; bimestre nao tem sigla e sai sem parenteses.", semanticRole: "behavior", bindable: true },
|
|
31
|
-
{ name: "
|
|
31
|
+
{ name: "enabled", type: "boolean", default: true, description: "Desabilita os tres combos (ano, recorte e fatia).", semanticRole: "behavior", bindable: true },
|
|
32
32
|
{ name: "required", type: "boolean", default: false, description: "Marca o campo como obrigatorio.", semanticRole: "validation", bindable: true },
|
|
33
33
|
{ name: "className", type: "string", description: "Classes extras aplicadas ao container do campo.", semanticRole: "appearance", bindable: false }
|
|
34
34
|
],
|
|
@@ -44,7 +44,7 @@ export const sgMeta = {
|
|
|
44
44
|
defaultProps: {
|
|
45
45
|
allowedKinds: ["SEMESTER", "QUARTER", "BIMESTER"],
|
|
46
46
|
locale: "pt-BR",
|
|
47
|
-
|
|
47
|
+
enabled: true,
|
|
48
48
|
required: false
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -17,6 +17,12 @@ export type DateTimeValidationInput = {
|
|
|
17
17
|
};
|
|
18
18
|
/** Codigo do erro (null = valido). `local` e o texto do campo ("" = vazio). min/max sao instantes. */
|
|
19
19
|
export declare function validateDateTime(local: string, input?: DateTimeValidationInput): DateTimeErrorCode | null;
|
|
20
|
-
/**
|
|
20
|
+
/** Data no idioma (Intl.DateTimeFormat): pt-BR/pt-PT 05/11/2026, en-US 11/5/2026, es 5/11/2026, fr 05/11/2026. */
|
|
21
|
+
export declare function formatLocalizedDate(year: number, month: number, day: number, locale: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Texto de exibicao de um relogio de parede, no idioma ativo: a data vem do `Intl.DateTimeFormat` (pt-BR/pt-PT 05/11/2026,
|
|
24
|
+
* en-US 11/5/2026, es 5/11/2026, fr 05/11/2026) e a hora e sempre 24h (HH:mm[:ss]), separadas por um espaco. Assim a saida
|
|
25
|
+
* nao depende do separador que cada navegador usa entre data e hora, e o Flutter (`intl`) produz o mesmo texto.
|
|
26
|
+
*/
|
|
21
27
|
export declare function formatWallClock(local: string, locale: string, showSeconds?: boolean): string;
|
|
22
28
|
//# sourceMappingURL=dateTimeLogic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeLogic.d.ts","sourceRoot":"","sources":["../../src/inputs/dateTimeLogic.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC;AASjF,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMhE;AAMD,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAuB9E;AAQD,2FAA2F;AAC3F,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,EACvC,QAAQ,CAAC,EAAE,MAAM,EACjB,WAAW,UAAQ,GAClB,MAAM,CAMR;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBlF;AAED,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAkBhE;AAED,MAA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,IAAI,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,sGAAsG;AACtG,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,uBAA4B,GAAG,iBAAiB,GAAG,IAAI,CAY7G;AAED,kHAAkH;AAClH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CASpG;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,MAAM,CAM1F"}
|
|
@@ -128,13 +128,26 @@ export function validateDateTime(local, input = {}) {
|
|
|
128
128
|
return "range";
|
|
129
129
|
return belowMin ? "min" : "max";
|
|
130
130
|
}
|
|
131
|
-
/**
|
|
131
|
+
/** Data no idioma (Intl.DateTimeFormat): pt-BR/pt-PT 05/11/2026, en-US 11/5/2026, es 5/11/2026, fr 05/11/2026. */
|
|
132
|
+
export function formatLocalizedDate(year, month, day, locale) {
|
|
133
|
+
try {
|
|
134
|
+
return new Intl.DateTimeFormat(locale, { timeZone: "UTC", year: "numeric", month: "numeric", day: "numeric" }).format(new Date(Date.UTC(year, month - 1, day)));
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
const two = (v) => String(v).padStart(2, "0");
|
|
138
|
+
return `${two(day)}/${two(month)}/${year}`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Texto de exibicao de um relogio de parede, no idioma ativo: a data vem do `Intl.DateTimeFormat` (pt-BR/pt-PT 05/11/2026,
|
|
143
|
+
* en-US 11/5/2026, es 5/11/2026, fr 05/11/2026) e a hora e sempre 24h (HH:mm[:ss]), separadas por um espaco. Assim a saida
|
|
144
|
+
* nao depende do separador que cada navegador usa entre data e hora, e o Flutter (`intl`) produz o mesmo texto.
|
|
145
|
+
*/
|
|
132
146
|
export function formatWallClock(local, locale, showSeconds = false) {
|
|
133
147
|
const m = LOCAL_RE.exec(local.trim());
|
|
134
148
|
if (!m)
|
|
135
149
|
return local;
|
|
136
150
|
const time = `${m[4]}:${m[5]}${showSeconds ? `:${m[6] ?? "00"}` : ""}`;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return `${m[3]}/${m[2]}/${m[1]} ${time}`;
|
|
151
|
+
const date = formatLocalizedDate(Number(m[1]), Number(m[2]), Number(m[3]), locale);
|
|
152
|
+
return `${date} ${time}`;
|
|
140
153
|
}
|
|
@@ -9,7 +9,7 @@ export type SgMultiSelectOption = {
|
|
|
9
9
|
* Sem ele, vale o `label`. Ex.: `label: "3 - Filial Centro"`, `chipLabel: "3"`.
|
|
10
10
|
*/
|
|
11
11
|
chipLabel?: string;
|
|
12
|
-
|
|
12
|
+
enabled?: boolean;
|
|
13
13
|
};
|
|
14
14
|
export declare function valueEquals(left: SgMultiSelectOptionValue, right: SgMultiSelectOptionValue): boolean;
|
|
15
15
|
export type UseSgMultiSelectParams = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSgMultiSelect.d.ts","sourceRoot":"","sources":["../../src/inputs/useSgMultiSelect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,wBAAwB,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"useSgMultiSelect.d.ts","sourceRoot":"","sources":["../../src/inputs/useSgMultiSelect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,wBAAwB,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,WAAW,CAAC,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,wBAAwB,WAE1F;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,wBAAwB,EAAE,KAAK,IAAI,CAAC;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAChC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB;;;;;;;;;;;;;;;;uCAyB7C,wBAAwB;oCAgD7B,mBAAmB;wCAgBd,wBAAwB;;;;wCA4E9B,KAAK,CAAC,aAAa;EAiE9B"}
|
|
@@ -65,7 +65,7 @@ export function useSgMultiSelect(params) {
|
|
|
65
65
|
setOpen(true);
|
|
66
66
|
}, [isDisabled]);
|
|
67
67
|
const toggleOption = React.useCallback((option) => {
|
|
68
|
-
if (option.
|
|
68
|
+
if ((option.enabled === false))
|
|
69
69
|
return;
|
|
70
70
|
const already = resolvedValue.some((entry) => valueEquals(entry, option.value));
|
|
71
71
|
if (already) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgAccordion.d.ts","sourceRoot":"","sources":["../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AAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACvC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAClD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxC,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAKF,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,gBAAgB,CAAC,2CAgN5D;yBAhNe,WAAW"}
|
|
@@ -63,7 +63,7 @@ export function SgAccordion(props) {
|
|
|
63
63
|
}, [controlled, items.length, multiple, onActiveIndexChange]);
|
|
64
64
|
const handleToggle = React.useCallback((index) => {
|
|
65
65
|
const item = items[index];
|
|
66
|
-
if (!item || item.
|
|
66
|
+
if (!item || (item.enabled === false))
|
|
67
67
|
return;
|
|
68
68
|
const isOpen = openSet.has(index);
|
|
69
69
|
if (isOpen && !collapsible)
|
|
@@ -84,14 +84,14 @@ export function SgAccordion(props) {
|
|
|
84
84
|
const headerId = `${baseId}-header-${item.id ?? index}`;
|
|
85
85
|
const contentId = `${baseId}-content-${item.id ?? index}`;
|
|
86
86
|
const resolvedHeaderBackground = item.headerBackgroundColor ?? headerBackgroundColor ?? DEFAULT_HEADER_BACKGROUND;
|
|
87
|
-
const sharedButtonClasses = cn("inline-flex items-center gap-2 text-left font-medium transition-[filter,colors] duration-150", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40", item.
|
|
87
|
+
const sharedButtonClasses = cn("inline-flex items-center gap-2 text-left font-medium transition-[filter,colors] duration-150", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40", (item.enabled === false) ? "cursor-not-allowed opacity-55" : "cursor-pointer hover:brightness-95");
|
|
88
88
|
return (_jsxs("div", { id: panelId, className: cn("border border-border bg-background", isHorizontal ? "flex min-w-0 overflow-hidden rounded-lg" : "overflow-hidden rounded-lg", panelClassName, item.className), style: isHorizontal
|
|
89
89
|
? {
|
|
90
90
|
minHeight,
|
|
91
91
|
flex: isOpen ? "1 1 0%" : "0 0 auto",
|
|
92
92
|
transition: `flex-basis ${animationDuration}ms ease`
|
|
93
93
|
}
|
|
94
|
-
: undefined, children: [_jsx("button", { id: headerId, type: "button", disabled: item.
|
|
94
|
+
: undefined, children: [_jsx("button", { id: headerId, type: "button", disabled: item.enabled === false, "aria-controls": contentId, "aria-expanded": isOpen, className: cn(sharedButtonClasses, isHorizontal
|
|
95
95
|
? "h-full flex-col justify-between border-r border-border px-2 py-3 text-[11px] uppercase tracking-wide"
|
|
96
96
|
: "w-full justify-between px-4 py-3 text-sm", headerClassName, item.headerClassName), style: isHorizontal
|
|
97
97
|
? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgBreadcrumb.d.ts","sourceRoot":"","sources":["../../src/layout/SgBreadcrumb.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;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AAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAsGF,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,2CAkL9D;yBAlLe,YAAY"}
|
|
@@ -43,7 +43,7 @@ function toDisplayTokens(items, overflowBehavior, maxItems) {
|
|
|
43
43
|
}
|
|
44
44
|
function renderActionItem(item, index, className, iconClassName, onNavigate) {
|
|
45
45
|
const content = (_jsxs(_Fragment, { children: [item.icon ? _jsx("span", { className: cn("inline-flex items-center justify-center", iconClassName), children: item.icon }) : null, _jsx("span", { className: "truncate", children: item.label })] }));
|
|
46
|
-
if (item.
|
|
46
|
+
if ((item.enabled === false)) {
|
|
47
47
|
return _jsx("span", { className: cn(className, "cursor-not-allowed opacity-45"), children: content });
|
|
48
48
|
}
|
|
49
49
|
if (item.href) {
|
package/dist/layout/SgCard.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type SgCardProps = Omit<React.HTMLAttributes<HTMLElement>, "title" | "onC
|
|
|
24
24
|
header?: React.ReactNode;
|
|
25
25
|
footer?: React.ReactNode;
|
|
26
26
|
clickable?: boolean;
|
|
27
|
-
|
|
27
|
+
enabled?: boolean;
|
|
28
28
|
collapsible?: boolean;
|
|
29
29
|
defaultOpen?: boolean;
|
|
30
30
|
open?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgCard.d.ts","sourceRoot":"","sources":["../../src/layout/SgCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;AACzE,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC5C,MAAM,MAAM,cAAc,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MA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