Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
fdb2a4e
Init Settings component
mrabbani Feb 14, 2026
b298fb2
refactor: enhance settings components with applyFilters support and i…
mrabbani Feb 14, 2026
171db6c
settings: fix select fields
mrabbani Feb 14, 2026
669aeb3
Settings: addrress subsection
mrabbani Feb 14, 2026
b2aebbd
refactor: unify label handling in settings components
mrabbani Feb 14, 2026
37e0ab6
feat: enhance settings context and components with page-specific func…
mrabbani Feb 14, 2026
080bfa3
feat: add customizable save button functionality to settings components
mrabbani Feb 14, 2026
940d22b
feat: improve save button functionality in settings components
mrabbani Feb 14, 2026
6a81a16
Add docs for settings
mrabbani Feb 14, 2026
4137cce
Cleanup pacakge.json
mrabbani Feb 14, 2026
208d386
feat: introduce ShowHideField and update RadioCapsuleField implementa…
Aunshon Feb 15, 2026
3c8464d
refactor: simplify layout structure in SettingsContent component
Aunshon Feb 15, 2026
8631106
feat: improve field layout support and enhance link styling in settings
Aunshon Feb 15, 2026
a4f1aaf
feat: enhance field layouts and add `doc_link_text` support in settings
Aunshon Feb 15, 2026
41e9cde
feat: enhance field layouts and add `doc_link_text` support in settings
Aunshon Feb 15, 2026
78cd404
refactor: update RadioGroup styles for improved hover and selection b…
Aunshon Feb 15, 2026
a361c51
feat: add product advertisement and request-for-quote settings in sto…
Aunshon Feb 15, 2026
0e4077e
enhance: improve styles and add descriptive properties in settings an…
Aunshon Feb 15, 2026
cd949f8
refactor: update settings field layout for better readability and spa…
Aunshon Feb 15, 2026
3da442d
Merge branch 'main' into feat/make-dokan-settings-components
Aunshon Feb 15, 2026
98a1cba
feat: add ColorPickerField component and integrate color picker suppo…
Aunshon Feb 15, 2026
f8e2602
feat: add NoticeField component and enhance ScrollArea customization
Aunshon Feb 16, 2026
905e635
feat: add CopyField and InfoField components to settings field renderer
Aunshon Feb 16, 2026
2ceb143
feat: add CopyInput component with Storybook examples
Aunshon Feb 16, 2026
b4f2216
feat: add dynamic icon rendering in FieldLabel and update settings st…
Aunshon Feb 16, 2026
b0ac9a7
feat: add AI Assist settings to Storybook
Aunshon Feb 16, 2026
0184dae
feat: update AI engine options and improve styles for settings compon…
Aunshon Feb 16, 2026
2263b8e
feat: add vendor settings pages and onboarding options to settings st…
Aunshon Feb 16, 2026
a4694b8
refactor: replace `<p>` with `<div>` for validation errors and wrap c…
Aunshon Feb 16, 2026
1707d79
feat: add RichTextField and enhance RichTextEditor functionality
Aunshon Feb 16, 2026
aa85c3e
feat: add support for startIcon and endIcon in fields and enhance set…
Aunshon Feb 16, 2026
6621d6d
feat: enhance subscription settings with tooltips, alerts, and email …
Aunshon Feb 16, 2026
cbc30cc
feat: add Google Analytics field support to settings
Aunshon Feb 16, 2026
23439ba
feat: add vendor verification settings to settings stories
Aunshon Feb 16, 2026
f65ac41
feat: add Transaction settings to settings stories
Aunshon Feb 16, 2026
24d44c4
feat: introduce CombineInput and add support for combined input field…
Aunshon Feb 16, 2026
55563e8
feat: introduce nested field rendering and `isNested` support
Aunshon Feb 16, 2026
2aa9efe
feat: enhance field rendering with isGroupParent support and nested l…
Aunshon Feb 16, 2026
374e8b2
feat: add Shipment settings to settings stories
Aunshon Feb 16, 2026
4e0207a
feat: add support for RadioIconCard and enhance radio group rendering
Aunshon Feb 16, 2026
0f89027
feat: add RadioImageCard and RadioIconCard examples to storybook
Aunshon Feb 16, 2026
eb2abb0
feat: add Compliance settings to settings stories
Aunshon Feb 16, 2026
0d2dd4f
feat: add `is_danger` support for settings fields and sections
Aunshon Feb 16, 2026
d05cf01
apearance added
Aunshon Feb 16, 2026
aad16c1
feat: enhance button and switch components with cursor pointer style
Aunshon Feb 17, 2026
c3396f6
feat: render `title` as RawHTML in settings components
Aunshon Feb 17, 2026
e570442
feat: add `PreviewMulticheckField` and integrate new preview variants
Aunshon Feb 17, 2026
aa32b93
feat: update preview variants to use `checkbox_group_preview` in sett…
Aunshon Feb 17, 2026
f4fd228
chore: update image URLs in `Settings.stories` to use CDN-hosted assets
Aunshon Feb 17, 2026
4507f48
feat: add documentation link text to settings components
Aunshon Feb 17, 2026
fb2a344
Merge branch 'main' into feat/make-dokan-settings-components
Aunshon Feb 19, 2026
d9b67fc
feat: add optional `image` prop to `LabeledCheckbox` and enhance desc…
Aunshon Feb 19, 2026
04eee81
refactor: improve type safety and conditional rendering across settin…
Aunshon Feb 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 21 additions & 54 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
"prepare": "npm run build"
},
"peerDependencies": {
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
"react": ">=17.0.0",
"react-dom": ">=17.0.0"
},
"dependencies": {
"@base-ui/react": "^1.1.0",
Expand Down
16,920 changes: 16,889 additions & 31 deletions src/components/settings/Settings.stories.tsx

Large diffs are not rendered by default.

109 changes: 108 additions & 1 deletion src/components/settings/field-renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@ import {
RadioCapsuleField,
CustomizeRadioField,
MulticheckField,
PreviewMulticheckField,
LabelField,
ShowHideField,
ColorPickerField,
HtmlField,
NoticeField,
FallbackField,
CopyField,
InfoField,
RichTextField,
GoogleAnalyticsField,
CombineInputField,
} from './fields';

// ============================================
Expand All @@ -21,7 +30,15 @@ import {
// e.g. @wordpress/hooks applyFilters or a custom function)
// ============================================

export function FieldRenderer({ element }: { element: SettingsElement }) {
export function FieldRenderer({
element,
isNested,
isGroupParent,
}: {
element: SettingsElement;
isNested?: boolean;
isGroupParent?: boolean;
}) {
const { values, updateValue, shouldDisplay, hookPrefix, errors, applyFilters } = useSettings();

// Check display status (dependency evaluation)
Expand All @@ -39,13 +56,39 @@ export function FieldRenderer({ element }: { element: SettingsElement }) {
const fieldProps: FieldComponentProps = {
element: mergedElement,
onChange: updateValue,
isNested,
isGroupParent,
};

const variant = element.variant || '';
const filterPrefix = hookPrefix || 'plugin_ui';

// Dispatch by variant — each wrapped with applyFilters
switch (variant) {
case 'switch_group': {
const isEnabled = element.enable_state
? mergedElement.value === element.enable_state.value
: Boolean(mergedElement.value);

const hasVisibleChildren = isEnabled && (element.children?.length ?? 0) > 0;

return applyFilters(
`${filterPrefix}_settings_switch_group_field`,
<div className="flex flex-col">
<SwitchField {...fieldProps} isGroupParent={hasVisibleChildren} />
{isEnabled && element.children?.map((child, index) => (
<FieldRenderer
key={child.id}
element={child}
isNested={true}
isGroupParent={index < (element.children?.length ?? 0) - 1}
/>
))}
</div>,
mergedElement
);
}

case 'text':
return applyFilters(
`${filterPrefix}_settings_text_field`,
Expand All @@ -67,6 +110,13 @@ export function FieldRenderer({ element }: { element: SettingsElement }) {
mergedElement
);

case 'rich_text':
return applyFilters(
`${filterPrefix}_settings_rich_text_field`,
<RichTextField {...fieldProps} />,
mergedElement
);

case 'select':
return applyFilters(
`${filterPrefix}_settings_select_field`,
Expand Down Expand Up @@ -95,6 +145,20 @@ export function FieldRenderer({ element }: { element: SettingsElement }) {
mergedElement
);

case 'google_analytics':
return applyFilters(
`${filterPrefix}_settings_google_analytics_field`,
<GoogleAnalyticsField {...fieldProps} />,
mergedElement
);

case 'combine_input':
return applyFilters(
`${filterPrefix}_settings_combine_input_field`,
<CombineInputField {...fieldProps} />,
mergedElement
);

case 'multicheck':
case 'checkbox_group':
return applyFilters(
Expand All @@ -103,20 +167,63 @@ export function FieldRenderer({ element }: { element: SettingsElement }) {
mergedElement
);

case 'checkbox_group_preview':
return applyFilters(
`${filterPrefix}_settings_preview_multicheck_field`,
<PreviewMulticheckField {...fieldProps} />,
mergedElement
);

case 'base_field_label':
return applyFilters(
`${filterPrefix}_settings_label_field`,
<LabelField {...fieldProps} />,
mergedElement
);

case 'show_hide':
return applyFilters(
`${filterPrefix}_settings_show_hide_field`,
<ShowHideField {...fieldProps} />,
mergedElement
);

case 'color_picker':
case 'select_color_picker':
return applyFilters(
`${filterPrefix}_settings_color_picker_field`,
<ColorPickerField {...fieldProps} />,
mergedElement
);

case 'html':
return applyFilters(
`${filterPrefix}_settings_html_field`,
<HtmlField {...fieldProps} />,
mergedElement
);

case 'notice':
return applyFilters(
`${filterPrefix}_settings_notice_field`,
<NoticeField {...fieldProps} />,
mergedElement
);

case 'copy_field':
return applyFilters(
`${filterPrefix}_settings_copy_field`,
<CopyField {...fieldProps} />,
mergedElement
);

case 'info':
return applyFilters(
`${filterPrefix}_settings_info_field`,
<InfoField {...fieldProps} />,
mergedElement
);

default:
// Unknown variant — consumer must handle via applyFilters
return applyFilters(
Expand Down
Loading