Skip to content

Commit

Permalink
docs(Value.Currency): improve documented properties (#4022)
Browse files Browse the repository at this point in the history
Follow-up to
#4008 (comment)

As of now docs looks like the following([deploy
preview](https://eufemia-dnb-design-system-portal.vercel.app/uilib/extensions/forms/Value/Currency/properties/)
of release
[v10.51](#4012)):

This PR will change it to be looking like this([deploy
preview](https://eufemia-git-docs-improve-value-currency-docs-eufemia.vercel.app/uilib/extensions/forms/Value/Currency/properties/)
this PR).

TODO:

- [x] Decide which props we want to display under [Value-specific
properties](https://eufemia-git-docs-improve-value-currency-docs-eufemia.vercel.app/uilib/extensions/forms/Value/Currency/properties/#value-specific-properties)

---------

Co-authored-by: Tobias Høegh <tobias@tujo.no>
  • Loading branch information
langz and tujoworker authored Sep 30, 2024
1 parent e889b8c commit d392901
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import PropertiesTable from 'dnb-design-system-portal/src/shared/parts/Propertie
import { CurrencyValueProperties } from '@dnb/eufemia/src/extensions/forms/Value/Currency/CurrencyDocs'
import { ValueProperties } from '@dnb/eufemia/src/extensions/forms/Value/ValueDocs'

## Properties

### Value-specific properties
## Value-specific properties

<PropertiesTable props={CurrencyValueProperties} />

### General properties
## General properties

<PropertiesTable
props={ValueProperties}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ export const NumberFormatProperties: PropertiesTableProps = {
type: 'number',
status: 'required',
},
srLabel: {
doc: 'Will add a visually hidden label, to give screen reader users the missing context to easier understand what the number represents.',
type: 'string',
status: 'optional',
},
locale: {
doc: 'Use a [2 Letter Language Code](https://www.sitepoint.com/iso-2-letter-language-codes/) or an extended code such as `nb-NO`. Use `auto` to detect the locale from the browser (`navigator.language`). Defaults to the Norwegian locale: `nb-NO`.',
type: 'string',
Expand All @@ -22,11 +17,6 @@ export const NumberFormatProperties: PropertiesTableProps = {
type: ['boolean', 'string'],
status: 'optional',
},
clean: {
doc: 'If set to `true` a dirty string will be parsed to extract the number (`prefix -123.45 suffix` would result in e.g. `kr -123,45`).',
type: 'boolean',
status: 'optional',
},
currency: {
doc: 'Currency code (ISO 4217) or `true` to use the default `NOK`. Uses two decimals by default.',
type: ['string', 'boolean'],
Expand Down Expand Up @@ -92,6 +82,11 @@ export const NumberFormatProperties: PropertiesTableProps = {
type: 'React.Node',
status: 'optional',
},
srLabel: {
doc: 'Will add a visually hidden label, to give screen reader users the missing context to easier understand what the number represents.',
type: 'string',
status: 'optional',
},
selectall: {
doc: 'Use `false` to disable the auto select all on the first click. Defaults to `true`.',
type: 'boolean',
Expand All @@ -112,6 +107,11 @@ export const NumberFormatProperties: PropertiesTableProps = {
type: 'boolean',
status: 'optional',
},
clean: {
doc: 'If set to `true` a dirty string will be parsed to extract the number (`prefix -123.45 suffix` would result in e.g. `kr -123,45`).',
type: 'boolean',
status: 'optional',
},
link: {
doc: 'Use `tel` or `sms` to enable a clickable / touchable anchor link.',
type: 'string',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ import { PropertiesTableProps } from '../../../../shared/types'
import { NumberProperties } from '../Number/NumberDocs'

export const CurrencyValueProperties: PropertiesTableProps = {
value: NumberProperties.value,
currency: NumberProperties.currency,
currencyDisplay: NumberProperties.currencyDisplay,
currencyPosition: NumberProperties.currencyPosition,
...NumberProperties,
currency: {
doc: 'Currency code (ISO 4217) or `true` to use the default `NOK`, which use two decimals by default. Defaults to value `NOK`.',
type: ['string', 'boolean'],
status: 'optional',
},
ban: undefined,
nin: undefined,
org: undefined,
percent: undefined,
phone: undefined,
link: undefined,
omitRounding: undefined,
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { PropertiesTableProps } from '../../../../shared/types'
import { NumberFormatPropertiesCamelCase } from '../../../../components/number-format/NumberFormatDocs'

export const NumberProperties: PropertiesTableProps = {
...NumberFormatPropertiesCamelCase,
value: NumberFormatPropertiesCamelCase.value,
minimum: {
doc: 'Defines the minimum value of the rendered number. Defaults to `Number.MIN_SAFE_INTEGER`.',
type: 'number',
Expand All @@ -13,4 +13,5 @@ export const NumberProperties: PropertiesTableProps = {
type: 'number',
status: 'optional',
},
...NumberFormatPropertiesCamelCase,
}

0 comments on commit d392901

Please sign in to comment.